aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2019-01-09 19:02:25 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2019-01-09 19:02:25 +0800
commitea14913b412e78ff458bdfba47182f7363e776e5 (patch)
tree3ee220bfbbd9923b5e1adc36ee51f9b5d39ad640
parent5868c91cfb54cfa9177572b201d88d1168bf5b06 (diff)
parent5dd55491b86bf8577405e37d0f2d668aa1273b10 (diff)
downloaddexon-sol-tools-ea14913b412e78ff458bdfba47182f7363e776e5.tar
dexon-sol-tools-ea14913b412e78ff458bdfba47182f7363e776e5.tar.gz
dexon-sol-tools-ea14913b412e78ff458bdfba47182f7363e776e5.tar.bz2
dexon-sol-tools-ea14913b412e78ff458bdfba47182f7363e776e5.tar.lz
dexon-sol-tools-ea14913b412e78ff458bdfba47182f7363e776e5.tar.xz
dexon-sol-tools-ea14913b412e78ff458bdfba47182f7363e776e5.tar.zst
dexon-sol-tools-ea14913b412e78ff458bdfba47182f7363e776e5.zip
Merge development
-rw-r--r--.circleci/config.yml88
-rw-r--r--.github/autolabeler.yml39
-rw-r--r--.github/stale.yml19
-rw-r--r--.gitignore22
-rw-r--r--.prettierignore23
-rw-r--r--CODEOWNERS4
-rw-r--r--CONTRIBUTING.md15
-rw-r--r--PULL_REQUEST_TEMPLATE.md1
-rw-r--r--README.md132
-rw-r--r--contracts/.solhint.json21
-rw-r--r--contracts/TESTING.md48
-rw-r--r--contracts/examples/CHANGELOG.json11
-rw-r--r--contracts/examples/CHANGELOG.md10
-rw-r--r--contracts/examples/README.md56
-rw-r--r--contracts/examples/compiler.json22
-rw-r--r--contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol100
-rw-r--r--contracts/examples/contracts/Validator/Validator.sol56
-rw-r--r--contracts/examples/contracts/Wallet/Wallet.sol65
-rw-r--r--contracts/examples/contracts/Whitelist/Whitelist.sol136
-rw-r--r--contracts/examples/package.json83
-rw-r--r--contracts/examples/src/artifacts/index.ts13
-rw-r--r--contracts/examples/src/index.ts2
-rw-r--r--contracts/examples/src/wrappers/index.ts4
-rw-r--r--contracts/examples/tsconfig.json16
-rw-r--r--contracts/examples/tslint.json (renamed from packages/contracts/tslint.json)0
-rw-r--r--contracts/extensions/CHANGELOG.json37
-rw-r--r--contracts/extensions/CHANGELOG.md10
-rw-r--r--contracts/extensions/DEPLOYS.json31
-rw-r--r--contracts/extensions/README.md69
-rw-r--r--contracts/extensions/compiler.json22
-rw-r--r--contracts/extensions/contracts/BalanceThresholdFilter/BalanceThresholdFilter.sol45
-rw-r--r--contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol135
-rw-r--r--contracts/extensions/contracts/BalanceThresholdFilter/MixinExchangeCalldata.sol103
-rw-r--r--contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IBalanceThresholdFilterCore.sol55
-rw-r--r--contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IThresholdAsset.sol31
-rw-r--r--contracts/extensions/contracts/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol54
-rw-r--r--contracts/extensions/contracts/BalanceThresholdFilter/mixins/MExchangeCalldata.sol56
-rw-r--r--contracts/extensions/contracts/DutchAuction/DutchAuction.sol205
-rw-r--r--contracts/extensions/contracts/Forwarder/Forwarder.sol (renamed from packages/contracts/contracts/extensions/Forwarder/Forwarder.sol)0
-rw-r--r--contracts/extensions/contracts/Forwarder/MixinAssets.sol143
-rw-r--r--contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol260
-rw-r--r--contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol214
-rw-r--r--contracts/extensions/contracts/Forwarder/MixinWeth.sol113
-rw-r--r--contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol34
-rw-r--r--contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol30
-rw-r--r--contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol80
-rw-r--r--contracts/extensions/contracts/Forwarder/libs/LibConstants.sol62
-rw-r--r--contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol34
-rw-r--r--contracts/extensions/contracts/Forwarder/mixins/MAssets.sol53
-rw-r--r--contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol87
-rw-r--r--contracts/extensions/contracts/Forwarder/mixins/MWeth.sol41
-rw-r--r--contracts/extensions/contracts/OrderMatcher/MixinAssets.sol195
-rw-r--r--contracts/extensions/contracts/OrderMatcher/MixinMatchOrders.sol86
-rw-r--r--contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol38
-rw-r--r--contracts/extensions/contracts/OrderMatcher/interfaces/IAssets.sol43
-rw-r--r--contracts/extensions/contracts/OrderMatcher/interfaces/IMatchOrders.sol43
-rw-r--r--contracts/extensions/contracts/OrderMatcher/interfaces/IOrderMatcher.sol31
-rw-r--r--contracts/extensions/contracts/OrderMatcher/libs/LibConstants.sol56
-rw-r--r--contracts/extensions/contracts/OrderMatcher/mixins/MAssets.sol71
-rw-r--r--contracts/extensions/contracts/OrderValidator/OrderValidator.sol218
-rw-r--r--contracts/extensions/package.json95
-rw-r--r--contracts/extensions/src/artifacts/index.ts15
-rw-r--r--contracts/extensions/src/index.ts2
-rw-r--r--contracts/extensions/src/wrappers/index.ts5
-rw-r--r--contracts/extensions/test/extensions/balance_threshold_filter.ts1644
-rw-r--r--contracts/extensions/test/extensions/dutch_auction.ts378
-rw-r--r--contracts/extensions/test/extensions/forwarder.ts1291
-rw-r--r--contracts/extensions/test/extensions/order_matcher.ts818
-rw-r--r--contracts/extensions/test/extensions/order_validator.ts609
-rw-r--r--contracts/extensions/test/global_hooks.ts17
-rw-r--r--contracts/extensions/test/utils/balance_threshold_wrapper.ts283
-rw-r--r--contracts/extensions/test/utils/dutch_auction_test_wrapper.ts62
-rw-r--r--contracts/extensions/test/utils/forwarder_wrapper.ts124
-rw-r--r--contracts/extensions/tsconfig.json17
-rw-r--r--contracts/extensions/tslint.json6
-rw-r--r--contracts/interfaces/CHANGELOG.json11
-rw-r--r--contracts/interfaces/CHANGELOG.md10
-rw-r--r--contracts/interfaces/README.md72
-rw-r--r--contracts/interfaces/compiler.json35
-rw-r--r--contracts/interfaces/contracts/protocol/AssetProxy/IAssetData.sol44
-rw-r--r--contracts/interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol46
-rw-r--r--contracts/interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol52
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol37
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IExchange.sol38
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IExchangeCore.sol60
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IMatchOrders.sol44
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/ISignatureValidator.sol57
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/ITransactions.sol35
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IValidator.sol37
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IWallet.sol35
-rw-r--r--contracts/interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol160
-rw-r--r--contracts/interfaces/package.json57
-rw-r--r--contracts/interfaces/src/artifacts/index.ts29
-rw-r--r--contracts/interfaces/src/index.ts2
-rw-r--r--contracts/interfaces/src/wrappers/index.ts12
-rw-r--r--contracts/interfaces/tsconfig.json24
-rw-r--r--contracts/interfaces/tslint.json6
-rw-r--r--contracts/libs/CHANGELOG.json11
-rw-r--r--contracts/libs/CHANGELOG.md10
-rw-r--r--contracts/libs/README.md70
-rw-r--r--contracts/libs/compiler.json31
-rw-r--r--contracts/libs/contracts/libs/LibAbiEncoder.sol215
-rw-r--r--contracts/libs/contracts/libs/LibAddressArray.sol84
-rw-r--r--contracts/libs/contracts/libs/LibAssetProxyErrors.sol38
-rw-r--r--contracts/libs/contracts/libs/LibConstants.sol49
-rw-r--r--contracts/libs/contracts/libs/LibEIP712.sol87
-rw-r--r--contracts/libs/contracts/libs/LibExchangeErrors.sol70
-rw-r--r--contracts/libs/contracts/libs/LibExchangeSelectors.sol152
-rw-r--r--contracts/libs/contracts/libs/LibFillResults.sol53
-rw-r--r--contracts/libs/contracts/libs/LibMath.sol253
-rw-r--r--contracts/libs/contracts/libs/LibOrder.sol145
-rw-r--r--contracts/libs/contracts/test/TestLibs/TestLibs.sol152
-rw-r--r--contracts/libs/package.json91
-rw-r--r--contracts/libs/src/artifacts/index.ts17
-rw-r--r--contracts/libs/src/index.ts2
-rw-r--r--contracts/libs/src/wrappers/index.ts6
-rw-r--r--contracts/libs/test/exchange/libs.ts125
-rw-r--r--contracts/libs/test/global_hooks.ts17
-rw-r--r--contracts/libs/tsconfig.json18
-rw-r--r--contracts/libs/tslint.json6
-rw-r--r--contracts/multisig/CHANGELOG.json11
-rw-r--r--contracts/multisig/CHANGELOG.md10
-rw-r--r--contracts/multisig/README.md70
-rw-r--r--contracts/multisig/compiler.json22
-rw-r--r--contracts/multisig/contracts/multisig/MultiSigWallet.sol (renamed from packages/contracts/contracts/multisig/MultiSigWallet.sol)0
-rw-r--r--contracts/multisig/contracts/multisig/MultiSigWalletWithTimeLock.sol (renamed from packages/contracts/contracts/multisig/MultiSigWalletWithTimeLock.sol)0
-rw-r--r--contracts/multisig/contracts/test/TestRejectEther/TestRejectEther.sol23
-rw-r--r--contracts/multisig/package.json86
-rw-r--r--contracts/multisig/src/artifacts/index.ts11
-rw-r--r--contracts/multisig/src/index.ts2
-rw-r--r--contracts/multisig/src/wrappers/index.ts2
-rw-r--r--contracts/multisig/test/global_hooks.ts19
-rw-r--r--contracts/multisig/test/multi_sig_with_time_lock.ts349
-rw-r--r--contracts/multisig/test/utils/multi_sig_wrapper.ts54
-rw-r--r--contracts/multisig/tsconfig.json15
-rw-r--r--contracts/multisig/tslint.json6
-rw-r--r--contracts/protocol/CHANGELOG.json28
-rw-r--r--contracts/protocol/CHANGELOG.md10
-rw-r--r--contracts/protocol/DEPLOYS.json92
-rw-r--r--contracts/protocol/README.md74
-rw-r--r--contracts/protocol/compiler.json34
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol (renamed from packages/contracts/contracts/protocol/AssetProxy/ERC20Proxy.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol (renamed from packages/contracts/contracts/protocol/AssetProxy/ERC721Proxy.sol)0
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol117
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol306
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol41
-rw-r--r--contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol108
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/Exchange.sol53
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol174
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol529
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol335
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol324
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol152
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol426
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol45
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol157
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol58
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol75
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol58
-rw-r--r--contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol41
-rw-r--r--contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol (renamed from packages/contracts/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol)0
-rw-r--r--contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol (renamed from packages/contracts/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol)0
-rw-r--r--contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol (renamed from packages/contracts/contracts/test/TestExchangeInternals/TestExchangeInternals.sol)0
-rw-r--r--contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol (renamed from packages/contracts/contracts/test/TestSignatureValidator/TestSignatureValidator.sol)0
-rw-r--r--contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol81
-rw-r--r--contracts/protocol/package.json95
-rw-r--r--contracts/protocol/src/artifacts/index.ts27
-rw-r--r--contracts/protocol/src/index.ts3
-rw-r--r--contracts/protocol/src/wrappers/index.ts10
-rw-r--r--contracts/protocol/test/asset_proxy/authorizable.ts211
-rw-r--r--contracts/protocol/test/asset_proxy/proxies.ts1285
-rw-r--r--contracts/protocol/test/exchange/core.ts1157
-rw-r--r--contracts/protocol/test/exchange/dispatcher.ts284
-rw-r--r--contracts/protocol/test/exchange/fill_order.ts314
-rw-r--r--contracts/protocol/test/exchange/internal.ts472
-rw-r--r--contracts/protocol/test/exchange/match_orders.ts1284
-rw-r--r--contracts/protocol/test/exchange/signature_validator.ts526
-rw-r--r--contracts/protocol/test/exchange/transactions.ts466
-rw-r--r--contracts/protocol/test/exchange/wrapper.ts1461
-rw-r--r--contracts/protocol/test/global_hooks.ts17
-rw-r--r--contracts/protocol/test/multisig/asset_proxy_owner.ts506
-rw-r--r--contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts70
-rw-r--r--contracts/protocol/test/utils/asset_wrapper.ts222
-rw-r--r--contracts/protocol/test/utils/erc20_wrapper.ts179
-rw-r--r--contracts/protocol/test/utils/erc721_wrapper.ts236
-rw-r--r--contracts/protocol/test/utils/exchange_wrapper.ts281
-rw-r--r--contracts/protocol/test/utils/fill_order_combinatorial_utils.ts928
-rw-r--r--contracts/protocol/test/utils/index.ts3
-rw-r--r--contracts/protocol/test/utils/match_order_tester.ts562
-rw-r--r--contracts/protocol/test/utils/order_factory_from_scenario.ts294
-rw-r--r--contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts (renamed from packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts)0
-rw-r--r--contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts (renamed from packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts)0
-rw-r--r--contracts/protocol/tsconfig.json23
-rw-r--r--contracts/protocol/tslint.json6
-rw-r--r--contracts/test-utils/CHANGELOG.json11
-rw-r--r--contracts/test-utils/CHANGELOG.md10
-rw-r--r--contracts/test-utils/README.md73
-rw-r--r--contracts/test-utils/package.json75
-rw-r--r--contracts/test-utils/src/abstract_asset_wrapper.ts (renamed from packages/contracts/test/utils/abstract_asset_wrapper.ts)0
-rw-r--r--contracts/test-utils/src/address_utils.ts (renamed from packages/contracts/test/utils/address_utils.ts)0
-rw-r--r--contracts/test-utils/src/assertions.ts199
-rw-r--r--contracts/test-utils/src/block_timestamp.ts (renamed from packages/contracts/test/utils/block_timestamp.ts)0
-rw-r--r--contracts/test-utils/src/chai_setup.ts (renamed from packages/contracts/test/utils/chai_setup.ts)0
-rw-r--r--contracts/test-utils/src/combinatorial_utils.ts (renamed from packages/contracts/test/utils/combinatorial_utils.ts)0
-rw-r--r--contracts/test-utils/src/constants.ts68
-rw-r--r--contracts/test-utils/src/coverage.ts (renamed from packages/contracts/test/utils/coverage.ts)0
-rw-r--r--contracts/test-utils/src/formatters.ts (renamed from packages/contracts/test/utils/formatters.ts)0
-rw-r--r--contracts/test-utils/src/global_hooks.ts15
-rw-r--r--contracts/test-utils/src/index.ts55
-rw-r--r--contracts/test-utils/src/log_decoder.ts51
-rw-r--r--contracts/test-utils/src/order_factory.ts (renamed from packages/contracts/test/utils/order_factory.ts)0
-rw-r--r--contracts/test-utils/src/order_utils.ts (renamed from packages/contracts/test/utils/order_utils.ts)0
-rw-r--r--contracts/test-utils/src/profiler.ts (renamed from packages/contracts/test/utils/profiler.ts)0
-rw-r--r--contracts/test-utils/src/revert_trace.ts (renamed from packages/contracts/test/utils/revert_trace.ts)0
-rw-r--r--contracts/test-utils/src/signing_utils.ts (renamed from packages/contracts/test/utils/signing_utils.ts)0
-rw-r--r--contracts/test-utils/src/test_with_reference.ts139
-rw-r--r--contracts/test-utils/src/transaction_factory.ts (renamed from packages/contracts/test/utils/transaction_factory.ts)0
-rw-r--r--contracts/test-utils/src/type_encoding_utils.ts (renamed from packages/contracts/test/utils/type_encoding_utils.ts)0
-rw-r--r--contracts/test-utils/src/types.ts243
-rw-r--r--contracts/test-utils/src/web3_wrapper.ts85
-rw-r--r--contracts/test-utils/test/test_with_reference.ts63
-rw-r--r--contracts/test-utils/tsconfig.json7
-rw-r--r--contracts/test-utils/tsconfig.lint.json7
-rw-r--r--contracts/test-utils/tslint.json6
-rw-r--r--contracts/tokens/.solhintignore (renamed from packages/contracts/.solhintignore)0
-rw-r--r--contracts/tokens/CHANGELOG.json11
-rw-r--r--contracts/tokens/CHANGELOG.md10
-rw-r--r--contracts/tokens/DEPLOYS.json16
-rw-r--r--contracts/tokens/README.md74
-rw-r--r--contracts/tokens/compiler.json44
-rw-r--r--contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol77
-rw-r--r--contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol (renamed from packages/contracts/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol (renamed from packages/contracts/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol (renamed from packages/contracts/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol (renamed from packages/contracts/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol)0
-rw-r--r--contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol63
-rw-r--r--contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol188
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/ERC20Token.sol148
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol87
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol60
-rw-r--r--contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol70
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol277
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol44
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol158
-rw-r--r--contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol82
-rw-r--r--contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol33
-rw-r--r--contracts/tokens/contracts/tokens/EtherToken/WETH9.sol (renamed from packages/contracts/contracts/tokens/EtherToken/WETH9.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol (renamed from packages/contracts/contracts/tokens/ZRXToken/ERC20Token_v1.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol (renamed from packages/contracts/contracts/tokens/ZRXToken/Token_v1.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol (renamed from packages/contracts/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol)0
-rw-r--r--contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol (renamed from packages/contracts/contracts/tokens/ZRXToken/ZRXToken.sol)0
-rw-r--r--contracts/tokens/package.json93
-rw-r--r--contracts/tokens/src/artifacts/index.ts50
-rw-r--r--contracts/tokens/src/index.ts2
-rw-r--r--contracts/tokens/src/wrappers/index.ts21
-rw-r--r--contracts/tokens/test/erc721_token.ts282
-rw-r--r--contracts/tokens/test/global_hooks.ts17
-rw-r--r--contracts/tokens/test/unlimited_allowance_token.ts194
-rw-r--r--contracts/tokens/test/weth9.ts142
-rw-r--r--contracts/tokens/test/zrx_token.ts203
-rw-r--r--contracts/tokens/tsconfig.json33
-rw-r--r--contracts/tokens/tslint.json6
-rw-r--r--contracts/utils/CHANGELOG.json11
-rw-r--r--contracts/utils/CHANGELOG.md10
-rw-r--r--contracts/utils/README.md70
-rw-r--r--contracts/utils/compiler.json22
-rw-r--r--contracts/utils/contracts/test/TestConstants/TestConstants.sol57
-rw-r--r--contracts/utils/contracts/test/TestLibBytes/TestLibBytes.sol269
-rw-r--r--contracts/utils/contracts/utils/LibBytes/LibBytes.sol567
-rw-r--r--contracts/utils/contracts/utils/Ownable/IOwnable.sol8
-rw-r--r--contracts/utils/contracts/utils/Ownable/Ownable.sol33
-rw-r--r--contracts/utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol45
-rw-r--r--contracts/utils/contracts/utils/SafeMath/SafeMath.sol87
-rw-r--r--contracts/utils/package.json89
-rw-r--r--contracts/utils/src/artifacts/index.ts19
-rw-r--r--contracts/utils/src/index.ts2
-rw-r--r--contracts/utils/src/wrappers/index.ts2
-rw-r--r--contracts/utils/test/global_hooks.ts17
-rw-r--r--contracts/utils/test/lib_bytes.ts875
-rw-r--r--contracts/utils/test/libs.ts34
-rw-r--r--contracts/utils/tsconfig.json19
-rw-r--r--contracts/utils/tslint.json6
-rw-r--r--lerna.json2
-rw-r--r--package.json15
-rw-r--r--packages/0x.js/.npmignore2
-rw-r--r--packages/0x.js/CHANGELOG.json46
-rw-r--r--packages/0x.js/CHANGELOG.md16
-rw-r--r--packages/0x.js/package.json35
-rw-r--r--packages/0x.js/src/index.ts7
-rw-r--r--packages/abi-gen-templates/CHANGELOG.json20
-rw-r--r--packages/abi-gen-templates/CHANGELOG.md14
-rw-r--r--packages/abi-gen-templates/README.md (renamed from packages/contract_templates/README.md)0
-rw-r--r--packages/abi-gen-templates/contract.handlebars91
-rw-r--r--packages/abi-gen-templates/package.json20
-rw-r--r--packages/abi-gen-templates/partials/call.handlebars (renamed from packages/contract_templates/partials/call.handlebars)0
-rw-r--r--packages/abi-gen-templates/partials/callAsync.handlebars (renamed from packages/contract_templates/partials/callAsync.handlebars)0
-rw-r--r--packages/abi-gen-templates/partials/event.handlebars (renamed from packages/contract_templates/partials/event.handlebars)0
-rw-r--r--packages/abi-gen-templates/partials/params.handlebars (renamed from packages/contract_templates/partials/params.handlebars)0
-rw-r--r--packages/abi-gen-templates/partials/return_type.handlebars (renamed from packages/contract_templates/partials/return_type.handlebars)0
-rw-r--r--packages/abi-gen-templates/partials/tx.handlebars (renamed from packages/contract_templates/partials/tx.handlebars)0
-rw-r--r--packages/abi-gen-templates/partials/typed_params.handlebars (renamed from packages/contract_templates/partials/typed_params.handlebars)0
-rw-r--r--packages/abi-gen-wrappers/CHANGELOG.json48
-rw-r--r--packages/abi-gen-wrappers/CHANGELOG.md16
-rw-r--r--packages/abi-gen-wrappers/package.json20
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts322
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts20
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts3
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts3
-rw-r--r--packages/abi-gen-wrappers/src/index.ts1
-rw-r--r--packages/abi-gen/CHANGELOG.json27
-rw-r--r--packages/abi-gen/CHANGELOG.md12
-rw-r--r--packages/abi-gen/README.md4
-rw-r--r--packages/abi-gen/package.json10
-rw-r--r--packages/assert/CHANGELOG.json27
-rw-r--r--packages/assert/CHANGELOG.md12
-rw-r--r--packages/assert/package.json10
-rw-r--r--packages/asset-buyer/CHANGELOG.json30
-rw-r--r--packages/asset-buyer/CHANGELOG.md16
-rw-r--r--packages/asset-buyer/README.md2
-rw-r--r--packages/asset-buyer/package.json26
-rw-r--r--packages/asset-buyer/src/order_providers/standard_relayer_api_order_provider.ts8
-rw-r--r--packages/base-contract/CHANGELOG.json36
-rw-r--r--packages/base-contract/CHANGELOG.md16
-rw-r--r--packages/base-contract/package.json12
-rw-r--r--packages/connect/CHANGELOG.json36
-rw-r--r--packages/connect/CHANGELOG.md16
-rw-r--r--packages/connect/package.json16
-rw-r--r--packages/contract-addresses/CHANGELOG.json26
-rw-r--r--packages/contract-addresses/CHANGELOG.md9
-rw-r--r--packages/contract-addresses/package.json2
-rw-r--r--packages/contract-addresses/src/index.ts35
-rw-r--r--packages/contract-artifacts/CHANGELOG.json19
-rw-r--r--packages/contract-artifacts/CHANGELOG.md4
-rw-r--r--packages/contract-artifacts/artifacts/DutchAuction.json310
-rw-r--r--packages/contract-artifacts/artifacts/Exchange.json9
-rw-r--r--packages/contract-artifacts/package.json2
-rw-r--r--packages/contract-artifacts/src/index.ts2
-rw-r--r--packages/contract-artifacts/tsconfig.json1
-rw-r--r--packages/contract-wrappers/.npmignore2
-rw-r--r--packages/contract-wrappers/CHANGELOG.json51
-rw-r--r--packages/contract-wrappers/CHANGELOG.md16
-rw-r--r--packages/contract-wrappers/package.json36
-rw-r--r--packages/contract-wrappers/src/contract_wrappers.ts10
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/dutch_auction_wrapper.ts182
-rw-r--r--packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts74
-rw-r--r--packages/contract-wrappers/src/index.ts15
-rw-r--r--packages/contract-wrappers/src/types.ts12
-rw-r--r--packages/contract-wrappers/src/utils/constants.ts3
-rw-r--r--packages/contract-wrappers/src/utils/decorators.ts5
-rw-r--r--packages/contract-wrappers/test/dutch_auction_wrapper_test.ts128
-rw-r--r--packages/contract-wrappers/test/utils/dutch_auction_utils.ts153
-rw-r--r--packages/contract_templates/contract.handlebars90
-rw-r--r--packages/contracts/.solhint.json20
-rw-r--r--packages/contracts/CHANGELOG.json115
-rw-r--r--packages/contracts/README.md129
-rw-r--r--packages/contracts/compiler.json59
-rw-r--r--packages/contracts/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol100
-rw-r--r--packages/contracts/contracts/examples/Validator/Validator.sol56
-rw-r--r--packages/contracts/contracts/examples/Wallet/Wallet.sol65
-rw-r--r--packages/contracts/contracts/examples/Whitelist/Whitelist.sol136
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/MixinAssets.sol143
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/MixinExchangeWrapper.sol260
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/MixinForwarderCore.sol214
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/MixinWeth.sol113
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/interfaces/IAssets.sol34
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarder.sol30
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol80
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/libs/LibConstants.sol62
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol34
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/mixins/MAssets.sol53
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol87
-rw-r--r--packages/contracts/contracts/extensions/Forwarder/mixins/MWeth.sol41
-rw-r--r--packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol218
-rw-r--r--packages/contracts/contracts/protocol/AssetProxy/MixinAuthorizable.sol117
-rw-r--r--packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetData.sol40
-rw-r--r--packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetProxy.sol46
-rw-r--r--packages/contracts/contracts/protocol/AssetProxy/interfaces/IAuthorizable.sol52
-rw-r--r--packages/contracts/contracts/protocol/AssetProxy/libs/LibAssetProxyErrors.sol38
-rw-r--r--packages/contracts/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol41
-rw-r--r--packages/contracts/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol108
-rw-r--r--packages/contracts/contracts/protocol/Exchange/Exchange.sol53
-rw-r--r--packages/contracts/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol174
-rw-r--r--packages/contracts/contracts/protocol/Exchange/MixinExchangeCore.sol529
-rw-r--r--packages/contracts/contracts/protocol/Exchange/MixinMatchOrders.sol335
-rw-r--r--packages/contracts/contracts/protocol/Exchange/MixinSignatureValidator.sol324
-rw-r--r--packages/contracts/contracts/protocol/Exchange/MixinTransactions.sol152
-rw-r--r--packages/contracts/contracts/protocol/Exchange/MixinWrapperFunctions.sol426
-rw-r--r--packages/contracts/contracts/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol37
-rw-r--r--packages/contracts/contracts/protocol/Exchange/interfaces/IExchange.sol38
-rw-r--r--packages/contracts/contracts/protocol/Exchange/interfaces/IExchangeCore.sol60
-rw-r--r--packages/contracts/contracts/protocol/Exchange/interfaces/IMatchOrders.sol44
-rw-r--r--packages/contracts/contracts/protocol/Exchange/interfaces/ISignatureValidator.sol57
-rw-r--r--packages/contracts/contracts/protocol/Exchange/interfaces/ITransactions.sol35
-rw-r--r--packages/contracts/contracts/protocol/Exchange/interfaces/IValidator.sol37
-rw-r--r--packages/contracts/contracts/protocol/Exchange/interfaces/IWallet.sol35
-rw-r--r--packages/contracts/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol160
-rw-r--r--packages/contracts/contracts/protocol/Exchange/libs/LibAbiEncoder.sol215
-rw-r--r--packages/contracts/contracts/protocol/Exchange/libs/LibConstants.sol49
-rw-r--r--packages/contracts/contracts/protocol/Exchange/libs/LibEIP712.sol87
-rw-r--r--packages/contracts/contracts/protocol/Exchange/libs/LibExchangeErrors.sol70
-rw-r--r--packages/contracts/contracts/protocol/Exchange/libs/LibFillResults.sol53
-rw-r--r--packages/contracts/contracts/protocol/Exchange/libs/LibMath.sol253
-rw-r--r--packages/contracts/contracts/protocol/Exchange/libs/LibOrder.sol145
-rw-r--r--packages/contracts/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol45
-rw-r--r--packages/contracts/contracts/protocol/Exchange/mixins/MExchangeCore.sol157
-rw-r--r--packages/contracts/contracts/protocol/Exchange/mixins/MMatchOrders.sol58
-rw-r--r--packages/contracts/contracts/protocol/Exchange/mixins/MSignatureValidator.sol75
-rw-r--r--packages/contracts/contracts/protocol/Exchange/mixins/MTransactions.sol58
-rw-r--r--packages/contracts/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol41
-rw-r--r--packages/contracts/contracts/test/DummyERC20Token/DummyERC20Token.sol77
-rw-r--r--packages/contracts/contracts/test/DummyERC721Token/DummyERC721Token.sol63
-rw-r--r--packages/contracts/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol188
-rw-r--r--packages/contracts/contracts/test/TestConstants/TestConstants.sol57
-rw-r--r--packages/contracts/contracts/test/TestLibBytes/TestLibBytes.sol269
-rw-r--r--packages/contracts/contracts/test/TestLibs/TestLibs.sol152
-rw-r--r--packages/contracts/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol81
-rw-r--r--packages/contracts/contracts/tokens/ERC20Token/ERC20Token.sol148
-rw-r--r--packages/contracts/contracts/tokens/ERC20Token/IERC20Token.sol87
-rw-r--r--packages/contracts/contracts/tokens/ERC20Token/MintableERC20Token.sol60
-rw-r--r--packages/contracts/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol70
-rw-r--r--packages/contracts/contracts/tokens/ERC721Token/ERC721Token.sol277
-rw-r--r--packages/contracts/contracts/tokens/ERC721Token/IERC721Receiver.sol44
-rw-r--r--packages/contracts/contracts/tokens/ERC721Token/IERC721Token.sol158
-rw-r--r--packages/contracts/contracts/tokens/ERC721Token/MintableERC721Token.sol82
-rw-r--r--packages/contracts/contracts/tokens/EtherToken/IEtherToken.sol33
-rw-r--r--packages/contracts/contracts/utils/LibBytes/LibBytes.sol567
-rw-r--r--packages/contracts/contracts/utils/Ownable/IOwnable.sol8
-rw-r--r--packages/contracts/contracts/utils/Ownable/Ownable.sol33
-rw-r--r--packages/contracts/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol45
-rw-r--r--packages/contracts/contracts/utils/SafeMath/SafeMath.sol87
-rw-r--r--packages/contracts/generated-artifacts/AssetProxyOwner.json748
-rw-r--r--packages/contracts/generated-artifacts/DummyERC20Token.json393
-rw-r--r--packages/contracts/generated-artifacts/DummyERC721Receiver.json115
-rw-r--r--packages/contracts/generated-artifacts/DummyERC721Token.json440
-rw-r--r--packages/contracts/generated-artifacts/DummyMultipleReturnERC20Token.json397
-rw-r--r--packages/contracts/generated-artifacts/DummyNoReturnERC20Token.json397
-rw-r--r--packages/contracts/generated-artifacts/ERC20Proxy.json252
-rw-r--r--packages/contracts/generated-artifacts/ERC20Token.json230
-rw-r--r--packages/contracts/generated-artifacts/ERC721Proxy.json252
-rw-r--r--packages/contracts/generated-artifacts/ERC721Token.json317
-rw-r--r--packages/contracts/generated-artifacts/Exchange.json2154
-rw-r--r--packages/contracts/generated-artifacts/ExchangeWrapper.json210
-rw-r--r--packages/contracts/generated-artifacts/Forwarder.json601
-rw-r--r--packages/contracts/generated-artifacts/IAssetData.json89
-rw-r--r--packages/contracts/generated-artifacts/IAssetProxy.json175
-rw-r--r--packages/contracts/generated-artifacts/IValidator.json80
-rw-r--r--packages/contracts/generated-artifacts/IWallet.json76
-rw-r--r--packages/contracts/generated-artifacts/InvalidERC721Receiver.json115
-rw-r--r--packages/contracts/generated-artifacts/MixinAuthorizable.json229
-rw-r--r--packages/contracts/generated-artifacts/MultiSigWallet.json584
-rw-r--r--packages/contracts/generated-artifacts/MultiSigWalletWithTimeLock.json668
-rw-r--r--packages/contracts/generated-artifacts/OrderValidator.json665
-rw-r--r--packages/contracts/generated-artifacts/ReentrantERC20Token.json307
-rw-r--r--packages/contracts/generated-artifacts/TestAssetProxyDispatcher.json204
-rw-r--r--packages/contracts/generated-artifacts/TestAssetProxyOwner.json790
-rw-r--r--packages/contracts/generated-artifacts/TestConstants.json85
-rw-r--r--packages/contracts/generated-artifacts/TestExchangeInternals.json2581
-rw-r--r--packages/contracts/generated-artifacts/TestLibBytes.json426
-rw-r--r--packages/contracts/generated-artifacts/TestLibs.json450
-rw-r--r--packages/contracts/generated-artifacts/TestSignatureValidator.json336
-rw-r--r--packages/contracts/generated-artifacts/TestStaticCallReceiver.json129
-rw-r--r--packages/contracts/generated-artifacts/Validator.json95
-rw-r--r--packages/contracts/generated-artifacts/WETH9.json330
-rw-r--r--packages/contracts/generated-artifacts/Wallet.json95
-rw-r--r--packages/contracts/generated-artifacts/Whitelist.json284
-rw-r--r--packages/contracts/generated-artifacts/ZRXToken.json6201
-rw-r--r--packages/contracts/generated-wrappers/asset_proxy_owner.ts1876
-rw-r--r--packages/contracts/generated-wrappers/dummy_erc20_token.ts1044
-rw-r--r--packages/contracts/generated-wrappers/dummy_erc721_receiver.ts231
-rw-r--r--packages/contracts/generated-wrappers/dummy_erc721_token.ts1326
-rw-r--r--packages/contracts/generated-wrappers/dummy_multiple_return_erc20_token.ts1044
-rw-r--r--packages/contracts/generated-wrappers/dummy_no_return_erc20_token.ts1044
-rw-r--r--packages/contracts/generated-wrappers/erc20_proxy.ts649
-rw-r--r--packages/contracts/generated-wrappers/erc20_token.ts556
-rw-r--r--packages/contracts/generated-wrappers/erc721_proxy.ts649
-rw-r--r--packages/contracts/generated-wrappers/erc721_token.ts893
-rw-r--r--packages/contracts/generated-wrappers/exchange.ts3079
-rw-r--r--packages/contracts/generated-wrappers/exchange_wrapper.ts378
-rw-r--r--packages/contracts/generated-wrappers/forwarder.ts730
-rw-r--r--packages/contracts/generated-wrappers/i_asset_data.ts143
-rw-r--r--packages/contracts/generated-wrappers/i_asset_proxy.ts684
-rw-r--r--packages/contracts/generated-wrappers/invalid_erc721_receiver.ts231
-rw-r--r--packages/contracts/generated-wrappers/mixin_authorizable.ts619
-rw-r--r--packages/contracts/generated-wrappers/multi_sig_wallet.ts1432
-rw-r--r--packages/contracts/generated-wrappers/multi_sig_wallet_with_time_lock.ts1614
-rw-r--r--packages/contracts/generated-wrappers/order_validator.ts357
-rw-r--r--packages/contracts/generated-wrappers/reentrant_erc20_token.ts660
-rw-r--r--packages/contracts/generated-wrappers/test_asset_proxy_dispatcher.ts523
-rw-r--r--packages/contracts/generated-wrappers/test_asset_proxy_owner.ts1946
-rw-r--r--packages/contracts/generated-wrappers/test_constants.ts123
-rw-r--r--packages/contracts/generated-wrappers/test_exchange_internals.ts3595
-rw-r--r--packages/contracts/generated-wrappers/test_lib_bytes.ts683
-rw-r--r--packages/contracts/generated-wrappers/test_libs.ts453
-rw-r--r--packages/contracts/generated-wrappers/test_signature_validator.ts746
-rw-r--r--packages/contracts/generated-wrappers/test_static_call_receiver.ts449
-rw-r--r--packages/contracts/generated-wrappers/validator.ts115
-rw-r--r--packages/contracts/generated-wrappers/wallet.ts110
-rw-r--r--packages/contracts/generated-wrappers/weth9.ts835
-rw-r--r--packages/contracts/generated-wrappers/whitelist.ts547
-rw-r--r--packages/contracts/generated-wrappers/zrx_token.ts646
-rw-r--r--packages/contracts/package.json92
-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.ts207
-rw-r--r--packages/contracts/test/asset_proxy/proxies.ts629
-rw-r--r--packages/contracts/test/exchange/core.ts829
-rw-r--r--packages/contracts/test/exchange/dispatcher.ts280
-rw-r--r--packages/contracts/test/exchange/fill_order.ts312
-rw-r--r--packages/contracts/test/exchange/internal.ts466
-rw-r--r--packages/contracts/test/exchange/libs.ts137
-rw-r--r--packages/contracts/test/exchange/match_orders.ts1276
-rw-r--r--packages/contracts/test/exchange/signature_validator.ts522
-rw-r--r--packages/contracts/test/exchange/transactions.ts462
-rw-r--r--packages/contracts/test/exchange/wrapper.ts1452
-rw-r--r--packages/contracts/test/extensions/forwarder.ts1282
-rw-r--r--packages/contracts/test/extensions/order_validator.ts600
-rw-r--r--packages/contracts/test/global_hooks.ts15
-rw-r--r--packages/contracts/test/libraries/lib_bytes.ts871
-rw-r--r--packages/contracts/test/multisig/asset_proxy_owner.ts498
-rw-r--r--packages/contracts/test/multisig/multi_sig_with_time_lock.ts347
-rw-r--r--packages/contracts/test/tokens/erc721_token.ts279
-rw-r--r--packages/contracts/test/tokens/unlimited_allowance_token.ts191
-rw-r--r--packages/contracts/test/tokens/weth9.ts138
-rw-r--r--packages/contracts/test/tokens/zrx_token.ts206
-rw-r--r--packages/contracts/test/tutorials/arbitrage.ts260
-rw-r--r--packages/contracts/test/utils/assertions.ts199
-rw-r--r--packages/contracts/test/utils/asset_wrapper.ts223
-rw-r--r--packages/contracts/test/utils/constants.ts67
-rw-r--r--packages/contracts/test/utils/erc20_wrapper.ts182
-rw-r--r--packages/contracts/test/utils/erc721_wrapper.ts237
-rw-r--r--packages/contracts/test/utils/exchange_wrapper.ts276
-rw-r--r--packages/contracts/test/utils/fill_order_combinatorial_utils.ts924
-rw-r--r--packages/contracts/test/utils/forwarder_wrapper.ts121
-rw-r--r--packages/contracts/test/utils/log_decoder.ts53
-rw-r--r--packages/contracts/test/utils/match_order_tester.ts566
-rw-r--r--packages/contracts/test/utils/multi_sig_wrapper.ts67
-rw-r--r--packages/contracts/test/utils/order_factory_from_scenario.ts296
-rw-r--r--packages/contracts/test/utils/test_with_reference.ts139
-rw-r--r--packages/contracts/test/utils/types.ts241
-rw-r--r--packages/contracts/test/utils/web3_wrapper.ts84
-rw-r--r--packages/contracts/test/utils_test/test_with_reference.ts63
-rw-r--r--packages/contracts/tsconfig.json48
-rw-r--r--packages/dev-tools-pages/package.json5
-rw-r--r--packages/dev-utils/CHANGELOG.json36
-rw-r--r--packages/dev-utils/CHANGELOG.md16
-rw-r--r--packages/dev-utils/README.md15
-rw-r--r--packages/dev-utils/package.json16
-rw-r--r--packages/dev-utils/src/web3_factory.ts6
-rw-r--r--packages/ethereum-types/CHANGELOG.json18
-rw-r--r--packages/ethereum-types/CHANGELOG.md8
-rw-r--r--packages/ethereum-types/package.json4
-rw-r--r--packages/ethereum-types/src/index.ts5
-rw-r--r--packages/fill-scenarios/CHANGELOG.json45
-rw-r--r--packages/fill-scenarios/CHANGELOG.md16
-rw-r--r--packages/fill-scenarios/package.json22
-rw-r--r--packages/fill-scenarios/src/fill_scenarios.ts63
-rw-r--r--packages/instant/.DS_Storebin0 -> 8196 bytes
-rw-r--r--packages/instant/.dogfood.discharge.json4
-rw-r--r--packages/instant/.env_example7
-rw-r--r--packages/instant/.gitignore3
-rw-r--r--packages/instant/.npmignore5
-rw-r--r--packages/instant/.production.discharge.json13
-rw-r--r--packages/instant/.staging.discharge.json4
-rw-r--r--packages/instant/CHANGELOG.json12
-rw-r--r--packages/instant/CHANGELOG.md9
-rw-r--r--packages/instant/README.md54
-rw-r--r--packages/instant/package.json42
-rw-r--r--packages/instant/public/external.css4
-rw-r--r--packages/instant/public/index.html330
-rw-r--r--packages/instant/src/assets/icons/zrx.svg7
-rw-r--r--packages/instant/src/components/amount_placeholder.tsx2
-rw-r--r--packages/instant/src/components/animations/slide_animation.tsx10
-rw-r--r--packages/instant/src/components/buy_button.tsx34
-rw-r--r--packages/instant/src/components/buy_order_progress.tsx4
-rw-r--r--packages/instant/src/components/buy_order_state_buttons.tsx6
-rw-r--r--packages/instant/src/components/erc20_asset_amount_input.tsx13
-rw-r--r--packages/instant/src/components/erc20_token_selector.tsx96
-rw-r--r--packages/instant/src/components/install_wallet_panel_content.tsx11
-rw-r--r--packages/instant/src/components/instant_heading.tsx47
-rw-r--r--packages/instant/src/components/order_details.tsx269
-rw-r--r--packages/instant/src/components/payment_method.tsx36
-rw-r--r--packages/instant/src/components/payment_method_dropdown.tsx18
-rw-r--r--packages/instant/src/components/placing_order_button.tsx2
-rw-r--r--packages/instant/src/components/scaling_amount_input.tsx11
-rw-r--r--packages/instant/src/components/scaling_input.tsx100
-rw-r--r--packages/instant/src/components/search_input.tsx8
-rw-r--r--packages/instant/src/components/secondary_button.tsx1
-rw-r--r--packages/instant/src/components/section_header.tsx21
-rw-r--r--packages/instant/src/components/sliding_error.tsx4
-rw-r--r--packages/instant/src/components/sliding_panel.tsx74
-rw-r--r--packages/instant/src/components/standard_panel_content.tsx15
-rw-r--r--packages/instant/src/components/standard_sliding_panel.tsx4
-rw-r--r--packages/instant/src/components/time_counter.tsx2
-rw-r--r--packages/instant/src/components/timed_progress_bar.tsx19
-rw-r--r--packages/instant/src/components/ui/container.tsx18
-rw-r--r--packages/instant/src/components/ui/dropdown.tsx51
-rw-r--r--packages/instant/src/components/ui/input.tsx11
-rw-r--r--packages/instant/src/components/ui/overlay.tsx2
-rw-r--r--packages/instant/src/components/ui/text.tsx10
-rw-r--r--packages/instant/src/components/wallet_prompt.tsx6
-rw-r--r--packages/instant/src/components/zero_ex_instant.tsx2
-rw-r--r--packages/instant/src/components/zero_ex_instant_container.tsx36
-rw-r--r--packages/instant/src/components/zero_ex_instant_overlay.tsx19
-rw-r--r--packages/instant/src/components/zero_ex_instant_provider.tsx57
-rw-r--r--packages/instant/src/constants.ts24
-rw-r--r--packages/instant/src/containers/connected_account_payment_method.ts49
-rw-r--r--packages/instant/src/containers/latest_buy_quote_order_details.ts33
-rw-r--r--packages/instant/src/containers/latest_error.tsx12
-rw-r--r--packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts11
-rw-r--r--packages/instant/src/containers/selected_erc20_asset_amount_input.ts4
-rw-r--r--packages/instant/src/data/asset_meta_data_map.ts6
-rw-r--r--packages/instant/src/index.umd.ts128
-rw-r--r--packages/instant/src/redux/actions.ts4
-rw-r--r--packages/instant/src/redux/analytics_middleware.ts89
-rw-r--r--packages/instant/src/redux/async_data.ts22
-rw-r--r--packages/instant/src/redux/reducer.ts9
-rw-r--r--packages/instant/src/style/theme.ts16
-rw-r--r--packages/instant/src/types.ts36
-rw-r--r--packages/instant/src/util/analytics.ts218
-rw-r--r--packages/instant/src/util/asset.ts24
-rw-r--r--packages/instant/src/util/buy_quote_updater.ts40
-rw-r--r--packages/instant/src/util/env.ts9
-rw-r--r--packages/instant/src/util/error_reporter.ts79
-rw-r--r--packages/instant/src/util/format.ts30
-rw-r--r--packages/instant/src/util/gas_price_estimator.ts5
-rw-r--r--packages/instant/src/util/heap.ts7
-rw-r--r--packages/instant/src/util/heartbeater_factory.ts12
-rw-r--r--packages/instant/src/util/provider_state_factory.ts33
-rw-r--r--packages/instant/test/util/asset.test.ts33
-rw-r--r--packages/instant/test/util/format.test.ts18
-rw-r--r--packages/instant/tsconfig.json15
-rw-r--r--packages/instant/webpack.config.js137
-rw-r--r--packages/json-schemas/CHANGELOG.json27
-rw-r--r--packages/json-schemas/CHANGELOG.md12
-rw-r--r--packages/json-schemas/package.json8
-rw-r--r--packages/json-schemas/schemas/asset_pairs_request_opts_schema.json2
-rw-r--r--packages/json-schemas/schemas/call_data_schema.json6
-rw-r--r--packages/json-schemas/schemas/ec_signature_schema.json2
-rw-r--r--packages/json-schemas/schemas/js_number.json5
-rw-r--r--packages/json-schemas/schemas/js_number_schema.json5
-rw-r--r--packages/json-schemas/schemas/order_config_request_schema.json2
-rw-r--r--packages/json-schemas/schemas/order_watcher_web_socket_request_schema.json52
-rw-r--r--packages/json-schemas/schemas/order_watcher_web_socket_utf8_message_schema.json10
-rw-r--r--packages/json-schemas/schemas/orderbook_request_schema.json4
-rw-r--r--packages/json-schemas/schemas/orders_request_opts_schema.json2
-rw-r--r--packages/json-schemas/schemas/paged_request_opts_schema.json2
-rw-r--r--packages/json-schemas/schemas/request_opts_schema.json2
-rw-r--r--packages/json-schemas/schemas/tx_data_schema.json6
-rw-r--r--packages/json-schemas/src/schema_validator.ts8
-rw-r--r--packages/json-schemas/src/schemas.ts6
-rw-r--r--packages/json-schemas/tsconfig.json4
-rw-r--r--packages/metacoin/package.json29
-rw-r--r--packages/migrations/.gitignore2
-rw-r--r--packages/migrations/CHANGELOG.json56
-rw-r--r--packages/migrations/CHANGELOG.md18
-rw-r--r--packages/migrations/Dockerfile15
-rw-r--r--packages/migrations/README.md41
-rwxr-xr-xpackages/migrations/bin/0x-migrate.js2
-rw-r--r--packages/migrations/package.json53
-rw-r--r--packages/migrations/src/cli.ts38
-rw-r--r--packages/migrations/src/index.ts10
-rw-r--r--packages/migrations/src/migrate_snapshot.ts32
-rw-r--r--packages/migrations/src/migration.ts28
-rw-r--r--packages/migrations/typedoc-tsconfig.json7
-rw-r--r--packages/monorepo-scripts/CHANGELOG.json8
-rw-r--r--packages/monorepo-scripts/package.json2
-rw-r--r--packages/monorepo-scripts/src/doc_gen_configs.ts1
-rw-r--r--packages/monorepo-scripts/src/prepublish_checks.ts13
-rw-r--r--packages/monorepo-scripts/src/test_installation.ts2
-rw-r--r--packages/monorepo-scripts/src/utils/github_release_utils.ts12
-rw-r--r--packages/monorepo-scripts/src/utils/utils.ts1
-rw-r--r--packages/order-utils/CHANGELOG.json56
-rw-r--r--packages/order-utils/CHANGELOG.md20
-rw-r--r--packages/order-utils/package.json26
-rw-r--r--packages/order-utils/src/asset_data_utils.ts293
-rw-r--r--packages/order-utils/src/constants.ts66
-rw-r--r--packages/order-utils/src/exchange_transfer_simulator.ts64
-rw-r--r--packages/order-utils/src/index.ts5
-rw-r--r--packages/order-utils/src/order_state_utils.ts56
-rw-r--r--packages/order-utils/src/signature_utils.ts2
-rw-r--r--packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts2
-rw-r--r--packages/order-utils/test/asset_data_utils_test.ts116
-rw-r--r--packages/order-utils/test/order_hash_test.ts2
-rw-r--r--packages/order-utils/test/utils/test_order_factory.ts4
-rw-r--r--packages/order-watcher/CHANGELOG.json55
-rw-r--r--packages/order-watcher/CHANGELOG.md16
-rw-r--r--packages/order-watcher/Dockerfile13
-rw-r--r--packages/order-watcher/README.md88
-rw-r--r--packages/order-watcher/package.json40
-rw-r--r--packages/order-watcher/src/index.ts2
-rw-r--r--packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts62
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher.ts93
-rw-r--r--packages/order-watcher/src/order_watcher/order_watcher_web_socket_server.ts200
-rw-r--r--packages/order-watcher/src/server.ts44
-rw-r--r--packages/order-watcher/src/types.ts66
-rw-r--r--packages/order-watcher/test/order_watcher_test.ts208
-rw-r--r--packages/order-watcher/test/order_watcher_web_socket_server_test.ts312
-rw-r--r--packages/pipeline/.npmignore7
-rw-r--r--packages/pipeline/README.md166
-rw-r--r--packages/pipeline/coverage/.gitkeep (renamed from python-packages/order_utils/stubs/jsonschema/exceptions.pyi)0
-rw-r--r--packages/pipeline/migrations/1542070840010-InitialSchema.ts187
-rw-r--r--packages/pipeline/migrations/1542147915364-NewSraOrderTimestampFormat.ts48
-rw-r--r--packages/pipeline/migrations/1542152278484-RenameSraOrdersFilledAmounts.ts13
-rw-r--r--packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts53
-rw-r--r--packages/pipeline/migrations/1542249766882-AddHomepageUrlToRelayers.ts14
-rw-r--r--packages/pipeline/migrations/1542401122477-MakeTakerAddressNullable.ts17
-rw-r--r--packages/pipeline/migrations/1542655823221-NewMetadataAndOHLCVTables.ts60
-rw-r--r--packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts30
-rw-r--r--packages/pipeline/migrations/1543446690436-CreateDexTrades.ts41
-rw-r--r--packages/pipeline/migrations/1543980079179-ConvertTokenMetadataDecimalsToBigNumber.ts17
-rw-r--r--packages/pipeline/migrations/1543983324954-ConvertTransactionGasPriceToBigNumber.ts19
-rw-r--r--packages/pipeline/migrations/1544131464368-CreateERC20ApprovalEvents.ts26
-rw-r--r--packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts33
-rw-r--r--packages/pipeline/migrations/1545440485644-CreateCopperTables.ts103
-rw-r--r--packages/pipeline/package.json66
-rw-r--r--packages/pipeline/src/data_sources/bloxy/index.ts133
-rw-r--r--packages/pipeline/src/data_sources/contract-wrappers/erc20_events.ts45
-rw-r--r--packages/pipeline/src/data_sources/contract-wrappers/exchange_events.ts59
-rw-r--r--packages/pipeline/src/data_sources/contract-wrappers/utils.ts67
-rw-r--r--packages/pipeline/src/data_sources/copper/index.ts126
-rw-r--r--packages/pipeline/src/data_sources/ddex/index.ts78
-rw-r--r--packages/pipeline/src/data_sources/idex/index.ts82
-rw-r--r--packages/pipeline/src/data_sources/oasis/index.ts103
-rw-r--r--packages/pipeline/src/data_sources/ohlcv_external/crypto_compare.ts110
-rw-r--r--packages/pipeline/src/data_sources/paradex/index.ts92
-rw-r--r--packages/pipeline/src/data_sources/relayer-registry/index.ts33
-rw-r--r--packages/pipeline/src/data_sources/trusted_tokens/index.ts29
-rw-r--r--packages/pipeline/src/data_sources/web3/index.ts22
-rw-r--r--packages/pipeline/src/entities/block.ts13
-rw-r--r--packages/pipeline/src/entities/copper_activity.ts41
-rw-r--r--packages/pipeline/src/entities/copper_activity_type.ts17
-rw-r--r--packages/pipeline/src/entities/copper_custom_field.ts15
-rw-r--r--packages/pipeline/src/entities/copper_lead.ts38
-rw-r--r--packages/pipeline/src/entities/copper_opportunity.ts45
-rw-r--r--packages/pipeline/src/entities/dex_trade.ts54
-rw-r--r--packages/pipeline/src/entities/erc20_approval_event.ts26
-rw-r--r--packages/pipeline/src/entities/exchange_cancel_event.ts51
-rw-r--r--packages/pipeline/src/entities/exchange_cancel_up_to_event.ts26
-rw-r--r--packages/pipeline/src/entities/exchange_fill_event.ts60
-rw-r--r--packages/pipeline/src/entities/index.ts25
-rw-r--r--packages/pipeline/src/entities/ohlcv_external.ts30
-rw-r--r--packages/pipeline/src/entities/relayer.ts21
-rw-r--r--packages/pipeline/src/entities/sra_order.ts63
-rw-r--r--packages/pipeline/src/entities/sra_order_observed_timestamp.ts35
-rw-r--r--packages/pipeline/src/entities/token_metadata.ts22
-rw-r--r--packages/pipeline/src/entities/token_order.ts28
-rw-r--r--packages/pipeline/src/entities/transaction.ts19
-rw-r--r--packages/pipeline/src/ormconfig.ts54
-rw-r--r--packages/pipeline/src/parsers/bloxy/index.ts53
-rw-r--r--packages/pipeline/src/parsers/copper/index.ts259
-rw-r--r--packages/pipeline/src/parsers/ddex_orders/index.ts71
-rw-r--r--packages/pipeline/src/parsers/events/erc20_events.ts34
-rw-r--r--packages/pipeline/src/parsers/events/exchange_events.ts145
-rw-r--r--packages/pipeline/src/parsers/events/index.ts2
-rw-r--r--packages/pipeline/src/parsers/idex_orders/index.ts81
-rw-r--r--packages/pipeline/src/parsers/oasis_orders/index.ts71
-rw-r--r--packages/pipeline/src/parsers/ohlcv_external/crypto_compare.ts38
-rw-r--r--packages/pipeline/src/parsers/paradex_orders/index.ts66
-rw-r--r--packages/pipeline/src/parsers/relayer_registry/index.ts37
-rw-r--r--packages/pipeline/src/parsers/sra_orders/index.ts68
-rw-r--r--packages/pipeline/src/parsers/token_metadata/index.ts46
-rw-r--r--packages/pipeline/src/parsers/utils.ts28
-rw-r--r--packages/pipeline/src/parsers/web3/index.ts49
-rw-r--r--packages/pipeline/src/scripts/pull_competing_dex_trades.ts51
-rw-r--r--packages/pipeline/src/scripts/pull_copper.ts129
-rw-r--r--packages/pipeline/src/scripts/pull_ddex_orderbook_snapshots.ts55
-rw-r--r--packages/pipeline/src/scripts/pull_erc20_events.ts96
-rw-r--r--packages/pipeline/src/scripts/pull_exchange_events.ts146
-rw-r--r--packages/pipeline/src/scripts/pull_idex_orderbook_snapshots.ts63
-rw-r--r--packages/pipeline/src/scripts/pull_missing_blocks.ts90
-rw-r--r--packages/pipeline/src/scripts/pull_oasis_orderbook_snapshots.ts58
-rw-r--r--packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts95
-rw-r--r--packages/pipeline/src/scripts/pull_paradex_orderbook_snapshots.ts87
-rw-r--r--packages/pipeline/src/scripts/pull_radar_relay_orders.ts54
-rw-r--r--packages/pipeline/src/scripts/pull_trusted_tokens.ts52
-rw-r--r--packages/pipeline/src/scripts/update_relayer_info.ts33
-rw-r--r--packages/pipeline/src/types.ts9
-rw-r--r--packages/pipeline/src/utils/constants.ts3
-rw-r--r--packages/pipeline/src/utils/get_ohlcv_trading_pairs.ts116
-rw-r--r--packages/pipeline/src/utils/index.ts53
-rw-r--r--packages/pipeline/src/utils/transformers/asset_proxy_id_types.ts20
-rw-r--r--packages/pipeline/src/utils/transformers/big_number.ts16
-rw-r--r--packages/pipeline/src/utils/transformers/index.ts3
-rw-r--r--packages/pipeline/src/utils/transformers/number_to_bigint.ts31
-rw-r--r--packages/pipeline/test/data_sources/contract-wrappers/utils_test.ts109
-rw-r--r--packages/pipeline/test/data_sources/ohlcv_external/crypto_compare_test.ts47
-rw-r--r--packages/pipeline/test/db_global_hooks.ts9
-rw-r--r--packages/pipeline/test/db_setup.ts174
-rw-r--r--packages/pipeline/test/entities/block_test.ts23
-rw-r--r--packages/pipeline/test/entities/copper_test.ts54
-rw-r--r--packages/pipeline/test/entities/dex_trades_test.ts60
-rw-r--r--packages/pipeline/test/entities/erc20_approval_events_test.ts29
-rw-r--r--packages/pipeline/test/entities/exchange_cancel_event_test.ts57
-rw-r--r--packages/pipeline/test/entities/exchange_cancel_up_to_event_test.ts29
-rw-r--r--packages/pipeline/test/entities/exchange_fill_event_test.ts62
-rw-r--r--packages/pipeline/test/entities/ohlcv_external_test.ts35
-rw-r--r--packages/pipeline/test/entities/relayer_test.ts55
-rw-r--r--packages/pipeline/test/entities/sra_order_test.ts84
-rw-r--r--packages/pipeline/test/entities/token_metadata_test.ts39
-rw-r--r--packages/pipeline/test/entities/token_order_test.ts31
-rw-r--r--packages/pipeline/test/entities/transaction_test.ts26
-rw-r--r--packages/pipeline/test/entities/util.ts25
-rw-r--r--packages/pipeline/test/fixtures/copper/api_v1_activity_types.json24
-rw-r--r--packages/pipeline/test/fixtures/copper/api_v1_activity_types.ts16
-rw-r--r--packages/pipeline/test/fixtures/copper/api_v1_custom_field_definitions.json38
-rw-r--r--packages/pipeline/test/fixtures/copper/api_v1_custom_field_definitions.ts39
-rw-r--r--packages/pipeline/test/fixtures/copper/api_v1_list_activities.json242
-rw-r--r--packages/pipeline/test/fixtures/copper/api_v1_list_activities.ts305
-rw-r--r--packages/pipeline/test/fixtures/copper/api_v1_list_leads.json583
-rw-r--r--packages/pipeline/test/fixtures/copper/api_v1_list_leads.ts229
-rw-r--r--packages/pipeline/test/fixtures/copper/api_v1_list_opportunities.json662
-rw-r--r--packages/pipeline/test/fixtures/copper/api_v1_list_opportunities.ts425
-rw-r--r--packages/pipeline/test/fixtures/copper/parsed_entities.ts5
-rw-r--r--packages/pipeline/test/parsers/bloxy/index_test.ts98
-rw-r--r--packages/pipeline/test/parsers/copper/index_test.ts87
-rw-r--r--packages/pipeline/test/parsers/ddex_orders/index_test.ts55
-rw-r--r--packages/pipeline/test/parsers/events/erc20_events_test.ts54
-rw-r--r--packages/pipeline/test/parsers/events/exchange_events_test.ts79
-rw-r--r--packages/pipeline/test/parsers/idex_orders/index_test.ts87
-rw-r--r--packages/pipeline/test/parsers/oasis_orders/index_test.ts49
-rw-r--r--packages/pipeline/test/parsers/ohlcv_external/crypto_compare_test.ts62
-rw-r--r--packages/pipeline/test/parsers/paradex_orders/index_test.ts54
-rw-r--r--packages/pipeline/test/parsers/sra_orders/index_test.ts69
-rw-r--r--packages/pipeline/test/parsers/utils/index_test.ts30
-rw-r--r--packages/pipeline/test/utils/chai_setup.ts13
-rw-r--r--packages/pipeline/tsconfig.json18
-rw-r--r--packages/pipeline/tslint.json3
-rw-r--r--packages/pipeline/typedoc-tsconfig.json10
-rw-r--r--packages/react-docs/CHANGELOG.json36
-rw-r--r--packages/react-docs/CHANGELOG.md16
-rw-r--r--packages/react-docs/package.json12
-rw-r--r--packages/react-shared/CHANGELOG.json46
-rw-r--r--packages/react-shared/CHANGELOG.md16
-rw-r--r--packages/react-shared/package.json8
-rw-r--r--packages/react-shared/src/components/link.tsx13
-rw-r--r--packages/react-shared/src/index.ts2
-rw-r--r--packages/sol-compiler/CHANGELOG.json50
-rw-r--r--packages/sol-compiler/CHANGELOG.md16
-rw-r--r--packages/sol-compiler/package.json26
-rw-r--r--packages/sol-compiler/src/cli.ts10
-rw-r--r--packages/sol-compiler/src/compiler.ts251
-rw-r--r--packages/sol-compiler/src/utils/compiler.ts217
-rw-r--r--packages/sol-compiler/src/utils/constants.ts3
-rw-r--r--packages/sol-compiler/src/utils/types.ts9
-rw-r--r--packages/sol-compiler/test/compiler_utils_test.ts6
-rw-r--r--packages/sol-cov/CHANGELOG.json36
-rw-r--r--packages/sol-cov/CHANGELOG.md16
-rw-r--r--packages/sol-cov/package.json18
-rw-r--r--packages/sol-doc/CHANGELOG.json36
-rw-r--r--packages/sol-doc/CHANGELOG.md16
-rw-r--r--packages/sol-doc/package.json12
-rw-r--r--packages/sol-resolver/CHANGELOG.json41
-rw-r--r--packages/sol-resolver/CHANGELOG.md12
-rw-r--r--packages/sol-resolver/package.json8
-rw-r--r--packages/sol-resolver/src/index.ts1
-rw-r--r--packages/sol-resolver/src/resolvers/fs_resolver.ts5
-rw-r--r--packages/sol-resolver/src/resolvers/name_resolver.ts10
-rw-r--r--packages/sol-resolver/src/resolvers/npm_resolver.ts20
-rw-r--r--packages/sol-resolver/src/resolvers/relative_fs_resolver.ts7
-rw-r--r--packages/sol-resolver/src/resolvers/spy_resolver.ts25
-rw-r--r--packages/sol-resolver/src/resolvers/url_resolver.ts5
-rw-r--r--packages/sol-resolver/src/types.ts1
-rw-r--r--packages/sra-spec/CHANGELOG.json27
-rw-r--r--packages/sra-spec/CHANGELOG.md12
-rw-r--r--packages/sra-spec/package.json6
-rw-r--r--packages/sra-spec/public/index.html4
-rw-r--r--packages/subproviders/CHANGELOG.json36
-rw-r--r--packages/subproviders/CHANGELOG.md16
-rw-r--r--packages/subproviders/package.json16
-rw-r--r--packages/testnet-faucets/package.json16
-rw-r--r--packages/tslint-config/CHANGELOG.json10
-rw-r--r--packages/tslint-config/CHANGELOG.md4
-rw-r--r--packages/tslint-config/package.json2
-rw-r--r--packages/tslint-config/rules/walkers/async_suffix.ts39
-rw-r--r--packages/tslint-config/tslint.json1
-rw-r--r--packages/types/CHANGELOG.json47
-rw-r--r--packages/types/CHANGELOG.md13
-rw-r--r--packages/types/package.json6
-rw-r--r--packages/types/src/index.ts63
-rw-r--r--packages/typescript-typings/CHANGELOG.json18
-rw-r--r--packages/typescript-typings/CHANGELOG.md8
-rw-r--r--packages/typescript-typings/package.json4
-rw-r--r--packages/typescript-typings/tsconfig.json3
-rw-r--r--packages/utils/CHANGELOG.json46
-rw-r--r--packages/utils/CHANGELOG.md12
-rw-r--r--packages/utils/package.json14
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/data_type.ts58
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/interfaces.ts19
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts40
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts54
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/set.ts218
-rw-r--r--packages/utils/src/abi_encoder/calldata/blocks/blob.ts20
-rw-r--r--packages/utils/src/abi_encoder/calldata/blocks/pointer.ts61
-rw-r--r--packages/utils/src/abi_encoder/calldata/blocks/set.ts47
-rw-r--r--packages/utils/src/abi_encoder/calldata/calldata.ts245
-rw-r--r--packages/utils/src/abi_encoder/calldata/calldata_block.ts77
-rw-r--r--packages/utils/src/abi_encoder/calldata/iterator.ts114
-rw-r--r--packages/utils/src/abi_encoder/calldata/raw_calldata.ts82
-rw-r--r--packages/utils/src/abi_encoder/evm_data_type_factory.ts132
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/address.ts49
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/array.ts64
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/bool.ts53
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts72
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/int.ts59
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/method.ts72
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/pointer.ts17
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts78
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/string.ts59
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/tuple.ts24
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/uint.ts58
-rw-r--r--packages/utils/src/abi_encoder/index.ts14
-rw-r--r--packages/utils/src/abi_encoder/utils/constants.ts17
-rw-r--r--packages/utils/src/abi_encoder/utils/math.ts111
-rw-r--r--packages/utils/src/abi_encoder/utils/queue.ts39
-rw-r--r--packages/utils/src/abi_encoder/utils/rules.ts8
-rw-r--r--packages/utils/src/abi_utils.ts4
-rw-r--r--packages/utils/src/index.ts1
-rw-r--r--packages/utils/src/log_utils.ts5
-rw-r--r--packages/utils/test/abi_encoder/abi_samples/method_abis.ts780
-rw-r--r--packages/utils/test/abi_encoder/abi_samples/optimizer_abis.ts340
-rw-r--r--packages/utils/test/abi_encoder/abi_samples/return_value_abis.ts99
-rw-r--r--packages/utils/test/abi_encoder/evm_data_types_test.ts1007
-rw-r--r--packages/utils/test/abi_encoder/methods_test.ts366
-rw-r--r--packages/utils/test/abi_encoder/optimizer_test.ts262
-rw-r--r--packages/utils/test/abi_encoder/return_values_test.ts67
-rw-r--r--packages/utils/test/utils/chai_setup.ts13
-rw-r--r--packages/web3-wrapper/CHANGELOG.json32
-rw-r--r--packages/web3-wrapper/CHANGELOG.md17
-rw-r--r--packages/web3-wrapper/package.json14
-rw-r--r--packages/web3-wrapper/src/marshaller.ts6
-rw-r--r--packages/web3-wrapper/src/web3_wrapper.ts7
-rw-r--r--packages/website/.gitignore1
-rw-r--r--packages/website/README.md5
-rw-r--r--packages/website/less/all.less2
-rw-r--r--packages/website/less/normalize.less349
-rw-r--r--packages/website/md/docs/0xjs/0.0.1/installation.md2
-rw-r--r--packages/website/md/docs/0xjs/1.0.1/installation.md2
-rw-r--r--packages/website/md/docs/0xjs/2.0.0/installation.md2
-rw-r--r--packages/website/md/docs/asset_buyer/introduction.md2
-rw-r--r--packages/website/md/docs/connect/1/installation.md2
-rw-r--r--packages/website/md/docs/connect/3/installation.md2
-rw-r--r--packages/website/md/docs/migrations/1/installation.md17
-rw-r--r--packages/website/md/docs/migrations/1/introduction.md1
-rw-r--r--packages/website/md/docs/smart_contracts/1/introduction.md2
-rw-r--r--packages/website/md/docs/smart_contracts/2/introduction.md4
-rw-r--r--packages/website/md/docs/sol_cov/1/usage.md4
-rw-r--r--packages/website/md/docs/sol_cov/2/usage.md4
-rw-r--r--packages/website/md/docs/subproviders/1/introduction.md2
-rw-r--r--packages/website/package.json49
-rw-r--r--packages/website/public/css/formular.css45
-rw-r--r--packages/website/public/fonts/Formular-Light.woffbin0 -> 44630 bytes
-rw-r--r--packages/website/public/fonts/Formular-Light.woff2bin0 -> 34337 bytes
-rw-r--r--packages/website/public/fonts/Formular-Regular.woffbin0 -> 45102 bytes
-rw-r--r--packages/website/public/fonts/Formular-Regular.woff2bin0 -> 34607 bytes
-rw-r--r--packages/website/public/images/0x-instant/0x-instant-widgets.pngbin0 -> 64041 bytes
-rw-r--r--packages/website/public/images/0x-instant/0x-instant-widgets@2x.pngbin0 -> 190593 bytes
-rwxr-xr-xpackages/website/public/images/0x-instant/widget-1.pngbin0 -> 27160 bytes
-rwxr-xr-xpackages/website/public/images/0x-instant/widget-2.pngbin0 -> 47878 bytes
-rwxr-xr-xpackages/website/public/images/0x-instant/widget-3.pngbin0 -> 27505 bytes
-rwxr-xr-xpackages/website/public/images/0x-instant/widget-4.pngbin0 -> 30727 bytes
-rwxr-xr-xpackages/website/public/images/0x-instant/widget-5.pngbin0 -> 144454 bytes
-rwxr-xr-xpackages/website/public/images/0x-instant/widget-6.pngbin0 -> 28382 bytes
-rwxr-xr-xpackages/website/public/images/about/about-office.pngbin0 -> 474673 bytes
-rw-r--r--packages/website/public/images/advisors/david.pngbin29962 -> 0 bytes
-rw-r--r--packages/website/public/images/advisors/fred.jpgbin4619 -> 0 bytes
-rw-r--r--packages/website/public/images/advisors/joey.jpgbin13493 -> 0 bytes
-rw-r--r--packages/website/public/images/advisors/linda.jpgbin6580 -> 0 bytes
-rw-r--r--packages/website/public/images/advisors/olaf.pngbin26365 -> 0 bytes
-rw-r--r--packages/website/public/images/banner/bottomofcta.pngbin0 -> 15803 bytes
-rw-r--r--packages/website/public/images/banner/topofcta.pngbin0 -> 13342 bytes
-rw-r--r--packages/website/public/images/clients/bamboo.svg17
-rw-r--r--packages/website/public/images/clients/emoon.svg8
-rw-r--r--packages/website/public/images/clients/ercdex.svg16
-rw-r--r--packages/website/public/images/clients/godsUnchained.svg16
-rw-r--r--packages/website/public/images/clients/instex.svg40
-rw-r--r--packages/website/public/images/clients/laketrade.svg13
-rw-r--r--packages/website/public/images/clients/ledgerdex.svg19
-rw-r--r--packages/website/public/images/clients/openrelay.svg22
-rw-r--r--packages/website/public/images/clients/paradex.svg9
-rw-r--r--packages/website/public/images/clients/radar-relay.svg13
-rw-r--r--packages/website/public/images/clients/sharkrelay.svg32
-rw-r--r--packages/website/public/images/clients/starbitex.svg22
-rw-r--r--packages/website/public/images/clients/tokenjar.svg13
-rw-r--r--packages/website/public/images/clients/veil.svg4
-rw-r--r--packages/website/public/images/developers/tutorials/integrate_0x_instant.svg3
-rw-r--r--packages/website/public/images/events/berlin.jpgbin0 -> 108690 bytes
-rw-r--r--packages/website/public/images/events/event-sample.jpgbin0 -> 24594 bytes
-rw-r--r--packages/website/public/images/events/london.jpgbin0 -> 138979 bytes
-rw-r--r--packages/website/public/images/events/sf.jpgbin0 -> 108324 bytes
-rw-r--r--packages/website/public/images/jobs/calendar-icon.svg15
-rw-r--r--packages/website/public/images/jobs/heart-icon.svg3
-rw-r--r--packages/website/public/images/jobs/hero-dots-left.svg17
-rw-r--r--packages/website/public/images/jobs/hero-dots-right.svg16
-rw-r--r--packages/website/public/images/jobs/map@2x.pngbin0 -> 27904 bytes
-rw-r--r--packages/website/public/images/jobs/ship-icon.svg6
-rw-r--r--packages/website/public/images/jobs/world-map.svg64
-rw-r--r--packages/website/public/images/og_image.pngbin192500 -> 51927 bytes
-rw-r--r--packages/website/public/images/press/logo-forbes.pngbin0 -> 2420 bytes
-rw-r--r--packages/website/public/images/press/logo-fortune.pngbin0 -> 1800 bytes
-rw-r--r--packages/website/public/images/press/logo-techcrunch.pngbin0 -> 2332 bytes
-rw-r--r--packages/website/public/images/press/logo-venturebeat.pngbin0 -> 2660 bytes
-rwxr-xr-xpackages/website/public/images/relayer-logos/logo.pngbin0 -> 6758 bytes
-rwxr-xr-xpackages/website/public/images/relayer-logos/logo_1.pngbin0 -> 7951 bytes
-rwxr-xr-xpackages/website/public/images/relayer-logos/logo_2.1.pngbin0 -> 4942 bytes
-rwxr-xr-xpackages/website/public/images/relayer-logos/logo_2.2.pngbin0 -> 5115 bytes
-rwxr-xr-xpackages/website/public/images/relayer-logos/logo_2.3.pngbin0 -> 8685 bytes
-rwxr-xr-xpackages/website/public/images/relayer-logos/logo_2.pngbin0 -> 6479 bytes
-rwxr-xr-xpackages/website/public/images/relayer-logos/logo_3.pngbin0 -> 7888 bytes
-rwxr-xr-xpackages/website/public/images/relayer-logos/logo_4.pngbin0 -> 9083 bytes
-rwxr-xr-xpackages/website/public/images/relayer-logos/logo_5.pngbin0 -> 5768 bytes
-rw-r--r--packages/website/public/images/social/discord.pngbin0 -> 858 bytes
-rw-r--r--packages/website/public/images/social/rocketchat.pngbin1587 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/advisors/davids.jpgbin0 -> 25263 bytes
-rwxr-xr-xpackages/website/public/images/team/advisors/frede.jpgbin0 -> 17015 bytes
-rwxr-xr-xpackages/website/public/images/team/advisors/joeyk.jpgbin0 -> 23496 bytes
-rwxr-xr-xpackages/website/public/images/team/advisors/lindax.jpgbin0 -> 20576 bytes
-rwxr-xr-xpackages/website/public/images/team/advisors/olafc.jpgbin0 -> 18024 bytes
-rw-r--r--packages/website/public/images/team/alex.jpgbin7271 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/alexb.jpgbin0 -> 17441 bytes
-rw-r--r--packages/website/public/images/team/alexbrowne.pngbin146699 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/alexv.jpgbin0 -> 16969 bytes
-rw-r--r--packages/website/public/images/team/amir.pngbin116488 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/amirb.jpgbin0 -> 21075 bytes
-rw-r--r--packages/website/public/images/team/anyone.pngbin4794 -> 0 bytes
-rw-r--r--packages/website/public/images/team/ben.jpgbin25486 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/benb.jpgbin0 -> 17571 bytes
-rwxr-xr-x[-rw-r--r--]packages/website/public/images/team/blake.jpgbin29743 -> 17515 bytes
-rw-r--r--packages/website/public/images/team/brandon.pngbin30180 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/brandonm.jpgbin0 -> 18765 bytes
-rw-r--r--packages/website/public/images/team/chris.pngbin96388 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/chrisk.jpgbin0 -> 16316 bytes
-rw-r--r--packages/website/public/images/team/clay.pngbin85774 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/clayr.jpgbin0 -> 17222 bytes
-rwxr-xr-xpackages/website/public/images/team/eugenea.jpgbin0 -> 23527 bytes
-rw-r--r--packages/website/public/images/team/fabio.jpgbin17125 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/fabiob.jpgbin0 -> 15358 bytes
-rw-r--r--packages/website/public/images/team/fragosti.pngbin26209 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/francesco.jpgbin0 -> 17467 bytes
-rw-r--r--packages/website/public/images/team/gene.jpgbin44173 -> 0 bytes
-rw-r--r--packages/website/public/images/team/greg.jpegbin4100 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/greg.jpgbin0 -> 21163 bytes
-rw-r--r--packages/website/public/images/team/jacob.jpgbin27088 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/jacobe.jpgbin0 -> 28977 bytes
-rw-r--r--packages/website/public/images/team/jason.pngbin45572 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/jasons.jpgbin0 -> 20455 bytes
-rw-r--r--packages/website/public/images/team/leonid.pngbin35014 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/leonidL.jpgbin0 -> 14413 bytes
-rw-r--r--packages/website/public/images/team/matt.jpgbin769216 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/mattt.jpgbin0 -> 18348 bytes
-rw-r--r--packages/website/public/images/team/mel.pngbin110351 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/melo.jpgbin0 -> 19188 bytes
-rw-r--r--packages/website/public/images/team/peter.jpgbin26748 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/peterz.jpgbin0 -> 30404 bytes
-rw-r--r--packages/website/public/images/team/rahul.pngbin29636 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/rahuls.jpgbin0 -> 21412 bytes
-rw-r--r--packages/website/public/images/team/remco.jpegbin14807 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/remcoB.jpgbin0 -> 24435 bytes
-rw-r--r--packages/website/public/images/team/steve.pngbin49008 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/steveK.jpgbin0 -> 39082 bytes
-rw-r--r--packages/website/public/images/team/tom.jpgbin14565 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/toms.jpgbin0 -> 13682 bytes
-rwxr-xr-xpackages/website/public/images/team/weijew.jpgbin0 -> 22031 bytes
-rw-r--r--packages/website/public/images/team/weijie.pngbin38401 -> 0 bytes
-rw-r--r--packages/website/public/images/team/will.jpgbin11493 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/willw.jpgbin0 -> 25440 bytes
-rwxr-xr-xpackages/website/public/images/team/xianny.jpgbin0 -> 29992 bytes
-rw-r--r--packages/website/public/images/team/zach.pngbin119387 -> 0 bytes
-rwxr-xr-xpackages/website/public/images/team/zack.jpgbin0 -> 19292 bytes
-rw-r--r--packages/website/public/index.html218
-rw-r--r--packages/website/translations/chinese.json9
-rw-r--r--packages/website/translations/english.json8
-rw-r--r--packages/website/translations/korean.json5
-rw-r--r--packages/website/translations/russian.json9
-rw-r--r--packages/website/translations/spanish.json9
-rw-r--r--packages/website/ts/components/aboutPageLayout.tsx71
-rw-r--r--packages/website/ts/components/animatedChatIcon.tsx106
-rw-r--r--packages/website/ts/components/animatedCompassIcon.tsx53
-rw-r--r--packages/website/ts/components/banner.tsx147
-rw-r--r--packages/website/ts/components/blockIconLink.tsx84
-rw-r--r--packages/website/ts/components/button.tsx107
-rw-r--r--packages/website/ts/components/chapter_link.tsx15
-rw-r--r--packages/website/ts/components/definition.tsx145
-rw-r--r--packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx46
-rw-r--r--packages/website/ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx33
-rw-r--r--packages/website/ts/components/documentation/sidebar_header.tsx16
-rw-r--r--packages/website/ts/components/dropdowns/developers_drop_down.tsx4
-rw-r--r--packages/website/ts/components/dropdowns/dropdown_developers.tsx184
-rw-r--r--packages/website/ts/components/dropdowns/dropdown_products.tsx48
-rw-r--r--packages/website/ts/components/eth_wrappers.tsx2
-rw-r--r--packages/website/ts/components/fill_warning_dialog.tsx2
-rw-r--r--packages/website/ts/components/footer.tsx368
-rw-r--r--packages/website/ts/components/forms/subscribe_form.tsx127
-rw-r--r--packages/website/ts/components/hamburger.tsx72
-rw-r--r--packages/website/ts/components/header.tsx252
-rw-r--r--packages/website/ts/components/hero.tsx152
-rw-r--r--packages/website/ts/components/heroAnimation.tsx123
-rw-r--r--packages/website/ts/components/heroImage.tsx27
-rw-r--r--packages/website/ts/components/icon.tsx72
-rw-r--r--packages/website/ts/components/image.tsx20
-rw-r--r--packages/website/ts/components/link.tsx64
-rw-r--r--packages/website/ts/components/logo.tsx41
-rw-r--r--packages/website/ts/components/mobileNav.tsx121
-rw-r--r--packages/website/ts/components/modals/input.tsx95
-rw-r--r--packages/website/ts/components/modals/modal_contact.tsx395
-rw-r--r--packages/website/ts/components/newLayout.tsx152
-rw-r--r--packages/website/ts/components/newsletter_form.tsx202
-rw-r--r--packages/website/ts/components/old_footer.tsx228
-rw-r--r--packages/website/ts/components/onboarding/onboarding_flow.tsx4
-rw-r--r--packages/website/ts/components/redirector.tsx9
-rw-r--r--packages/website/ts/components/sections/landing/about.tsx81
-rw-r--r--packages/website/ts/components/sections/landing/clients.tsx113
-rw-r--r--packages/website/ts/components/sections/landing/cta.tsx29
-rw-r--r--packages/website/ts/components/sections/landing/hero.tsx31
-rw-r--r--packages/website/ts/components/siteWrap.tsx149
-rw-r--r--packages/website/ts/components/slider/slider.tsx177
-rw-r--r--packages/website/ts/components/text.tsx83
-rw-r--r--packages/website/ts/components/ui/animation.tsx42
-rw-r--r--packages/website/ts/components/ui/check_mark.tsx31
-rw-r--r--packages/website/ts/components/ui/container.tsx43
-rw-r--r--packages/website/ts/components/ui/ease_up_from_bottom_animation.tsx31
-rw-r--r--packages/website/ts/components/ui/filled_image.tsx18
-rw-r--r--packages/website/ts/components/ui/image.tsx2
-rw-r--r--packages/website/ts/components/ui/input.tsx43
-rw-r--r--packages/website/ts/components/ui/multi_select.tsx66
-rw-r--r--packages/website/ts/components/ui/simple_loading.tsx17
-rw-r--r--packages/website/ts/components/ui/text.tsx3
-rw-r--r--packages/website/ts/components/ui/typed_text.tsx75
-rw-r--r--packages/website/ts/constants/.gitkeep0
-rw-r--r--packages/website/ts/constants/animations.tsx18
-rw-r--r--packages/website/ts/constants/cssReset.js50
-rw-r--r--packages/website/ts/constants/globalStyle.tsx109
-rw-r--r--packages/website/ts/constants/utilities.tsx22
-rw-r--r--packages/website/ts/containers/about.ts25
-rw-r--r--packages/website/ts/containers/jobs.ts28
-rw-r--r--packages/website/ts/containers/landing.ts27
-rw-r--r--packages/website/ts/containers/launch_kit.ts27
-rw-r--r--packages/website/ts/containers/migrations_documentation.ts66
-rw-r--r--packages/website/ts/containers/order_watcher_documentation.ts2
-rw-r--r--packages/website/ts/globals.d.ts13
-rwxr-xr-xpackages/website/ts/icons/illustrations/0x.svg14
-rwxr-xr-xpackages/website/ts/icons/illustrations/buildBusiness.svg6
-rw-r--r--packages/website/ts/icons/illustrations/checkmark.svg1
-rw-r--r--packages/website/ts/icons/illustrations/code-repo.svg7
-rw-r--r--packages/website/ts/icons/illustrations/coin.svg1
-rw-r--r--packages/website/ts/icons/illustrations/consistently-ship.svg6
-rw-r--r--packages/website/ts/icons/illustrations/customize.svg1
-rwxr-xr-xpackages/website/ts/icons/illustrations/decentralisedLoans.svg13
-rwxr-xr-xpackages/website/ts/icons/illustrations/description.svg21
-rwxr-xr-xpackages/website/ts/icons/illustrations/descriptionBolt.svg4
-rwxr-xr-xpackages/website/ts/icons/illustrations/descriptionCoin.svg9
-rwxr-xr-xpackages/website/ts/icons/illustrations/descriptionCopy.svg7
-rwxr-xr-xpackages/website/ts/icons/illustrations/descriptionFlask.svg7
-rwxr-xr-xpackages/website/ts/icons/illustrations/eficientDesign.svg11
-rw-r--r--packages/website/ts/icons/illustrations/eth-based-tokens.svg6
-rwxr-xr-xpackages/website/ts/icons/illustrations/extensibleArchitecture.svg11
-rwxr-xr-xpackages/website/ts/icons/illustrations/flexibleIntegration.svg12
-rwxr-xr-xpackages/website/ts/icons/illustrations/flexibleIntegration0xInstant.svg17
-rwxr-xr-xpackages/website/ts/icons/illustrations/flexibleOrders.svg4
-rwxr-xr-xpackages/website/ts/icons/illustrations/gamingAndCollectibles.svg18
-rwxr-xr-xpackages/website/ts/icons/illustrations/generateRevenueForYourBusiness-large.svg28
-rwxr-xr-xpackages/website/ts/icons/illustrations/getInTouch.svg13
-rw-r--r--packages/website/ts/icons/illustrations/getStarted.svg13
-rw-r--r--packages/website/ts/icons/illustrations/launchKit.svg18
-rwxr-xr-xpackages/website/ts/icons/illustrations/launchKit_versionB.svg7
-rwxr-xr-xpackages/website/ts/icons/illustrations/legalResources.svg4
-rw-r--r--packages/website/ts/icons/illustrations/logo-mark.svg6
-rw-r--r--packages/website/ts/icons/illustrations/logo-outlined.svg14
-rw-r--r--packages/website/ts/icons/illustrations/long-term-impact.svg9
-rw-r--r--packages/website/ts/icons/illustrations/low-cost.svg30
-rwxr-xr-xpackages/website/ts/icons/illustrations/marketingDesignHelp.svg11
-rwxr-xr-xpackages/website/ts/icons/illustrations/milestoneGrants.svg7
-rwxr-xr-xpackages/website/ts/icons/illustrations/networkedLiquidity-small.svg20
-rwxr-xr-xpackages/website/ts/icons/illustrations/networkedLiquidity.svg28
-rwxr-xr-xpackages/website/ts/icons/illustrations/orderBooks.svg8
-rwxr-xr-xpackages/website/ts/icons/illustrations/predictionMarkets.svg7
-rw-r--r--packages/website/ts/icons/illustrations/protocol.svg1
-rw-r--r--packages/website/ts/icons/illustrations/ready-to-build.svg1
-rwxr-xr-xpackages/website/ts/icons/illustrations/recruitingSupport.svg7
-rw-r--r--packages/website/ts/icons/illustrations/right-thing.svg6
-rwxr-xr-xpackages/website/ts/icons/illustrations/robustSmartContracts.svg6
-rw-r--r--packages/website/ts/icons/illustrations/rocketship.svg9
-rwxr-xr-xpackages/website/ts/icons/illustrations/secureTrading.svg15
-rw-r--r--packages/website/ts/icons/illustrations/social-discord.svg3
-rw-r--r--packages/website/ts/icons/illustrations/social-fb.svg3
-rw-r--r--packages/website/ts/icons/illustrations/social-github.svg3
-rw-r--r--packages/website/ts/icons/illustrations/social-newsletter.svg3
-rw-r--r--packages/website/ts/icons/illustrations/social-reddit.svg3
-rw-r--r--packages/website/ts/icons/illustrations/social-twitter.svg3
-rwxr-xr-xpackages/website/ts/icons/illustrations/stableTokens.svg10
-rwxr-xr-xpackages/website/ts/icons/illustrations/standardForExchange.svg12
-rw-r--r--packages/website/ts/icons/illustrations/support.svg1
-rwxr-xr-xpackages/website/ts/icons/illustrations/supportForAllEthereumStandards-large.svg28
-rwxr-xr-xpackages/website/ts/icons/illustrations/supportForAllEthereumStandards.svg21
-rwxr-xr-xpackages/website/ts/icons/illustrations/techSupport.svg13
-rw-r--r--packages/website/ts/icons/illustrations/tokens.svg1
-rwxr-xr-xpackages/website/ts/icons/illustrations/vcIntroductions.svg11
-rw-r--r--packages/website/ts/icons/logo-with-type.svg1
-rw-r--r--packages/website/ts/index.tsx54
-rw-r--r--packages/website/ts/pages/about/about.tsx413
-rw-r--r--packages/website/ts/pages/about/jobs.tsx236
-rw-r--r--packages/website/ts/pages/about/mission.tsx97
-rw-r--r--packages/website/ts/pages/about/press.tsx94
-rw-r--r--packages/website/ts/pages/about/profile.tsx80
-rw-r--r--packages/website/ts/pages/about/team.tsx286
-rw-r--r--packages/website/ts/pages/community.tsx289
-rw-r--r--packages/website/ts/pages/documentation/developers_page.tsx4
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx1
-rw-r--r--packages/website/ts/pages/documentation/docs_home.tsx43
-rw-r--r--packages/website/ts/pages/ecosystem.tsx128
-rw-r--r--packages/website/ts/pages/faq/faq.tsx4
-rw-r--r--packages/website/ts/pages/instant.tsx261
-rw-r--r--packages/website/ts/pages/instant/code_demo.tsx183
-rw-r--r--packages/website/ts/pages/instant/config_generator.tsx332
-rw-r--r--packages/website/ts/pages/instant/config_generator_address_input.tsx84
-rw-r--r--packages/website/ts/pages/instant/configurator.tsx104
-rw-r--r--packages/website/ts/pages/instant/fee_percentage_slider.tsx80
-rw-r--r--packages/website/ts/pages/instant/rc-slider.css295
-rw-r--r--packages/website/ts/pages/instant/select.tsx74
-rw-r--r--packages/website/ts/pages/jobs/benefits.tsx158
-rw-r--r--packages/website/ts/pages/jobs/jobs.tsx71
-rw-r--r--packages/website/ts/pages/jobs/join_0x.tsx64
-rw-r--r--packages/website/ts/pages/jobs/mission.tsx47
-rw-r--r--packages/website/ts/pages/jobs/open_positions.tsx179
-rw-r--r--packages/website/ts/pages/jobs/photo_rail.tsx22
-rw-r--r--packages/website/ts/pages/landing.tsx44
-rw-r--r--packages/website/ts/pages/landing/landing.tsx620
-rw-r--r--packages/website/ts/pages/launch_kit.tsx125
-rw-r--r--packages/website/ts/pages/launch_kit/launch_kit.tsx335
-rw-r--r--packages/website/ts/pages/market_maker.tsx162
-rw-r--r--packages/website/ts/pages/not_found.tsx2
-rw-r--r--packages/website/ts/pages/why.tsx309
-rw-r--r--packages/website/ts/style/colors.ts11
-rw-r--r--packages/website/ts/style/theme.ts4
-rw-r--r--packages/website/ts/types.ts16
-rw-r--r--packages/website/ts/utils/configs.ts4
-rw-r--r--packages/website/ts/utils/constants.ts16
-rw-r--r--packages/website/tsconfig.json4
-rw-r--r--packages/website/tslint.json3
-rw-r--r--packages/website/webpack.config.js29
-rw-r--r--python-packages/json_schemas/.discharge.json13
-rw-r--r--python-packages/json_schemas/.pylintrc3
-rw-r--r--python-packages/json_schemas/README.md45
-rwxr-xr-xpython-packages/json_schemas/setup.py191
-rw-r--r--python-packages/json_schemas/src/conf.py54
-rw-r--r--python-packages/json_schemas/src/doc_static/.gitkeep0
-rw-r--r--python-packages/json_schemas/src/index.rst18
-rw-r--r--python-packages/json_schemas/src/zero_ex/__init__.py2
-rw-r--r--python-packages/json_schemas/src/zero_ex/json_schemas/__init__.py83
-rw-r--r--python-packages/json_schemas/src/zero_ex/json_schemas/py.typed0
l---------python-packages/json_schemas/src/zero_ex/json_schemas/schemas (renamed from python-packages/order_utils/src/zero_ex/json_schemas/schemas)0
-rw-r--r--python-packages/json_schemas/stubs/distutils/__init__.pyi0
-rw-r--r--python-packages/json_schemas/stubs/distutils/command/__init__.pyi0
-rw-r--r--python-packages/json_schemas/stubs/distutils/command/clean.pyi7
-rw-r--r--python-packages/json_schemas/stubs/jsonschema/__init__.pyi11
-rw-r--r--python-packages/json_schemas/stubs/jsonschema/exceptions.pyi0
-rw-r--r--python-packages/json_schemas/stubs/pytest/__init__.pyi0
-rw-r--r--python-packages/json_schemas/stubs/pytest/raises.pyi1
-rw-r--r--python-packages/json_schemas/stubs/setuptools/__init__.pyi8
-rw-r--r--python-packages/json_schemas/stubs/setuptools/command/__init__.pyi0
-rw-r--r--python-packages/json_schemas/stubs/setuptools/command/test.pyi3
-rw-r--r--python-packages/json_schemas/stubs/stringcase/__init__.pyi2
-rw-r--r--python-packages/json_schemas/test/__init__.py1
-rw-r--r--python-packages/json_schemas/test/test_doctest.py25
-rw-r--r--python-packages/json_schemas/test/test_json_schemas.py41
-rw-r--r--python-packages/json_schemas/tox.ini25
-rwxr-xr-xpython-packages/order_utils/setup.py11
-rw-r--r--python-packages/order_utils/src/index.rst3
-rw-r--r--python-packages/order_utils/src/zero_ex/dev_utils/type_assertions.py2
-rw-r--r--python-packages/order_utils/src/zero_ex/json_schemas/__init__.py61
-rw-r--r--python-packages/order_utils/stubs/jsonschema/__init__.pyi5
-rw-r--r--python-packages/order_utils/stubs/web3/__init___BASE_31011.pyi26
-rw-r--r--python-packages/order_utils/test/test_doctest.py5
-rw-r--r--python-packages/sra_client/README.md332
-rw-r--r--python-packages/sra_client/docs/DefaultApi.md397
-rw-r--r--python-packages/sra_client/docs/OrderSchema.md21
-rw-r--r--python-packages/sra_client/docs/PaginatedCollectionSchema.md11
-rw-r--r--python-packages/sra_client/docs/RelayerApiAssetDataPairsResponseSchema.md9
-rw-r--r--python-packages/sra_client/docs/RelayerApiAssetDataTradeInfoSchema.md12
-rw-r--r--python-packages/sra_client/docs/RelayerApiErrorResponseSchema.md11
-rw-r--r--python-packages/sra_client/docs/RelayerApiErrorResponseSchemaValidationErrors.md11
-rw-r--r--python-packages/sra_client/docs/RelayerApiFeeRecipientsResponseSchema.md9
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrderConfigPayloadSchema.md16
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrderConfigResponseSchema.md12
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrderSchema.md10
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrderbookResponseSchema.md10
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribePayloadSchema.md16
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribeSchema.md12
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrdersChannelUpdateSchema.md12
-rw-r--r--python-packages/sra_client/docs/RelayerApiOrdersResponseSchema.md9
-rw-r--r--python-packages/sra_client/docs/SignedOrderSchema.md9
-rwxr-xr-xpython-packages/sra_client/generate.sh26
-rw-r--r--python-packages/sra_client/openapi-generator-cli-config.json4
-rw-r--r--python-packages/sra_client/requirements.txt5
-rwxr-xr-xpython-packages/sra_client/setup.py67
-rw-r--r--python-packages/sra_client/sra_client/__init__.py59
-rw-r--r--python-packages/sra_client/sra_client/api/__init__.py6
-rw-r--r--python-packages/sra_client/sra_client/api/default_api.py976
-rw-r--r--python-packages/sra_client/sra_client/api_client.py730
-rw-r--r--python-packages/sra_client/sra_client/configuration.py225
-rw-r--r--python-packages/sra_client/sra_client/models/__init__.py49
-rw-r--r--python-packages/sra_client/sra_client/models/order_schema.py550
-rw-r--r--python-packages/sra_client/sra_client/models/paginated_collection_schema.py161
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_asset_data_pairs_response_schema.py107
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_asset_data_trade_info_schema.py209
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_error_response_schema.py176
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_error_response_schema_validation_errors.py171
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_fee_recipients_response_schema.py107
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_order_config_payload_schema.py372
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_order_config_response_schema.py228
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_order_schema.py134
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_orderbook_response_schema.py137
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_payload_schema.py344
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_schema.py211
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_orders_channel_update_schema.py211
-rw-r--r--python-packages/sra_client/sra_client/models/relayer_api_orders_response_schema.py107
-rw-r--r--python-packages/sra_client/sra_client/models/signed_order_schema.py113
-rw-r--r--python-packages/sra_client/sra_client/rest.py421
-rw-r--r--python-packages/sra_client/test-requirements.txt5
-rw-r--r--python-packages/sra_client/test/__init__.py0
-rw-r--r--python-packages/sra_client/test/test_default_api.py35
-rw-r--r--python-packages/sra_client/tox.ini24
-rw-r--r--tsconfig.json16
1333 files changed, 121925 insertions, 28966 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 756a17fce..fadcbeab8 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -18,6 +18,7 @@ jobs:
name: yarn
command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install
- run: yarn build:ci:no_website
+ - run: yarn build:ts
- save_cache:
key: repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -40,7 +41,12 @@ jobs:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- - run: yarn wsrun test:circleci contracts
+ - run: yarn wsrun test:circleci @0x/contracts-multisig
+ - run: yarn wsrun test:circleci @0x/contracts-utils
+ - run: yarn wsrun test:circleci @0x/contracts-libs
+ - run: yarn wsrun test:circleci @0x/contracts-tokens
+ - run: yarn wsrun test:circleci @0x/contracts-extensions
+ - run: yarn wsrun test:circleci @0x/contracts-protocol
test-contracts-geth:
docker:
- image: circleci/node:9-browsers
@@ -52,7 +58,12 @@ jobs:
- repo-{{ .Environment.CIRCLE_SHA1 }}
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
# initialized
- - run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts
+ - run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test @0x/contracts-multisig
+ - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-utils
+ - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-libs
+ - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-tokens
+ - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-extensions
+ - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-protocol
test-publish:
resource_class: medium+
docker:
@@ -73,6 +84,20 @@ jobs:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn test:generate_docs:circleci
+ test-pipeline:
+ docker:
+ - image: circleci/node:9
+ - image: postgres:11-alpine
+ working_directory: ~/repo
+ steps:
+ - restore_cache:
+ keys:
+ - repo-{{ .Environment.CIRCLE_SHA1 }}
+ - run: ZEROEX_DATA_PIPELINE_TEST_DB_URL='postgresql://postgres@localhost/postgres' yarn wsrun test:circleci @0x/pipeline
+ - save_cache:
+ key: coverage-pipeline-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/packages/pipeline/coverage/lcov.info
test-rest:
docker:
- image: circleci/node:9-browsers
@@ -81,6 +106,7 @@ jobs:
- restore_cache:
keys:
- repo-{{ .Environment.CIRCLE_SHA1 }}
+ - run: yarn wsrun test:circleci @0x/contracts-test-utils
- run: yarn wsrun test:circleci @0x/abi-gen
- run: yarn wsrun test:circleci @0x/assert
- run: yarn wsrun test:circleci @0x/base-contract
@@ -162,9 +188,10 @@ jobs:
working_directory: ~/repo
docker:
- image: circleci/python
- - image: 0xorg/ganache-cli
+ - image: 0xorg/ganache-cli:2.2.2
+ - image: 0xorg/launch-kit-ci
command: |
- ganache-cli --gasLimit 10000000 --noVMErrorsOnRPCResponse --db /snapshot --noVMErrorsOnRPCResponse -p 8545 --networkId 50 -m "concert load couple harbor equip island argue ramp clarify fence smart topic"
+ yarn start:ts -p 3000:3000
steps:
- checkout
- run: sudo chown -R circleci:circleci /usr/local/bin
@@ -173,9 +200,25 @@ jobs:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
command: |
+ cd python-packages/json_schemas
+ python -m ensurepip
+ python -m pip install .[dev]
+ # HACK! installing the package should do the following
+ # copy for us, but it's not working in CircleCI for some
+ # reason. Zendesk support ticket raised (#43979) with
+ # CircleCI.
+ mkdir /usr/local/lib/python3.7/site-packages/zero_ex/json_schemas/schemas
+ cp -R src/zero_ex/json_schemas/schemas/* /usr/local/lib/python3.7/site-packages/zero_ex/json_schemas/schemas
+ - run:
+ command: |
cd python-packages/order_utils
python -m ensurepip
- python -m pip install -e .[dev]
+ python -m pip install .[dev]
+ - run:
+ command: |
+ cd python-packages/sra_client
+ python -m ensurepip
+ python -m pip install .[dev]
- save_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -187,12 +230,28 @@ jobs:
- '.tox'
- run:
command: |
+ cd python-packages/json_schemas
+ coverage run setup.py test
+ - run:
+ command: |
cd python-packages/order_utils
coverage run setup.py test
+ - run:
+ command: |
+ cd python-packages/sra_client
+ coverage run setup.py test
+ - save_cache:
+ key: coverage-python-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/python-packages/json_schemas/.coverage
- save_cache:
key: coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/order_utils/.coverage
+ - save_cache:
+ key: coverage-python-sra-client-{{ .Environment.CIRCLE_SHA1 }}
+ paths:
+ - ~/repo/python-packages/sra_client/.coverage
test-rest-python:
working_directory: ~/repo
docker:
@@ -207,7 +266,7 @@ jobs:
command: |
cd python-packages/order_utils
python -m ensurepip
- python -m pip install -e .[dev]
+ python -m pip install .
- save_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -233,9 +292,14 @@ jobs:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
command: |
+ cd python-packages/json_schemas
+ python -m ensurepip
+ python -m pip install .[dev]
+ - run:
+ command: |
cd python-packages/order_utils
python -m ensurepip
- python -m pip install -e .[dev]
+ python -m pip install .[dev]
- save_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -243,6 +307,10 @@ jobs:
- '/usr/local/lib/python3.7/site-packages'
- run:
command: |
+ cd python-packages/json_schemas
+ python setup.py lint
+ - run:
+ command: |
cd python-packages/order_utils
python setup.py lint
static-tests:
@@ -315,6 +383,9 @@ jobs:
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
+ - coverage-python-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
+ - restore_cache:
+ keys:
- coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn report_coverage
workflows:
@@ -331,6 +402,9 @@ workflows:
- test-contracts-geth:
requires:
- build
+ - test-pipeline:
+ requires:
+ - build
- test-rest:
requires:
- build
diff --git a/.github/autolabeler.yml b/.github/autolabeler.yml
new file mode 100644
index 000000000..8284293d5
--- /dev/null
+++ b/.github/autolabeler.yml
@@ -0,0 +1,39 @@
+python: ['python-packages']
+contracts: ['contracts']
+sol-doc: ['packages/sol-doc']
+sol-resolver: ['packages/sol-resolver']
+sra-spec: ['packages/sra-spec']
+subproviders: ['packages/subproviders']
+contract-addresses: ['packages/contract-addresses']
+migrations: ['packages/migrations']
+web3-wrapper: ['packages/web3-wrapper']
+sol-compiler: ['packages/sol-compiler']
+types: ['packages/types']
+instant: ['packages/instant']
+abi-gen-templates: ['packages/abi-gen-templates']
+abi-gen: ['packages/abi-gen']
+website: ['packages/website']
+sol-cov: ['packages/sol-cov']
+utils: ['packages/utils']
+tslint-config: ['packages/tslint-config']
+asset-buyer: ['packages/asset-buyer']
+order-watcher: ['packages/order-watcher']
+react-docs: ['packages/react-docs']
+order-utils: ['packages/order-utils']
+react-shared: ['packages/react-shared']
+assert: ['packages/assert']
+base-contract: ['packages/base-contract']
+typescript-typings: ['packages/typescript-typings']
+0x.js: ['packages/0x.js']
+abi-gen-wrappers: ['packages/abi-gen-wrappers']
+metacoin: ['packages/metacoin']
+contract-artifacts: ['packages/contract-artifacts']
+dev-utils: ['packages/dev-utils']
+contract-wrappers: ['packages/contract-wrappers']
+json-schemas: ['packages/json-schemas']
+ethereum-types: ['ethereum-types']
+connect: ['packages/connect']
+fill-scenarios: ['packages/fill-scenarios']
+dev-tools-pages: ['packages/dev-tools-pages']
+testnet-faucets: ['packages/testnet-faucets']
+monorepo-scripts: ['packages/monorepo-scripts']
diff --git a/.github/stale.yml b/.github/stale.yml
new file mode 100644
index 000000000..09eb40a77
--- /dev/null
+++ b/.github/stale.yml
@@ -0,0 +1,19 @@
+# Number of days of inactivity before an issue becomes stale
+daysUntilStale: 30
+# Number of days of inactivity before a stale issue is closed
+daysUntilClose: 30
+# Issues with these labels will never be considered stale
+exemptLabels:
+ - pinned
+ - security
+# Label to use when marking an issue as stale
+staleLabel: stale
+# Comment to post when marking an issue as stale. Set to `false` to disable
+markComment: >
+ This issue has been automatically marked as stale because it has not had
+ recent activity. It will be closed if no further activity occurs. Thank you
+ for your contributions.
+# Comment to post when closing a stale issue. Set to `false` to disable
+closeComment: >
+ This issue has been automatically closed because no activity occured in 7 days after being marked as stale. If it's still relevant - feel free to reopen. Thank you
+ for your contributions.
diff --git a/.gitignore b/.gitignore
index 9e43f20b0..1d4410e25 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,10 @@ pids
*.seed
*.pid.lock
+# SQLite database files
+*.db
+*.sqlite
+
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
@@ -79,13 +83,27 @@ packages/react-docs/example/public/bundle*
packages/testnet-faucets/server/
# generated contract artifacts/
-packages/contracts/generated-artifacts/
+contracts/protocol/generated-artifacts/
+contracts/multisig/generated-artifacts/
+contracts/utils/generated-artifacts/
+contracts/libs/generated-artifacts/
+contracts/interfaces/generated-artifacts/
+contracts/tokens/generated-artifacts/
+contracts/examples/generated-artifacts/
+contracts/extensions/generated-artifacts/
packages/sol-cov/test/fixtures/artifacts/
packages/metacoin/artifacts/
# generated contract wrappers
packages/abi-gen-wrappers/wrappers
-packages/contracts/generated-wrappers/
+contracts/protocol/generated-wrappers/
+contracts/multisig/generated-wrappers/
+contracts/utils/generated-wrappers/
+contracts/libs/generated-wrappers/
+contracts/interfaces/generated-wrappers/
+contracts/tokens/generated-wrappers/
+contracts/examples/generated-wrappers/
+contracts/extensions/generated-wrappers/
packages/metacoin/src/contract_wrappers
# solc-bin in sol-compiler
diff --git a/.prettierignore b/.prettierignore
index 3ce7713cc..d48dcea08 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,12 +1,26 @@
lib
.nyc_output
-/packages/contracts/generated-wrappers
-/packages/contracts/generated-artifacts
+/contracts/protocol/generated-wrappers
+/contracts/protocol/generated-artifacts
+/contracts/multisig/generated-wrappers
+/contracts/multisig/generated-artifacts
+/contracts/utils/generated-wrappers
+/contracts/utils/generated-artifacts
+/contracts/libs/generated-wrappers
+/contracts/libs/generated-artifacts
+/contracts/interfaces/generated-wrappers
+/contracts/interfaces/generated-artifacts
+/contracts/tokens/generated-wrappers
+/contracts/tokens/generated-artifacts
+/contracts/examples/generated-wrappers
+/contracts/examples/generated-artifacts
+/contracts/extensions/generated-wrappers
+/contracts/extensions/generated-artifacts
/packages/abi-gen-wrappers/src/generated-wrappers
/packages/contract-artifacts/artifacts
/python-packages/order_utils/src/zero_ex/contract_artifacts/artifacts
/packages/json-schemas/schemas
-/python-packages/order_utils/src/zero_ex/json_schemas/schemas
+/python-packages/json_schemas/src/zero_ex/json_schemas/schemas
/packages/metacoin/src/contract_wrappers
/packages/metacoin/artifacts
/packages/sra-spec/public/
@@ -14,3 +28,6 @@ lib
package.json
scripts/postpublish_utils.js
packages/sol-cov/test/fixtures/artifacts
+.pytest_cache
+.mypy_cache
+.tox
diff --git a/CODEOWNERS b/CODEOWNERS
index 3cf75fb2d..ca98ec19b 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -14,7 +14,7 @@ packages/website/ @BMillman19 @fragosti @fabioberger @steveklebanoff
packages/abi-gen/ @LogvinovLeon
packages/base-contract/ @LogvinovLeon
packages/connect/ @fragosti
-packages/contract_templates/ @LogvinovLeon
+packages/abi-gen-templates/ @LogvinovLeon
packages/contract-addresses/ @albrow
packages/contract-artifacts/ @albrow
packages/dev-utils/ @LogvinovLeon @fabioberger
@@ -32,4 +32,4 @@ packages/web3-wrapper/ @LogvinovLeon @fabioberger
python-packages/ @feuGeneA
# Protocol/smart contracts
-packages/contracts/test/ @albrow
+contracts/core/test/ @albrow
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1fea8f501..3e709b36f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -79,7 +79,20 @@ If using the Atom text editor, we recommend you install the following packages:
* VSCode: [prettier-vscode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
* Atom: [prettier-atom](https://atom.io/packages/prettier-atom)
-## Fix `submit-coverage` CI failure
+## Unenforced coding conventions
+
+A few of our coding conventions are not yet enforced by the linter/auto-formatter. Be careful to follow these conventions in your PR's.
+
+1. Unused anonymous function parameters should be named with an underscore + number (e.g \_1, \_2, etc...)
+1. There should be a new-line between methods in a class and between test cases.
+1. If a string literal has the same value in two or more places, it should be a single constant referenced in both places.
+1. Do not import from a project's `index.ts` (e.g import { Token } from '../src';). Always import from the source file itself.
+1. Generic error variables should be named `err` instead of `e` or `error`.
+1. If you _must_ cast a variable to any - try to type it back as fast as possible. (e.g., `const cw = ((zeroEx as any)._contractWrappers as ContractWrappers);`). This ensures subsequent code is type-safe.
+1. Our enum conventions coincide with the recommended Typescript conventions, using capitalized keys, and all-caps snake-case values. Eg `GetStats = 'GET_STATS'`
+1. All public, exported methods/functions/classes must have associated Javadoc-style comments.
+
+### Fix `submit-coverage` CI failure
If you simply fork the repo and then create a PR from it, your PR will fail the `submit-coverage` check on CI. This is because the 0x CircleCI configuration sets the `COVERALLS_REPO_TOKEN` environment variable to the token for `0xProject/0x-monorepo`, but when running the check against your fork the token needs to match your repo's name `your-username/0x-monorepo`.
diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md
index 9bacbcede..70c5e8a9f 100644
--- a/PULL_REQUEST_TEMPLATE.md
+++ b/PULL_REQUEST_TEMPLATE.md
@@ -21,7 +21,6 @@
<!--- The following points should be used to indicate the progress of your PR. Put an `x` in all the boxes that apply right now, and come back over time and check them off as you make progress. If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
* [ ] Prefix PR title with `[WIP]` if necessary.
-* [ ] Prefix PR title with bracketed package name(s) corresponding to the changed package(s). For example: `[sol-cov] Fixed bug`.
* [ ] Add tests to cover changes as needed.
* [ ] Update documentation as needed.
* [ ] Add new entries to the relevant CHANGELOG.jsons.
diff --git a/README.md b/README.md
index 90810f089..30f78b504 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
-<img src="https://github.com/0xProject/branding/blob/master/0x_Black_CMYK.png" width="200px" >
+<img src="https://github.com/0xProject/branding/blob/master/0x%20Logo/PNG/0x-Logo-Black.png" width="150px" >
---
-[0x][website-url] is an open protocol that facilitates trustless, low friction exchange of Ethereum-based assets. A full description of the protocol may be found in our [whitepaper][whitepaper-url].
+[0x][website-url] is an open protocol that facilitates trustless, low friction exchange of Ethereum-based assets. For more information on how it works, check out the [0x protocol specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
This repository is a monorepo including the 0x protocol smart contracts and numerous developer tools. Each public sub-package is independently published to NPM.
@@ -18,71 +18,75 @@ If you're developing on 0x now or are interested in using 0x infrastructure in t
[![Join the chat at https://gitter.im/0xProject/Lobby](https://badges.gitter.im/0xProject/Lobby.svg)](https://gitter.im/0xProject/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
-### Published Packages
-
-#### TypeScript/JavaScript
-
-| Package | Version | Description |
-| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
-| [`0x.js`](/packages/0x.js) | [![npm](https://img.shields.io/npm/v/0x.js.svg)](https://www.npmjs.com/package/0x.js) | A Javascript library for interacting with the 0x protocol |
-| [`@0x/abi-gen`](/packages/abi-gen) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen.svg)](https://www.npmjs.com/package/@0x/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
-| [`@0x/abi-gen-wrappers`](/packages/abi-gen-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen-wrappers.svg)](https://www.npmjs.com/package/@0x/abi-gen-wrappers) | Low-level 0x smart contract wrappers generated using @0x/abi-gen |
-| [`@0x/assert`](/packages/assert) | [![npm](https://img.shields.io/npm/v/@0x/assert.svg)](https://www.npmjs.com/package/@0x/assert) | Type and schema assertions used by our packages |
-| [`@0x/asset-buyer`](/packages/asset-buyer) | [![npm](https://img.shields.io/npm/v/@0x/asset-buyer.svg)](https://www.npmjs.com/package/@0x/asset-buyer) | Convenience package for discovering and buying assets with Ether |
-| [`@0x/base-contract`](/packages/base-contract) | [![npm](https://img.shields.io/npm/v/@0x/base-contract.svg)](https://www.npmjs.com/package/@0x/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
-| [`@0x/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0x/connect.svg)](https://www.npmjs.com/package/@0x/connect) | A Javascript library for interacting with the Standard Relayer API |
-| [`@0x/contract-addresses`](/packages/contract-addresses) | [![npm](https://img.shields.io/npm/v/@0x/contract-addresses.svg)](https://www.npmjs.com/package/@0x/contract-addresses) | Used to get known addresses of deployed 0x contracts |
-| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [![npm](https://img.shields.io/npm/v/@0x/contract-artifacts.svg)](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts |
-| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/contract-wrappers.svg)](https://www.npmjs.com/package/@0x/contract-wrappers) | Smart TS wrappers for 0x smart contracts |
-| [`@0x/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0x/dev-utils.svg)](https://www.npmjs.com/package/@0x/dev-utils) | Dev utils to be shared across 0x projects and packages |
-| [`@0x/fill-scenarios`](/packages/fill-scenarios) | [![npm](https://img.shields.io/npm/v/@0x/fill-scenarios.svg)](https://www.npmjs.com/package/@0x/fill-scenarios) | 0x order fill scenario generation |
-| [`@0x/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0x/json-schemas.svg)](https://www.npmjs.com/package/@0x/json-schemas) | 0x-related json schemas |
-| [`@0x/migrations`](/packages/migrations) | [![npm](https://img.shields.io/npm/v/@0x/migrations.svg)](https://www.npmjs.com/package/@0x/migrations) | 0x smart contract migrations |
-| [`@0x/order-utils`](/packages/order-utils) | [![npm](https://img.shields.io/npm/v/@0x/order-utils.svg)](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
-| [`@0x/order-watcher`](/packages/order-watcher) | [![npm](https://img.shields.io/npm/v/@0x/order-watcher.svg)](https://www.npmjs.com/package/@0x/order-watcher) | An order watcher daemon that watches for order validity |
-| [`@0x/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0x/react-docs.svg)](https://www.npmjs.com/package/@0x/react-docs) | React documentation component for rendering TypeDoc & Doxity generated JSON |
-| [`@0x/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0x/react-shared.svg)](https://www.npmjs.com/package/@0x/react-shared) | 0x shared react components |
-| [`@0x/sol-compiler`](/packages/sol-compiler) | [![npm](https://img.shields.io/npm/v/@0x/sol-compiler.svg)](https://www.npmjs.com/package/@0x/sol-compiler) | A thin wrapper around Solc.js that outputs artifacts, resolves imports, only re-compiles when needed, and other niceties |
-| [`@0x/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0x/sol-cov.svg)](https://www.npmjs.com/package/@0x/sol-cov) | Solidity test coverage tool |
-| [`@0x/sol-doc`](/packages/sol-doc) | [![npm](https://img.shields.io/npm/v/@0x/sol-doc.svg)](https://www.npmjs.com/package/@0x/sol-doc) | Solidity documentation generator |
-| [`@0x/sol-resolver`](/packages/sol-resolver) | [![npm](https://img.shields.io/npm/v/@0x/sol-resolver.svg)](https://www.npmjs.com/package/@0x/sol-resolver) | Import resolver for smart contracts dependencies |
-| [`@0x/sra-spec`](/packages/sra-spec) | [![npm](https://img.shields.io/npm/v/@0x/sra-spec.svg)](https://www.npmjs.com/package/@0x/sra-spec) | OpenAPI specification for the standard relayer API |
-| [`@0x/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0x/subproviders.svg)](https://www.npmjs.com/package/@0x/subproviders) | Useful web3 subproviders (e.g. LedgerSubprovider) |
-| [`@0x/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0x/tslint-config.svg)](https://www.npmjs.com/package/@0x/tslint-config) | Custom 0x development TSLint rules |
-| [`@0x/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0x/types.svg)](https://www.npmjs.com/package/@0x/types) | Shared type declarations |
-| [`@0x/typescript-typings`](/packages/typescript-typings) | [![npm](https://img.shields.io/npm/v/@0x/typescript-typings.svg)](https://www.npmjs.com/package/@0x/typescript-typings) | Repository of types for external packages |
-| [`@0x/utils`](/packages/utils) | [![npm](https://img.shields.io/npm/v/@0x/utils.svg)](https://www.npmjs.com/package/@0x/utils) | Shared utilities |
-| [`@0x/web3-wrapper`](/packages/web3-wrapper) | [![npm](https://img.shields.io/npm/v/@0x/web3-wrapper.svg)](https://www.npmjs.com/package/@0x/web3-wrapper) | Web3 wrapper |
-
-#### Python
-
-| Package | Version | Description |
-| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
-| [`0x-order-utils.py`](/python-packages/order_utils) | [![PyPI](https://img.shields.io/pypi/v/0x-order-utils.svg)](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
-
-### Private Packages
-
-| Package | Description |
-| -------------------------------------------------------- | ---------------------------------------------------------------- |
-| [`@0x/contracts`](/packages/contracts) | 0x solidity smart contracts & tests |
-| [`@0x/react-docs-example`](/packages/react-docs-example) | Example documentation site created with `@0x/react-docs` |
-| [`@0x/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
-| [`@0x/website`](/packages/website) | 0x website & Portal DApp |
+## Packages
+
+Visit our [developer portal](https://0xproject.com/docs/order-utils) for a comprehensive list of core & community maintained packages. All packages maintained with this monorepo are listed below.
+
+### Python Packages
+
+| Package | Version | Description |
+| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| [`0x-json-schemas`](/python-packages/json_schemas) | [![PyPI](https://img.shields.io/pypi/v/0x-json-schemas.svg)](https://pypi.org/project/0x-json-schemas/) | 0x-related JSON schemas |
+| [`0x-order-utils`](/python-packages/order_utils) | [![PyPI](https://img.shields.io/pypi/v/0x-order-utils.svg)](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
+| [`0x-sra-client`](/python-packages/sra_client) | [![PyPI](https://img.shields.io/pypi/v/0x-sra-client.svg)](https://pypi.org/project/0x-sra-client/) | A Python client for interacting with servers conforming to the Standard Relayer API specification |
+
+### Typescript/Javascript Packages
+
+#### 0x-specific packages
+
+| Package | Version | Description |
+| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
+| [`0x.js`](/packages/0x.js) | [![npm](https://img.shields.io/npm/v/0x.js.svg)](https://www.npmjs.com/package/0x.js) | An aggregate package combining many smaller utility packages for interacting with the 0x protocol |
+| [`@0x/contract-addresses`](/packages/contract-addresses) | [![npm](https://img.shields.io/npm/v/@0x/contract-addresses.svg)](https://www.npmjs.com/package/@0x/contract-addresses) | A tiny utility library for getting known deployed contract addresses for a particular network. |
+| [`@0x/contract-wrappers`](/packages/contract-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/contract-wrappers.svg)](https://www.npmjs.com/package/@0x/contract-wrappers) | JS/TS wrappers for interacting with the 0x smart contracts |
+| [`@0x/order-utils`](/packages/order-utils) | [![npm](https://img.shields.io/npm/v/@0x/order-utils.svg)](https://www.npmjs.com/package/@0x/order-utils) | A set of utilities for generating, parsing, signing and validating 0x orders |
+| [`@0x/json-schemas`](/packages/json-schemas) | [![npm](https://img.shields.io/npm/v/@0x/json-schemas.svg)](https://www.npmjs.com/package/@0x/json-schemas) | 0x-related JSON schemas |
+| [`@0x/order-watcher`](/packages/order-watcher) | [![npm](https://img.shields.io/npm/v/@0x/order-watcher.svg)](https://www.npmjs.com/package/@0x/order-watcher) | An order watcher daemon that watches for order validity |
+| [`@0x/migrations`](/packages/migrations) | [![npm](https://img.shields.io/npm/v/@0x/migrations.svg)](https://www.npmjs.com/package/@0x/migrations) | Migration tool for deploying 0x smart contracts on private testnets |
+| [`@0x/contract-artifacts`](/packages/contract-artifacts) | [![npm](https://img.shields.io/npm/v/@0x/contract-artifacts.svg)](https://www.npmjs.com/package/@0x/contract-artifacts) | 0x smart contract compilation artifacts |
+| [`@0x/abi-gen-wrappers`](/packages/abi-gen-wrappers) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen-wrappers.svg)](https://www.npmjs.com/package/@0x/abi-gen-wrappers) | Low-level 0x smart contract wrappers generated using `@0x/abi-gen` |
+| [`@0x/sra-spec`](/packages/sra-spec) | [![npm](https://img.shields.io/npm/v/@0x/sra-spec.svg)](https://www.npmjs.com/package/@0x/sra-spec) | OpenAPI specification for the Standard Relayer API |
+| [`@0x/connect`](/packages/connect) | [![npm](https://img.shields.io/npm/v/@0x/connect.svg)](https://www.npmjs.com/package/@0x/connect) | An HTTP/WS client for interacting with the Standard Relayer API |
+| [`@0x/asset-buyer`](/packages/asset-buyer) | [![npm](https://img.shields.io/npm/v/@0x/asset-buyer.svg)](https://www.npmjs.com/package/@0x/asset-buyer) | Convenience package for discovering and buying assets with Ether |
+
+#### Ethereum tooling
+
+| Package | Version | Description |
+| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| [`@0x/web3-wrapper`](/packages/web3-wrapper) | [![npm](https://img.shields.io/npm/v/@0x/web3-wrapper.svg)](https://www.npmjs.com/package/@0x/web3-wrapper) | An Ethereum JSON RPC client |
+| [`@0x/sol-compiler`](/packages/sol-compiler) | [![npm](https://img.shields.io/npm/v/@0x/sol-compiler.svg)](https://www.npmjs.com/package/@0x/sol-compiler) | A wrapper around solc-js that adds smart re-compilation, ability to compile an entire project, Solidity version specific compilation, standard input description support and much more. |
+| [`@0x/sol-cov`](/packages/sol-cov) | [![npm](https://img.shields.io/npm/v/@0x/sol-cov.svg)](https://www.npmjs.com/package/@0x/sol-cov) | A solidity test coverage tool |
+| [`@0x/sol-resolver`](/packages/sol-resolver) | [![npm](https://img.shields.io/npm/v/@0x/sol-resolver.svg)](https://www.npmjs.com/package/@0x/sol-resolver) | Import resolver for smart contracts dependencies |
+| [`@0x/subproviders`](/packages/subproviders) | [![npm](https://img.shields.io/npm/v/@0x/subproviders.svg)](https://www.npmjs.com/package/@0x/subproviders) | Web3 provider middlewares (e.g. LedgerSubprovider) |
+| [`@0x/sol-doc`](/packages/sol-doc) | [![npm](https://img.shields.io/npm/v/@0x/sol-doc.svg)](https://www.npmjs.com/package/@0x/sol-doc) | Solidity documentation generator |
+
+#### Utilities
+
+| Package | Version | Description |
+| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
+| [`@0x/abi-gen`](/packages/abi-gen) | [![npm](https://img.shields.io/npm/v/@0x/abi-gen.svg)](https://www.npmjs.com/package/@0x/abi-gen) | Tool to generate TS wrappers from smart contract ABIs |
+| [`@0x/tslint-config`](/packages/tslint-config) | [![npm](https://img.shields.io/npm/v/@0x/tslint-config.svg)](https://www.npmjs.com/package/@0x/tslint-config) | Custom TSLint rules used by the 0x core team |
+| [`@0x/types`](/packages/types) | [![npm](https://img.shields.io/npm/v/@0x/types.svg)](https://www.npmjs.com/package/@0x/types) | Shared type declarations |
+| [`@0x/typescript-typings`](/packages/typescript-typings) | [![npm](https://img.shields.io/npm/v/@0x/typescript-typings.svg)](https://www.npmjs.com/package/@0x/typescript-typings) | Repository of types for external packages |
+| [`@0x/utils`](/packages/utils) | [![npm](https://img.shields.io/npm/v/@0x/utils.svg)](https://www.npmjs.com/package/@0x/utils) | Shared utilities |
+| [`@0x/react-docs`](/packages/react-docs) | [![npm](https://img.shields.io/npm/v/@0x/react-docs.svg)](https://www.npmjs.com/package/@0x/react-docs) | React documentation component for rendering TypeDoc & sol-doc generated JSON |
+| [`@0x/react-shared`](/packages/react-shared) | [![npm](https://img.shields.io/npm/v/@0x/react-shared.svg)](https://www.npmjs.com/package/@0x/react-shared) | 0x shared react components |
+| [`@0x/assert`](/packages/assert) | [![npm](https://img.shields.io/npm/v/@0x/assert.svg)](https://www.npmjs.com/package/@0x/assert) | Type and schema assertions used by our packages |
+| [`@0x/base-contract`](/packages/base-contract) | [![npm](https://img.shields.io/npm/v/@0x/base-contract.svg)](https://www.npmjs.com/package/@0x/base-contract) | BaseContract used by auto-generated `abi-gen` wrapper contracts |
+| [`@0x/dev-utils`](/packages/dev-utils) | [![npm](https://img.shields.io/npm/v/@0x/dev-utils.svg)](https://www.npmjs.com/package/@0x/dev-utils) | Dev utils to be shared across 0x packages |
+| [`@0x/fill-scenarios`](/packages/fill-scenarios) | [![npm](https://img.shields.io/npm/v/@0x/fill-scenarios.svg)](https://www.npmjs.com/package/@0x/fill-scenarios) | 0x order fill scenario generator |
+
+#### Private Packages
+
+| Package | Description |
+| -------------------------------------------------- | -------------------------------------------------------------------------------- |
+| [`@0x/contracts`](/contracts/core) | 0x protocol solidity smart contracts & tests |
+| [`@0x/instant`](/packages/instant) | A free and flexible way to offer simple crypto purchasing in any app or website. |
+| [`@0x/testnet-faucets`](/packages/testnet-faucets) | A faucet micro-service that dispenses test ERC20 tokens or Ether |
+| [`@0x/website`](/packages/website) | 0x website |
## Usage
-Dedicated documentation pages:
-
-* [0x.js Library](https://0xproject.com/docs/0xjs)
-* [0x Connect](https://0xproject.com/docs/connect)
-* [Smart contracts](https://0xproject.com/docs/contracts)
-* [Subproviders](https://0xproject.com/docs/subproviders)
-* [Sol Compiler](https://0xproject.com/docs/sol-compiler)
-* [Web3-wrapper](https://0xproject.com/docs/web3-wrapper)
-* [JSON-schemas](https://0xproject.com/docs/json-schemas)
-* [Sol-cov](https://0xproject.com/docs/sol-cov)
-* [Standard Relayer API](https://github.com/0xProject/standard-relayer-api/blob/master/README.md)
-
Node version >= 6.12 is required.
Most of the packages require additional typings for external dependencies.
diff --git a/contracts/.solhint.json b/contracts/.solhint.json
new file mode 100644
index 000000000..3090d981a
--- /dev/null
+++ b/contracts/.solhint.json
@@ -0,0 +1,21 @@
+{
+ "extends": "default",
+ "rules": {
+ "avoid-low-level-calls": false,
+ "avoid-tx-origin": "warn",
+ "bracket-align": false,
+ "code-complexity": false,
+ "compiler-fixed": false,
+ "const-name-snakecase": "error",
+ "expression-indent": "error",
+ "function-max-lines": false,
+ "func-order": "error",
+ "indent": ["error", 4],
+ "max-line-length": ["warn", 160],
+ "no-inline-assembly": false,
+ "quotes": ["error", "double"],
+ "separate-by-one-line-in-contract": "error",
+ "space-after-comma": "error",
+ "statement-indent": "error"
+ }
+}
diff --git a/contracts/TESTING.md b/contracts/TESTING.md
new file mode 100644
index 000000000..750b3c62c
--- /dev/null
+++ b/contracts/TESTING.md
@@ -0,0 +1,48 @@
+# Contracts testing options
+
+## Revert stack traces
+
+If you want to see helpful stack traces (incl. line number, code snippet) for smart contract reverts, run the tests with:
+
+```
+yarn test:trace
+```
+
+**Note:** This currently slows down the test runs and is therefore not enabled by default.
+
+## Backing Ethereum node
+
+By default, our tests run against an in-process [Ganache](https://github.com/trufflesuite/ganache-core) instance. In order to run the tests against [Geth](https://github.com/ethereum/go-ethereum), first follow the instructions in the README for the devnet package to start the devnet Geth node. Then run:
+
+```bash
+TEST_PROVIDER=geth yarn test
+```
+
+## Code coverage
+
+In order to see the Solidity code coverage output generated by `@0x/sol-cov`, run:
+
+```
+yarn test:coverage
+```
+
+## Gas profiler
+
+In order to profile the gas costs for a specific smart contract call/transaction, you can run the tests in `profiler` mode.
+
+**Note:** Traces emitted by ganache have incorrect gas costs so we recommend using Geth for profiling.
+
+```
+TEST_PROVIDER=geth yarn test:profiler
+```
+
+You'll see a warning that you need to explicitly enable and disable the profiler before and after the block of code you want to profile.
+
+```typescript
+import { profiler } from './utils/profiler';
+profiler.start();
+// Some call to a smart contract
+profiler.stop();
+```
+
+Without explicitly starting and stopping the profiler, the profiler output will be too busy, and therefore unusable.
diff --git a/contracts/examples/CHANGELOG.json b/contracts/examples/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/examples/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/examples/CHANGELOG.md b/contracts/examples/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/examples/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/examples/README.md b/contracts/examples/README.md
new file mode 100644
index 000000000..ca23d0974
--- /dev/null
+++ b/contracts/examples/README.md
@@ -0,0 +1,56 @@
+## Contract examples
+
+Example smart contracts that interact with 0x protocol.
+
+## Usage
+
+Contracts can be found in the [contracts](./contracts) directory.
+This package contains example implementations of contracts that interact with the protocol but are _not_ intended for use in production. Examples include [filter](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#filter-contracts) contracts, a [Wallet](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#wallet) contract, and a [Validator](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#validator) contract, among others.
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-examples yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-examples yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
diff --git a/contracts/examples/compiler.json b/contracts/examples/compiler.json
new file mode 100644
index 000000000..375fa0c55
--- /dev/null
+++ b/contracts/examples/compiler.json
@@ -0,0 +1,22 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": ["ExchangeWrapper", "Validator", "Wallet", "Whitelist"]
+}
diff --git a/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol b/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol
new file mode 100644
index 000000000..d98136922
--- /dev/null
+++ b/contracts/examples/contracts/ExchangeWrapper/ExchangeWrapper.sol
@@ -0,0 +1,100 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+
+
+contract ExchangeWrapper {
+
+ // Exchange contract.
+ // solhint-disable-next-line var-name-mixedcase
+ IExchange internal EXCHANGE;
+
+ constructor (address _exchange)
+ public
+ {
+ EXCHANGE = IExchange(_exchange);
+ }
+
+ /// @dev Cancels all orders created by sender with a salt less than or equal to the targetOrderEpoch
+ /// and senderAddress equal to this contract.
+ /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
+ /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.
+ /// @param makerSignature Proof that maker wishes to call this function with given params.
+ function cancelOrdersUpTo(
+ uint256 targetOrderEpoch,
+ uint256 salt,
+ bytes makerSignature
+ )
+ external
+ {
+ address makerAddress = msg.sender;
+
+ // Encode arguments into byte array.
+ bytes memory data = abi.encodeWithSelector(
+ EXCHANGE.cancelOrdersUpTo.selector,
+ targetOrderEpoch
+ );
+
+ // Call `cancelOrdersUpTo` via `executeTransaction`.
+ EXCHANGE.executeTransaction(
+ salt,
+ makerAddress,
+ data,
+ makerSignature
+ );
+ }
+
+ /// @dev Fills an order using `msg.sender` as the taker.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.
+ /// @param orderSignature Proof that order has been created by maker.
+ /// @param takerSignature Proof that taker wishes to call this function with given params.
+ function fillOrder(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ uint256 salt,
+ bytes memory orderSignature,
+ bytes memory takerSignature
+ )
+ public
+ {
+ address takerAddress = msg.sender;
+
+ // Encode arguments into byte array.
+ bytes memory data = abi.encodeWithSelector(
+ EXCHANGE.fillOrder.selector,
+ order,
+ takerAssetFillAmount,
+ orderSignature
+ );
+
+ // Call `fillOrder` via `executeTransaction`.
+ EXCHANGE.executeTransaction(
+ salt,
+ takerAddress,
+ data,
+ takerSignature
+ );
+ }
+}
diff --git a/contracts/examples/contracts/Validator/Validator.sol b/contracts/examples/contracts/Validator/Validator.sol
new file mode 100644
index 000000000..e488a9ca7
--- /dev/null
+++ b/contracts/examples/contracts/Validator/Validator.sol
@@ -0,0 +1,56 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol";
+
+
+contract Validator is
+ IValidator
+{
+
+ // The single valid signer for this wallet.
+ // solhint-disable-next-line var-name-mixedcase
+ address internal VALID_SIGNER;
+
+ /// @dev constructs a new `Validator` with a single valid signer.
+ /// @param validSigner The sole, valid signer.
+ constructor (address validSigner) public {
+ VALID_SIGNER = validSigner;
+ }
+
+ /// @dev Verifies that a signature is valid. `signer` must match `VALID_SIGNER`.
+ /// @param hash Message hash that is signed.
+ /// @param signerAddress Address that should have signed the given hash.
+ /// @param signature Proof of signing.
+ /// @return Validity of signature.
+ // solhint-disable no-unused-vars
+ function isValidSignature(
+ bytes32 hash,
+ address signerAddress,
+ bytes signature
+ )
+ external
+ view
+ returns (bool isValid)
+ {
+ return (signerAddress == VALID_SIGNER);
+ }
+ // solhint-enable no-unused-vars
+}
diff --git a/contracts/examples/contracts/Wallet/Wallet.sol b/contracts/examples/contracts/Wallet/Wallet.sol
new file mode 100644
index 000000000..8edc74eb3
--- /dev/null
+++ b/contracts/examples/contracts/Wallet/Wallet.sol
@@ -0,0 +1,65 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWallet.sol";
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+
+
+contract Wallet is
+ IWallet
+{
+ using LibBytes for bytes;
+
+ // The owner of this wallet.
+ // solhint-disable-next-line var-name-mixedcase
+ address internal WALLET_OWNER;
+
+ /// @dev constructs a new `Wallet` with a single owner.
+ /// @param walletOwner The owner of this wallet.
+ constructor (address walletOwner) public {
+ WALLET_OWNER = walletOwner;
+ }
+
+ /// @dev Validates an EIP712 signature.
+ /// The signer must match the owner of this wallet.
+ /// @param hash Message hash that is signed.
+ /// @param eip712Signature Proof of signing.
+ /// @return Validity of signature.
+ function isValidSignature(
+ bytes32 hash,
+ bytes eip712Signature
+ )
+ external
+ view
+ returns (bool isValid)
+ {
+ require(
+ eip712Signature.length == 65,
+ "LENGTH_65_REQUIRED"
+ );
+
+ uint8 v = uint8(eip712Signature[0]);
+ bytes32 r = eip712Signature.readBytes32(1);
+ bytes32 s = eip712Signature.readBytes32(33);
+ address recoveredAddress = ecrecover(hash, v, r, s);
+ isValid = WALLET_OWNER == recoveredAddress;
+ return isValid;
+ }
+}
diff --git a/contracts/examples/contracts/Whitelist/Whitelist.sol b/contracts/examples/contracts/Whitelist/Whitelist.sol
new file mode 100644
index 000000000..2a3d33738
--- /dev/null
+++ b/contracts/examples/contracts/Whitelist/Whitelist.sol
@@ -0,0 +1,136 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+
+
+contract Whitelist is
+ Ownable
+{
+
+ // Mapping of address => whitelist status.
+ mapping (address => bool) public isWhitelisted;
+
+ // Exchange contract.
+ // solhint-disable var-name-mixedcase
+ IExchange internal EXCHANGE;
+ bytes internal TX_ORIGIN_SIGNATURE;
+ // solhint-enable var-name-mixedcase
+
+ byte constant internal VALIDATOR_SIGNATURE_BYTE = "\x05";
+
+ constructor (address _exchange)
+ public
+ {
+ EXCHANGE = IExchange(_exchange);
+ TX_ORIGIN_SIGNATURE = abi.encodePacked(address(this), VALIDATOR_SIGNATURE_BYTE);
+ }
+
+ /// @dev Adds or removes an address from the whitelist.
+ /// @param target Address to add or remove from whitelist.
+ /// @param isApproved Whitelist status to assign to address.
+ function updateWhitelistStatus(
+ address target,
+ bool isApproved
+ )
+ external
+ onlyOwner
+ {
+ isWhitelisted[target] = isApproved;
+ }
+
+ /// @dev Verifies signer is same as signer of current Ethereum transaction.
+ /// NOTE: This function can currently be used to validate signatures coming from outside of this contract.
+ /// Extra safety checks can be added for a production contract.
+ /// @param signerAddress Address that should have signed the given hash.
+ /// @param signature Proof of signing.
+ /// @return Validity of order signature.
+ // solhint-disable no-unused-vars
+ function isValidSignature(
+ bytes32 hash,
+ address signerAddress,
+ bytes signature
+ )
+ external
+ view
+ returns (bool isValid)
+ {
+ // solhint-disable-next-line avoid-tx-origin
+ return signerAddress == tx.origin;
+ }
+ // solhint-enable no-unused-vars
+
+ /// @dev Fills an order using `msg.sender` as the taker.
+ /// The transaction will revert if both the maker and taker are not whitelisted.
+ /// Orders should specify this contract as the `senderAddress` in order to gaurantee
+ /// that both maker and taker have been whitelisted.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.
+ /// @param orderSignature Proof that order has been created by maker.
+ function fillOrderIfWhitelisted(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ uint256 salt,
+ bytes memory orderSignature
+ )
+ public
+ {
+ address takerAddress = msg.sender;
+
+ // This contract must be the entry point for the transaction.
+ require(
+ // solhint-disable-next-line avoid-tx-origin
+ takerAddress == tx.origin,
+ "INVALID_SENDER"
+ );
+
+ // Check if maker is on the whitelist.
+ require(
+ isWhitelisted[order.makerAddress],
+ "MAKER_NOT_WHITELISTED"
+ );
+
+ // Check if taker is on the whitelist.
+ require(
+ isWhitelisted[takerAddress],
+ "TAKER_NOT_WHITELISTED"
+ );
+
+ // Encode arguments into byte array.
+ bytes memory data = abi.encodeWithSelector(
+ EXCHANGE.fillOrder.selector,
+ order,
+ takerAssetFillAmount,
+ orderSignature
+ );
+
+ // Call `fillOrder` via `executeTransaction`.
+ EXCHANGE.executeTransaction(
+ salt,
+ takerAddress,
+ data,
+ TX_ORIGIN_SIGNATURE
+ );
+ }
+}
diff --git a/contracts/examples/package.json b/contracts/examples/package.json
new file mode 100644
index 000000000..37b73f98c
--- /dev/null
+++ b/contracts/examples/package.json
@@ -0,0 +1,83 @@
+{
+ "name": "@0x/contracts-examples",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract examples of 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "compile": "sol-compiler",
+ "watch": "sol-compiler -w",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(ExchangeWrapper|Validator|Wallet|Whitelist).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-interfaces": "^1.0.2",
+ "@0x/contracts-libs": "^1.0.2",
+ "@0x/contracts-multisig": "^1.0.2",
+ "@0x/contracts-tokens": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.4",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/examples/src/artifacts/index.ts b/contracts/examples/src/artifacts/index.ts
new file mode 100644
index 000000000..c921fbf89
--- /dev/null
+++ b/contracts/examples/src/artifacts/index.ts
@@ -0,0 +1,13 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as ExchangeWrapper from '../../generated-artifacts/ExchangeWrapper.json';
+import * as Validator from '../../generated-artifacts/Validator.json';
+import * as Wallet from '../../generated-artifacts/Wallet.json';
+import * as Whitelist from '../../generated-artifacts/Whitelist.json';
+
+export const artifacts = {
+ ExchangeWrapper: ExchangeWrapper as ContractArtifact,
+ Validator: Validator as ContractArtifact,
+ Wallet: Wallet as ContractArtifact,
+ Whitelist: Whitelist as ContractArtifact,
+};
diff --git a/contracts/examples/src/index.ts b/contracts/examples/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/examples/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/examples/src/wrappers/index.ts b/contracts/examples/src/wrappers/index.ts
new file mode 100644
index 000000000..dc67277d7
--- /dev/null
+++ b/contracts/examples/src/wrappers/index.ts
@@ -0,0 +1,4 @@
+export * from '../../generated-wrappers/exchange_wrapper';
+export * from '../../generated-wrappers/validator';
+export * from '../../generated-wrappers/wallet';
+export * from '../../generated-wrappers/whitelist';
diff --git a/contracts/examples/tsconfig.json b/contracts/examples/tsconfig.json
new file mode 100644
index 000000000..63245da1e
--- /dev/null
+++ b/contracts/examples/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/ExchangeWrapper.json",
+ "./generated-artifacts/Validator.json",
+ "./generated-artifacts/Wallet.json",
+ "./generated-artifacts/Whitelist.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/packages/contracts/tslint.json b/contracts/examples/tslint.json
index 1bb3ac2a2..1bb3ac2a2 100644
--- a/packages/contracts/tslint.json
+++ b/contracts/examples/tslint.json
diff --git a/contracts/extensions/CHANGELOG.json b/contracts/extensions/CHANGELOG.json
new file mode 100644
index 000000000..40e25565e
--- /dev/null
+++ b/contracts/extensions/CHANGELOG.json
@@ -0,0 +1,37 @@
+[
+ {
+ "version": "1.2.0",
+ "changes": [
+ {
+ "note": "Added Dutch Auction Wrapper",
+ "pr": 1465
+ }
+ ]
+ },
+ {
+ "version": "1.1.0",
+ "changes": [
+ {
+ "note": "Added Balance Threshold Filter",
+ "pr": 1383
+ },
+ {
+ "note": "Add OrderMatcher",
+ "pr": 1117
+ },
+ {
+ "note": "Add OrderValidator",
+ "pr": 1464
+ }
+ ]
+ },
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/extensions/CHANGELOG.md b/contracts/extensions/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/extensions/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/extensions/DEPLOYS.json b/contracts/extensions/DEPLOYS.json
new file mode 100644
index 000000000..1a093bf77
--- /dev/null
+++ b/contracts/extensions/DEPLOYS.json
@@ -0,0 +1,31 @@
+[
+ {
+ "name": "Forwarder",
+ "version": "1.1.0",
+ "changes": [
+ {
+ "note": "Round up when calculating remaining amounts in marketBuy functions",
+ "pr": 1162,
+ "networks": {
+ "1": "0x5468a1dc173652ee28d249c271fa9933144746b1",
+ "3": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
+ "42": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Forwarder",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x7afc2d5107af94c462a194d2c21b5bdd238709d6",
+ "3": "0x3983e204b12b3c02fb0638caf2cd406a62e0ead3",
+ "42": "0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8"
+ }
+ }
+ ]
+ }
+]
diff --git a/contracts/extensions/README.md b/contracts/extensions/README.md
new file mode 100644
index 000000000..820f6e78a
--- /dev/null
+++ b/contracts/extensions/README.md
@@ -0,0 +1,69 @@
+## Contract extensions
+
+Smart contracts that implement extensions for the 0x protocol.
+
+## Usage
+
+Contract extensions of the protocol can be found in the [contracts](./contracts) directory. This directory contains contracts that interact with the 2.0.0 contracts and will be used in production, such as the [Forwarder](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract.
+
+## Bug bounty
+
+A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-extensions yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-extensions yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/extensions/compiler.json b/contracts/extensions/compiler.json
new file mode 100644
index 000000000..2bb468724
--- /dev/null
+++ b/contracts/extensions/compiler.json
@@ -0,0 +1,22 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": ["BalanceThresholdFilter", "DutchAuction", "Forwarder", "OrderMatcher", "OrderValidator"]
+}
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/BalanceThresholdFilter.sol b/contracts/extensions/contracts/BalanceThresholdFilter/BalanceThresholdFilter.sol
new file mode 100644
index 000000000..16cacd461
--- /dev/null
+++ b/contracts/extensions/contracts/BalanceThresholdFilter/BalanceThresholdFilter.sol
@@ -0,0 +1,45 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "./interfaces/IThresholdAsset.sol";
+import "./MixinBalanceThresholdFilterCore.sol";
+
+
+contract BalanceThresholdFilter is
+ MixinBalanceThresholdFilterCore
+{
+
+ /// @dev Constructs BalanceThresholdFilter.
+ /// @param exchange Address of 0x exchange.
+ /// @param thresholdAsset The asset that must be held by makers/takers.
+ /// @param balanceThreshold The minimum balance of `thresholdAsset` that must be held by makers/takers.
+ constructor(
+ address exchange,
+ address thresholdAsset,
+ uint256 balanceThreshold
+ )
+ public
+ {
+ EXCHANGE = IExchange(exchange);
+ THRESHOLD_ASSET = IThresholdAsset(thresholdAsset);
+ BALANCE_THRESHOLD = balanceThreshold;
+ }
+}
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol b/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol
new file mode 100644
index 000000000..da050bf72
--- /dev/null
+++ b/contracts/extensions/contracts/BalanceThresholdFilter/MixinBalanceThresholdFilterCore.sol
@@ -0,0 +1,135 @@
+/*
+
+ 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/LICENSE2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-libs/contracts/libs/LibExchangeSelectors.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "./mixins/MBalanceThresholdFilterCore.sol";
+import "./MixinExchangeCalldata.sol";
+
+
+contract MixinBalanceThresholdFilterCore is
+ MBalanceThresholdFilterCore,
+ MixinExchangeCalldata,
+ LibOrder,
+ LibExchangeSelectors
+{
+
+ /// @dev Executes an Exchange transaction iff the maker and taker meet
+ /// the hold at least `BALANCE_THRESHOLD` of the asset `THRESHOLD_ASSET` OR
+ /// the exchange function is a cancellation.
+ /// Supported Exchange functions:
+ /// batchFillOrders
+ /// batchFillOrdersNoThrow
+ /// batchFillOrKillOrders
+ /// fillOrder
+ /// fillOrderNoThrow
+ /// fillOrKillOrder
+ /// marketBuyOrders
+ /// marketBuyOrdersNoThrow
+ /// marketSellOrders
+ /// marketSellOrdersNoThrow
+ /// matchOrders
+ /// cancelOrder
+ /// batchCancelOrders
+ /// cancelOrdersUpTo
+ /// Trying to call any other exchange function will throw.
+ /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
+ /// @param signerAddress Address of transaction signer.
+ /// @param signedExchangeTransaction AbiV2 encoded calldata.
+ /// @param signature Proof of signer transaction by signer.
+ function executeTransaction(
+ uint256 salt,
+ address signerAddress,
+ bytes signedExchangeTransaction,
+ bytes signature
+ )
+ external
+ {
+ // Get accounts whose balances must be validated
+ address[] memory addressesToValidate = getAddressesToValidate(signerAddress);
+
+ // Validate account balances
+ uint256 balanceThreshold = BALANCE_THRESHOLD;
+ IThresholdAsset thresholdAsset = THRESHOLD_ASSET;
+ for (uint256 i = 0; i < addressesToValidate.length; ++i) {
+ uint256 addressBalance = thresholdAsset.balanceOf(addressesToValidate[i]);
+ require(
+ addressBalance >= balanceThreshold,
+ "AT_LEAST_ONE_ADDRESS_DOES_NOT_MEET_BALANCE_THRESHOLD"
+ );
+ }
+ emit ValidatedAddresses(addressesToValidate);
+
+ // All addresses are valid. Execute exchange function.
+ EXCHANGE.executeTransaction(
+ salt,
+ signerAddress,
+ signedExchangeTransaction,
+ signature
+ );
+ }
+
+ /// @dev Constructs an array of addresses to be validated.
+ /// Addresses depend on which Exchange function is to be called
+ /// (defined by `signedExchangeTransaction` above).
+ /// @param signerAddress Address of transaction signer.
+ /// @return addressesToValidate Array of addresses to validate.
+ function getAddressesToValidate(address signerAddress)
+ internal pure
+ returns (address[] memory addressesToValidate)
+ {
+ bytes4 exchangeFunctionSelector = bytes4(exchangeCalldataload(0));
+ // solhint-disable expression-indent
+ if (
+ exchangeFunctionSelector == BATCH_FILL_ORDERS_SELECTOR ||
+ exchangeFunctionSelector == BATCH_FILL_ORDERS_NO_THROW_SELECTOR ||
+ exchangeFunctionSelector == BATCH_FILL_OR_KILL_ORDERS_SELECTOR ||
+ exchangeFunctionSelector == MARKET_BUY_ORDERS_SELECTOR ||
+ exchangeFunctionSelector == MARKET_BUY_ORDERS_NO_THROW_SELECTOR ||
+ exchangeFunctionSelector == MARKET_SELL_ORDERS_SELECTOR ||
+ exchangeFunctionSelector == MARKET_SELL_ORDERS_NO_THROW_SELECTOR
+ ) {
+ addressesToValidate = loadMakerAddressesFromOrderArray(0);
+ addressesToValidate = addressesToValidate.append(signerAddress);
+ } else if (
+ exchangeFunctionSelector == FILL_ORDER_SELECTOR ||
+ exchangeFunctionSelector == FILL_ORDER_NO_THROW_SELECTOR ||
+ exchangeFunctionSelector == FILL_OR_KILL_ORDER_SELECTOR
+ ) {
+ address makerAddress = loadMakerAddressFromOrder(0);
+ addressesToValidate = addressesToValidate.append(makerAddress);
+ addressesToValidate = addressesToValidate.append(signerAddress);
+ } else if (exchangeFunctionSelector == MATCH_ORDERS_SELECTOR) {
+ address leftMakerAddress = loadMakerAddressFromOrder(0);
+ addressesToValidate = addressesToValidate.append(leftMakerAddress);
+ address rightMakerAddress = loadMakerAddressFromOrder(1);
+ addressesToValidate = addressesToValidate.append(rightMakerAddress);
+ addressesToValidate = addressesToValidate.append(signerAddress);
+ } else if (
+ exchangeFunctionSelector != CANCEL_ORDER_SELECTOR &&
+ exchangeFunctionSelector != BATCH_CANCEL_ORDERS_SELECTOR &&
+ exchangeFunctionSelector != CANCEL_ORDERS_UP_TO_SELECTOR
+ ) {
+ revert("INVALID_OR_BLOCKED_EXCHANGE_SELECTOR");
+ }
+ // solhint-enable expression-indent
+ return addressesToValidate;
+ }
+}
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/MixinExchangeCalldata.sol b/contracts/extensions/contracts/BalanceThresholdFilter/MixinExchangeCalldata.sol
new file mode 100644
index 000000000..a15e95a9d
--- /dev/null
+++ b/contracts/extensions/contracts/BalanceThresholdFilter/MixinExchangeCalldata.sol
@@ -0,0 +1,103 @@
+
+ /*
+
+ 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/LICENSE2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "./mixins/MExchangeCalldata.sol";
+import "@0x/contracts-libs/contracts/libs/LibAddressArray.sol";
+
+
+contract MixinExchangeCalldata is
+ MExchangeCalldata
+{
+
+ using LibAddressArray for address[];
+
+ /// @dev Emulates the `calldataload` opcode on the embedded Exchange calldata,
+ /// which is accessed through `signedExchangeTransaction`.
+ /// @param offset Offset into the Exchange calldata.
+ /// @return value Corresponding 32 byte value stored at `offset`.
+ function exchangeCalldataload(uint256 offset)
+ internal pure
+ returns (bytes32 value)
+ {
+ assembly {
+ // Pointer to exchange transaction
+ // 0x04 for calldata selector
+ // 0x40 to access `signedExchangeTransaction`, which is the third parameter
+ let exchangeTxPtr := calldataload(0x44)
+
+ // Offset into Exchange calldata
+ // We compute this by adding 0x24 to the `exchangeTxPtr` computed above.
+ // 0x04 for calldata selector
+ // 0x20 for length field of `signedExchangeTransaction`
+ let exchangeCalldataOffset := add(exchangeTxPtr, add(0x24, offset))
+ value := calldataload(exchangeCalldataOffset)
+ }
+ return value;
+ }
+
+ /// @dev Convenience function that skips the 4 byte selector when loading
+ /// from the embedded Exchange calldata.
+ /// @param offset Offset into the Exchange calldata (minus the 4 byte selector)
+ /// @return value Corresponding 32 byte value stored at `offset` + 4.
+ function loadExchangeData(uint256 offset)
+ internal pure
+ returns (bytes32 value)
+ {
+ value = exchangeCalldataload(offset + 4);
+ return value;
+ }
+
+ /// @dev Extracts the maker address from an order stored in the Exchange calldata
+ /// (which is embedded in `signedExchangeTransaction`).
+ /// @param orderParamIndex Index of the order in the Exchange function's signature.
+ /// @return makerAddress The extracted maker address.
+ function loadMakerAddressFromOrder(uint256 orderParamIndex)
+ internal pure
+ returns (address makerAddress)
+ {
+ uint256 orderOffsetInBytes = orderParamIndex * 32;
+ uint256 orderPtr = uint256(loadExchangeData(orderOffsetInBytes));
+ makerAddress = address(loadExchangeData(orderPtr));
+ return makerAddress;
+ }
+
+ /// @dev Extracts the maker addresses from an array of orders stored in the Exchange calldata
+ /// (which is embedded in `signedExchangeTransaction`).
+ /// @param orderArrayParamIndex Index of the order array in the Exchange function's signature
+ /// @return makerAddresses The extracted maker addresses.
+ function loadMakerAddressesFromOrderArray(uint256 orderArrayParamIndex)
+ internal pure
+ returns (address[] makerAddresses)
+ {
+ uint256 orderArrayOffsetInBytes = orderArrayParamIndex * 32;
+ uint256 orderArrayPtr = uint256(loadExchangeData(orderArrayOffsetInBytes));
+ uint256 orderArrayLength = uint256(loadExchangeData(orderArrayPtr));
+ uint256 orderArrayLengthInBytes = orderArrayLength * 32;
+ uint256 orderArrayElementPtr = orderArrayPtr + 32;
+ uint256 orderArrayElementEndPtr = orderArrayElementPtr + orderArrayLengthInBytes;
+ for (uint orderPtrOffset = orderArrayElementPtr; orderPtrOffset < orderArrayElementEndPtr; orderPtrOffset += 32) {
+ uint256 orderPtr = uint256(loadExchangeData(orderPtrOffset));
+ address makerAddress = address(loadExchangeData(orderPtr + orderArrayElementPtr));
+ makerAddresses = makerAddresses.append(makerAddress);
+ }
+ return makerAddresses;
+ }
+}
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IBalanceThresholdFilterCore.sol b/contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IBalanceThresholdFilterCore.sol
new file mode 100644
index 000000000..4a1bf1fb2
--- /dev/null
+++ b/contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IBalanceThresholdFilterCore.sol
@@ -0,0 +1,55 @@
+
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract IBalanceThresholdFilterCore {
+
+ /// @dev Executes an Exchange transaction iff the maker and taker meet
+ /// the hold at least `BALANCE_THRESHOLD` of the asset `THRESHOLD_ASSET` OR
+ /// the exchange function is a cancellation.
+ /// Supported Exchange functions:
+ /// - batchFillOrders
+ /// - batchFillOrdersNoThrow
+ /// - batchFillOrKillOrders
+ /// - fillOrder
+ /// - fillOrderNoThrow
+ /// - fillOrKillOrder
+ /// - marketBuyOrders
+ /// - marketBuyOrdersNoThrow
+ /// - marketSellOrders
+ /// - marketSellOrdersNoThrow
+ /// - matchOrders
+ /// - cancelOrder
+ /// - batchCancelOrders
+ /// - cancelOrdersUpTo
+ /// Trying to call any other exchange function will throw.
+ /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
+ /// @param signerAddress Address of transaction signer.
+ /// @param signedExchangeTransaction AbiV2 encoded calldata.
+ /// @param signature Proof of signer transaction by signer.
+ function executeTransaction(
+ uint256 salt,
+ address signerAddress,
+ bytes signedExchangeTransaction,
+ bytes signature
+ )
+ external;
+}
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IThresholdAsset.sol b/contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IThresholdAsset.sol
new file mode 100644
index 000000000..f78f9c2de
--- /dev/null
+++ b/contracts/extensions/contracts/BalanceThresholdFilter/interfaces/IThresholdAsset.sol
@@ -0,0 +1,31 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract IThresholdAsset {
+
+ /// @param _owner The address from which the balance will be retrieved
+ /// @return Balance of owner
+ function balanceOf(address _owner)
+ external
+ view
+ returns (uint256);
+
+}
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol b/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol
new file mode 100644
index 000000000..074686e8d
--- /dev/null
+++ b/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MBalanceThresholdFilterCore.sol
@@ -0,0 +1,54 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "../interfaces/IThresholdAsset.sol";
+import "../interfaces/IBalanceThresholdFilterCore.sol";
+
+
+contract MBalanceThresholdFilterCore is
+ IBalanceThresholdFilterCore
+{
+
+ // Points to 0x exchange contract
+ // solhint-disable var-name-mixedcase
+ IExchange internal EXCHANGE;
+
+ // The asset that must be held by makers/takers
+ IThresholdAsset internal THRESHOLD_ASSET;
+
+ // The minimum balance of `THRESHOLD_ASSET` that must be held by makers/takers
+ uint256 internal BALANCE_THRESHOLD;
+ // solhint-enable var-name-mixedcase
+
+ // Addresses that hold at least `BALANCE_THRESHOLD` of `THRESHOLD_ASSET`
+ event ValidatedAddresses (
+ address[] addresses
+ );
+
+ /// @dev Constructs an array of addresses to be validated.
+ /// Addresses depend on which Exchange function is to be called
+ /// (defined by `signedExchangeTransaction` above).
+ /// @param signerAddress Address of transaction signer.
+ /// @return addressesToValidate Array of addresses to validate.
+ function getAddressesToValidate(address signerAddress)
+ internal pure
+ returns (address[] memory addressesToValidate);
+}
diff --git a/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MExchangeCalldata.sol b/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MExchangeCalldata.sol
new file mode 100644
index 000000000..40536d820
--- /dev/null
+++ b/contracts/extensions/contracts/BalanceThresholdFilter/mixins/MExchangeCalldata.sol
@@ -0,0 +1,56 @@
+
+ /*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract MExchangeCalldata {
+
+ /// @dev Emulates the `calldataload` opcode on the embedded Exchange calldata,
+ /// which is accessed through `signedExchangeTransaction`.
+ /// @param offset Offset into the Exchange calldata.
+ /// @return value Corresponding 32 byte value stored at `offset`.
+ function exchangeCalldataload(uint256 offset)
+ internal pure
+ returns (bytes32 value);
+
+ /// @dev Convenience function that skips the 4 byte selector when loading
+ /// from the embedded Exchange calldata.
+ /// @param offset Offset into the Exchange calldata (minus the 4 byte selector)
+ /// @return value Corresponding 32 byte value stored at `offset` + 4.
+ function loadExchangeData(uint256 offset)
+ internal pure
+ returns (bytes32 value);
+
+ /// @dev Extracts the maker address from an order stored in the Exchange calldata
+ /// (which is embedded in `signedExchangeTransaction`).
+ /// @param orderParamIndex Index of the order in the Exchange function's signature.
+ /// @return makerAddress The extracted maker address.
+ function loadMakerAddressFromOrder(uint256 orderParamIndex)
+ internal pure
+ returns (address makerAddress);
+
+ /// @dev Extracts the maker addresses from an array of orders stored in the Exchange calldata
+ /// (which is embedded in `signedExchangeTransaction`).
+ /// @param orderArrayParamIndex Index of the order array in the Exchange function's signature
+ /// @return makerAddresses The extracted maker addresses.
+ function loadMakerAddressesFromOrderArray(uint256 orderArrayParamIndex)
+ internal pure
+ returns (address[] makerAddresses);
+}
diff --git a/contracts/extensions/contracts/DutchAuction/DutchAuction.sol b/contracts/extensions/contracts/DutchAuction/DutchAuction.sol
new file mode 100644
index 000000000..9c9f3990a
--- /dev/null
+++ b/contracts/extensions/contracts/DutchAuction/DutchAuction.sol
@@ -0,0 +1,205 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
+
+
+contract DutchAuction is
+ SafeMath
+{
+ using LibBytes for bytes;
+
+ // solhint-disable var-name-mixedcase
+ IExchange internal EXCHANGE;
+
+ struct AuctionDetails {
+ uint256 beginTimeSeconds; // Auction begin unix timestamp: sellOrder.makerAssetData
+ uint256 endTimeSeconds; // Auction end unix timestamp: sellOrder.expiryTimeSeconds
+ uint256 beginAmount; // Auction begin amount: sellOrder.makerAssetData
+ uint256 endAmount; // Auction end amount: sellOrder.takerAssetAmount
+ uint256 currentAmount; // Calculated amount given block.timestamp
+ uint256 currentTimeSeconds; // block.timestamp
+ }
+
+ constructor (address _exchange)
+ public
+ {
+ EXCHANGE = IExchange(_exchange);
+ }
+
+ /// @dev Matches the buy and sell orders at an amount given the following: the current block time, the auction
+ /// start time and the auction begin amount. The sell order is a an order at the lowest amount
+ /// at the end of the auction. Excess from the match is transferred to the seller.
+ /// Over time the price moves from beginAmount to endAmount given the current block.timestamp.
+ /// sellOrder.expiryTimeSeconds is the end time of the auction.
+ /// sellOrder.takerAssetAmount is the end amount of the auction (lowest possible amount).
+ /// sellOrder.makerAssetData is the ABI encoded Asset Proxy data with the following data appended
+ /// buyOrder.makerAssetData is the buyers bid on the auction, must meet the amount for the current block timestamp
+ /// (uint256 beginTimeSeconds, uint256 beginAmount).
+ /// This function reverts in the following scenarios:
+ /// * Auction has not started (auctionDetails.currentTimeSeconds < auctionDetails.beginTimeSeconds)
+ /// * Auction has expired (auctionDetails.endTimeSeconds < auctionDetails.currentTimeSeconds)
+ /// * Amount is invalid: Buy order amount is too low (buyOrder.makerAssetAmount < auctionDetails.currentAmount)
+ /// * Amount is invalid: Invalid begin amount (auctionDetails.beginAmount > auctionDetails.endAmount)
+ /// * Any failure in the 0x Match Orders
+ /// @param buyOrder The Buyer's order. This order is for the current expected price of the auction.
+ /// @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
+ /// @param buySignature Proof that order was created by the buyer.
+ /// @param sellSignature Proof that order was created by the seller.
+ /// @return matchedFillResults amounts filled and fees paid by maker and taker of matched orders.
+ function matchOrders(
+ LibOrder.Order memory buyOrder,
+ LibOrder.Order memory sellOrder,
+ bytes memory buySignature,
+ bytes memory sellSignature
+ )
+ public
+ returns (LibFillResults.MatchedFillResults memory matchedFillResults)
+ {
+ AuctionDetails memory auctionDetails = getAuctionDetails(sellOrder);
+ // Ensure the auction has not yet started
+ require(
+ auctionDetails.currentTimeSeconds >= auctionDetails.beginTimeSeconds,
+ "AUCTION_NOT_STARTED"
+ );
+ // Ensure the auction has not expired. This will fail later in 0x but we can save gas by failing early
+ require(
+ sellOrder.expirationTimeSeconds > auctionDetails.currentTimeSeconds,
+ "AUCTION_EXPIRED"
+ );
+ // Validate the buyer amount is greater than the current auction amount
+ require(
+ buyOrder.makerAssetAmount >= auctionDetails.currentAmount,
+ "INVALID_AMOUNT"
+ );
+ // Match orders, maximally filling `buyOrder`
+ matchedFillResults = EXCHANGE.matchOrders(
+ buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ );
+ // The difference in sellOrder.takerAssetAmount and current amount is given as spread to the matcher
+ // This may include additional spread from the buyOrder.makerAssetAmount and the currentAmount.
+ // e.g currentAmount is 30, sellOrder.takerAssetAmount is 10 and buyOrder.makerAssetamount is 40.
+ // 10 (40-30) is returned to the buyer, 20 (30-10) sent to the seller and 10 has previously
+ // been transferred to the seller during matchOrders
+ uint256 leftMakerAssetSpreadAmount = matchedFillResults.leftMakerAssetSpreadAmount;
+ if (leftMakerAssetSpreadAmount > 0) {
+ // ERC20 Asset data itself is encoded as follows:
+ //
+ // | Area | Offset | Length | Contents |
+ // |----------|--------|---------|-------------------------------------|
+ // | Header | 0 | 4 | function selector |
+ // | Params | | 1 * 32 | function parameters: |
+ // | | 4 | 12 | 1. token address padding |
+ // | | 16 | 20 | 2. token address |
+ bytes memory assetData = sellOrder.takerAssetData;
+ address token = assetData.readAddress(16);
+ // Calculate the excess from the buy order. This can occur if the buyer sends in a higher
+ // amount than the calculated current amount
+ uint256 buyerExcessAmount = safeSub(buyOrder.makerAssetAmount, auctionDetails.currentAmount);
+ uint256 sellerExcessAmount = safeSub(leftMakerAssetSpreadAmount, buyerExcessAmount);
+ // Return the difference between auctionDetails.currentAmount and sellOrder.takerAssetAmount
+ // to the seller
+ if (sellerExcessAmount > 0) {
+ IERC20Token(token).transfer(sellOrder.makerAddress, sellerExcessAmount);
+ }
+ // Return the difference between buyOrder.makerAssetAmount and auctionDetails.currentAmount
+ // to the buyer
+ if (buyerExcessAmount > 0) {
+ IERC20Token(token).transfer(buyOrder.makerAddress, buyerExcessAmount);
+ }
+ }
+ return matchedFillResults;
+ }
+
+ /// @dev Calculates the Auction Details for the given order
+ /// @param order The sell order
+ /// @return AuctionDetails
+ function getAuctionDetails(
+ LibOrder.Order memory order
+ )
+ public
+ returns (AuctionDetails memory auctionDetails)
+ {
+ uint256 makerAssetDataLength = order.makerAssetData.length;
+ // It is unknown the encoded data of makerAssetData, we assume the last 64 bytes
+ // are the Auction Details encoding.
+ // Auction Details is encoded as follows:
+ //
+ // | Area | Offset | Length | Contents |
+ // |----------|--------|---------|-------------------------------------|
+ // | Params | | 2 * 32 | parameters: |
+ // | | -64 | 32 | 1. auction begin unix timestamp |
+ // | | -32 | 32 | 2. auction begin begin amount |
+ // ERC20 asset data length is 4+32, 64 for auction details results in min length 100
+ require(
+ makerAssetDataLength >= 100,
+ "INVALID_ASSET_DATA"
+ );
+ uint256 auctionBeginTimeSeconds = order.makerAssetData.readUint256(makerAssetDataLength - 64);
+ uint256 auctionBeginAmount = order.makerAssetData.readUint256(makerAssetDataLength - 32);
+ // Ensure the auction has a valid begin time
+ require(
+ order.expirationTimeSeconds > auctionBeginTimeSeconds,
+ "INVALID_BEGIN_TIME"
+ );
+ uint256 auctionDurationSeconds = order.expirationTimeSeconds-auctionBeginTimeSeconds;
+ // Ensure the auction goes from high to low
+ uint256 minAmount = order.takerAssetAmount;
+ require(
+ auctionBeginAmount > minAmount,
+ "INVALID_AMOUNT"
+ );
+ uint256 amountDelta = auctionBeginAmount-minAmount;
+ // solhint-disable-next-line not-rely-on-time
+ uint256 timestamp = block.timestamp;
+ auctionDetails.beginTimeSeconds = auctionBeginTimeSeconds;
+ auctionDetails.endTimeSeconds = order.expirationTimeSeconds;
+ auctionDetails.beginAmount = auctionBeginAmount;
+ auctionDetails.endAmount = minAmount;
+ auctionDetails.currentTimeSeconds = timestamp;
+
+ uint256 remainingDurationSeconds = order.expirationTimeSeconds-timestamp;
+ if (timestamp < auctionBeginTimeSeconds) {
+ // If the auction has not yet begun the current amount is the auctionBeginAmount
+ auctionDetails.currentAmount = auctionBeginAmount;
+ } else if (timestamp >= order.expirationTimeSeconds) {
+ // If the auction has ended the current amount is the minAmount.
+ // Auction end time is guaranteed by 0x Exchange due to the order expiration
+ auctionDetails.currentAmount = minAmount;
+ } else {
+ auctionDetails.currentAmount = safeAdd(
+ minAmount,
+ safeDiv(
+ safeMul(remainingDurationSeconds, amountDelta),
+ auctionDurationSeconds
+ )
+ );
+ }
+ return auctionDetails;
+ }
+}
diff --git a/packages/contracts/contracts/extensions/Forwarder/Forwarder.sol b/contracts/extensions/contracts/Forwarder/Forwarder.sol
index 94dec40ed..94dec40ed 100644
--- a/packages/contracts/contracts/extensions/Forwarder/Forwarder.sol
+++ b/contracts/extensions/contracts/Forwarder/Forwarder.sol
diff --git a/contracts/extensions/contracts/Forwarder/MixinAssets.sol b/contracts/extensions/contracts/Forwarder/MixinAssets.sol
new file mode 100644
index 000000000..116cdf267
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/MixinAssets.sol
@@ -0,0 +1,143 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
+import "./libs/LibConstants.sol";
+import "./mixins/MAssets.sol";
+
+
+contract MixinAssets is
+ Ownable,
+ LibConstants,
+ MAssets
+{
+ using LibBytes for bytes;
+
+ bytes4 constant internal ERC20_TRANSFER_SELECTOR = bytes4(keccak256("transfer(address,uint256)"));
+
+ /// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
+ /// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
+ /// used to withdraw assets that were accidentally sent to this contract.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of ERC20 token to withdraw.
+ function withdrawAsset(
+ bytes assetData,
+ uint256 amount
+ )
+ external
+ onlyOwner
+ {
+ transferAssetToSender(assetData, amount);
+ }
+
+ /// @dev Transfers given amount of asset to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferAssetToSender(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal
+ {
+ bytes4 proxyId = assetData.readBytes4(0);
+
+ if (proxyId == ERC20_DATA_ID) {
+ transferERC20Token(assetData, amount);
+ } else if (proxyId == ERC721_DATA_ID) {
+ transferERC721Token(assetData, amount);
+ } else {
+ revert("UNSUPPORTED_ASSET_PROXY");
+ }
+ }
+
+ /// @dev Decodes ERC20 assetData and transfers given amount to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferERC20Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal
+ {
+ address token = assetData.readAddress(16);
+
+ // Transfer tokens.
+ // We do a raw call so we can check the success separate
+ // from the return data.
+ bool success = token.call(abi.encodeWithSelector(
+ ERC20_TRANSFER_SELECTOR,
+ msg.sender,
+ amount
+ ));
+ require(
+ success,
+ "TRANSFER_FAILED"
+ );
+
+ // Check return data.
+ // If there is no return data, we assume the token incorrectly
+ // does not return a bool. In this case we expect it to revert
+ // on failure, which was handled above.
+ // If the token does return data, we require that it is a single
+ // value that evaluates to true.
+ assembly {
+ if returndatasize {
+ success := 0
+ if eq(returndatasize, 32) {
+ // First 64 bytes of memory are reserved scratch space
+ returndatacopy(0, 0, 32)
+ success := mload(0)
+ }
+ }
+ }
+ require(
+ success,
+ "TRANSFER_FAILED"
+ );
+ }
+
+ /// @dev Decodes ERC721 assetData and transfers given amount to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferERC721Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal
+ {
+ require(
+ amount == 1,
+ "INVALID_AMOUNT"
+ );
+ // Decode asset data.
+ address token = assetData.readAddress(16);
+ uint256 tokenId = assetData.readUint256(36);
+
+ // Perform transfer.
+ IERC721Token(token).transferFrom(
+ address(this),
+ msg.sender,
+ tokenId
+ );
+ }
+}
diff --git a/contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol b/contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol
new file mode 100644
index 000000000..cab26741d
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/MixinExchangeWrapper.sol
@@ -0,0 +1,260 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "./libs/LibConstants.sol";
+import "./mixins/MExchangeWrapper.sol";
+import "@0x/contracts-libs/contracts/libs/LibAbiEncoder.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+
+
+contract MixinExchangeWrapper is
+ LibAbiEncoder,
+ LibFillResults,
+ LibMath,
+ LibConstants,
+ MExchangeWrapper
+{
+ /// @dev Fills the input order.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ /// @return Amounts filled and fees paid by maker and taker.
+ function fillOrderNoThrow(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ internal
+ returns (FillResults memory fillResults)
+ {
+ // ABI encode calldata for `fillOrder`
+ bytes memory fillOrderCalldata = abiEncodeFillOrder(
+ order,
+ takerAssetFillAmount,
+ signature
+ );
+
+ address exchange = address(EXCHANGE);
+
+ // Call `fillOrder` and handle any exceptions gracefully
+ assembly {
+ let success := call(
+ gas, // forward all gas
+ exchange, // call address of Exchange contract
+ 0, // transfer 0 wei
+ add(fillOrderCalldata, 32), // pointer to start of input (skip array length in first 32 bytes)
+ mload(fillOrderCalldata), // length of input
+ fillOrderCalldata, // write output over input
+ 128 // output size is 128 bytes
+ )
+ if success {
+ mstore(fillResults, mload(fillOrderCalldata))
+ mstore(add(fillResults, 32), mload(add(fillOrderCalldata, 32)))
+ mstore(add(fillResults, 64), mload(add(fillOrderCalldata, 64)))
+ mstore(add(fillResults, 96), mload(add(fillOrderCalldata, 96)))
+ }
+ }
+ // fillResults values will be 0 by default if call was unsuccessful
+ return fillResults;
+ }
+
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of WETH has been sold by taker.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param orders Array of order specifications.
+ /// @param wethSellAmount Desired amount of WETH to sell.
+ /// @param signatures Proofs that orders have been signed by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketSellWeth(
+ LibOrder.Order[] memory orders,
+ uint256 wethSellAmount,
+ bytes[] memory signatures
+ )
+ internal
+ returns (FillResults memory totalFillResults)
+ {
+ bytes memory makerAssetData = orders[0].makerAssetData;
+ bytes memory wethAssetData = WETH_ASSET_DATA;
+
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+
+ // We assume that asset being bought by taker is the same for each order.
+ // We assume that asset being sold by taker is WETH for each order.
+ orders[i].makerAssetData = makerAssetData;
+ orders[i].takerAssetData = wethAssetData;
+
+ // Calculate the remaining amount of WETH to sell
+ uint256 remainingTakerAssetFillAmount = safeSub(wethSellAmount, totalFillResults.takerAssetFilledAmount);
+
+ // Attempt to sell the remaining amount of WETH
+ FillResults memory singleFillResults = fillOrderNoThrow(
+ orders[i],
+ remainingTakerAssetFillAmount,
+ signatures[i]
+ );
+
+ // Update amounts filled and fees paid by maker and taker
+ addFillResults(totalFillResults, singleFillResults);
+
+ // Stop execution if the entire amount of takerAsset has been sold
+ if (totalFillResults.takerAssetFilledAmount >= wethSellAmount) {
+ break;
+ }
+ }
+ return totalFillResults;
+ }
+
+ /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.
+ /// Returns false if the transaction would otherwise revert.
+ /// The asset being sold by taker must always be WETH.
+ /// @param orders Array of order specifications.
+ /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
+ /// @param signatures Proofs that orders have been signed by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketBuyExactAmountWithWeth(
+ LibOrder.Order[] memory orders,
+ uint256 makerAssetFillAmount,
+ bytes[] memory signatures
+ )
+ internal
+ returns (FillResults memory totalFillResults)
+ {
+ bytes memory makerAssetData = orders[0].makerAssetData;
+ bytes memory wethAssetData = WETH_ASSET_DATA;
+
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+
+ // We assume that asset being bought by taker is the same for each order.
+ // We assume that asset being sold by taker is WETH for each order.
+ orders[i].makerAssetData = makerAssetData;
+ orders[i].takerAssetData = wethAssetData;
+
+ // Calculate the remaining amount of makerAsset to buy
+ uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
+
+ // Convert the remaining amount of makerAsset to buy into remaining amount
+ // of takerAsset to sell, assuming entire amount can be sold in the current order.
+ // We round up because the exchange rate computed by fillOrder rounds in favor
+ // of the Maker. In this case we want to overestimate the amount of takerAsset.
+ uint256 remainingTakerAssetFillAmount = getPartialAmountCeil(
+ orders[i].takerAssetAmount,
+ orders[i].makerAssetAmount,
+ remainingMakerAssetFillAmount
+ );
+
+ // Attempt to sell the remaining amount of takerAsset
+ FillResults memory singleFillResults = fillOrderNoThrow(
+ orders[i],
+ remainingTakerAssetFillAmount,
+ signatures[i]
+ );
+
+ // Update amounts filled and fees paid by maker and taker
+ addFillResults(totalFillResults, singleFillResults);
+
+ // Stop execution if the entire amount of makerAsset has been bought
+ uint256 makerAssetFilledAmount = totalFillResults.makerAssetFilledAmount;
+ if (makerAssetFilledAmount >= makerAssetFillAmount) {
+ break;
+ }
+ }
+
+ require(
+ makerAssetFilledAmount >= makerAssetFillAmount,
+ "COMPLETE_FILL_FAILED"
+ );
+ return totalFillResults;
+ }
+
+ /// @dev Buys zrxBuyAmount of ZRX fee tokens, taking into account ZRX fees for each order. This will guarantee
+ /// that at least zrxBuyAmount of ZRX is purchased (sometimes slightly over due to rounding issues).
+ /// It is possible that a request to buy 200 ZRX will require purchasing 202 ZRX
+ /// as 2 ZRX is required to purchase the 200 ZRX fee tokens. This guarantees at least 200 ZRX for future purchases.
+ /// The asset being sold by taker must always be WETH.
+ /// @param orders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset.
+ /// @param zrxBuyAmount Desired amount of ZRX to buy.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @return totalFillResults Amounts filled and fees paid by maker and taker.
+ function marketBuyExactZrxWithWeth(
+ LibOrder.Order[] memory orders,
+ uint256 zrxBuyAmount,
+ bytes[] memory signatures
+ )
+ internal
+ returns (FillResults memory totalFillResults)
+ {
+ // Do nothing if zrxBuyAmount == 0
+ if (zrxBuyAmount == 0) {
+ return totalFillResults;
+ }
+
+ bytes memory zrxAssetData = ZRX_ASSET_DATA;
+ bytes memory wethAssetData = WETH_ASSET_DATA;
+ uint256 zrxPurchased = 0;
+
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+
+ // All of these are ZRX/WETH, so we can drop the respective assetData from calldata.
+ orders[i].makerAssetData = zrxAssetData;
+ orders[i].takerAssetData = wethAssetData;
+
+ // Calculate the remaining amount of ZRX to buy.
+ uint256 remainingZrxBuyAmount = safeSub(zrxBuyAmount, zrxPurchased);
+
+ // Convert the remaining amount of ZRX to buy into remaining amount
+ // of WETH to sell, assuming entire amount can be sold in the current order.
+ // We round up because the exchange rate computed by fillOrder rounds in favor
+ // of the Maker. In this case we want to overestimate the amount of takerAsset.
+ uint256 remainingWethSellAmount = getPartialAmountCeil(
+ orders[i].takerAssetAmount,
+ safeSub(orders[i].makerAssetAmount, orders[i].takerFee), // our exchange rate after fees
+ remainingZrxBuyAmount
+ );
+
+ // Attempt to sell the remaining amount of WETH.
+ FillResults memory singleFillResult = fillOrderNoThrow(
+ orders[i],
+ remainingWethSellAmount,
+ signatures[i]
+ );
+
+ // Update amounts filled and fees paid by maker and taker.
+ addFillResults(totalFillResults, singleFillResult);
+ zrxPurchased = safeSub(totalFillResults.makerAssetFilledAmount, totalFillResults.takerFeePaid);
+
+ // Stop execution if the entire amount of ZRX has been bought.
+ if (zrxPurchased >= zrxBuyAmount) {
+ break;
+ }
+ }
+
+ require(
+ zrxPurchased >= zrxBuyAmount,
+ "COMPLETE_FILL_FAILED"
+ );
+ return totalFillResults;
+ }
+}
diff --git a/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol b/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol
new file mode 100644
index 000000000..11c0147a5
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/MixinForwarderCore.sol
@@ -0,0 +1,214 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "./libs/LibConstants.sol";
+import "./mixins/MWeth.sol";
+import "./mixins/MAssets.sol";
+import "./mixins/MExchangeWrapper.sol";
+import "./interfaces/IForwarderCore.sol";
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+
+
+contract MixinForwarderCore is
+ LibFillResults,
+ LibMath,
+ LibConstants,
+ MWeth,
+ MAssets,
+ MExchangeWrapper,
+ IForwarderCore
+{
+ using LibBytes for bytes;
+
+ /// @dev Constructor approves ERC20 proxy to transfer ZRX and WETH on this contract's behalf.
+ constructor ()
+ public
+ {
+ address proxyAddress = EXCHANGE.getAssetProxy(ERC20_DATA_ID);
+ require(
+ proxyAddress != address(0),
+ "UNREGISTERED_ASSET_PROXY"
+ );
+ ETHER_TOKEN.approve(proxyAddress, MAX_UINT);
+ ZRX_TOKEN.approve(proxyAddress, MAX_UINT);
+ }
+
+ /// @dev Purchases as much of orders' makerAssets as possible by selling up to 95% of transaction's ETH value.
+ /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
+ /// 5% of ETH value is reserved for paying fees to order feeRecipients (in ZRX) and forwarding contract feeRecipient (in ETH).
+ /// Any ETH not spent will be refunded to sender.
+ /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.
+ /// @param feeSignatures Proofs that feeOrders have been created by makers.
+ /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
+ /// @param feeRecipient Address that will receive ETH when orders are filled.
+ /// @return Amounts filled and fees paid by maker and taker for both sets of orders.
+ function marketSellOrdersWithEth(
+ LibOrder.Order[] memory orders,
+ bytes[] memory signatures,
+ LibOrder.Order[] memory feeOrders,
+ bytes[] memory feeSignatures,
+ uint256 feePercentage,
+ address feeRecipient
+ )
+ public
+ payable
+ returns (
+ FillResults memory orderFillResults,
+ FillResults memory feeOrderFillResults
+ )
+ {
+ // Convert ETH to WETH.
+ convertEthToWeth();
+
+ uint256 wethSellAmount;
+ uint256 zrxBuyAmount;
+ uint256 makerAssetAmountPurchased;
+ if (orders[0].makerAssetData.equals(ZRX_ASSET_DATA)) {
+ // Calculate amount of WETH that won't be spent on ETH fees.
+ wethSellAmount = getPartialAmountFloor(
+ PERCENTAGE_DENOMINATOR,
+ safeAdd(PERCENTAGE_DENOMINATOR, feePercentage),
+ msg.value
+ );
+ // Market sell available WETH.
+ // ZRX fees are paid with this contract's balance.
+ orderFillResults = marketSellWeth(
+ orders,
+ wethSellAmount,
+ signatures
+ );
+ // The fee amount must be deducted from the amount transfered back to sender.
+ makerAssetAmountPurchased = safeSub(orderFillResults.makerAssetFilledAmount, orderFillResults.takerFeePaid);
+ } else {
+ // 5% of WETH is reserved for filling feeOrders and paying feeRecipient.
+ wethSellAmount = getPartialAmountFloor(
+ MAX_WETH_FILL_PERCENTAGE,
+ PERCENTAGE_DENOMINATOR,
+ msg.value
+ );
+ // Market sell 95% of WETH.
+ // ZRX fees are payed with this contract's balance.
+ orderFillResults = marketSellWeth(
+ orders,
+ wethSellAmount,
+ signatures
+ );
+ // Buy back all ZRX spent on fees.
+ zrxBuyAmount = orderFillResults.takerFeePaid;
+ feeOrderFillResults = marketBuyExactZrxWithWeth(
+ feeOrders,
+ zrxBuyAmount,
+ feeSignatures
+ );
+ makerAssetAmountPurchased = orderFillResults.makerAssetFilledAmount;
+ }
+
+ // Transfer feePercentage of total ETH spent on primary orders to feeRecipient.
+ // Refund remaining ETH to msg.sender.
+ transferEthFeeAndRefund(
+ orderFillResults.takerAssetFilledAmount,
+ feeOrderFillResults.takerAssetFilledAmount,
+ feePercentage,
+ feeRecipient
+ );
+
+ // Transfer purchased assets to msg.sender.
+ transferAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);
+ }
+
+ /// @dev Attempt to purchase makerAssetFillAmount of makerAsset by selling ETH provided with transaction.
+ /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
+ /// Any ETH not spent will be refunded to sender.
+ /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset.
+ /// @param makerAssetFillAmount Desired amount of makerAsset to purchase.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.
+ /// @param feeSignatures Proofs that feeOrders have been created by makers.
+ /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
+ /// @param feeRecipient Address that will receive ETH when orders are filled.
+ /// @return Amounts filled and fees paid by maker and taker for both sets of orders.
+ function marketBuyOrdersWithEth(
+ LibOrder.Order[] memory orders,
+ uint256 makerAssetFillAmount,
+ bytes[] memory signatures,
+ LibOrder.Order[] memory feeOrders,
+ bytes[] memory feeSignatures,
+ uint256 feePercentage,
+ address feeRecipient
+ )
+ public
+ payable
+ returns (
+ FillResults memory orderFillResults,
+ FillResults memory feeOrderFillResults
+ )
+ {
+ // Convert ETH to WETH.
+ convertEthToWeth();
+
+ uint256 zrxBuyAmount;
+ uint256 makerAssetAmountPurchased;
+ if (orders[0].makerAssetData.equals(ZRX_ASSET_DATA)) {
+ // If the makerAsset is ZRX, it is not necessary to pay fees out of this
+ // contracts's ZRX balance because fees are factored into the price of the order.
+ orderFillResults = marketBuyExactZrxWithWeth(
+ orders,
+ makerAssetFillAmount,
+ signatures
+ );
+ // The fee amount must be deducted from the amount transfered back to sender.
+ makerAssetAmountPurchased = safeSub(orderFillResults.makerAssetFilledAmount, orderFillResults.takerFeePaid);
+ } else {
+ // Attemp to purchase desired amount of makerAsset.
+ // ZRX fees are payed with this contract's balance.
+ orderFillResults = marketBuyExactAmountWithWeth(
+ orders,
+ makerAssetFillAmount,
+ signatures
+ );
+ // Buy back all ZRX spent on fees.
+ zrxBuyAmount = orderFillResults.takerFeePaid;
+ feeOrderFillResults = marketBuyExactZrxWithWeth(
+ feeOrders,
+ zrxBuyAmount,
+ feeSignatures
+ );
+ makerAssetAmountPurchased = orderFillResults.makerAssetFilledAmount;
+ }
+
+ // Transfer feePercentage of total ETH spent on primary orders to feeRecipient.
+ // Refund remaining ETH to msg.sender.
+ transferEthFeeAndRefund(
+ orderFillResults.takerAssetFilledAmount,
+ feeOrderFillResults.takerAssetFilledAmount,
+ feePercentage,
+ feeRecipient
+ );
+
+ // Transfer purchased assets to msg.sender.
+ transferAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);
+ }
+}
diff --git a/contracts/extensions/contracts/Forwarder/MixinWeth.sol b/contracts/extensions/contracts/Forwarder/MixinWeth.sol
new file mode 100644
index 000000000..25a35f47b
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/MixinWeth.sol
@@ -0,0 +1,113 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+import "./libs/LibConstants.sol";
+import "./mixins/MWeth.sol";
+
+
+contract MixinWeth is
+ LibMath,
+ LibConstants,
+ MWeth
+{
+ /// @dev Default payabale function, this allows us to withdraw WETH
+ function ()
+ public
+ payable
+ {
+ require(
+ msg.sender == address(ETHER_TOKEN),
+ "DEFAULT_FUNCTION_WETH_CONTRACT_ONLY"
+ );
+ }
+
+ /// @dev Converts message call's ETH value into WETH.
+ function convertEthToWeth()
+ internal
+ {
+ require(
+ msg.value > 0,
+ "INVALID_MSG_VALUE"
+ );
+ ETHER_TOKEN.deposit.value(msg.value)();
+ }
+
+ /// @dev Transfers feePercentage of WETH spent on primary orders to feeRecipient.
+ /// Refunds any excess ETH to msg.sender.
+ /// @param wethSoldExcludingFeeOrders Amount of WETH sold when filling primary orders.
+ /// @param wethSoldForZrx Amount of WETH sold when purchasing ZRX required for primary order fees.
+ /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
+ /// @param feeRecipient Address that will receive ETH when orders are filled.
+ function transferEthFeeAndRefund(
+ uint256 wethSoldExcludingFeeOrders,
+ uint256 wethSoldForZrx,
+ uint256 feePercentage,
+ address feeRecipient
+ )
+ internal
+ {
+ // Ensure feePercentage is less than 5%.
+ require(
+ feePercentage <= MAX_FEE_PERCENTAGE,
+ "FEE_PERCENTAGE_TOO_LARGE"
+ );
+
+ // Ensure that no extra WETH owned by this contract has been sold.
+ uint256 wethSold = safeAdd(wethSoldExcludingFeeOrders, wethSoldForZrx);
+ require(
+ wethSold <= msg.value,
+ "OVERSOLD_WETH"
+ );
+
+ // Calculate amount of WETH that hasn't been sold.
+ uint256 wethRemaining = safeSub(msg.value, wethSold);
+
+ // Calculate ETH fee to pay to feeRecipient.
+ uint256 ethFee = getPartialAmountFloor(
+ feePercentage,
+ PERCENTAGE_DENOMINATOR,
+ wethSoldExcludingFeeOrders
+ );
+
+ // Ensure fee is less than amount of WETH remaining.
+ require(
+ ethFee <= wethRemaining,
+ "INSUFFICIENT_ETH_REMAINING"
+ );
+
+ // Do nothing if no WETH remaining
+ if (wethRemaining > 0) {
+ // Convert remaining WETH to ETH
+ ETHER_TOKEN.withdraw(wethRemaining);
+
+ // Pay ETH to feeRecipient
+ if (ethFee > 0) {
+ feeRecipient.transfer(ethFee);
+ }
+
+ // Refund remaining ETH to msg.sender.
+ uint256 ethRefund = safeSub(wethRemaining, ethFee);
+ if (ethRefund > 0) {
+ msg.sender.transfer(ethRefund);
+ }
+ }
+ }
+}
diff --git a/contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol b/contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol
new file mode 100644
index 000000000..cebfd3706
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/interfaces/IAssets.sol
@@ -0,0 +1,34 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract IAssets {
+
+ /// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
+ /// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
+ /// used to withdraw assets that were accidentally sent to this contract.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of ERC20 token to withdraw.
+ function withdrawAsset(
+ bytes assetData,
+ uint256 amount
+ )
+ external;
+}
diff --git a/contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol b/contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol
new file mode 100644
index 000000000..6ce8a1d31
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/interfaces/IForwarder.sol
@@ -0,0 +1,30 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "./IForwarderCore.sol";
+import "./IAssets.sol";
+
+
+// solhint-disable no-empty-blocks
+contract IForwarder is
+ IForwarderCore,
+ IAssets
+{}
diff --git a/contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol b/contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol
new file mode 100644
index 000000000..7f62722e7
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/interfaces/IForwarderCore.sol
@@ -0,0 +1,80 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+
+
+contract IForwarderCore {
+
+ /// @dev Purchases as much of orders' makerAssets as possible by selling up to 95% of transaction's ETH value.
+ /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
+ /// 5% of ETH value is reserved for paying fees to order feeRecipients (in ZRX) and forwarding contract feeRecipient (in ETH).
+ /// Any ETH not spent will be refunded to sender.
+ /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.
+ /// @param feeSignatures Proofs that feeOrders have been created by makers.
+ /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
+ /// @param feeRecipient Address that will receive ETH when orders are filled.
+ /// @return Amounts filled and fees paid by maker and taker for both sets of orders.
+ function marketSellOrdersWithEth(
+ LibOrder.Order[] memory orders,
+ bytes[] memory signatures,
+ LibOrder.Order[] memory feeOrders,
+ bytes[] memory feeSignatures,
+ uint256 feePercentage,
+ address feeRecipient
+ )
+ public
+ payable
+ returns (
+ LibFillResults.FillResults memory orderFillResults,
+ LibFillResults.FillResults memory feeOrderFillResults
+ );
+
+ /// @dev Attempt to purchase makerAssetFillAmount of makerAsset by selling ETH provided with transaction.
+ /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
+ /// Any ETH not spent will be refunded to sender.
+ /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset.
+ /// @param makerAssetFillAmount Desired amount of makerAsset to purchase.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.
+ /// @param feeSignatures Proofs that feeOrders have been created by makers.
+ /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
+ /// @param feeRecipient Address that will receive ETH when orders are filled.
+ /// @return Amounts filled and fees paid by maker and taker for both sets of orders.
+ function marketBuyOrdersWithEth(
+ LibOrder.Order[] memory orders,
+ uint256 makerAssetFillAmount,
+ bytes[] memory signatures,
+ LibOrder.Order[] memory feeOrders,
+ bytes[] memory feeSignatures,
+ uint256 feePercentage,
+ address feeRecipient
+ )
+ public
+ payable
+ returns (
+ LibFillResults.FillResults memory orderFillResults,
+ LibFillResults.FillResults memory feeOrderFillResults
+ );
+}
diff --git a/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol b/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol
new file mode 100644
index 000000000..0d2f6e36d
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/libs/LibConstants.sol
@@ -0,0 +1,62 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "@0x/contracts-tokens/contracts/tokens/EtherToken/IEtherToken.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+
+
+contract LibConstants {
+
+ using LibBytes for bytes;
+
+ bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256("ERC20Token(address)"));
+ bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256("ERC721Token(address,uint256)"));
+ uint256 constant internal MAX_UINT = 2**256 - 1;
+ uint256 constant internal PERCENTAGE_DENOMINATOR = 10**18;
+ uint256 constant internal MAX_FEE_PERCENTAGE = 5 * PERCENTAGE_DENOMINATOR / 100; // 5%
+ uint256 constant internal MAX_WETH_FILL_PERCENTAGE = 95 * PERCENTAGE_DENOMINATOR / 100; // 95%
+
+ // solhint-disable var-name-mixedcase
+ IExchange internal EXCHANGE;
+ IEtherToken internal ETHER_TOKEN;
+ IERC20Token internal ZRX_TOKEN;
+ bytes internal ZRX_ASSET_DATA;
+ bytes internal WETH_ASSET_DATA;
+ // solhint-enable var-name-mixedcase
+
+ constructor (
+ address _exchange,
+ bytes memory _zrxAssetData,
+ bytes memory _wethAssetData
+ )
+ public
+ {
+ EXCHANGE = IExchange(_exchange);
+ ZRX_ASSET_DATA = _zrxAssetData;
+ WETH_ASSET_DATA = _wethAssetData;
+
+ address etherToken = _wethAssetData.readAddress(16);
+ address zrxToken = _zrxAssetData.readAddress(16);
+ ETHER_TOKEN = IEtherToken(etherToken);
+ ZRX_TOKEN = IERC20Token(zrxToken);
+ }
+}
diff --git a/contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol b/contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol
new file mode 100644
index 000000000..7a95b78a0
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/libs/LibForwarderErrors.sol
@@ -0,0 +1,34 @@
+/*
+
+ 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.
+
+*/
+
+// solhint-disable
+pragma solidity ^0.4.24;
+
+
+/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.
+contract LibForwarderErrors {
+ string constant FEE_PERCENTAGE_TOO_LARGE = "FEE_PROPORTION_TOO_LARGE"; // Provided fee percentage greater than 5%.
+ string constant INSUFFICIENT_ETH_REMAINING = "INSUFFICIENT_ETH_REMAINING"; // Not enough ETH remaining to pay feeRecipient.
+ string constant OVERSOLD_WETH = "OVERSOLD_WETH"; // More WETH sold than provided with current message call.
+ string constant COMPLETE_FILL_FAILED = "COMPLETE_FILL_FAILED"; // Desired purchase amount not completely filled (required for ZRX fees only).
+ string constant TRANSFER_FAILED = "TRANSFER_FAILED"; // Asset transfer failed.
+ string constant UNSUPPORTED_ASSET_PROXY = "UNSUPPORTED_ASSET_PROXY"; // Proxy in assetData not supported.
+ string constant DEFAULT_FUNCTION_WETH_CONTRACT_ONLY = "DEFAULT_FUNCTION_WETH_CONTRACT_ONLY"; // Fallback function may only be used for WETH withdrawals.
+ string constant INVALID_MSG_VALUE = "INVALID_MSG_VALUE"; // msg.value must be greater than 0.
+ string constant INVALID_AMOUNT = "INVALID_AMOUNT"; // Amount must equal 1.
+}
diff --git a/contracts/extensions/contracts/Forwarder/mixins/MAssets.sol b/contracts/extensions/contracts/Forwarder/mixins/MAssets.sol
new file mode 100644
index 000000000..1757b37fb
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/mixins/MAssets.sol
@@ -0,0 +1,53 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "../interfaces/IAssets.sol";
+
+
+contract MAssets is
+ IAssets
+{
+ /// @dev Transfers given amount of asset to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferAssetToSender(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal;
+
+ /// @dev Decodes ERC20 assetData and transfers given amount to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferERC20Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal;
+
+ /// @dev Decodes ERC721 assetData and transfers given amount to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferERC721Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal;
+}
diff --git a/contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol b/contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol
new file mode 100644
index 000000000..143f888b1
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/mixins/MExchangeWrapper.sol
@@ -0,0 +1,87 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+
+
+contract MExchangeWrapper {
+
+ /// @dev Fills the input order.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ /// @return Amounts filled and fees paid by maker and taker.
+ function fillOrderNoThrow(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ internal
+ returns (LibFillResults.FillResults memory fillResults);
+
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of WETH has been sold by taker.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param orders Array of order specifications.
+ /// @param wethSellAmount Desired amount of WETH to sell.
+ /// @param signatures Proofs that orders have been signed by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketSellWeth(
+ LibOrder.Order[] memory orders,
+ uint256 wethSellAmount,
+ bytes[] memory signatures
+ )
+ internal
+ returns (LibFillResults.FillResults memory totalFillResults);
+
+ /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.
+ /// Returns false if the transaction would otherwise revert.
+ /// The asset being sold by taker must always be WETH.
+ /// @param orders Array of order specifications.
+ /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
+ /// @param signatures Proofs that orders have been signed by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketBuyExactAmountWithWeth(
+ LibOrder.Order[] memory orders,
+ uint256 makerAssetFillAmount,
+ bytes[] memory signatures
+ )
+ internal
+ returns (LibFillResults.FillResults memory totalFillResults);
+
+ /// @dev Buys zrxBuyAmount of ZRX fee tokens, taking into account ZRX fees for each order. This will guarantee
+ /// that at least zrxBuyAmount of ZRX is purchased (sometimes slightly over due to rounding issues).
+ /// It is possible that a request to buy 200 ZRX will require purchasing 202 ZRX
+ /// as 2 ZRX is required to purchase the 200 ZRX fee tokens. This guarantees at least 200 ZRX for future purchases.
+ /// The asset being sold by taker must always be WETH.
+ /// @param orders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset.
+ /// @param zrxBuyAmount Desired amount of ZRX to buy.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @return totalFillResults Amounts filled and fees paid by maker and taker.
+ function marketBuyExactZrxWithWeth(
+ LibOrder.Order[] memory orders,
+ uint256 zrxBuyAmount,
+ bytes[] memory signatures
+ )
+ internal
+ returns (LibFillResults.FillResults memory totalFillResults);
+}
diff --git a/contracts/extensions/contracts/Forwarder/mixins/MWeth.sol b/contracts/extensions/contracts/Forwarder/mixins/MWeth.sol
new file mode 100644
index 000000000..15d66942f
--- /dev/null
+++ b/contracts/extensions/contracts/Forwarder/mixins/MWeth.sol
@@ -0,0 +1,41 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract MWeth {
+
+ /// @dev Converts message call's ETH value into WETH.
+ function convertEthToWeth()
+ internal;
+
+ /// @dev Transfers feePercentage of WETH spent on primary orders to feeRecipient.
+ /// Refunds any excess ETH to msg.sender.
+ /// @param wethSoldExcludingFeeOrders Amount of WETH sold when filling primary orders.
+ /// @param wethSoldForZrx Amount of WETH sold when purchasing ZRX required for primary order fees.
+ /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
+ /// @param feeRecipient Address that will receive ETH when orders are filled.
+ function transferEthFeeAndRefund(
+ uint256 wethSoldExcludingFeeOrders,
+ uint256 wethSoldForZrx,
+ uint256 feePercentage,
+ address feeRecipient
+ )
+ internal;
+}
diff --git a/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol b/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol
new file mode 100644
index 000000000..f0f91cfc0
--- /dev/null
+++ b/contracts/extensions/contracts/OrderMatcher/MixinAssets.sol
@@ -0,0 +1,195 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
+import "./mixins/MAssets.sol";
+import "./libs/LibConstants.sol";
+
+
+contract MixinAssets is
+ MAssets,
+ Ownable,
+ LibConstants
+{
+ using LibBytes for bytes;
+
+ /// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
+ /// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
+ /// used to withdraw assets that were accidentally sent to this contract.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to withdraw.
+ function withdrawAsset(
+ bytes assetData,
+ uint256 amount
+ )
+ external
+ onlyOwner
+ {
+ transferAssetToSender(assetData, amount);
+ }
+
+ /// @dev Approves or disapproves an AssetProxy to spend asset.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to approve for respective proxy.
+ function approveAssetProxy(
+ bytes assetData,
+ uint256 amount
+ )
+ external
+ onlyOwner
+ {
+ bytes4 proxyId = assetData.readBytes4(0);
+
+ if (proxyId == ERC20_DATA_ID) {
+ approveERC20Token(assetData, amount);
+ } else if (proxyId == ERC721_DATA_ID) {
+ approveERC721Token(assetData, amount);
+ } else {
+ revert("UNSUPPORTED_ASSET_PROXY");
+ }
+ }
+
+ /// @dev Transfers given amount of asset to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferAssetToSender(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal
+ {
+ bytes4 proxyId = assetData.readBytes4(0);
+
+ if (proxyId == ERC20_DATA_ID) {
+ transferERC20Token(assetData, amount);
+ } else if (proxyId == ERC721_DATA_ID) {
+ transferERC721Token(assetData, amount);
+ } else {
+ revert("UNSUPPORTED_ASSET_PROXY");
+ }
+ }
+
+ /// @dev Decodes ERC20 assetData and transfers given amount to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferERC20Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal
+ {
+ // 4 byte id + 12 0 bytes before ABI encoded token address.
+ address token = assetData.readAddress(16);
+
+ // Transfer tokens.
+ // We do a raw call so we can check the success separate
+ // from the return data.
+ bool success = token.call(abi.encodeWithSelector(
+ ERC20_TRANSFER_SELECTOR,
+ msg.sender,
+ amount
+ ));
+ require(
+ success,
+ "TRANSFER_FAILED"
+ );
+
+ // Check return data.
+ // If there is no return data, we assume the token incorrectly
+ // does not return a bool. In this case we expect it to revert
+ // on failure, which was handled above.
+ // If the token does return data, we require that it is a single
+ // value that evaluates to true.
+ assembly {
+ if returndatasize {
+ success := 0
+ if eq(returndatasize, 32) {
+ // First 64 bytes of memory are reserved scratch space
+ returndatacopy(0, 0, 32)
+ success := mload(0)
+ }
+ }
+ }
+ require(
+ success,
+ "TRANSFER_FAILED"
+ );
+ }
+
+ /// @dev Decodes ERC721 assetData and transfers given amount to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferERC721Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal
+ {
+ require(
+ amount == 1,
+ "INVALID_AMOUNT"
+ );
+ // Decode asset data.
+ // 4 byte id + 12 0 bytes before ABI encoded token address.
+ address token = assetData.readAddress(16);
+ // 4 byte id + 32 byte ABI encoded token address before token id.
+ uint256 tokenId = assetData.readUint256(36);
+
+ // Perform transfer.
+ IERC721Token(token).transferFrom(
+ address(this),
+ msg.sender,
+ tokenId
+ );
+ }
+
+ /// @dev Sets approval for ERC20 AssetProxy.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to approve for respective proxy.
+ function approveERC20Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal
+ {
+ address token = assetData.readAddress(16);
+ require(
+ IERC20Token(token).approve(ERC20_PROXY_ADDRESS, amount),
+ "APPROVAL_FAILED"
+ );
+ }
+
+ /// @dev Sets approval for ERC721 AssetProxy.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to approve for respective proxy.
+ function approveERC721Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal
+ {
+ address token = assetData.readAddress(16);
+ bool approval = amount >= 1;
+ IERC721Token(token).setApprovalForAll(ERC721_PROXY_ADDRESS, approval);
+ }
+}
diff --git a/contracts/extensions/contracts/OrderMatcher/MixinMatchOrders.sol b/contracts/extensions/contracts/OrderMatcher/MixinMatchOrders.sol
new file mode 100644
index 000000000..1787deb59
--- /dev/null
+++ b/contracts/extensions/contracts/OrderMatcher/MixinMatchOrders.sol
@@ -0,0 +1,86 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "./libs/LibConstants.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+
+
+contract MixinMatchOrders is
+ Ownable,
+ LibConstants
+{
+ /// @dev Match two complementary orders that have a profitable spread.
+ /// Each order is filled at their respective price point. However, the calculations are
+ /// carried out as though the orders are both being filled at the right order's price point.
+ /// The profit made by the left order is then used to fill the right order as much as possible.
+ /// This results in a spread being taken in terms of both assets. The spread is held within this contract.
+ /// @param leftOrder First order to match.
+ /// @param rightOrder Second order to match.
+ /// @param leftSignature Proof that order was created by the left maker.
+ /// @param rightSignature Proof that order was created by the right maker.
+ function matchOrders(
+ LibOrder.Order memory leftOrder,
+ LibOrder.Order memory rightOrder,
+ bytes memory leftSignature,
+ bytes memory rightSignature
+ )
+ public
+ onlyOwner
+ {
+ // Match orders, maximally filling `leftOrder`
+ LibFillResults.MatchedFillResults memory matchedFillResults = EXCHANGE.matchOrders(
+ leftOrder,
+ rightOrder,
+ leftSignature,
+ rightSignature
+ );
+
+ uint256 leftMakerAssetSpreadAmount = matchedFillResults.leftMakerAssetSpreadAmount;
+ uint256 rightOrderTakerAssetAmount = rightOrder.takerAssetAmount;
+
+ // Do not attempt to call `fillOrder` if no spread was taken or `rightOrder` has been completely filled
+ if (leftMakerAssetSpreadAmount == 0 || matchedFillResults.right.takerAssetFilledAmount == rightOrderTakerAssetAmount) {
+ return;
+ }
+
+ // The `assetData` fields of the `rightOrder` could have been null for the `matchOrders` call. We reassign them before calling `fillOrder`.
+ rightOrder.makerAssetData = leftOrder.takerAssetData;
+ rightOrder.takerAssetData = leftOrder.makerAssetData;
+
+ // Query `rightOrder` info to check if it has been completely filled
+ // We need to make this check in case the `rightOrder` was partially filled before the `matchOrders` call
+ LibOrder.OrderInfo memory orderInfo = EXCHANGE.getOrderInfo(rightOrder);
+
+ // Do not attempt to call `fillOrder` if order has been completely filled
+ if (orderInfo.orderTakerAssetFilledAmount == rightOrderTakerAssetAmount) {
+ return;
+ }
+
+ // We do not need to pass in a signature since it was already validated in the `matchOrders` call
+ EXCHANGE.fillOrder(
+ rightOrder,
+ leftMakerAssetSpreadAmount,
+ ""
+ );
+ }
+}
diff --git a/contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol b/contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol
new file mode 100644
index 000000000..4879b7bca
--- /dev/null
+++ b/contracts/extensions/contracts/OrderMatcher/OrderMatcher.sol
@@ -0,0 +1,38 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "./libs/LibConstants.sol";
+import "./MixinMatchOrders.sol";
+import "./MixinAssets.sol";
+
+
+// solhint-disable no-empty-blocks
+contract OrderMatcher is
+ MixinMatchOrders,
+ MixinAssets
+{
+ constructor (address _exchange)
+ public
+ LibConstants(_exchange)
+ Ownable()
+ {}
+}
diff --git a/contracts/extensions/contracts/OrderMatcher/interfaces/IAssets.sol b/contracts/extensions/contracts/OrderMatcher/interfaces/IAssets.sol
new file mode 100644
index 000000000..9fcc0023a
--- /dev/null
+++ b/contracts/extensions/contracts/OrderMatcher/interfaces/IAssets.sol
@@ -0,0 +1,43 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract IAssets {
+
+ /// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
+ /// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
+ /// used to withdraw assets that were accidentally sent to this contract.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to withdraw.
+ function withdrawAsset(
+ bytes assetData,
+ uint256 amount
+ )
+ external;
+
+ /// @dev Approves or disapproves an AssetProxy to spend asset.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to approve for respective proxy.
+ function approveAssetProxy(
+ bytes assetData,
+ uint256 amount
+ )
+ external;
+}
diff --git a/contracts/extensions/contracts/OrderMatcher/interfaces/IMatchOrders.sol b/contracts/extensions/contracts/OrderMatcher/interfaces/IMatchOrders.sol
new file mode 100644
index 000000000..1443c73b9
--- /dev/null
+++ b/contracts/extensions/contracts/OrderMatcher/interfaces/IMatchOrders.sol
@@ -0,0 +1,43 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+
+
+contract IMatchOrders {
+
+ /// @dev Match two complementary orders that have a profitable spread.
+ /// Each order is filled at their respective price point. However, the calculations are
+ /// carried out as though the orders are both being filled at the right order's price point.
+ /// The profit made by the left order is then used to fill the right order as much as possible.
+ /// This results in a spread being taken in terms of both assets. The spread is held within this contract.
+ /// @param leftOrder First order to match.
+ /// @param rightOrder Second order to match.
+ /// @param leftSignature Proof that order was created by the left maker.
+ /// @param rightSignature Proof that order was created by the right maker.
+ function matchOrders(
+ LibOrder.Order memory leftOrder,
+ LibOrder.Order memory rightOrder,
+ bytes memory leftSignature,
+ bytes memory rightSignature
+ )
+ public;
+}
diff --git a/contracts/extensions/contracts/OrderMatcher/interfaces/IOrderMatcher.sol b/contracts/extensions/contracts/OrderMatcher/interfaces/IOrderMatcher.sol
new file mode 100644
index 000000000..75f26dca6
--- /dev/null
+++ b/contracts/extensions/contracts/OrderMatcher/interfaces/IOrderMatcher.sol
@@ -0,0 +1,31 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contract-utils/contracts/utils/Ownable/IOwnable.sol";
+import "./IMatchOrders.sol";
+import "./IAssets.sol";
+
+
+// solhint-disable no-empty-blocks
+contract IOrderMatcher is
+ IOwnable,
+ IMatchOrders,
+ IAssets
+{}
diff --git a/contracts/extensions/contracts/OrderMatcher/libs/LibConstants.sol b/contracts/extensions/contracts/OrderMatcher/libs/LibConstants.sol
new file mode 100644
index 000000000..c1a86a9c7
--- /dev/null
+++ b/contracts/extensions/contracts/OrderMatcher/libs/LibConstants.sol
@@ -0,0 +1,56 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+
+
+contract LibConstants {
+
+ // bytes4(keccak256("transfer(address,uint256)"))
+ bytes4 constant internal ERC20_TRANSFER_SELECTOR = 0xa9059cbb;
+ // bytes4(keccak256("ERC20Token(address)"))
+ bytes4 constant internal ERC20_DATA_ID = 0xf47261b0;
+ // bytes4(keccak256("ERC721Token(address,uint256)"))
+ bytes4 constant internal ERC721_DATA_ID = 0x02571792;
+
+ // solhint-disable var-name-mixedcase
+ IExchange internal EXCHANGE;
+ address internal ERC20_PROXY_ADDRESS;
+ address internal ERC721_PROXY_ADDRESS;
+ // solhint-enable var-name-mixedcase
+
+ constructor (address _exchange)
+ public
+ {
+ EXCHANGE = IExchange(_exchange);
+
+ ERC20_PROXY_ADDRESS = EXCHANGE.getAssetProxy(ERC20_DATA_ID);
+ require(
+ ERC20_PROXY_ADDRESS != address(0),
+ "UNREGISTERED_ASSET_PROXY"
+ );
+
+ ERC721_PROXY_ADDRESS = EXCHANGE.getAssetProxy(ERC721_DATA_ID);
+ require(
+ ERC721_PROXY_ADDRESS != address(0),
+ "UNREGISTERED_ASSET_PROXY"
+ );
+ }
+}
diff --git a/contracts/extensions/contracts/OrderMatcher/mixins/MAssets.sol b/contracts/extensions/contracts/OrderMatcher/mixins/MAssets.sol
new file mode 100644
index 000000000..6ea7a3290
--- /dev/null
+++ b/contracts/extensions/contracts/OrderMatcher/mixins/MAssets.sol
@@ -0,0 +1,71 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "../interfaces/IAssets.sol";
+
+
+contract MAssets is
+ IAssets
+{
+ /// @dev Transfers given amount of asset to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferAssetToSender(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal;
+
+ /// @dev Decodes ERC20 assetData and transfers given amount to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferERC20Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal;
+
+ /// @dev Decodes ERC721 assetData and transfers given amount to sender.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to transfer to sender.
+ function transferERC721Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal;
+
+ /// @dev Sets approval for ERC20 AssetProxy.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to approve for respective proxy.
+ function approveERC20Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal;
+
+ /// @dev Sets approval for ERC721 AssetProxy.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param amount Amount of asset to approve for respective proxy.
+ function approveERC721Token(
+ bytes memory assetData,
+ uint256 amount
+ )
+ internal;
+}
diff --git a/contracts/extensions/contracts/OrderValidator/OrderValidator.sol b/contracts/extensions/contracts/OrderValidator/OrderValidator.sol
new file mode 100644
index 000000000..33dd1326c
--- /dev/null
+++ b/contracts/extensions/contracts/OrderValidator/OrderValidator.sol
@@ -0,0 +1,218 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+import "@0x/contracts-tokens/contracts/tokens/ERC721Token/IERC721Token.sol";
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+
+
+contract OrderValidator {
+
+ using LibBytes for bytes;
+
+ bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256("ERC20Token(address)"));
+ bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256("ERC721Token(address,uint256)"));
+
+ struct TraderInfo {
+ uint256 makerBalance; // Maker's balance of makerAsset
+ uint256 makerAllowance; // Maker's allowance to corresponding AssetProxy
+ uint256 takerBalance; // Taker's balance of takerAsset
+ uint256 takerAllowance; // Taker's allowance to corresponding AssetProxy
+ uint256 makerZrxBalance; // Maker's balance of ZRX
+ uint256 makerZrxAllowance; // Maker's allowance of ZRX to ERC20Proxy
+ uint256 takerZrxBalance; // Taker's balance of ZRX
+ uint256 takerZrxAllowance; // Taker's allowance of ZRX to ERC20Proxy
+ }
+
+ // solhint-disable var-name-mixedcase
+ IExchange internal EXCHANGE;
+ bytes internal ZRX_ASSET_DATA;
+ // solhint-enable var-name-mixedcase
+
+ constructor (address _exchange, bytes memory _zrxAssetData)
+ public
+ {
+ EXCHANGE = IExchange(_exchange);
+ ZRX_ASSET_DATA = _zrxAssetData;
+ }
+
+ /// @dev Fetches information for order and maker/taker of order.
+ /// @param order The order structure.
+ /// @param takerAddress Address that will be filling the order.
+ /// @return OrderInfo and TraderInfo instances for given order.
+ function getOrderAndTraderInfo(LibOrder.Order memory order, address takerAddress)
+ public
+ view
+ returns (LibOrder.OrderInfo memory orderInfo, TraderInfo memory traderInfo)
+ {
+ orderInfo = EXCHANGE.getOrderInfo(order);
+ traderInfo = getTraderInfo(order, takerAddress);
+ return (orderInfo, traderInfo);
+ }
+
+ /// @dev Fetches information for all passed in orders and the makers/takers of each order.
+ /// @param orders Array of order specifications.
+ /// @param takerAddresses Array of taker addresses corresponding to each order.
+ /// @return Arrays of OrderInfo and TraderInfo instances that correspond to each order.
+ function getOrdersAndTradersInfo(LibOrder.Order[] memory orders, address[] memory takerAddresses)
+ public
+ view
+ returns (LibOrder.OrderInfo[] memory ordersInfo, TraderInfo[] memory tradersInfo)
+ {
+ ordersInfo = EXCHANGE.getOrdersInfo(orders);
+ tradersInfo = getTradersInfo(orders, takerAddresses);
+ return (ordersInfo, tradersInfo);
+ }
+
+ /// @dev Fetches balance and allowances for maker and taker of order.
+ /// @param order The order structure.
+ /// @param takerAddress Address that will be filling the order.
+ /// @return Balances and allowances of maker and taker of order.
+ function getTraderInfo(LibOrder.Order memory order, address takerAddress)
+ public
+ view
+ returns (TraderInfo memory traderInfo)
+ {
+ (traderInfo.makerBalance, traderInfo.makerAllowance) = getBalanceAndAllowance(order.makerAddress, order.makerAssetData);
+ (traderInfo.takerBalance, traderInfo.takerAllowance) = getBalanceAndAllowance(takerAddress, order.takerAssetData);
+ bytes memory zrxAssetData = ZRX_ASSET_DATA;
+ (traderInfo.makerZrxBalance, traderInfo.makerZrxAllowance) = getBalanceAndAllowance(order.makerAddress, zrxAssetData);
+ (traderInfo.takerZrxBalance, traderInfo.takerZrxAllowance) = getBalanceAndAllowance(takerAddress, zrxAssetData);
+ return traderInfo;
+ }
+
+ /// @dev Fetches balances and allowances of maker and taker for each provided order.
+ /// @param orders Array of order specifications.
+ /// @param takerAddresses Array of taker addresses corresponding to each order.
+ /// @return Array of balances and allowances for maker and taker of each order.
+ function getTradersInfo(LibOrder.Order[] memory orders, address[] memory takerAddresses)
+ public
+ view
+ returns (TraderInfo[] memory)
+ {
+ uint256 ordersLength = orders.length;
+ TraderInfo[] memory tradersInfo = new TraderInfo[](ordersLength);
+ for (uint256 i = 0; i != ordersLength; i++) {
+ tradersInfo[i] = getTraderInfo(orders[i], takerAddresses[i]);
+ }
+ return tradersInfo;
+ }
+
+ /// @dev Fetches token balances and allowances of an address to given assetProxy. Supports ERC20 and ERC721.
+ /// @param target Address to fetch balances and allowances of.
+ /// @param assetData Encoded data that can be decoded by a specified proxy contract when transferring asset.
+ /// @return Balance of asset and allowance set to given proxy of asset.
+ /// For ERC721 tokens, these values will always be 1 or 0.
+ function getBalanceAndAllowance(address target, bytes memory assetData)
+ public
+ view
+ returns (uint256 balance, uint256 allowance)
+ {
+ bytes4 assetProxyId = assetData.readBytes4(0);
+ address token = assetData.readAddress(16);
+ address assetProxy = EXCHANGE.getAssetProxy(assetProxyId);
+
+ if (assetProxyId == ERC20_DATA_ID) {
+ // Query balance
+ balance = IERC20Token(token).balanceOf(target);
+
+ // Query allowance
+ allowance = IERC20Token(token).allowance(target, assetProxy);
+ } else if (assetProxyId == ERC721_DATA_ID) {
+ uint256 tokenId = assetData.readUint256(36);
+
+ // Query owner of tokenId
+ address owner = getERC721TokenOwner(token, tokenId);
+
+ // Set balance to 1 if tokenId is owned by target
+ balance = target == owner ? 1 : 0;
+
+ // Check if ERC721Proxy is approved to spend tokenId
+ bool isApproved = IERC721Token(token).isApprovedForAll(target, assetProxy);
+
+ // Set alowance to 1 if ERC721Proxy is approved to spend tokenId
+ allowance = isApproved ? 1 : 0;
+ } else {
+ revert("UNSUPPORTED_ASSET_PROXY");
+ }
+ return (balance, allowance);
+ }
+
+ /// @dev Fetches token balances and allowances of an address for each given assetProxy. Supports ERC20 and ERC721.
+ /// @param target Address to fetch balances and allowances of.
+ /// @param assetData Array of encoded byte arrays that can be decoded by a specified proxy contract when transferring asset.
+ /// @return Balances and allowances of assets.
+ /// For ERC721 tokens, these values will always be 1 or 0.
+ function getBalancesAndAllowances(address target, bytes[] memory assetData)
+ public
+ view
+ returns (uint256[] memory, uint256[] memory)
+ {
+ uint256 length = assetData.length;
+ uint256[] memory balances = new uint256[](length);
+ uint256[] memory allowances = new uint256[](length);
+ for (uint256 i = 0; i != length; i++) {
+ (balances[i], allowances[i]) = getBalanceAndAllowance(target, assetData[i]);
+ }
+ return (balances, allowances);
+ }
+
+ /// @dev Calls `token.ownerOf(tokenId)`, but returns a null owner instead of reverting on an unowned token.
+ /// @param token Address of ERC721 token.
+ /// @param tokenId The identifier for the specific NFT.
+ /// @return Owner of tokenId or null address if unowned.
+ function getERC721TokenOwner(address token, uint256 tokenId)
+ public
+ view
+ returns (address owner)
+ {
+ assembly {
+ // load free memory pointer
+ let cdStart := mload(64)
+
+ // bytes4(keccak256(ownerOf(uint256))) = 0x6352211e
+ mstore(cdStart, 0x6352211e00000000000000000000000000000000000000000000000000000000)
+ mstore(add(cdStart, 4), tokenId)
+
+ // staticcall `ownerOf(tokenId)`
+ // `ownerOf` will revert if tokenId is not owned
+ let success := staticcall(
+ gas, // forward all gas
+ token, // call token contract
+ cdStart, // start of calldata
+ 36, // length of input is 36 bytes
+ cdStart, // write output over input
+ 32 // size of output is 32 bytes
+ )
+
+ // Success implies that tokenId is owned
+ // Copy owner from return data if successful
+ if success {
+ owner := mload(cdStart)
+ }
+ }
+
+ // Owner initialized to address(0), no need to modify if call is unsuccessful
+ return owner;
+ }
+}
diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json
new file mode 100644
index 000000000..aee995645
--- /dev/null
+++ b/contracts/extensions/package.json
@@ -0,0 +1,95 @@
+{
+ "name": "@0x/contracts-extensions",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract extensions of 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
+ "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "compile": "sol-compiler",
+ "watch": "sol-compiler -w",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "coverage:report:text": "istanbul report text",
+ "coverage:report:html": "istanbul report html && open coverage/index.html",
+ "profiler:report:html": "istanbul report html && open coverage/index.html",
+ "coverage:report:lcov": "istanbul report lcov",
+ "test:circleci": "yarn test",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(BalanceThresholdFilter|DutchAuction|Forwarder|OrderMatcher|OrderValidator).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contract-wrappers": "^4.1.3",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-interfaces": "^1.0.2",
+ "@0x/contracts-libs": "^1.0.2",
+ "@0x/contracts-protocol": "^2.1.59",
+ "@0x/contracts-tokens": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.4",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/extensions/src/artifacts/index.ts b/contracts/extensions/src/artifacts/index.ts
new file mode 100644
index 000000000..329d0f3f3
--- /dev/null
+++ b/contracts/extensions/src/artifacts/index.ts
@@ -0,0 +1,15 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as BalanceThresholdFilter from '../../generated-artifacts/BalanceThresholdFilter.json';
+import * as DutchAuction from '../../generated-artifacts/DutchAuction.json';
+import * as Forwarder from '../../generated-artifacts/Forwarder.json';
+import * as OrderMatcher from '../../generated-artifacts/OrderMatcher.json';
+import * as OrderValidator from '../../generated-artifacts/OrderValidator.json';
+
+export const artifacts = {
+ BalanceThresholdFilter: BalanceThresholdFilter as ContractArtifact,
+ DutchAuction: DutchAuction as ContractArtifact,
+ Forwarder: Forwarder as ContractArtifact,
+ OrderMatcher: OrderMatcher as ContractArtifact,
+ OrderValidator: OrderValidator as ContractArtifact,
+};
diff --git a/contracts/extensions/src/index.ts b/contracts/extensions/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/extensions/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/extensions/src/wrappers/index.ts b/contracts/extensions/src/wrappers/index.ts
new file mode 100644
index 000000000..65aec3ccd
--- /dev/null
+++ b/contracts/extensions/src/wrappers/index.ts
@@ -0,0 +1,5 @@
+export * from '../../generated-wrappers/balance_threshold_filter';
+export * from '../../generated-wrappers/dutch_auction';
+export * from '../../generated-wrappers/forwarder';
+export * from '../../generated-wrappers/order_matcher';
+export * from '../../generated-wrappers/order_validator';
diff --git a/contracts/extensions/test/extensions/balance_threshold_filter.ts b/contracts/extensions/test/extensions/balance_threshold_filter.ts
new file mode 100644
index 000000000..07199d60b
--- /dev/null
+++ b/contracts/extensions/test/extensions/balance_threshold_filter.ts
@@ -0,0 +1,1644 @@
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { Order, RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import {
+ artifacts as protocolArtifacts,
+ ERC20Wrapper,
+ ERC721Wrapper,
+ ExchangeContract,
+ ExchangeWrapper,
+} from '@0x/contracts-protocol';
+import {
+ chaiSetup,
+ constants,
+ ContractName,
+ ERC20BalancesByOwner,
+ expectTransactionFailedAsync,
+ OrderFactory,
+ OrderStatus,
+ provider,
+ TransactionFactory,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { DummyERC20TokenContract } from '@0x/contracts-tokens';
+
+import { BalanceThresholdFilterContract } from '../../generated-wrappers/balance_threshold_filter';
+import { artifacts } from '../../src/artifacts';
+import { BalanceThresholdWrapper } from '../utils/balance_threshold_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+const DECIMALS_DEFAULT = 18;
+
+interface ValidatedAddressesLog {
+ args: { addresses: string[] };
+}
+
+describe(ContractName.BalanceThresholdFilter, () => {
+ const takerAssetAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(500), DECIMALS_DEFAULT);
+ const makerAssetAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), DECIMALS_DEFAULT);
+ const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(250), DECIMALS_DEFAULT);
+
+ let validMakerAddress: string;
+ let validMakerAddress2: string;
+ let owner: string;
+ let validTakerAddress: string;
+ let feeRecipientAddress: string;
+ let invalidAddress: string;
+ let defaultMakerAssetAddress: string;
+ let defaultTakerAssetAddress: string;
+ let zrxAssetData: string;
+ let zrxToken: DummyERC20TokenContract;
+ let exchangeInstance: ExchangeContract;
+ let exchangeWrapper: ExchangeWrapper;
+
+ let orderFactory: OrderFactory;
+ let orderFactory2: OrderFactory;
+ let invalidOrderFactory: OrderFactory;
+ let erc20Wrapper: ERC20Wrapper;
+ let erc20Balances: ERC20BalancesByOwner;
+ let erc20TakerBalanceThresholdWrapper: BalanceThresholdWrapper;
+ let erc721TakerBalanceThresholdWrapper: BalanceThresholdWrapper;
+ let erc721MakerBalanceThresholdWrapper: BalanceThresholdWrapper;
+ let erc721NonValidBalanceThresholdWrapper: BalanceThresholdWrapper;
+
+ let defaultOrderParams: Partial<Order>;
+ let validSignedOrder: SignedOrder;
+ let validSignedOrder2: SignedOrder;
+
+ let erc721BalanceThresholdFilterInstance: BalanceThresholdFilterContract;
+ let erc20BalanceThresholdFilterInstance: BalanceThresholdFilterContract;
+
+ const assertValidatedAddressesLog = async (
+ txReceipt: TransactionReceiptWithDecodedLogs,
+ expectedValidatedAddresses: string[],
+ ) => {
+ expect(txReceipt.logs.length).to.be.gte(1);
+ const validatedAddressesLog = (txReceipt.logs[0] as any) as ValidatedAddressesLog;
+ const validatedAddresses = validatedAddressesLog.args.addresses;
+ // @HACK-hysz: Nested addresses are not translated to lower-case but this will change once
+ // the new ABI Encoder/Decoder is used by the contract templates.
+ const validatedAddressesNormalized: string[] = [];
+ _.each(validatedAddresses, address => {
+ const normalizedAddress = _.toLower(address);
+ validatedAddressesNormalized.push(normalizedAddress);
+ });
+ expect(validatedAddressesNormalized).to.be.deep.equal(expectedValidatedAddresses);
+ };
+
+ before(async () => {
+ // Create accounts
+ await blockchainLifecycle.startAsync();
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const usedAddresses = ([
+ owner,
+ validMakerAddress,
+ validMakerAddress2,
+ validTakerAddress,
+ feeRecipientAddress,
+ invalidAddress,
+ ] = accounts);
+ const takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(validTakerAddress)];
+ const makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(validMakerAddress)];
+ const secondMakerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(validMakerAddress2)];
+ const invalidAddressPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(invalidAddress)];
+ // Create wrappers
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ const validAddresses = _.cloneDeepWith(usedAddresses);
+ _.remove(validAddresses, (address: string) => {
+ return address === invalidAddress;
+ });
+ const erc721Wrapper = new ERC721Wrapper(provider, validAddresses, owner);
+ // Deploy ERC20 tokens
+ const numDummyErc20ToDeploy = 4;
+ let erc20TokenA: DummyERC20TokenContract;
+ let erc20TokenB: DummyERC20TokenContract;
+ let erc20BalanceThresholdAsset: DummyERC20TokenContract;
+ [erc20TokenA, erc20TokenB, zrxToken, erc20BalanceThresholdAsset] = await erc20Wrapper.deployDummyTokensAsync(
+ numDummyErc20ToDeploy,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
+ defaultMakerAssetAddress = erc20TokenA.address;
+ defaultTakerAssetAddress = erc20TokenB.address;
+ zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+ // Create proxies
+ const erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+ // Deploy Exchange contract
+ exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
+ protocolArtifacts.Exchange,
+ provider,
+ txDefaults,
+ zrxAssetData,
+ );
+ exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider);
+ // Register proxies
+ await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
+ from: owner,
+ });
+ // Deploy Balance Threshold Filters
+ // One uses an ERC721 token as its balance threshold asset; the other uses an ERC20
+ const erc721alanceThreshold = new BigNumber(1);
+ await erc721Wrapper.deployProxyAsync();
+ const [erc721BalanceThresholdAsset] = await erc721Wrapper.deployDummyTokensAsync();
+ await erc721Wrapper.setBalancesAndAllowancesAsync();
+ erc721BalanceThresholdFilterInstance = await BalanceThresholdFilterContract.deployFrom0xArtifactAsync(
+ artifacts.BalanceThresholdFilter,
+ provider,
+ txDefaults,
+ exchangeInstance.address,
+ erc721BalanceThresholdAsset.address,
+ erc721alanceThreshold,
+ );
+ const erc20BalanceThreshold = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 10);
+ erc20BalanceThresholdFilterInstance = await BalanceThresholdFilterContract.deployFrom0xArtifactAsync(
+ artifacts.BalanceThresholdFilter,
+ provider,
+ txDefaults,
+ exchangeInstance.address,
+ erc20BalanceThresholdAsset.address,
+ erc20BalanceThreshold,
+ );
+ // Default order parameters
+ defaultOrderParams = {
+ exchangeAddress: exchangeInstance.address,
+ feeRecipientAddress,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
+ makerAssetAmount,
+ takerAssetAmount,
+ makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), DECIMALS_DEFAULT),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(150), DECIMALS_DEFAULT),
+ senderAddress: erc721BalanceThresholdFilterInstance.address,
+ };
+ // Create two order factories with valid makers (who meet the threshold balance), and
+ // one factory for an invalid address (that does not meet the threshold balance)
+ // Valid order factory #1
+ const defaultOrderParams1 = {
+ makerAddress: validMakerAddress,
+ ...defaultOrderParams,
+ };
+ orderFactory = new OrderFactory(makerPrivateKey, defaultOrderParams1);
+ // Valid order factory #2
+ const defaultOrderParams2 = {
+ makerAddress: validMakerAddress2,
+ ...defaultOrderParams,
+ };
+ orderFactory2 = new OrderFactory(secondMakerPrivateKey, defaultOrderParams2);
+ // Invalid order factory
+ const defaultNonValidOrderParams = {
+ makerAddress: invalidAddress,
+ ...defaultOrderParams,
+ };
+ invalidOrderFactory = new OrderFactory(invalidAddressPrivateKey, defaultNonValidOrderParams);
+ // Create Balance Thresold Wrappers
+ erc20TakerBalanceThresholdWrapper = new BalanceThresholdWrapper(
+ erc20BalanceThresholdFilterInstance,
+ exchangeInstance,
+ new TransactionFactory(takerPrivateKey, exchangeInstance.address),
+ provider,
+ );
+ erc721TakerBalanceThresholdWrapper = new BalanceThresholdWrapper(
+ erc721BalanceThresholdFilterInstance,
+ exchangeInstance,
+ new TransactionFactory(takerPrivateKey, exchangeInstance.address),
+ provider,
+ );
+ erc721MakerBalanceThresholdWrapper = new BalanceThresholdWrapper(
+ erc721BalanceThresholdFilterInstance,
+ exchangeInstance,
+ new TransactionFactory(makerPrivateKey, exchangeInstance.address),
+ provider,
+ );
+ erc721NonValidBalanceThresholdWrapper = new BalanceThresholdWrapper(
+ erc721BalanceThresholdFilterInstance,
+ exchangeInstance,
+ new TransactionFactory(invalidAddressPrivateKey, exchangeInstance.address),
+ provider,
+ );
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('General Sanity Checks', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ validSignedOrder2 = await orderFactory2.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both maker/taker when both maker and taker exceed the balance threshold of an ERC20 token', async () => {
+ const validSignedOrderERC20Sender = await orderFactory.newSignedOrderAsync({
+ ...defaultOrderParams,
+ makerAddress: validMakerAddress,
+ senderAddress: erc20TakerBalanceThresholdWrapper.getBalanceThresholdAddress(),
+ });
+ // Execute a valid fill
+ const txReceipt = await erc20TakerBalanceThresholdWrapper.fillOrderAsync(
+ validSignedOrderERC20Sender,
+ validTakerAddress,
+ { takerAssetFillAmount },
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [validSignedOrder.makerAddress, validTakerAddress];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerAssetFillAmount = takerAssetFillAmount
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const makerFeePaid = validSignedOrder.makerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
+ );
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ );
+ });
+ it('should revert if the Exchange transaction function is not supported', async () => {
+ // Create signed order without the fillOrder function selector
+ const salt = new BigNumber(0);
+ const badSelectorHex = '0x00000000';
+ const signatureHex = '0x';
+ // Call valid forwarder
+ return expectTransactionFailedAsync(
+ erc721BalanceThresholdFilterInstance.executeTransaction.sendTransactionAsync(
+ salt,
+ validTakerAddress,
+ badSelectorHex,
+ signatureHex,
+ ),
+ RevertReason.InvalidOrBlockedExchangeSelector,
+ );
+ });
+ it('should revert if senderAddress is not set to the valid forwarding contract', async () => {
+ // Create signed order with incorrect senderAddress
+ const notBalanceThresholdFilterAddress = zrxToken.address;
+ const signedOrderWithBadSenderAddress = await orderFactory.newSignedOrderAsync({
+ senderAddress: notBalanceThresholdFilterAddress,
+ });
+ // Call valid forwarder
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.fillOrderAsync(signedOrderWithBadSenderAddress, validTakerAddress, {
+ takerAssetFillAmount,
+ }),
+ RevertReason.FailedExecution,
+ );
+ });
+ });
+
+ describe('batchFillOrders', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ validSignedOrder2 = await orderFactory2.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both makers/taker when both maker and taker meet the balance threshold', async () => {
+ // Execute a valid fill
+ const orders = [validSignedOrder, validSignedOrder2];
+ const takerAssetFillAmounts = [takerAssetFillAmount, takerAssetFillAmount];
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.batchFillOrdersAsync(orders, validTakerAddress, {
+ takerAssetFillAmounts,
+ });
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [
+ validSignedOrder.makerAddress,
+ validSignedOrder2.makerAddress,
+ validTakerAddress,
+ ];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const cumulativeTakerAssetFillAmount = takerAssetFillAmount.times(2);
+ const makerAssetFillAmount = takerAssetFillAmount
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const makerFeePaid = validSignedOrder.makerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount)
+ .times(2);
+ // Maker #1
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
+ );
+ // Maker #2
+ expect(newBalances[validMakerAddress2][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid),
+ );
+ // Taker
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
+ );
+
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount.times(2)),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ // Fee recipient
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.times(2).add(takerFeePaid)),
+ );
+ });
+ it('should revert if one maker does not meet the balance threshold', async () => {
+ // Create order set with one non-valid maker address
+ const takerAssetFillAmounts = [takerAssetFillAmount, takerAssetFillAmount];
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ makerAddress: invalidAddress,
+ });
+ const orders = [validSignedOrder, signedOrderWithBadMakerAddress];
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.batchFillOrdersAsync(orders, validTakerAddress, {
+ takerAssetFillAmounts,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ const orders = [validSignedOrder, validSignedOrder2];
+ const takerAssetFillAmounts = [takerAssetFillAmount, takerAssetFillAmount];
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.batchFillOrdersAsync(orders, invalidAddress, {
+ takerAssetFillAmounts,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ });
+
+ describe('batchFillOrdersNoThrow', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ validSignedOrder2 = await orderFactory2.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both makers/taker when both maker and taker meet the balance threshold', async () => {
+ // Execute a valid fill
+ const orders = [validSignedOrder, validSignedOrder2];
+ const takerAssetFillAmounts = [takerAssetFillAmount, takerAssetFillAmount];
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.batchFillOrdersNoThrowAsync(
+ orders,
+ validTakerAddress,
+ {
+ takerAssetFillAmounts,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ },
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [
+ validSignedOrder.makerAddress,
+ validSignedOrder2.makerAddress,
+ validTakerAddress,
+ ];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const cumulativeTakerAssetFillAmount = takerAssetFillAmount.times(2);
+ const makerAssetFillAmount = takerAssetFillAmount
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const makerFeePaid = validSignedOrder.makerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount)
+ .times(2);
+ // Maker #1
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
+ );
+ // Maker #2
+ expect(newBalances[validMakerAddress2][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid),
+ );
+ // Taker
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
+ );
+
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount.times(2)),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ // Fee recipient
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.times(2).add(takerFeePaid)),
+ );
+ });
+ it('should revert if one maker does not meet the balance threshold', async () => {
+ // Create order set with one non-valid maker address
+ const takerAssetFillAmounts = [takerAssetFillAmount, takerAssetFillAmount];
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ makerAddress: invalidAddress,
+ });
+ const orders = [validSignedOrder, signedOrderWithBadMakerAddress];
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.batchFillOrdersNoThrowAsync(orders, validTakerAddress, {
+ takerAssetFillAmounts,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ const orders = [validSignedOrder, validSignedOrder2];
+ const takerAssetFillAmounts = [takerAssetFillAmount, takerAssetFillAmount];
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.batchFillOrdersNoThrowAsync(orders, invalidAddress, {
+ takerAssetFillAmounts,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ });
+
+ describe('batchFillOrKillOrders', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ validSignedOrder2 = await orderFactory2.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both makers/taker when both makers and taker meet the balance threshold', async () => {
+ // Execute a valid fill
+ const orders = [validSignedOrder, validSignedOrder2];
+ const takerAssetFillAmounts = [takerAssetFillAmount, takerAssetFillAmount];
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.batchFillOrKillOrdersAsync(
+ orders,
+ validTakerAddress,
+ { takerAssetFillAmounts },
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [
+ validSignedOrder.makerAddress,
+ validSignedOrder2.makerAddress,
+ validTakerAddress,
+ ];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const cumulativeTakerAssetFillAmount = takerAssetFillAmount.times(2);
+ const makerAssetFillAmount = takerAssetFillAmount
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const makerFeePaid = validSignedOrder.makerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount)
+ .times(2);
+ // Maker #1
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
+ );
+ // Maker #2
+ expect(newBalances[validMakerAddress2][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid),
+ );
+ // Taker
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
+ );
+
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount.times(2)),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ // Fee recipient
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.times(2).add(takerFeePaid)),
+ );
+ });
+ it('should revert if one maker does not meet the balance threshold', async () => {
+ // Create order set with one non-valid maker address
+ const takerAssetFillAmounts = [takerAssetFillAmount, takerAssetFillAmount];
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ makerAddress: invalidAddress,
+ });
+ const orders = [validSignedOrder, signedOrderWithBadMakerAddress];
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.batchFillOrKillOrdersAsync(orders, validTakerAddress, {
+ takerAssetFillAmounts,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ const orders = [validSignedOrder, validSignedOrder2];
+ const takerAssetFillAmounts = [takerAssetFillAmount, takerAssetFillAmount];
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.batchFillOrKillOrdersAsync(orders, invalidAddress, {
+ takerAssetFillAmounts,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if one takerAssetFillAmount is not fully filled', async () => {
+ const tooBigTakerAssetFillAmount = validSignedOrder.takerAssetAmount.times(2);
+ const orders = [validSignedOrder, validSignedOrder2];
+ const takerAssetFillAmounts = [takerAssetFillAmount, tooBigTakerAssetFillAmount];
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.batchFillOrKillOrdersAsync(orders, validTakerAddress, {
+ takerAssetFillAmounts,
+ }),
+ RevertReason.FailedExecution,
+ );
+ });
+ });
+
+ describe('fillOrder', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both maker/taker when both maker and taker meet the balance threshold', async () => {
+ // Execute a valid fill
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.fillOrderAsync(
+ validSignedOrder,
+ validTakerAddress,
+ { takerAssetFillAmount },
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [validSignedOrder.makerAddress, validTakerAddress];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerAssetFillAmount = takerAssetFillAmount
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const makerFeePaid = validSignedOrder.makerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
+ );
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ );
+ });
+ it('should revert if maker does not meet the balance threshold', async () => {
+ // Create signed order with non-valid maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ senderAddress: erc721BalanceThresholdFilterInstance.address,
+ makerAddress: invalidAddress,
+ });
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.fillOrderAsync(signedOrderWithBadMakerAddress, validTakerAddress, {
+ takerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.fillOrderAsync(validSignedOrder, invalidAddress, {
+ takerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ });
+
+ describe('fillOrderNoThrow', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both maker/taker when both maker and taker meet the balance threshold', async () => {
+ // Execute a valid fill
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.fillOrderNoThrowAsync(
+ validSignedOrder,
+ validTakerAddress,
+ {
+ takerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ },
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [validSignedOrder.makerAddress, validTakerAddress];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerAssetFillAmount = takerAssetFillAmount
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const makerFeePaid = validSignedOrder.makerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
+ );
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ );
+ });
+ it('should revert if maker does not meet the balance threshold', async () => {
+ // Create signed order with non-valid maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ senderAddress: erc721BalanceThresholdFilterInstance.address,
+ makerAddress: invalidAddress,
+ });
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.fillOrderNoThrowAsync(
+ signedOrderWithBadMakerAddress,
+ validTakerAddress,
+ { takerAssetFillAmount },
+ ),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.fillOrderNoThrowAsync(validSignedOrder, invalidAddress, {
+ takerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ });
+
+ describe('fillOrKillOrder', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both maker/taker when both maker and taker meet the balance threshold', async () => {
+ // Execute a valid fill
+ const takerAssetFillAmount_ = validSignedOrder.takerAssetAmount;
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.fillOrKillOrderAsync(
+ validSignedOrder,
+ validTakerAddress,
+ { takerAssetFillAmount: takerAssetFillAmount_ },
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [validSignedOrder.makerAddress, validTakerAddress];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerAssetFillAmount = takerAssetFillAmount_
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const makerFeePaid = validSignedOrder.makerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(validSignedOrder.makerAssetAmount);
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount_),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(makerFeePaid),
+ );
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount_),
+ );
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ );
+ });
+ it('should revert if maker does not meet the balance threshold', async () => {
+ // Create signed order with non-valid maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ senderAddress: erc721BalanceThresholdFilterInstance.address,
+ makerAddress: invalidAddress,
+ });
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.fillOrKillOrderAsync(
+ signedOrderWithBadMakerAddress,
+ validTakerAddress,
+ { takerAssetFillAmount },
+ ),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.fillOrKillOrderAsync(validSignedOrder, invalidAddress, {
+ takerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if takerAssetFillAmount is not fully filled', async () => {
+ const tooBigTakerAssetFillAmount = validSignedOrder.takerAssetAmount.times(2);
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.fillOrKillOrderAsync(validSignedOrder, validTakerAddress, {
+ takerAssetFillAmount: tooBigTakerAssetFillAmount,
+ }),
+ RevertReason.FailedExecution,
+ );
+ });
+ });
+
+ describe('marketSellOrders', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ validSignedOrder2 = await orderFactory2.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both makers/taker when both makers and taker meet the balance threshold', async () => {
+ // Execute a valid fill
+ const orders = [validSignedOrder, validSignedOrder2];
+ const cumulativeTakerAssetFillAmount = validSignedOrder.takerAssetAmount.plus(takerAssetFillAmount);
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.marketSellOrdersAsync(
+ orders,
+ validTakerAddress,
+ { takerAssetFillAmount: cumulativeTakerAssetFillAmount },
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [
+ validSignedOrder.makerAddress,
+ validSignedOrder2.makerAddress,
+ validTakerAddress,
+ ];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerAssetFillAmount2 = takerAssetFillAmount
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const makerFeePaid2 = validSignedOrder2.makerFee
+ .times(makerAssetFillAmount2)
+ .dividedToIntegerBy(validSignedOrder2.makerAssetAmount);
+ const takerFeePaid2 = validSignedOrder2.takerFee
+ .times(makerAssetFillAmount2)
+ .dividedToIntegerBy(validSignedOrder2.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee.plus(takerFeePaid2);
+ const cumulativeMakerAssetFillAmount = validSignedOrder.makerAssetAmount.plus(makerAssetFillAmount2);
+ // Maker #1
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(validSignedOrder.makerAssetAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(validSignedOrder.takerAssetAmount),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(validSignedOrder.makerFee),
+ );
+ // Maker #2
+ expect(newBalances[validMakerAddress2][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount2),
+ );
+ expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid2),
+ );
+ // Taker
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(cumulativeMakerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ // Fee recipient
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address]
+ .add(validSignedOrder.makerFee)
+ .add(makerFeePaid2)
+ .add(takerFeePaid),
+ );
+ });
+ it('should revert if one maker does not meet the balance threshold', async () => {
+ // Create order set with one non-valid maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ makerAddress: invalidAddress,
+ });
+ const orders = [validSignedOrder, signedOrderWithBadMakerAddress];
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.marketSellOrdersAsync(orders, validTakerAddress, {
+ takerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ const orders = [validSignedOrder, validSignedOrder2];
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.marketSellOrdersAsync(orders, invalidAddress, {
+ takerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ });
+
+ describe('marketSellOrdersNoThrow', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ validSignedOrder2 = await orderFactory2.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both makers/taker when both makers and taker meet the balance threshold', async () => {
+ // Execute a valid fill
+ const orders = [validSignedOrder, validSignedOrder2];
+ const cumulativeTakerAssetFillAmount = validSignedOrder.takerAssetAmount.plus(takerAssetFillAmount);
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.marketSellOrdersNoThrowAsync(
+ orders,
+ validTakerAddress,
+ {
+ takerAssetFillAmount: cumulativeTakerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ },
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [
+ validSignedOrder.makerAddress,
+ validSignedOrder2.makerAddress,
+ validTakerAddress,
+ ];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerAssetFillAmount2 = takerAssetFillAmount
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const makerFeePaid2 = validSignedOrder2.makerFee
+ .times(makerAssetFillAmount2)
+ .dividedToIntegerBy(validSignedOrder2.makerAssetAmount);
+ const takerFeePaid2 = validSignedOrder2.takerFee
+ .times(makerAssetFillAmount2)
+ .dividedToIntegerBy(validSignedOrder2.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee.plus(takerFeePaid2);
+ const cumulativeMakerAssetFillAmount = validSignedOrder.makerAssetAmount.plus(makerAssetFillAmount2);
+ // Maker #1
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(validSignedOrder.makerAssetAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(validSignedOrder.takerAssetAmount),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(validSignedOrder.makerFee),
+ );
+ // Maker #2
+ expect(newBalances[validMakerAddress2][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount2),
+ );
+ expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid2),
+ );
+ // Taker
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(cumulativeMakerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ // Fee recipient
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address]
+ .add(validSignedOrder.makerFee)
+ .add(makerFeePaid2)
+ .add(takerFeePaid),
+ );
+ });
+ it('should revert if one maker does not meet the balance threshold', async () => {
+ // Create order set with one non-valid maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ makerAddress: invalidAddress,
+ });
+ const orders = [validSignedOrder, signedOrderWithBadMakerAddress];
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.marketSellOrdersNoThrowAsync(orders, validTakerAddress, {
+ takerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ const orders = [validSignedOrder, validSignedOrder2];
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.marketSellOrdersNoThrowAsync(orders, invalidAddress, {
+ takerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ });
+
+ describe('marketBuyOrders', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ validSignedOrder2 = await orderFactory2.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both makers/taker when both makers and taker meet the balance threshold', async () => {
+ // Execute a valid fill
+ const orders = [validSignedOrder, validSignedOrder2];
+ const cumulativeTakerAssetFillAmount = validSignedOrder.takerAssetAmount.plus(takerAssetFillAmount);
+ const makerAssetFillAmount2 = takerAssetFillAmount
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const cumulativeMakerAssetFillAmount = validSignedOrder.makerAssetAmount.plus(makerAssetFillAmount2);
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.marketBuyOrdersAsync(orders, validTakerAddress, {
+ makerAssetFillAmount: cumulativeMakerAssetFillAmount,
+ });
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [
+ validSignedOrder.makerAddress,
+ validSignedOrder2.makerAddress,
+ validTakerAddress,
+ ];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerFeePaid2 = validSignedOrder2.makerFee
+ .times(makerAssetFillAmount2)
+ .dividedToIntegerBy(validSignedOrder2.makerAssetAmount);
+ const takerFeePaid2 = validSignedOrder2.takerFee
+ .times(makerAssetFillAmount2)
+ .dividedToIntegerBy(validSignedOrder2.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee.plus(takerFeePaid2);
+ // Maker #1
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(validSignedOrder.makerAssetAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(validSignedOrder.takerAssetAmount),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(validSignedOrder.makerFee),
+ );
+ // Maker #2
+ expect(newBalances[validMakerAddress2][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount2),
+ );
+ expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid2),
+ );
+ // Taker
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(cumulativeMakerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ // Fee recipient
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address]
+ .add(validSignedOrder.makerFee)
+ .add(makerFeePaid2)
+ .add(takerFeePaid),
+ );
+ });
+ it('should revert if one maker does not meet the balance threshold', async () => {
+ // Create order set with one non-valid maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ makerAddress: invalidAddress,
+ });
+ const orders = [validSignedOrder, signedOrderWithBadMakerAddress];
+ // Execute transaction
+ const dummyMakerAssetFillAmount = new BigNumber(0);
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.marketBuyOrdersAsync(orders, validTakerAddress, {
+ makerAssetFillAmount: dummyMakerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ const orders = [validSignedOrder, validSignedOrder2];
+ const dummyMakerAssetFillAmount = new BigNumber(0);
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.marketBuyOrdersAsync(orders, invalidAddress, {
+ makerAssetFillAmount: dummyMakerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ });
+
+ describe('marketBuyOrdersNoThrowAsync', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ validSignedOrder2 = await orderFactory2.newSignedOrderAsync();
+ });
+ it('should transfer the correct amounts and validate both makers/taker when both makers and taker meet the balance threshold', async () => {
+ // Execute a valid fill
+ const orders = [validSignedOrder, validSignedOrder2];
+ const cumulativeTakerAssetFillAmount = validSignedOrder.takerAssetAmount.plus(takerAssetFillAmount);
+ const makerAssetFillAmount2 = takerAssetFillAmount
+ .times(validSignedOrder.makerAssetAmount)
+ .dividedToIntegerBy(validSignedOrder.takerAssetAmount);
+ const cumulativeMakerAssetFillAmount = validSignedOrder.makerAssetAmount.plus(makerAssetFillAmount2);
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.marketBuyOrdersNoThrowAsync(
+ orders,
+ validTakerAddress,
+ {
+ makerAssetFillAmount: cumulativeMakerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ },
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [
+ validSignedOrder.makerAddress,
+ validSignedOrder2.makerAddress,
+ validTakerAddress,
+ ];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerFeePaid2 = validSignedOrder2.makerFee
+ .times(makerAssetFillAmount2)
+ .dividedToIntegerBy(validSignedOrder2.makerAssetAmount);
+ const takerFeePaid2 = validSignedOrder2.takerFee
+ .times(makerAssetFillAmount2)
+ .dividedToIntegerBy(validSignedOrder2.makerAssetAmount);
+ const takerFeePaid = validSignedOrder.takerFee.plus(takerFeePaid2);
+ // Maker #1
+ expect(newBalances[validMakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultMakerAssetAddress].minus(validSignedOrder.makerAssetAmount),
+ );
+ expect(newBalances[validMakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][defaultTakerAssetAddress].add(validSignedOrder.takerAssetAmount),
+ );
+ expect(newBalances[validMakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress][zrxToken.address].minus(validSignedOrder.makerFee),
+ );
+ // Maker #2
+ expect(newBalances[validMakerAddress2][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultMakerAssetAddress].minus(makerAssetFillAmount2),
+ );
+ expect(newBalances[validMakerAddress2][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[validMakerAddress2][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validMakerAddress2][zrxToken.address].minus(makerFeePaid2),
+ );
+ // Taker
+ expect(newBalances[validTakerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultTakerAssetAddress].minus(cumulativeTakerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(cumulativeMakerAssetFillAmount),
+ );
+ expect(newBalances[validTakerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ // Fee recipient
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address]
+ .add(validSignedOrder.makerFee)
+ .add(makerFeePaid2)
+ .add(takerFeePaid),
+ );
+ });
+ it('should revert if one maker does not meet the balance threshold', async () => {
+ // Create order set with one non-valid maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ makerAddress: invalidAddress,
+ });
+ const orders = [validSignedOrder, signedOrderWithBadMakerAddress];
+ // Execute transaction
+ const dummyMakerAssetFillAmount = new BigNumber(0);
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.marketBuyOrdersNoThrowAsync(orders, validTakerAddress, {
+ makerAssetFillAmount: dummyMakerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ const orders = [validSignedOrder, validSignedOrder2];
+ const dummyMakerAssetFillAmount = new BigNumber(0);
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.marketBuyOrdersNoThrowAsync(orders, invalidAddress, {
+ makerAssetFillAmount: dummyMakerAssetFillAmount,
+ }),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ });
+
+ describe('matchOrders', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ validSignedOrder2 = await orderFactory2.newSignedOrderAsync();
+ });
+ it('Should transfer correct amounts when both makers and taker meet the balance threshold', async () => {
+ // Test values/results taken from Match Orders test:
+ // 'Should transfer correct amounts when right order is fully filled and values pass isRoundingErrorFloor but fail isRoundingErrorCeil'
+ // Create orders to match
+ const signedOrderLeft = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(17), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(98), 0),
+ makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
+ feeRecipientAddress,
+ });
+ const signedOrderRight = await orderFactory2.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(75), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
+ makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
+ feeRecipientAddress,
+ });
+ // Compute expected transfer amounts
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(75), 0),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('76.4705882352941176'), 16), // 76.47%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(75), 0),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 0),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber('76.5306122448979591'), 16), // 76.53%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ const txReceipt = await erc721TakerBalanceThresholdWrapper.matchOrdersAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ validTakerAddress,
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses = [
+ signedOrderLeft.makerAddress,
+ signedOrderRight.makerAddress,
+ validTakerAddress,
+ ];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check balances
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(
+ newBalances[signedOrderLeft.makerAddress][defaultMakerAssetAddress],
+ 'Checking left maker egress ERC20 account balance',
+ ).to.be.bignumber.equal(
+ erc20Balances[signedOrderLeft.makerAddress][defaultMakerAssetAddress].sub(
+ expectedTransferAmounts.amountSoldByLeftMaker,
+ ),
+ );
+ expect(
+ newBalances[signedOrderRight.makerAddress][defaultTakerAssetAddress],
+ 'Checking right maker ingress ERC20 account balance',
+ ).to.be.bignumber.equal(
+ erc20Balances[signedOrderRight.makerAddress][defaultTakerAssetAddress].sub(
+ expectedTransferAmounts.amountSoldByRightMaker,
+ ),
+ );
+ expect(
+ newBalances[validTakerAddress][defaultMakerAssetAddress],
+ 'Checking taker ingress ERC20 account balance',
+ ).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][defaultMakerAssetAddress].add(
+ expectedTransferAmounts.amountReceivedByTaker,
+ ),
+ );
+ expect(
+ newBalances[signedOrderLeft.makerAddress][defaultTakerAssetAddress],
+ 'Checking left maker ingress ERC20 account balance',
+ ).to.be.bignumber.equal(
+ erc20Balances[signedOrderLeft.makerAddress][defaultTakerAssetAddress].add(
+ expectedTransferAmounts.amountBoughtByLeftMaker,
+ ),
+ );
+ expect(
+ newBalances[signedOrderRight.makerAddress][defaultMakerAssetAddress],
+ 'Checking right maker egress ERC20 account balance',
+ ).to.be.bignumber.equal(
+ erc20Balances[signedOrderRight.makerAddress][defaultMakerAssetAddress].add(
+ expectedTransferAmounts.amountBoughtByRightMaker,
+ ),
+ );
+ // Paid fees
+ expect(
+ newBalances[signedOrderLeft.makerAddress][zrxToken.address],
+ 'Checking left maker egress ERC20 account fees',
+ ).to.be.bignumber.equal(
+ erc20Balances[signedOrderLeft.makerAddress][zrxToken.address].minus(
+ expectedTransferAmounts.feePaidByLeftMaker,
+ ),
+ );
+ expect(
+ newBalances[signedOrderRight.makerAddress][zrxToken.address],
+ 'Checking right maker egress ERC20 account fees',
+ ).to.be.bignumber.equal(
+ erc20Balances[signedOrderRight.makerAddress][zrxToken.address].minus(
+ expectedTransferAmounts.feePaidByRightMaker,
+ ),
+ );
+ expect(
+ newBalances[validTakerAddress][zrxToken.address],
+ 'Checking taker egress ERC20 account fees',
+ ).to.be.bignumber.equal(
+ erc20Balances[validTakerAddress][zrxToken.address]
+ .minus(expectedTransferAmounts.feePaidByTakerLeft)
+ .sub(expectedTransferAmounts.feePaidByTakerRight),
+ );
+ // Received fees
+ expect(
+ newBalances[signedOrderLeft.feeRecipientAddress][zrxToken.address],
+ 'Checking left fee recipient ingress ERC20 account fees',
+ ).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address]
+ .add(expectedTransferAmounts.feePaidByLeftMaker)
+ .add(expectedTransferAmounts.feePaidByRightMaker)
+ .add(expectedTransferAmounts.feePaidByTakerLeft)
+ .add(expectedTransferAmounts.feePaidByTakerRight),
+ );
+ });
+ it('should revert if left maker does not meet the balance threshold', async () => {
+ // Create signed order with non-valid maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ senderAddress: erc721BalanceThresholdFilterInstance.address,
+ makerAddress: invalidAddress,
+ });
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.matchOrdersAsync(
+ validSignedOrder,
+ signedOrderWithBadMakerAddress,
+ validTakerAddress,
+ ),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if right maker does not meet the balance threshold', async () => {
+ // Create signed order with non-valid maker address
+ const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
+ senderAddress: erc721BalanceThresholdFilterInstance.address,
+ makerAddress: invalidAddress,
+ });
+ // Execute transaction
+ return expectTransactionFailedAsync(
+ erc721TakerBalanceThresholdWrapper.matchOrdersAsync(
+ signedOrderWithBadMakerAddress,
+ validSignedOrder,
+ validTakerAddress,
+ ),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ it('should revert if taker does not meet the balance threshold', async () => {
+ return expectTransactionFailedAsync(
+ erc721NonValidBalanceThresholdWrapper.matchOrdersAsync(
+ validSignedOrder,
+ validSignedOrder,
+ invalidAddress,
+ ),
+ RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold,
+ );
+ });
+ });
+
+ describe('cancelOrder', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ validSignedOrder = await orderFactory.newSignedOrderAsync();
+ validSignedOrder2 = await orderFactory2.newSignedOrderAsync();
+ });
+ it('Should successfully cancel order if maker meets balance threshold', async () => {
+ // Verify order is not cancelled
+ const orderInfoBeforeCancelling = await erc721MakerBalanceThresholdWrapper.getOrderInfoAsync(
+ validSignedOrder,
+ );
+ expect(orderInfoBeforeCancelling.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ // Cancel
+ const txReceipt = await erc721MakerBalanceThresholdWrapper.cancelOrderAsync(
+ validSignedOrder,
+ validSignedOrder.makerAddress,
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses: string[] = [];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check that order was cancelled
+ const orderInfoAfterCancelling = await erc721MakerBalanceThresholdWrapper.getOrderInfoAsync(
+ validSignedOrder,
+ );
+ expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.CANCELLED);
+ });
+ it('Should successfully cancel order if maker does not meet balance threshold', async () => {
+ // Create order where maker does not meet balance threshold
+ const signedOrderWithBadMakerAddress = await invalidOrderFactory.newSignedOrderAsync({});
+ // Verify order is not cancelled
+ const orderInfoBeforeCancelling = await erc721NonValidBalanceThresholdWrapper.getOrderInfoAsync(
+ signedOrderWithBadMakerAddress,
+ );
+ expect(orderInfoBeforeCancelling.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ // Cancel
+ const txReceipt = await erc721NonValidBalanceThresholdWrapper.cancelOrderAsync(
+ signedOrderWithBadMakerAddress,
+ signedOrderWithBadMakerAddress.makerAddress,
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses: string[] = [];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check that order was cancelled
+ const orderInfoAfterCancelling = await erc721MakerBalanceThresholdWrapper.getOrderInfoAsync(
+ signedOrderWithBadMakerAddress,
+ );
+ expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.CANCELLED);
+ });
+ });
+
+ describe('batchCancelOrders', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ });
+ it('Should successfully batch cancel orders if maker meets balance threshold', async () => {
+ // Create orders to cancel
+ const validSignedOrders = [
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync(),
+ ];
+ // Verify orders are not cancelled
+ _.each(validSignedOrders, async signedOrder => {
+ const orderInfoBeforeCancelling = await erc721MakerBalanceThresholdWrapper.getOrderInfoAsync(
+ signedOrder,
+ );
+ return expect(orderInfoBeforeCancelling.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ });
+ // Cancel
+ const txReceipt = await erc721MakerBalanceThresholdWrapper.batchCancelOrdersAsync(
+ validSignedOrders,
+ validSignedOrders[0].makerAddress,
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses: string[] = [];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check that order was cancelled
+ _.each(validSignedOrders, async signedOrder => {
+ const orderInfoAfterCancelling = await erc721MakerBalanceThresholdWrapper.getOrderInfoAsync(
+ signedOrder,
+ );
+ return expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.CANCELLED);
+ });
+ });
+ it('Should successfully batch cancel order if maker does not meet balance threshold', async () => {
+ // Create orders to cancel
+ const invalidSignedOrders = [
+ await invalidOrderFactory.newSignedOrderAsync(),
+ await invalidOrderFactory.newSignedOrderAsync(),
+ await invalidOrderFactory.newSignedOrderAsync(),
+ ];
+ // Verify orders are not cancelled
+ _.each(invalidSignedOrders, async signedOrder => {
+ const orderInfoBeforeCancelling = await erc721NonValidBalanceThresholdWrapper.getOrderInfoAsync(
+ signedOrder,
+ );
+ return expect(orderInfoBeforeCancelling.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ });
+ // Cancel
+ const txReceipt = await erc721NonValidBalanceThresholdWrapper.batchCancelOrdersAsync(
+ invalidSignedOrders,
+ invalidAddress,
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses: string[] = [];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check that order was cancelled
+ _.each(invalidSignedOrders, async signedOrder => {
+ const orderInfoAfterCancelling = await erc721NonValidBalanceThresholdWrapper.getOrderInfoAsync(
+ signedOrder,
+ );
+ return expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.CANCELLED);
+ });
+ });
+ });
+
+ describe('cancelOrdersUpTo', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ });
+ it('Should successfully batch cancel orders if maker meets balance threshold', async () => {
+ // Create orders to cancel
+ const validSignedOrders = [
+ await orderFactory.newSignedOrderAsync({ salt: new BigNumber(0) }),
+ await orderFactory.newSignedOrderAsync({ salt: new BigNumber(1) }),
+ await orderFactory.newSignedOrderAsync({ salt: new BigNumber(2) }),
+ ];
+ // Verify orders are not cancelled
+ _.each(validSignedOrders, async signedOrder => {
+ const orderInfoBeforeCancelling = await erc721MakerBalanceThresholdWrapper.getOrderInfoAsync(
+ signedOrder,
+ );
+ return expect(orderInfoBeforeCancelling.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ });
+ // Cancel
+ const cancelOrdersUpToThisSalt = new BigNumber(1);
+ const txReceipt = await erc721MakerBalanceThresholdWrapper.cancelOrdersUpToAsync(
+ cancelOrdersUpToThisSalt,
+ validSignedOrders[0].makerAddress,
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses: string[] = [];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check that order was cancelled
+ _.each(validSignedOrders, async (signedOrder, salt: number) => {
+ const orderInfoAfterCancelling = await erc721MakerBalanceThresholdWrapper.getOrderInfoAsync(
+ signedOrder,
+ );
+ const saltAsBigNumber = new BigNumber(salt);
+ if (saltAsBigNumber.lessThanOrEqualTo(cancelOrdersUpToThisSalt)) {
+ return expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.CANCELLED);
+ } else {
+ return expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ }
+ });
+ });
+ it('Should successfully batch cancel order if maker does not meet balance threshold', async () => {
+ // Create orders to cancel
+ const invalidSignedOrders = [
+ await invalidOrderFactory.newSignedOrderAsync({ salt: new BigNumber(0) }),
+ await invalidOrderFactory.newSignedOrderAsync({ salt: new BigNumber(1) }),
+ await invalidOrderFactory.newSignedOrderAsync({ salt: new BigNumber(2) }),
+ ];
+ // Verify orders are not cancelled
+ _.each(invalidSignedOrders, async signedOrder => {
+ const orderInfoBeforeCancelling = await erc721NonValidBalanceThresholdWrapper.getOrderInfoAsync(
+ signedOrder,
+ );
+ return expect(orderInfoBeforeCancelling.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ });
+ // Cancel
+ const cancelOrdersUpToThisSalt = new BigNumber(1);
+ const txReceipt = await erc721NonValidBalanceThresholdWrapper.cancelOrdersUpToAsync(
+ cancelOrdersUpToThisSalt,
+ invalidAddress,
+ );
+ // Assert validated addresses
+ const expectedValidatedAddresseses: string[] = [];
+ await assertValidatedAddressesLog(txReceipt, expectedValidatedAddresseses);
+ // Check that order was cancelled
+ _.each(invalidSignedOrders, async (signedOrder, salt: number) => {
+ const orderInfoAfterCancelling = await erc721NonValidBalanceThresholdWrapper.getOrderInfoAsync(
+ signedOrder,
+ );
+ const saltAsBigNumber = new BigNumber(salt);
+ if (saltAsBigNumber.lessThanOrEqualTo(cancelOrdersUpToThisSalt)) {
+ return expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.CANCELLED);
+ } else {
+ return expect(orderInfoAfterCancelling.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ }
+ });
+ });
+ });
+});
+// tslint:disable:max-file-line-count
+// tslint:enable:no-unnecessary-type-assertion
diff --git a/contracts/extensions/test/extensions/dutch_auction.ts b/contracts/extensions/test/extensions/dutch_auction.ts
new file mode 100644
index 000000000..22b3caa16
--- /dev/null
+++ b/contracts/extensions/test/extensions/dutch_auction.ts
@@ -0,0 +1,378 @@
+import { DutchAuctionWrapper } from '@0x/contract-wrappers';
+import {
+ artifacts as protocolArtifacts,
+ ERC20Wrapper,
+ ERC721Wrapper,
+ ExchangeContract,
+ ExchangeWrapper,
+} from '@0x/contracts-protocol';
+import {
+ chaiSetup,
+ constants,
+ ContractName,
+ ERC20BalancesByOwner,
+ expectTransactionFailedAsync,
+ getLatestBlockTimestampAsync,
+ OrderFactory,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ DummyERC721TokenContract,
+ WETH9Contract,
+} from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
+import { RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
+import { artifacts } from '../../src/artifacts';
+import { DutchAuctionTestWrapper } from '../utils/dutch_auction_test_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+const DECIMALS_DEFAULT = 18;
+
+describe(ContractName.DutchAuction, () => {
+ let makerAddress: string;
+ let owner: string;
+ let takerAddress: string;
+ let feeRecipientAddress: string;
+ let defaultMakerAssetAddress: string;
+
+ let zrxToken: DummyERC20TokenContract;
+ let erc20TokenA: DummyERC20TokenContract;
+ let erc721Token: DummyERC721TokenContract;
+ let dutchAuctionContract: DutchAuctionContract;
+ let wethContract: WETH9Contract;
+
+ let sellerOrderFactory: OrderFactory;
+ let buyerOrderFactory: OrderFactory;
+ let erc20Wrapper: ERC20Wrapper;
+ let erc20Balances: ERC20BalancesByOwner;
+ let currentBlockTimestamp: number;
+ let auctionBeginTimeSeconds: BigNumber;
+ let auctionEndTimeSeconds: BigNumber;
+ let auctionBeginAmount: BigNumber;
+ let auctionEndAmount: BigNumber;
+ let sellOrder: SignedOrder;
+ let buyOrder: SignedOrder;
+ let erc721MakerAssetIds: BigNumber[];
+ const tenMinutesInSeconds = 10 * 60;
+
+ let dutchAuctionTestWrapper: DutchAuctionTestWrapper;
+ let defaultERC20MakerAssetData: string;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts);
+
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+
+ const numDummyErc20ToDeploy = 2;
+ [erc20TokenA, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
+ numDummyErc20ToDeploy,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
+ const erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+
+ const erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
+ [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
+ const erc721Proxy = await erc721Wrapper.deployProxyAsync();
+ await erc721Wrapper.setBalancesAndAllowancesAsync();
+ const erc721Balances = await erc721Wrapper.getBalancesAsync();
+ erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
+
+ wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokensArtifacts.WETH9, provider, txDefaults);
+ erc20Wrapper.addDummyTokenContract(wethContract as any);
+
+ const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+ const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
+ protocolArtifacts.Exchange,
+ provider,
+ txDefaults,
+ zrxAssetData,
+ );
+ const exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider);
+ await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
+ await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
+
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
+ from: owner,
+ });
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
+ from: owner,
+ });
+
+ const dutchAuctionInstance = await DutchAuctionContract.deployFrom0xArtifactAsync(
+ artifacts.DutchAuction,
+ provider,
+ txDefaults,
+ exchangeInstance.address,
+ );
+ dutchAuctionContract = new DutchAuctionContract(
+ dutchAuctionInstance.abi,
+ dutchAuctionInstance.address,
+ provider,
+ );
+ dutchAuctionTestWrapper = new DutchAuctionTestWrapper(dutchAuctionInstance, provider);
+
+ defaultMakerAssetAddress = erc20TokenA.address;
+ const defaultTakerAssetAddress = wethContract.address;
+
+ // Set up taker WETH balance and allowance
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await wethContract.deposit.sendTransactionAsync({
+ from: takerAddress,
+ value: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), DECIMALS_DEFAULT),
+ }),
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await wethContract.approve.sendTransactionAsync(
+ erc20Proxy.address,
+ constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
+ { from: takerAddress },
+ ),
+ );
+ web3Wrapper.abiDecoder.addABI(exchangeInstance.abi);
+ web3Wrapper.abiDecoder.addABI(zrxToken.abi);
+ erc20Wrapper.addTokenOwnerAddress(dutchAuctionContract.address);
+
+ currentBlockTimestamp = await getLatestBlockTimestampAsync();
+ // Default auction begins 10 minutes ago
+ auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp).minus(tenMinutesInSeconds);
+ // Default auction ends 10 from now
+ auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp).plus(tenMinutesInSeconds);
+ auctionBeginAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(10), DECIMALS_DEFAULT);
+ auctionEndAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT);
+
+ // Default sell order and buy order are exact mirrors
+ const sellerDefaultOrderParams = {
+ salt: generatePseudoRandomSalt(),
+ exchangeAddress: exchangeInstance.address,
+ makerAddress,
+ feeRecipientAddress,
+ // taker address or sender address should be set to the ducth auction contract
+ takerAddress: dutchAuctionContract.address,
+ makerAssetData: DutchAuctionWrapper.encodeDutchAuctionAssetData(
+ assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
+ auctionBeginTimeSeconds,
+ auctionBeginAmount,
+ ),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), DECIMALS_DEFAULT),
+ takerAssetAmount: auctionEndAmount,
+ expirationTimeSeconds: auctionEndTimeSeconds,
+ makerFee: constants.ZERO_AMOUNT,
+ takerFee: constants.ZERO_AMOUNT,
+ };
+ // Default buy order is for the auction begin price
+ const buyerDefaultOrderParams = {
+ ...sellerDefaultOrderParams,
+ makerAddress: takerAddress,
+ makerAssetData: sellerDefaultOrderParams.takerAssetData,
+ takerAssetData: sellerDefaultOrderParams.makerAssetData,
+ makerAssetAmount: auctionBeginAmount,
+ takerAssetAmount: sellerDefaultOrderParams.makerAssetAmount,
+ };
+ const makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
+ const takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
+ sellerOrderFactory = new OrderFactory(makerPrivateKey, sellerDefaultOrderParams);
+ buyerOrderFactory = new OrderFactory(takerPrivateKey, buyerDefaultOrderParams);
+ defaultERC20MakerAssetData = assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress);
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ sellOrder = await sellerOrderFactory.newSignedOrderAsync();
+ buyOrder = await buyerOrderFactory.newSignedOrderAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('matchOrders', () => {
+ it('should be worth the begin price at the begining of the auction', async () => {
+ auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2);
+ const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
+ defaultERC20MakerAssetData,
+ auctionBeginTimeSeconds,
+ auctionBeginAmount,
+ );
+ sellOrder = await sellerOrderFactory.newSignedOrderAsync({ makerAssetData });
+ const auctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
+ expect(auctionDetails.currentTimeSeconds).to.be.bignumber.lte(auctionBeginTimeSeconds);
+ expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionBeginAmount);
+ expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount);
+ });
+ it('should be be worth the end price at the end of the auction', async () => {
+ auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
+ auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
+ const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
+ defaultERC20MakerAssetData,
+ auctionBeginTimeSeconds,
+ auctionBeginAmount,
+ );
+ sellOrder = await sellerOrderFactory.newSignedOrderAsync({
+ makerAssetData,
+ expirationTimeSeconds: auctionEndTimeSeconds,
+ });
+ const auctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
+ expect(auctionDetails.currentTimeSeconds).to.be.bignumber.gte(auctionEndTimeSeconds);
+ expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionEndAmount);
+ expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount);
+ });
+ it('should match orders at current amount and send excess to buyer', async () => {
+ const beforeAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
+ buyOrder = await buyerOrderFactory.newSignedOrderAsync({
+ makerAssetAmount: beforeAuctionDetails.currentAmount.times(2),
+ });
+ await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
+ const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances[dutchAuctionContract.address][wethContract.address]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ // HACK gte used here due to a bug in ganache where the timestamp can change
+ // between multiple calls to the same block. Which can move the amount in our case
+ // ref: https://github.com/trufflesuite/ganache-core/issues/111
+ expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
+ erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
+ );
+ expect(newBalances[takerAddress][wethContract.address]).to.be.bignumber.gte(
+ erc20Balances[takerAddress][wethContract.address].minus(beforeAuctionDetails.currentAmount),
+ );
+ });
+ it('maker fees on sellOrder are paid to the fee receipient', async () => {
+ sellOrder = await sellerOrderFactory.newSignedOrderAsync({
+ makerFee: new BigNumber(1),
+ });
+ await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
+ const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
+ erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(sellOrder.makerFee),
+ );
+ });
+ it('maker fees on buyOrder are paid to the fee receipient', async () => {
+ buyOrder = await buyerOrderFactory.newSignedOrderAsync({
+ makerFee: new BigNumber(1),
+ });
+ await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
+ expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
+ erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].plus(buyOrder.makerFee),
+ );
+ });
+ it('should revert when auction expires', async () => {
+ auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
+ auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
+ const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
+ defaultERC20MakerAssetData,
+ auctionBeginTimeSeconds,
+ auctionBeginAmount,
+ );
+ sellOrder = await sellerOrderFactory.newSignedOrderAsync({
+ expirationTimeSeconds: auctionEndTimeSeconds,
+ makerAssetData,
+ });
+ return expectTransactionFailedAsync(
+ dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
+ RevertReason.AuctionExpired,
+ );
+ });
+ it('cannot be filled for less than the current price', async () => {
+ buyOrder = await buyerOrderFactory.newSignedOrderAsync({
+ makerAssetAmount: sellOrder.takerAssetAmount,
+ });
+ return expectTransactionFailedAsync(
+ dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
+ RevertReason.AuctionInvalidAmount,
+ );
+ });
+ it('auction begin amount must be higher than final amount ', async () => {
+ sellOrder = await sellerOrderFactory.newSignedOrderAsync({
+ takerAssetAmount: auctionBeginAmount.plus(1),
+ });
+ return expectTransactionFailedAsync(
+ dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
+ RevertReason.AuctionInvalidAmount,
+ );
+ });
+ it('begin time is less than end time', async () => {
+ auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds);
+ const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
+ defaultERC20MakerAssetData,
+ auctionBeginTimeSeconds,
+ auctionBeginAmount,
+ );
+ sellOrder = await sellerOrderFactory.newSignedOrderAsync({
+ expirationTimeSeconds: auctionEndTimeSeconds,
+ makerAssetData,
+ });
+ return expectTransactionFailedAsync(
+ dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
+ RevertReason.AuctionInvalidBeginTime,
+ );
+ });
+ it('asset data contains auction parameters', async () => {
+ sellOrder = await sellerOrderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
+ });
+ return expectTransactionFailedAsync(
+ dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
+ RevertReason.InvalidAssetData,
+ );
+ });
+
+ describe('ERC721', () => {
+ it('should match orders when ERC721', async () => {
+ const makerAssetId = erc721MakerAssetIds[0];
+ const erc721MakerAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId);
+ const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
+ erc721MakerAssetData,
+ auctionBeginTimeSeconds,
+ auctionBeginAmount,
+ );
+ sellOrder = await sellerOrderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ makerAssetData,
+ });
+ buyOrder = await buyerOrderFactory.newSignedOrderAsync({
+ takerAssetAmount: new BigNumber(1),
+ takerAssetData: sellOrder.makerAssetData,
+ });
+ await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
+ const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ // HACK gte used here due to a bug in ganache where the timestamp can change
+ // between multiple calls to the same block. Which can move the amount in our case
+ // ref: https://github.com/trufflesuite/ganache-core/issues/111
+ expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
+ erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
+ );
+ const newOwner = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(newOwner).to.be.bignumber.equal(takerAddress);
+ });
+ });
+ });
+});
diff --git a/contracts/extensions/test/extensions/forwarder.ts b/contracts/extensions/test/extensions/forwarder.ts
new file mode 100644
index 000000000..69939ed04
--- /dev/null
+++ b/contracts/extensions/test/extensions/forwarder.ts
@@ -0,0 +1,1291 @@
+import {
+ artifacts as protocolArtifacts,
+ ERC20Wrapper,
+ ERC721Wrapper,
+ ExchangeContract,
+ ExchangeWrapper,
+} from '@0x/contracts-protocol';
+import {
+ chaiSetup,
+ constants,
+ ContractName,
+ ERC20BalancesByOwner,
+ expectContractCreationFailedAsync,
+ expectTransactionFailedAsync,
+ OrderFactory,
+ provider,
+ sendTransactionResult,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokenArtifacts,
+ DummyERC20TokenContract,
+ DummyERC721TokenContract,
+ WETH9Contract,
+} from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+
+import { ForwarderContract } from '../../generated-wrappers/forwarder';
+import { artifacts } from '../../src/artifacts';
+
+import { ForwarderWrapper } from '../utils/forwarder_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+const DECIMALS_DEFAULT = 18;
+const MAX_WETH_FILL_PERCENTAGE = 95;
+
+describe(ContractName.Forwarder, () => {
+ let makerAddress: string;
+ let owner: string;
+ let takerAddress: string;
+ let feeRecipientAddress: string;
+ let defaultMakerAssetAddress: string;
+ let zrxAssetData: string;
+ let wethAssetData: string;
+
+ let weth: DummyERC20TokenContract;
+ let zrxToken: DummyERC20TokenContract;
+ let erc20TokenA: DummyERC20TokenContract;
+ let erc721Token: DummyERC721TokenContract;
+ let forwarderContract: ForwarderContract;
+ let wethContract: WETH9Contract;
+ let forwarderWrapper: ForwarderWrapper;
+ let exchangeWrapper: ExchangeWrapper;
+
+ let orderWithoutFee: SignedOrder;
+ let orderWithFee: SignedOrder;
+ let feeOrder: SignedOrder;
+ let orderFactory: OrderFactory;
+ let erc20Wrapper: ERC20Wrapper;
+ let erc20Balances: ERC20BalancesByOwner;
+ let tx: TransactionReceiptWithDecodedLogs;
+
+ let erc721MakerAssetIds: BigNumber[];
+ let takerEthBalanceBefore: BigNumber;
+ let feePercentage: BigNumber;
+ let gasPrice: BigNumber;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts);
+
+ const txHash = await web3Wrapper.sendTransactionAsync({ from: accounts[0], to: accounts[0], value: 0 });
+ const transaction = await web3Wrapper.getTransactionByHashAsync(txHash);
+ gasPrice = new BigNumber(transaction.gasPrice);
+
+ const erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+
+ const numDummyErc20ToDeploy = 3;
+ [erc20TokenA, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
+ numDummyErc20ToDeploy,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
+ const erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+
+ [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
+ const erc721Proxy = await erc721Wrapper.deployProxyAsync();
+ await erc721Wrapper.setBalancesAndAllowancesAsync();
+ const erc721Balances = await erc721Wrapper.getBalancesAsync();
+ erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
+
+ wethContract = await WETH9Contract.deployFrom0xArtifactAsync(tokenArtifacts.WETH9, provider, txDefaults);
+ weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider);
+ erc20Wrapper.addDummyTokenContract(weth);
+
+ wethAssetData = assetDataUtils.encodeERC20AssetData(wethContract.address);
+ zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+ const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
+ protocolArtifacts.Exchange,
+ provider,
+ txDefaults,
+ zrxAssetData,
+ );
+ exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider);
+ await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
+ await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
+
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
+ from: owner,
+ });
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
+ from: owner,
+ });
+
+ defaultMakerAssetAddress = erc20TokenA.address;
+ const defaultTakerAssetAddress = wethContract.address;
+ const defaultOrderParams = {
+ exchangeAddress: exchangeInstance.address,
+ makerAddress,
+ feeRecipientAddress,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), DECIMALS_DEFAULT),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), DECIMALS_DEFAULT),
+ makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), DECIMALS_DEFAULT),
+ };
+ const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
+ orderFactory = new OrderFactory(privateKey, defaultOrderParams);
+
+ const forwarderInstance = await ForwarderContract.deployFrom0xArtifactAsync(
+ artifacts.Forwarder,
+ provider,
+ txDefaults,
+ exchangeInstance.address,
+ zrxAssetData,
+ wethAssetData,
+ );
+ forwarderContract = new ForwarderContract(forwarderInstance.abi, forwarderInstance.address, provider);
+ forwarderWrapper = new ForwarderWrapper(forwarderContract, provider);
+ const zrxDepositAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.transfer.sendTransactionAsync(forwarderContract.address, zrxDepositAmount),
+ );
+ erc20Wrapper.addTokenOwnerAddress(forwarderInstance.address);
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ takerEthBalanceBefore = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ orderWithoutFee = await orderFactory.newSignedOrderAsync();
+ feeOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
+ });
+ orderWithFee = await orderFactory.newSignedOrderAsync({
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
+ });
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('constructor', () => {
+ it('should revert if assetProxy is unregistered', async () => {
+ const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
+ protocolArtifacts.Exchange,
+ provider,
+ txDefaults,
+ zrxAssetData,
+ );
+ return expectContractCreationFailedAsync(
+ (ForwarderContract.deployFrom0xArtifactAsync(
+ artifacts.Forwarder,
+ provider,
+ txDefaults,
+ exchangeInstance.address,
+ zrxAssetData,
+ wethAssetData,
+ ) as any) as sendTransactionResult,
+ RevertReason.UnregisteredAssetProxy,
+ );
+ });
+ });
+ describe('marketSellOrdersWithEth without extra fees', () => {
+ it('should fill a single order', async () => {
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const ethValue = orderWithoutFee.takerAssetAmount.dividedToIntegerBy(2);
+
+ tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithoutFee, feeOrders, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = ForwarderWrapper.getPercentageOfValue(
+ ethValue,
+ MAX_WETH_FILL_PERCENTAGE,
+ );
+ const makerAssetFillAmount = primaryTakerAssetFillAmount
+ .times(orderWithoutFee.makerAssetAmount)
+ .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should fill multiple orders', async () => {
+ const secondOrderWithoutFee = await orderFactory.newSignedOrderAsync();
+ const ordersWithoutFee = [orderWithoutFee, secondOrderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const ethValue = ordersWithoutFee[0].takerAssetAmount.plus(
+ ordersWithoutFee[1].takerAssetAmount.dividedToIntegerBy(2),
+ );
+
+ tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithoutFee, feeOrders, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = ForwarderWrapper.getPercentageOfValue(
+ ethValue,
+ MAX_WETH_FILL_PERCENTAGE,
+ );
+ const firstTakerAssetFillAmount = ordersWithoutFee[0].takerAssetAmount;
+ const secondTakerAssetFillAmount = primaryTakerAssetFillAmount.minus(firstTakerAssetFillAmount);
+
+ const makerAssetFillAmount = ordersWithoutFee[0].makerAssetAmount.plus(
+ ordersWithoutFee[1].makerAssetAmount
+ .times(secondTakerAssetFillAmount)
+ .dividedToIntegerBy(ordersWithoutFee[1].takerAssetAmount),
+ );
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should fill the order and pay ZRX fees from a single feeOrder', async () => {
+ const ordersWithFee = [orderWithFee];
+ const feeOrders = [feeOrder];
+ const ethValue = orderWithFee.takerAssetAmount.dividedToIntegerBy(2);
+
+ tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithFee, feeOrders, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = ForwarderWrapper.getPercentageOfValue(
+ ethValue,
+ MAX_WETH_FILL_PERCENTAGE,
+ );
+ const makerAssetFillAmount = primaryTakerAssetFillAmount
+ .times(orderWithoutFee.makerAssetAmount)
+ .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
+ const feeAmount = ForwarderWrapper.getPercentageOfValue(
+ orderWithFee.takerFee.dividedToIntegerBy(2),
+ MAX_WETH_FILL_PERCENTAGE,
+ );
+ const wethSpentOnFeeOrders = ForwarderWrapper.getWethForFeeOrders(feeAmount, feeOrders);
+ const totalEthSpent = primaryTakerAssetFillAmount
+ .plus(wethSpentOnFeeOrders)
+ .plus(gasPrice.times(tx.gasUsed));
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount).plus(wethSpentOnFeeOrders),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should fill the orders and pay ZRX from multiple feeOrders', async () => {
+ const ordersWithFee = [orderWithFee];
+ const ethValue = orderWithFee.takerAssetAmount;
+ const makerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+ const makerAssetAmount = orderWithFee.takerFee.dividedToIntegerBy(2);
+ const takerAssetAmount = feeOrder.takerAssetAmount
+ .times(makerAssetAmount)
+ .dividedToIntegerBy(feeOrder.makerAssetAmount);
+
+ const firstFeeOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData,
+ makerAssetAmount,
+ takerAssetAmount,
+ });
+ const secondFeeOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData,
+ makerAssetAmount,
+ takerAssetAmount,
+ });
+ const feeOrders = [firstFeeOrder, secondFeeOrder];
+
+ tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithFee, feeOrders, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = ForwarderWrapper.getPercentageOfValue(
+ ethValue,
+ MAX_WETH_FILL_PERCENTAGE,
+ );
+ const makerAssetFillAmount = primaryTakerAssetFillAmount
+ .times(orderWithoutFee.makerAssetAmount)
+ .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
+ const feeAmount = ForwarderWrapper.getPercentageOfValue(orderWithFee.takerFee, MAX_WETH_FILL_PERCENTAGE);
+ const wethSpentOnFeeOrders = ForwarderWrapper.getWethForFeeOrders(feeAmount, feeOrders);
+ const totalEthSpent = primaryTakerAssetFillAmount
+ .plus(wethSpentOnFeeOrders)
+ .plus(gasPrice.times(tx.gasUsed));
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount).plus(wethSpentOnFeeOrders),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should fill the order when token is ZRX with fees', async () => {
+ orderWithFee = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
+ });
+ const ordersWithFee = [orderWithFee];
+ const feeOrders: SignedOrder[] = [];
+ const ethValue = orderWithFee.takerAssetAmount.dividedToIntegerBy(2);
+
+ tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithFee, feeOrders, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const makerAssetFillAmount = orderWithFee.makerAssetAmount.dividedToIntegerBy(2);
+ const totalEthSpent = ethValue.plus(gasPrice.times(tx.gasUsed));
+ const takerFeePaid = orderWithFee.takerFee.dividedToIntegerBy(2);
+ const makerFeePaid = orderWithFee.makerFee.dividedToIntegerBy(2);
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount).minus(makerFeePaid),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount).minus(takerFeePaid),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(ethValue),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[forwarderContract.address][zrxToken.address],
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should refund remaining ETH if amount is greater than takerAssetAmount', async () => {
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const ethValue = orderWithoutFee.takerAssetAmount.times(2);
+
+ tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithoutFee, feeOrders, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const totalEthSpent = orderWithoutFee.takerAssetAmount.plus(gasPrice.times(tx.gasUsed));
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ });
+ it('should revert if ZRX cannot be fully repurchased', async () => {
+ orderWithFee = await orderFactory.newSignedOrderAsync({
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), DECIMALS_DEFAULT),
+ });
+ const ordersWithFee = [orderWithFee];
+ feeOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
+ });
+ const feeOrders = [feeOrder];
+ const ethValue = orderWithFee.takerAssetAmount;
+ return expectTransactionFailedAsync(
+ forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithFee, feeOrders, {
+ value: ethValue,
+ from: takerAddress,
+ }),
+ RevertReason.CompleteFillFailed,
+ );
+ });
+ it('should not fill orders with different makerAssetData than the first order', async () => {
+ const makerAssetId = erc721MakerAssetIds[0];
+ const erc721SignedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ });
+ const erc20SignedOrder = await orderFactory.newSignedOrderAsync();
+ const ordersWithoutFee = [erc20SignedOrder, erc721SignedOrder];
+ const feeOrders: SignedOrder[] = [];
+ const ethValue = erc20SignedOrder.takerAssetAmount.plus(erc721SignedOrder.takerAssetAmount);
+
+ tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithoutFee, feeOrders, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const totalEthSpent = erc20SignedOrder.takerAssetAmount.plus(gasPrice.times(tx.gasUsed));
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ });
+ });
+ describe('marketSellOrdersWithEth with extra fees', () => {
+ it('should fill the order and send fee to feeRecipient', async () => {
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const ethValue = orderWithoutFee.takerAssetAmount.div(2);
+
+ const baseFeePercentage = 2;
+ feePercentage = ForwarderWrapper.getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, baseFeePercentage);
+ const feeRecipientEthBalanceBefore = await web3Wrapper.getBalanceInWeiAsync(feeRecipientAddress);
+ tx = await forwarderWrapper.marketSellOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ { feePercentage, feeRecipient: feeRecipientAddress },
+ );
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const feeRecipientEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(feeRecipientAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = ForwarderWrapper.getPercentageOfValue(
+ ethValue,
+ MAX_WETH_FILL_PERCENTAGE,
+ );
+ const makerAssetFillAmount = primaryTakerAssetFillAmount
+ .times(orderWithoutFee.makerAssetAmount)
+ .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
+ const ethSpentOnFee = ForwarderWrapper.getPercentageOfValue(primaryTakerAssetFillAmount, baseFeePercentage);
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(ethSpentOnFee).plus(gasPrice.times(tx.gasUsed));
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(feeRecipientEthBalanceAfter).to.be.bignumber.equal(feeRecipientEthBalanceBefore.plus(ethSpentOnFee));
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should fail if the fee is set too high', async () => {
+ const ethValue = orderWithoutFee.takerAssetAmount.div(2);
+ const baseFeePercentage = 6;
+ feePercentage = ForwarderWrapper.getPercentageOfValue(ethValue, baseFeePercentage);
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ await expectTransactionFailedAsync(
+ forwarderWrapper.marketSellOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ { from: takerAddress, value: ethValue, gasPrice },
+ { feePercentage, feeRecipient: feeRecipientAddress },
+ ),
+ RevertReason.FeePercentageTooLarge,
+ );
+ });
+ it('should fail if there is not enough ETH remaining to pay the fee', async () => {
+ const ethValue = orderWithoutFee.takerAssetAmount.div(2);
+ const baseFeePercentage = 5;
+ feePercentage = ForwarderWrapper.getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, baseFeePercentage);
+ const ordersWithFee = [orderWithFee];
+ const feeOrders = [feeOrder];
+ await expectTransactionFailedAsync(
+ forwarderWrapper.marketSellOrdersWithEthAsync(
+ ordersWithFee,
+ feeOrders,
+ { from: takerAddress, value: ethValue, gasPrice },
+ { feePercentage, feeRecipient: feeRecipientAddress },
+ ),
+ RevertReason.InsufficientEthRemaining,
+ );
+ });
+ });
+ describe('marketBuyOrdersWithEth without extra fees', () => {
+ it('should buy the exact amount of makerAsset in a single order', async () => {
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
+ const ethValue = orderWithoutFee.takerAssetAmount.dividedToIntegerBy(2);
+
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should buy the exact amount of makerAsset in multiple orders', async () => {
+ const secondOrderWithoutFee = await orderFactory.newSignedOrderAsync();
+ const ordersWithoutFee = [orderWithoutFee, secondOrderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = ordersWithoutFee[0].makerAssetAmount.plus(
+ ordersWithoutFee[1].makerAssetAmount.dividedToIntegerBy(2),
+ );
+ const ethValue = ordersWithoutFee[0].takerAssetAmount.plus(
+ ordersWithoutFee[1].takerAssetAmount.dividedToIntegerBy(2),
+ );
+
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should buy the exact amount of makerAsset and return excess ETH', async () => {
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
+ const ethValue = orderWithoutFee.takerAssetAmount;
+
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = ethValue.dividedToIntegerBy(2);
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should buy the exact amount of makerAsset and pay ZRX from feeOrders', async () => {
+ const ordersWithFee = [orderWithFee];
+ const feeOrders = [feeOrder];
+ const makerAssetFillAmount = orderWithFee.makerAssetAmount.dividedToIntegerBy(2);
+ const ethValue = orderWithFee.takerAssetAmount;
+
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = orderWithFee.takerAssetAmount.dividedToIntegerBy(2);
+ const feeAmount = orderWithFee.takerFee.dividedToIntegerBy(2);
+ const wethSpentOnFeeOrders = ForwarderWrapper.getWethForFeeOrders(feeAmount, feeOrders);
+ const totalEthSpent = primaryTakerAssetFillAmount
+ .plus(wethSpentOnFeeOrders)
+ .plus(gasPrice.times(tx.gasUsed));
+
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount).plus(wethSpentOnFeeOrders),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should buy slightly greater than makerAssetAmount when buying ZRX', async () => {
+ orderWithFee = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
+ });
+ const ordersWithFee = [orderWithFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = orderWithFee.makerAssetAmount.dividedToIntegerBy(2);
+ const ethValue = orderWithFee.takerAssetAmount;
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = ForwarderWrapper.getWethForFeeOrders(
+ makerAssetFillAmount,
+ ordersWithFee,
+ );
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ const makerAssetFilledAmount = orderWithFee.makerAssetAmount
+ .times(primaryTakerAssetFillAmount)
+ .dividedToIntegerBy(orderWithFee.takerAssetAmount);
+ const takerFeePaid = orderWithFee.takerFee
+ .times(primaryTakerAssetFillAmount)
+ .dividedToIntegerBy(orderWithFee.takerAssetAmount);
+ const makerFeePaid = orderWithFee.makerFee
+ .times(primaryTakerAssetFillAmount)
+ .dividedToIntegerBy(orderWithFee.takerAssetAmount);
+ const totalZrxPurchased = makerAssetFilledAmount.minus(takerFeePaid);
+ // Up to 1 wei worth of ZRX will be overbought per order
+ const maxOverboughtZrx = new BigNumber(1)
+ .times(orderWithFee.makerAssetAmount)
+ .dividedToIntegerBy(orderWithFee.takerAssetAmount);
+
+ expect(totalZrxPurchased).to.be.bignumber.gte(makerAssetFillAmount);
+ expect(totalZrxPurchased).to.be.bignumber.lte(makerAssetFillAmount.plus(maxOverboughtZrx));
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFilledAmount).minus(makerFeePaid),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].plus(totalZrxPurchased),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[forwarderContract.address][zrxToken.address],
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount', async () => {
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
+ const ethValue = orderWithoutFee.takerAssetAmount.dividedToIntegerBy(4);
+ return expectTransactionFailedAsync(
+ forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ }),
+ RevertReason.CompleteFillFailed,
+ );
+ });
+ it('should buy an ERC721 asset from a single order', async () => {
+ const makerAssetId = erc721MakerAssetIds[0];
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = new BigNumber(1);
+ const ethValue = orderWithFee.takerAssetAmount;
+
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
+ from: takerAddress,
+ value: ethValue,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newOwner = await erc721Token.ownerOf.callAsync(makerAssetId);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ expect(newOwner).to.be.bignumber.equal(takerAddress);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should revert if buying an ERC721 asset when later orders contain different makerAssetData', async () => {
+ const makerAssetId = erc721MakerAssetIds[0];
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ });
+ const differentMakerAssetDataOrder = await orderFactory.newSignedOrderAsync();
+ const ordersWithoutFee = [orderWithoutFee, differentMakerAssetDataOrder];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = new BigNumber(1).plus(differentMakerAssetDataOrder.makerAssetAmount);
+ const ethValue = orderWithFee.takerAssetAmount;
+ return expectTransactionFailedAsync(
+ forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ }),
+ RevertReason.CompleteFillFailed,
+ );
+ });
+ it('should buy an ERC721 asset and pay ZRX fees from a single fee order', async () => {
+ const makerAssetId = erc721MakerAssetIds[0];
+ orderWithFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
+ });
+ const ordersWithFee = [orderWithFee];
+ const feeOrders = [feeOrder];
+ const makerAssetFillAmount = orderWithFee.makerAssetAmount;
+ const primaryTakerAssetFillAmount = orderWithFee.takerAssetAmount;
+ const feeAmount = orderWithFee.takerFee;
+ const wethSpentOnFeeOrders = ForwarderWrapper.getWethForFeeOrders(feeAmount, feeOrders);
+ const ethValue = primaryTakerAssetFillAmount.plus(wethSpentOnFeeOrders);
+
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newOwner = await erc721Token.ownerOf.callAsync(makerAssetId);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const totalEthSpent = ethValue.plus(gasPrice.times(tx.gasUsed));
+
+ expect(newOwner).to.be.bignumber.equal(takerAddress);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount).plus(wethSpentOnFeeOrders),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should buy an ERC721 asset and pay ZRX fees from multiple fee orders', async () => {
+ const makerAssetId = erc721MakerAssetIds[0];
+ orderWithFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
+ });
+ const ordersWithFee = [orderWithFee];
+ const makerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+ const makerAssetAmount = orderWithFee.takerFee.dividedToIntegerBy(2);
+ const takerAssetAmount = feeOrder.takerAssetAmount
+ .times(makerAssetAmount)
+ .dividedToIntegerBy(feeOrder.makerAssetAmount);
+
+ const firstFeeOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData,
+ makerAssetAmount,
+ takerAssetAmount,
+ });
+ const secondFeeOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData,
+ makerAssetAmount,
+ takerAssetAmount,
+ });
+ const feeOrders = [firstFeeOrder, secondFeeOrder];
+
+ const makerAssetFillAmount = orderWithFee.makerAssetAmount;
+ const primaryTakerAssetFillAmount = orderWithFee.takerAssetAmount;
+ const feeAmount = orderWithFee.takerFee;
+ const wethSpentOnFeeOrders = ForwarderWrapper.getWethForFeeOrders(feeAmount, feeOrders);
+ const ethValue = primaryTakerAssetFillAmount.plus(wethSpentOnFeeOrders);
+
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newOwner = await erc721Token.ownerOf.callAsync(makerAssetId);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const totalEthSpent = ethValue.plus(gasPrice.times(tx.gasUsed));
+
+ expect(newOwner).to.be.bignumber.equal(takerAddress);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount).plus(wethSpentOnFeeOrders),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('Should buy slightly greater MakerAsset when exchange rate is rounded', async () => {
+ // The 0x Protocol contracts round the exchange rate in favor of the Maker.
+ // In this case, the taker must round up how much they're going to spend, which
+ // in turn increases the amount of MakerAsset being purchased.
+ // Example:
+ // The taker wants to buy 5 units of the MakerAsset at a rate of 3M/2T.
+ // For every 2 units of TakerAsset, the taker will receive 3 units of MakerAsset.
+ // To purchase 5 units, the taker must spend 10/3 = 3.33 units of TakerAssset.
+ // However, the Taker can only spend whole units.
+ // Spending floor(10/3) = 3 units will yield a profit of Floor(3*3/2) = Floor(4.5) = 4 units of MakerAsset.
+ // Spending ceil(10/3) = 4 units will yield a profit of Floor(4*3/2) = 6 units of MakerAsset.
+ //
+ // The forwarding contract will opt for the second option, which overbuys, to ensure the taker
+ // receives at least the amount of MakerAsset they requested.
+ //
+ // Construct test case using values from example above
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber('30'),
+ takerAssetAmount: new BigNumber('20'),
+ makerAssetData: assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const desiredMakerAssetFillAmount = new BigNumber('5');
+ const makerAssetFillAmount = new BigNumber('6');
+ const ethValue = new BigNumber('4');
+ // Execute test case
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ desiredMakerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ );
+ // Fetch end balances and construct expected outputs
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ // Validate test case
+ expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('Should buy slightly greater MakerAsset when exchange rate is rounded, and MakerAsset is ZRX', async () => {
+ // See the test case above for a detailed description of this case.
+ // The difference here is that the MakerAsset is ZRX. We expect the same result as above,
+ // but this tests a different code path.
+ //
+ // Construct test case using values from example above
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber('30'),
+ takerAssetAmount: new BigNumber('20'),
+ makerAssetData: zrxAssetData,
+ takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const desiredMakerAssetFillAmount = new BigNumber('5');
+ const makerAssetFillAmount = new BigNumber('6');
+ const ethValue = new BigNumber('4');
+ // Execute test case
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ desiredMakerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ );
+ // Fetch end balances and construct expected outputs
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ // Validate test case
+ expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('Should buy slightly greater MakerAsset when exchange rate is rounded (Regression Test)', async () => {
+ // Order taken from a transaction on mainnet that failed due to a rounding error.
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber('268166666666666666666'),
+ takerAssetAmount: new BigNumber('219090625878836371'),
+ makerAssetData: assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ // The taker will receive more than the desired amount of makerAsset due to rounding
+ const desiredMakerAssetFillAmount = new BigNumber('5000000000000000000');
+ const ethValue = new BigNumber('4084971271824171');
+ const makerAssetFillAmount = ethValue
+ .times(orderWithoutFee.makerAssetAmount)
+ .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
+ // Execute test case
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ desiredMakerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ );
+ // Fetch end balances and construct expected outputs
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ // Validate test case
+ expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('Should buy slightly greater MakerAsset when exchange rate is rounded, and MakerAsset is ZRX (Regression Test)', async () => {
+ // Order taken from a transaction on mainnet that failed due to a rounding error.
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber('268166666666666666666'),
+ takerAssetAmount: new BigNumber('219090625878836371'),
+ makerAssetData: zrxAssetData,
+ takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ // The taker will receive more than the desired amount of makerAsset due to rounding
+ const desiredMakerAssetFillAmount = new BigNumber('5000000000000000000');
+ const ethValue = new BigNumber('4084971271824171');
+ const makerAssetFillAmount = ethValue
+ .times(orderWithoutFee.makerAssetAmount)
+ .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
+ // Execute test case
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ desiredMakerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ );
+ // Fetch end balances and construct expected outputs
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ // Validate test case
+ expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('Should buy correct MakerAsset when exchange rate is NOT rounded, and MakerAsset is ZRX (Regression Test)', async () => {
+ // An extra unit of TakerAsset was sent to the exchange contract to account for rounding errors, in Forwarder v1.
+ // Specifically, the takerFillAmount was calculated using Floor(desiredMakerAmount * exchangeRate) + 1
+ // We have since changed this to be Ceil(desiredMakerAmount * exchangeRate)
+ // These calculations produce different results when `desiredMakerAmount * exchangeRate` is an integer.
+ //
+ // This test verifies that `ceil` is sufficient:
+ // Let TakerAssetAmount = MakerAssetAmount * 2
+ // -> exchangeRate = TakerAssetAmount / MakerAssetAmount = (2*MakerAssetAmount)/MakerAssetAmount = 2
+ // .: desiredMakerAmount * exchangeRate is an integer.
+ //
+ // Construct test case using values from example above
+ orderWithoutFee = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber('30'),
+ takerAssetAmount: new BigNumber('60'),
+ makerAssetData: zrxAssetData,
+ takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ });
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = new BigNumber('5');
+ const ethValue = new BigNumber('10');
+ // Execute test case
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
+ value: ethValue,
+ from: takerAddress,
+ });
+ // Fetch end balances and construct expected outputs
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const primaryTakerAssetFillAmount = ethValue;
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
+ // Validate test case
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ });
+ describe('marketBuyOrdersWithEth with extra fees', () => {
+ it('should buy an asset and send fee to feeRecipient', async () => {
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
+ const ethValue = orderWithoutFee.takerAssetAmount;
+
+ const baseFeePercentage = 2;
+ feePercentage = ForwarderWrapper.getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, baseFeePercentage);
+ const feeRecipientEthBalanceBefore = await web3Wrapper.getBalanceInWeiAsync(feeRecipientAddress);
+ tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ makerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ { feePercentage, feeRecipient: feeRecipientAddress },
+ );
+ const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
+ const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
+ const feeRecipientEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(feeRecipientAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const primaryTakerAssetFillAmount = orderWithoutFee.takerAssetAmount.dividedToIntegerBy(2);
+ const ethSpentOnFee = ForwarderWrapper.getPercentageOfValue(primaryTakerAssetFillAmount, baseFeePercentage);
+ const totalEthSpent = primaryTakerAssetFillAmount.plus(ethSpentOnFee).plus(gasPrice.times(tx.gasUsed));
+
+ expect(feeRecipientEthBalanceAfter).to.be.bignumber.equal(feeRecipientEthBalanceBefore.plus(ethSpentOnFee));
+ expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
+ );
+ expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ constants.ZERO_AMOUNT,
+ );
+ expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should fail if the fee is set too high', async () => {
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
+ const ethValue = orderWithoutFee.takerAssetAmount;
+
+ const baseFeePercentage = 6;
+ feePercentage = ForwarderWrapper.getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, baseFeePercentage);
+ await expectTransactionFailedAsync(
+ forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ makerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ { feePercentage, feeRecipient: feeRecipientAddress },
+ ),
+ RevertReason.FeePercentageTooLarge,
+ );
+ });
+ it('should fail if there is not enough ETH remaining to pay the fee', async () => {
+ const ordersWithoutFee = [orderWithoutFee];
+ const feeOrders: SignedOrder[] = [];
+ const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
+ const ethValue = orderWithoutFee.takerAssetAmount.dividedToIntegerBy(2);
+
+ const baseFeePercentage = 2;
+ feePercentage = ForwarderWrapper.getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, baseFeePercentage);
+ await expectTransactionFailedAsync(
+ forwarderWrapper.marketBuyOrdersWithEthAsync(
+ ordersWithoutFee,
+ feeOrders,
+ makerAssetFillAmount,
+ {
+ value: ethValue,
+ from: takerAddress,
+ },
+ { feePercentage, feeRecipient: feeRecipientAddress },
+ ),
+ RevertReason.InsufficientEthRemaining,
+ );
+ });
+ });
+ describe('withdrawAsset', () => {
+ it('should allow owner to withdraw ERC20 tokens', async () => {
+ const zrxWithdrawAmount = erc20Balances[forwarderContract.address][zrxToken.address];
+ await forwarderWrapper.withdrawAssetAsync(zrxAssetData, zrxWithdrawAmount, { from: owner });
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances[owner][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[owner][zrxToken.address].plus(zrxWithdrawAmount),
+ );
+ expect(newBalances[forwarderContract.address][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[forwarderContract.address][zrxToken.address].minus(zrxWithdrawAmount),
+ );
+ });
+ it('should revert if not called by owner', async () => {
+ const zrxWithdrawAmount = erc20Balances[forwarderContract.address][zrxToken.address];
+ await expectTransactionFailedAsync(
+ forwarderWrapper.withdrawAssetAsync(zrxAssetData, zrxWithdrawAmount, { from: makerAddress }),
+ RevertReason.OnlyContractOwner,
+ );
+ });
+ });
+});
+// tslint:disable:max-file-line-count
+// tslint:enable:no-unnecessary-type-assertion
diff --git a/contracts/extensions/test/extensions/order_matcher.ts b/contracts/extensions/test/extensions/order_matcher.ts
new file mode 100644
index 000000000..acb46ced4
--- /dev/null
+++ b/contracts/extensions/test/extensions/order_matcher.ts
@@ -0,0 +1,818 @@
+import {
+ artifacts as protocolArtifacts,
+ ERC20ProxyContract,
+ ERC20Wrapper,
+ ERC721ProxyContract,
+ ExchangeContract,
+ ExchangeFillEventArgs,
+ ExchangeWrapper,
+} from '@0x/contracts-protocol';
+import {
+ chaiSetup,
+ constants,
+ ERC20BalancesByOwner,
+ expectContractCreationFailedAsync,
+ expectTransactionFailedAsync,
+ LogDecoder,
+ OrderFactory,
+ provider,
+ sendTransactionResult,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { artifacts as tokenArtifacts, DummyERC20TokenContract, DummyERC721TokenContract } from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { OrderMatcherContract } from '../../generated-wrappers/order_matcher';
+import { artifacts } from '../../src/artifacts';
+
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+chaiSetup.configure();
+const expect = chai.expect;
+// tslint:disable:no-unnecessary-type-assertion
+describe('OrderMatcher', () => {
+ let makerAddressLeft: string;
+ let makerAddressRight: string;
+ let owner: string;
+ let takerAddress: string;
+ let feeRecipientAddressLeft: string;
+ let feeRecipientAddressRight: string;
+
+ let erc20TokenA: DummyERC20TokenContract;
+ let erc20TokenB: DummyERC20TokenContract;
+ let zrxToken: DummyERC20TokenContract;
+ let exchange: ExchangeContract;
+ let erc20Proxy: ERC20ProxyContract;
+ let erc721Proxy: ERC721ProxyContract;
+ let orderMatcher: OrderMatcherContract;
+
+ let erc20BalancesByOwner: ERC20BalancesByOwner;
+ let exchangeWrapper: ExchangeWrapper;
+ let erc20Wrapper: ERC20Wrapper;
+ let orderFactoryLeft: OrderFactory;
+ let orderFactoryRight: OrderFactory;
+
+ let leftMakerAssetData: string;
+ let leftTakerAssetData: string;
+ let defaultERC20MakerAssetAddress: string;
+ let defaultERC20TakerAssetAddress: string;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ // Create accounts
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ // Hack(albrow): Both Prettier and TSLint insert a trailing comma below
+ // but that is invalid syntax as of TypeScript version >= 2.8. We don't
+ // have the right fine-grained configuration options in TSLint,
+ // Prettier, or TypeScript, to reconcile this, so we will just have to
+ // wait for them to sort it out. We disable TSLint and Prettier for
+ // this part of the code for now. This occurs several times in this
+ // file. See https://github.com/prettier/prettier/issues/4624.
+ // prettier-ignore
+ const usedAddresses = ([
+ owner,
+ makerAddressLeft,
+ makerAddressRight,
+ takerAddress,
+ feeRecipientAddressLeft,
+ // tslint:disable-next-line:trailing-comma
+ feeRecipientAddressRight
+ ] = _.slice(accounts, 0, 6));
+ // Create wrappers
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ // Deploy ERC20 token & ERC20 proxy
+ const numDummyErc20ToDeploy = 3;
+ [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
+ numDummyErc20ToDeploy,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
+ erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+ // Deploy ERC721 proxy
+ erc721Proxy = await ERC721ProxyContract.deployFrom0xArtifactAsync(
+ protocolArtifacts.ERC721Proxy,
+ provider,
+ txDefaults,
+ );
+ // Depoy exchange
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ protocolArtifacts.Exchange,
+ provider,
+ txDefaults,
+ assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ );
+ exchangeWrapper = new ExchangeWrapper(exchange, provider);
+ await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
+ await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
+ // Authorize ERC20 trades by exchange
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Deploy OrderMatcher
+ orderMatcher = await OrderMatcherContract.deployFrom0xArtifactAsync(
+ artifacts.OrderMatcher,
+ provider,
+ txDefaults,
+ exchange.address,
+ );
+ // Set default addresses
+ defaultERC20MakerAssetAddress = erc20TokenA.address;
+ defaultERC20TakerAssetAddress = erc20TokenB.address;
+ leftMakerAssetData = assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress);
+ leftTakerAssetData = assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress);
+ // Set OrderMatcher balances and allowances
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20TokenA.setBalance.sendTransactionAsync(orderMatcher.address, constants.INITIAL_ERC20_BALANCE, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20TokenB.setBalance.sendTransactionAsync(orderMatcher.address, constants.INITIAL_ERC20_BALANCE, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await orderMatcher.approveAssetProxy.sendTransactionAsync(
+ leftMakerAssetData,
+ constants.INITIAL_ERC20_ALLOWANCE,
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await orderMatcher.approveAssetProxy.sendTransactionAsync(
+ leftTakerAssetData,
+ constants.INITIAL_ERC20_ALLOWANCE,
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Create default order parameters
+ const defaultOrderParamsLeft = {
+ ...constants.STATIC_ORDER_PARAMS,
+ makerAddress: makerAddressLeft,
+ exchangeAddress: exchange.address,
+ makerAssetData: leftMakerAssetData,
+ takerAssetData: leftTakerAssetData,
+ feeRecipientAddress: feeRecipientAddressLeft,
+ makerFee: constants.ZERO_AMOUNT,
+ takerFee: constants.ZERO_AMOUNT,
+ };
+ const defaultOrderParamsRight = {
+ ...constants.STATIC_ORDER_PARAMS,
+ makerAddress: makerAddressRight,
+ exchangeAddress: exchange.address,
+ makerAssetData: leftTakerAssetData,
+ takerAssetData: leftMakerAssetData,
+ feeRecipientAddress: feeRecipientAddressRight,
+ makerFee: constants.ZERO_AMOUNT,
+ takerFee: constants.ZERO_AMOUNT,
+ };
+ const privateKeyLeft = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressLeft)];
+ orderFactoryLeft = new OrderFactory(privateKeyLeft, defaultOrderParamsLeft);
+ const privateKeyRight = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressRight)];
+ orderFactoryRight = new OrderFactory(privateKeyRight, defaultOrderParamsRight);
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('constructor', () => {
+ it('should revert if assetProxy is unregistered', async () => {
+ const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
+ protocolArtifacts.Exchange,
+ provider,
+ txDefaults,
+ constants.NULL_BYTES,
+ );
+ return expectContractCreationFailedAsync(
+ (OrderMatcherContract.deployFrom0xArtifactAsync(
+ artifacts.OrderMatcher,
+ provider,
+ txDefaults,
+ exchangeInstance.address,
+ ) as any) as sendTransactionResult,
+ RevertReason.UnregisteredAssetProxy,
+ );
+ });
+ });
+ describe('matchOrders', () => {
+ beforeEach(async () => {
+ erc20BalancesByOwner = await erc20Wrapper.getBalancesAsync();
+ });
+ it('should revert if not called by owner', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ const data = exchange.matchOrders.getABIEncodedTransactionData(
+ signedOrderLeft,
+ signedOrderRight,
+ signedOrderLeft.signature,
+ signedOrderRight.signature,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ data,
+ to: orderMatcher.address,
+ from: takerAddress,
+ gas: constants.MAX_MATCH_ORDERS_GAS,
+ }),
+ RevertReason.OnlyContractOwner,
+ );
+ });
+ it('should transfer the correct amounts when orders completely fill each other', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match signedOrderLeft with signedOrderRight
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: signedOrderLeft.makerAssetAmount,
+ amountBoughtByLeftMaker: signedOrderLeft.takerAssetAmount,
+ // Right Maker
+ amountSoldByRightMaker: signedOrderRight.makerAssetAmount,
+ amountBoughtByRightMaker: signedOrderRight.takerAssetAmount,
+ // Taker
+ leftMakerAssetSpreadAmount: signedOrderLeft.makerAssetAmount.minus(signedOrderRight.takerAssetAmount),
+ };
+ const initialLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ const data = exchange.matchOrders.getABIEncodedTransactionData(
+ signedOrderLeft,
+ signedOrderRight,
+ signedOrderLeft.signature,
+ signedOrderRight.signature,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ data,
+ to: orderMatcher.address,
+ from: owner,
+ gas: constants.MAX_MATCH_ORDERS_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ const newErc20Balances = await erc20Wrapper.getBalancesAsync();
+ expect(newErc20Balances[makerAddressLeft][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressLeft][defaultERC20MakerAssetAddress].minus(
+ expectedTransferAmounts.amountSoldByLeftMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressRight][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressRight][defaultERC20TakerAssetAddress].minus(
+ expectedTransferAmounts.amountSoldByRightMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressLeft][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressLeft][defaultERC20TakerAssetAddress].plus(
+ expectedTransferAmounts.amountBoughtByLeftMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressRight][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressRight][defaultERC20MakerAssetAddress].plus(
+ expectedTransferAmounts.amountBoughtByRightMaker,
+ ),
+ );
+ expect(newLeftMakerAssetTakerBalance).to.be.bignumber.equal(
+ initialLeftMakerAssetTakerBalance.plus(expectedTransferAmounts.leftMakerAssetSpreadAmount),
+ );
+ });
+ it('should transfer the correct amounts when orders completely fill each other and taker doesnt take a profit', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ });
+ // Match signedOrderLeft with signedOrderRight
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: signedOrderLeft.makerAssetAmount,
+ amountBoughtByLeftMaker: signedOrderLeft.takerAssetAmount,
+ // Right Maker
+ amountSoldByRightMaker: signedOrderRight.makerAssetAmount,
+ amountBoughtByRightMaker: signedOrderRight.takerAssetAmount,
+ };
+ const initialLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ const data = exchange.matchOrders.getABIEncodedTransactionData(
+ signedOrderLeft,
+ signedOrderRight,
+ signedOrderLeft.signature,
+ signedOrderRight.signature,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ data,
+ to: orderMatcher.address,
+ from: owner,
+ gas: constants.MAX_MATCH_ORDERS_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ const newErc20Balances = await erc20Wrapper.getBalancesAsync();
+ expect(newErc20Balances[makerAddressLeft][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressLeft][defaultERC20MakerAssetAddress].minus(
+ expectedTransferAmounts.amountSoldByLeftMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressRight][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressRight][defaultERC20TakerAssetAddress].minus(
+ expectedTransferAmounts.amountSoldByRightMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressLeft][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressLeft][defaultERC20TakerAssetAddress].plus(
+ expectedTransferAmounts.amountBoughtByLeftMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressRight][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressRight][defaultERC20MakerAssetAddress].plus(
+ expectedTransferAmounts.amountBoughtByRightMaker,
+ ),
+ );
+ expect(newLeftMakerAssetTakerBalance).to.be.bignumber.equal(initialLeftMakerAssetTakerBalance);
+ });
+ it('should transfer the correct amounts when left order is completely filled and right order would be partially filled', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
+ });
+ // Match signedOrderLeft with signedOrderRight
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: signedOrderLeft.makerAssetAmount,
+ amountBoughtByLeftMaker: signedOrderLeft.takerAssetAmount,
+ // Right Maker
+ amountSoldByRightMaker: signedOrderRight.makerAssetAmount,
+ amountBoughtByRightMaker: signedOrderRight.takerAssetAmount,
+ // Taker
+ leftMakerAssetSpreadAmount: signedOrderLeft.makerAssetAmount.minus(signedOrderRight.takerAssetAmount),
+ leftTakerAssetSpreadAmount: signedOrderRight.makerAssetAmount.minus(signedOrderLeft.takerAssetAmount),
+ };
+ const initialLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ const initialLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
+ // Match signedOrderLeft with signedOrderRight
+ const data = exchange.matchOrders.getABIEncodedTransactionData(
+ signedOrderLeft,
+ signedOrderRight,
+ signedOrderLeft.signature,
+ signedOrderRight.signature,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ data,
+ to: orderMatcher.address,
+ from: owner,
+ gas: constants.MAX_MATCH_ORDERS_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ const newLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
+ const newErc20Balances = await erc20Wrapper.getBalancesAsync();
+ expect(newErc20Balances[makerAddressLeft][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressLeft][defaultERC20MakerAssetAddress].minus(
+ expectedTransferAmounts.amountSoldByLeftMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressRight][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressRight][defaultERC20TakerAssetAddress].minus(
+ expectedTransferAmounts.amountSoldByRightMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressLeft][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressLeft][defaultERC20TakerAssetAddress].plus(
+ expectedTransferAmounts.amountBoughtByLeftMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressRight][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressRight][defaultERC20MakerAssetAddress].plus(
+ expectedTransferAmounts.amountBoughtByRightMaker,
+ ),
+ );
+ expect(newLeftMakerAssetTakerBalance).to.be.bignumber.equal(
+ initialLeftMakerAssetTakerBalance.plus(expectedTransferAmounts.leftMakerAssetSpreadAmount),
+ );
+ expect(newLeftTakerAssetTakerBalance).to.be.bignumber.equal(
+ initialLeftTakerAssetTakerBalance.plus(expectedTransferAmounts.leftTakerAssetSpreadAmount),
+ );
+ });
+ it('should not call fillOrder when rightOrder is completely filled after matchOrders call and orders were never partially filled', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ const data = exchange.matchOrders.getABIEncodedTransactionData(
+ signedOrderLeft,
+ signedOrderRight,
+ signedOrderLeft.signature,
+ signedOrderRight.signature,
+ );
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokenArtifacts, ...protocolArtifacts });
+ const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
+ await web3Wrapper.sendTransactionAsync({
+ data,
+ to: orderMatcher.address,
+ from: owner,
+ gas: constants.MAX_MATCH_ORDERS_GAS,
+ }),
+ );
+ const fillLogs = _.filter(
+ txReceipt.logs,
+ log => (log as LogWithDecodedArgs<ExchangeFillEventArgs>).event === 'Fill',
+ );
+ // Only 2 Fill logs should exist for `matchOrders` call. `fillOrder` should not have been called and should not have emitted a Fill event.
+ expect(fillLogs.length).to.be.equal(2);
+ });
+ it('should not call fillOrder when rightOrder is completely filled after matchOrders call and orders were initially partially filled', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ await exchangeWrapper.fillOrderAsync(signedOrderLeft, takerAddress, {
+ takerAssetFillAmount: signedOrderLeft.takerAssetAmount.dividedToIntegerBy(5),
+ });
+ await exchangeWrapper.fillOrderAsync(signedOrderRight, takerAddress, {
+ takerAssetFillAmount: signedOrderRight.takerAssetAmount.dividedToIntegerBy(5),
+ });
+ const data = exchange.matchOrders.getABIEncodedTransactionData(
+ signedOrderLeft,
+ signedOrderRight,
+ signedOrderLeft.signature,
+ signedOrderRight.signature,
+ );
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokenArtifacts, ...protocolArtifacts });
+ const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
+ await web3Wrapper.sendTransactionAsync({
+ data,
+ to: orderMatcher.address,
+ from: owner,
+ gas: constants.MAX_MATCH_ORDERS_GAS,
+ }),
+ );
+ const fillLogs = _.filter(
+ txReceipt.logs,
+ log => (log as LogWithDecodedArgs<ExchangeFillEventArgs>).event === 'Fill',
+ );
+ // Only 2 Fill logs should exist for `matchOrders` call. `fillOrder` should not have been called and should not have emitted a Fill event.
+ expect(fillLogs.length).to.be.equal(2);
+ });
+ it('should only take a spread in rightMakerAsset if entire leftMakerAssetSpread amount can be used to fill rightOrder after matchOrders call', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(0.9), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(990), 18),
+ });
+ const initialLeftMakerAssetSpreadAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1.09), 18);
+ const leftTakerAssetSpreadAmount = initialLeftMakerAssetSpreadAmount
+ .times(signedOrderRight.makerAssetAmount)
+ .dividedToIntegerBy(signedOrderRight.takerAssetAmount);
+ // Match signedOrderLeft with signedOrderRight
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: signedOrderLeft.makerAssetAmount,
+ amountBoughtByLeftMaker: signedOrderLeft.takerAssetAmount,
+ // Right Maker
+ amountSoldByRightMaker: signedOrderLeft.takerAssetAmount.plus(leftTakerAssetSpreadAmount),
+ amountBoughtByRightMaker: signedOrderLeft.makerAssetAmount,
+ // Taker
+ leftMakerAssetSpreadAmount: constants.ZERO_AMOUNT,
+ leftTakerAssetSpreadAmount,
+ };
+ const initialLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ const initialLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
+ // Match signedOrderLeft with signedOrderRight
+ const data = exchange.matchOrders.getABIEncodedTransactionData(
+ signedOrderLeft,
+ signedOrderRight,
+ signedOrderLeft.signature,
+ signedOrderRight.signature,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ data,
+ to: orderMatcher.address,
+ from: owner,
+ gas: constants.MAX_MATCH_ORDERS_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ const newLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
+ const newErc20Balances = await erc20Wrapper.getBalancesAsync();
+ expect(newErc20Balances[makerAddressLeft][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressLeft][defaultERC20MakerAssetAddress].minus(
+ expectedTransferAmounts.amountSoldByLeftMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressRight][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressRight][defaultERC20TakerAssetAddress].minus(
+ expectedTransferAmounts.amountSoldByRightMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressLeft][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressLeft][defaultERC20TakerAssetAddress].plus(
+ expectedTransferAmounts.amountBoughtByLeftMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressRight][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressRight][defaultERC20MakerAssetAddress].plus(
+ expectedTransferAmounts.amountBoughtByRightMaker,
+ ),
+ );
+ expect(newLeftMakerAssetTakerBalance).to.be.bignumber.equal(
+ initialLeftMakerAssetTakerBalance.plus(expectedTransferAmounts.leftMakerAssetSpreadAmount),
+ );
+ expect(newLeftTakerAssetTakerBalance).to.be.bignumber.equal(
+ initialLeftTakerAssetTakerBalance.plus(expectedTransferAmounts.leftTakerAssetSpreadAmount),
+ );
+ });
+ it("should succeed if rightOrder's makerAssetData and takerAssetData are not provided", async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
+ });
+ // Match signedOrderLeft with signedOrderRight
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: signedOrderLeft.makerAssetAmount,
+ amountBoughtByLeftMaker: signedOrderLeft.takerAssetAmount,
+ // Right Maker
+ amountSoldByRightMaker: signedOrderRight.makerAssetAmount,
+ amountBoughtByRightMaker: signedOrderRight.takerAssetAmount,
+ // Taker
+ leftMakerAssetSpreadAmount: signedOrderLeft.makerAssetAmount.minus(signedOrderRight.takerAssetAmount),
+ leftTakerAssetSpreadAmount: signedOrderRight.makerAssetAmount.minus(signedOrderLeft.takerAssetAmount),
+ };
+ const initialLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ const initialLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
+ // Match signedOrderLeft with signedOrderRight
+ signedOrderRight.makerAssetData = constants.NULL_BYTES;
+ signedOrderRight.takerAssetData = constants.NULL_BYTES;
+ const data = exchange.matchOrders.getABIEncodedTransactionData(
+ signedOrderLeft,
+ signedOrderRight,
+ signedOrderLeft.signature,
+ signedOrderRight.signature,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ data,
+ to: orderMatcher.address,
+ from: owner,
+ gas: constants.MAX_MATCH_ORDERS_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newLeftMakerAssetTakerBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ const newLeftTakerAssetTakerBalance = await erc20TokenB.balanceOf.callAsync(orderMatcher.address);
+ const newErc20Balances = await erc20Wrapper.getBalancesAsync();
+ expect(newErc20Balances[makerAddressLeft][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressLeft][defaultERC20MakerAssetAddress].minus(
+ expectedTransferAmounts.amountSoldByLeftMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressRight][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressRight][defaultERC20TakerAssetAddress].minus(
+ expectedTransferAmounts.amountSoldByRightMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressLeft][defaultERC20TakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressLeft][defaultERC20TakerAssetAddress].plus(
+ expectedTransferAmounts.amountBoughtByLeftMaker,
+ ),
+ );
+ expect(newErc20Balances[makerAddressRight][defaultERC20MakerAssetAddress]).to.be.bignumber.equal(
+ erc20BalancesByOwner[makerAddressRight][defaultERC20MakerAssetAddress].plus(
+ expectedTransferAmounts.amountBoughtByRightMaker,
+ ),
+ );
+ expect(newLeftMakerAssetTakerBalance).to.be.bignumber.equal(
+ initialLeftMakerAssetTakerBalance.plus(expectedTransferAmounts.leftMakerAssetSpreadAmount),
+ );
+ expect(newLeftTakerAssetTakerBalance).to.be.bignumber.equal(
+ initialLeftTakerAssetTakerBalance.plus(expectedTransferAmounts.leftTakerAssetSpreadAmount),
+ );
+ });
+ it('should revert with the correct reason if matchOrders call reverts', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ });
+ signedOrderRight.signature = `0xff${signedOrderRight.signature.slice(4)}`;
+ const data = exchange.matchOrders.getABIEncodedTransactionData(
+ signedOrderLeft,
+ signedOrderRight,
+ signedOrderLeft.signature,
+ signedOrderRight.signature,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ data,
+ to: orderMatcher.address,
+ from: owner,
+ gas: constants.MAX_MATCH_ORDERS_GAS,
+ }),
+ RevertReason.InvalidOrderSignature,
+ );
+ });
+ it('should revert with the correct reason if fillOrder call reverts', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
+ });
+ // Matcher will not have enough allowance to fill rightOrder
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await orderMatcher.approveAssetProxy.sendTransactionAsync(leftMakerAssetData, constants.ZERO_AMOUNT, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const data = exchange.matchOrders.getABIEncodedTransactionData(
+ signedOrderLeft,
+ signedOrderRight,
+ signedOrderLeft.signature,
+ signedOrderRight.signature,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ data,
+ to: orderMatcher.address,
+ from: owner,
+ gas: constants.MAX_MATCH_ORDERS_GAS,
+ }),
+ RevertReason.TransferFailed,
+ );
+ });
+ });
+ describe('withdrawAsset', () => {
+ it('should allow owner to withdraw ERC20 tokens', async () => {
+ const erc20AWithdrawAmount = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ expect(erc20AWithdrawAmount).to.be.bignumber.gt(constants.ZERO_AMOUNT);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await orderMatcher.withdrawAsset.sendTransactionAsync(leftMakerAssetData, erc20AWithdrawAmount, {
+ from: owner,
+ }),
+ );
+ const newBalance = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ expect(newBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should allow owner to withdraw ERC721 tokens', async () => {
+ const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
+ tokenArtifacts.DummyERC721Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ );
+ const tokenId = new BigNumber(1);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.mint.sendTransactionAsync(orderMatcher.address, tokenId, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const assetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, tokenId);
+ const withdrawAmount = new BigNumber(1);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await orderMatcher.withdrawAsset.sendTransactionAsync(assetData, withdrawAmount, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const erc721Owner = await erc721Token.ownerOf.callAsync(tokenId);
+ expect(erc721Owner).to.be.equal(owner);
+ });
+ it('should revert if not called by owner', async () => {
+ const erc20AWithdrawAmount = await erc20TokenA.balanceOf.callAsync(orderMatcher.address);
+ expect(erc20AWithdrawAmount).to.be.bignumber.gt(constants.ZERO_AMOUNT);
+ await expectTransactionFailedAsync(
+ orderMatcher.withdrawAsset.sendTransactionAsync(leftMakerAssetData, erc20AWithdrawAmount, {
+ from: takerAddress,
+ }),
+ RevertReason.OnlyContractOwner,
+ );
+ });
+ });
+ describe('approveAssetProxy', () => {
+ it('should be able to set an allowance for ERC20 tokens', async () => {
+ const allowance = new BigNumber(55465465426546);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await orderMatcher.approveAssetProxy.sendTransactionAsync(leftMakerAssetData, allowance, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newAllowance = await erc20TokenA.allowance.callAsync(orderMatcher.address, erc20Proxy.address);
+ expect(newAllowance).to.be.bignumber.equal(allowance);
+ });
+ it('should be able to approve an ERC721 token by passing in allowance = 1', async () => {
+ const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
+ tokenArtifacts.DummyERC721Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ );
+ const assetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, constants.ZERO_AMOUNT);
+ const allowance = new BigNumber(1);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await orderMatcher.approveAssetProxy.sendTransactionAsync(assetData, allowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const isApproved = await erc721Token.isApprovedForAll.callAsync(orderMatcher.address, erc721Proxy.address);
+ expect(isApproved).to.be.equal(true);
+ });
+ it('should be able to approve an ERC721 token by passing in allowance > 1', async () => {
+ const erc721Token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
+ tokenArtifacts.DummyERC721Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ );
+ const assetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, constants.ZERO_AMOUNT);
+ const allowance = new BigNumber(2);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await orderMatcher.approveAssetProxy.sendTransactionAsync(assetData, allowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const isApproved = await erc721Token.isApprovedForAll.callAsync(orderMatcher.address, erc721Proxy.address);
+ expect(isApproved).to.be.equal(true);
+ });
+ it('should revert if not called by owner', async () => {
+ const approval = new BigNumber(1);
+ await expectTransactionFailedAsync(
+ orderMatcher.approveAssetProxy.sendTransactionAsync(leftMakerAssetData, approval, {
+ from: takerAddress,
+ }),
+ RevertReason.OnlyContractOwner,
+ );
+ });
+ });
+});
+// tslint:disable:max-file-line-count
+// tslint:enable:no-unnecessary-type-assertion
diff --git a/contracts/extensions/test/extensions/order_validator.ts b/contracts/extensions/test/extensions/order_validator.ts
new file mode 100644
index 000000000..82a6b937f
--- /dev/null
+++ b/contracts/extensions/test/extensions/order_validator.ts
@@ -0,0 +1,609 @@
+import {
+ artifacts as protocolArtifacts,
+ ERC20ProxyContract,
+ ERC20Wrapper,
+ ERC721ProxyContract,
+ ERC721Wrapper,
+ ExchangeContract,
+ ExchangeWrapper,
+} from '@0x/contracts-protocol';
+import {
+ chaiSetup,
+ constants,
+ OrderFactory,
+ OrderStatus,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { DummyERC20TokenContract, DummyERC721TokenContract } from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { OrderValidatorContract } from '../../generated-wrappers/order_validator';
+import { artifacts } from '../../src/artifacts/index';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+describe('OrderValidator', () => {
+ let makerAddress: string;
+ let owner: string;
+ let takerAddress: string;
+ let erc20AssetData: string;
+ let erc721AssetData: string;
+
+ let erc20Token: DummyERC20TokenContract;
+ let zrxToken: DummyERC20TokenContract;
+ let erc721Token: DummyERC721TokenContract;
+ let exchange: ExchangeContract;
+ let orderValidator: OrderValidatorContract;
+ let erc20Proxy: ERC20ProxyContract;
+ let erc721Proxy: ERC721ProxyContract;
+
+ let signedOrder: SignedOrder;
+ let signedOrder2: SignedOrder;
+ let orderFactory: OrderFactory;
+
+ const tokenId = new BigNumber(123456789);
+ const tokenId2 = new BigNumber(987654321);
+ const ERC721_BALANCE = new BigNumber(1);
+ const ERC721_ALLOWANCE = new BigNumber(1);
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const usedAddresses = ([owner, makerAddress, takerAddress] = _.slice(accounts, 0, 3));
+
+ const erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ const erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
+
+ const numDummyErc20ToDeploy = 2;
+ [erc20Token, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
+ numDummyErc20ToDeploy,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
+ erc20Proxy = await erc20Wrapper.deployProxyAsync();
+
+ [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
+ erc721Proxy = await erc721Wrapper.deployProxyAsync();
+
+ const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ protocolArtifacts.Exchange,
+ provider,
+ txDefaults,
+ zrxAssetData,
+ );
+ const exchangeWrapper = new ExchangeWrapper(exchange, provider);
+ await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
+ await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
+
+ orderValidator = await OrderValidatorContract.deployFrom0xArtifactAsync(
+ artifacts.OrderValidator,
+ provider,
+ txDefaults,
+ exchange.address,
+ zrxAssetData,
+ );
+
+ erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20Token.address);
+ erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, tokenId);
+ const defaultOrderParams = {
+ ...constants.STATIC_ORDER_PARAMS,
+ exchangeAddress: exchange.address,
+ makerAddress,
+ feeRecipientAddress: constants.NULL_ADDRESS,
+ makerAssetData: erc20AssetData,
+ takerAssetData: erc721AssetData,
+ };
+ const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
+ orderFactory = new OrderFactory(privateKey, defaultOrderParams);
+ });
+
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('getBalanceAndAllowance', () => {
+ describe('getERC721TokenOwner', async () => {
+ it('should return the null address when tokenId is not owned', async () => {
+ const tokenOwner = await orderValidator.getERC721TokenOwner.callAsync(makerAddress, tokenId);
+ expect(tokenOwner).to.be.equal(constants.NULL_ADDRESS);
+ });
+ it('should return the owner address when tokenId is owned', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const tokenOwner = await orderValidator.getERC721TokenOwner.callAsync(erc721Token.address, tokenId);
+ expect(tokenOwner).to.be.equal(makerAddress);
+ });
+ });
+ describe('ERC20 assetData', () => {
+ it('should return the correct balances and allowances when both values are 0', async () => {
+ const [newBalance, newAllowance] = await orderValidator.getBalanceAndAllowance.callAsync(
+ makerAddress,
+ erc20AssetData,
+ );
+ expect(constants.ZERO_AMOUNT).to.be.bignumber.equal(newBalance);
+ expect(constants.ZERO_AMOUNT).to.be.bignumber.equal(newAllowance);
+ });
+ it('should return the correct balance and allowance when both values are non-zero', async () => {
+ const balance = new BigNumber(123);
+ const allowance = new BigNumber(456);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.setBalance.sendTransactionAsync(makerAddress, balance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, allowance, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const [newBalance, newAllowance] = await orderValidator.getBalanceAndAllowance.callAsync(
+ makerAddress,
+ erc20AssetData,
+ );
+ expect(balance).to.be.bignumber.equal(newBalance);
+ expect(allowance).to.be.bignumber.equal(newAllowance);
+ });
+ });
+ describe('ERC721 assetData', () => {
+ it('should return a balance of 0 when the tokenId is not owned by target', async () => {
+ const [newBalance] = await orderValidator.getBalanceAndAllowance.callAsync(
+ makerAddress,
+ erc721AssetData,
+ );
+ expect(newBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should return an allowance of 0 when no approval is set', async () => {
+ const [, newAllowance] = await orderValidator.getBalanceAndAllowance.callAsync(
+ makerAddress,
+ erc721AssetData,
+ );
+ expect(newAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should return a balance of 1 when the tokenId is owned by target', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const [newBalance] = await orderValidator.getBalanceAndAllowance.callAsync(
+ makerAddress,
+ erc721AssetData,
+ );
+ expect(newBalance).to.be.bignumber.equal(ERC721_BALANCE);
+ });
+ it('should return an allowance of 1 when ERC721Proxy is approved for all', async () => {
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const [, newAllowance] = await orderValidator.getBalanceAndAllowance.callAsync(
+ makerAddress,
+ erc721AssetData,
+ );
+ expect(newAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
+ });
+ it('should return an allowance of 0 when ERC721Proxy is approved for specific tokenId', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const [, newAllowance] = await orderValidator.getBalanceAndAllowance.callAsync(
+ makerAddress,
+ erc721AssetData,
+ );
+ expect(newAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ });
+ });
+ describe('getBalancesAndAllowances', () => {
+ it('should return the correct balances and allowances when all values are 0', async () => {
+ const [
+ [erc20Balance, erc721Balance],
+ [erc20Allowance, erc721Allowance],
+ ] = await orderValidator.getBalancesAndAllowances.callAsync(makerAddress, [
+ erc20AssetData,
+ erc721AssetData,
+ ]);
+ expect(erc20Balance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(erc721Balance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(erc20Allowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(erc721Allowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should return the correct balances and allowances when balances and allowances are non-zero', async () => {
+ const balance = new BigNumber(123);
+ const allowance = new BigNumber(456);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.setBalance.sendTransactionAsync(makerAddress, balance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, allowance, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const [
+ [erc20Balance, erc721Balance],
+ [erc20Allowance, erc721Allowance],
+ ] = await orderValidator.getBalancesAndAllowances.callAsync(makerAddress, [
+ erc20AssetData,
+ erc721AssetData,
+ ]);
+ expect(erc20Balance).to.be.bignumber.equal(balance);
+ expect(erc721Balance).to.be.bignumber.equal(ERC721_BALANCE);
+ expect(erc20Allowance).to.be.bignumber.equal(allowance);
+ expect(erc721Allowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
+ });
+ });
+ describe('getTraderInfo', () => {
+ beforeEach(async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ });
+ it('should return the correct info when no balances or allowances are set', async () => {
+ const traderInfo = await orderValidator.getTraderInfo.callAsync(signedOrder, takerAddress);
+ expect(traderInfo.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should return the correct info when balances and allowances are set', async () => {
+ const makerBalance = new BigNumber(123);
+ const makerAllowance = new BigNumber(456);
+ const makerZrxBalance = new BigNumber(789);
+ const takerZrxAllowance = new BigNumber(987);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.setBalance.sendTransactionAsync(makerAddress, makerBalance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, makerAllowance, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.setBalance.sendTransactionAsync(makerAddress, makerZrxBalance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, takerZrxAllowance, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const traderInfo = await orderValidator.getTraderInfo.callAsync(signedOrder, takerAddress);
+ expect(traderInfo.makerBalance).to.be.bignumber.equal(makerBalance);
+ expect(traderInfo.makerAllowance).to.be.bignumber.equal(makerAllowance);
+ expect(traderInfo.takerBalance).to.be.bignumber.equal(ERC721_BALANCE);
+ expect(traderInfo.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
+ expect(traderInfo.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
+ expect(traderInfo.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
+ });
+ });
+ describe('getTradersInfo', () => {
+ beforeEach(async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ signedOrder2 = await orderFactory.newSignedOrderAsync({
+ takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, tokenId2),
+ });
+ });
+ it('should return the correct info when no balances or allowances have been set', async () => {
+ const orders = [signedOrder, signedOrder2];
+ const takers = [takerAddress, takerAddress];
+ const [traderInfo1, traderInfo2] = await orderValidator.getTradersInfo.callAsync(orders, takers);
+ expect(traderInfo1.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should return the correct info when balances and allowances are set', async () => {
+ const makerBalance = new BigNumber(123);
+ const makerAllowance = new BigNumber(456);
+ const makerZrxBalance = new BigNumber(789);
+ const takerZrxAllowance = new BigNumber(987);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.setBalance.sendTransactionAsync(makerAddress, makerBalance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, makerAllowance, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.setBalance.sendTransactionAsync(makerAddress, makerZrxBalance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, takerZrxAllowance, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId2),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const orders = [signedOrder, signedOrder2];
+ const takers = [takerAddress, takerAddress];
+ const [traderInfo1, traderInfo2] = await orderValidator.getTradersInfo.callAsync(orders, takers);
+
+ expect(traderInfo1.makerBalance).to.be.bignumber.equal(makerBalance);
+ expect(traderInfo1.makerAllowance).to.be.bignumber.equal(makerAllowance);
+ expect(traderInfo1.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
+ expect(traderInfo1.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
+ expect(traderInfo1.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
+ expect(traderInfo2.makerBalance).to.be.bignumber.equal(makerBalance);
+ expect(traderInfo2.makerAllowance).to.be.bignumber.equal(makerAllowance);
+ expect(traderInfo2.takerBalance).to.be.bignumber.equal(ERC721_BALANCE);
+ expect(traderInfo2.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
+ expect(traderInfo2.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
+ expect(traderInfo2.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
+ });
+ });
+ describe('getOrderAndTraderInfo', () => {
+ beforeEach(async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ });
+ it('should return the correct info when no balances or allowances are set', async () => {
+ const [orderInfo, traderInfo] = await orderValidator.getOrderAndTraderInfo.callAsync(
+ signedOrder,
+ takerAddress,
+ );
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should return the correct info when balances and allowances are set', async () => {
+ const makerBalance = new BigNumber(123);
+ const makerAllowance = new BigNumber(456);
+ const makerZrxBalance = new BigNumber(789);
+ const takerZrxAllowance = new BigNumber(987);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.setBalance.sendTransactionAsync(makerAddress, makerBalance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, makerAllowance, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.setBalance.sendTransactionAsync(makerAddress, makerZrxBalance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, takerZrxAllowance, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const [orderInfo, traderInfo] = await orderValidator.getOrderAndTraderInfo.callAsync(
+ signedOrder,
+ takerAddress,
+ );
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.makerBalance).to.be.bignumber.equal(makerBalance);
+ expect(traderInfo.makerAllowance).to.be.bignumber.equal(makerAllowance);
+ expect(traderInfo.takerBalance).to.be.bignumber.equal(ERC721_BALANCE);
+ expect(traderInfo.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
+ expect(traderInfo.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
+ expect(traderInfo.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
+ });
+ });
+ describe('getOrdersAndTradersInfo', () => {
+ beforeEach(async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ signedOrder2 = await orderFactory.newSignedOrderAsync({
+ takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, tokenId2),
+ });
+ });
+ it('should return the correct info when no balances or allowances have been set', async () => {
+ const orders = [signedOrder, signedOrder2];
+ const takers = [takerAddress, takerAddress];
+ const [
+ [orderInfo1, orderInfo2],
+ [traderInfo1, traderInfo2],
+ ] = await orderValidator.getOrdersAndTradersInfo.callAsync(orders, takers);
+ const expectedOrderHash1 = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedOrderHash2 = orderHashUtils.getOrderHashHex(signedOrder2);
+ expect(orderInfo1.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ expect(orderInfo1.orderHash).to.be.equal(expectedOrderHash1);
+ expect(orderInfo1.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(orderInfo2.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ expect(orderInfo2.orderHash).to.be.equal(expectedOrderHash2);
+ expect(orderInfo2.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ });
+ it('should return the correct info when balances and allowances are set', async () => {
+ const makerBalance = new BigNumber(123);
+ const makerAllowance = new BigNumber(456);
+ const makerZrxBalance = new BigNumber(789);
+ const takerZrxAllowance = new BigNumber(987);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.setBalance.sendTransactionAsync(makerAddress, makerBalance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, makerAllowance, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.setBalance.sendTransactionAsync(makerAddress, makerZrxBalance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, takerZrxAllowance, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId2),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const orders = [signedOrder, signedOrder2];
+ const takers = [takerAddress, takerAddress];
+ const [
+ [orderInfo1, orderInfo2],
+ [traderInfo1, traderInfo2],
+ ] = await orderValidator.getOrdersAndTradersInfo.callAsync(orders, takers);
+ const expectedOrderHash1 = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedOrderHash2 = orderHashUtils.getOrderHashHex(signedOrder2);
+ expect(orderInfo1.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ expect(orderInfo1.orderHash).to.be.equal(expectedOrderHash1);
+ expect(orderInfo1.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(orderInfo2.orderStatus).to.be.equal(OrderStatus.FILLABLE);
+ expect(orderInfo2.orderHash).to.be.equal(expectedOrderHash2);
+ expect(orderInfo2.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.makerBalance).to.be.bignumber.equal(makerBalance);
+ expect(traderInfo1.makerAllowance).to.be.bignumber.equal(makerAllowance);
+ expect(traderInfo1.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
+ expect(traderInfo1.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
+ expect(traderInfo1.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo1.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
+ expect(traderInfo2.makerBalance).to.be.bignumber.equal(makerBalance);
+ expect(traderInfo2.makerAllowance).to.be.bignumber.equal(makerAllowance);
+ expect(traderInfo2.takerBalance).to.be.bignumber.equal(ERC721_BALANCE);
+ expect(traderInfo2.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
+ expect(traderInfo2.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
+ expect(traderInfo2.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ expect(traderInfo2.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
+ });
+ });
+});
+// tslint:disable:max-file-line-count
diff --git a/contracts/extensions/test/global_hooks.ts b/contracts/extensions/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/extensions/test/global_hooks.ts
@@ -0,0 +1,17 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage, profiler, provider } from '@0x/contracts-test-utils';
+before('start web3 provider', () => {
+ provider.start();
+});
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+ provider.stop();
+});
diff --git a/contracts/extensions/test/utils/balance_threshold_wrapper.ts b/contracts/extensions/test/utils/balance_threshold_wrapper.ts
new file mode 100644
index 000000000..28a4ef011
--- /dev/null
+++ b/contracts/extensions/test/utils/balance_threshold_wrapper.ts
@@ -0,0 +1,283 @@
+import { artifacts as protocolArtifacts, ExchangeContract } from '@0x/contracts-protocol';
+import {
+ FillResults,
+ formatters,
+ LogDecoder,
+ OrderInfo,
+ orderUtils,
+ TransactionFactory,
+} from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { BalanceThresholdFilterContract } from '../../generated-wrappers/balance_threshold_filter';
+import { artifacts } from '../../src/artifacts';
+
+export class BalanceThresholdWrapper {
+ private readonly _balanceThresholdFilter: BalanceThresholdFilterContract;
+ private readonly _signerTransactionFactory: TransactionFactory;
+ private readonly _exchange: ExchangeContract;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _logDecoder: LogDecoder;
+ constructor(
+ balanceThresholdFilter: BalanceThresholdFilterContract,
+ exchangeContract: ExchangeContract,
+ signerTransactionFactory: TransactionFactory,
+ provider: Provider,
+ ) {
+ this._balanceThresholdFilter = balanceThresholdFilter;
+ this._exchange = exchangeContract;
+ this._signerTransactionFactory = signerTransactionFactory;
+ this._web3Wrapper = new Web3Wrapper(provider);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, {
+ ...artifacts,
+ ...tokensArtifacts,
+ ...protocolArtifacts,
+ });
+ }
+ public async fillOrderAsync(
+ signedOrder: SignedOrder,
+ from: string,
+ opts: { takerAssetFillAmount?: BigNumber } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
+ const data = this._exchange.fillOrder.getABIEncodedTransactionData(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from);
+ return txReceipt;
+ }
+ public async fillOrKillOrderAsync(
+ signedOrder: SignedOrder,
+ from: string,
+ opts: { takerAssetFillAmount?: BigNumber } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
+ const data = this._exchange.fillOrKillOrder.getABIEncodedTransactionData(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from);
+ return txReceipt;
+ }
+ public async fillOrderNoThrowAsync(
+ signedOrder: SignedOrder,
+ from: string,
+ opts: { takerAssetFillAmount?: BigNumber; gas?: number } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
+ const data = this._exchange.fillOrderNoThrow.getABIEncodedTransactionData(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from, opts.gas);
+ return txReceipt;
+ }
+ public async batchFillOrdersAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { takerAssetFillAmounts?: BigNumber[] } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
+ const data = this._exchange.batchFillOrders.getABIEncodedTransactionData(
+ params.orders,
+ params.takerAssetFillAmounts,
+ params.signatures,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from);
+ return txReceipt;
+ }
+ public async batchFillOrKillOrdersAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { takerAssetFillAmounts?: BigNumber[] } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
+ const data = this._exchange.batchFillOrKillOrders.getABIEncodedTransactionData(
+ params.orders,
+ params.takerAssetFillAmounts,
+ params.signatures,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from);
+ return txReceipt;
+ }
+ public async batchFillOrdersNoThrowAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { takerAssetFillAmounts?: BigNumber[]; gas?: number } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
+ const data = this._exchange.batchFillOrKillOrders.getABIEncodedTransactionData(
+ params.orders,
+ params.takerAssetFillAmounts,
+ params.signatures,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from, opts.gas);
+ return txReceipt;
+ }
+ public async marketSellOrdersAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { takerAssetFillAmount: BigNumber },
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount);
+ const data = this._exchange.marketSellOrders.getABIEncodedTransactionData(
+ params.orders,
+ params.takerAssetFillAmount,
+ params.signatures,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from);
+ return txReceipt;
+ }
+ public async marketSellOrdersNoThrowAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { takerAssetFillAmount: BigNumber; gas?: number },
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount);
+ const data = this._exchange.marketSellOrdersNoThrow.getABIEncodedTransactionData(
+ params.orders,
+ params.takerAssetFillAmount,
+ params.signatures,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from, opts.gas);
+ return txReceipt;
+ }
+ public async marketBuyOrdersAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { makerAssetFillAmount: BigNumber },
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
+ const data = this._exchange.marketBuyOrders.getABIEncodedTransactionData(
+ params.orders,
+ params.makerAssetFillAmount,
+ params.signatures,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from);
+ return txReceipt;
+ }
+ public async marketBuyOrdersNoThrowAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { makerAssetFillAmount: BigNumber; gas?: number },
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
+ const data = this._exchange.marketBuyOrdersNoThrow.getABIEncodedTransactionData(
+ params.orders,
+ params.makerAssetFillAmount,
+ params.signatures,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from, opts.gas);
+ return txReceipt;
+ }
+ public async cancelOrderAsync(signedOrder: SignedOrder, from: string): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createCancel(signedOrder);
+ const data = this._exchange.cancelOrder.getABIEncodedTransactionData(params.order);
+ const txReceipt = this._executeTransactionAsync(data, from);
+ return txReceipt;
+ }
+ public async batchCancelOrdersAsync(
+ orders: SignedOrder[],
+ from: string,
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createBatchCancel(orders);
+ const data = this._exchange.batchCancelOrders.getABIEncodedTransactionData(params.orders);
+ const txReceipt = this._executeTransactionAsync(data, from);
+ return txReceipt;
+ }
+ public async cancelOrdersUpToAsync(salt: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
+ const data = this._exchange.cancelOrdersUpTo.getABIEncodedTransactionData(salt);
+ const txReceipt = this._executeTransactionAsync(data, from);
+ return txReceipt;
+ }
+ public async getTakerAssetFilledAmountAsync(orderHashHex: string): Promise<BigNumber> {
+ const filledAmount = await this._exchange.filled.callAsync(orderHashHex);
+ return filledAmount;
+ }
+ public async isCancelledAsync(orderHashHex: string): Promise<boolean> {
+ const isCancelled = await this._exchange.cancelled.callAsync(orderHashHex);
+ return isCancelled;
+ }
+ public async getOrderEpochAsync(makerAddress: string, senderAddress: string): Promise<BigNumber> {
+ const orderEpoch = await this._exchange.orderEpoch.callAsync(makerAddress, senderAddress);
+ return orderEpoch;
+ }
+ public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> {
+ const orderInfo = await this._exchange.getOrderInfo.callAsync(signedOrder);
+ return orderInfo;
+ }
+ public async getOrdersInfoAsync(signedOrders: SignedOrder[]): Promise<OrderInfo[]> {
+ const ordersInfo = (await this._exchange.getOrdersInfo.callAsync(signedOrders)) as OrderInfo[];
+ return ordersInfo;
+ }
+ public async matchOrdersAsync(
+ signedOrderLeft: SignedOrder,
+ signedOrderRight: SignedOrder,
+ from: string,
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createMatchOrders(signedOrderLeft, signedOrderRight);
+ const data = await this._exchange.matchOrders.getABIEncodedTransactionData(
+ params.left,
+ params.right,
+ params.leftSignature,
+ params.rightSignature,
+ );
+ const txReceipt = this._executeTransactionAsync(data, from);
+ return txReceipt;
+ }
+ public async getFillOrderResultsAsync(
+ signedOrder: SignedOrder,
+ from: string,
+ opts: { takerAssetFillAmount?: BigNumber } = {},
+ ): Promise<FillResults> {
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
+ const fillResults = await this._exchange.fillOrder.callAsync(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ { from },
+ );
+ return fillResults;
+ }
+ public abiEncodeFillOrder(signedOrder: SignedOrder, opts: { takerAssetFillAmount?: BigNumber } = {}): string {
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
+ const data = this._exchange.fillOrder.getABIEncodedTransactionData(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ );
+ return data;
+ }
+ public getBalanceThresholdAddress(): string {
+ return this._balanceThresholdFilter.address;
+ }
+ public getExchangeAddress(): string {
+ return this._exchange.address;
+ }
+ private async _executeTransactionAsync(
+ abiEncodedExchangeTxData: string,
+ from: string,
+ gas?: number,
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const signedExchangeTx = this._signerTransactionFactory.newSignedTransaction(abiEncodedExchangeTxData);
+ const txOpts = _.isUndefined(gas) ? { from } : { from, gas };
+ const txHash = await this._balanceThresholdFilter.executeTransaction.sendTransactionAsync(
+ signedExchangeTx.salt,
+ signedExchangeTx.signerAddress,
+ signedExchangeTx.data,
+ signedExchangeTx.signature,
+ txOpts,
+ );
+ const txReceipt = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return txReceipt;
+ }
+}
diff --git a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts
new file mode 100644
index 000000000..c1e2f2070
--- /dev/null
+++ b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts
@@ -0,0 +1,62 @@
+import { artifacts as protocolArtifacts } from '@0x/contracts-protocol';
+import { LogDecoder } from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
+import { DutchAuctionDetails, SignedOrder } from '@0x/types';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
+import { artifacts } from '../../src/artifacts';
+
+export class DutchAuctionTestWrapper {
+ private readonly _dutchAuctionContract: DutchAuctionContract;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _logDecoder: LogDecoder;
+
+ constructor(contractInstance: DutchAuctionContract, provider: Provider) {
+ this._dutchAuctionContract = contractInstance;
+ this._web3Wrapper = new Web3Wrapper(provider);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, {
+ ...artifacts,
+ ...tokensArtifacts,
+ ...protocolArtifacts,
+ });
+ }
+ /**
+ * Matches the buy and sell orders at an amount given the following: the current block time, the auction
+ * start time and the auction begin amount. The sell order is a an order at the lowest amount
+ * at the end of the auction. Excess from the match is transferred to the seller.
+ * Over time the price moves from beginAmount to endAmount given the current block.timestamp.
+ * @param buyOrder The Buyer's order. This order is for the current expected price of the auction.
+ * @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
+ * @param from Address the transaction is being sent from.
+ * @return Transaction receipt with decoded logs.
+ */
+ public async matchOrdersAsync(
+ buyOrder: SignedOrder,
+ sellOrder: SignedOrder,
+ from: string,
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._dutchAuctionContract.matchOrders.sendTransactionAsync(
+ buyOrder,
+ sellOrder,
+ buyOrder.signature,
+ sellOrder.signature,
+ {
+ from,
+ },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ /**
+ * Calculates the Auction Details for the given order
+ * @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
+ * @return The dutch auction details.
+ */
+ public async getAuctionDetailsAsync(sellOrder: SignedOrder): Promise<DutchAuctionDetails> {
+ const auctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
+ return auctionDetails;
+ }
+}
diff --git a/contracts/extensions/test/utils/forwarder_wrapper.ts b/contracts/extensions/test/utils/forwarder_wrapper.ts
new file mode 100644
index 000000000..9e44ff6b9
--- /dev/null
+++ b/contracts/extensions/test/utils/forwarder_wrapper.ts
@@ -0,0 +1,124 @@
+import { artifacts as protocolArtifacts } from '@0x/contracts-protocol';
+import { constants, formatters, LogDecoder, MarketSellOrders } from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import { Provider, TransactionReceiptWithDecodedLogs, TxDataPayable } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { ForwarderContract } from '../../generated-wrappers/forwarder';
+import { artifacts } from '../../src/artifacts';
+
+export class ForwarderWrapper {
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _forwarderContract: ForwarderContract;
+ private readonly _logDecoder: LogDecoder;
+ public static getPercentageOfValue(value: BigNumber, percentage: number): BigNumber {
+ const numerator = constants.PERCENTAGE_DENOMINATOR.times(percentage).dividedToIntegerBy(100);
+ const newValue = value.times(numerator).dividedToIntegerBy(constants.PERCENTAGE_DENOMINATOR);
+ return newValue;
+ }
+ public static getWethForFeeOrders(feeAmount: BigNumber, feeOrders: SignedOrder[]): BigNumber {
+ let wethAmount = new BigNumber(0);
+ let remainingFeeAmount = feeAmount;
+ _.forEach(feeOrders, feeOrder => {
+ const feeAvailable = feeOrder.makerAssetAmount.minus(feeOrder.takerFee);
+ if (!remainingFeeAmount.isZero() && feeAvailable.gt(remainingFeeAmount)) {
+ wethAmount = wethAmount.plus(
+ feeOrder.takerAssetAmount
+ .times(remainingFeeAmount)
+ .dividedBy(feeAvailable)
+ .ceil(),
+ );
+ remainingFeeAmount = new BigNumber(0);
+ } else if (!remainingFeeAmount.isZero()) {
+ wethAmount = wethAmount.plus(feeOrder.takerAssetAmount);
+ remainingFeeAmount = remainingFeeAmount.minus(feeAvailable);
+ }
+ });
+ return wethAmount;
+ }
+ private static _createOptimizedOrders(signedOrders: SignedOrder[]): MarketSellOrders {
+ _.forEach(signedOrders, (signedOrder, index) => {
+ signedOrder.takerAssetData = constants.NULL_BYTES;
+ if (index > 0) {
+ signedOrder.makerAssetData = constants.NULL_BYTES;
+ }
+ });
+ const params = formatters.createMarketSellOrders(signedOrders, constants.ZERO_AMOUNT);
+ return params;
+ }
+ private static _createOptimizedZrxOrders(signedOrders: SignedOrder[]): MarketSellOrders {
+ _.forEach(signedOrders, signedOrder => {
+ signedOrder.makerAssetData = constants.NULL_BYTES;
+ signedOrder.takerAssetData = constants.NULL_BYTES;
+ });
+ const params = formatters.createMarketSellOrders(signedOrders, constants.ZERO_AMOUNT);
+ return params;
+ }
+ constructor(contractInstance: ForwarderContract, provider: Provider) {
+ this._forwarderContract = contractInstance;
+ this._web3Wrapper = new Web3Wrapper(provider);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, {
+ ...artifacts,
+ ...tokensArtifacts,
+ ...protocolArtifacts,
+ });
+ }
+ public async marketSellOrdersWithEthAsync(
+ orders: SignedOrder[],
+ feeOrders: SignedOrder[],
+ txData: TxDataPayable,
+ opts: { feePercentage?: BigNumber; feeRecipient?: string } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = ForwarderWrapper._createOptimizedOrders(orders);
+ const feeParams = ForwarderWrapper._createOptimizedZrxOrders(feeOrders);
+ const feePercentage = _.isUndefined(opts.feePercentage) ? constants.ZERO_AMOUNT : opts.feePercentage;
+ const feeRecipient = _.isUndefined(opts.feeRecipient) ? constants.NULL_ADDRESS : opts.feeRecipient;
+ const txHash = await this._forwarderContract.marketSellOrdersWithEth.sendTransactionAsync(
+ params.orders,
+ params.signatures,
+ feeParams.orders,
+ feeParams.signatures,
+ feePercentage,
+ feeRecipient,
+ txData,
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async marketBuyOrdersWithEthAsync(
+ orders: SignedOrder[],
+ feeOrders: SignedOrder[],
+ makerAssetFillAmount: BigNumber,
+ txData: TxDataPayable,
+ opts: { feePercentage?: BigNumber; feeRecipient?: string } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = ForwarderWrapper._createOptimizedOrders(orders);
+ const feeParams = ForwarderWrapper._createOptimizedZrxOrders(feeOrders);
+ const feePercentage = _.isUndefined(opts.feePercentage) ? constants.ZERO_AMOUNT : opts.feePercentage;
+ const feeRecipient = _.isUndefined(opts.feeRecipient) ? constants.NULL_ADDRESS : opts.feeRecipient;
+ const txHash = await this._forwarderContract.marketBuyOrdersWithEth.sendTransactionAsync(
+ params.orders,
+ makerAssetFillAmount,
+ params.signatures,
+ feeParams.orders,
+ feeParams.signatures,
+ feePercentage,
+ feeRecipient,
+ txData,
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async withdrawAssetAsync(
+ assetData: string,
+ amount: BigNumber,
+ txData: TxDataPayable,
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._forwarderContract.withdrawAsset.sendTransactionAsync(assetData, amount, txData);
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+}
diff --git a/contracts/extensions/tsconfig.json b/contracts/extensions/tsconfig.json
new file mode 100644
index 000000000..ed9b4fbe1
--- /dev/null
+++ b/contracts/extensions/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/BalanceThresholdFilter.json",
+ "./generated-artifacts/DutchAuction.json",
+ "./generated-artifacts/Forwarder.json",
+ "./generated-artifacts/OrderMatcher.json",
+ "./generated-artifacts/OrderValidator.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/extensions/tslint.json b/contracts/extensions/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/extensions/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/interfaces/CHANGELOG.json b/contracts/interfaces/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/interfaces/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/interfaces/CHANGELOG.md b/contracts/interfaces/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/interfaces/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/interfaces/README.md b/contracts/interfaces/README.md
new file mode 100644
index 000000000..b7d519abb
--- /dev/null
+++ b/contracts/interfaces/README.md
@@ -0,0 +1,72 @@
+## Contract interfaces
+
+Smart contract interfaces of the 0x protocol.
+
+## Usage
+
+Contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+
+* [protocol](./contracts/protocol)
+ * This directory contains the contract interfaces that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
+
+## Bug bounty
+
+A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-interfaces yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-interfaces yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/interfaces/compiler.json b/contracts/interfaces/compiler.json
new file mode 100644
index 000000000..38a232541
--- /dev/null
+++ b/contracts/interfaces/compiler.json
@@ -0,0 +1,35 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": [
+ "IAssetData",
+ "IAssetProxy",
+ "IAuthorizable",
+ "IAssetProxyDispatcher",
+ "IExchange",
+ "IExchangeCore",
+ "IMatchOrders",
+ "ISignatureValidator",
+ "ITransactions",
+ "IValidator",
+ "IWallet",
+ "IWrapperFunctions"
+ ]
+}
diff --git a/contracts/interfaces/contracts/protocol/AssetProxy/IAssetData.sol b/contracts/interfaces/contracts/protocol/AssetProxy/IAssetData.sol
new file mode 100644
index 000000000..a130e615f
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/AssetProxy/IAssetData.sol
@@ -0,0 +1,44 @@
+/*
+
+ 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.
+
+*/
+
+// solhint-disable
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+
+// @dev Interface of the asset proxy's assetData.
+// The asset proxies take an ABI encoded `bytes assetData` as argument.
+// This argument is ABI encoded as one of the methods of this interface.
+interface IAssetData {
+
+ function ERC20Token(address tokenContract)
+ external;
+
+ function ERC721Token(
+ address tokenContract,
+ uint256 tokenId
+ )
+ external;
+
+ function MultiAsset(
+ uint256[] amounts,
+ bytes[] nestedAssetData
+ )
+ external;
+
+}
diff --git a/contracts/interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol b/contracts/interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol
new file mode 100644
index 000000000..706412dd0
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol
@@ -0,0 +1,46 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "./IAuthorizable.sol";
+
+
+contract IAssetProxy is
+ IAuthorizable
+{
+ /// @dev Transfers assets. Either succeeds or throws.
+ /// @param assetData Byte array encoded for the respective asset proxy.
+ /// @param from Address to transfer asset from.
+ /// @param to Address to transfer asset to.
+ /// @param amount Amount of asset to transfer.
+ function transferFrom(
+ bytes assetData,
+ address from,
+ address to,
+ uint256 amount
+ )
+ external;
+
+ /// @dev Gets the proxy id associated with the proxy address.
+ /// @return Proxy id.
+ function getProxyId()
+ external
+ pure
+ returns (bytes4);
+}
diff --git a/contracts/interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol b/contracts/interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol
new file mode 100644
index 000000000..202173998
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol
@@ -0,0 +1,52 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/Ownable/IOwnable.sol";
+
+
+contract IAuthorizable is
+ IOwnable
+{
+ /// @dev Authorizes an address.
+ /// @param target Address to authorize.
+ function addAuthorizedAddress(address target)
+ external;
+
+ /// @dev Removes authorizion of an address.
+ /// @param target Address to remove authorization from.
+ function removeAuthorizedAddress(address target)
+ external;
+
+ /// @dev Removes authorizion of an address.
+ /// @param target Address to remove authorization from.
+ /// @param index Index of target in authorities array.
+ function removeAuthorizedAddressAtIndex(
+ address target,
+ uint256 index
+ )
+ external;
+
+ /// @dev Gets all authorized addresses.
+ /// @return Array of authorized addresses.
+ function getAuthorizedAddresses()
+ external
+ view
+ returns (address[] memory);
+}
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol b/contracts/interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol
new file mode 100644
index 000000000..b73881c07
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol
@@ -0,0 +1,37 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract IAssetProxyDispatcher {
+
+ /// @dev Registers an asset proxy to its asset proxy id.
+ /// Once an asset proxy is registered, it cannot be unregistered.
+ /// @param assetProxy Address of new asset proxy to register.
+ function registerAssetProxy(address assetProxy)
+ external;
+
+ /// @dev Gets an asset proxy.
+ /// @param assetProxyId Id of the asset proxy.
+ /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.
+ function getAssetProxy(bytes4 assetProxyId)
+ external
+ view
+ returns (address);
+}
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IExchange.sol b/contracts/interfaces/contracts/protocol/Exchange/IExchange.sol
new file mode 100644
index 000000000..866e4c194
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/Exchange/IExchange.sol
@@ -0,0 +1,38 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "./IExchangeCore.sol";
+import "./IMatchOrders.sol";
+import "./ISignatureValidator.sol";
+import "./ITransactions.sol";
+import "./IAssetProxyDispatcher.sol";
+import "./IWrapperFunctions.sol";
+
+
+// solhint-disable no-empty-blocks
+contract IExchange is
+ IExchangeCore,
+ IMatchOrders,
+ ISignatureValidator,
+ ITransactions,
+ IAssetProxyDispatcher,
+ IWrapperFunctions
+{}
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IExchangeCore.sol b/contracts/interfaces/contracts/protocol/Exchange/IExchangeCore.sol
new file mode 100644
index 000000000..ab4a62408
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/Exchange/IExchangeCore.sol
@@ -0,0 +1,60 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+
+
+contract IExchangeCore {
+
+ /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch
+ /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).
+ /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
+ function cancelOrdersUpTo(uint256 targetOrderEpoch)
+ external;
+
+ /// @dev Fills the input order.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ /// @return Amounts filled and fees paid by maker and taker.
+ function fillOrder(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ public
+ returns (LibFillResults.FillResults memory fillResults);
+
+ /// @dev After calling, the order can not be filled anymore.
+ /// @param order Order struct containing order specifications.
+ function cancelOrder(LibOrder.Order memory order)
+ public;
+
+ /// @dev Gets information about an order: status, hash, and amount filled.
+ /// @param order Order to gather information on.
+ /// @return OrderInfo Information about the order and its state.
+ /// See LibOrder.OrderInfo for a complete description.
+ function getOrderInfo(LibOrder.Order memory order)
+ public
+ view
+ returns (LibOrder.OrderInfo memory orderInfo);
+}
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IMatchOrders.sol b/contracts/interfaces/contracts/protocol/Exchange/IMatchOrders.sol
new file mode 100644
index 000000000..5df46ea80
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/Exchange/IMatchOrders.sol
@@ -0,0 +1,44 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+
+
+contract IMatchOrders {
+
+ /// @dev Match two complementary orders that have a profitable spread.
+ /// Each order is filled at their respective price point. However, the calculations are
+ /// carried out as though the orders are both being filled at the right order's price point.
+ /// The profit made by the left order goes to the taker (who matched the two orders).
+ /// @param leftOrder First order to match.
+ /// @param rightOrder Second order to match.
+ /// @param leftSignature Proof that order was created by the left maker.
+ /// @param rightSignature Proof that order was created by the right maker.
+ /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.
+ function matchOrders(
+ LibOrder.Order memory leftOrder,
+ LibOrder.Order memory rightOrder,
+ bytes memory leftSignature,
+ bytes memory rightSignature
+ )
+ public
+ returns (LibFillResults.MatchedFillResults memory matchedFillResults);
+}
diff --git a/contracts/interfaces/contracts/protocol/Exchange/ISignatureValidator.sol b/contracts/interfaces/contracts/protocol/Exchange/ISignatureValidator.sol
new file mode 100644
index 000000000..c5a4a57e1
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/Exchange/ISignatureValidator.sol
@@ -0,0 +1,57 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract ISignatureValidator {
+
+ /// @dev Approves a hash on-chain using any valid signature type.
+ /// After presigning a hash, the preSign signature type will become valid for that hash and signer.
+ /// @param signerAddress Address that should have signed the given hash.
+ /// @param signature Proof that the hash has been signed by signer.
+ function preSign(
+ bytes32 hash,
+ address signerAddress,
+ bytes signature
+ )
+ external;
+
+ /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.
+ /// @param validatorAddress Address of Validator contract.
+ /// @param approval Approval or disapproval of Validator contract.
+ function setSignatureValidatorApproval(
+ address validatorAddress,
+ bool approval
+ )
+ external;
+
+ /// @dev Verifies that a signature is valid.
+ /// @param hash Message hash that is signed.
+ /// @param signerAddress Address of signer.
+ /// @param signature Proof of signing.
+ /// @return Validity of order signature.
+ function isValidSignature(
+ bytes32 hash,
+ address signerAddress,
+ bytes memory signature
+ )
+ public
+ view
+ returns (bool isValid);
+}
diff --git a/contracts/interfaces/contracts/protocol/Exchange/ITransactions.sol b/contracts/interfaces/contracts/protocol/Exchange/ITransactions.sol
new file mode 100644
index 000000000..aaaee389f
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/Exchange/ITransactions.sol
@@ -0,0 +1,35 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+pragma solidity ^0.4.24;
+
+
+contract ITransactions {
+
+ /// @dev Executes an exchange method call in the context of signer.
+ /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
+ /// @param signerAddress Address of transaction signer.
+ /// @param data AbiV2 encoded calldata.
+ /// @param signature Proof of signer transaction by signer.
+ function executeTransaction(
+ uint256 salt,
+ address signerAddress,
+ bytes data,
+ bytes signature
+ )
+ external;
+}
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IValidator.sol b/contracts/interfaces/contracts/protocol/Exchange/IValidator.sol
new file mode 100644
index 000000000..d214e54dd
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/Exchange/IValidator.sol
@@ -0,0 +1,37 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract IValidator {
+
+ /// @dev Verifies that a signature is valid.
+ /// @param hash Message hash that is signed.
+ /// @param signerAddress Address that should have signed the given hash.
+ /// @param signature Proof of signing.
+ /// @return Validity of order signature.
+ function isValidSignature(
+ bytes32 hash,
+ address signerAddress,
+ bytes signature
+ )
+ external
+ view
+ returns (bool isValid);
+}
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IWallet.sol b/contracts/interfaces/contracts/protocol/Exchange/IWallet.sol
new file mode 100644
index 000000000..c2db4a5b1
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/Exchange/IWallet.sol
@@ -0,0 +1,35 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract IWallet {
+
+ /// @dev Verifies that a signature is valid.
+ /// @param hash Message hash that is signed.
+ /// @param signature Proof of signing.
+ /// @return Validity of order signature.
+ function isValidSignature(
+ bytes32 hash,
+ bytes signature
+ )
+ external
+ view
+ returns (bool isValid);
+}
diff --git a/contracts/interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol b/contracts/interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol
new file mode 100644
index 000000000..0eeaa874b
--- /dev/null
+++ b/contracts/interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol
@@ -0,0 +1,160 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+
+
+contract IWrapperFunctions {
+
+ /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
+ /// @param order LibOrder.Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ function fillOrKillOrder(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ public
+ returns (LibFillResults.FillResults memory fillResults);
+
+ /// @dev Fills an order with specified parameters and ECDSA signature.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param order LibOrder.Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ /// @return Amounts filled and fees paid by maker and taker.
+ function fillOrderNoThrow(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ public
+ returns (LibFillResults.FillResults memory fillResults);
+
+ /// @dev Synchronously executes multiple calls of fillOrder.
+ /// @param orders Array of order specifications.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function batchFillOrders(
+ LibOrder.Order[] memory orders,
+ uint256[] memory takerAssetFillAmounts,
+ bytes[] memory signatures
+ )
+ public
+ returns (LibFillResults.FillResults memory totalFillResults);
+
+ /// @dev Synchronously executes multiple calls of fillOrKill.
+ /// @param orders Array of order specifications.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function batchFillOrKillOrders(
+ LibOrder.Order[] memory orders,
+ uint256[] memory takerAssetFillAmounts,
+ bytes[] memory signatures
+ )
+ public
+ returns (LibFillResults.FillResults memory totalFillResults);
+
+ /// @dev Fills an order with specified parameters and ECDSA signature.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param orders Array of order specifications.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function batchFillOrdersNoThrow(
+ LibOrder.Order[] memory orders,
+ uint256[] memory takerAssetFillAmounts,
+ bytes[] memory signatures
+ )
+ public
+ returns (LibFillResults.FillResults memory totalFillResults);
+
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.
+ /// @param orders Array of order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketSellOrders(
+ LibOrder.Order[] memory orders,
+ uint256 takerAssetFillAmount,
+ bytes[] memory signatures
+ )
+ public
+ returns (LibFillResults.FillResults memory totalFillResults);
+
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param orders Array of order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signatures Proofs that orders have been signed by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketSellOrdersNoThrow(
+ LibOrder.Order[] memory orders,
+ uint256 takerAssetFillAmount,
+ bytes[] memory signatures
+ )
+ public
+ returns (LibFillResults.FillResults memory totalFillResults);
+
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.
+ /// @param orders Array of order specifications.
+ /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
+ /// @param signatures Proofs that orders have been signed by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketBuyOrders(
+ LibOrder.Order[] memory orders,
+ uint256 makerAssetFillAmount,
+ bytes[] memory signatures
+ )
+ public
+ returns (LibFillResults.FillResults memory totalFillResults);
+
+ /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param orders Array of order specifications.
+ /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
+ /// @param signatures Proofs that orders have been signed by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketBuyOrdersNoThrow(
+ LibOrder.Order[] memory orders,
+ uint256 makerAssetFillAmount,
+ bytes[] memory signatures
+ )
+ public
+ returns (LibFillResults.FillResults memory totalFillResults);
+
+ /// @dev Synchronously cancels multiple orders in a single transaction.
+ /// @param orders Array of order specifications.
+ function batchCancelOrders(LibOrder.Order[] memory orders)
+ public;
+
+ /// @dev Fetches information for all passed in orders
+ /// @param orders Array of order specifications.
+ /// @return Array of OrderInfo instances that correspond to each order.
+ function getOrdersInfo(LibOrder.Order[] memory orders)
+ public
+ view
+ returns (LibOrder.OrderInfo[] memory);
+}
diff --git a/contracts/interfaces/package.json b/contracts/interfaces/package.json
new file mode 100644
index 000000000..15385a154
--- /dev/null
+++ b/contracts/interfaces/package.json
@@ -0,0 +1,57 @@
+{
+ "name": "@0x/contracts-interfaces",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract interfaces of 0x protocol",
+ "main": "lib/src/index.js",
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "compile": "sol-compiler",
+ "watch": "sol-compiler -w",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(IAssetData|IAssetProxy|IAuthorizable|IAssetProxyDispatcher|IExchange|IExchangeCore|IMatchOrders|ISignatureValidator|ITransactions|IValidator|IWallet|IWrapperFunctions).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/interfaces/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/tslint-config": "^2.0.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-libs": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/interfaces/src/artifacts/index.ts b/contracts/interfaces/src/artifacts/index.ts
new file mode 100644
index 000000000..5a2a37d8a
--- /dev/null
+++ b/contracts/interfaces/src/artifacts/index.ts
@@ -0,0 +1,29 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as IAssetData from '../../generated-artifacts/IAssetData.json';
+import * as IAssetProxy from '../../generated-artifacts/IAssetProxy.json';
+import * as IAssetProxyDispatcher from '../../generated-artifacts/IAssetProxyDispatcher.json';
+import * as IAuthorizable from '../../generated-artifacts/IAuthorizable.json';
+import * as IExchange from '../../generated-artifacts/IExchange.json';
+import * as IExchangeCore from '../../generated-artifacts/IExchangeCore.json';
+import * as IMatchOrders from '../../generated-artifacts/IMatchOrders.json';
+import * as ISignatureValidator from '../../generated-artifacts/ISignatureValidator.json';
+import * as ITransactions from '../../generated-artifacts/ITransactions.json';
+import * as IValidator from '../../generated-artifacts/IValidator.json';
+import * as IWallet from '../../generated-artifacts/IWallet.json';
+import * as IWrapperFunctions from '../../generated-artifacts/IWrapperFunctions.json';
+
+export const artifacts = {
+ IAssetProxyDispatcher: IAssetProxyDispatcher as ContractArtifact,
+ IAuthorizable: IAuthorizable as ContractArtifact,
+ IExchange: IExchange as ContractArtifact,
+ IExchangeCore: IExchangeCore as ContractArtifact,
+ IMatchOrders: IMatchOrders as ContractArtifact,
+ ISignatureValidator: ISignatureValidator as ContractArtifact,
+ ITransactions: ITransactions as ContractArtifact,
+ IWrapperFunctions: IWrapperFunctions as ContractArtifact,
+ IAssetData: IAssetData as ContractArtifact,
+ IAssetProxy: IAssetProxy as ContractArtifact,
+ IValidator: IValidator as ContractArtifact,
+ IWallet: IWallet as ContractArtifact,
+};
diff --git a/contracts/interfaces/src/index.ts b/contracts/interfaces/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/interfaces/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/interfaces/src/wrappers/index.ts b/contracts/interfaces/src/wrappers/index.ts
new file mode 100644
index 000000000..f7f72fada
--- /dev/null
+++ b/contracts/interfaces/src/wrappers/index.ts
@@ -0,0 +1,12 @@
+export * from '../../generated-wrappers/i_asset_data';
+export * from '../../generated-wrappers/i_asset_proxy';
+export * from '../../generated-wrappers/i_asset_proxy_dispatcher';
+export * from '../../generated-wrappers/i_exchange';
+export * from '../../generated-wrappers/i_exchange_core';
+export * from '../../generated-wrappers/i_match_orders';
+export * from '../../generated-wrappers/i_signature_validator';
+export * from '../../generated-wrappers/i_transactions';
+export * from '../../generated-wrappers/i_authorizable';
+export * from '../../generated-wrappers/i_wrapper_functions';
+export * from '../../generated-wrappers/i_validator';
+export * from '../../generated-wrappers/i_wallet';
diff --git a/contracts/interfaces/tsconfig.json b/contracts/interfaces/tsconfig.json
new file mode 100644
index 000000000..90b7d41bb
--- /dev/null
+++ b/contracts/interfaces/tsconfig.json
@@ -0,0 +1,24 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/IAssetData.json",
+ "./generated-artifacts/IAssetProxy.json",
+ "./generated-artifacts/IAuthorizable.json",
+ "./generated-artifacts/IAssetProxyDispatcher.json",
+ "./generated-artifacts/IExchange.json",
+ "./generated-artifacts/IExchangeCore.json",
+ "./generated-artifacts/IMatchOrders.json",
+ "./generated-artifacts/ISignatureValidator.json",
+ "./generated-artifacts/ITransactions.json",
+ "./generated-artifacts/IValidator.json",
+ "./generated-artifacts/IWallet.json",
+ "./generated-artifacts/IWrapperFunctions.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/interfaces/tslint.json b/contracts/interfaces/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/interfaces/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/libs/CHANGELOG.json b/contracts/libs/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/libs/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/libs/CHANGELOG.md b/contracts/libs/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/libs/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/libs/README.md b/contracts/libs/README.md
new file mode 100644
index 000000000..66eedf6be
--- /dev/null
+++ b/contracts/libs/README.md
@@ -0,0 +1,70 @@
+## Contracts libs
+
+Smart contracts libs used in the 0x protocol.
+
+## Usage
+
+Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+
+* [libs](./contracts/protocol)
+ * This directory contains the libs.
+* [test](./contracts/test)
+ * This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-libs yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-libs yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/libs/compiler.json b/contracts/libs/compiler.json
new file mode 100644
index 000000000..349d3063b
--- /dev/null
+++ b/contracts/libs/compiler.json
@@ -0,0 +1,31 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": [
+ "TestLibs",
+ "LibOrder",
+ "LibMath",
+ "LibFillResults",
+ "LibAbiEncoder",
+ "LibEIP712",
+ "LibAssetProxyErrors",
+ "LibConstants"
+ ]
+}
diff --git a/contracts/libs/contracts/libs/LibAbiEncoder.sol b/contracts/libs/contracts/libs/LibAbiEncoder.sol
new file mode 100644
index 000000000..5422bfeec
--- /dev/null
+++ b/contracts/libs/contracts/libs/LibAbiEncoder.sol
@@ -0,0 +1,215 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "./LibOrder.sol";
+
+
+contract LibAbiEncoder {
+
+ /// @dev ABI encodes calldata for `fillOrder`.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ /// @return ABI encoded calldata for `fillOrder`.
+ function abiEncodeFillOrder(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ internal
+ pure
+ returns (bytes memory fillOrderCalldata)
+ {
+ // We need to call MExchangeCore.fillOrder using a delegatecall in
+ // assembly so that we can intercept a call that throws. For this, we
+ // need the input encoded in memory in the Ethereum ABIv2 format [1].
+
+ // | Area | Offset | Length | Contents |
+ // | -------- |--------|---------|-------------------------------------------- |
+ // | Header | 0x00 | 4 | function selector |
+ // | Params | | 3 * 32 | function parameters: |
+ // | | 0x00 | | 1. offset to order (*) |
+ // | | 0x20 | | 2. takerAssetFillAmount |
+ // | | 0x40 | | 3. offset to signature (*) |
+ // | Data | | 12 * 32 | order: |
+ // | | 0x000 | | 1. senderAddress |
+ // | | 0x020 | | 2. makerAddress |
+ // | | 0x040 | | 3. takerAddress |
+ // | | 0x060 | | 4. feeRecipientAddress |
+ // | | 0x080 | | 5. makerAssetAmount |
+ // | | 0x0A0 | | 6. takerAssetAmount |
+ // | | 0x0C0 | | 7. makerFeeAmount |
+ // | | 0x0E0 | | 8. takerFeeAmount |
+ // | | 0x100 | | 9. expirationTimeSeconds |
+ // | | 0x120 | | 10. salt |
+ // | | 0x140 | | 11. Offset to makerAssetData (*) |
+ // | | 0x160 | | 12. Offset to takerAssetData (*) |
+ // | | 0x180 | 32 | makerAssetData Length |
+ // | | 0x1A0 | ** | makerAssetData Contents |
+ // | | 0x1C0 | 32 | takerAssetData Length |
+ // | | 0x1E0 | ** | takerAssetData Contents |
+ // | | 0x200 | 32 | signature Length |
+ // | | 0x220 | ** | signature Contents |
+
+ // * Offsets are calculated from the beginning of the current area: Header, Params, Data:
+ // An offset stored in the Params area is calculated from the beginning of the Params section.
+ // An offset stored in the Data area is calculated from the beginning of the Data section.
+
+ // ** The length of dynamic array contents are stored in the field immediately preceeding the contents.
+
+ // [1]: https://solidity.readthedocs.io/en/develop/abi-spec.html
+
+ assembly {
+
+ // Areas below may use the following variables:
+ // 1. <area>Start -- Start of this area in memory
+ // 2. <area>End -- End of this area in memory. This value may
+ // be precomputed (before writing contents),
+ // or it may be computed as contents are written.
+ // 3. <area>Offset -- Current offset into area. If an area's End
+ // is precomputed, this variable tracks the
+ // offsets of contents as they are written.
+
+ /////// Setup Header Area ///////
+ // Load free memory pointer
+ fillOrderCalldata := mload(0x40)
+ // bytes4(keccak256("fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"))
+ // = 0xb4be83d5
+ // Leave 0x20 bytes to store the length
+ mstore(add(fillOrderCalldata, 0x20), 0xb4be83d500000000000000000000000000000000000000000000000000000000)
+ let headerAreaEnd := add(fillOrderCalldata, 0x24)
+
+ /////// Setup Params Area ///////
+ // This area is preallocated and written to later.
+ // This is because we need to fill in offsets that have not yet been calculated.
+ let paramsAreaStart := headerAreaEnd
+ let paramsAreaEnd := add(paramsAreaStart, 0x60)
+ let paramsAreaOffset := paramsAreaStart
+
+ /////// Setup Data Area ///////
+ let dataAreaStart := paramsAreaEnd
+ let dataAreaEnd := dataAreaStart
+
+ // Offset from the source data we're reading from
+ let sourceOffset := order
+ // arrayLenBytes and arrayLenWords track the length of a dynamically-allocated bytes array.
+ let arrayLenBytes := 0
+ let arrayLenWords := 0
+
+ /////// Write order Struct ///////
+ // Write memory location of Order, relative to the start of the
+ // parameter list, then increment the paramsAreaOffset respectively.
+ mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))
+ paramsAreaOffset := add(paramsAreaOffset, 0x20)
+
+ // Write values for each field in the order
+ // It would be nice to use a loop, but we save on gas by writing
+ // the stores sequentially.
+ mstore(dataAreaEnd, mload(sourceOffset)) // makerAddress
+ mstore(add(dataAreaEnd, 0x20), mload(add(sourceOffset, 0x20))) // takerAddress
+ mstore(add(dataAreaEnd, 0x40), mload(add(sourceOffset, 0x40))) // feeRecipientAddress
+ mstore(add(dataAreaEnd, 0x60), mload(add(sourceOffset, 0x60))) // senderAddress
+ mstore(add(dataAreaEnd, 0x80), mload(add(sourceOffset, 0x80))) // makerAssetAmount
+ mstore(add(dataAreaEnd, 0xA0), mload(add(sourceOffset, 0xA0))) // takerAssetAmount
+ mstore(add(dataAreaEnd, 0xC0), mload(add(sourceOffset, 0xC0))) // makerFeeAmount
+ mstore(add(dataAreaEnd, 0xE0), mload(add(sourceOffset, 0xE0))) // takerFeeAmount
+ mstore(add(dataAreaEnd, 0x100), mload(add(sourceOffset, 0x100))) // expirationTimeSeconds
+ mstore(add(dataAreaEnd, 0x120), mload(add(sourceOffset, 0x120))) // salt
+ mstore(add(dataAreaEnd, 0x140), mload(add(sourceOffset, 0x140))) // Offset to makerAssetData
+ mstore(add(dataAreaEnd, 0x160), mload(add(sourceOffset, 0x160))) // Offset to takerAssetData
+ dataAreaEnd := add(dataAreaEnd, 0x180)
+ sourceOffset := add(sourceOffset, 0x180)
+
+ // Write offset to <order.makerAssetData>
+ mstore(add(dataAreaStart, mul(10, 0x20)), sub(dataAreaEnd, dataAreaStart))
+
+ // Calculate length of <order.makerAssetData>
+ sourceOffset := mload(add(order, 0x140)) // makerAssetData
+ arrayLenBytes := mload(sourceOffset)
+ sourceOffset := add(sourceOffset, 0x20)
+ arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)
+
+ // Write length of <order.makerAssetData>
+ mstore(dataAreaEnd, arrayLenBytes)
+ dataAreaEnd := add(dataAreaEnd, 0x20)
+
+ // Write contents of <order.makerAssetData>
+ for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {
+ mstore(dataAreaEnd, mload(sourceOffset))
+ dataAreaEnd := add(dataAreaEnd, 0x20)
+ sourceOffset := add(sourceOffset, 0x20)
+ }
+
+ // Write offset to <order.takerAssetData>
+ mstore(add(dataAreaStart, mul(11, 0x20)), sub(dataAreaEnd, dataAreaStart))
+
+ // Calculate length of <order.takerAssetData>
+ sourceOffset := mload(add(order, 0x160)) // takerAssetData
+ arrayLenBytes := mload(sourceOffset)
+ sourceOffset := add(sourceOffset, 0x20)
+ arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)
+
+ // Write length of <order.takerAssetData>
+ mstore(dataAreaEnd, arrayLenBytes)
+ dataAreaEnd := add(dataAreaEnd, 0x20)
+
+ // Write contents of <order.takerAssetData>
+ for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {
+ mstore(dataAreaEnd, mload(sourceOffset))
+ dataAreaEnd := add(dataAreaEnd, 0x20)
+ sourceOffset := add(sourceOffset, 0x20)
+ }
+
+ /////// Write takerAssetFillAmount ///////
+ mstore(paramsAreaOffset, takerAssetFillAmount)
+ paramsAreaOffset := add(paramsAreaOffset, 0x20)
+
+ /////// Write signature ///////
+ // Write offset to paramsArea
+ mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))
+
+ // Calculate length of signature
+ sourceOffset := signature
+ arrayLenBytes := mload(sourceOffset)
+ sourceOffset := add(sourceOffset, 0x20)
+ arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)
+
+ // Write length of signature
+ mstore(dataAreaEnd, arrayLenBytes)
+ dataAreaEnd := add(dataAreaEnd, 0x20)
+
+ // Write contents of signature
+ for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {
+ mstore(dataAreaEnd, mload(sourceOffset))
+ dataAreaEnd := add(dataAreaEnd, 0x20)
+ sourceOffset := add(sourceOffset, 0x20)
+ }
+
+ // Set length of calldata
+ mstore(fillOrderCalldata, sub(dataAreaEnd, add(fillOrderCalldata, 0x20)))
+
+ // Increment free memory pointer
+ mstore(0x40, dataAreaEnd)
+ }
+
+ return fillOrderCalldata;
+ }
+}
diff --git a/contracts/libs/contracts/libs/LibAddressArray.sol b/contracts/libs/contracts/libs/LibAddressArray.sol
new file mode 100644
index 000000000..997ce85fa
--- /dev/null
+++ b/contracts/libs/contracts/libs/LibAddressArray.sol
@@ -0,0 +1,84 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+
+
+library LibAddressArray {
+
+ /// @dev Append a new address to an array of addresses.
+ /// The `addressArray` may need to be reallocated to make space
+ /// for the new address. Because of this we return the resulting
+ /// memory location of `addressArray`.
+ /// @param addressToAppend Address to append.
+ /// @return Array of addresses: [... addressArray, addressToAppend]
+ function append(address[] memory addressArray, address addressToAppend)
+ internal pure
+ returns (address[])
+ {
+ // Get stats on address array and free memory
+ uint256 freeMemPtr = 0;
+ uint256 addressArrayBeginPtr = 0;
+ uint256 addressArrayEndPtr = 0;
+ uint256 addressArrayLength = addressArray.length;
+ uint256 addressArrayMemSizeInBytes = 32 + (32 * addressArrayLength);
+ assembly {
+ freeMemPtr := mload(0x40)
+ addressArrayBeginPtr := addressArray
+ addressArrayEndPtr := add(addressArray, addressArrayMemSizeInBytes)
+ }
+
+ // Cases for `freeMemPtr`:
+ // `freeMemPtr` == `addressArrayEndPtr`: Nothing occupies memory after `addressArray`
+ // `freeMemPtr` > `addressArrayEndPtr`: Some value occupies memory after `addressArray`
+ // `freeMemPtr` < `addressArrayEndPtr`: Memory has not been managed properly.
+ require(
+ freeMemPtr >= addressArrayEndPtr,
+ "INVALID_FREE_MEMORY_PTR"
+ );
+
+ // If free memory begins at the end of `addressArray`
+ // then we can append `addressToAppend` directly.
+ // Otherwise, we must copy the array to free memory
+ // before appending new values to it.
+ if (freeMemPtr > addressArrayEndPtr) {
+ LibBytes.memCopy(freeMemPtr, addressArrayBeginPtr, addressArrayMemSizeInBytes);
+ assembly {
+ addressArray := freeMemPtr
+ addressArrayBeginPtr := addressArray
+ }
+ }
+
+ // Append `addressToAppend`
+ addressArrayLength += 1;
+ addressArrayMemSizeInBytes += 32;
+ addressArrayEndPtr = addressArrayBeginPtr + addressArrayMemSizeInBytes;
+ freeMemPtr = addressArrayEndPtr;
+ assembly {
+ // Store new array length
+ mstore(addressArray, addressArrayLength)
+
+ // Update `freeMemPtr`
+ mstore(0x40, freeMemPtr)
+ }
+ addressArray[addressArrayLength - 1] = addressToAppend;
+ return addressArray;
+ }
+}
diff --git a/contracts/libs/contracts/libs/LibAssetProxyErrors.sol b/contracts/libs/contracts/libs/LibAssetProxyErrors.sol
new file mode 100644
index 000000000..96c48b5e3
--- /dev/null
+++ b/contracts/libs/contracts/libs/LibAssetProxyErrors.sol
@@ -0,0 +1,38 @@
+/*
+
+ 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.
+
+*/
+
+// solhint-disable
+pragma solidity ^0.4.24;
+
+
+/// @dev This contract documents the revert reasons used in the AssetProxy contracts.
+/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.
+contract LibAssetProxyErrors {
+
+ /// Authorizable errors ///
+ string constant SENDER_NOT_AUTHORIZED = "SENDER_NOT_AUTHORIZED"; // Sender not authorized to call this method.
+ string constant TARGET_NOT_AUTHORIZED = "TARGET_NOT_AUTHORIZED"; // Target address not authorized to call this method.
+ string constant TARGET_ALREADY_AUTHORIZED = "TARGET_ALREADY_AUTHORIZED"; // Target address must not already be authorized.
+ string constant INDEX_OUT_OF_BOUNDS = "INDEX_OUT_OF_BOUNDS"; // Specified array index is out of bounds.
+ string constant AUTHORIZED_ADDRESS_MISMATCH = "AUTHORIZED_ADDRESS_MISMATCH"; // Address at index does not match given target address.
+
+ /// Transfer errors ///
+ string constant INVALID_AMOUNT = "INVALID_AMOUNT"; // Transfer amount must equal 1.
+ string constant TRANSFER_FAILED = "TRANSFER_FAILED"; // Transfer failed.
+ string constant LENGTH_GREATER_THAN_131_REQUIRED = "LENGTH_GREATER_THAN_131_REQUIRED"; // Byte array must have a length greater than 0.
+}
diff --git a/contracts/libs/contracts/libs/LibConstants.sol b/contracts/libs/contracts/libs/LibConstants.sol
new file mode 100644
index 000000000..3efa3e1b3
--- /dev/null
+++ b/contracts/libs/contracts/libs/LibConstants.sol
@@ -0,0 +1,49 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+// solhint-disable max-line-length
+contract LibConstants {
+
+ // Asset data for ZRX token. Used for fee transfers.
+ // @TODO: Hardcode constant when we deploy. Currently
+ // not constant to make testing easier.
+
+ // The proxyId for ZRX_ASSET_DATA is bytes4(keccak256("ERC20Token(address)")) = 0xf47261b0
+
+ // Kovan ZRX address is 0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570.
+ // The ABI encoded proxyId and address is 0xf47261b00000000000000000000000006ff6c0ff1d68b964901f986d4c9fa3ac68346570
+ // bytes constant public ZRX_ASSET_DATA = "\xf4\x72\x61\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6f\xf6\xc0\xff\x1d\x68\xb9\x64\x90\x1f\x98\x6d\x4c\x9f\xa3\xac\x68\x34\x65\x70";
+
+ // Mainnet ZRX address is 0xe41d2489571d322189246dafa5ebde1f4699f498.
+ // The ABI encoded proxyId and address is 0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498
+ // bytes constant public ZRX_ASSET_DATA = "\xf4\x72\x61\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\x1d\x24\x89\x57\x1d\x32\x21\x89\x24\x6d\xaf\xa5\xeb\xde\x1f\x46\x99\xf4\x98";
+
+ // solhint-disable-next-line var-name-mixedcase
+ bytes public ZRX_ASSET_DATA;
+
+ // @TODO: Remove when we deploy.
+ constructor (bytes memory zrxAssetData)
+ public
+ {
+ ZRX_ASSET_DATA = zrxAssetData;
+ }
+}
+// solhint-enable max-line-length
diff --git a/contracts/libs/contracts/libs/LibEIP712.sol b/contracts/libs/contracts/libs/LibEIP712.sol
new file mode 100644
index 000000000..3a85ab3c0
--- /dev/null
+++ b/contracts/libs/contracts/libs/LibEIP712.sol
@@ -0,0 +1,87 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract LibEIP712 {
+
+ // EIP191 header for EIP712 prefix
+ string constant internal EIP191_HEADER = "\x19\x01";
+
+ // EIP712 Domain Name value
+ string constant internal EIP712_DOMAIN_NAME = "0x Protocol";
+
+ // EIP712 Domain Version value
+ string constant internal EIP712_DOMAIN_VERSION = "2";
+
+ // Hash of the EIP712 Domain Separator Schema
+ bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(
+ "EIP712Domain(",
+ "string name,",
+ "string version,",
+ "address verifyingContract",
+ ")"
+ ));
+
+ // Hash of the EIP712 Domain Separator data
+ // solhint-disable-next-line var-name-mixedcase
+ bytes32 public EIP712_DOMAIN_HASH;
+
+ constructor ()
+ public
+ {
+ EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(
+ EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,
+ keccak256(bytes(EIP712_DOMAIN_NAME)),
+ keccak256(bytes(EIP712_DOMAIN_VERSION)),
+ bytes32(address(this))
+ ));
+ }
+
+ /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.
+ /// @param hashStruct The EIP712 hash struct.
+ /// @return EIP712 hash applied to this EIP712 Domain.
+ function hashEIP712Message(bytes32 hashStruct)
+ internal
+ view
+ returns (bytes32 result)
+ {
+ bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;
+
+ // Assembly for more efficient computing:
+ // keccak256(abi.encodePacked(
+ // EIP191_HEADER,
+ // EIP712_DOMAIN_HASH,
+ // hashStruct
+ // ));
+
+ assembly {
+ // Load free memory pointer
+ let memPtr := mload(64)
+
+ mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header
+ mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash
+ mstore(add(memPtr, 34), hashStruct) // Hash of struct
+
+ // Compute hash
+ result := keccak256(memPtr, 66)
+ }
+ return result;
+ }
+}
diff --git a/contracts/libs/contracts/libs/LibExchangeErrors.sol b/contracts/libs/contracts/libs/LibExchangeErrors.sol
new file mode 100644
index 000000000..a160242c9
--- /dev/null
+++ b/contracts/libs/contracts/libs/LibExchangeErrors.sol
@@ -0,0 +1,70 @@
+/*
+
+ 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.
+
+*/
+
+// solhint-disable
+pragma solidity ^0.4.24;
+
+
+/// @dev This contract documents the revert reasons used in the Exchange contract.
+/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.
+contract LibExchangeErrors {
+
+ /// Order validation errors ///
+ string constant ORDER_UNFILLABLE = "ORDER_UNFILLABLE"; // Order cannot be filled.
+ string constant INVALID_MAKER = "INVALID_MAKER"; // Invalid makerAddress.
+ string constant INVALID_TAKER = "INVALID_TAKER"; // Invalid takerAddress.
+ string constant INVALID_SENDER = "INVALID_SENDER"; // Invalid `msg.sender`.
+ string constant INVALID_ORDER_SIGNATURE = "INVALID_ORDER_SIGNATURE"; // Signature validation failed.
+
+ /// fillOrder validation errors ///
+ string constant INVALID_TAKER_AMOUNT = "INVALID_TAKER_AMOUNT"; // takerAssetFillAmount cannot equal 0.
+ string constant ROUNDING_ERROR = "ROUNDING_ERROR"; // Rounding error greater than 0.1% of takerAssetFillAmount.
+
+ /// Signature validation errors ///
+ string constant INVALID_SIGNATURE = "INVALID_SIGNATURE"; // Signature validation failed.
+ string constant SIGNATURE_ILLEGAL = "SIGNATURE_ILLEGAL"; // Signature type is illegal.
+ string constant SIGNATURE_UNSUPPORTED = "SIGNATURE_UNSUPPORTED"; // Signature type unsupported.
+
+ /// cancelOrdersUptTo errors ///
+ string constant INVALID_NEW_ORDER_EPOCH = "INVALID_NEW_ORDER_EPOCH"; // Specified salt must be greater than or equal to existing orderEpoch.
+
+ /// fillOrKillOrder errors ///
+ string constant COMPLETE_FILL_FAILED = "COMPLETE_FILL_FAILED"; // Desired takerAssetFillAmount could not be completely filled.
+
+ /// matchOrders errors ///
+ string constant NEGATIVE_SPREAD_REQUIRED = "NEGATIVE_SPREAD_REQUIRED"; // Matched orders must have a negative spread.
+
+ /// Transaction errors ///
+ string constant REENTRANCY_ILLEGAL = "REENTRANCY_ILLEGAL"; // Recursive reentrancy is not allowed.
+ string constant INVALID_TX_HASH = "INVALID_TX_HASH"; // Transaction has already been executed.
+ string constant INVALID_TX_SIGNATURE = "INVALID_TX_SIGNATURE"; // Signature validation failed.
+ string constant FAILED_EXECUTION = "FAILED_EXECUTION"; // Transaction execution failed.
+
+ /// registerAssetProxy errors ///
+ string constant ASSET_PROXY_ALREADY_EXISTS = "ASSET_PROXY_ALREADY_EXISTS"; // AssetProxy with same id already exists.
+
+ /// dispatchTransferFrom errors ///
+ string constant ASSET_PROXY_DOES_NOT_EXIST = "ASSET_PROXY_DOES_NOT_EXIST"; // No assetProxy registered at given id.
+ string constant TRANSFER_FAILED = "TRANSFER_FAILED"; // Asset transfer unsuccesful.
+
+ /// Length validation errors ///
+ string constant LENGTH_GREATER_THAN_0_REQUIRED = "LENGTH_GREATER_THAN_0_REQUIRED"; // Byte array must have a length greater than 0.
+ string constant LENGTH_GREATER_THAN_3_REQUIRED = "LENGTH_GREATER_THAN_3_REQUIRED"; // Byte array must have a length greater than 3.
+ string constant LENGTH_0_REQUIRED = "LENGTH_0_REQUIRED"; // Byte array must have a length of 0.
+ string constant LENGTH_65_REQUIRED = "LENGTH_65_REQUIRED"; // Byte array must have a length of 65.
+}
diff --git a/contracts/libs/contracts/libs/LibExchangeSelectors.sol b/contracts/libs/contracts/libs/LibExchangeSelectors.sol
new file mode 100644
index 000000000..71640c609
--- /dev/null
+++ b/contracts/libs/contracts/libs/LibExchangeSelectors.sol
@@ -0,0 +1,152 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract LibExchangeSelectors {
+
+ // solhint-disable max-line-length
+ // allowedValidators
+ bytes4 constant public ALLOWED_VALIDATORS_SELECTOR = 0x7b8e3514;
+ bytes4 constant public ALLOWED_VALIDATORS_SELECTOR_GENERATOR = bytes4(keccak256("allowedValidators(address,address)"));
+
+ // assetProxies
+ bytes4 constant public ASSET_PROXIES_SELECTOR = 0x3fd3c997;
+ bytes4 constant public ASSET_PROXIES_SELECTOR_GENERATOR = bytes4(keccak256("assetProxies(bytes4)"));
+
+ // batchCancelOrders
+ bytes4 constant public BATCH_CANCEL_ORDERS_SELECTOR = 0x4ac14782;
+ bytes4 constant public BATCH_CANCEL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])"));
+
+ // batchFillOrKillOrders
+ bytes4 constant public BATCH_FILL_OR_KILL_ORDERS_SELECTOR = 0x4d0ae546;
+ bytes4 constant public BATCH_FILL_OR_KILL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])"));
+
+ // batchFillOrders
+ bytes4 constant public BATCH_FILL_ORDERS_SELECTOR = 0x297bb70b;
+ bytes4 constant public BATCH_FILL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])"));
+
+ // batchFillOrdersNoThrow
+ bytes4 constant public BATCH_FILL_ORDERS_NO_THROW_SELECTOR = 0x50dde190;
+ bytes4 constant public BATCH_FILL_ORDERS_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])"));
+
+ // cancelOrder
+ bytes4 constant public CANCEL_ORDER_SELECTOR = 0xd46b02c3;
+ bytes4 constant public CANCEL_ORDER_SELECTOR_GENERATOR = bytes4(keccak256("cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))"));
+
+ // cancelOrdersUpTo
+ bytes4 constant public CANCEL_ORDERS_UP_TO_SELECTOR = 0x4f9559b1;
+ bytes4 constant public CANCEL_ORDERS_UP_TO_SELECTOR_GENERATOR = bytes4(keccak256("cancelOrdersUpTo(uint256)"));
+
+ // cancelled
+ bytes4 constant public CANCELLED_SELECTOR = 0x2ac12622;
+ bytes4 constant public CANCELLED_SELECTOR_GENERATOR = bytes4(keccak256("cancelled(bytes32)"));
+
+ // currentContextAddress
+ bytes4 constant public CURRENT_CONTEXT_ADDRESS_SELECTOR = 0xeea086ba;
+ bytes4 constant public CURRENT_CONTEXT_ADDRESS_SELECTOR_GENERATOR = bytes4(keccak256("currentContextAddress()"));
+
+ // executeTransaction
+ bytes4 constant public EXECUTE_TRANSACTION_SELECTOR = 0xbfc8bfce;
+ bytes4 constant public EXECUTE_TRANSACTION_SELECTOR_GENERATOR = bytes4(keccak256("executeTransaction(uint256,address,bytes,bytes)"));
+
+ // fillOrKillOrder
+ bytes4 constant public FILL_OR_KILL_ORDER_SELECTOR = 0x64a3bc15;
+ bytes4 constant public FILL_OR_KILL_ORDER_SELECTOR_GENERATOR = bytes4(keccak256("fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"));
+
+ // fillOrder
+ bytes4 constant public FILL_ORDER_SELECTOR = 0xb4be83d5;
+ bytes4 constant public FILL_ORDER_SELECTOR_GENERATOR = bytes4(keccak256("fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"));
+
+ // fillOrderNoThrow
+ bytes4 constant public FILL_ORDER_NO_THROW_SELECTOR = 0x3e228bae;
+ bytes4 constant public FILL_ORDER_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"));
+
+ // filled
+ bytes4 constant public FILLED_SELECTOR = 0x288cdc91;
+ bytes4 constant public FILLED_SELECTOR_GENERATOR = bytes4(keccak256("filled(bytes32)"));
+
+ // getAssetProxy
+ bytes4 constant public GET_ASSET_PROXY_SELECTOR = 0x60704108;
+ bytes4 constant public GET_ASSET_PROXY_SELECTOR_GENERATOR = bytes4(keccak256("getAssetProxy(bytes4)"));
+
+ // getOrderInfo
+ bytes4 constant public GET_ORDER_INFO_SELECTOR = 0xc75e0a81;
+ bytes4 constant public GET_ORDER_INFO_SELECTOR_GENERATOR = bytes4(keccak256("getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))"));
+
+ // getOrdersInfo
+ bytes4 constant public GET_ORDERS_INFO_SELECTOR = 0x7e9d74dc;
+ bytes4 constant public GET_ORDERS_INFO_SELECTOR_GENERATOR = bytes4(keccak256("getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])"));
+
+ // isValidSignature
+ bytes4 constant public IS_VALID_SIGNATURE_SELECTOR = 0x93634702;
+ bytes4 constant public IS_VALID_SIGNATURE_SELECTOR_GENERATOR = bytes4(keccak256("isValidSignature(bytes32,address,bytes)"));
+
+ // marketBuyOrders
+ bytes4 constant public MARKET_BUY_ORDERS_SELECTOR = 0xe5fa431b;
+ bytes4 constant public MARKET_BUY_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
+
+ // marketBuyOrdersNoThrow
+ bytes4 constant public MARKET_BUY_ORDERS_NO_THROW_SELECTOR = 0xa3e20380;
+ bytes4 constant public MARKET_BUY_ORDERS_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
+
+ // marketSellOrders
+ bytes4 constant public MARKET_SELL_ORDERS_SELECTOR = 0x7e1d9808;
+ bytes4 constant public MARKET_SELL_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
+
+ // marketSellOrdersNoThrow
+ bytes4 constant public MARKET_SELL_ORDERS_NO_THROW_SELECTOR = 0xdd1c7d18;
+ bytes4 constant public MARKET_SELL_ORDERS_NO_THROW_SELECTOR_GENERATOR = bytes4(keccak256("marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])"));
+
+ // matchOrders
+ bytes4 constant public MATCH_ORDERS_SELECTOR = 0x3c28d861;
+ bytes4 constant public MATCH_ORDERS_SELECTOR_GENERATOR = bytes4(keccak256("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)"));
+
+ // orderEpoch
+ bytes4 constant public ORDER_EPOCH_SELECTOR = 0xd9bfa73e;
+ bytes4 constant public ORDER_EPOCH_SELECTOR_GENERATOR = bytes4(keccak256("orderEpoch(address,address)"));
+
+ // owner
+ bytes4 constant public OWNER_SELECTOR = 0x8da5cb5b;
+ bytes4 constant public OWNER_SELECTOR_GENERATOR = bytes4(keccak256("owner()"));
+
+ // preSign
+ bytes4 constant public PRE_SIGN_SELECTOR = 0x3683ef8e;
+ bytes4 constant public PRE_SIGN_SELECTOR_GENERATOR = bytes4(keccak256("preSign(bytes32,address,bytes)"));
+
+ // preSigned
+ bytes4 constant public PRE_SIGNED_SELECTOR = 0x82c174d0;
+ bytes4 constant public PRE_SIGNED_SELECTOR_GENERATOR = bytes4(keccak256("preSigned(bytes32,address)"));
+
+ // registerAssetProxy
+ bytes4 constant public REGISTER_ASSET_PROXY_SELECTOR = 0xc585bb93;
+ bytes4 constant public REGISTER_ASSET_PROXY_SELECTOR_GENERATOR = bytes4(keccak256("registerAssetProxy(address)"));
+
+ // setSignatureValidatorApproval
+ bytes4 constant public SET_SIGNATURE_VALIDATOR_APPROVAL_SELECTOR = 0x77fcce68;
+ bytes4 constant public SET_SIGNATURE_VALIDATOR_APPROVAL_SELECTOR_GENERATOR = bytes4(keccak256("setSignatureValidatorApproval(address,bool)"));
+
+ // transactions
+ bytes4 constant public TRANSACTIONS_SELECTOR = 0x642f2eaf;
+ bytes4 constant public TRANSACTIONS_SELECTOR_GENERATOR = bytes4(keccak256("transactions(bytes32)"));
+
+ // transferOwnership
+ bytes4 constant public TRANSFER_OWNERSHIP_SELECTOR = 0xf2fde38b;
+ bytes4 constant public TRANSFER_OWNERSHIP_SELECTOR_GENERATOR = bytes4(keccak256("transferOwnership(address)"));
+} \ No newline at end of file
diff --git a/contracts/libs/contracts/libs/LibFillResults.sol b/contracts/libs/contracts/libs/LibFillResults.sol
new file mode 100644
index 000000000..74b7f7984
--- /dev/null
+++ b/contracts/libs/contracts/libs/LibFillResults.sol
@@ -0,0 +1,53 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
+
+
+contract LibFillResults is
+ SafeMath
+{
+ struct FillResults {
+ uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.
+ uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.
+ uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).
+ uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).
+ }
+
+ struct MatchedFillResults {
+ FillResults left; // Amounts filled and fees paid of left order.
+ FillResults right; // Amounts filled and fees paid of right order.
+ uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker.
+ }
+
+ /// @dev Adds properties of both FillResults instances.
+ /// Modifies the first FillResults instance specified.
+ /// @param totalFillResults Fill results instance that will be added onto.
+ /// @param singleFillResults Fill results instance that will be added to totalFillResults.
+ function addFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)
+ internal
+ pure
+ {
+ totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);
+ totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);
+ totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);
+ totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);
+ }
+}
diff --git a/contracts/libs/contracts/libs/LibMath.sol b/contracts/libs/contracts/libs/LibMath.sol
new file mode 100644
index 000000000..f14b1b34d
--- /dev/null
+++ b/contracts/libs/contracts/libs/LibMath.sol
@@ -0,0 +1,253 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
+
+
+contract LibMath is
+ SafeMath
+{
+ /// @dev Calculates partial value given a numerator and denominator rounded down.
+ /// Reverts if rounding error is >= 0.1%
+ /// @param numerator Numerator.
+ /// @param denominator Denominator.
+ /// @param target Value to calculate partial of.
+ /// @return Partial value of target rounded down.
+ function safeGetPartialAmountFloor(
+ uint256 numerator,
+ uint256 denominator,
+ uint256 target
+ )
+ internal
+ pure
+ returns (uint256 partialAmount)
+ {
+ require(
+ denominator > 0,
+ "DIVISION_BY_ZERO"
+ );
+
+ require(
+ !isRoundingErrorFloor(
+ numerator,
+ denominator,
+ target
+ ),
+ "ROUNDING_ERROR"
+ );
+
+ partialAmount = safeDiv(
+ safeMul(numerator, target),
+ denominator
+ );
+ return partialAmount;
+ }
+
+ /// @dev Calculates partial value given a numerator and denominator rounded down.
+ /// Reverts if rounding error is >= 0.1%
+ /// @param numerator Numerator.
+ /// @param denominator Denominator.
+ /// @param target Value to calculate partial of.
+ /// @return Partial value of target rounded up.
+ function safeGetPartialAmountCeil(
+ uint256 numerator,
+ uint256 denominator,
+ uint256 target
+ )
+ internal
+ pure
+ returns (uint256 partialAmount)
+ {
+ require(
+ denominator > 0,
+ "DIVISION_BY_ZERO"
+ );
+
+ require(
+ !isRoundingErrorCeil(
+ numerator,
+ denominator,
+ target
+ ),
+ "ROUNDING_ERROR"
+ );
+
+ // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):
+ // ceil(a / b) = floor((a + b - 1) / b)
+ // To implement `ceil(a / b)` using safeDiv.
+ partialAmount = safeDiv(
+ safeAdd(
+ safeMul(numerator, target),
+ safeSub(denominator, 1)
+ ),
+ denominator
+ );
+ return partialAmount;
+ }
+
+ /// @dev Calculates partial value given a numerator and denominator rounded down.
+ /// @param numerator Numerator.
+ /// @param denominator Denominator.
+ /// @param target Value to calculate partial of.
+ /// @return Partial value of target rounded down.
+ function getPartialAmountFloor(
+ uint256 numerator,
+ uint256 denominator,
+ uint256 target
+ )
+ internal
+ pure
+ returns (uint256 partialAmount)
+ {
+ require(
+ denominator > 0,
+ "DIVISION_BY_ZERO"
+ );
+
+ partialAmount = safeDiv(
+ safeMul(numerator, target),
+ denominator
+ );
+ return partialAmount;
+ }
+
+ /// @dev Calculates partial value given a numerator and denominator rounded down.
+ /// @param numerator Numerator.
+ /// @param denominator Denominator.
+ /// @param target Value to calculate partial of.
+ /// @return Partial value of target rounded up.
+ function getPartialAmountCeil(
+ uint256 numerator,
+ uint256 denominator,
+ uint256 target
+ )
+ internal
+ pure
+ returns (uint256 partialAmount)
+ {
+ require(
+ denominator > 0,
+ "DIVISION_BY_ZERO"
+ );
+
+ // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):
+ // ceil(a / b) = floor((a + b - 1) / b)
+ // To implement `ceil(a / b)` using safeDiv.
+ partialAmount = safeDiv(
+ safeAdd(
+ safeMul(numerator, target),
+ safeSub(denominator, 1)
+ ),
+ denominator
+ );
+ return partialAmount;
+ }
+
+ /// @dev Checks if rounding error >= 0.1% when rounding down.
+ /// @param numerator Numerator.
+ /// @param denominator Denominator.
+ /// @param target Value to multiply with numerator/denominator.
+ /// @return Rounding error is present.
+ function isRoundingErrorFloor(
+ uint256 numerator,
+ uint256 denominator,
+ uint256 target
+ )
+ internal
+ pure
+ returns (bool isError)
+ {
+ require(
+ denominator > 0,
+ "DIVISION_BY_ZERO"
+ );
+
+ // The absolute rounding error is the difference between the rounded
+ // value and the ideal value. The relative rounding error is the
+ // absolute rounding error divided by the absolute value of the
+ // ideal value. This is undefined when the ideal value is zero.
+ //
+ // The ideal value is `numerator * target / denominator`.
+ // Let's call `numerator * target % denominator` the remainder.
+ // The absolute error is `remainder / denominator`.
+ //
+ // When the ideal value is zero, we require the absolute error to
+ // be zero. Fortunately, this is always the case. The ideal value is
+ // zero iff `numerator == 0` and/or `target == 0`. In this case the
+ // remainder and absolute error are also zero.
+ if (target == 0 || numerator == 0) {
+ return false;
+ }
+
+ // Otherwise, we want the relative rounding error to be strictly
+ // less than 0.1%.
+ // The relative error is `remainder / (numerator * target)`.
+ // We want the relative error less than 1 / 1000:
+ // remainder / (numerator * denominator) < 1 / 1000
+ // or equivalently:
+ // 1000 * remainder < numerator * target
+ // so we have a rounding error iff:
+ // 1000 * remainder >= numerator * target
+ uint256 remainder = mulmod(
+ target,
+ numerator,
+ denominator
+ );
+ isError = safeMul(1000, remainder) >= safeMul(numerator, target);
+ return isError;
+ }
+
+ /// @dev Checks if rounding error >= 0.1% when rounding up.
+ /// @param numerator Numerator.
+ /// @param denominator Denominator.
+ /// @param target Value to multiply with numerator/denominator.
+ /// @return Rounding error is present.
+ function isRoundingErrorCeil(
+ uint256 numerator,
+ uint256 denominator,
+ uint256 target
+ )
+ internal
+ pure
+ returns (bool isError)
+ {
+ require(
+ denominator > 0,
+ "DIVISION_BY_ZERO"
+ );
+
+ // See the comments in `isRoundingError`.
+ if (target == 0 || numerator == 0) {
+ // When either is zero, the ideal value and rounded value are zero
+ // and there is no rounding error. (Although the relative error
+ // is undefined.)
+ return false;
+ }
+ // Compute remainder as before
+ uint256 remainder = mulmod(
+ target,
+ numerator,
+ denominator
+ );
+ remainder = safeSub(denominator, remainder) % denominator;
+ isError = safeMul(1000, remainder) >= safeMul(numerator, target);
+ return isError;
+ }
+}
diff --git a/contracts/libs/contracts/libs/LibOrder.sol b/contracts/libs/contracts/libs/LibOrder.sol
new file mode 100644
index 000000000..fcf5da5fb
--- /dev/null
+++ b/contracts/libs/contracts/libs/LibOrder.sol
@@ -0,0 +1,145 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "./LibEIP712.sol";
+
+
+contract LibOrder is
+ LibEIP712
+{
+ // Hash for the EIP712 Order Schema
+ bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(
+ "Order(",
+ "address makerAddress,",
+ "address takerAddress,",
+ "address feeRecipientAddress,",
+ "address senderAddress,",
+ "uint256 makerAssetAmount,",
+ "uint256 takerAssetAmount,",
+ "uint256 makerFee,",
+ "uint256 takerFee,",
+ "uint256 expirationTimeSeconds,",
+ "uint256 salt,",
+ "bytes makerAssetData,",
+ "bytes takerAssetData",
+ ")"
+ ));
+
+ // A valid order remains fillable until it is expired, fully filled, or cancelled.
+ // An order's state is unaffected by external factors, like account balances.
+ enum OrderStatus {
+ INVALID, // Default value
+ INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount
+ INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount
+ FILLABLE, // Order is fillable
+ EXPIRED, // Order has already expired
+ FULLY_FILLED, // Order is fully filled
+ CANCELLED // Order has been cancelled
+ }
+
+ // solhint-disable max-line-length
+ struct Order {
+ address makerAddress; // Address that created the order.
+ address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order.
+ address feeRecipientAddress; // Address that will recieve fees when order is filled.
+ address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.
+ uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0.
+ uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0.
+ uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.
+ uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.
+ uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires.
+ uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash.
+ bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.
+ bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.
+ }
+ // solhint-enable max-line-length
+
+ struct OrderInfo {
+ uint8 orderStatus; // Status that describes order's validity and fillability.
+ bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash).
+ uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled.
+ }
+
+ /// @dev Calculates Keccak-256 hash of the order.
+ /// @param order The order structure.
+ /// @return Keccak-256 EIP712 hash of the order.
+ function getOrderHash(Order memory order)
+ internal
+ view
+ returns (bytes32 orderHash)
+ {
+ orderHash = hashEIP712Message(hashOrder(order));
+ return orderHash;
+ }
+
+ /// @dev Calculates EIP712 hash of the order.
+ /// @param order The order structure.
+ /// @return EIP712 hash of the order.
+ function hashOrder(Order memory order)
+ internal
+ pure
+ returns (bytes32 result)
+ {
+ bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;
+ bytes32 makerAssetDataHash = keccak256(order.makerAssetData);
+ bytes32 takerAssetDataHash = keccak256(order.takerAssetData);
+
+ // Assembly for more efficiently computing:
+ // keccak256(abi.encodePacked(
+ // EIP712_ORDER_SCHEMA_HASH,
+ // bytes32(order.makerAddress),
+ // bytes32(order.takerAddress),
+ // bytes32(order.feeRecipientAddress),
+ // bytes32(order.senderAddress),
+ // order.makerAssetAmount,
+ // order.takerAssetAmount,
+ // order.makerFee,
+ // order.takerFee,
+ // order.expirationTimeSeconds,
+ // order.salt,
+ // keccak256(order.makerAssetData),
+ // keccak256(order.takerAssetData)
+ // ));
+
+ assembly {
+ // Calculate memory addresses that will be swapped out before hashing
+ let pos1 := sub(order, 32)
+ let pos2 := add(order, 320)
+ let pos3 := add(order, 352)
+
+ // Backup
+ let temp1 := mload(pos1)
+ let temp2 := mload(pos2)
+ let temp3 := mload(pos3)
+
+ // Hash in place
+ mstore(pos1, schemaHash)
+ mstore(pos2, makerAssetDataHash)
+ mstore(pos3, takerAssetDataHash)
+ result := keccak256(pos1, 416)
+
+ // Restore
+ mstore(pos1, temp1)
+ mstore(pos2, temp2)
+ mstore(pos3, temp3)
+ }
+ return result;
+ }
+}
diff --git a/contracts/libs/contracts/test/TestLibs/TestLibs.sol b/contracts/libs/contracts/test/TestLibs/TestLibs.sol
new file mode 100644
index 000000000..bd5f9f9da
--- /dev/null
+++ b/contracts/libs/contracts/test/TestLibs/TestLibs.sol
@@ -0,0 +1,152 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "../../libs/LibMath.sol";
+import "../../libs/LibOrder.sol";
+import "../../libs/LibFillResults.sol";
+import "../../libs/LibAbiEncoder.sol";
+
+
+contract TestLibs is
+ LibMath,
+ LibOrder,
+ LibFillResults,
+ LibAbiEncoder
+{
+ function publicAbiEncodeFillOrder(
+ Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ public
+ pure
+ returns (bytes memory fillOrderCalldata)
+ {
+ fillOrderCalldata = abiEncodeFillOrder(
+ order,
+ takerAssetFillAmount,
+ signature
+ );
+ return fillOrderCalldata;
+ }
+
+ function publicGetPartialAmountFloor(
+ uint256 numerator,
+ uint256 denominator,
+ uint256 target
+ )
+ public
+ pure
+ returns (uint256 partialAmount)
+ {
+ partialAmount = getPartialAmountFloor(
+ numerator,
+ denominator,
+ target
+ );
+ return partialAmount;
+ }
+
+ function publicGetPartialAmountCeil(
+ uint256 numerator,
+ uint256 denominator,
+ uint256 target
+ )
+ public
+ pure
+ returns (uint256 partialAmount)
+ {
+ partialAmount = getPartialAmountCeil(
+ numerator,
+ denominator,
+ target
+ );
+ return partialAmount;
+ }
+
+ function publicIsRoundingErrorFloor(
+ uint256 numerator,
+ uint256 denominator,
+ uint256 target
+ )
+ public
+ pure
+ returns (bool isError)
+ {
+ isError = isRoundingErrorFloor(
+ numerator,
+ denominator,
+ target
+ );
+ return isError;
+ }
+
+ function publicIsRoundingErrorCeil(
+ uint256 numerator,
+ uint256 denominator,
+ uint256 target
+ )
+ public
+ pure
+ returns (bool isError)
+ {
+ isError = isRoundingErrorCeil(
+ numerator,
+ denominator,
+ target
+ );
+ return isError;
+ }
+
+ function publicGetOrderHash(Order memory order)
+ public
+ view
+ returns (bytes32 orderHash)
+ {
+ orderHash = getOrderHash(order);
+ return orderHash;
+ }
+
+ function getOrderSchemaHash()
+ public
+ pure
+ returns (bytes32)
+ {
+ return EIP712_ORDER_SCHEMA_HASH;
+ }
+
+ function getDomainSeparatorSchemaHash()
+ public
+ pure
+ returns (bytes32)
+ {
+ return EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH;
+ }
+
+ function publicAddFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)
+ public
+ pure
+ returns (FillResults memory)
+ {
+ addFillResults(totalFillResults, singleFillResults);
+ return totalFillResults;
+ }
+}
diff --git a/contracts/libs/package.json b/contracts/libs/package.json
new file mode 100644
index 000000000..ce7b97502
--- /dev/null
+++ b/contracts/libs/package.json
@@ -0,0 +1,91 @@
+{
+ "name": "@0x/contracts-libs",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract libs of 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
+ "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "compile": "sol-compiler",
+ "watch": "sol-compiler -w",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "coverage:report:text": "istanbul report text",
+ "coverage:report:html": "istanbul report html && open coverage/index.html",
+ "profiler:report:html": "istanbul report html && open coverage/index.html",
+ "coverage:report:lcov": "istanbul report lcov",
+ "test:circleci": "yarn test",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(LibMath|LibOrder|LibFillResults|LibAbiEncoder|TestLibs|LibEIP712).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-multisig": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.4",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/libs/src/artifacts/index.ts b/contracts/libs/src/artifacts/index.ts
new file mode 100644
index 000000000..3955bbe2b
--- /dev/null
+++ b/contracts/libs/src/artifacts/index.ts
@@ -0,0 +1,17 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as LibAbiEncoder from '../../generated-artifacts/LibAbiEncoder.json';
+import * as LibEIP721 from '../../generated-artifacts/LibEIP712.json';
+import * as LibFillResults from '../../generated-artifacts/LibFillResults.json';
+import * as LibMath from '../../generated-artifacts/LibMath.json';
+import * as LibOrder from '../../generated-artifacts/LibOrder.json';
+import * as TestLibs from '../../generated-artifacts/TestLibs.json';
+
+export const artifacts = {
+ TestLibs: TestLibs as ContractArtifact,
+ LibAbiEncoder: LibAbiEncoder as ContractArtifact,
+ LibFillResults: LibFillResults as ContractArtifact,
+ LibMath: LibMath as ContractArtifact,
+ LibOrder: LibOrder as ContractArtifact,
+ LibEIP721: LibEIP721 as ContractArtifact,
+};
diff --git a/contracts/libs/src/index.ts b/contracts/libs/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/libs/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/libs/src/wrappers/index.ts b/contracts/libs/src/wrappers/index.ts
new file mode 100644
index 000000000..baaae6e34
--- /dev/null
+++ b/contracts/libs/src/wrappers/index.ts
@@ -0,0 +1,6 @@
+export * from '../../generated-wrappers/test_libs';
+export * from '../../generated-wrappers/lib_abi_encoder';
+export * from '../../generated-wrappers/lib_fill_results';
+export * from '../../generated-wrappers/lib_math';
+export * from '../../generated-wrappers/lib_order';
+export * from '../../generated-wrappers/lib_e_i_p712';
diff --git a/contracts/libs/test/exchange/libs.ts b/contracts/libs/test/exchange/libs.ts
new file mode 100644
index 000000000..44ff6a844
--- /dev/null
+++ b/contracts/libs/test/exchange/libs.ts
@@ -0,0 +1,125 @@
+import {
+ addressUtils,
+ chaiSetup,
+ constants,
+ OrderFactory,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+
+import { TestLibsContract } from '../../generated-wrappers/test_libs';
+import { artifacts } from '../../src/artifacts';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+describe('Exchange libs', () => {
+ let signedOrder: SignedOrder;
+ let orderFactory: OrderFactory;
+ let libs: TestLibsContract;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const makerAddress = accounts[0];
+ libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
+
+ const defaultOrderParams = {
+ ...constants.STATIC_ORDER_PARAMS,
+ exchangeAddress: libs.address,
+ makerAddress,
+ feeRecipientAddress: addressUtils.generatePseudoRandomAddress(),
+ makerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
+ };
+ const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
+ orderFactory = new OrderFactory(privateKey, defaultOrderParams);
+ });
+
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ // Note(albrow): These tests are designed to be supplemental to the
+ // combinatorial tests in test/exchange/internal. They test specific edge
+ // cases that are not covered by the combinatorial tests.
+ describe('LibMath', () => {
+ describe('isRoundingError', () => {
+ it('should return true if there is a rounding error of 0.1%', async () => {
+ const numerator = new BigNumber(20);
+ const denominator = new BigNumber(999);
+ const target = new BigNumber(50);
+ // rounding error = ((20*50/999) - floor(20*50/999)) / (20*50/999) = 0.1%
+ const isRoundingError = await libs.publicIsRoundingErrorFloor.callAsync(numerator, denominator, target);
+ expect(isRoundingError).to.be.true();
+ });
+ it('should return false if there is a rounding of 0.09%', async () => {
+ const numerator = new BigNumber(20);
+ const denominator = new BigNumber(9991);
+ const target = new BigNumber(500);
+ // rounding error = ((20*500/9991) - floor(20*500/9991)) / (20*500/9991) = 0.09%
+ const isRoundingError = await libs.publicIsRoundingErrorFloor.callAsync(numerator, denominator, target);
+ expect(isRoundingError).to.be.false();
+ });
+ it('should return true if there is a rounding error of 0.11%', async () => {
+ const numerator = new BigNumber(20);
+ const denominator = new BigNumber(9989);
+ const target = new BigNumber(500);
+ // rounding error = ((20*500/9989) - floor(20*500/9989)) / (20*500/9989) = 0.011%
+ const isRoundingError = await libs.publicIsRoundingErrorFloor.callAsync(numerator, denominator, target);
+ expect(isRoundingError).to.be.true();
+ });
+ });
+ describe('isRoundingErrorCeil', () => {
+ it('should return true if there is a rounding error of 0.1%', async () => {
+ const numerator = new BigNumber(20);
+ const denominator = new BigNumber(1001);
+ const target = new BigNumber(50);
+ // rounding error = (ceil(20*50/1001) - (20*50/1001)) / (20*50/1001) = 0.1%
+ const isRoundingError = await libs.publicIsRoundingErrorCeil.callAsync(numerator, denominator, target);
+ expect(isRoundingError).to.be.true();
+ });
+ it('should return false if there is a rounding of 0.09%', async () => {
+ const numerator = new BigNumber(20);
+ const denominator = new BigNumber(10009);
+ const target = new BigNumber(500);
+ // rounding error = (ceil(20*500/10009) - (20*500/10009)) / (20*500/10009) = 0.09%
+ const isRoundingError = await libs.publicIsRoundingErrorCeil.callAsync(numerator, denominator, target);
+ expect(isRoundingError).to.be.false();
+ });
+ it('should return true if there is a rounding error of 0.11%', async () => {
+ const numerator = new BigNumber(20);
+ const denominator = new BigNumber(10011);
+ const target = new BigNumber(500);
+ // rounding error = (ceil(20*500/10011) - (20*500/10011)) / (20*500/10011) = 0.11%
+ const isRoundingError = await libs.publicIsRoundingErrorCeil.callAsync(numerator, denominator, target);
+ expect(isRoundingError).to.be.true();
+ });
+ });
+ });
+
+ describe('LibOrder', () => {
+ describe('getOrderHash', () => {
+ it('should output the correct orderHash', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ const orderHashHex = await libs.publicGetOrderHash.callAsync(signedOrder);
+ expect(orderHashUtils.getOrderHashHex(signedOrder)).to.be.equal(orderHashHex);
+ });
+ });
+ });
+});
diff --git a/contracts/libs/test/global_hooks.ts b/contracts/libs/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/libs/test/global_hooks.ts
@@ -0,0 +1,17 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage, profiler, provider } from '@0x/contracts-test-utils';
+before('start web3 provider', () => {
+ provider.start();
+});
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+ provider.stop();
+});
diff --git a/contracts/libs/tsconfig.json b/contracts/libs/tsconfig.json
new file mode 100644
index 000000000..27ca35085
--- /dev/null
+++ b/contracts/libs/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/TestLibs.json",
+ "./generated-artifacts/LibOrder.json",
+ "./generated-artifacts/LibFillResults.json",
+ "./generated-artifacts/LibAbiEncoder.json",
+ "./generated-artifacts/LibEIP712.json",
+ "./generated-artifacts/LibMath.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/libs/tslint.json b/contracts/libs/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/libs/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/multisig/CHANGELOG.json b/contracts/multisig/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/multisig/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/multisig/CHANGELOG.md b/contracts/multisig/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/multisig/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/multisig/README.md b/contracts/multisig/README.md
new file mode 100644
index 000000000..93db63b5b
--- /dev/null
+++ b/contracts/multisig/README.md
@@ -0,0 +1,70 @@
+## MultisSig Contracts
+
+MultiSig smart contracts
+
+## Usage
+
+Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+
+* [multisig](./contracts/multisig)
+ * This directory contains the [Gnosis MultiSigWallet](https://github.com/gnosis/MultiSigWallet) and a custom extension that adds a timelock to transactions within the MultiSigWallet.
+* [test](./contracts/test)
+ * This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-multisig yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-multisig yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/multisig/compiler.json b/contracts/multisig/compiler.json
new file mode 100644
index 000000000..5a1f689e2
--- /dev/null
+++ b/contracts/multisig/compiler.json
@@ -0,0 +1,22 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": ["MultiSigWallet", "MultiSigWalletWithTimeLock", "TestRejectEther"]
+}
diff --git a/packages/contracts/contracts/multisig/MultiSigWallet.sol b/contracts/multisig/contracts/multisig/MultiSigWallet.sol
index 516e7391c..516e7391c 100644
--- a/packages/contracts/contracts/multisig/MultiSigWallet.sol
+++ b/contracts/multisig/contracts/multisig/MultiSigWallet.sol
diff --git a/packages/contracts/contracts/multisig/MultiSigWalletWithTimeLock.sol b/contracts/multisig/contracts/multisig/MultiSigWalletWithTimeLock.sol
index 9513d3b30..9513d3b30 100644
--- a/packages/contracts/contracts/multisig/MultiSigWalletWithTimeLock.sol
+++ b/contracts/multisig/contracts/multisig/MultiSigWalletWithTimeLock.sol
diff --git a/contracts/multisig/contracts/test/TestRejectEther/TestRejectEther.sol b/contracts/multisig/contracts/test/TestRejectEther/TestRejectEther.sol
new file mode 100644
index 000000000..e523f591d
--- /dev/null
+++ b/contracts/multisig/contracts/test/TestRejectEther/TestRejectEther.sol
@@ -0,0 +1,23 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+
+// solhint-disable no-empty-blocks
+contract TestRejectEther {}
diff --git a/contracts/multisig/package.json b/contracts/multisig/package.json
new file mode 100644
index 000000000..2d7b4aa05
--- /dev/null
+++ b/contracts/multisig/package.json
@@ -0,0 +1,86 @@
+{
+ "name": "@0x/contracts-multisig",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Multisig contracts used by 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
+ "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "compile": "sol-compiler",
+ "watch": "sol-compiler -w",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../packages/abi-gen-templates/contract.handlebars --partials '../../packages/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "coverage:report:text": "istanbul report text",
+ "coverage:report:html": "istanbul report html && open coverage/index.html",
+ "profiler:report:html": "istanbul report html && open coverage/index.html",
+ "coverage:report:lcov": "istanbul report lcov",
+ "test:circleci": "yarn test",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(MultiSigWallet|MultiSigWalletWithTimeLock|TestRejectEther).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/bn.js": "^4.11.0",
+ "@types/ethereumjs-abi": "^0.6.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/multisig/src/artifacts/index.ts b/contracts/multisig/src/artifacts/index.ts
new file mode 100644
index 000000000..7cf47be01
--- /dev/null
+++ b/contracts/multisig/src/artifacts/index.ts
@@ -0,0 +1,11 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as MultiSigWallet from '../../generated-artifacts/MultiSigWallet.json';
+import * as MultiSigWalletWithTimeLock from '../../generated-artifacts/MultiSigWalletWithTimeLock.json';
+import * as TestRejectEther from '../../generated-artifacts/TestRejectEther.json';
+
+export const artifacts = {
+ TestRejectEther: TestRejectEther as ContractArtifact,
+ MultiSigWallet: MultiSigWallet as ContractArtifact,
+ MultiSigWalletWithTimeLock: MultiSigWalletWithTimeLock as ContractArtifact,
+};
diff --git a/contracts/multisig/src/index.ts b/contracts/multisig/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/multisig/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/multisig/src/wrappers/index.ts b/contracts/multisig/src/wrappers/index.ts
new file mode 100644
index 000000000..69abd62f2
--- /dev/null
+++ b/contracts/multisig/src/wrappers/index.ts
@@ -0,0 +1,2 @@
+export * from '../../generated-wrappers/multi_sig_wallet';
+export * from '../../generated-wrappers/multi_sig_wallet_with_time_lock';
diff --git a/contracts/multisig/test/global_hooks.ts b/contracts/multisig/test/global_hooks.ts
new file mode 100644
index 000000000..68eb4f8d5
--- /dev/null
+++ b/contracts/multisig/test/global_hooks.ts
@@ -0,0 +1,19 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage, profiler, provider } from '@0x/contracts-test-utils';
+
+before('start web3 provider engine', () => {
+ provider.start();
+});
+
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+ provider.stop();
+});
diff --git a/contracts/multisig/test/multi_sig_with_time_lock.ts b/contracts/multisig/test/multi_sig_with_time_lock.ts
new file mode 100644
index 000000000..31c215505
--- /dev/null
+++ b/contracts/multisig/test/multi_sig_with_time_lock.ts
@@ -0,0 +1,349 @@
+import {
+ chaiSetup,
+ constants,
+ expectTransactionFailedAsync,
+ expectTransactionFailedWithoutReasonAsync,
+ increaseTimeAndMineBlockAsync,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import {
+ MultiSigWalletWithTimeLockConfirmationEventArgs,
+ MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs,
+ MultiSigWalletWithTimeLockContract,
+ MultiSigWalletWithTimeLockExecutionEventArgs,
+ MultiSigWalletWithTimeLockExecutionFailureEventArgs,
+ MultiSigWalletWithTimeLockSubmissionEventArgs,
+} from '../generated-wrappers/multi_sig_wallet_with_time_lock';
+import { TestRejectEtherContract } from '../generated-wrappers/test_reject_ether';
+import { artifacts } from '../src/artifacts';
+
+import { MultiSigWrapper } from './utils/multi_sig_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+// tslint:disable:no-unnecessary-type-assertion
+describe('MultiSigWalletWithTimeLock', () => {
+ let owners: string[];
+ let notOwner: string;
+ const REQUIRED_APPROVALS = new BigNumber(2);
+ const SECONDS_TIME_LOCKED = new BigNumber(1000000);
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ owners = [accounts[0], accounts[1], accounts[2]];
+ notOwner = accounts[3];
+ });
+
+ let multiSig: MultiSigWalletWithTimeLockContract;
+ let multiSigWrapper: MultiSigWrapper;
+
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('external_call', () => {
+ it('should be internal', async () => {
+ const secondsTimeLocked = new BigNumber(0);
+ multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
+ artifacts.MultiSigWalletWithTimeLock,
+ provider,
+ txDefaults,
+ owners,
+ REQUIRED_APPROVALS,
+ secondsTimeLocked,
+ );
+ expect(_.isUndefined((multiSig as any).external_call)).to.be.equal(true);
+ });
+ });
+ describe('confirmTransaction', () => {
+ let txId: BigNumber;
+ beforeEach(async () => {
+ const secondsTimeLocked = new BigNumber(0);
+ multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
+ artifacts.MultiSigWalletWithTimeLock,
+ provider,
+ txDefaults,
+ owners,
+ REQUIRED_APPROVALS,
+ secondsTimeLocked,
+ );
+ multiSigWrapper = new MultiSigWrapper(multiSig, provider);
+ const destination = notOwner;
+ const data = constants.NULL_BYTES;
+ const txReceipt = await multiSigWrapper.submitTransactionAsync(destination, data, owners[0]);
+ txId = (txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>).args
+ .transactionId;
+ });
+ it('should revert if called by a non-owner', async () => {
+ await expectTransactionFailedWithoutReasonAsync(multiSigWrapper.confirmTransactionAsync(txId, notOwner));
+ });
+ it('should revert if transaction does not exist', async () => {
+ const nonexistentTxId = new BigNumber(123456789);
+ await expectTransactionFailedWithoutReasonAsync(
+ multiSigWrapper.confirmTransactionAsync(nonexistentTxId, owners[1]),
+ );
+ });
+ it('should revert if transaction is already confirmed by caller', async () => {
+ await expectTransactionFailedWithoutReasonAsync(multiSigWrapper.confirmTransactionAsync(txId, owners[0]));
+ });
+ it('should confirm transaction for caller and log a Confirmation event', async () => {
+ const txReceipt = await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ const log = txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockConfirmationEventArgs>;
+ expect(log.event).to.be.equal('Confirmation');
+ expect(log.args.sender).to.be.equal(owners[1]);
+ expect(log.args.transactionId).to.be.bignumber.equal(txId);
+ });
+ it('should revert if fully confirmed', async () => {
+ await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ await expectTransactionFailedAsync(
+ multiSigWrapper.confirmTransactionAsync(txId, owners[2]),
+ RevertReason.TxFullyConfirmed,
+ );
+ });
+ it('should set the confirmation time of the transaction if it becomes fully confirmed', async () => {
+ const txReceipt = await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ const blockNum = await web3Wrapper.getBlockNumberAsync();
+ const timestamp = new BigNumber(await web3Wrapper.getBlockTimestampAsync(blockNum));
+ const log = txReceipt.logs[1] as LogWithDecodedArgs<MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs>;
+ expect(log.args.confirmationTime).to.be.bignumber.equal(timestamp);
+ expect(log.args.transactionId).to.be.bignumber.equal(txId);
+ });
+ });
+ describe('executeTransaction', () => {
+ let txId: BigNumber;
+ const secondsTimeLocked = new BigNumber(1000000);
+ beforeEach(async () => {
+ multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
+ artifacts.MultiSigWalletWithTimeLock,
+ provider,
+ txDefaults,
+ owners,
+ REQUIRED_APPROVALS,
+ secondsTimeLocked,
+ );
+ multiSigWrapper = new MultiSigWrapper(multiSig, provider);
+ const destination = notOwner;
+ const data = constants.NULL_BYTES;
+ const txReceipt = await multiSigWrapper.submitTransactionAsync(destination, data, owners[0]);
+ txId = (txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>).args
+ .transactionId;
+ });
+ it('should revert if transaction has not been fully confirmed', async () => {
+ await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
+ await expectTransactionFailedAsync(
+ multiSigWrapper.executeTransactionAsync(txId, owners[1]),
+ RevertReason.TxNotFullyConfirmed,
+ );
+ });
+ it('should revert if time lock has not passed', async () => {
+ await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ await expectTransactionFailedAsync(
+ multiSigWrapper.executeTransactionAsync(txId, owners[1]),
+ RevertReason.TimeLockIncomplete,
+ );
+ });
+ it('should execute a transaction and log an Execution event if successful and called by owner', async () => {
+ await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
+ const txReceipt = await multiSigWrapper.executeTransactionAsync(txId, owners[1]);
+ const log = txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockExecutionEventArgs>;
+ expect(log.event).to.be.equal('Execution');
+ expect(log.args.transactionId).to.be.bignumber.equal(txId);
+ });
+ it('should execute a transaction and log an Execution event if successful and called by non-owner', async () => {
+ await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
+ const txReceipt = await multiSigWrapper.executeTransactionAsync(txId, notOwner);
+ const log = txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockExecutionEventArgs>;
+ expect(log.event).to.be.equal('Execution');
+ expect(log.args.transactionId).to.be.bignumber.equal(txId);
+ });
+ it('should revert if a required confirmation is revoked before executeTransaction is called', async () => {
+ await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
+ await multiSigWrapper.revokeConfirmationAsync(txId, owners[0]);
+ await expectTransactionFailedAsync(
+ multiSigWrapper.executeTransactionAsync(txId, owners[1]),
+ RevertReason.TxNotFullyConfirmed,
+ );
+ });
+ it('should revert if transaction has been executed', async () => {
+ await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
+ const txReceipt = await multiSigWrapper.executeTransactionAsync(txId, owners[1]);
+ const log = txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockExecutionEventArgs>;
+ expect(log.args.transactionId).to.be.bignumber.equal(txId);
+ await expectTransactionFailedWithoutReasonAsync(multiSigWrapper.executeTransactionAsync(txId, owners[1]));
+ });
+ it("should log an ExecutionFailure event and not update the transaction's execution state if unsuccessful", async () => {
+ const contractWithoutFallback = await TestRejectEtherContract.deployFrom0xArtifactAsync(
+ artifacts.TestRejectEther,
+ provider,
+ txDefaults,
+ );
+ const data = constants.NULL_BYTES;
+ const value = new BigNumber(10);
+ const submissionTxReceipt = await multiSigWrapper.submitTransactionAsync(
+ contractWithoutFallback.address,
+ data,
+ owners[0],
+ { value },
+ );
+ const newTxId = (submissionTxReceipt.logs[0] as LogWithDecodedArgs<
+ MultiSigWalletWithTimeLockSubmissionEventArgs
+ >).args.transactionId;
+ await multiSigWrapper.confirmTransactionAsync(newTxId, owners[1]);
+ await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
+ const txReceipt = await multiSigWrapper.executeTransactionAsync(newTxId, owners[1]);
+ const executionFailureLog = txReceipt.logs[0] as LogWithDecodedArgs<
+ MultiSigWalletWithTimeLockExecutionFailureEventArgs
+ >;
+ expect(executionFailureLog.event).to.be.equal('ExecutionFailure');
+ expect(executionFailureLog.args.transactionId).to.be.bignumber.equal(newTxId);
+ });
+ });
+ describe('changeTimeLock', () => {
+ describe('initially non-time-locked', async () => {
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before('deploy a wallet', async () => {
+ const secondsTimeLocked = new BigNumber(0);
+ multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
+ artifacts.MultiSigWalletWithTimeLock,
+ provider,
+ txDefaults,
+ owners,
+ REQUIRED_APPROVALS,
+ secondsTimeLocked,
+ );
+ multiSigWrapper = new MultiSigWrapper(multiSig, provider);
+ });
+
+ it('should throw when not called by wallet', async () => {
+ return expectTransactionFailedWithoutReasonAsync(
+ multiSig.changeTimeLock.sendTransactionAsync(SECONDS_TIME_LOCKED, { from: owners[0] }),
+ );
+ });
+
+ it('should throw without enough confirmations', async () => {
+ const destination = multiSig.address;
+ const changeTimeLockData = multiSig.changeTimeLock.getABIEncodedTransactionData(SECONDS_TIME_LOCKED);
+ const res = await multiSigWrapper.submitTransactionAsync(destination, changeTimeLockData, owners[0]);
+ const log = res.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>;
+ const txId = log.args.transactionId;
+ return expectTransactionFailedAsync(
+ multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
+ RevertReason.TxNotFullyConfirmed,
+ );
+ });
+
+ it('should set confirmation time with enough confirmations', async () => {
+ const destination = multiSig.address;
+ const changeTimeLockData = multiSig.changeTimeLock.getABIEncodedTransactionData(SECONDS_TIME_LOCKED);
+ const subRes = await multiSigWrapper.submitTransactionAsync(destination, changeTimeLockData, owners[0]);
+ const subLog = subRes.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>;
+ const txId = subLog.args.transactionId;
+
+ const confirmRes = await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ expect(confirmRes.logs).to.have.length(2);
+
+ const blockNum = await web3Wrapper.getBlockNumberAsync();
+ const blockInfo = await web3Wrapper.getBlockIfExistsAsync(blockNum);
+ if (_.isUndefined(blockInfo)) {
+ throw new Error(`Unexpectedly failed to fetch block at #${blockNum}`);
+ }
+ const timestamp = new BigNumber(blockInfo.timestamp);
+ const confirmationTimeBigNum = new BigNumber(await multiSig.confirmationTimes.callAsync(txId));
+
+ expect(timestamp).to.be.bignumber.equal(confirmationTimeBigNum);
+ });
+
+ it('should be executable with enough confirmations and secondsTimeLocked of 0', async () => {
+ const destination = multiSig.address;
+ const changeTimeLockData = multiSig.changeTimeLock.getABIEncodedTransactionData(SECONDS_TIME_LOCKED);
+ const subRes = await multiSigWrapper.submitTransactionAsync(destination, changeTimeLockData, owners[0]);
+ const subLog = subRes.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>;
+ const txId = subLog.args.transactionId;
+
+ await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ await multiSigWrapper.executeTransactionAsync(txId, owners[1]);
+
+ const secondsTimeLocked = new BigNumber(await multiSig.secondsTimeLocked.callAsync());
+ expect(secondsTimeLocked).to.be.bignumber.equal(SECONDS_TIME_LOCKED);
+ });
+ });
+ describe('initially time-locked', async () => {
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ let txId: BigNumber;
+ const newSecondsTimeLocked = new BigNumber(0);
+ before('deploy a wallet, submit transaction to change timelock, and confirm the transaction', async () => {
+ multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
+ artifacts.MultiSigWalletWithTimeLock,
+ provider,
+ txDefaults,
+ owners,
+ REQUIRED_APPROVALS,
+ SECONDS_TIME_LOCKED,
+ );
+ multiSigWrapper = new MultiSigWrapper(multiSig, provider);
+
+ const changeTimeLockData = multiSig.changeTimeLock.getABIEncodedTransactionData(newSecondsTimeLocked);
+ const res = await multiSigWrapper.submitTransactionAsync(
+ multiSig.address,
+ changeTimeLockData,
+ owners[0],
+ );
+ const log = res.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>;
+ txId = log.args.transactionId;
+ await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
+ });
+
+ it('should throw if it has enough confirmations but is not past the time lock', async () => {
+ return expectTransactionFailedAsync(
+ multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
+ RevertReason.TimeLockIncomplete,
+ );
+ });
+
+ it('should execute if it has enough confirmations and is past the time lock', async () => {
+ await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const secondsTimeLocked = new BigNumber(await multiSig.secondsTimeLocked.callAsync());
+ expect(secondsTimeLocked).to.be.bignumber.equal(newSecondsTimeLocked);
+ });
+ });
+ });
+});
+// tslint:enable:no-unnecessary-type-assertion
diff --git a/contracts/multisig/test/utils/multi_sig_wrapper.ts b/contracts/multisig/test/utils/multi_sig_wrapper.ts
new file mode 100644
index 000000000..086143613
--- /dev/null
+++ b/contracts/multisig/test/utils/multi_sig_wrapper.ts
@@ -0,0 +1,54 @@
+import { LogDecoder } from '@0x/contracts-test-utils';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { MultiSigWalletContract } from '../../generated-wrappers/multi_sig_wallet';
+import { artifacts } from '../../src/artifacts';
+
+export class MultiSigWrapper {
+ private readonly _multiSig: MultiSigWalletContract;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _logDecoder: LogDecoder;
+ constructor(multiSigContract: MultiSigWalletContract, provider: Provider) {
+ this._multiSig = multiSigContract;
+ this._web3Wrapper = new Web3Wrapper(provider);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
+ }
+ public async submitTransactionAsync(
+ destination: string,
+ data: string,
+ from: string,
+ opts: { value?: BigNumber } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value;
+ const txHash = await this._multiSig.submitTransaction.sendTransactionAsync(destination, value, data, {
+ from,
+ });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async confirmTransactionAsync(txId: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._multiSig.confirmTransaction.sendTransactionAsync(txId, { from });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async revokeConfirmationAsync(txId: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._multiSig.revokeConfirmation.sendTransactionAsync(txId, { from });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async executeTransactionAsync(
+ txId: BigNumber,
+ from: string,
+ opts: { gas?: number } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._multiSig.executeTransaction.sendTransactionAsync(txId, {
+ from,
+ gas: opts.gas,
+ });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+}
diff --git a/contracts/multisig/tsconfig.json b/contracts/multisig/tsconfig.json
new file mode 100644
index 000000000..6f381620e
--- /dev/null
+++ b/contracts/multisig/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/MultiSigWallet.json",
+ "./generated-artifacts/MultiSigWalletWithTimeLock.json",
+ "./generated-artifacts/TestRejectEther.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/multisig/tslint.json b/contracts/multisig/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/multisig/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/protocol/CHANGELOG.json b/contracts/protocol/CHANGELOG.json
new file mode 100644
index 000000000..e283d7917
--- /dev/null
+++ b/contracts/protocol/CHANGELOG.json
@@ -0,0 +1,28 @@
+[
+ {
+ "version": "2.2.0",
+ "changes": [
+ {
+ "note": "Added LibAddressArray",
+ "pr": 1383
+ },
+ {
+ "note": "Add validation and comments to MultiAssetProxy",
+ "pr": 1455
+ },
+ {
+ "note": "Move OrderValidator to extensions",
+ "pr": 1464
+ }
+ ]
+ },
+ {
+ "timestamp": 1544741676,
+ "version": "2.1.59",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/protocol/CHANGELOG.md b/contracts/protocol/CHANGELOG.md
new file mode 100644
index 000000000..d90b1b2cc
--- /dev/null
+++ b/contracts/protocol/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v2.1.59 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/protocol/DEPLOYS.json b/contracts/protocol/DEPLOYS.json
new file mode 100644
index 000000000..5c24ae59c
--- /dev/null
+++ b/contracts/protocol/DEPLOYS.json
@@ -0,0 +1,92 @@
+[
+ {
+ "name": "MultiAssetProxy",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Add MultiAssetProxy implementation",
+ "pr": 1224
+ }
+ ]
+ },
+ {
+ "name": "OrderValidator",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "remove `getApproved` check from ERC721 approval query",
+ "pr": 1149
+ }
+ ]
+ },
+ {
+ "name": "OrderValidator",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x9463e518dea6810309563c81d5266c1b1d149138",
+ "3": "0x90431a90516ab49af23a0530e04e8c7836e7122f",
+ "42": "0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d"
+ }
+ }
+ ]
+ },
+ {
+ "name": "Exchange",
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
+ "3": "0x4530c0483a1633c7a1c97d2c53721caff2caaaaf",
+ "42": "0x35dd2932454449b14cee11a94d3674a936d5d7b2"
+ }
+ }
+ ]
+ },
+ {
+ "name": "ERC20Proxy",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
+ "3": "0xb1408f4c245a23c31b98d2c626777d4c0d766caa",
+ "42": "0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e"
+ }
+ }
+ ]
+ },
+ {
+ "name": "ERC721Proxy",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x208e41fb445f1bb1b6780d58356e81405f3e6127",
+ "3": "0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4",
+ "42": "0x2a9127c745688a165106c11cd4d647d2220af821"
+ }
+ }
+ ]
+ },
+ {
+ "name": "AssetProxyOwner",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v2 deploy",
+ "networks": {
+ "1": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6",
+ "3": "0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b",
+ "42": "0x2c824d2882baa668e0d5202b1e7f2922278703f8"
+ }
+ }
+ ]
+ }
+]
diff --git a/contracts/protocol/README.md b/contracts/protocol/README.md
new file mode 100644
index 000000000..5fc9c0a89
--- /dev/null
+++ b/contracts/protocol/README.md
@@ -0,0 +1,74 @@
+## Contracts
+
+Smart contracts that implement the 0x protocol. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [CHANGELOG](./CHANGELOG.json) of this package.
+
+## Usage
+
+Contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+
+* [protocol](./contracts/protocol)
+ * This directory contains the contracts that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
+* [test](./contracts/test)
+ * This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+
+## Bug bounty
+
+A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-protocol yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-protocol yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/protocol/compiler.json b/contracts/protocol/compiler.json
new file mode 100644
index 000000000..10e5bb0a1
--- /dev/null
+++ b/contracts/protocol/compiler.json
@@ -0,0 +1,34 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": [
+ "AssetProxyOwner",
+ "ERC20Proxy",
+ "ERC721Proxy",
+ "Exchange",
+ "MixinAuthorizable",
+ "MultiAssetProxy",
+ "TestAssetProxyOwner",
+ "TestAssetProxyDispatcher",
+ "TestExchangeInternals",
+ "TestSignatureValidator",
+ "TestStaticCallReceiver"
+ ]
+}
diff --git a/packages/contracts/contracts/protocol/AssetProxy/ERC20Proxy.sol b/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol
index 258443bca..258443bca 100644
--- a/packages/contracts/contracts/protocol/AssetProxy/ERC20Proxy.sol
+++ b/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol
diff --git a/packages/contracts/contracts/protocol/AssetProxy/ERC721Proxy.sol b/contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol
index 65b664b8b..65b664b8b 100644
--- a/packages/contracts/contracts/protocol/AssetProxy/ERC721Proxy.sol
+++ b/contracts/protocol/contracts/protocol/AssetProxy/ERC721Proxy.sol
diff --git a/contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol b/contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol
new file mode 100644
index 000000000..b610ef709
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/AssetProxy/MixinAuthorizable.sol
@@ -0,0 +1,117 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "./mixins/MAuthorizable.sol";
+
+
+contract MixinAuthorizable is
+ Ownable,
+ MAuthorizable
+{
+ /// @dev Only authorized addresses can invoke functions with this modifier.
+ modifier onlyAuthorized {
+ require(
+ authorized[msg.sender],
+ "SENDER_NOT_AUTHORIZED"
+ );
+ _;
+ }
+
+ mapping (address => bool) public authorized;
+ address[] public authorities;
+
+ /// @dev Authorizes an address.
+ /// @param target Address to authorize.
+ function addAuthorizedAddress(address target)
+ external
+ onlyOwner
+ {
+ require(
+ !authorized[target],
+ "TARGET_ALREADY_AUTHORIZED"
+ );
+
+ authorized[target] = true;
+ authorities.push(target);
+ emit AuthorizedAddressAdded(target, msg.sender);
+ }
+
+ /// @dev Removes authorizion of an address.
+ /// @param target Address to remove authorization from.
+ function removeAuthorizedAddress(address target)
+ external
+ onlyOwner
+ {
+ require(
+ authorized[target],
+ "TARGET_NOT_AUTHORIZED"
+ );
+
+ delete authorized[target];
+ for (uint256 i = 0; i < authorities.length; i++) {
+ if (authorities[i] == target) {
+ authorities[i] = authorities[authorities.length - 1];
+ authorities.length -= 1;
+ break;
+ }
+ }
+ emit AuthorizedAddressRemoved(target, msg.sender);
+ }
+
+ /// @dev Removes authorizion of an address.
+ /// @param target Address to remove authorization from.
+ /// @param index Index of target in authorities array.
+ function removeAuthorizedAddressAtIndex(
+ address target,
+ uint256 index
+ )
+ external
+ onlyOwner
+ {
+ require(
+ authorized[target],
+ "TARGET_NOT_AUTHORIZED"
+ );
+ require(
+ index < authorities.length,
+ "INDEX_OUT_OF_BOUNDS"
+ );
+ require(
+ authorities[index] == target,
+ "AUTHORIZED_ADDRESS_MISMATCH"
+ );
+
+ delete authorized[target];
+ authorities[index] = authorities[authorities.length - 1];
+ authorities.length -= 1;
+ emit AuthorizedAddressRemoved(target, msg.sender);
+ }
+
+ /// @dev Gets all authorized addresses.
+ /// @return Array of authorized addresses.
+ function getAuthorizedAddresses()
+ external
+ view
+ returns (address[] memory)
+ {
+ return authorities;
+ }
+}
diff --git a/contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol b/contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol
new file mode 100644
index 000000000..5f559163c
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/AssetProxy/MultiAssetProxy.sol
@@ -0,0 +1,306 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+import "../Exchange/MixinAssetProxyDispatcher.sol";
+import "./MixinAuthorizable.sol";
+
+
+contract MultiAssetProxy is
+ MixinAssetProxyDispatcher,
+ MixinAuthorizable
+{
+ // Id of this proxy.
+ bytes4 constant internal PROXY_ID = bytes4(keccak256("MultiAsset(uint256[],bytes[])"));
+
+ // solhint-disable-next-line payable-fallback
+ function ()
+ external
+ {
+ // NOTE: The below assembly assumes that clients do some input validation and that the input is properly encoded according to the AbiV2 specification.
+ // It is technically possible for inputs with very large lengths and offsets to cause overflows. However, this would make the calldata prohibitively
+ // expensive and we therefore do not check for overflows in these scenarios.
+ assembly {
+ // The first 4 bytes of calldata holds the function selector
+ let selector := and(calldataload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000)
+
+ // `transferFrom` will be called with the following parameters:
+ // assetData Encoded byte array.
+ // from Address to transfer asset from.
+ // to Address to transfer asset to.
+ // amount Amount of asset to transfer.
+ // bytes4(keccak256("transferFrom(bytes,address,address,uint256)")) = 0xa85e59e4
+ if eq(selector, 0xa85e59e400000000000000000000000000000000000000000000000000000000) {
+
+ // To lookup a value in a mapping, we load from the storage location keccak256(k, p),
+ // where k is the key left padded to 32 bytes and p is the storage slot
+ mstore(0, caller)
+ mstore(32, authorized_slot)
+
+ // Revert if authorized[msg.sender] == false
+ if iszero(sload(keccak256(0, 64))) {
+ // Revert with `Error("SENDER_NOT_AUTHORIZED")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000001553454e4445525f4e4f545f415554484f52495a454400000000000000)
+ mstore(96, 0)
+ revert(0, 100)
+ }
+
+ // `transferFrom`.
+ // The function is marked `external`, so no abi decoding is done for
+ // us. Instead, we expect the `calldata` memory to contain the
+ // following:
+ //
+ // | Area | Offset | Length | Contents |
+ // |----------|--------|---------|-------------------------------------|
+ // | Header | 0 | 4 | function selector |
+ // | Params | | 4 * 32 | function parameters: |
+ // | | 4 | | 1. offset to assetData (*) |
+ // | | 36 | | 2. from |
+ // | | 68 | | 3. to |
+ // | | 100 | | 4. amount |
+ // | Data | | | assetData: |
+ // | | 132 | 32 | assetData Length |
+ // | | 164 | ** | assetData Contents |
+ //
+ // (*): offset is computed from start of function parameters, so offset
+ // by an additional 4 bytes in the calldata.
+ //
+ // (**): see table below to compute length of assetData Contents
+ //
+ // WARNING: The ABIv2 specification allows additional padding between
+ // the Params and Data section. This will result in a larger
+ // offset to assetData.
+
+ // Load offset to `assetData`
+ let assetDataOffset := calldataload(4)
+
+ // Asset data itself is encoded as follows:
+ //
+ // | Area | Offset | Length | Contents |
+ // |----------|-------------|---------|-------------------------------------|
+ // | Header | 0 | 4 | assetProxyId |
+ // | Params | | 2 * 32 | function parameters: |
+ // | | 4 | | 1. offset to amounts (*) |
+ // | | 36 | | 2. offset to nestedAssetData (*) |
+ // | Data | | | amounts: |
+ // | | 68 | 32 | amounts Length |
+ // | | 100 | a | amounts Contents |
+ // | | | | nestedAssetData: |
+ // | | 100 + a | 32 | nestedAssetData Length |
+ // | | 132 + a | b | nestedAssetData Contents (offsets) |
+ // | | 132 + a + b | | nestedAssetData[0, ..., len] |
+
+ // In order to find the offset to `amounts`, we must add:
+ // 4 (function selector)
+ // + assetDataOffset
+ // + 32 (assetData len)
+ // + 4 (assetProxyId)
+ let amountsOffset := calldataload(add(assetDataOffset, 40))
+
+ // In order to find the offset to `nestedAssetData`, we must add:
+ // 4 (function selector)
+ // + assetDataOffset
+ // + 32 (assetData len)
+ // + 4 (assetProxyId)
+ // + 32 (amounts offset)
+ let nestedAssetDataOffset := calldataload(add(assetDataOffset, 72))
+
+ // In order to find the start of the `amounts` contents, we must add:
+ // 4 (function selector)
+ // + assetDataOffset
+ // + 32 (assetData len)
+ // + 4 (assetProxyId)
+ // + amountsOffset
+ // + 32 (amounts len)
+ let amountsContentsStart := add(assetDataOffset, add(amountsOffset, 72))
+
+ // Load number of elements in `amounts`
+ let amountsLen := calldataload(sub(amountsContentsStart, 32))
+
+ // In order to find the start of the `nestedAssetData` contents, we must add:
+ // 4 (function selector)
+ // + assetDataOffset
+ // + 32 (assetData len)
+ // + 4 (assetProxyId)
+ // + nestedAssetDataOffset
+ // + 32 (nestedAssetData len)
+ let nestedAssetDataContentsStart := add(assetDataOffset, add(nestedAssetDataOffset, 72))
+
+ // Load number of elements in `nestedAssetData`
+ let nestedAssetDataLen := calldataload(sub(nestedAssetDataContentsStart, 32))
+
+ // Revert if number of elements in `amounts` differs from number of elements in `nestedAssetData`
+ if sub(amountsLen, nestedAssetDataLen) {
+ // Revert with `Error("LENGTH_MISMATCH")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000000f4c454e4754485f4d49534d4154434800000000000000000000000000)
+ mstore(96, 0)
+ revert(0, 100)
+ }
+
+ // Copy `transferFrom` selector, offset to `assetData`, `from`, and `to` from calldata to memory
+ calldatacopy(
+ 0, // memory can safely be overwritten from beginning
+ 0, // start of calldata
+ 100 // length of selector (4) and 3 params (32 * 3)
+ )
+
+ // Overwrite existing offset to `assetData` with our own
+ mstore(4, 128)
+
+ // Load `amount`
+ let amount := calldataload(100)
+
+ // Calculate number of bytes in `amounts` contents
+ let amountsByteLen := mul(amountsLen, 32)
+
+ // Initialize `assetProxyId` and `assetProxy` to 0
+ let assetProxyId := 0
+ let assetProxy := 0
+
+ // Loop through `amounts` and `nestedAssetData`, calling `transferFrom` for each respective element
+ for {let i := 0} lt(i, amountsByteLen) {i := add(i, 32)} {
+
+ // Calculate the total amount
+ let amountsElement := calldataload(add(amountsContentsStart, i))
+ let totalAmount := mul(amountsElement, amount)
+
+ // Revert if `amount` != 0 and multiplication resulted in an overflow
+ if iszero(or(
+ iszero(amount),
+ eq(div(totalAmount, amount), amountsElement)
+ )) {
+ // Revert with `Error("UINT256_OVERFLOW")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000001055494e543235365f4f564552464c4f57000000000000000000000000)
+ mstore(96, 0)
+ revert(0, 100)
+ }
+
+ // Write `totalAmount` to memory
+ mstore(100, totalAmount)
+
+ // Load offset to `nestedAssetData[i]`
+ let nestedAssetDataElementOffset := calldataload(add(nestedAssetDataContentsStart, i))
+
+ // In order to find the start of the `nestedAssetData[i]` contents, we must add:
+ // 4 (function selector)
+ // + assetDataOffset
+ // + 32 (assetData len)
+ // + 4 (assetProxyId)
+ // + nestedAssetDataOffset
+ // + 32 (nestedAssetData len)
+ // + nestedAssetDataElementOffset
+ // + 32 (nestedAssetDataElement len)
+ let nestedAssetDataElementContentsStart := add(assetDataOffset, add(nestedAssetDataOffset, add(nestedAssetDataElementOffset, 104)))
+
+ // Load length of `nestedAssetData[i]`
+ let nestedAssetDataElementLenStart := sub(nestedAssetDataElementContentsStart, 32)
+ let nestedAssetDataElementLen := calldataload(nestedAssetDataElementLenStart)
+
+ // Revert if the `nestedAssetData` does not contain a 4 byte `assetProxyId`
+ if lt(nestedAssetDataElementLen, 4) {
+ // Revert with `Error("LENGTH_GREATER_THAN_3_REQUIRED")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000001e4c454e4754485f475245415445525f5448414e5f335f524551554952)
+ mstore(96, 0x4544000000000000000000000000000000000000000000000000000000000000)
+ revert(0, 100)
+ }
+
+ // Load AssetProxy id
+ let currentAssetProxyId := and(
+ calldataload(nestedAssetDataElementContentsStart),
+ 0xffffffff00000000000000000000000000000000000000000000000000000000
+ )
+
+ // Only load `assetProxy` if `currentAssetProxyId` does not equal `assetProxyId`
+ // We do not need to check if `currentAssetProxyId` is 0 since `assetProxy` is also initialized to 0
+ if sub(currentAssetProxyId, assetProxyId) {
+ // Update `assetProxyId`
+ assetProxyId := currentAssetProxyId
+ // To lookup a value in a mapping, we load from the storage location keccak256(k, p),
+ // where k is the key left padded to 32 bytes and p is the storage slot
+ mstore(132, assetProxyId)
+ mstore(164, assetProxies_slot)
+ assetProxy := sload(keccak256(132, 64))
+ }
+
+ // Revert if AssetProxy with given id does not exist
+ if iszero(assetProxy) {
+ // Revert with `Error("ASSET_PROXY_DOES_NOT_EXIST")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000001a41535345545f50524f58595f444f45535f4e4f545f45584953540000)
+ mstore(96, 0)
+ revert(0, 100)
+ }
+
+ // Copy `nestedAssetData[i]` from calldata to memory
+ calldatacopy(
+ 132, // memory slot after `amounts[i]`
+ nestedAssetDataElementLenStart, // location of `nestedAssetData[i]` in calldata
+ add(nestedAssetDataElementLen, 32) // `nestedAssetData[i].length` plus 32 byte length
+ )
+
+ // call `assetProxy.transferFrom`
+ let success := call(
+ gas, // forward all gas
+ assetProxy, // call address of asset proxy
+ 0, // don't send any ETH
+ 0, // pointer to start of input
+ add(164, nestedAssetDataElementLen), // length of input
+ 0, // write output over memory that won't be reused
+ 0 // don't copy output to memory
+ )
+
+ // Revert with reason given by AssetProxy if `transferFrom` call failed
+ if iszero(success) {
+ returndatacopy(
+ 0, // copy to memory at 0
+ 0, // copy from return data at 0
+ returndatasize() // copy all return data
+ )
+ revert(0, returndatasize())
+ }
+ }
+
+ // Return if no `transferFrom` calls reverted
+ return(0, 0)
+ }
+
+ // Revert if undefined function is called
+ revert(0, 0)
+ }
+ }
+
+ /// @dev Gets the proxy id associated with the proxy address.
+ /// @return Proxy id.
+ function getProxyId()
+ external
+ pure
+ returns (bytes4)
+ {
+ return PROXY_ID;
+ }
+}
diff --git a/contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol b/contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol
new file mode 100644
index 000000000..6c3f70500
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol
@@ -0,0 +1,41 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-interfaces/contracts/protocol/AssetProxy/IAuthorizable.sol";
+
+
+contract MAuthorizable is
+ IAuthorizable
+{
+ // Event logged when a new address is authorized.
+ event AuthorizedAddressAdded(
+ address indexed target,
+ address indexed caller
+ );
+
+ // Event logged when a currently authorized address is unauthorized.
+ event AuthorizedAddressRemoved(
+ address indexed target,
+ address indexed caller
+ );
+
+ /// @dev Only authorized addresses can invoke functions with this modifier.
+ modifier onlyAuthorized { revert(); _; }
+}
diff --git a/contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol b/contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol
new file mode 100644
index 000000000..bfc7b5a66
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol
@@ -0,0 +1,108 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+import "@0x/contracts-multisig/contracts/multisig/MultiSigWalletWithTimeLock.sol";
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+
+
+contract AssetProxyOwner is
+ MultiSigWalletWithTimeLock
+{
+ using LibBytes for bytes;
+
+ event AssetProxyRegistration(address assetProxyContract, bool isRegistered);
+
+ // Mapping of AssetProxy contract address =>
+ // if this contract is allowed to call the AssetProxy's `removeAuthorizedAddressAtIndex` method without a time lock.
+ mapping (address => bool) public isAssetProxyRegistered;
+
+ bytes4 constant internal REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR = bytes4(keccak256("removeAuthorizedAddressAtIndex(address,uint256)"));
+
+ /// @dev Function will revert if the transaction does not call `removeAuthorizedAddressAtIndex`
+ /// on an approved AssetProxy contract.
+ modifier validRemoveAuthorizedAddressAtIndexTx(uint256 transactionId) {
+ Transaction storage txn = transactions[transactionId];
+ require(
+ isAssetProxyRegistered[txn.destination],
+ "UNREGISTERED_ASSET_PROXY"
+ );
+ require(
+ txn.data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR,
+ "INVALID_FUNCTION_SELECTOR"
+ );
+ _;
+ }
+
+ /// @dev Contract constructor sets initial owners, required number of confirmations,
+ /// time lock, and list of AssetProxy addresses.
+ /// @param _owners List of initial owners.
+ /// @param _assetProxyContracts Array of AssetProxy contract addresses.
+ /// @param _required Number of required confirmations.
+ /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.
+ constructor (
+ address[] memory _owners,
+ address[] memory _assetProxyContracts,
+ uint256 _required,
+ uint256 _secondsTimeLocked
+ )
+ public
+ MultiSigWalletWithTimeLock(_owners, _required, _secondsTimeLocked)
+ {
+ for (uint256 i = 0; i < _assetProxyContracts.length; i++) {
+ address assetProxy = _assetProxyContracts[i];
+ require(
+ assetProxy != address(0),
+ "INVALID_ASSET_PROXY"
+ );
+ isAssetProxyRegistered[assetProxy] = true;
+ }
+ }
+
+ /// @dev Registers or deregisters an AssetProxy to be able to execute
+ /// `removeAuthorizedAddressAtIndex` without a timelock.
+ /// @param assetProxyContract Address of AssetProxy contract.
+ /// @param isRegistered Status of approval for AssetProxy contract.
+ function registerAssetProxy(address assetProxyContract, bool isRegistered)
+ public
+ onlyWallet
+ notNull(assetProxyContract)
+ {
+ isAssetProxyRegistered[assetProxyContract] = isRegistered;
+ emit AssetProxyRegistration(assetProxyContract, isRegistered);
+ }
+
+ /// @dev Allows execution of `removeAuthorizedAddressAtIndex` without time lock.
+ /// @param transactionId Transaction ID.
+ function executeRemoveAuthorizedAddressAtIndex(uint256 transactionId)
+ public
+ notExecuted(transactionId)
+ fullyConfirmed(transactionId)
+ validRemoveAuthorizedAddressAtIndexTx(transactionId)
+ {
+ Transaction storage txn = transactions[transactionId];
+ txn.executed = true;
+ if (external_call(txn.destination, txn.value, txn.data.length, txn.data)) {
+ emit Execution(transactionId);
+ } else {
+ emit ExecutionFailure(transactionId);
+ txn.executed = false;
+ }
+ }
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/Exchange.sol b/contracts/protocol/contracts/protocol/Exchange/Exchange.sol
new file mode 100644
index 000000000..65ca742ea
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/Exchange.sol
@@ -0,0 +1,53 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
+import "./MixinExchangeCore.sol";
+import "./MixinSignatureValidator.sol";
+import "./MixinWrapperFunctions.sol";
+import "./MixinAssetProxyDispatcher.sol";
+import "./MixinTransactions.sol";
+import "./MixinMatchOrders.sol";
+
+
+// solhint-disable no-empty-blocks
+contract Exchange is
+ MixinExchangeCore,
+ MixinMatchOrders,
+ MixinSignatureValidator,
+ MixinTransactions,
+ MixinAssetProxyDispatcher,
+ MixinWrapperFunctions
+{
+ string constant public VERSION = "2.0.1-alpha";
+
+ // Mixins are instantiated in the order they are inherited
+ constructor (bytes memory _zrxAssetData)
+ public
+ LibConstants(_zrxAssetData) // @TODO: Remove when we deploy.
+ MixinExchangeCore()
+ MixinMatchOrders()
+ MixinSignatureValidator()
+ MixinTransactions()
+ MixinAssetProxyDispatcher()
+ MixinWrapperFunctions()
+ {}
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol b/contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol
new file mode 100644
index 000000000..2922a8c1a
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol
@@ -0,0 +1,174 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "./mixins/MAssetProxyDispatcher.sol";
+import "@0x/contracts-interfaces/contracts/protocol/AssetProxy/IAssetProxy.sol";
+
+
+contract MixinAssetProxyDispatcher is
+ Ownable,
+ MAssetProxyDispatcher
+{
+ // Mapping from Asset Proxy Id's to their respective Asset Proxy
+ mapping (bytes4 => IAssetProxy) public assetProxies;
+
+ /// @dev Registers an asset proxy to its asset proxy id.
+ /// Once an asset proxy is registered, it cannot be unregistered.
+ /// @param assetProxy Address of new asset proxy to register.
+ function registerAssetProxy(address assetProxy)
+ external
+ onlyOwner
+ {
+ IAssetProxy assetProxyContract = IAssetProxy(assetProxy);
+
+ // Ensure that no asset proxy exists with current id.
+ bytes4 assetProxyId = assetProxyContract.getProxyId();
+ address currentAssetProxy = assetProxies[assetProxyId];
+ require(
+ currentAssetProxy == address(0),
+ "ASSET_PROXY_ALREADY_EXISTS"
+ );
+
+ // Add asset proxy and log registration.
+ assetProxies[assetProxyId] = assetProxyContract;
+ emit AssetProxyRegistered(
+ assetProxyId,
+ assetProxy
+ );
+ }
+
+ /// @dev Gets an asset proxy.
+ /// @param assetProxyId Id of the asset proxy.
+ /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.
+ function getAssetProxy(bytes4 assetProxyId)
+ external
+ view
+ returns (address)
+ {
+ return assetProxies[assetProxyId];
+ }
+
+ /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.
+ /// @param assetData Byte array encoded for the asset.
+ /// @param from Address to transfer token from.
+ /// @param to Address to transfer token to.
+ /// @param amount Amount of token to transfer.
+ function dispatchTransferFrom(
+ bytes memory assetData,
+ address from,
+ address to,
+ uint256 amount
+ )
+ internal
+ {
+ // Do nothing if no amount should be transferred.
+ if (amount > 0 && from != to) {
+ // Ensure assetData length is valid
+ require(
+ assetData.length > 3,
+ "LENGTH_GREATER_THAN_3_REQUIRED"
+ );
+
+ // Lookup assetProxy. We do not use `LibBytes.readBytes4` for gas efficiency reasons.
+ bytes4 assetProxyId;
+ assembly {
+ assetProxyId := and(mload(
+ add(assetData, 32)),
+ 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000
+ )
+ }
+ address assetProxy = assetProxies[assetProxyId];
+
+ // Ensure that assetProxy exists
+ require(
+ assetProxy != address(0),
+ "ASSET_PROXY_DOES_NOT_EXIST"
+ );
+
+ // We construct calldata for the `assetProxy.transferFrom` ABI.
+ // The layout of this calldata is in the table below.
+ //
+ // | Area | Offset | Length | Contents |
+ // | -------- |--------|---------|-------------------------------------------- |
+ // | Header | 0 | 4 | function selector |
+ // | Params | | 4 * 32 | function parameters: |
+ // | | 4 | | 1. offset to assetData (*) |
+ // | | 36 | | 2. from |
+ // | | 68 | | 3. to |
+ // | | 100 | | 4. amount |
+ // | Data | | | assetData: |
+ // | | 132 | 32 | assetData Length |
+ // | | 164 | ** | assetData Contents |
+
+ assembly {
+ /////// Setup State ///////
+ // `cdStart` is the start of the calldata for `assetProxy.transferFrom` (equal to free memory ptr).
+ let cdStart := mload(64)
+ // `dataAreaLength` is the total number of words needed to store `assetData`
+ // As-per the ABI spec, this value is padded up to the nearest multiple of 32,
+ // and includes 32-bytes for length.
+ let dataAreaLength := and(add(mload(assetData), 63), 0xFFFFFFFFFFFE0)
+ // `cdEnd` is the end of the calldata for `assetProxy.transferFrom`.
+ let cdEnd := add(cdStart, add(132, dataAreaLength))
+
+
+ /////// Setup Header Area ///////
+ // This area holds the 4-byte `transferFromSelector`.
+ // bytes4(keccak256("transferFrom(bytes,address,address,uint256)")) = 0xa85e59e4
+ mstore(cdStart, 0xa85e59e400000000000000000000000000000000000000000000000000000000)
+
+ /////// Setup Params Area ///////
+ // Each parameter is padded to 32-bytes. The entire Params Area is 128 bytes.
+ // Notes:
+ // 1. The offset to `assetData` is the length of the Params Area (128 bytes).
+ // 2. A 20-byte mask is applied to addresses to zero-out the unused bytes.
+ mstore(add(cdStart, 4), 128)
+ mstore(add(cdStart, 36), and(from, 0xffffffffffffffffffffffffffffffffffffffff))
+ mstore(add(cdStart, 68), and(to, 0xffffffffffffffffffffffffffffffffffffffff))
+ mstore(add(cdStart, 100), amount)
+
+ /////// Setup Data Area ///////
+ // This area holds `assetData`.
+ let dataArea := add(cdStart, 132)
+ // solhint-disable-next-line no-empty-blocks
+ for {} lt(dataArea, cdEnd) {} {
+ mstore(dataArea, mload(assetData))
+ dataArea := add(dataArea, 32)
+ assetData := add(assetData, 32)
+ }
+
+ /////// Call `assetProxy.transferFrom` using the constructed calldata ///////
+ let success := call(
+ gas, // forward all gas
+ assetProxy, // call address of asset proxy
+ 0, // don't send any ETH
+ cdStart, // pointer to start of input
+ sub(cdEnd, cdStart), // length of input
+ cdStart, // write output over input
+ 512 // reserve 512 bytes for output
+ )
+ if iszero(success) {
+ revert(cdStart, returndatasize())
+ }
+ }
+ }
+ }
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol b/contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol
new file mode 100644
index 000000000..72bcebc62
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinExchangeCore.sol
@@ -0,0 +1,529 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
+import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+import "./mixins/MExchangeCore.sol";
+import "./mixins/MSignatureValidator.sol";
+import "./mixins/MTransactions.sol";
+import "./mixins/MAssetProxyDispatcher.sol";
+
+
+contract MixinExchangeCore is
+ ReentrancyGuard,
+ LibConstants,
+ LibMath,
+ LibOrder,
+ LibFillResults,
+ MAssetProxyDispatcher,
+ MExchangeCore,
+ MSignatureValidator,
+ MTransactions
+{
+ // Mapping of orderHash => amount of takerAsset already bought by maker
+ mapping (bytes32 => uint256) public filled;
+
+ // Mapping of orderHash => cancelled
+ mapping (bytes32 => bool) public cancelled;
+
+ // Mapping of makerAddress => senderAddress => lowest salt an order can have in order to be fillable
+ // Orders with specified senderAddress and with a salt less than their epoch are considered cancelled
+ mapping (address => mapping (address => uint256)) public orderEpoch;
+
+ /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch
+ /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).
+ /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
+ function cancelOrdersUpTo(uint256 targetOrderEpoch)
+ external
+ nonReentrant
+ {
+ address makerAddress = getCurrentContextAddress();
+ // If this function is called via `executeTransaction`, we only update the orderEpoch for the makerAddress/msg.sender combination.
+ // This allows external filter contracts to add rules to how orders are cancelled via this function.
+ address senderAddress = makerAddress == msg.sender ? address(0) : msg.sender;
+
+ // orderEpoch is initialized to 0, so to cancelUpTo we need salt + 1
+ uint256 newOrderEpoch = targetOrderEpoch + 1;
+ uint256 oldOrderEpoch = orderEpoch[makerAddress][senderAddress];
+
+ // Ensure orderEpoch is monotonically increasing
+ require(
+ newOrderEpoch > oldOrderEpoch,
+ "INVALID_NEW_ORDER_EPOCH"
+ );
+
+ // Update orderEpoch
+ orderEpoch[makerAddress][senderAddress] = newOrderEpoch;
+ emit CancelUpTo(
+ makerAddress,
+ senderAddress,
+ newOrderEpoch
+ );
+ }
+
+ /// @dev Fills the input order.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ /// @return Amounts filled and fees paid by maker and taker.
+ function fillOrder(
+ Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ public
+ nonReentrant
+ returns (FillResults memory fillResults)
+ {
+ fillResults = fillOrderInternal(
+ order,
+ takerAssetFillAmount,
+ signature
+ );
+ return fillResults;
+ }
+
+ /// @dev After calling, the order can not be filled anymore.
+ /// Throws if order is invalid or sender does not have permission to cancel.
+ /// @param order Order to cancel. Order must be OrderStatus.FILLABLE.
+ function cancelOrder(Order memory order)
+ public
+ nonReentrant
+ {
+ cancelOrderInternal(order);
+ }
+
+ /// @dev Gets information about an order: status, hash, and amount filled.
+ /// @param order Order to gather information on.
+ /// @return OrderInfo Information about the order and its state.
+ /// See LibOrder.OrderInfo for a complete description.
+ function getOrderInfo(Order memory order)
+ public
+ view
+ returns (OrderInfo memory orderInfo)
+ {
+ // Compute the order hash
+ orderInfo.orderHash = getOrderHash(order);
+
+ // Fetch filled amount
+ orderInfo.orderTakerAssetFilledAmount = filled[orderInfo.orderHash];
+
+ // If order.makerAssetAmount is zero, we also reject the order.
+ // While the Exchange contract handles them correctly, they create
+ // edge cases in the supporting infrastructure because they have
+ // an 'infinite' price when computed by a simple division.
+ if (order.makerAssetAmount == 0) {
+ orderInfo.orderStatus = uint8(OrderStatus.INVALID_MAKER_ASSET_AMOUNT);
+ return orderInfo;
+ }
+
+ // If order.takerAssetAmount is zero, then the order will always
+ // be considered filled because 0 == takerAssetAmount == orderTakerAssetFilledAmount
+ // Instead of distinguishing between unfilled and filled zero taker
+ // amount orders, we choose not to support them.
+ if (order.takerAssetAmount == 0) {
+ orderInfo.orderStatus = uint8(OrderStatus.INVALID_TAKER_ASSET_AMOUNT);
+ return orderInfo;
+ }
+
+ // Validate order availability
+ if (orderInfo.orderTakerAssetFilledAmount >= order.takerAssetAmount) {
+ orderInfo.orderStatus = uint8(OrderStatus.FULLY_FILLED);
+ return orderInfo;
+ }
+
+ // Validate order expiration
+ // solhint-disable-next-line not-rely-on-time
+ if (block.timestamp >= order.expirationTimeSeconds) {
+ orderInfo.orderStatus = uint8(OrderStatus.EXPIRED);
+ return orderInfo;
+ }
+
+ // Check if order has been cancelled
+ if (cancelled[orderInfo.orderHash]) {
+ orderInfo.orderStatus = uint8(OrderStatus.CANCELLED);
+ return orderInfo;
+ }
+ if (orderEpoch[order.makerAddress][order.senderAddress] > order.salt) {
+ orderInfo.orderStatus = uint8(OrderStatus.CANCELLED);
+ return orderInfo;
+ }
+
+ // All other statuses are ruled out: order is Fillable
+ orderInfo.orderStatus = uint8(OrderStatus.FILLABLE);
+ return orderInfo;
+ }
+
+ /// @dev Fills the input order.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ /// @return Amounts filled and fees paid by maker and taker.
+ function fillOrderInternal(
+ Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ internal
+ returns (FillResults memory fillResults)
+ {
+ // Fetch order info
+ OrderInfo memory orderInfo = getOrderInfo(order);
+
+ // Fetch taker address
+ address takerAddress = getCurrentContextAddress();
+
+ // Assert that the order is fillable by taker
+ assertFillableOrder(
+ order,
+ orderInfo,
+ takerAddress,
+ signature
+ );
+
+ // Get amount of takerAsset to fill
+ uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderInfo.orderTakerAssetFilledAmount);
+ uint256 takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetAmount);
+
+ // Validate context
+ assertValidFill(
+ order,
+ orderInfo,
+ takerAssetFillAmount,
+ takerAssetFilledAmount,
+ fillResults.makerAssetFilledAmount
+ );
+
+ // Compute proportional fill amounts
+ fillResults = calculateFillResults(order, takerAssetFilledAmount);
+
+ // Update exchange internal state
+ updateFilledState(
+ order,
+ takerAddress,
+ orderInfo.orderHash,
+ orderInfo.orderTakerAssetFilledAmount,
+ fillResults
+ );
+
+ // Settle order
+ settleOrder(
+ order,
+ takerAddress,
+ fillResults
+ );
+
+ return fillResults;
+ }
+
+ /// @dev After calling, the order can not be filled anymore.
+ /// Throws if order is invalid or sender does not have permission to cancel.
+ /// @param order Order to cancel. Order must be OrderStatus.FILLABLE.
+ function cancelOrderInternal(Order memory order)
+ internal
+ {
+ // Fetch current order status
+ OrderInfo memory orderInfo = getOrderInfo(order);
+
+ // Validate context
+ assertValidCancel(order, orderInfo);
+
+ // Perform cancel
+ updateCancelledState(order, orderInfo.orderHash);
+ }
+
+ /// @dev Updates state with results of a fill order.
+ /// @param order that was filled.
+ /// @param takerAddress Address of taker who filled the order.
+ /// @param orderTakerAssetFilledAmount Amount of order already filled.
+ function updateFilledState(
+ Order memory order,
+ address takerAddress,
+ bytes32 orderHash,
+ uint256 orderTakerAssetFilledAmount,
+ FillResults memory fillResults
+ )
+ internal
+ {
+ // Update state
+ filled[orderHash] = safeAdd(orderTakerAssetFilledAmount, fillResults.takerAssetFilledAmount);
+
+ // Log order
+ emit Fill(
+ order.makerAddress,
+ order.feeRecipientAddress,
+ takerAddress,
+ msg.sender,
+ fillResults.makerAssetFilledAmount,
+ fillResults.takerAssetFilledAmount,
+ fillResults.makerFeePaid,
+ fillResults.takerFeePaid,
+ orderHash,
+ order.makerAssetData,
+ order.takerAssetData
+ );
+ }
+
+ /// @dev Updates state with results of cancelling an order.
+ /// State is only updated if the order is currently fillable.
+ /// Otherwise, updating state would have no effect.
+ /// @param order that was cancelled.
+ /// @param orderHash Hash of order that was cancelled.
+ function updateCancelledState(
+ Order memory order,
+ bytes32 orderHash
+ )
+ internal
+ {
+ // Perform cancel
+ cancelled[orderHash] = true;
+
+ // Log cancel
+ emit Cancel(
+ order.makerAddress,
+ order.feeRecipientAddress,
+ msg.sender,
+ orderHash,
+ order.makerAssetData,
+ order.takerAssetData
+ );
+ }
+
+ /// @dev Validates context for fillOrder. Succeeds or throws.
+ /// @param order to be filled.
+ /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
+ /// @param takerAddress Address of order taker.
+ /// @param signature Proof that the orders was created by its maker.
+ function assertFillableOrder(
+ Order memory order,
+ OrderInfo memory orderInfo,
+ address takerAddress,
+ bytes memory signature
+ )
+ internal
+ view
+ {
+ // An order can only be filled if its status is FILLABLE.
+ require(
+ orderInfo.orderStatus == uint8(OrderStatus.FILLABLE),
+ "ORDER_UNFILLABLE"
+ );
+
+ // Validate sender is allowed to fill this order
+ if (order.senderAddress != address(0)) {
+ require(
+ order.senderAddress == msg.sender,
+ "INVALID_SENDER"
+ );
+ }
+
+ // Validate taker is allowed to fill this order
+ if (order.takerAddress != address(0)) {
+ require(
+ order.takerAddress == takerAddress,
+ "INVALID_TAKER"
+ );
+ }
+
+ // Validate Maker signature (check only if first time seen)
+ if (orderInfo.orderTakerAssetFilledAmount == 0) {
+ require(
+ isValidSignature(
+ orderInfo.orderHash,
+ order.makerAddress,
+ signature
+ ),
+ "INVALID_ORDER_SIGNATURE"
+ );
+ }
+ }
+
+ /// @dev Validates context for fillOrder. Succeeds or throws.
+ /// @param order to be filled.
+ /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
+ /// @param takerAssetFillAmount Desired amount of order to fill by taker.
+ /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
+ /// @param makerAssetFilledAmount Amount of makerAsset that will be transfered.
+ function assertValidFill(
+ Order memory order,
+ OrderInfo memory orderInfo,
+ uint256 takerAssetFillAmount, // TODO: use FillResults
+ uint256 takerAssetFilledAmount,
+ uint256 makerAssetFilledAmount
+ )
+ internal
+ view
+ {
+ // Revert if fill amount is invalid
+ // TODO: reconsider necessity for v2.1
+ require(
+ takerAssetFillAmount != 0,
+ "INVALID_TAKER_AMOUNT"
+ );
+
+ // Make sure taker does not pay more than desired amount
+ // NOTE: This assertion should never fail, it is here
+ // as an extra defence against potential bugs.
+ require(
+ takerAssetFilledAmount <= takerAssetFillAmount,
+ "TAKER_OVERPAY"
+ );
+
+ // Make sure order is not overfilled
+ // NOTE: This assertion should never fail, it is here
+ // as an extra defence against potential bugs.
+ require(
+ safeAdd(orderInfo.orderTakerAssetFilledAmount, takerAssetFilledAmount) <= order.takerAssetAmount,
+ "ORDER_OVERFILL"
+ );
+
+ // Make sure order is filled at acceptable price.
+ // The order has an implied price from the makers perspective:
+ // order price = order.makerAssetAmount / order.takerAssetAmount
+ // i.e. the number of makerAsset maker is paying per takerAsset. The
+ // maker is guaranteed to get this price or a better (lower) one. The
+ // actual price maker is getting in this fill is:
+ // fill price = makerAssetFilledAmount / takerAssetFilledAmount
+ // We need `fill price <= order price` for the fill to be fair to maker.
+ // This amounts to:
+ // makerAssetFilledAmount order.makerAssetAmount
+ // ------------------------ <= -----------------------
+ // takerAssetFilledAmount order.takerAssetAmount
+ // or, equivalently:
+ // makerAssetFilledAmount * order.takerAssetAmount <=
+ // order.makerAssetAmount * takerAssetFilledAmount
+ // NOTE: This assertion should never fail, it is here
+ // as an extra defence against potential bugs.
+ require(
+ safeMul(makerAssetFilledAmount, order.takerAssetAmount)
+ <=
+ safeMul(order.makerAssetAmount, takerAssetFilledAmount),
+ "INVALID_FILL_PRICE"
+ );
+ }
+
+ /// @dev Validates context for cancelOrder. Succeeds or throws.
+ /// @param order to be cancelled.
+ /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
+ function assertValidCancel(
+ Order memory order,
+ OrderInfo memory orderInfo
+ )
+ internal
+ view
+ {
+ // Ensure order is valid
+ // An order can only be cancelled if its status is FILLABLE.
+ require(
+ orderInfo.orderStatus == uint8(OrderStatus.FILLABLE),
+ "ORDER_UNFILLABLE"
+ );
+
+ // Validate sender is allowed to cancel this order
+ if (order.senderAddress != address(0)) {
+ require(
+ order.senderAddress == msg.sender,
+ "INVALID_SENDER"
+ );
+ }
+
+ // Validate transaction signed by maker
+ address makerAddress = getCurrentContextAddress();
+ require(
+ order.makerAddress == makerAddress,
+ "INVALID_MAKER"
+ );
+ }
+
+ /// @dev Calculates amounts filled and fees paid by maker and taker.
+ /// @param order to be filled.
+ /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
+ /// @return fillResults Amounts filled and fees paid by maker and taker.
+ function calculateFillResults(
+ Order memory order,
+ uint256 takerAssetFilledAmount
+ )
+ internal
+ pure
+ returns (FillResults memory fillResults)
+ {
+ // Compute proportional transfer amounts
+ fillResults.takerAssetFilledAmount = takerAssetFilledAmount;
+ fillResults.makerAssetFilledAmount = safeGetPartialAmountFloor(
+ takerAssetFilledAmount,
+ order.takerAssetAmount,
+ order.makerAssetAmount
+ );
+ fillResults.makerFeePaid = safeGetPartialAmountFloor(
+ fillResults.makerAssetFilledAmount,
+ order.makerAssetAmount,
+ order.makerFee
+ );
+ fillResults.takerFeePaid = safeGetPartialAmountFloor(
+ takerAssetFilledAmount,
+ order.takerAssetAmount,
+ order.takerFee
+ );
+
+ return fillResults;
+ }
+
+ /// @dev Settles an order by transferring assets between counterparties.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAddress Address selling takerAsset and buying makerAsset.
+ /// @param fillResults Amounts to be filled and fees paid by maker and taker.
+ function settleOrder(
+ LibOrder.Order memory order,
+ address takerAddress,
+ LibFillResults.FillResults memory fillResults
+ )
+ private
+ {
+ bytes memory zrxAssetData = ZRX_ASSET_DATA;
+ dispatchTransferFrom(
+ order.makerAssetData,
+ order.makerAddress,
+ takerAddress,
+ fillResults.makerAssetFilledAmount
+ );
+ dispatchTransferFrom(
+ order.takerAssetData,
+ takerAddress,
+ order.makerAddress,
+ fillResults.takerAssetFilledAmount
+ );
+ dispatchTransferFrom(
+ zrxAssetData,
+ order.makerAddress,
+ order.feeRecipientAddress,
+ fillResults.makerFeePaid
+ );
+ dispatchTransferFrom(
+ zrxAssetData,
+ takerAddress,
+ order.feeRecipientAddress,
+ fillResults.takerFeePaid
+ );
+ }
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol b/contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol
new file mode 100644
index 000000000..2627b82fd
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinMatchOrders.sol
@@ -0,0 +1,335 @@
+/*
+ Copyright 2018 ZeroEx Intl.
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
+import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "./mixins/MExchangeCore.sol";
+import "./mixins/MMatchOrders.sol";
+import "./mixins/MTransactions.sol";
+import "./mixins/MAssetProxyDispatcher.sol";
+
+
+contract MixinMatchOrders is
+ ReentrancyGuard,
+ LibConstants,
+ LibMath,
+ MAssetProxyDispatcher,
+ MExchangeCore,
+ MMatchOrders,
+ MTransactions
+{
+ /// @dev Match two complementary orders that have a profitable spread.
+ /// Each order is filled at their respective price point. However, the calculations are
+ /// carried out as though the orders are both being filled at the right order's price point.
+ /// The profit made by the left order goes to the taker (who matched the two orders).
+ /// @param leftOrder First order to match.
+ /// @param rightOrder Second order to match.
+ /// @param leftSignature Proof that order was created by the left maker.
+ /// @param rightSignature Proof that order was created by the right maker.
+ /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.
+ function matchOrders(
+ LibOrder.Order memory leftOrder,
+ LibOrder.Order memory rightOrder,
+ bytes memory leftSignature,
+ bytes memory rightSignature
+ )
+ public
+ nonReentrant
+ returns (LibFillResults.MatchedFillResults memory matchedFillResults)
+ {
+ // We assume that rightOrder.takerAssetData == leftOrder.makerAssetData and rightOrder.makerAssetData == leftOrder.takerAssetData.
+ // If this assumption isn't true, the match will fail at signature validation.
+ rightOrder.makerAssetData = leftOrder.takerAssetData;
+ rightOrder.takerAssetData = leftOrder.makerAssetData;
+
+ // Get left & right order info
+ LibOrder.OrderInfo memory leftOrderInfo = getOrderInfo(leftOrder);
+ LibOrder.OrderInfo memory rightOrderInfo = getOrderInfo(rightOrder);
+
+ // Fetch taker address
+ address takerAddress = getCurrentContextAddress();
+
+ // Either our context is valid or we revert
+ assertFillableOrder(
+ leftOrder,
+ leftOrderInfo,
+ takerAddress,
+ leftSignature
+ );
+ assertFillableOrder(
+ rightOrder,
+ rightOrderInfo,
+ takerAddress,
+ rightSignature
+ );
+ assertValidMatch(leftOrder, rightOrder);
+
+ // Compute proportional fill amounts
+ matchedFillResults = calculateMatchedFillResults(
+ leftOrder,
+ rightOrder,
+ leftOrderInfo.orderTakerAssetFilledAmount,
+ rightOrderInfo.orderTakerAssetFilledAmount
+ );
+
+ // Validate fill contexts
+ assertValidFill(
+ leftOrder,
+ leftOrderInfo,
+ matchedFillResults.left.takerAssetFilledAmount,
+ matchedFillResults.left.takerAssetFilledAmount,
+ matchedFillResults.left.makerAssetFilledAmount
+ );
+ assertValidFill(
+ rightOrder,
+ rightOrderInfo,
+ matchedFillResults.right.takerAssetFilledAmount,
+ matchedFillResults.right.takerAssetFilledAmount,
+ matchedFillResults.right.makerAssetFilledAmount
+ );
+
+ // Update exchange state
+ updateFilledState(
+ leftOrder,
+ takerAddress,
+ leftOrderInfo.orderHash,
+ leftOrderInfo.orderTakerAssetFilledAmount,
+ matchedFillResults.left
+ );
+ updateFilledState(
+ rightOrder,
+ takerAddress,
+ rightOrderInfo.orderHash,
+ rightOrderInfo.orderTakerAssetFilledAmount,
+ matchedFillResults.right
+ );
+
+ // Settle matched orders. Succeeds or throws.
+ settleMatchedOrders(
+ leftOrder,
+ rightOrder,
+ takerAddress,
+ matchedFillResults
+ );
+
+ return matchedFillResults;
+ }
+
+ /// @dev Validates context for matchOrders. Succeeds or throws.
+ /// @param leftOrder First order to match.
+ /// @param rightOrder Second order to match.
+ function assertValidMatch(
+ LibOrder.Order memory leftOrder,
+ LibOrder.Order memory rightOrder
+ )
+ internal
+ pure
+ {
+ // Make sure there is a profitable spread.
+ // There is a profitable spread iff the cost per unit bought (OrderA.MakerAmount/OrderA.TakerAmount) for each order is greater
+ // than the profit per unit sold of the matched order (OrderB.TakerAmount/OrderB.MakerAmount).
+ // This is satisfied by the equations below:
+ // <leftOrder.makerAssetAmount> / <leftOrder.takerAssetAmount> >= <rightOrder.takerAssetAmount> / <rightOrder.makerAssetAmount>
+ // AND
+ // <rightOrder.makerAssetAmount> / <rightOrder.takerAssetAmount> >= <leftOrder.takerAssetAmount> / <leftOrder.makerAssetAmount>
+ // These equations can be combined to get the following:
+ require(
+ safeMul(leftOrder.makerAssetAmount, rightOrder.makerAssetAmount) >=
+ safeMul(leftOrder.takerAssetAmount, rightOrder.takerAssetAmount),
+ "NEGATIVE_SPREAD_REQUIRED"
+ );
+ }
+
+ /// @dev Calculates fill amounts for the matched orders.
+ /// Each order is filled at their respective price point. However, the calculations are
+ /// carried out as though the orders are both being filled at the right order's price point.
+ /// The profit made by the leftOrder order goes to the taker (who matched the two orders).
+ /// @param leftOrder First order to match.
+ /// @param rightOrder Second order to match.
+ /// @param leftOrderTakerAssetFilledAmount Amount of left order already filled.
+ /// @param rightOrderTakerAssetFilledAmount Amount of right order already filled.
+ /// @param matchedFillResults Amounts to fill and fees to pay by maker and taker of matched orders.
+ function calculateMatchedFillResults(
+ LibOrder.Order memory leftOrder,
+ LibOrder.Order memory rightOrder,
+ uint256 leftOrderTakerAssetFilledAmount,
+ uint256 rightOrderTakerAssetFilledAmount
+ )
+ internal
+ pure
+ returns (LibFillResults.MatchedFillResults memory matchedFillResults)
+ {
+ // Derive maker asset amounts for left & right orders, given store taker assert amounts
+ uint256 leftTakerAssetAmountRemaining = safeSub(leftOrder.takerAssetAmount, leftOrderTakerAssetFilledAmount);
+ uint256 leftMakerAssetAmountRemaining = safeGetPartialAmountFloor(
+ leftOrder.makerAssetAmount,
+ leftOrder.takerAssetAmount,
+ leftTakerAssetAmountRemaining
+ );
+ uint256 rightTakerAssetAmountRemaining = safeSub(rightOrder.takerAssetAmount, rightOrderTakerAssetFilledAmount);
+ uint256 rightMakerAssetAmountRemaining = safeGetPartialAmountFloor(
+ rightOrder.makerAssetAmount,
+ rightOrder.takerAssetAmount,
+ rightTakerAssetAmountRemaining
+ );
+
+ // Calculate fill results for maker and taker assets: at least one order will be fully filled.
+ // The maximum amount the left maker can buy is `leftTakerAssetAmountRemaining`
+ // The maximum amount the right maker can sell is `rightMakerAssetAmountRemaining`
+ // We have two distinct cases for calculating the fill results:
+ // Case 1.
+ // If the left maker can buy more than the right maker can sell, then only the right order is fully filled.
+ // If the left maker can buy exactly what the right maker can sell, then both orders are fully filled.
+ // Case 2.
+ // If the left maker cannot buy more than the right maker can sell, then only the left order is fully filled.
+ if (leftTakerAssetAmountRemaining >= rightMakerAssetAmountRemaining) {
+ // Case 1: Right order is fully filled
+ matchedFillResults.right.makerAssetFilledAmount = rightMakerAssetAmountRemaining;
+ matchedFillResults.right.takerAssetFilledAmount = rightTakerAssetAmountRemaining;
+ matchedFillResults.left.takerAssetFilledAmount = matchedFillResults.right.makerAssetFilledAmount;
+ // Round down to ensure the maker's exchange rate does not exceed the price specified by the order.
+ // We favor the maker when the exchange rate must be rounded.
+ matchedFillResults.left.makerAssetFilledAmount = safeGetPartialAmountFloor(
+ leftOrder.makerAssetAmount,
+ leftOrder.takerAssetAmount,
+ matchedFillResults.left.takerAssetFilledAmount
+ );
+ } else {
+ // Case 2: Left order is fully filled
+ matchedFillResults.left.makerAssetFilledAmount = leftMakerAssetAmountRemaining;
+ matchedFillResults.left.takerAssetFilledAmount = leftTakerAssetAmountRemaining;
+ matchedFillResults.right.makerAssetFilledAmount = matchedFillResults.left.takerAssetFilledAmount;
+ // Round up to ensure the maker's exchange rate does not exceed the price specified by the order.
+ // We favor the maker when the exchange rate must be rounded.
+ matchedFillResults.right.takerAssetFilledAmount = safeGetPartialAmountCeil(
+ rightOrder.takerAssetAmount,
+ rightOrder.makerAssetAmount,
+ matchedFillResults.right.makerAssetFilledAmount
+ );
+ }
+
+ // Calculate amount given to taker
+ matchedFillResults.leftMakerAssetSpreadAmount = safeSub(
+ matchedFillResults.left.makerAssetFilledAmount,
+ matchedFillResults.right.takerAssetFilledAmount
+ );
+
+ // Compute fees for left order
+ matchedFillResults.left.makerFeePaid = safeGetPartialAmountFloor(
+ matchedFillResults.left.makerAssetFilledAmount,
+ leftOrder.makerAssetAmount,
+ leftOrder.makerFee
+ );
+ matchedFillResults.left.takerFeePaid = safeGetPartialAmountFloor(
+ matchedFillResults.left.takerAssetFilledAmount,
+ leftOrder.takerAssetAmount,
+ leftOrder.takerFee
+ );
+
+ // Compute fees for right order
+ matchedFillResults.right.makerFeePaid = safeGetPartialAmountFloor(
+ matchedFillResults.right.makerAssetFilledAmount,
+ rightOrder.makerAssetAmount,
+ rightOrder.makerFee
+ );
+ matchedFillResults.right.takerFeePaid = safeGetPartialAmountFloor(
+ matchedFillResults.right.takerAssetFilledAmount,
+ rightOrder.takerAssetAmount,
+ rightOrder.takerFee
+ );
+
+ // Return fill results
+ return matchedFillResults;
+ }
+
+ /// @dev Settles matched order by transferring appropriate funds between order makers, taker, and fee recipient.
+ /// @param leftOrder First matched order.
+ /// @param rightOrder Second matched order.
+ /// @param takerAddress Address that matched the orders. The taker receives the spread between orders as profit.
+ /// @param matchedFillResults Struct holding amounts to transfer between makers, taker, and fee recipients.
+ function settleMatchedOrders(
+ LibOrder.Order memory leftOrder,
+ LibOrder.Order memory rightOrder,
+ address takerAddress,
+ LibFillResults.MatchedFillResults memory matchedFillResults
+ )
+ private
+ {
+ bytes memory zrxAssetData = ZRX_ASSET_DATA;
+ // Order makers and taker
+ dispatchTransferFrom(
+ leftOrder.makerAssetData,
+ leftOrder.makerAddress,
+ rightOrder.makerAddress,
+ matchedFillResults.right.takerAssetFilledAmount
+ );
+ dispatchTransferFrom(
+ rightOrder.makerAssetData,
+ rightOrder.makerAddress,
+ leftOrder.makerAddress,
+ matchedFillResults.left.takerAssetFilledAmount
+ );
+ dispatchTransferFrom(
+ leftOrder.makerAssetData,
+ leftOrder.makerAddress,
+ takerAddress,
+ matchedFillResults.leftMakerAssetSpreadAmount
+ );
+
+ // Maker fees
+ dispatchTransferFrom(
+ zrxAssetData,
+ leftOrder.makerAddress,
+ leftOrder.feeRecipientAddress,
+ matchedFillResults.left.makerFeePaid
+ );
+ dispatchTransferFrom(
+ zrxAssetData,
+ rightOrder.makerAddress,
+ rightOrder.feeRecipientAddress,
+ matchedFillResults.right.makerFeePaid
+ );
+
+ // Taker fees
+ if (leftOrder.feeRecipientAddress == rightOrder.feeRecipientAddress) {
+ dispatchTransferFrom(
+ zrxAssetData,
+ takerAddress,
+ leftOrder.feeRecipientAddress,
+ safeAdd(
+ matchedFillResults.left.takerFeePaid,
+ matchedFillResults.right.takerFeePaid
+ )
+ );
+ } else {
+ dispatchTransferFrom(
+ zrxAssetData,
+ takerAddress,
+ leftOrder.feeRecipientAddress,
+ matchedFillResults.left.takerFeePaid
+ );
+ dispatchTransferFrom(
+ zrxAssetData,
+ takerAddress,
+ rightOrder.feeRecipientAddress,
+ matchedFillResults.right.takerFeePaid
+ );
+ }
+ }
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol b/contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol
new file mode 100644
index 000000000..b40aa1412
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinSignatureValidator.sol
@@ -0,0 +1,324 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
+import "./mixins/MSignatureValidator.sol";
+import "./mixins/MTransactions.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWallet.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IValidator.sol";
+
+
+contract MixinSignatureValidator is
+ ReentrancyGuard,
+ MSignatureValidator,
+ MTransactions
+{
+ using LibBytes for bytes;
+
+ // Mapping of hash => signer => signed
+ mapping (bytes32 => mapping (address => bool)) public preSigned;
+
+ // Mapping of signer => validator => approved
+ mapping (address => mapping (address => bool)) public allowedValidators;
+
+ /// @dev Approves a hash on-chain using any valid signature type.
+ /// After presigning a hash, the preSign signature type will become valid for that hash and signer.
+ /// @param signerAddress Address that should have signed the given hash.
+ /// @param signature Proof that the hash has been signed by signer.
+ function preSign(
+ bytes32 hash,
+ address signerAddress,
+ bytes signature
+ )
+ external
+ {
+ if (signerAddress != msg.sender) {
+ require(
+ isValidSignature(
+ hash,
+ signerAddress,
+ signature
+ ),
+ "INVALID_SIGNATURE"
+ );
+ }
+ preSigned[hash][signerAddress] = true;
+ }
+
+ /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.
+ /// @param validatorAddress Address of Validator contract.
+ /// @param approval Approval or disapproval of Validator contract.
+ function setSignatureValidatorApproval(
+ address validatorAddress,
+ bool approval
+ )
+ external
+ nonReentrant
+ {
+ address signerAddress = getCurrentContextAddress();
+ allowedValidators[signerAddress][validatorAddress] = approval;
+ emit SignatureValidatorApproval(
+ signerAddress,
+ validatorAddress,
+ approval
+ );
+ }
+
+ /// @dev Verifies that a hash has been signed by the given signer.
+ /// @param hash Any 32 byte hash.
+ /// @param signerAddress Address that should have signed the given hash.
+ /// @param signature Proof that the hash has been signed by signer.
+ /// @return True if the address recovered from the provided signature matches the input signer address.
+ function isValidSignature(
+ bytes32 hash,
+ address signerAddress,
+ bytes memory signature
+ )
+ public
+ view
+ returns (bool isValid)
+ {
+ require(
+ signature.length > 0,
+ "LENGTH_GREATER_THAN_0_REQUIRED"
+ );
+
+ // Pop last byte off of signature byte array.
+ uint8 signatureTypeRaw = uint8(signature.popLastByte());
+
+ // Ensure signature is supported
+ require(
+ signatureTypeRaw < uint8(SignatureType.NSignatureTypes),
+ "SIGNATURE_UNSUPPORTED"
+ );
+
+ SignatureType signatureType = SignatureType(signatureTypeRaw);
+
+ // Variables are not scoped in Solidity.
+ uint8 v;
+ bytes32 r;
+ bytes32 s;
+ address recovered;
+
+ // Always illegal signature.
+ // This is always an implicit option since a signer can create a
+ // signature array with invalid type or length. We may as well make
+ // it an explicit option. This aids testing and analysis. It is
+ // also the initialization value for the enum type.
+ if (signatureType == SignatureType.Illegal) {
+ revert("SIGNATURE_ILLEGAL");
+
+ // Always invalid signature.
+ // Like Illegal, this is always implicitly available and therefore
+ // offered explicitly. It can be implicitly created by providing
+ // a correctly formatted but incorrect signature.
+ } else if (signatureType == SignatureType.Invalid) {
+ require(
+ signature.length == 0,
+ "LENGTH_0_REQUIRED"
+ );
+ isValid = false;
+ return isValid;
+
+ // Signature using EIP712
+ } else if (signatureType == SignatureType.EIP712) {
+ require(
+ signature.length == 65,
+ "LENGTH_65_REQUIRED"
+ );
+ v = uint8(signature[0]);
+ r = signature.readBytes32(1);
+ s = signature.readBytes32(33);
+ recovered = ecrecover(
+ hash,
+ v,
+ r,
+ s
+ );
+ isValid = signerAddress == recovered;
+ return isValid;
+
+ // Signed using web3.eth_sign
+ } else if (signatureType == SignatureType.EthSign) {
+ require(
+ signature.length == 65,
+ "LENGTH_65_REQUIRED"
+ );
+ v = uint8(signature[0]);
+ r = signature.readBytes32(1);
+ s = signature.readBytes32(33);
+ recovered = ecrecover(
+ keccak256(abi.encodePacked(
+ "\x19Ethereum Signed Message:\n32",
+ hash
+ )),
+ v,
+ r,
+ s
+ );
+ isValid = signerAddress == recovered;
+ return isValid;
+
+ // Signature verified by wallet contract.
+ // If used with an order, the maker of the order is the wallet contract.
+ } else if (signatureType == SignatureType.Wallet) {
+ isValid = isValidWalletSignature(
+ hash,
+ signerAddress,
+ signature
+ );
+ return isValid;
+
+ // Signature verified by validator contract.
+ // If used with an order, the maker of the order can still be an EOA.
+ // A signature using this type should be encoded as:
+ // | Offset | Length | Contents |
+ // | 0x00 | x | Signature to validate |
+ // | 0x00 + x | 20 | Address of validator contract |
+ // | 0x14 + x | 1 | Signature type is always "\x06" |
+ } else if (signatureType == SignatureType.Validator) {
+ // Pop last 20 bytes off of signature byte array.
+ address validatorAddress = signature.popLast20Bytes();
+
+ // Ensure signer has approved validator.
+ if (!allowedValidators[signerAddress][validatorAddress]) {
+ return false;
+ }
+ isValid = isValidValidatorSignature(
+ validatorAddress,
+ hash,
+ signerAddress,
+ signature
+ );
+ return isValid;
+
+ // Signer signed hash previously using the preSign function.
+ } else if (signatureType == SignatureType.PreSigned) {
+ isValid = preSigned[hash][signerAddress];
+ return isValid;
+ }
+
+ // Anything else is illegal (We do not return false because
+ // the signature may actually be valid, just not in a format
+ // that we currently support. In this case returning false
+ // may lead the caller to incorrectly believe that the
+ // signature was invalid.)
+ revert("SIGNATURE_UNSUPPORTED");
+ }
+
+ /// @dev Verifies signature using logic defined by Wallet contract.
+ /// @param hash Any 32 byte hash.
+ /// @param walletAddress Address that should have signed the given hash
+ /// and defines its own signature verification method.
+ /// @param signature Proof that the hash has been signed by signer.
+ /// @return True if signature is valid for given wallet..
+ function isValidWalletSignature(
+ bytes32 hash,
+ address walletAddress,
+ bytes signature
+ )
+ internal
+ view
+ returns (bool isValid)
+ {
+ bytes memory callData = abi.encodeWithSelector(
+ IWallet(walletAddress).isValidSignature.selector,
+ hash,
+ signature
+ );
+ assembly {
+ let cdStart := add(callData, 32)
+ let success := staticcall(
+ gas, // forward all gas
+ walletAddress, // address of Wallet contract
+ cdStart, // pointer to start of input
+ mload(callData), // length of input
+ cdStart, // write output over input
+ 32 // output size is 32 bytes
+ )
+
+ switch success
+ case 0 {
+ // Revert with `Error("WALLET_ERROR")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000000c57414c4c45545f4552524f5200000000000000000000000000000000)
+ mstore(96, 0)
+ revert(0, 100)
+ }
+ case 1 {
+ // Signature is valid if call did not revert and returned true
+ isValid := mload(cdStart)
+ }
+ }
+ return isValid;
+ }
+
+ /// @dev Verifies signature using logic defined by Validator contract.
+ /// @param validatorAddress Address of validator contract.
+ /// @param hash Any 32 byte hash.
+ /// @param signerAddress Address that should have signed the given hash.
+ /// @param signature Proof that the hash has been signed by signer.
+ /// @return True if the address recovered from the provided signature matches the input signer address.
+ function isValidValidatorSignature(
+ address validatorAddress,
+ bytes32 hash,
+ address signerAddress,
+ bytes signature
+ )
+ internal
+ view
+ returns (bool isValid)
+ {
+ bytes memory callData = abi.encodeWithSelector(
+ IValidator(signerAddress).isValidSignature.selector,
+ hash,
+ signerAddress,
+ signature
+ );
+ assembly {
+ let cdStart := add(callData, 32)
+ let success := staticcall(
+ gas, // forward all gas
+ validatorAddress, // address of Validator contract
+ cdStart, // pointer to start of input
+ mload(callData), // length of input
+ cdStart, // write output over input
+ 32 // output size is 32 bytes
+ )
+
+ switch success
+ case 0 {
+ // Revert with `Error("VALIDATOR_ERROR")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000000f56414c494441544f525f4552524f5200000000000000000000000000)
+ mstore(96, 0)
+ revert(0, 100)
+ }
+ case 1 {
+ // Signature is valid if call did not revert and returned true
+ isValid := mload(cdStart)
+ }
+ }
+ return isValid;
+ }
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol b/contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol
new file mode 100644
index 000000000..1ac5b1a5e
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinTransactions.sol
@@ -0,0 +1,152 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-libs/contracts/libs/LibExchangeErrors.sol";
+import "./mixins/MSignatureValidator.sol";
+import "./mixins/MTransactions.sol";
+import "@0x/contracts-libs/contracts/libs/LibEIP712.sol";
+
+
+contract MixinTransactions is
+ LibEIP712,
+ MSignatureValidator,
+ MTransactions
+{
+ // Mapping of transaction hash => executed
+ // This prevents transactions from being executed more than once.
+ mapping (bytes32 => bool) public transactions;
+
+ // Address of current transaction signer
+ address public currentContextAddress;
+
+ /// @dev Executes an exchange method call in the context of signer.
+ /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
+ /// @param signerAddress Address of transaction signer.
+ /// @param data AbiV2 encoded calldata.
+ /// @param signature Proof of signer transaction by signer.
+ function executeTransaction(
+ uint256 salt,
+ address signerAddress,
+ bytes data,
+ bytes signature
+ )
+ external
+ {
+ // Prevent reentrancy
+ require(
+ currentContextAddress == address(0),
+ "REENTRANCY_ILLEGAL"
+ );
+
+ bytes32 transactionHash = hashEIP712Message(hashZeroExTransaction(
+ salt,
+ signerAddress,
+ data
+ ));
+
+ // Validate transaction has not been executed
+ require(
+ !transactions[transactionHash],
+ "INVALID_TX_HASH"
+ );
+
+ // Transaction always valid if signer is sender of transaction
+ if (signerAddress != msg.sender) {
+ // Validate signature
+ require(
+ isValidSignature(
+ transactionHash,
+ signerAddress,
+ signature
+ ),
+ "INVALID_TX_SIGNATURE"
+ );
+
+ // Set the current transaction signer
+ currentContextAddress = signerAddress;
+ }
+
+ // Execute transaction
+ transactions[transactionHash] = true;
+ require(
+ address(this).delegatecall(data),
+ "FAILED_EXECUTION"
+ );
+
+ // Reset current transaction signer if it was previously updated
+ if (signerAddress != msg.sender) {
+ currentContextAddress = address(0);
+ }
+ }
+
+ /// @dev Calculates EIP712 hash of the Transaction.
+ /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
+ /// @param signerAddress Address of transaction signer.
+ /// @param data AbiV2 encoded calldata.
+ /// @return EIP712 hash of the Transaction.
+ function hashZeroExTransaction(
+ uint256 salt,
+ address signerAddress,
+ bytes memory data
+ )
+ internal
+ pure
+ returns (bytes32 result)
+ {
+ bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH;
+ bytes32 dataHash = keccak256(data);
+
+ // Assembly for more efficiently computing:
+ // keccak256(abi.encodePacked(
+ // EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH,
+ // salt,
+ // bytes32(signerAddress),
+ // keccak256(data)
+ // ));
+
+ assembly {
+ // Load free memory pointer
+ let memPtr := mload(64)
+
+ mstore(memPtr, schemaHash) // hash of schema
+ mstore(add(memPtr, 32), salt) // salt
+ mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) // signerAddress
+ mstore(add(memPtr, 96), dataHash) // hash of data
+
+ // Compute hash
+ result := keccak256(memPtr, 128)
+ }
+ return result;
+ }
+
+ /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).
+ /// If calling a fill function, this address will represent the taker.
+ /// If calling a cancel function, this address will represent the maker.
+ /// @return Signer of 0x transaction if entry point is `executeTransaction`.
+ /// `msg.sender` if entry point is any other function.
+ function getCurrentContextAddress()
+ internal
+ view
+ returns (address)
+ {
+ address currentContextAddress_ = currentContextAddress;
+ address contextAddress = currentContextAddress_ == address(0) ? msg.sender : currentContextAddress_;
+ return contextAddress;
+ }
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol b/contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol
new file mode 100644
index 000000000..6fc6ee999
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/MixinWrapperFunctions.sol
@@ -0,0 +1,426 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibAbiEncoder.sol";
+import "./mixins/MExchangeCore.sol";
+import "./mixins/MWrapperFunctions.sol";
+
+
+contract MixinWrapperFunctions is
+ ReentrancyGuard,
+ LibMath,
+ LibFillResults,
+ LibAbiEncoder,
+ MExchangeCore,
+ MWrapperFunctions
+{
+ /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ function fillOrKillOrder(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ public
+ nonReentrant
+ returns (FillResults memory fillResults)
+ {
+ fillResults = fillOrKillOrderInternal(
+ order,
+ takerAssetFillAmount,
+ signature
+ );
+ return fillResults;
+ }
+
+ /// @dev Fills the input order.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ /// @return Amounts filled and fees paid by maker and taker.
+ function fillOrderNoThrow(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ public
+ returns (FillResults memory fillResults)
+ {
+ // ABI encode calldata for `fillOrder`
+ bytes memory fillOrderCalldata = abiEncodeFillOrder(
+ order,
+ takerAssetFillAmount,
+ signature
+ );
+
+ // Delegate to `fillOrder` and handle any exceptions gracefully
+ assembly {
+ let success := delegatecall(
+ gas, // forward all gas
+ address, // call address of this contract
+ add(fillOrderCalldata, 32), // pointer to start of input (skip array length in first 32 bytes)
+ mload(fillOrderCalldata), // length of input
+ fillOrderCalldata, // write output over input
+ 128 // output size is 128 bytes
+ )
+ if success {
+ mstore(fillResults, mload(fillOrderCalldata))
+ mstore(add(fillResults, 32), mload(add(fillOrderCalldata, 32)))
+ mstore(add(fillResults, 64), mload(add(fillOrderCalldata, 64)))
+ mstore(add(fillResults, 96), mload(add(fillOrderCalldata, 96)))
+ }
+ }
+ // fillResults values will be 0 by default if call was unsuccessful
+ return fillResults;
+ }
+
+ /// @dev Synchronously executes multiple calls of fillOrder.
+ /// @param orders Array of order specifications.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.
+ function batchFillOrders(
+ LibOrder.Order[] memory orders,
+ uint256[] memory takerAssetFillAmounts,
+ bytes[] memory signatures
+ )
+ public
+ nonReentrant
+ returns (FillResults memory totalFillResults)
+ {
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+ FillResults memory singleFillResults = fillOrderInternal(
+ orders[i],
+ takerAssetFillAmounts[i],
+ signatures[i]
+ );
+ addFillResults(totalFillResults, singleFillResults);
+ }
+ return totalFillResults;
+ }
+
+ /// @dev Synchronously executes multiple calls of fillOrKill.
+ /// @param orders Array of order specifications.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.
+ function batchFillOrKillOrders(
+ LibOrder.Order[] memory orders,
+ uint256[] memory takerAssetFillAmounts,
+ bytes[] memory signatures
+ )
+ public
+ nonReentrant
+ returns (FillResults memory totalFillResults)
+ {
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+ FillResults memory singleFillResults = fillOrKillOrderInternal(
+ orders[i],
+ takerAssetFillAmounts[i],
+ signatures[i]
+ );
+ addFillResults(totalFillResults, singleFillResults);
+ }
+ return totalFillResults;
+ }
+
+ /// @dev Fills an order with specified parameters and ECDSA signature.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param orders Array of order specifications.
+ /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.
+ function batchFillOrdersNoThrow(
+ LibOrder.Order[] memory orders,
+ uint256[] memory takerAssetFillAmounts,
+ bytes[] memory signatures
+ )
+ public
+ returns (FillResults memory totalFillResults)
+ {
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+ FillResults memory singleFillResults = fillOrderNoThrow(
+ orders[i],
+ takerAssetFillAmounts[i],
+ signatures[i]
+ );
+ addFillResults(totalFillResults, singleFillResults);
+ }
+ return totalFillResults;
+ }
+
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.
+ /// @param orders Array of order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signatures Proofs that orders have been created by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketSellOrders(
+ LibOrder.Order[] memory orders,
+ uint256 takerAssetFillAmount,
+ bytes[] memory signatures
+ )
+ public
+ nonReentrant
+ returns (FillResults memory totalFillResults)
+ {
+ bytes memory takerAssetData = orders[0].takerAssetData;
+
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+
+ // We assume that asset being sold by taker is the same for each order.
+ // Rather than passing this in as calldata, we use the takerAssetData from the first order in all later orders.
+ orders[i].takerAssetData = takerAssetData;
+
+ // Calculate the remaining amount of takerAsset to sell
+ uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
+
+ // Attempt to sell the remaining amount of takerAsset
+ FillResults memory singleFillResults = fillOrderInternal(
+ orders[i],
+ remainingTakerAssetFillAmount,
+ signatures[i]
+ );
+
+ // Update amounts filled and fees paid by maker and taker
+ addFillResults(totalFillResults, singleFillResults);
+
+ // Stop execution if the entire amount of takerAsset has been sold
+ if (totalFillResults.takerAssetFilledAmount >= takerAssetFillAmount) {
+ break;
+ }
+ }
+ return totalFillResults;
+ }
+
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param orders Array of order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signatures Proofs that orders have been signed by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketSellOrdersNoThrow(
+ LibOrder.Order[] memory orders,
+ uint256 takerAssetFillAmount,
+ bytes[] memory signatures
+ )
+ public
+ returns (FillResults memory totalFillResults)
+ {
+ bytes memory takerAssetData = orders[0].takerAssetData;
+
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+
+ // We assume that asset being sold by taker is the same for each order.
+ // Rather than passing this in as calldata, we use the takerAssetData from the first order in all later orders.
+ orders[i].takerAssetData = takerAssetData;
+
+ // Calculate the remaining amount of takerAsset to sell
+ uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
+
+ // Attempt to sell the remaining amount of takerAsset
+ FillResults memory singleFillResults = fillOrderNoThrow(
+ orders[i],
+ remainingTakerAssetFillAmount,
+ signatures[i]
+ );
+
+ // Update amounts filled and fees paid by maker and taker
+ addFillResults(totalFillResults, singleFillResults);
+
+ // Stop execution if the entire amount of takerAsset has been sold
+ if (totalFillResults.takerAssetFilledAmount >= takerAssetFillAmount) {
+ break;
+ }
+ }
+ return totalFillResults;
+ }
+
+ /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.
+ /// @param orders Array of order specifications.
+ /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
+ /// @param signatures Proofs that orders have been signed by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketBuyOrders(
+ LibOrder.Order[] memory orders,
+ uint256 makerAssetFillAmount,
+ bytes[] memory signatures
+ )
+ public
+ nonReentrant
+ returns (FillResults memory totalFillResults)
+ {
+ bytes memory makerAssetData = orders[0].makerAssetData;
+
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+
+ // We assume that asset being bought by taker is the same for each order.
+ // Rather than passing this in as calldata, we copy the makerAssetData from the first order onto all later orders.
+ orders[i].makerAssetData = makerAssetData;
+
+ // Calculate the remaining amount of makerAsset to buy
+ uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
+
+ // Convert the remaining amount of makerAsset to buy into remaining amount
+ // of takerAsset to sell, assuming entire amount can be sold in the current order
+ uint256 remainingTakerAssetFillAmount = getPartialAmountFloor(
+ orders[i].takerAssetAmount,
+ orders[i].makerAssetAmount,
+ remainingMakerAssetFillAmount
+ );
+
+ // Attempt to sell the remaining amount of takerAsset
+ FillResults memory singleFillResults = fillOrderInternal(
+ orders[i],
+ remainingTakerAssetFillAmount,
+ signatures[i]
+ );
+
+ // Update amounts filled and fees paid by maker and taker
+ addFillResults(totalFillResults, singleFillResults);
+
+ // Stop execution if the entire amount of makerAsset has been bought
+ if (totalFillResults.makerAssetFilledAmount >= makerAssetFillAmount) {
+ break;
+ }
+ }
+ return totalFillResults;
+ }
+
+ /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.
+ /// Returns false if the transaction would otherwise revert.
+ /// @param orders Array of order specifications.
+ /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
+ /// @param signatures Proofs that orders have been signed by makers.
+ /// @return Amounts filled and fees paid by makers and taker.
+ function marketBuyOrdersNoThrow(
+ LibOrder.Order[] memory orders,
+ uint256 makerAssetFillAmount,
+ bytes[] memory signatures
+ )
+ public
+ returns (FillResults memory totalFillResults)
+ {
+ bytes memory makerAssetData = orders[0].makerAssetData;
+
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+
+ // We assume that asset being bought by taker is the same for each order.
+ // Rather than passing this in as calldata, we copy the makerAssetData from the first order onto all later orders.
+ orders[i].makerAssetData = makerAssetData;
+
+ // Calculate the remaining amount of makerAsset to buy
+ uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
+
+ // Convert the remaining amount of makerAsset to buy into remaining amount
+ // of takerAsset to sell, assuming entire amount can be sold in the current order
+ uint256 remainingTakerAssetFillAmount = getPartialAmountFloor(
+ orders[i].takerAssetAmount,
+ orders[i].makerAssetAmount,
+ remainingMakerAssetFillAmount
+ );
+
+ // Attempt to sell the remaining amount of takerAsset
+ FillResults memory singleFillResults = fillOrderNoThrow(
+ orders[i],
+ remainingTakerAssetFillAmount,
+ signatures[i]
+ );
+
+ // Update amounts filled and fees paid by maker and taker
+ addFillResults(totalFillResults, singleFillResults);
+
+ // Stop execution if the entire amount of makerAsset has been bought
+ if (totalFillResults.makerAssetFilledAmount >= makerAssetFillAmount) {
+ break;
+ }
+ }
+ return totalFillResults;
+ }
+
+ /// @dev Synchronously cancels multiple orders in a single transaction.
+ /// @param orders Array of order specifications.
+ function batchCancelOrders(LibOrder.Order[] memory orders)
+ public
+ nonReentrant
+ {
+ uint256 ordersLength = orders.length;
+ for (uint256 i = 0; i != ordersLength; i++) {
+ cancelOrderInternal(orders[i]);
+ }
+ }
+
+ /// @dev Fetches information for all passed in orders.
+ /// @param orders Array of order specifications.
+ /// @return Array of OrderInfo instances that correspond to each order.
+ function getOrdersInfo(LibOrder.Order[] memory orders)
+ public
+ view
+ returns (LibOrder.OrderInfo[] memory)
+ {
+ uint256 ordersLength = orders.length;
+ LibOrder.OrderInfo[] memory ordersInfo = new LibOrder.OrderInfo[](ordersLength);
+ for (uint256 i = 0; i != ordersLength; i++) {
+ ordersInfo[i] = getOrderInfo(orders[i]);
+ }
+ return ordersInfo;
+ }
+
+ /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ function fillOrKillOrderInternal(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ internal
+ returns (FillResults memory fillResults)
+ {
+ fillResults = fillOrderInternal(
+ order,
+ takerAssetFillAmount,
+ signature
+ );
+ require(
+ fillResults.takerAssetFilledAmount == takerAssetFillAmount,
+ "COMPLETE_FILL_FAILED"
+ );
+ return fillResults;
+ }
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
new file mode 100644
index 000000000..05c2c4c0b
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
@@ -0,0 +1,45 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IAssetProxyDispatcher.sol";
+
+
+contract MAssetProxyDispatcher is
+ IAssetProxyDispatcher
+{
+ // Logs registration of new asset proxy
+ event AssetProxyRegistered(
+ bytes4 id, // Id of new registered AssetProxy.
+ address assetProxy // Address of new registered AssetProxy.
+ );
+
+ /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.
+ /// @param assetData Byte array encoded for the asset.
+ /// @param from Address to transfer token from.
+ /// @param to Address to transfer token to.
+ /// @param amount Amount of token to transfer.
+ function dispatchTransferFrom(
+ bytes memory assetData,
+ address from,
+ address to,
+ uint256 amount
+ )
+ internal;
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol
new file mode 100644
index 000000000..09dc491cd
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MExchangeCore.sol
@@ -0,0 +1,157 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchangeCore.sol";
+
+
+contract MExchangeCore is
+ IExchangeCore
+{
+ // Fill event is emitted whenever an order is filled.
+ event Fill(
+ address indexed makerAddress, // Address that created the order.
+ address indexed feeRecipientAddress, // Address that received fees.
+ address takerAddress, // Address that filled the order.
+ address senderAddress, // Address that called the Exchange contract (msg.sender).
+ uint256 makerAssetFilledAmount, // Amount of makerAsset sold by maker and bought by taker.
+ uint256 takerAssetFilledAmount, // Amount of takerAsset sold by taker and bought by maker.
+ uint256 makerFeePaid, // Amount of ZRX paid to feeRecipient by maker.
+ uint256 takerFeePaid, // Amount of ZRX paid to feeRecipient by taker.
+ bytes32 indexed orderHash, // EIP712 hash of order (see LibOrder.getOrderHash).
+ bytes makerAssetData, // Encoded data specific to makerAsset.
+ bytes takerAssetData // Encoded data specific to takerAsset.
+ );
+
+ // Cancel event is emitted whenever an individual order is cancelled.
+ event Cancel(
+ address indexed makerAddress, // Address that created the order.
+ address indexed feeRecipientAddress, // Address that would have recieved fees if order was filled.
+ address senderAddress, // Address that called the Exchange contract (msg.sender).
+ bytes32 indexed orderHash, // EIP712 hash of order (see LibOrder.getOrderHash).
+ bytes makerAssetData, // Encoded data specific to makerAsset.
+ bytes takerAssetData // Encoded data specific to takerAsset.
+ );
+
+ // CancelUpTo event is emitted whenever `cancelOrdersUpTo` is executed succesfully.
+ event CancelUpTo(
+ address indexed makerAddress, // Orders cancelled must have been created by this address.
+ address indexed senderAddress, // Orders cancelled must have a `senderAddress` equal to this address.
+ uint256 orderEpoch // Orders with specified makerAddress and senderAddress with a salt less than this value are considered cancelled.
+ );
+
+ /// @dev Fills the input order.
+ /// @param order Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ /// @return Amounts filled and fees paid by maker and taker.
+ function fillOrderInternal(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ internal
+ returns (LibFillResults.FillResults memory fillResults);
+
+ /// @dev After calling, the order can not be filled anymore.
+ /// @param order Order struct containing order specifications.
+ function cancelOrderInternal(LibOrder.Order memory order)
+ internal;
+
+ /// @dev Updates state with results of a fill order.
+ /// @param order that was filled.
+ /// @param takerAddress Address of taker who filled the order.
+ /// @param orderTakerAssetFilledAmount Amount of order already filled.
+ /// @return fillResults Amounts filled and fees paid by maker and taker.
+ function updateFilledState(
+ LibOrder.Order memory order,
+ address takerAddress,
+ bytes32 orderHash,
+ uint256 orderTakerAssetFilledAmount,
+ LibFillResults.FillResults memory fillResults
+ )
+ internal;
+
+ /// @dev Updates state with results of cancelling an order.
+ /// State is only updated if the order is currently fillable.
+ /// Otherwise, updating state would have no effect.
+ /// @param order that was cancelled.
+ /// @param orderHash Hash of order that was cancelled.
+ function updateCancelledState(
+ LibOrder.Order memory order,
+ bytes32 orderHash
+ )
+ internal;
+
+ /// @dev Validates context for fillOrder. Succeeds or throws.
+ /// @param order to be filled.
+ /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
+ /// @param takerAddress Address of order taker.
+ /// @param signature Proof that the orders was created by its maker.
+ function assertFillableOrder(
+ LibOrder.Order memory order,
+ LibOrder.OrderInfo memory orderInfo,
+ address takerAddress,
+ bytes memory signature
+ )
+ internal
+ view;
+
+ /// @dev Validates context for fillOrder. Succeeds or throws.
+ /// @param order to be filled.
+ /// @param orderInfo Status, orderHash, and amount already filled of order.
+ /// @param takerAssetFillAmount Desired amount of order to fill by taker.
+ /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
+ /// @param makerAssetFilledAmount Amount of makerAsset that will be transfered.
+ function assertValidFill(
+ LibOrder.Order memory order,
+ LibOrder.OrderInfo memory orderInfo,
+ uint256 takerAssetFillAmount,
+ uint256 takerAssetFilledAmount,
+ uint256 makerAssetFilledAmount
+ )
+ internal
+ view;
+
+ /// @dev Validates context for cancelOrder. Succeeds or throws.
+ /// @param order to be cancelled.
+ /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
+ function assertValidCancel(
+ LibOrder.Order memory order,
+ LibOrder.OrderInfo memory orderInfo
+ )
+ internal
+ view;
+
+ /// @dev Calculates amounts filled and fees paid by maker and taker.
+ /// @param order to be filled.
+ /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
+ /// @return fillResults Amounts filled and fees paid by maker and taker.
+ function calculateFillResults(
+ LibOrder.Order memory order,
+ uint256 takerAssetFilledAmount
+ )
+ internal
+ pure
+ returns (LibFillResults.FillResults memory fillResults);
+
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol
new file mode 100644
index 000000000..56ee895c4
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MMatchOrders.sol
@@ -0,0 +1,58 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IMatchOrders.sol";
+
+
+contract MMatchOrders is
+ IMatchOrders
+{
+ /// @dev Validates context for matchOrders. Succeeds or throws.
+ /// @param leftOrder First order to match.
+ /// @param rightOrder Second order to match.
+ function assertValidMatch(
+ LibOrder.Order memory leftOrder,
+ LibOrder.Order memory rightOrder
+ )
+ internal
+ pure;
+
+ /// @dev Calculates fill amounts for the matched orders.
+ /// Each order is filled at their respective price point. However, the calculations are
+ /// carried out as though the orders are both being filled at the right order's price point.
+ /// The profit made by the leftOrder order goes to the taker (who matched the two orders).
+ /// @param leftOrder First order to match.
+ /// @param rightOrder Second order to match.
+ /// @param leftOrderTakerAssetFilledAmount Amount of left order already filled.
+ /// @param rightOrderTakerAssetFilledAmount Amount of right order already filled.
+ /// @param matchedFillResults Amounts to fill and fees to pay by maker and taker of matched orders.
+ function calculateMatchedFillResults(
+ LibOrder.Order memory leftOrder,
+ LibOrder.Order memory rightOrder,
+ uint256 leftOrderTakerAssetFilledAmount,
+ uint256 rightOrderTakerAssetFilledAmount
+ )
+ internal
+ pure
+ returns (LibFillResults.MatchedFillResults memory matchedFillResults);
+
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol
new file mode 100644
index 000000000..6407760d4
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MSignatureValidator.sol
@@ -0,0 +1,75 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/ISignatureValidator.sol";
+
+
+contract MSignatureValidator is
+ ISignatureValidator
+{
+ event SignatureValidatorApproval(
+ address indexed signerAddress, // Address that approves or disapproves a contract to verify signatures.
+ address indexed validatorAddress, // Address of signature validator contract.
+ bool approved // Approval or disapproval of validator contract.
+ );
+
+ // Allowed signature types.
+ enum SignatureType {
+ Illegal, // 0x00, default value
+ Invalid, // 0x01
+ EIP712, // 0x02
+ EthSign, // 0x03
+ Wallet, // 0x04
+ Validator, // 0x05
+ PreSigned, // 0x06
+ NSignatureTypes // 0x07, number of signature types. Always leave at end.
+ }
+
+ /// @dev Verifies signature using logic defined by Wallet contract.
+ /// @param hash Any 32 byte hash.
+ /// @param walletAddress Address that should have signed the given hash
+ /// and defines its own signature verification method.
+ /// @param signature Proof that the hash has been signed by signer.
+ /// @return True if the address recovered from the provided signature matches the input signer address.
+ function isValidWalletSignature(
+ bytes32 hash,
+ address walletAddress,
+ bytes signature
+ )
+ internal
+ view
+ returns (bool isValid);
+
+ /// @dev Verifies signature using logic defined by Validator contract.
+ /// @param validatorAddress Address of validator contract.
+ /// @param hash Any 32 byte hash.
+ /// @param signerAddress Address that should have signed the given hash.
+ /// @param signature Proof that the hash has been signed by signer.
+ /// @return True if the address recovered from the provided signature matches the input signer address.
+ function isValidValidatorSignature(
+ address validatorAddress,
+ bytes32 hash,
+ address signerAddress,
+ bytes signature
+ )
+ internal
+ view
+ returns (bool isValid);
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol
new file mode 100644
index 000000000..04dd716d7
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MTransactions.sol
@@ -0,0 +1,58 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/ITransactions.sol";
+
+
+contract MTransactions is
+ ITransactions
+{
+ // Hash for the EIP712 ZeroEx Transaction Schema
+ bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked(
+ "ZeroExTransaction(",
+ "uint256 salt,",
+ "address signerAddress,",
+ "bytes data",
+ ")"
+ ));
+
+ /// @dev Calculates EIP712 hash of the Transaction.
+ /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
+ /// @param signerAddress Address of transaction signer.
+ /// @param data AbiV2 encoded calldata.
+ /// @return EIP712 hash of the Transaction.
+ function hashZeroExTransaction(
+ uint256 salt,
+ address signerAddress,
+ bytes memory data
+ )
+ internal
+ pure
+ returns (bytes32 result);
+
+ /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).
+ /// If calling a fill function, this address will represent the taker.
+ /// If calling a cancel function, this address will represent the maker.
+ /// @return Signer of 0x transaction if entry point is `executeTransaction`.
+ /// `msg.sender` if entry point is any other function.
+ function getCurrentContextAddress()
+ internal
+ view
+ returns (address);
+}
diff --git a/contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol b/contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
new file mode 100644
index 000000000..2ff3b8790
--- /dev/null
+++ b/contracts/protocol/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
@@ -0,0 +1,41 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IWrapperFunctions.sol";
+
+
+contract MWrapperFunctions is
+ IWrapperFunctions
+{
+ /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
+ /// @param order LibOrder.Order struct containing order specifications.
+ /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
+ /// @param signature Proof that order has been created by maker.
+ function fillOrKillOrderInternal(
+ LibOrder.Order memory order,
+ uint256 takerAssetFillAmount,
+ bytes memory signature
+ )
+ internal
+ returns (LibFillResults.FillResults memory fillResults);
+}
diff --git a/packages/contracts/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol b/contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
index ad71fc9a1..ad71fc9a1 100644
--- a/packages/contracts/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
+++ b/contracts/protocol/contracts/test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol
diff --git a/packages/contracts/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol b/contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
index 52c66cb56..52c66cb56 100644
--- a/packages/contracts/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
+++ b/contracts/protocol/contracts/test/TestAssetProxyOwner/TestAssetProxyOwner.sol
diff --git a/packages/contracts/contracts/test/TestExchangeInternals/TestExchangeInternals.sol b/contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol
index 27187f8f8..27187f8f8 100644
--- a/packages/contracts/contracts/test/TestExchangeInternals/TestExchangeInternals.sol
+++ b/contracts/protocol/contracts/test/TestExchangeInternals/TestExchangeInternals.sol
diff --git a/packages/contracts/contracts/test/TestSignatureValidator/TestSignatureValidator.sol b/contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol
index ea3e2de59..ea3e2de59 100644
--- a/packages/contracts/contracts/test/TestSignatureValidator/TestSignatureValidator.sol
+++ b/contracts/protocol/contracts/test/TestSignatureValidator/TestSignatureValidator.sol
diff --git a/contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol b/contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
new file mode 100644
index 000000000..d08da7303
--- /dev/null
+++ b/contracts/protocol/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
@@ -0,0 +1,81 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+import "@0x/contracts-tokens/contracts/tokens/ERC20Token/IERC20Token.sol";
+
+
+// solhint-disable no-unused-vars
+contract TestStaticCallReceiver {
+
+ uint256 internal state = 1;
+
+ /// @dev Updates state and returns true. Intended to be used with `Validator` signature type.
+ /// @param hash Message hash that is signed.
+ /// @param signerAddress Address that should have signed the given hash.
+ /// @param signature Proof of signing.
+ /// @return Validity of order signature.
+ function isValidSignature(
+ bytes32 hash,
+ address signerAddress,
+ bytes signature
+ )
+ external
+ returns (bool isValid)
+ {
+ updateState();
+ return true;
+ }
+
+ /// @dev Updates state and returns true. Intended to be used with `Wallet` signature type.
+ /// @param hash Message hash that is signed.
+ /// @param signature Proof of signing.
+ /// @return Validity of order signature.
+ function isValidSignature(
+ bytes32 hash,
+ bytes signature
+ )
+ external
+ returns (bool isValid)
+ {
+ updateState();
+ return true;
+ }
+
+ /// @dev Approves an ERC20 token to spend tokens from this address.
+ /// @param token Address of ERC20 token.
+ /// @param spender Address that will spend tokens.
+ /// @param value Amount of tokens spender is approved to spend.
+ function approveERC20(
+ address token,
+ address spender,
+ uint256 value
+ )
+ external
+ {
+ IERC20Token(token).approve(spender, value);
+ }
+
+ /// @dev Increments state variable.
+ function updateState()
+ internal
+ {
+ state++;
+ }
+}
diff --git a/contracts/protocol/package.json b/contracts/protocol/package.json
new file mode 100644
index 000000000..891838e54
--- /dev/null
+++ b/contracts/protocol/package.json
@@ -0,0 +1,95 @@
+{
+ "name": "@0x/contracts-protocol",
+ "version": "2.1.59",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract components of 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
+ "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "compile": "sol-compiler",
+ "watch": "sol-compiler -w",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "coverage:report:text": "istanbul report text",
+ "coverage:report:html": "istanbul report html && open coverage/index.html",
+ "profiler:report:html": "istanbul report html && open coverage/index.html",
+ "coverage:report:lcov": "istanbul report lcov",
+ "test:circleci": "yarn test",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(AssetProxyOwner|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiAssetProxy|TestSignatureValidator|TestAssetProxyOwner|TestAssetProxyDispatcher|TestExchangeInternals|TestStaticCallReceiver).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-examples": "^1.0.2",
+ "@0x/contracts-interfaces": "^1.0.2",
+ "@0x/contracts-libs": "^1.0.2",
+ "@0x/contracts-multisig": "^1.0.2",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/contracts-tokens": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.4",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/protocol/src/artifacts/index.ts b/contracts/protocol/src/artifacts/index.ts
new file mode 100644
index 000000000..c5d12f10b
--- /dev/null
+++ b/contracts/protocol/src/artifacts/index.ts
@@ -0,0 +1,27 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as AssetProxyOwner from '../../generated-artifacts/AssetProxyOwner.json';
+import * as ERC20Proxy from '../../generated-artifacts/ERC20Proxy.json';
+import * as ERC721Proxy from '../../generated-artifacts/ERC721Proxy.json';
+import * as Exchange from '../../generated-artifacts/Exchange.json';
+import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json';
+import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.json';
+import * as TestAssetProxyDispatcher from '../../generated-artifacts/TestAssetProxyDispatcher.json';
+import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOwner.json';
+import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json';
+import * as TestSignatureValidator from '../../generated-artifacts/TestSignatureValidator.json';
+import * as TestStaticCallReceiver from '../../generated-artifacts/TestStaticCallReceiver.json';
+
+export const artifacts = {
+ AssetProxyOwner: AssetProxyOwner as ContractArtifact,
+ ERC20Proxy: ERC20Proxy as ContractArtifact,
+ ERC721Proxy: ERC721Proxy as ContractArtifact,
+ Exchange: Exchange as ContractArtifact,
+ MixinAuthorizable: MixinAuthorizable as ContractArtifact,
+ MultiAssetProxy: MultiAssetProxy as ContractArtifact,
+ TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
+ TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact,
+ TestExchangeInternals: TestExchangeInternals as ContractArtifact,
+ TestSignatureValidator: TestSignatureValidator as ContractArtifact,
+ TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact,
+};
diff --git a/contracts/protocol/src/index.ts b/contracts/protocol/src/index.ts
new file mode 100644
index 000000000..ba813e7ca
--- /dev/null
+++ b/contracts/protocol/src/index.ts
@@ -0,0 +1,3 @@
+export * from './artifacts';
+export * from './wrappers';
+export * from '../test/utils';
diff --git a/contracts/protocol/src/wrappers/index.ts b/contracts/protocol/src/wrappers/index.ts
new file mode 100644
index 000000000..01b121054
--- /dev/null
+++ b/contracts/protocol/src/wrappers/index.ts
@@ -0,0 +1,10 @@
+export * from '../../generated-wrappers/asset_proxy_owner';
+export * from '../../generated-wrappers/erc20_proxy';
+export * from '../../generated-wrappers/erc721_proxy';
+export * from '../../generated-wrappers/exchange';
+export * from '../../generated-wrappers/mixin_authorizable';
+export * from '../../generated-wrappers/test_asset_proxy_dispatcher';
+export * from '../../generated-wrappers/test_asset_proxy_owner';
+export * from '../../generated-wrappers/test_exchange_internals';
+export * from '../../generated-wrappers/test_signature_validator';
+export * from '../../generated-wrappers/test_static_call_receiver';
diff --git a/contracts/protocol/test/asset_proxy/authorizable.ts b/contracts/protocol/test/asset_proxy/authorizable.ts
new file mode 100644
index 000000000..853d18be0
--- /dev/null
+++ b/contracts/protocol/test/asset_proxy/authorizable.ts
@@ -0,0 +1,211 @@
+import {
+ chaiSetup,
+ constants,
+ expectTransactionFailedAsync,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable';
+import { artifacts } from '../../src/artifacts';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+describe('Authorizable', () => {
+ let owner: string;
+ let notOwner: string;
+ let address: string;
+ let authorizable: MixinAuthorizableContract;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ [owner, address, notOwner] = _.slice(accounts, 0, 3);
+ authorizable = await MixinAuthorizableContract.deployFrom0xArtifactAsync(
+ artifacts.MixinAuthorizable,
+ provider,
+ txDefaults,
+ );
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('addAuthorizedAddress', () => {
+ it('should throw if not called by owner', async () => {
+ return expectTransactionFailedAsync(
+ authorizable.addAuthorizedAddress.sendTransactionAsync(notOwner, { from: notOwner }),
+ RevertReason.OnlyContractOwner,
+ );
+ });
+ it('should allow owner to add an authorized address', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const isAuthorized = await authorizable.authorized.callAsync(address);
+ expect(isAuthorized).to.be.true();
+ });
+ it('should throw if owner attempts to authorize a duplicate address', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ return expectTransactionFailedAsync(
+ authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
+ RevertReason.TargetAlreadyAuthorized,
+ );
+ });
+ });
+
+ describe('removeAuthorizedAddress', () => {
+ it('should throw if not called by owner', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ return expectTransactionFailedAsync(
+ authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
+ from: notOwner,
+ }),
+ RevertReason.OnlyContractOwner,
+ );
+ });
+
+ it('should allow owner to remove an authorized address', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const isAuthorized = await authorizable.authorized.callAsync(address);
+ expect(isAuthorized).to.be.false();
+ });
+
+ it('should throw if owner attempts to remove an address that is not authorized', async () => {
+ return expectTransactionFailedAsync(
+ authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
+ from: owner,
+ }),
+ RevertReason.TargetNotAuthorized,
+ );
+ });
+ });
+
+ describe('removeAuthorizedAddressAtIndex', () => {
+ it('should throw if not called by owner', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const index = new BigNumber(0);
+ return expectTransactionFailedAsync(
+ authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
+ from: notOwner,
+ }),
+ RevertReason.OnlyContractOwner,
+ );
+ });
+ it('should throw if index is >= authorities.length', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const index = new BigNumber(1);
+ return expectTransactionFailedAsync(
+ authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
+ from: owner,
+ }),
+ RevertReason.IndexOutOfBounds,
+ );
+ });
+ it('should throw if owner attempts to remove an address that is not authorized', async () => {
+ const index = new BigNumber(0);
+ return expectTransactionFailedAsync(
+ authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
+ from: owner,
+ }),
+ RevertReason.TargetNotAuthorized,
+ );
+ });
+ it('should throw if address at index does not match target', async () => {
+ const address1 = address;
+ const address2 = notOwner;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.addAuthorizedAddress.sendTransactionAsync(address1, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.addAuthorizedAddress.sendTransactionAsync(address2, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const address1Index = new BigNumber(0);
+ return expectTransactionFailedAsync(
+ authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address2, address1Index, {
+ from: owner,
+ }),
+ RevertReason.AuthorizedAddressMismatch,
+ );
+ });
+ it('should allow owner to remove an authorized address', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const index = new BigNumber(0);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const isAuthorized = await authorizable.authorized.callAsync(address);
+ expect(isAuthorized).to.be.false();
+ });
+ });
+
+ describe('getAuthorizedAddresses', () => {
+ it('should return all authorized addresses', async () => {
+ const initial = await authorizable.getAuthorizedAddresses.callAsync();
+ expect(initial).to.have.length(0);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.addAuthorizedAddress.sendTransactionAsync(address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const afterAdd = await authorizable.getAuthorizedAddresses.callAsync();
+ expect(afterAdd).to.have.length(1);
+ expect(afterAdd).to.include(address);
+
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const afterRemove = await authorizable.getAuthorizedAddresses.callAsync();
+ expect(afterRemove).to.have.length(0);
+ });
+ });
+});
diff --git a/contracts/protocol/test/asset_proxy/proxies.ts b/contracts/protocol/test/asset_proxy/proxies.ts
new file mode 100644
index 000000000..bbb44f402
--- /dev/null
+++ b/contracts/protocol/test/asset_proxy/proxies.ts
@@ -0,0 +1,1285 @@
+import { artifacts as interfacesArtifacts, IAssetDataContract, IAssetProxyContract } from '@0x/contracts-interfaces';
+import {
+ chaiSetup,
+ constants,
+ expectTransactionFailedAsync,
+ expectTransactionFailedWithoutReasonAsync,
+ LogDecoder,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ DummyERC20TokenTransferEventArgs,
+ DummyERC721ReceiverContract,
+ DummyERC721TokenContract,
+ DummyMultipleReturnERC20TokenContract,
+ DummyNoReturnERC20TokenContract,
+} from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { MultiAssetProxyContract } from '../../generated-wrappers/multi_asset_proxy';
+import { artifacts } from '../../src/artifacts';
+import { ERC20Wrapper } from '../utils/erc20_wrapper';
+import { ERC721Wrapper } from '../utils/erc721_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+const assetProxyInterface = new IAssetProxyContract(
+ interfacesArtifacts.IAssetProxy.compilerOutput.abi,
+ constants.NULL_ADDRESS,
+ provider,
+);
+const assetDataInterface = new IAssetDataContract(
+ interfacesArtifacts.IAssetData.compilerOutput.abi,
+ constants.NULL_ADDRESS,
+ provider,
+);
+
+// tslint:disable:no-unnecessary-type-assertion
+describe('Asset Transfer Proxies', () => {
+ let owner: string;
+ let notAuthorized: string;
+ let authorized: string;
+ let fromAddress: string;
+ let toAddress: string;
+
+ let erc20TokenA: DummyERC20TokenContract;
+ let erc20TokenB: DummyERC20TokenContract;
+ let erc721TokenA: DummyERC721TokenContract;
+ let erc721TokenB: DummyERC721TokenContract;
+ let erc721Receiver: DummyERC721ReceiverContract;
+ let erc20Proxy: ERC20ProxyContract;
+ let erc721Proxy: ERC721ProxyContract;
+ let noReturnErc20Token: DummyNoReturnERC20TokenContract;
+ let multipleReturnErc20Token: DummyMultipleReturnERC20TokenContract;
+ let multiAssetProxy: MultiAssetProxyContract;
+
+ let erc20Wrapper: ERC20Wrapper;
+ let erc721Wrapper: ERC721Wrapper;
+ let erc721AFromTokenId: BigNumber;
+ let erc721BFromTokenId: BigNumber;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const usedAddresses = ([owner, notAuthorized, authorized, fromAddress, toAddress] = _.slice(accounts, 0, 5));
+
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
+
+ // Deploy AssetProxies
+ erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ erc721Proxy = await erc721Wrapper.deployProxyAsync();
+ multiAssetProxy = await MultiAssetProxyContract.deployFrom0xArtifactAsync(
+ artifacts.MultiAssetProxy,
+ provider,
+ txDefaults,
+ );
+
+ // Configure ERC20Proxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(authorized, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ // Configure ERC721Proxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(authorized, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ // Configure MultiAssetProxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(authorized, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ // Deploy and configure ERC20 tokens
+ const numDummyErc20ToDeploy = 2;
+ [erc20TokenA, erc20TokenB] = await erc20Wrapper.deployDummyTokensAsync(
+ numDummyErc20ToDeploy,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
+ noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
+ tokensArtifacts.DummyNoReturnERC20Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ );
+ multipleReturnErc20Token = await DummyMultipleReturnERC20TokenContract.deployFrom0xArtifactAsync(
+ tokensArtifacts.DummyMultipleReturnERC20Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ );
+
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await noReturnErc20Token.setBalance.sendTransactionAsync(fromAddress, constants.INITIAL_ERC20_BALANCE),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await noReturnErc20Token.approve.sendTransactionAsync(
+ erc20Proxy.address,
+ constants.INITIAL_ERC20_ALLOWANCE,
+ { from: fromAddress },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multipleReturnErc20Token.setBalance.sendTransactionAsync(
+ fromAddress,
+ constants.INITIAL_ERC20_BALANCE,
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multipleReturnErc20Token.approve.sendTransactionAsync(
+ erc20Proxy.address,
+ constants.INITIAL_ERC20_ALLOWANCE,
+ { from: fromAddress },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ // Deploy and configure ERC721 tokens and receiver
+ [erc721TokenA, erc721TokenB] = await erc721Wrapper.deployDummyTokensAsync();
+ erc721Receiver = await DummyERC721ReceiverContract.deployFrom0xArtifactAsync(
+ tokensArtifacts.DummyERC721Receiver,
+ provider,
+ txDefaults,
+ );
+
+ await erc721Wrapper.setBalancesAndAllowancesAsync();
+ const erc721Balances = await erc721Wrapper.getBalancesAsync();
+ erc721AFromTokenId = erc721Balances[fromAddress][erc721TokenA.address][0];
+ erc721BFromTokenId = erc721Balances[fromAddress][erc721TokenB.address][0];
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('ERC20Proxy', () => {
+ it('should revert if undefined function is called', async () => {
+ const undefinedSelector = '0x01020304';
+ await expectTransactionFailedWithoutReasonAsync(
+ web3Wrapper.sendTransactionAsync({
+ from: owner,
+ to: erc20Proxy.address,
+ value: constants.ZERO_AMOUNT,
+ data: undefinedSelector,
+ }),
+ );
+ });
+ it('should have an id of 0xf47261b0', async () => {
+ const proxyId = await erc20Proxy.getProxyId.callAsync();
+ const expectedProxyId = '0xf47261b0';
+ expect(proxyId).to.equal(expectedProxyId);
+ });
+ describe('transferFrom', () => {
+ it('should successfully transfer tokens', async () => {
+ // Construct ERC20 asset data
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ // Perform a transfer from fromAddress to toAddress
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const amount = new BigNumber(10);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: erc20Proxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Verify transfer was successful
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances[fromAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenA.address].minus(amount),
+ );
+ expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenA.address].add(amount),
+ );
+ });
+
+ it('should successfully transfer tokens that do not return a value', async () => {
+ // Construct ERC20 asset data
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(noReturnErc20Token.address);
+ // Perform a transfer from fromAddress to toAddress
+ const initialFromBalance = await noReturnErc20Token.balanceOf.callAsync(fromAddress);
+ const initialToBalance = await noReturnErc20Token.balanceOf.callAsync(toAddress);
+ const amount = new BigNumber(10);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: erc20Proxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Verify transfer was successful
+ const newFromBalance = await noReturnErc20Token.balanceOf.callAsync(fromAddress);
+ const newToBalance = await noReturnErc20Token.balanceOf.callAsync(toAddress);
+ expect(newFromBalance).to.be.bignumber.equal(initialFromBalance.minus(amount));
+ expect(newToBalance).to.be.bignumber.equal(initialToBalance.plus(amount));
+ });
+
+ it('should successfully transfer tokens and ignore extra assetData', async () => {
+ // Construct ERC20 asset data
+ const extraData = '0102030405060708';
+ const encodedAssetData = `${assetDataUtils.encodeERC20AssetData(erc20TokenA.address)}${extraData}`;
+ // Perform a transfer from fromAddress to toAddress
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const amount = new BigNumber(10);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: erc20Proxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Verify transfer was successful
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances[fromAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenA.address].minus(amount),
+ );
+ expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenA.address].add(amount),
+ );
+ });
+
+ it('should do nothing if transferring 0 amount of a token', async () => {
+ // Construct ERC20 asset data
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ // Perform a transfer from fromAddress to toAddress
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const amount = new BigNumber(0);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: erc20Proxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Verify transfer was successful
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances[fromAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenA.address],
+ );
+ expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenA.address],
+ );
+ });
+
+ it('should revert if allowances are too low', async () => {
+ // Construct ERC20 asset data
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ // Create allowance less than transfer amount. Set allowance on proxy.
+ const allowance = new BigNumber(0);
+ const amount = new BigNumber(10);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, allowance, {
+ from: fromAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ // Perform a transfer; expect this to fail.
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: erc20Proxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.TransferFailed,
+ );
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.deep.equal(erc20Balances);
+ });
+
+ it('should revert if allowances are too low and token does not return a value', async () => {
+ // Construct ERC20 asset data
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(noReturnErc20Token.address);
+ // Create allowance less than transfer amount. Set allowance on proxy.
+ const allowance = new BigNumber(0);
+ const amount = new BigNumber(10);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await noReturnErc20Token.approve.sendTransactionAsync(erc20Proxy.address, allowance, {
+ from: fromAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const initialFromBalance = await noReturnErc20Token.balanceOf.callAsync(fromAddress);
+ const initialToBalance = await noReturnErc20Token.balanceOf.callAsync(toAddress);
+ // Perform a transfer; expect this to fail.
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: erc20Proxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.TransferFailed,
+ );
+ const newFromBalance = await noReturnErc20Token.balanceOf.callAsync(fromAddress);
+ const newToBalance = await noReturnErc20Token.balanceOf.callAsync(toAddress);
+ expect(newFromBalance).to.be.bignumber.equal(initialFromBalance);
+ expect(newToBalance).to.be.bignumber.equal(initialToBalance);
+ });
+
+ it('should revert if caller is not authorized', async () => {
+ // Construct ERC20 asset data
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ // Perform a transfer from fromAddress to toAddress
+ const amount = new BigNumber(10);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: erc20Proxy.address,
+ data,
+ from: notAuthorized,
+ }),
+ RevertReason.SenderNotAuthorized,
+ );
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.deep.equal(erc20Balances);
+ });
+
+ it('should revert if token returns more than 32 bytes', async () => {
+ // Construct ERC20 asset data
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(multipleReturnErc20Token.address);
+ const amount = new BigNumber(10);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ const initialFromBalance = await multipleReturnErc20Token.balanceOf.callAsync(fromAddress);
+ const initialToBalance = await multipleReturnErc20Token.balanceOf.callAsync(toAddress);
+ // Perform a transfer; expect this to fail.
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: erc20Proxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.TransferFailed,
+ );
+ const newFromBalance = await multipleReturnErc20Token.balanceOf.callAsync(fromAddress);
+ const newToBalance = await multipleReturnErc20Token.balanceOf.callAsync(toAddress);
+ expect(newFromBalance).to.be.bignumber.equal(initialFromBalance);
+ expect(newToBalance).to.be.bignumber.equal(initialToBalance);
+ });
+ });
+ });
+
+ describe('ERC721Proxy', () => {
+ it('should revert if undefined function is called', async () => {
+ const undefinedSelector = '0x01020304';
+ await expectTransactionFailedWithoutReasonAsync(
+ web3Wrapper.sendTransactionAsync({
+ from: owner,
+ to: erc721Proxy.address,
+ value: constants.ZERO_AMOUNT,
+ data: undefinedSelector,
+ }),
+ );
+ });
+ it('should have an id of 0x02571792', async () => {
+ const proxyId = await erc721Proxy.getProxyId.callAsync();
+ const expectedProxyId = '0x02571792';
+ expect(proxyId).to.equal(expectedProxyId);
+ });
+ describe('transferFrom', () => {
+ it('should successfully transfer tokens', async () => {
+ // Construct ERC721 asset data
+ const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ // Verify pre-condition
+ const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset).to.be.equal(fromAddress);
+ // Perform a transfer from fromAddress to toAddress
+ const amount = new BigNumber(1);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: erc721Proxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Verify transfer was successful
+ const newOwnerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(newOwnerFromAsset).to.be.bignumber.equal(toAddress);
+ });
+
+ it('should successfully transfer tokens and ignore extra assetData', async () => {
+ // Construct ERC721 asset data
+ const extraData = '0102030405060708';
+ const encodedAssetData = `${assetDataUtils.encodeERC721AssetData(
+ erc721TokenA.address,
+ erc721AFromTokenId,
+ )}${extraData}`;
+ // Verify pre-condition
+ const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset).to.be.equal(fromAddress);
+ // Perform a transfer from fromAddress to toAddress
+ const amount = new BigNumber(1);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: erc721Proxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Verify transfer was successful
+ const newOwnerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(newOwnerFromAsset).to.be.bignumber.equal(toAddress);
+ });
+
+ it('should not call onERC721Received when transferring to a smart contract', async () => {
+ // Construct ERC721 asset data
+ const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ // Verify pre-condition
+ const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset).to.be.equal(fromAddress);
+ // Perform a transfer from fromAddress to toAddress
+ const amount = new BigNumber(1);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ erc721Receiver.address,
+ amount,
+ );
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
+ const tx = await logDecoder.getTxWithDecodedLogsAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: erc721Proxy.address,
+ data,
+ from: authorized,
+ gas: constants.MAX_TRANSFER_FROM_GAS,
+ }),
+ );
+ // Verify that no log was emitted by erc721 receiver
+ expect(tx.logs.length).to.be.equal(1);
+ // Verify transfer was successful
+ const newOwnerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(newOwnerFromAsset).to.be.bignumber.equal(erc721Receiver.address);
+ });
+
+ it('should revert if transferring 0 amount of a token', async () => {
+ // Construct ERC721 asset data
+ const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ // Verify pre-condition
+ const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset).to.be.equal(fromAddress);
+ // Perform a transfer from fromAddress to toAddress
+ const amount = new BigNumber(0);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: erc721Proxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.InvalidAmount,
+ );
+ const newOwner = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(newOwner).to.be.equal(ownerFromAsset);
+ });
+
+ it('should revert if transferring > 1 amount of a token', async () => {
+ // Construct ERC721 asset data
+ const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ // Verify pre-condition
+ const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset).to.be.equal(fromAddress);
+ // Perform a transfer from fromAddress to toAddress
+ const amount = new BigNumber(500);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: erc721Proxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.InvalidAmount,
+ );
+ const newOwner = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(newOwner).to.be.equal(ownerFromAsset);
+ });
+
+ it('should revert if allowances are too low', async () => {
+ // Construct ERC721 asset data
+ const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ // Verify pre-condition
+ const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset).to.be.equal(fromAddress);
+ // Remove transfer approval for fromAddress.
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721TokenA.approve.sendTransactionAsync(constants.NULL_ADDRESS, erc721AFromTokenId, {
+ from: fromAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Perform a transfer; expect this to fail.
+ const amount = new BigNumber(1);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: erc721Proxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.TransferFailed,
+ );
+ const newOwner = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(newOwner).to.be.equal(ownerFromAsset);
+ });
+
+ it('should revert if caller is not authorized', async () => {
+ // Construct ERC721 asset data
+ const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ // Verify pre-condition
+ const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset).to.be.equal(fromAddress);
+ // Perform a transfer from fromAddress to toAddress
+ const amount = new BigNumber(1);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ encodedAssetData,
+ fromAddress,
+ toAddress,
+ amount,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: erc721Proxy.address,
+ data,
+ from: notAuthorized,
+ }),
+ RevertReason.SenderNotAuthorized,
+ );
+ const newOwner = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(newOwner).to.be.equal(ownerFromAsset);
+ });
+ });
+ });
+ describe('MultiAssetProxy', () => {
+ it('should revert if undefined function is called', async () => {
+ const undefinedSelector = '0x01020304';
+ await expectTransactionFailedWithoutReasonAsync(
+ web3Wrapper.sendTransactionAsync({
+ from: owner,
+ to: multiAssetProxy.address,
+ value: constants.ZERO_AMOUNT,
+ data: undefinedSelector,
+ }),
+ );
+ });
+ it('should have an id of 0x94cfcdd7', async () => {
+ const proxyId = await multiAssetProxy.getProxyId.callAsync();
+ // first 4 bytes of `keccak256('MultiAsset(uint256[],bytes[])')`
+ const expectedProxyId = '0x94cfcdd7';
+ expect(proxyId).to.equal(expectedProxyId);
+ });
+ describe('transferFrom', () => {
+ it('should transfer a single ERC20 token', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount = new BigNumber(10);
+ const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const amounts = [erc20Amount];
+ const nestedAssetData = [erc20AssetData];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const totalAmount = inputAmount.times(erc20Amount);
+ expect(newBalances[fromAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenA.address].minus(totalAmount),
+ );
+ expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenA.address].add(totalAmount),
+ );
+ });
+ it('should dispatch an ERC20 transfer when input amount is 0', async () => {
+ const inputAmount = constants.ZERO_AMOUNT;
+ const erc20Amount = new BigNumber(10);
+ const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const amounts = [erc20Amount];
+ const nestedAssetData = [erc20AssetData];
+ const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const logDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
+ const tx = await logDecoder.getTxWithDecodedLogsAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ );
+ expect(tx.logs.length).to.be.equal(1);
+ const log = tx.logs[0] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>;
+ const transferEventName = 'Transfer';
+ expect(log.event).to.equal(transferEventName);
+ expect(log.args._value).to.be.bignumber.equal(constants.ZERO_AMOUNT);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.deep.equal(erc20Balances);
+ });
+ it('should successfully transfer multiple of the same ERC20 token', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount1 = new BigNumber(10);
+ const erc20Amount2 = new BigNumber(20);
+ const erc20AssetData1 = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const amounts = [erc20Amount1, erc20Amount2];
+ const nestedAssetData = [erc20AssetData1, erc20AssetData2];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const totalAmount = inputAmount.times(erc20Amount1).plus(inputAmount.times(erc20Amount2));
+ expect(newBalances[fromAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenA.address].minus(totalAmount),
+ );
+ expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenA.address].add(totalAmount),
+ );
+ });
+ it('should successfully transfer multiple different ERC20 tokens', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount1 = new BigNumber(10);
+ const erc20Amount2 = new BigNumber(20);
+ const erc20AssetData1 = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenB.address);
+ const amounts = [erc20Amount1, erc20Amount2];
+ const nestedAssetData = [erc20AssetData1, erc20AssetData2];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const totalErc20AAmount = inputAmount.times(erc20Amount1);
+ const totalErc20BAmount = inputAmount.times(erc20Amount2);
+ expect(newBalances[fromAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenA.address].minus(totalErc20AAmount),
+ );
+ expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenA.address].add(totalErc20AAmount),
+ );
+ expect(newBalances[fromAddress][erc20TokenB.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenB.address].minus(totalErc20BAmount),
+ );
+ expect(newBalances[toAddress][erc20TokenB.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenB.address].add(totalErc20BAmount),
+ );
+ });
+ it('should transfer a single ERC721 token', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc721Amount = new BigNumber(1);
+ const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ const amounts = [erc721Amount];
+ const nestedAssetData = [erc721AssetData];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset).to.be.equal(fromAddress);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newOwnerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(newOwnerFromAsset).to.be.equal(toAddress);
+ });
+ it('should successfully transfer multiple of the same ERC721 token', async () => {
+ const erc721Balances = await erc721Wrapper.getBalancesAsync();
+ const erc721AFromTokenId2 = erc721Balances[fromAddress][erc721TokenA.address][1];
+ const erc721AssetData1 = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ const erc721AssetData2 = assetDataUtils.encodeERC721AssetData(
+ erc721TokenA.address,
+ erc721AFromTokenId2,
+ );
+ const inputAmount = new BigNumber(1);
+ const erc721Amount = new BigNumber(1);
+ const amounts = [erc721Amount, erc721Amount];
+ const nestedAssetData = [erc721AssetData1, erc721AssetData2];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const ownerFromAsset1 = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset1).to.be.equal(fromAddress);
+ const ownerFromAsset2 = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId2);
+ expect(ownerFromAsset2).to.be.equal(fromAddress);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ gas: constants.MAX_TRANSFER_FROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newOwnerFromAsset1 = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ const newOwnerFromAsset2 = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId2);
+ expect(newOwnerFromAsset1).to.be.equal(toAddress);
+ expect(newOwnerFromAsset2).to.be.equal(toAddress);
+ });
+ it('should successfully transfer multiple different ERC721 tokens', async () => {
+ const erc721AssetData1 = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ const erc721AssetData2 = assetDataUtils.encodeERC721AssetData(erc721TokenB.address, erc721BFromTokenId);
+ const inputAmount = new BigNumber(1);
+ const erc721Amount = new BigNumber(1);
+ const amounts = [erc721Amount, erc721Amount];
+ const nestedAssetData = [erc721AssetData1, erc721AssetData2];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const ownerFromAsset1 = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset1).to.be.equal(fromAddress);
+ const ownerFromAsset2 = await erc721TokenB.ownerOf.callAsync(erc721BFromTokenId);
+ expect(ownerFromAsset2).to.be.equal(fromAddress);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ gas: constants.MAX_TRANSFER_FROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newOwnerFromAsset1 = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ const newOwnerFromAsset2 = await erc721TokenB.ownerOf.callAsync(erc721BFromTokenId);
+ expect(newOwnerFromAsset1).to.be.equal(toAddress);
+ expect(newOwnerFromAsset2).to.be.equal(toAddress);
+ });
+ it('should successfully transfer a combination of ERC20 and ERC721 tokens', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount = new BigNumber(10);
+ const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const erc721Amount = new BigNumber(1);
+ const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ const amounts = [erc20Amount, erc721Amount];
+ const nestedAssetData = [erc20AssetData, erc721AssetData];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset).to.be.equal(fromAddress);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const totalAmount = inputAmount.times(erc20Amount);
+ expect(newBalances[fromAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenA.address].minus(totalAmount),
+ );
+ expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenA.address].add(totalAmount),
+ );
+ const newOwnerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(newOwnerFromAsset).to.be.equal(toAddress);
+ });
+ it('should successfully transfer tokens and ignore extra assetData', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount = new BigNumber(10);
+ const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const erc721Amount = new BigNumber(1);
+ const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ const amounts = [erc20Amount, erc721Amount];
+ const nestedAssetData = [erc20AssetData, erc721AssetData];
+ const extraData = '0102030405060708';
+ const assetData = `${assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData)}${extraData}`;
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset).to.be.equal(fromAddress);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const totalAmount = inputAmount.times(erc20Amount);
+ expect(newBalances[fromAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenA.address].minus(totalAmount),
+ );
+ expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenA.address].add(totalAmount),
+ );
+ const newOwnerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(newOwnerFromAsset).to.be.equal(toAddress);
+ });
+ it('should successfully transfer correct amounts when the `amount` > 1', async () => {
+ const inputAmount = new BigNumber(100);
+ const erc20Amount1 = new BigNumber(10);
+ const erc20Amount2 = new BigNumber(20);
+ const erc20AssetData1 = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenB.address);
+ const amounts = [erc20Amount1, erc20Amount2];
+ const nestedAssetData = [erc20AssetData1, erc20AssetData2];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const totalErc20AAmount = inputAmount.times(erc20Amount1);
+ const totalErc20BAmount = inputAmount.times(erc20Amount2);
+ expect(newBalances[fromAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenA.address].minus(totalErc20AAmount),
+ );
+ expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenA.address].add(totalErc20AAmount),
+ );
+ expect(newBalances[fromAddress][erc20TokenB.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenB.address].minus(totalErc20BAmount),
+ );
+ expect(newBalances[toAddress][erc20TokenB.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenB.address].add(totalErc20BAmount),
+ );
+ });
+ it('should successfully transfer a large amount of tokens', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount1 = new BigNumber(10);
+ const erc20Amount2 = new BigNumber(20);
+ const erc20AssetData1 = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenB.address);
+ const erc721Amount = new BigNumber(1);
+ const erc721Balances = await erc721Wrapper.getBalancesAsync();
+ const erc721AFromTokenId2 = erc721Balances[fromAddress][erc721TokenA.address][1];
+ const erc721BFromTokenId2 = erc721Balances[fromAddress][erc721TokenB.address][1];
+ const erc721AssetData1 = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ const erc721AssetData2 = assetDataUtils.encodeERC721AssetData(
+ erc721TokenA.address,
+ erc721AFromTokenId2,
+ );
+ const erc721AssetData3 = assetDataUtils.encodeERC721AssetData(erc721TokenB.address, erc721BFromTokenId);
+ const erc721AssetData4 = assetDataUtils.encodeERC721AssetData(
+ erc721TokenB.address,
+ erc721BFromTokenId2,
+ );
+ const amounts = [erc721Amount, erc20Amount1, erc721Amount, erc20Amount2, erc721Amount, erc721Amount];
+ const nestedAssetData = [
+ erc721AssetData1,
+ erc20AssetData1,
+ erc721AssetData2,
+ erc20AssetData2,
+ erc721AssetData3,
+ erc721AssetData4,
+ ];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ const ownerFromAsset1 = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ expect(ownerFromAsset1).to.be.equal(fromAddress);
+ const ownerFromAsset2 = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId2);
+ expect(ownerFromAsset2).to.be.equal(fromAddress);
+ const ownerFromAsset3 = await erc721TokenB.ownerOf.callAsync(erc721BFromTokenId);
+ expect(ownerFromAsset3).to.be.equal(fromAddress);
+ const ownerFromAsset4 = await erc721TokenB.ownerOf.callAsync(erc721BFromTokenId2);
+ expect(ownerFromAsset4).to.be.equal(fromAddress);
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ gas: constants.MAX_EXECUTE_TRANSACTION_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const newOwnerFromAsset1 = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
+ const newOwnerFromAsset2 = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId2);
+ const newOwnerFromAsset3 = await erc721TokenB.ownerOf.callAsync(erc721BFromTokenId);
+ const newOwnerFromAsset4 = await erc721TokenB.ownerOf.callAsync(erc721BFromTokenId2);
+ expect(newOwnerFromAsset1).to.be.equal(toAddress);
+ expect(newOwnerFromAsset2).to.be.equal(toAddress);
+ expect(newOwnerFromAsset3).to.be.equal(toAddress);
+ expect(newOwnerFromAsset4).to.be.equal(toAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const totalErc20AAmount = inputAmount.times(erc20Amount1);
+ const totalErc20BAmount = inputAmount.times(erc20Amount2);
+ expect(newBalances[fromAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenA.address].minus(totalErc20AAmount),
+ );
+ expect(newBalances[toAddress][erc20TokenA.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenA.address].add(totalErc20AAmount),
+ );
+ expect(newBalances[fromAddress][erc20TokenB.address]).to.be.bignumber.equal(
+ erc20Balances[fromAddress][erc20TokenB.address].minus(totalErc20BAmount),
+ );
+ expect(newBalances[toAddress][erc20TokenB.address]).to.be.bignumber.equal(
+ erc20Balances[toAddress][erc20TokenB.address].add(totalErc20BAmount),
+ );
+ });
+ it('should revert if a single transfer fails', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount = new BigNumber(10);
+ const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ // 2 is an invalid erc721 amount
+ const erc721Amount = new BigNumber(2);
+ const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ const amounts = [erc20Amount, erc721Amount];
+ const nestedAssetData = [erc20AssetData, erc721AssetData];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.InvalidAmount,
+ );
+ });
+ it('should revert if an AssetProxy is not registered', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount = new BigNumber(10);
+ const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const erc721Amount = new BigNumber(1);
+ const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ const invalidProxyId = '0x12345678';
+ const invalidErc721AssetData = `${invalidProxyId}${erc721AssetData.slice(10)}`;
+ const amounts = [erc20Amount, erc721Amount];
+ const nestedAssetData = [erc20AssetData, invalidErc721AssetData];
+ // HACK: This is used to get around validation built into assetDataUtils
+ const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.AssetProxyDoesNotExist,
+ );
+ });
+ it('should revert if the length of `amounts` does not match the length of `nestedAssetData`', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount = new BigNumber(10);
+ const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ const amounts = [erc20Amount];
+ const nestedAssetData = [erc20AssetData, erc721AssetData];
+ // HACK: This is used to get around validation built into assetDataUtils
+ const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.LengthMismatch,
+ );
+ });
+ it('should revert if amounts multiplication results in an overflow', async () => {
+ const inputAmount = new BigNumber(2).pow(128);
+ const erc20Amount = new BigNumber(2).pow(128);
+ const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const amounts = [erc20Amount];
+ const nestedAssetData = [erc20AssetData];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.Uint256Overflow,
+ );
+ });
+ it('should revert if an element of `nestedAssetData` is < 4 bytes long', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount = new BigNumber(10);
+ const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const erc721Amount = new BigNumber(1);
+ const erc721AssetData = '0x123456';
+ const amounts = [erc20Amount, erc721Amount];
+ const nestedAssetData = [erc20AssetData, erc721AssetData];
+ // HACK: This is used to get around validation built into assetDataUtils
+ const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: authorized,
+ }),
+ RevertReason.LengthGreaterThan3Required,
+ );
+ });
+ it('should revert if caller is not authorized', async () => {
+ const inputAmount = new BigNumber(1);
+ const erc20Amount = new BigNumber(10);
+ const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
+ const erc721Amount = new BigNumber(1);
+ const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
+ const amounts = [erc20Amount, erc721Amount];
+ const nestedAssetData = [erc20AssetData, erc721AssetData];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
+ assetData,
+ fromAddress,
+ toAddress,
+ inputAmount,
+ );
+ await expectTransactionFailedAsync(
+ web3Wrapper.sendTransactionAsync({
+ to: multiAssetProxy.address,
+ data,
+ from: notAuthorized,
+ }),
+ RevertReason.SenderNotAuthorized,
+ );
+ });
+ });
+ });
+});
+// tslint:enable:no-unnecessary-type-assertion
+// tslint:disable:max-file-line-count
diff --git a/contracts/protocol/test/exchange/core.ts b/contracts/protocol/test/exchange/core.ts
new file mode 100644
index 000000000..42db8623d
--- /dev/null
+++ b/contracts/protocol/test/exchange/core.ts
@@ -0,0 +1,1157 @@
+import {
+ chaiSetup,
+ constants,
+ ERC20BalancesByOwner,
+ expectTransactionFailedAsync,
+ getLatestBlockTimestampAsync,
+ increaseTimeAndMineBlockAsync,
+ OrderFactory,
+ OrderStatus,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ DummyERC20TokenTransferEventArgs,
+ DummyERC721TokenContract,
+ DummyNoReturnERC20TokenContract,
+ ReentrantERC20TokenContract,
+} from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import ethUtil = require('ethereumjs-util');
+import * as _ from 'lodash';
+
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { ExchangeCancelEventArgs, ExchangeContract } from '../../generated-wrappers/exchange';
+import { MultiAssetProxyContract } from '../../generated-wrappers/multi_asset_proxy';
+import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver';
+import { artifacts } from '../../src/artifacts';
+import { ERC20Wrapper } from '../utils/erc20_wrapper';
+import { ERC721Wrapper } from '../utils/erc721_wrapper';
+import { ExchangeWrapper } from '../utils/exchange_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+// tslint:disable:no-unnecessary-type-assertion
+describe('Exchange core', () => {
+ let makerAddress: string;
+ let owner: string;
+ let takerAddress: string;
+ let feeRecipientAddress: string;
+
+ let erc20TokenA: DummyERC20TokenContract;
+ let erc20TokenB: DummyERC20TokenContract;
+ let zrxToken: DummyERC20TokenContract;
+ let erc721Token: DummyERC721TokenContract;
+ let noReturnErc20Token: DummyNoReturnERC20TokenContract;
+ let reentrantErc20Token: ReentrantERC20TokenContract;
+ let exchange: ExchangeContract;
+ let erc20Proxy: ERC20ProxyContract;
+ let erc721Proxy: ERC721ProxyContract;
+ let multiAssetProxy: MultiAssetProxyContract;
+ let maliciousWallet: TestStaticCallReceiverContract;
+ let maliciousValidator: TestStaticCallReceiverContract;
+
+ let signedOrder: SignedOrder;
+ let erc20Balances: ERC20BalancesByOwner;
+ let exchangeWrapper: ExchangeWrapper;
+ let erc20Wrapper: ERC20Wrapper;
+ let erc721Wrapper: ERC721Wrapper;
+ let orderFactory: OrderFactory;
+
+ let erc721MakerAssetIds: BigNumber[];
+ let erc721TakerAssetIds: BigNumber[];
+
+ let defaultMakerAssetAddress: string;
+ let defaultTakerAssetAddress: string;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = _.slice(accounts, 0, 4));
+
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
+
+ // Deploy AssetProxies, Exchange, tokens, and malicious contracts
+ erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ erc721Proxy = await erc721Wrapper.deployProxyAsync();
+ multiAssetProxy = await MultiAssetProxyContract.deployFrom0xArtifactAsync(
+ artifacts.MultiAssetProxy,
+ provider,
+ txDefaults,
+ );
+ const numDummyErc20ToDeploy = 3;
+ [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
+ numDummyErc20ToDeploy,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
+ [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
+ assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ );
+ maliciousWallet = maliciousValidator = await TestStaticCallReceiverContract.deployFrom0xArtifactAsync(
+ artifacts.TestStaticCallReceiver,
+ provider,
+ txDefaults,
+ );
+ reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
+ tokensArtifacts.ReentrantERC20Token,
+ provider,
+ txDefaults,
+ exchange.address,
+ );
+
+ // Configure ERC20Proxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ // Configure ERC721Proxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ // Configure MultiAssetProxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ // Configure Exchange
+ exchangeWrapper = new ExchangeWrapper(exchange, provider);
+ await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
+ await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
+ await exchangeWrapper.registerAssetProxyAsync(multiAssetProxy.address, owner);
+
+ // Configure ERC20 tokens
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+
+ // Configure ERC721 tokens
+ await erc721Wrapper.setBalancesAndAllowancesAsync();
+ const erc721Balances = await erc721Wrapper.getBalancesAsync();
+ erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
+ erc721TakerAssetIds = erc721Balances[takerAddress][erc721Token.address];
+
+ // Configure order defaults
+ defaultMakerAssetAddress = erc20TokenA.address;
+ defaultTakerAssetAddress = erc20TokenB.address;
+ const defaultOrderParams = {
+ ...constants.STATIC_ORDER_PARAMS,
+ exchangeAddress: exchange.address,
+ makerAddress,
+ feeRecipientAddress,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
+ };
+ const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
+ orderFactory = new OrderFactory(privateKey, defaultOrderParams);
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('fillOrder', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ });
+
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow fillOrder to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
+ RevertReason.TransferFailed,
+ );
+ });
+ });
+ };
+ describe('fillOrder reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should throw if signature is invalid', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+
+ const v = ethUtil.toBuffer(signedOrder.signature.slice(0, 4));
+ const invalidR = ethUtil.sha3('invalidR');
+ const invalidS = ethUtil.sha3('invalidS');
+ const signatureType = ethUtil.toBuffer(`0x${signedOrder.signature.slice(-2)}`);
+ const invalidSigBuff = Buffer.concat([v, invalidR, invalidS, signatureType]);
+ const invalidSigHex = `0x${invalidSigBuff.toString('hex')}`;
+ signedOrder.signature = invalidSigHex;
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
+ RevertReason.InvalidOrderSignature,
+ );
+ });
+
+ it('should throw if no value is filled', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
+ RevertReason.OrderUnfillable,
+ );
+ });
+
+ it('should revert if `isValidSignature` tries to update state when SignatureType=Wallet', async () => {
+ const maliciousMakerAddress = maliciousWallet.address;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20TokenA.setBalance.sendTransactionAsync(
+ maliciousMakerAddress,
+ constants.INITIAL_ERC20_BALANCE,
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await maliciousWallet.approveERC20.sendTransactionAsync(
+ erc20TokenA.address,
+ erc20Proxy.address,
+ constants.INITIAL_ERC20_ALLOWANCE,
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAddress: maliciousMakerAddress,
+ makerFee: constants.ZERO_AMOUNT,
+ });
+ signedOrder.signature = `0x0${SignatureType.Wallet}`;
+ await expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
+ RevertReason.WalletError,
+ );
+ });
+
+ it('should revert if `isValidSignature` tries to update state when SignatureType=Validator', async () => {
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await exchange.setSignatureValidatorApproval.sendTransactionAsync(
+ maliciousValidator.address,
+ isApproved,
+ { from: makerAddress },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ signedOrder.signature = `${maliciousValidator.address}0${SignatureType.Validator}`;
+ await expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
+ RevertReason.ValidatorError,
+ );
+ });
+
+ it('should not emit transfer events for transfers where from == to', async () => {
+ const txReceipt = await exchangeWrapper.fillOrderAsync(signedOrder, makerAddress);
+ const logs = txReceipt.logs;
+ const transferLogs = _.filter(
+ logs,
+ log => (log as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).event === 'Transfer',
+ );
+ expect(transferLogs.length).to.be.equal(2);
+ expect((transferLogs[0] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).address).to.be.equal(
+ zrxToken.address,
+ );
+ expect((transferLogs[0] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._from).to.be.equal(
+ makerAddress,
+ );
+ expect((transferLogs[0] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._to).to.be.equal(
+ feeRecipientAddress,
+ );
+ expect(
+ (transferLogs[0] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._value,
+ ).to.be.bignumber.equal(signedOrder.makerFee);
+ expect((transferLogs[1] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).address).to.be.equal(
+ zrxToken.address,
+ );
+ expect((transferLogs[1] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._from).to.be.equal(
+ makerAddress,
+ );
+ expect((transferLogs[1] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._to).to.be.equal(
+ feeRecipientAddress,
+ );
+ expect(
+ (transferLogs[1] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._value,
+ ).to.be.bignumber.equal(signedOrder.takerFee);
+ });
+ });
+
+ describe('Testing exchange of ERC20 tokens with no return values', () => {
+ before(async () => {
+ noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
+ tokensArtifacts.DummyNoReturnERC20Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await noReturnErc20Token.setBalance.sendTransactionAsync(makerAddress, constants.INITIAL_ERC20_BALANCE),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await noReturnErc20Token.approve.sendTransactionAsync(
+ erc20Proxy.address,
+ constants.INITIAL_ERC20_ALLOWANCE,
+ { from: makerAddress },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ });
+ it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(noReturnErc20Token.address),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ });
+
+ const initialMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
+ const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const initialTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
+ const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+ const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
+
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
+
+ const finalMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
+ const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const finalTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
+ const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+ const finalFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
+
+ expect(finalMakerBalanceA).to.be.bignumber.equal(initialMakerBalanceA.minus(signedOrder.makerAssetAmount));
+ expect(finalMakerBalanceB).to.be.bignumber.equal(initialMakerBalanceB.plus(signedOrder.takerAssetAmount));
+ expect(finalTakerBalanceA).to.be.bignumber.equal(initialTakerBalanceA.plus(signedOrder.makerAssetAmount));
+ expect(finalTakerBalanceB).to.be.bignumber.equal(initialTakerBalanceB.minus(signedOrder.takerAssetAmount));
+ expect(finalMakerZrxBalance).to.be.bignumber.equal(initialMakerZrxBalance.minus(signedOrder.makerFee));
+ expect(finalTakerZrxBalance).to.be.bignumber.equal(initialTakerZrxBalance.minus(signedOrder.takerFee));
+ expect(finalFeeRecipientZrxBalance).to.be.bignumber.equal(
+ initialFeeRecipientZrxBalance.plus(signedOrder.makerFee.plus(signedOrder.takerFee)),
+ );
+ });
+ it('should transfer the correct amounts when makerAssetAmount > takerAssetAmount', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(noReturnErc20Token.address),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ });
+
+ const initialMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
+ const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const initialTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
+ const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+ const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
+
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
+
+ const finalMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
+ const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const finalTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
+ const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+ const finalFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
+
+ expect(finalMakerBalanceA).to.be.bignumber.equal(initialMakerBalanceA.minus(signedOrder.makerAssetAmount));
+ expect(finalMakerBalanceB).to.be.bignumber.equal(initialMakerBalanceB.plus(signedOrder.takerAssetAmount));
+ expect(finalTakerBalanceA).to.be.bignumber.equal(initialTakerBalanceA.plus(signedOrder.makerAssetAmount));
+ expect(finalTakerBalanceB).to.be.bignumber.equal(initialTakerBalanceB.minus(signedOrder.takerAssetAmount));
+ expect(finalMakerZrxBalance).to.be.bignumber.equal(initialMakerZrxBalance.minus(signedOrder.makerFee));
+ expect(finalTakerZrxBalance).to.be.bignumber.equal(initialTakerZrxBalance.minus(signedOrder.takerFee));
+ expect(finalFeeRecipientZrxBalance).to.be.bignumber.equal(
+ initialFeeRecipientZrxBalance.plus(signedOrder.makerFee.plus(signedOrder.takerFee)),
+ );
+ });
+ it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(noReturnErc20Token.address),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
+ });
+
+ const initialMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
+ const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const initialTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
+ const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+ const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
+
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
+
+ const finalMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
+ const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const finalTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
+ const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+ const finalFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
+
+ expect(finalMakerBalanceA).to.be.bignumber.equal(initialMakerBalanceA.minus(signedOrder.makerAssetAmount));
+ expect(finalMakerBalanceB).to.be.bignumber.equal(initialMakerBalanceB.plus(signedOrder.takerAssetAmount));
+ expect(finalTakerBalanceA).to.be.bignumber.equal(initialTakerBalanceA.plus(signedOrder.makerAssetAmount));
+ expect(finalTakerBalanceB).to.be.bignumber.equal(initialTakerBalanceB.minus(signedOrder.takerAssetAmount));
+ expect(finalMakerZrxBalance).to.be.bignumber.equal(initialMakerZrxBalance.minus(signedOrder.makerFee));
+ expect(finalTakerZrxBalance).to.be.bignumber.equal(initialTakerZrxBalance.minus(signedOrder.takerFee));
+ expect(finalFeeRecipientZrxBalance).to.be.bignumber.equal(
+ initialFeeRecipientZrxBalance.plus(signedOrder.makerFee.plus(signedOrder.takerFee)),
+ );
+ });
+ });
+
+ describe('cancelOrder', () => {
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ });
+
+ it('should throw if not sent by maker', async () => {
+ return expectTransactionFailedAsync(
+ exchangeWrapper.cancelOrderAsync(signedOrder, takerAddress),
+ RevertReason.InvalidMaker,
+ );
+ });
+
+ it('should throw if makerAssetAmount is 0', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(0),
+ });
+
+ return expectTransactionFailedAsync(
+ exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
+ RevertReason.OrderUnfillable,
+ );
+ });
+
+ it('should throw if takerAssetAmount is 0', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ takerAssetAmount: new BigNumber(0),
+ });
+
+ return expectTransactionFailedAsync(
+ exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
+ RevertReason.OrderUnfillable,
+ );
+ });
+
+ it('should be able to cancel a full order', async () => {
+ await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
+ takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
+ }),
+ RevertReason.OrderUnfillable,
+ );
+ });
+
+ it('should log 1 event with correct arguments', async () => {
+ const res = await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
+ expect(res.logs).to.have.length(1);
+
+ const log = res.logs[0] as LogWithDecodedArgs<ExchangeCancelEventArgs>;
+ const logArgs = log.args;
+
+ expect(signedOrder.makerAddress).to.be.equal(logArgs.makerAddress);
+ expect(signedOrder.makerAddress).to.be.equal(logArgs.senderAddress);
+ expect(signedOrder.feeRecipientAddress).to.be.equal(logArgs.feeRecipientAddress);
+ expect(signedOrder.makerAssetData).to.be.equal(logArgs.makerAssetData);
+ expect(signedOrder.takerAssetData).to.be.equal(logArgs.takerAssetData);
+ expect(orderHashUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash);
+ });
+
+ it('should throw if already cancelled', async () => {
+ await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
+ return expectTransactionFailedAsync(
+ exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
+ RevertReason.OrderUnfillable,
+ );
+ });
+
+ it('should throw if order is expired', async () => {
+ const currentTimestamp = await getLatestBlockTimestampAsync();
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ expirationTimeSeconds: new BigNumber(currentTimestamp).sub(10),
+ });
+ return expectTransactionFailedAsync(
+ exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
+ RevertReason.OrderUnfillable,
+ );
+ });
+
+ it('should throw if rounding error is greater than 0.1%', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1001),
+ takerAssetAmount: new BigNumber(3),
+ });
+
+ const fillTakerAssetAmount1 = new BigNumber(2);
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
+ takerAssetFillAmount: fillTakerAssetAmount1,
+ });
+
+ const fillTakerAssetAmount2 = new BigNumber(1);
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
+ takerAssetFillAmount: fillTakerAssetAmount2,
+ }),
+ RevertReason.RoundingError,
+ );
+ });
+ });
+
+ describe('cancelOrdersUpTo', () => {
+ it('should fail to set orderEpoch less than current orderEpoch', async () => {
+ const orderEpoch = new BigNumber(1);
+ await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
+ const lesserOrderEpoch = new BigNumber(0);
+ return expectTransactionFailedAsync(
+ exchangeWrapper.cancelOrdersUpToAsync(lesserOrderEpoch, makerAddress),
+ RevertReason.InvalidNewOrderEpoch,
+ );
+ });
+
+ it('should fail to set orderEpoch equal to existing orderEpoch', async () => {
+ const orderEpoch = new BigNumber(1);
+ await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
+ return expectTransactionFailedAsync(
+ exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress),
+ RevertReason.InvalidNewOrderEpoch,
+ );
+ });
+
+ it('should cancel only orders with a orderEpoch less than existing orderEpoch', async () => {
+ // Cancel all transactions with a orderEpoch less than 1
+ const orderEpoch = new BigNumber(1);
+ await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
+
+ // Create 3 orders with orderEpoch values: 0,1,2,3
+ // Since we cancelled with orderEpoch=1, orders with orderEpoch<=1 will not be processed
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const signedOrders = [
+ await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(9), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(9), 18),
+ salt: new BigNumber(0),
+ }),
+ await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(79), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(79), 18),
+ salt: new BigNumber(1),
+ }),
+ await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(979), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(979), 18),
+ salt: new BigNumber(2),
+ }),
+ await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(7979), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(7979), 18),
+ salt: new BigNumber(3),
+ }),
+ ];
+ await exchangeWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress, {
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const fillMakerAssetAmount = signedOrders[2].makerAssetAmount.add(signedOrders[3].makerAssetAmount);
+ const fillTakerAssetAmount = signedOrders[2].takerAssetAmount.add(signedOrders[3].takerAssetAmount);
+ const makerFee = signedOrders[2].makerFee.add(signedOrders[3].makerFee);
+ const takerFee = signedOrders[2].takerFee.add(signedOrders[3].takerFee);
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(fillMakerAssetAmount),
+ );
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultTakerAssetAddress].add(fillTakerAssetAmount),
+ );
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
+ );
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultTakerAssetAddress].minus(fillTakerAssetAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].add(fillMakerAssetAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ );
+ });
+ });
+
+ describe('Testing Exchange of ERC721 Tokens', () => {
+ it('should throw when maker does not own the token with id makerAssetId', async () => {
+ // Construct Exchange parameters
+ const makerAssetId = erc721TakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[1];
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
+ });
+ // Verify pre-conditions
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.not.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
+ // Call Exchange
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
+ RevertReason.TransferFailed,
+ );
+ });
+
+ it('should throw when taker does not own the token with id takerAssetId', async () => {
+ // Construct Exchange parameters
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721MakerAssetIds[1];
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
+ });
+ // Verify pre-conditions
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.not.equal(takerAddress);
+ // Call Exchange
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
+ RevertReason.TransferFailed,
+ );
+ });
+
+ it('should throw when makerAssetAmount is greater than 1', async () => {
+ // Construct Exchange parameters
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[0];
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(2),
+ takerAssetAmount: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
+ });
+ // Verify pre-conditions
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
+ // Call Exchange
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
+ RevertReason.InvalidAmount,
+ );
+ });
+
+ it('should throw when takerAssetAmount is greater than 1', async () => {
+ // Construct Exchange parameters
+ const makerAssetId = erc721MakerAssetIds[0];
+ const takerAssetId = erc721TakerAssetIds[0];
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: new BigNumber(500),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
+ });
+ // Verify pre-conditions
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
+ // Call Exchange
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
+ RevertReason.InvalidAmount,
+ );
+ });
+
+ it('should throw on partial fill', async () => {
+ // Construct Exchange parameters
+ const makerAssetId = erc721MakerAssetIds[0];
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
+ });
+ // Call Exchange
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
+ RevertReason.RoundingError,
+ );
+ });
+ });
+
+ describe('Testing exchange of multiple assets', () => {
+ it('should allow multiple assets to be exchanged for a single asset', async () => {
+ const makerAmounts = [new BigNumber(10), new BigNumber(20)];
+ const makerNestedAssetData = [
+ assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
+ assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
+ ];
+ const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData);
+ const makerAssetAmount = new BigNumber(1);
+ const takerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+ const takerAssetAmount = new BigNumber(10);
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData,
+ takerAssetData,
+ makerAssetAmount,
+ takerAssetAmount,
+ makerFee: constants.ZERO_AMOUNT,
+ takerFee: constants.ZERO_AMOUNT,
+ });
+
+ const initialMakerBalanceA = await erc20TokenA.balanceOf.callAsync(makerAddress);
+ const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const initialTakerBalanceA = await erc20TokenA.balanceOf.callAsync(takerAddress);
+ const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
+
+ const finalMakerBalanceA = await erc20TokenA.balanceOf.callAsync(makerAddress);
+ const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const finalTakerBalanceA = await erc20TokenA.balanceOf.callAsync(takerAddress);
+ const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+
+ expect(finalMakerBalanceA).to.be.bignumber.equal(
+ initialMakerBalanceA.minus(makerAmounts[0].times(makerAssetAmount)),
+ );
+ expect(finalMakerBalanceB).to.be.bignumber.equal(
+ initialMakerBalanceB.minus(makerAmounts[1].times(makerAssetAmount)),
+ );
+ expect(finalMakerZrxBalance).to.be.bignumber.equal(initialMakerZrxBalance.plus(takerAssetAmount));
+ expect(finalTakerBalanceA).to.be.bignumber.equal(
+ initialTakerBalanceA.plus(makerAmounts[0].times(makerAssetAmount)),
+ );
+ expect(finalTakerBalanceB).to.be.bignumber.equal(
+ initialTakerBalanceB.plus(makerAmounts[1].times(makerAssetAmount)),
+ );
+ expect(finalTakerZrxBalance).to.be.bignumber.equal(initialTakerZrxBalance.minus(takerAssetAmount));
+ });
+ it('should allow multiple assets to be exchanged for multiple assets', async () => {
+ const makerAmounts = [new BigNumber(10), new BigNumber(20)];
+ const makerNestedAssetData = [
+ assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
+ assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
+ ];
+ const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData);
+ const makerAssetAmount = new BigNumber(1);
+ const takerAmounts = [new BigNumber(10), new BigNumber(1)];
+ const takerAssetId = erc721TakerAssetIds[0];
+ const takerNestedAssetData = [
+ assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
+ ];
+ const takerAssetData = assetDataUtils.encodeMultiAssetData(takerAmounts, takerNestedAssetData);
+ const takerAssetAmount = new BigNumber(1);
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData,
+ takerAssetData,
+ makerAssetAmount,
+ takerAssetAmount,
+ makerFee: constants.ZERO_AMOUNT,
+ takerFee: constants.ZERO_AMOUNT,
+ });
+
+ const initialMakerBalanceA = await erc20TokenA.balanceOf.callAsync(makerAddress);
+ const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const initialTakerBalanceA = await erc20TokenA.balanceOf.callAsync(takerAddress);
+ const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
+
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
+
+ const finalMakerBalanceA = await erc20TokenA.balanceOf.callAsync(makerAddress);
+ const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const finalTakerBalanceA = await erc20TokenA.balanceOf.callAsync(takerAddress);
+ const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+ const finalOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+
+ expect(finalMakerBalanceA).to.be.bignumber.equal(
+ initialMakerBalanceA.minus(makerAmounts[0].times(makerAssetAmount)),
+ );
+ expect(finalMakerBalanceB).to.be.bignumber.equal(
+ initialMakerBalanceB.minus(makerAmounts[1].times(makerAssetAmount)),
+ );
+ expect(finalMakerZrxBalance).to.be.bignumber.equal(
+ initialMakerZrxBalance.plus(takerAmounts[0].times(takerAssetAmount)),
+ );
+ expect(finalTakerBalanceA).to.be.bignumber.equal(
+ initialTakerBalanceA.plus(makerAmounts[0].times(makerAssetAmount)),
+ );
+ expect(finalTakerBalanceB).to.be.bignumber.equal(
+ initialTakerBalanceB.plus(makerAmounts[1].times(makerAssetAmount)),
+ );
+ expect(finalTakerZrxBalance).to.be.bignumber.equal(
+ initialTakerZrxBalance.minus(takerAmounts[0].times(takerAssetAmount)),
+ );
+ expect(finalOwnerTakerAsset).to.be.equal(makerAddress);
+ });
+ it('should allow an order selling multiple assets to be partially filled', async () => {
+ const makerAmounts = [new BigNumber(10), new BigNumber(20)];
+ const makerNestedAssetData = [
+ assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
+ assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
+ ];
+ const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData);
+ const makerAssetAmount = new BigNumber(30);
+ const takerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+ const takerAssetAmount = new BigNumber(10);
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData,
+ takerAssetData,
+ makerAssetAmount,
+ takerAssetAmount,
+ makerFee: constants.ZERO_AMOUNT,
+ takerFee: constants.ZERO_AMOUNT,
+ });
+
+ const initialMakerBalanceA = await erc20TokenA.balanceOf.callAsync(makerAddress);
+ const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const initialTakerBalanceA = await erc20TokenA.balanceOf.callAsync(takerAddress);
+ const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+
+ const takerAssetFillAmount = takerAssetAmount.dividedToIntegerBy(2);
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
+ takerAssetFillAmount,
+ });
+
+ const finalMakerBalanceA = await erc20TokenA.balanceOf.callAsync(makerAddress);
+ const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const finalTakerBalanceA = await erc20TokenA.balanceOf.callAsync(takerAddress);
+ const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+
+ expect(finalMakerBalanceA).to.be.bignumber.equal(
+ initialMakerBalanceA.minus(
+ makerAmounts[0].times(
+ makerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ ),
+ );
+ expect(finalMakerBalanceB).to.be.bignumber.equal(
+ initialMakerBalanceB.minus(
+ makerAmounts[1].times(
+ makerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ ),
+ );
+ expect(finalMakerZrxBalance).to.be.bignumber.equal(
+ initialMakerZrxBalance.plus(
+ takerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ );
+ expect(finalTakerBalanceA).to.be.bignumber.equal(
+ initialTakerBalanceA.plus(
+ makerAmounts[0].times(
+ makerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ ),
+ );
+ expect(finalTakerBalanceB).to.be.bignumber.equal(
+ initialTakerBalanceB.plus(
+ makerAmounts[1].times(
+ makerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ ),
+ );
+ expect(finalTakerZrxBalance).to.be.bignumber.equal(
+ initialTakerZrxBalance.minus(
+ takerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ );
+ });
+ it('should allow an order buying multiple assets to be partially filled', async () => {
+ const takerAmounts = [new BigNumber(10), new BigNumber(20)];
+ const takerNestedAssetData = [
+ assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
+ assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
+ ];
+ const takerAssetData = assetDataUtils.encodeMultiAssetData(takerAmounts, takerNestedAssetData);
+ const takerAssetAmount = new BigNumber(30);
+ const makerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+ const makerAssetAmount = new BigNumber(10);
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData,
+ takerAssetData,
+ makerAssetAmount,
+ takerAssetAmount,
+ makerFee: constants.ZERO_AMOUNT,
+ takerFee: constants.ZERO_AMOUNT,
+ });
+
+ const initialMakerBalanceA = await erc20TokenA.balanceOf.callAsync(makerAddress);
+ const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const initialTakerBalanceA = await erc20TokenA.balanceOf.callAsync(takerAddress);
+ const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+
+ const takerAssetFillAmount = takerAssetAmount.dividedToIntegerBy(2);
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
+ takerAssetFillAmount,
+ });
+
+ const finalMakerBalanceA = await erc20TokenA.balanceOf.callAsync(makerAddress);
+ const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
+ const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
+ const finalTakerBalanceA = await erc20TokenA.balanceOf.callAsync(takerAddress);
+ const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
+ const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
+
+ expect(finalMakerBalanceA).to.be.bignumber.equal(
+ initialMakerBalanceA.plus(
+ takerAmounts[0].times(
+ takerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ ),
+ );
+ expect(finalMakerBalanceB).to.be.bignumber.equal(
+ initialMakerBalanceB.plus(
+ takerAmounts[1].times(
+ takerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ ),
+ );
+ expect(finalMakerZrxBalance).to.be.bignumber.equal(
+ initialMakerZrxBalance.minus(
+ makerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ );
+ expect(finalTakerBalanceA).to.be.bignumber.equal(
+ initialTakerBalanceA.minus(
+ takerAmounts[0].times(
+ takerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ ),
+ );
+ expect(finalTakerBalanceB).to.be.bignumber.equal(
+ initialTakerBalanceB.minus(
+ takerAmounts[1].times(
+ takerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ ),
+ );
+ expect(finalTakerZrxBalance).to.be.bignumber.equal(
+ initialTakerZrxBalance.plus(
+ makerAssetAmount.times(takerAssetFillAmount).dividedToIntegerBy(takerAssetAmount),
+ ),
+ );
+ });
+ });
+
+ describe('getOrderInfo', () => {
+ beforeEach(async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ });
+ it('should return the correct orderInfo for an unfilled valid order', async () => {
+ const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = new BigNumber(0);
+ const expectedOrderStatus = OrderStatus.FILLABLE;
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ it('should return the correct orderInfo for a fully filled order', async () => {
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
+ const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount;
+ const expectedOrderStatus = OrderStatus.FULLY_FILLED;
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ it('should return the correct orderInfo for a partially filled order', async () => {
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
+ const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = takerAssetFillAmount;
+ const expectedOrderStatus = OrderStatus.FILLABLE;
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ it('should return the correct orderInfo for a cancelled and unfilled order', async () => {
+ await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
+ const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = new BigNumber(0);
+ const expectedOrderStatus = OrderStatus.CANCELLED;
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ it('should return the correct orderInfo for a cancelled and partially filled order', async () => {
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
+ await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
+ const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = takerAssetFillAmount;
+ const expectedOrderStatus = OrderStatus.CANCELLED;
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ it('should return the correct orderInfo for an expired and unfilled order', async () => {
+ const currentTimestamp = await getLatestBlockTimestampAsync();
+ const timeUntilExpiration = signedOrder.expirationTimeSeconds.minus(currentTimestamp).toNumber();
+ await increaseTimeAndMineBlockAsync(timeUntilExpiration);
+ const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = new BigNumber(0);
+ const expectedOrderStatus = OrderStatus.EXPIRED;
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ it('should return the correct orderInfo for an expired and partially filled order', async () => {
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
+ const currentTimestamp = await getLatestBlockTimestampAsync();
+ const timeUntilExpiration = signedOrder.expirationTimeSeconds.minus(currentTimestamp).toNumber();
+ await increaseTimeAndMineBlockAsync(timeUntilExpiration);
+ const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = takerAssetFillAmount;
+ const expectedOrderStatus = OrderStatus.EXPIRED;
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ it('should return the correct orderInfo for an expired and fully filled order', async () => {
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
+ const currentTimestamp = await getLatestBlockTimestampAsync();
+ const timeUntilExpiration = signedOrder.expirationTimeSeconds.minus(currentTimestamp).toNumber();
+ await increaseTimeAndMineBlockAsync(timeUntilExpiration);
+ const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount;
+ // FULLY_FILLED takes precedence over EXPIRED
+ const expectedOrderStatus = OrderStatus.FULLY_FILLED;
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ it('should return the correct orderInfo for an order with a makerAssetAmount of 0', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync({ makerAssetAmount: new BigNumber(0) });
+ const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = new BigNumber(0);
+ const expectedOrderStatus = OrderStatus.INVALID_MAKER_ASSET_AMOUNT;
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ it('should return the correct orderInfo for an order with a takerAssetAmount of 0', async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync({ takerAssetAmount: new BigNumber(0) });
+ const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = new BigNumber(0);
+ const expectedOrderStatus = OrderStatus.INVALID_TAKER_ASSET_AMOUNT;
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ });
+});
+// tslint:disable:max-file-line-count
+// tslint:enable:no-unnecessary-type-assertion
diff --git a/contracts/protocol/test/exchange/dispatcher.ts b/contracts/protocol/test/exchange/dispatcher.ts
new file mode 100644
index 000000000..5b1ac1e20
--- /dev/null
+++ b/contracts/protocol/test/exchange/dispatcher.ts
@@ -0,0 +1,284 @@
+import {
+ chaiSetup,
+ constants,
+ expectTransactionFailedAsync,
+ LogDecoder,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { DummyERC20TokenContract } from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { AssetProxyId, RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import {
+ TestAssetProxyDispatcherAssetProxyRegisteredEventArgs,
+ TestAssetProxyDispatcherContract,
+} from '../../generated-wrappers/test_asset_proxy_dispatcher';
+import { artifacts } from '../../src/artifacts';
+import { ERC20Wrapper } from '../utils/erc20_wrapper';
+import { ERC721Wrapper } from '../utils/erc721_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+// tslint:disable:no-unnecessary-type-assertion
+describe('AssetProxyDispatcher', () => {
+ let owner: string;
+ let notOwner: string;
+ let makerAddress: string;
+ let takerAddress: string;
+
+ let zrxToken: DummyERC20TokenContract;
+ let erc20Proxy: ERC20ProxyContract;
+ let erc721Proxy: ERC721ProxyContract;
+ let assetProxyDispatcher: TestAssetProxyDispatcherContract;
+
+ let erc20Wrapper: ERC20Wrapper;
+ let erc721Wrapper: ERC721Wrapper;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ // Setup accounts & addresses
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const usedAddresses = ([owner, notOwner, makerAddress, takerAddress] = _.slice(accounts, 0, 4));
+
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
+
+ const numDummyErc20ToDeploy = 1;
+ [zrxToken] = await erc20Wrapper.deployDummyTokensAsync(numDummyErc20ToDeploy, constants.DUMMY_TOKEN_DECIMALS);
+ erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+
+ erc721Proxy = await erc721Wrapper.deployProxyAsync();
+
+ assetProxyDispatcher = await TestAssetProxyDispatcherContract.deployFrom0xArtifactAsync(
+ artifacts.TestAssetProxyDispatcher,
+ provider,
+ txDefaults,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('registerAssetProxy', () => {
+ it('should record proxy upon registration', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
+ expect(proxyAddress).to.be.equal(erc20Proxy.address);
+ });
+
+ it('should be able to record multiple proxies', async () => {
+ // Record first proxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
+ expect(proxyAddress).to.be.equal(erc20Proxy.address);
+ // Record another proxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC721);
+ expect(proxyAddress).to.be.equal(erc721Proxy.address);
+ });
+
+ it('should throw if a proxy with the same id is already registered', async () => {
+ // Initial registration
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
+ expect(proxyAddress).to.be.equal(erc20Proxy.address);
+ // Deploy a new version of the ERC20 Transfer Proxy contract
+ const newErc20TransferProxy = await ERC20ProxyContract.deployFrom0xArtifactAsync(
+ artifacts.ERC20Proxy,
+ provider,
+ txDefaults,
+ );
+ // Register new ERC20 Transfer Proxy contract
+ return expectTransactionFailedAsync(
+ assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(newErc20TransferProxy.address, {
+ from: owner,
+ }),
+ RevertReason.AssetProxyAlreadyExists,
+ );
+ });
+
+ it('should throw if requesting address is not owner', async () => {
+ return expectTransactionFailedAsync(
+ assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: notOwner }),
+ RevertReason.OnlyContractOwner,
+ );
+ });
+
+ it('should log an event with correct arguments when an asset proxy is registered', async () => {
+ const logDecoder = new LogDecoder(web3Wrapper, artifacts);
+ const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
+ );
+ const logs = txReceipt.logs;
+ const log = logs[0] as LogWithDecodedArgs<TestAssetProxyDispatcherAssetProxyRegisteredEventArgs>;
+ expect(log.args.id).to.equal(AssetProxyId.ERC20);
+ expect(log.args.assetProxy).to.equal(erc20Proxy.address);
+ });
+ });
+
+ describe('getAssetProxy', () => {
+ it('should return correct address of registered proxy', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
+ expect(proxyAddress).to.be.equal(erc20Proxy.address);
+ });
+
+ it('should return NULL address if requesting non-existent proxy', async () => {
+ const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
+ expect(proxyAddress).to.be.equal(constants.NULL_ADDRESS);
+ });
+ });
+
+ describe('dispatchTransferFrom', () => {
+ it('should dispatch transfer to registered proxy', async () => {
+ // Register ERC20 proxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Construct metadata for ERC20 proxy
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+
+ // Perform a transfer from makerAddress to takerAddress
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const amount = new BigNumber(10);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
+ encodedAssetData,
+ makerAddress,
+ takerAddress,
+ amount,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Verify transfer was successful
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(amount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].add(amount),
+ );
+ });
+
+ it('should not dispatch a transfer if amount == 0', async () => {
+ // Register ERC20 proxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Construct metadata for ERC20 proxy
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+
+ // Perform a transfer from makerAddress to takerAddress
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const amount = constants.ZERO_AMOUNT;
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
+ encodedAssetData,
+ makerAddress,
+ takerAddress,
+ amount,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ expect(txReceipt.logs.length).to.be.equal(0);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.deep.equal(erc20Balances);
+ });
+
+ it('should not dispatch a transfer if from == to', async () => {
+ // Register ERC20 proxy
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Construct metadata for ERC20 proxy
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+
+ // Perform a transfer from makerAddress to takerAddress
+ const erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const amount = new BigNumber(10);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
+ await assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
+ encodedAssetData,
+ makerAddress,
+ makerAddress,
+ amount,
+ { from: owner },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ expect(txReceipt.logs.length).to.be.equal(0);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.deep.equal(erc20Balances);
+ });
+
+ it('should throw if dispatching to unregistered proxy', async () => {
+ // Construct metadata for ERC20 proxy
+ const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+ // Perform a transfer from makerAddress to takerAddress
+ const amount = new BigNumber(10);
+ return expectTransactionFailedAsync(
+ assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
+ encodedAssetData,
+ makerAddress,
+ takerAddress,
+ amount,
+ { from: owner },
+ ),
+ RevertReason.AssetProxyDoesNotExist,
+ );
+ });
+ });
+});
+// tslint:enable:no-unnecessary-type-assertion
diff --git a/contracts/protocol/test/exchange/fill_order.ts b/contracts/protocol/test/exchange/fill_order.ts
new file mode 100644
index 000000000..2bdbe4855
--- /dev/null
+++ b/contracts/protocol/test/exchange/fill_order.ts
@@ -0,0 +1,314 @@
+import {
+ AllowanceAmountScenario,
+ AssetDataScenario,
+ BalanceAmountScenario,
+ chaiSetup,
+ ExpirationTimeSecondsScenario,
+ FeeRecipientAddressScenario,
+ FillScenario,
+ OrderAssetAmountScenario,
+ provider,
+ TakerAssetFillAmountScenario,
+ TakerScenario,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import * as _ from 'lodash';
+
+import {
+ FillOrderCombinatorialUtils,
+ fillOrderCombinatorialUtilsFactoryAsync,
+} from '../utils/fill_order_combinatorial_utils';
+
+chaiSetup.configure();
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+const defaultFillScenario = {
+ orderScenario: {
+ takerScenario: TakerScenario.Unspecified,
+ feeRecipientScenario: FeeRecipientAddressScenario.EthUserAddress,
+ makerAssetAmountScenario: OrderAssetAmountScenario.Large,
+ takerAssetAmountScenario: OrderAssetAmountScenario.Large,
+ makerFeeScenario: OrderAssetAmountScenario.Large,
+ takerFeeScenario: OrderAssetAmountScenario.Large,
+ expirationTimeSecondsScenario: ExpirationTimeSecondsScenario.InFuture,
+ makerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals,
+ takerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals,
+ },
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount,
+ makerStateScenario: {
+ traderAssetBalance: BalanceAmountScenario.Higher,
+ traderAssetAllowance: AllowanceAmountScenario.Higher,
+ zrxFeeBalance: BalanceAmountScenario.Higher,
+ zrxFeeAllowance: AllowanceAmountScenario.Higher,
+ },
+ takerStateScenario: {
+ traderAssetBalance: BalanceAmountScenario.Higher,
+ traderAssetAllowance: AllowanceAmountScenario.Higher,
+ zrxFeeBalance: BalanceAmountScenario.Higher,
+ zrxFeeAllowance: AllowanceAmountScenario.Higher,
+ },
+};
+
+describe('FillOrder Tests', () => {
+ let fillOrderCombinatorialUtils: FillOrderCombinatorialUtils;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ fillOrderCombinatorialUtils = await fillOrderCombinatorialUtilsFactoryAsync(web3Wrapper, txDefaults);
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('fillOrder', () => {
+ const test = (fillScenarios: FillScenario[]) => {
+ _.forEach(fillScenarios, fillScenario => {
+ const description = `Combinatorial OrderFill: ${JSON.stringify(fillScenario)}`;
+ it(description, async () => {
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+ });
+ };
+
+ const allFillScenarios = FillOrderCombinatorialUtils.generateFillOrderCombinations();
+ describe('Combinatorially generated fills orders', () => test(allFillScenarios));
+
+ it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+ it('should transfer the correct amounts when makerAssetAmount > takerAssetAmount', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ takerAssetAmountScenario: OrderAssetAmountScenario.Small,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+ it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ makerAssetAmountScenario: OrderAssetAmountScenario.Small,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+ it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount with zero decimals', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ makerAssetAmountScenario: OrderAssetAmountScenario.Small,
+ makerAssetDataScenario: AssetDataScenario.ERC20ZeroDecimals,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+ it('should transfer the correct amounts when taker is specified and order is claimed by taker', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ takerScenario: TakerScenario.CorrectlySpecified,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+ it('should fill remaining value if takerAssetFillAmount > remaining takerAssetAmount', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount,
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+ it('should throw when taker is specified and order is claimed by other', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ takerScenario: TakerScenario.IncorrectlySpecified,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should throw if makerAssetAmount is 0', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ makerAssetAmountScenario: OrderAssetAmountScenario.Zero,
+ },
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount,
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should throw if takerAssetAmount is 0', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ takerAssetAmountScenario: OrderAssetAmountScenario.Zero,
+ },
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount,
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should throw if takerAssetFillAmount is 0', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario.Zero,
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should throw if an order is expired', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ expirationTimeSecondsScenario: ExpirationTimeSecondsScenario.InPast,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should throw if maker erc20Balances are too low to fill order', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ makerStateScenario: {
+ ...defaultFillScenario.makerStateScenario,
+ traderAssetBalance: BalanceAmountScenario.TooLow,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should throw if taker erc20Balances are too low to fill order', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ takerStateScenario: {
+ ...defaultFillScenario.makerStateScenario,
+ traderAssetBalance: BalanceAmountScenario.TooLow,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should throw if maker allowances are too low to fill order', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ makerStateScenario: {
+ ...defaultFillScenario.makerStateScenario,
+ traderAssetAllowance: AllowanceAmountScenario.TooLow,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should throw if taker allowances are too low to fill order', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ takerStateScenario: {
+ ...defaultFillScenario.makerStateScenario,
+ traderAssetAllowance: AllowanceAmountScenario.TooLow,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+ });
+
+ describe('Testing exchange of ERC721 Tokens', () => {
+ it('should successfully exchange a single token between the maker and taker (via fillOrder)', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ makerAssetDataScenario: AssetDataScenario.ERC721,
+ takerAssetDataScenario: AssetDataScenario.ERC721,
+ },
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should successfully fill order when makerAsset is ERC721 and takerAsset is ERC20', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ makerAssetDataScenario: AssetDataScenario.ERC721,
+ takerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals,
+ },
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario, true);
+ });
+
+ it('should successfully fill order when makerAsset is ERC20 and takerAsset is ERC721', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ makerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals,
+ takerAssetDataScenario: AssetDataScenario.ERC721,
+ },
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should successfully fill order when makerAsset is ERC721 and approveAll is set for it', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ makerAssetDataScenario: AssetDataScenario.ERC721,
+ takerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals,
+ },
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
+ makerStateScenario: {
+ ...defaultFillScenario.makerStateScenario,
+ traderAssetAllowance: AllowanceAmountScenario.Unlimited,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+
+ it('should successfully fill order when makerAsset and takerAsset are ERC721 and approveAll is set for them', async () => {
+ const fillScenario = {
+ ...defaultFillScenario,
+ orderScenario: {
+ ...defaultFillScenario.orderScenario,
+ makerAssetDataScenario: AssetDataScenario.ERC721,
+ takerAssetDataScenario: AssetDataScenario.ERC721,
+ },
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
+ makerStateScenario: {
+ ...defaultFillScenario.makerStateScenario,
+ traderAssetAllowance: AllowanceAmountScenario.Unlimited,
+ },
+ takerStateScenario: {
+ ...defaultFillScenario.takerStateScenario,
+ traderAssetAllowance: AllowanceAmountScenario.Unlimited,
+ },
+ };
+ await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
+ });
+ });
+});
diff --git a/contracts/protocol/test/exchange/internal.ts b/contracts/protocol/test/exchange/internal.ts
new file mode 100644
index 000000000..972f5efb6
--- /dev/null
+++ b/contracts/protocol/test/exchange/internal.ts
@@ -0,0 +1,472 @@
+import {
+ bytes32Values,
+ chaiSetup,
+ constants,
+ FillResults,
+ getRevertReasonOrErrorMessageForSendTransactionAsync,
+ provider,
+ testCombinatoriallyWithReferenceFuncAsync,
+ txDefaults,
+ uint256Values,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { Order, RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals';
+import { artifacts } from '../../src/artifacts';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
+
+const emptyOrder: Order = {
+ senderAddress: constants.NULL_ADDRESS,
+ makerAddress: constants.NULL_ADDRESS,
+ takerAddress: constants.NULL_ADDRESS,
+ makerFee: new BigNumber(0),
+ takerFee: new BigNumber(0),
+ makerAssetAmount: new BigNumber(0),
+ takerAssetAmount: new BigNumber(0),
+ makerAssetData: '0x',
+ takerAssetData: '0x',
+ salt: new BigNumber(0),
+ exchangeAddress: constants.NULL_ADDRESS,
+ feeRecipientAddress: constants.NULL_ADDRESS,
+ expirationTimeSeconds: new BigNumber(0),
+};
+
+const emptySignedOrder: SignedOrder = {
+ ...emptyOrder,
+ signature: '',
+};
+
+const overflowErrorForCall = new Error(RevertReason.Uint256Overflow);
+
+describe('Exchange core internal functions', () => {
+ let testExchange: TestExchangeInternalsContract;
+ let overflowErrorForSendTransaction: Error | undefined;
+ let divisionByZeroErrorForCall: Error | undefined;
+ let roundingErrorForCall: Error | undefined;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ testExchange = await TestExchangeInternalsContract.deployFrom0xArtifactAsync(
+ artifacts.TestExchangeInternals,
+ provider,
+ txDefaults,
+ );
+ overflowErrorForSendTransaction = new Error(
+ await getRevertReasonOrErrorMessageForSendTransactionAsync(RevertReason.Uint256Overflow),
+ );
+ divisionByZeroErrorForCall = new Error(RevertReason.DivisionByZero);
+ roundingErrorForCall = new Error(RevertReason.RoundingError);
+ });
+ // Note(albrow): Don't forget to add beforeEach and afterEach calls to reset
+ // the blockchain state for any tests which modify it!
+
+ async function referenceIsRoundingErrorFloorAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<boolean> {
+ if (denominator.eq(0)) {
+ throw divisionByZeroErrorForCall;
+ }
+ if (numerator.eq(0)) {
+ return false;
+ }
+ if (target.eq(0)) {
+ return false;
+ }
+ const product = numerator.mul(target);
+ const remainder = product.mod(denominator);
+ const remainderTimes1000 = remainder.mul('1000');
+ const isError = remainderTimes1000.gte(product);
+ if (product.greaterThan(MAX_UINT256)) {
+ throw overflowErrorForCall;
+ }
+ if (remainderTimes1000.greaterThan(MAX_UINT256)) {
+ throw overflowErrorForCall;
+ }
+ return isError;
+ }
+
+ async function referenceIsRoundingErrorCeilAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<boolean> {
+ if (denominator.eq(0)) {
+ throw divisionByZeroErrorForCall;
+ }
+ if (numerator.eq(0)) {
+ return false;
+ }
+ if (target.eq(0)) {
+ return false;
+ }
+ const product = numerator.mul(target);
+ const remainder = product.mod(denominator);
+ const error = denominator.sub(remainder).mod(denominator);
+ const errorTimes1000 = error.mul('1000');
+ const isError = errorTimes1000.gte(product);
+ if (product.greaterThan(MAX_UINT256)) {
+ throw overflowErrorForCall;
+ }
+ if (errorTimes1000.greaterThan(MAX_UINT256)) {
+ throw overflowErrorForCall;
+ }
+ return isError;
+ }
+
+ async function referenceSafeGetPartialAmountFloorAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<BigNumber> {
+ if (denominator.eq(0)) {
+ throw divisionByZeroErrorForCall;
+ }
+ const isRoundingError = await referenceIsRoundingErrorFloorAsync(numerator, denominator, target);
+ if (isRoundingError) {
+ throw roundingErrorForCall;
+ }
+ const product = numerator.mul(target);
+ if (product.greaterThan(MAX_UINT256)) {
+ throw overflowErrorForCall;
+ }
+ return product.dividedToIntegerBy(denominator);
+ }
+
+ describe('addFillResults', async () => {
+ function makeFillResults(value: BigNumber): FillResults {
+ return {
+ makerAssetFilledAmount: value,
+ takerAssetFilledAmount: value,
+ makerFeePaid: value,
+ takerFeePaid: value,
+ };
+ }
+ async function referenceAddFillResultsAsync(
+ totalValue: BigNumber,
+ singleValue: BigNumber,
+ ): Promise<FillResults> {
+ // Note(albrow): Here, each of totalFillResults and
+ // singleFillResults will consist of fields with the same values.
+ // This should be safe because none of the fields in a given
+ // FillResults are ever used together in a mathemetical operation.
+ // They are only used with the corresponding field from *the other*
+ // FillResults, which are different.
+ const totalFillResults = makeFillResults(totalValue);
+ const singleFillResults = makeFillResults(singleValue);
+ // HACK(albrow): _.mergeWith mutates the first argument! To
+ // workaround this we use _.cloneDeep.
+ return _.mergeWith(
+ _.cloneDeep(totalFillResults),
+ singleFillResults,
+ (totalVal: BigNumber, singleVal: BigNumber) => {
+ const newTotal = totalVal.add(singleVal);
+ if (newTotal.greaterThan(MAX_UINT256)) {
+ throw overflowErrorForCall;
+ }
+ return newTotal;
+ },
+ );
+ }
+ async function testAddFillResultsAsync(totalValue: BigNumber, singleValue: BigNumber): Promise<FillResults> {
+ const totalFillResults = makeFillResults(totalValue);
+ const singleFillResults = makeFillResults(singleValue);
+ return testExchange.publicAddFillResults.callAsync(totalFillResults, singleFillResults);
+ }
+ await testCombinatoriallyWithReferenceFuncAsync(
+ 'addFillResults',
+ referenceAddFillResultsAsync,
+ testAddFillResultsAsync,
+ [uint256Values, uint256Values],
+ );
+ });
+
+ describe('calculateFillResults', async () => {
+ function makeOrder(
+ makerAssetAmount: BigNumber,
+ takerAssetAmount: BigNumber,
+ makerFee: BigNumber,
+ takerFee: BigNumber,
+ ): Order {
+ return {
+ ...emptyOrder,
+ makerAssetAmount,
+ takerAssetAmount,
+ makerFee,
+ takerFee,
+ };
+ }
+ async function referenceCalculateFillResultsAsync(
+ orderTakerAssetAmount: BigNumber,
+ takerAssetFilledAmount: BigNumber,
+ otherAmount: BigNumber,
+ ): Promise<FillResults> {
+ // Note(albrow): Here we are re-using the same value (otherAmount)
+ // for order.makerAssetAmount, order.makerFee, and order.takerFee.
+ // This should be safe because they are never used with each other
+ // in any mathematical operation in either the reference TypeScript
+ // implementation or the Solidity implementation of
+ // calculateFillResults.
+ const makerAssetFilledAmount = await referenceSafeGetPartialAmountFloorAsync(
+ takerAssetFilledAmount,
+ orderTakerAssetAmount,
+ otherAmount,
+ );
+ const order = makeOrder(otherAmount, orderTakerAssetAmount, otherAmount, otherAmount);
+ const orderMakerAssetAmount = order.makerAssetAmount;
+ return {
+ makerAssetFilledAmount,
+ takerAssetFilledAmount,
+ makerFeePaid: await referenceSafeGetPartialAmountFloorAsync(
+ makerAssetFilledAmount,
+ orderMakerAssetAmount,
+ otherAmount,
+ ),
+ takerFeePaid: await referenceSafeGetPartialAmountFloorAsync(
+ takerAssetFilledAmount,
+ orderTakerAssetAmount,
+ otherAmount,
+ ),
+ };
+ }
+ async function testCalculateFillResultsAsync(
+ orderTakerAssetAmount: BigNumber,
+ takerAssetFilledAmount: BigNumber,
+ otherAmount: BigNumber,
+ ): Promise<FillResults> {
+ const order = makeOrder(otherAmount, orderTakerAssetAmount, otherAmount, otherAmount);
+ return testExchange.publicCalculateFillResults.callAsync(order, takerAssetFilledAmount);
+ }
+ await testCombinatoriallyWithReferenceFuncAsync(
+ 'calculateFillResults',
+ referenceCalculateFillResultsAsync,
+ testCalculateFillResultsAsync,
+ [uint256Values, uint256Values, uint256Values],
+ );
+ });
+
+ describe('getPartialAmountFloor', async () => {
+ async function referenceGetPartialAmountFloorAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<BigNumber> {
+ if (denominator.eq(0)) {
+ throw divisionByZeroErrorForCall;
+ }
+ const product = numerator.mul(target);
+ if (product.greaterThan(MAX_UINT256)) {
+ throw overflowErrorForCall;
+ }
+ return product.dividedToIntegerBy(denominator);
+ }
+ async function testGetPartialAmountFloorAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<BigNumber> {
+ return testExchange.publicGetPartialAmountFloor.callAsync(numerator, denominator, target);
+ }
+ await testCombinatoriallyWithReferenceFuncAsync(
+ 'getPartialAmountFloor',
+ referenceGetPartialAmountFloorAsync,
+ testGetPartialAmountFloorAsync,
+ [uint256Values, uint256Values, uint256Values],
+ );
+ });
+
+ describe('getPartialAmountCeil', async () => {
+ async function referenceGetPartialAmountCeilAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<BigNumber> {
+ if (denominator.eq(0)) {
+ throw divisionByZeroErrorForCall;
+ }
+ const product = numerator.mul(target);
+ const offset = product.add(denominator.sub(1));
+ if (offset.greaterThan(MAX_UINT256)) {
+ throw overflowErrorForCall;
+ }
+ const result = offset.dividedToIntegerBy(denominator);
+ if (product.mod(denominator).eq(0)) {
+ expect(result.mul(denominator)).to.be.bignumber.eq(product);
+ } else {
+ expect(result.mul(denominator)).to.be.bignumber.gt(product);
+ }
+ return result;
+ }
+ async function testGetPartialAmountCeilAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<BigNumber> {
+ return testExchange.publicGetPartialAmountCeil.callAsync(numerator, denominator, target);
+ }
+ await testCombinatoriallyWithReferenceFuncAsync(
+ 'getPartialAmountCeil',
+ referenceGetPartialAmountCeilAsync,
+ testGetPartialAmountCeilAsync,
+ [uint256Values, uint256Values, uint256Values],
+ );
+ });
+
+ describe('safeGetPartialAmountFloor', async () => {
+ async function testSafeGetPartialAmountFloorAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<BigNumber> {
+ return testExchange.publicSafeGetPartialAmountFloor.callAsync(numerator, denominator, target);
+ }
+ await testCombinatoriallyWithReferenceFuncAsync(
+ 'safeGetPartialAmountFloor',
+ referenceSafeGetPartialAmountFloorAsync,
+ testSafeGetPartialAmountFloorAsync,
+ [uint256Values, uint256Values, uint256Values],
+ );
+ });
+
+ describe('safeGetPartialAmountCeil', async () => {
+ async function referenceSafeGetPartialAmountCeilAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<BigNumber> {
+ if (denominator.eq(0)) {
+ throw divisionByZeroErrorForCall;
+ }
+ const isRoundingError = await referenceIsRoundingErrorCeilAsync(numerator, denominator, target);
+ if (isRoundingError) {
+ throw roundingErrorForCall;
+ }
+ const product = numerator.mul(target);
+ const offset = product.add(denominator.sub(1));
+ if (offset.greaterThan(MAX_UINT256)) {
+ throw overflowErrorForCall;
+ }
+ const result = offset.dividedToIntegerBy(denominator);
+ if (product.mod(denominator).eq(0)) {
+ expect(result.mul(denominator)).to.be.bignumber.eq(product);
+ } else {
+ expect(result.mul(denominator)).to.be.bignumber.gt(product);
+ }
+ return result;
+ }
+ async function testSafeGetPartialAmountCeilAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<BigNumber> {
+ return testExchange.publicSafeGetPartialAmountCeil.callAsync(numerator, denominator, target);
+ }
+ await testCombinatoriallyWithReferenceFuncAsync(
+ 'safeGetPartialAmountCeil',
+ referenceSafeGetPartialAmountCeilAsync,
+ testSafeGetPartialAmountCeilAsync,
+ [uint256Values, uint256Values, uint256Values],
+ );
+ });
+
+ describe('isRoundingErrorFloor', async () => {
+ async function testIsRoundingErrorFloorAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<boolean> {
+ return testExchange.publicIsRoundingErrorFloor.callAsync(numerator, denominator, target);
+ }
+ await testCombinatoriallyWithReferenceFuncAsync(
+ 'isRoundingErrorFloor',
+ referenceIsRoundingErrorFloorAsync,
+ testIsRoundingErrorFloorAsync,
+ [uint256Values, uint256Values, uint256Values],
+ );
+ });
+
+ describe('isRoundingErrorCeil', async () => {
+ async function testIsRoundingErrorCeilAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ ): Promise<boolean> {
+ return testExchange.publicIsRoundingErrorCeil.callAsync(numerator, denominator, target);
+ }
+ await testCombinatoriallyWithReferenceFuncAsync(
+ 'isRoundingErrorCeil',
+ referenceIsRoundingErrorCeilAsync,
+ testIsRoundingErrorCeilAsync,
+ [uint256Values, uint256Values, uint256Values],
+ );
+ });
+
+ describe('updateFilledState', async () => {
+ // Note(albrow): Since updateFilledState modifies the state by calling
+ // sendTransaction, we must reset the state after each test.
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ async function referenceUpdateFilledStateAsync(
+ takerAssetFilledAmount: BigNumber,
+ orderTakerAssetFilledAmount: BigNumber,
+ // tslint:disable-next-line:no-unused-variable
+ orderHash: string,
+ ): Promise<BigNumber> {
+ const totalFilledAmount = takerAssetFilledAmount.add(orderTakerAssetFilledAmount);
+ if (totalFilledAmount.greaterThan(MAX_UINT256)) {
+ throw overflowErrorForSendTransaction;
+ }
+ return totalFilledAmount;
+ }
+ async function testUpdateFilledStateAsync(
+ takerAssetFilledAmount: BigNumber,
+ orderTakerAssetFilledAmount: BigNumber,
+ orderHash: string,
+ ): Promise<BigNumber> {
+ const fillResults = {
+ makerAssetFilledAmount: new BigNumber(0),
+ takerAssetFilledAmount,
+ makerFeePaid: new BigNumber(0),
+ takerFeePaid: new BigNumber(0),
+ };
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await testExchange.publicUpdateFilledState.sendTransactionAsync(
+ emptySignedOrder,
+ constants.NULL_ADDRESS,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults,
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ return testExchange.filled.callAsync(orderHash);
+ }
+ await testCombinatoriallyWithReferenceFuncAsync(
+ 'updateFilledState',
+ referenceUpdateFilledStateAsync,
+ testUpdateFilledStateAsync,
+ [uint256Values, uint256Values, bytes32Values],
+ );
+ });
+});
diff --git a/contracts/protocol/test/exchange/match_orders.ts b/contracts/protocol/test/exchange/match_orders.ts
new file mode 100644
index 000000000..8e943c237
--- /dev/null
+++ b/contracts/protocol/test/exchange/match_orders.ts
@@ -0,0 +1,1284 @@
+import {
+ chaiSetup,
+ constants,
+ ERC20BalancesByOwner,
+ ERC721TokenIdsByOwner,
+ expectTransactionFailedAsync,
+ OrderFactory,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ DummyERC721TokenContract,
+ ReentrantERC20TokenContract,
+} from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { ExchangeContract } from '../../generated-wrappers/exchange';
+import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals';
+import { artifacts } from '../../src/artifacts';
+import { ERC20Wrapper } from '../utils/erc20_wrapper';
+import { ERC721Wrapper } from '../utils/erc721_wrapper';
+import { ExchangeWrapper } from '../utils/exchange_wrapper';
+import { MatchOrderTester } from '../utils/match_order_tester';
+
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+chaiSetup.configure();
+const expect = chai.expect;
+
+describe('matchOrders', () => {
+ let makerAddressLeft: string;
+ let makerAddressRight: string;
+ let owner: string;
+ let takerAddress: string;
+ let feeRecipientAddressLeft: string;
+ let feeRecipientAddressRight: string;
+
+ let erc20TokenA: DummyERC20TokenContract;
+ let erc20TokenB: DummyERC20TokenContract;
+ let zrxToken: DummyERC20TokenContract;
+ let erc721Token: DummyERC721TokenContract;
+ let reentrantErc20Token: ReentrantERC20TokenContract;
+ let exchange: ExchangeContract;
+ let erc20Proxy: ERC20ProxyContract;
+ let erc721Proxy: ERC721ProxyContract;
+
+ let erc20BalancesByOwner: ERC20BalancesByOwner;
+ let erc721TokenIdsByOwner: ERC721TokenIdsByOwner;
+ let exchangeWrapper: ExchangeWrapper;
+ let erc20Wrapper: ERC20Wrapper;
+ let erc721Wrapper: ERC721Wrapper;
+ let orderFactoryLeft: OrderFactory;
+ let orderFactoryRight: OrderFactory;
+
+ let erc721LeftMakerAssetIds: BigNumber[];
+ let erc721RightMakerAssetIds: BigNumber[];
+
+ let defaultERC20MakerAssetAddress: string;
+ let defaultERC20TakerAssetAddress: string;
+ let defaultERC721AssetAddress: string;
+
+ let matchOrderTester: MatchOrderTester;
+
+ let testExchange: TestExchangeInternalsContract;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ // Create accounts
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ // Hack(albrow): Both Prettier and TSLint insert a trailing comma below
+ // but that is invalid syntax as of TypeScript version >= 2.8. We don't
+ // have the right fine-grained configuration options in TSLint,
+ // Prettier, or TypeScript, to reconcile this, so we will just have to
+ // wait for them to sort it out. We disable TSLint and Prettier for
+ // this part of the code for now. This occurs several times in this
+ // file. See https://github.com/prettier/prettier/issues/4624.
+ // prettier-ignore
+ const usedAddresses = ([
+ owner,
+ makerAddressLeft,
+ makerAddressRight,
+ takerAddress,
+ feeRecipientAddressLeft,
+ // tslint:disable-next-line:trailing-comma
+ feeRecipientAddressRight
+ ] = _.slice(accounts, 0, 6));
+ // Create wrappers
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
+ // Deploy ERC20 token & ERC20 proxy
+ const numDummyErc20ToDeploy = 3;
+ [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
+ numDummyErc20ToDeploy,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
+ erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+ // Deploy ERC721 token and proxy
+ [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
+ erc721Proxy = await erc721Wrapper.deployProxyAsync();
+ await erc721Wrapper.setBalancesAndAllowancesAsync();
+ const erc721Balances = await erc721Wrapper.getBalancesAsync();
+ erc721LeftMakerAssetIds = erc721Balances[makerAddressLeft][erc721Token.address];
+ erc721RightMakerAssetIds = erc721Balances[makerAddressRight][erc721Token.address];
+ // Depoy exchange
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
+ assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ );
+ exchangeWrapper = new ExchangeWrapper(exchange, provider);
+ await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
+ await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
+ // Authorize ERC20 and ERC721 trades by exchange
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
+ tokensArtifacts.ReentrantERC20Token,
+ provider,
+ txDefaults,
+ exchange.address,
+ );
+
+ // Set default addresses
+ defaultERC20MakerAssetAddress = erc20TokenA.address;
+ defaultERC20TakerAssetAddress = erc20TokenB.address;
+ defaultERC721AssetAddress = erc721Token.address;
+ // Create default order parameters
+ const defaultOrderParamsLeft = {
+ ...constants.STATIC_ORDER_PARAMS,
+ makerAddress: makerAddressLeft,
+ exchangeAddress: exchange.address,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ feeRecipientAddress: feeRecipientAddressLeft,
+ };
+ const defaultOrderParamsRight = {
+ ...constants.STATIC_ORDER_PARAMS,
+ makerAddress: makerAddressRight,
+ exchangeAddress: exchange.address,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ feeRecipientAddress: feeRecipientAddressRight,
+ };
+ const privateKeyLeft = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressLeft)];
+ orderFactoryLeft = new OrderFactory(privateKeyLeft, defaultOrderParamsLeft);
+ const privateKeyRight = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressRight)];
+ orderFactoryRight = new OrderFactory(privateKeyRight, defaultOrderParamsRight);
+ // Set match order tester
+ matchOrderTester = new MatchOrderTester(exchangeWrapper, erc20Wrapper, erc721Wrapper, zrxToken.address);
+ testExchange = await TestExchangeInternalsContract.deployFrom0xArtifactAsync(
+ artifacts.TestExchangeInternals,
+ provider,
+ txDefaults,
+ );
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('matchOrders', () => {
+ beforeEach(async () => {
+ erc20BalancesByOwner = await erc20Wrapper.getBalancesAsync();
+ erc721TokenIdsByOwner = await erc721Wrapper.getBalancesAsync();
+ });
+
+ it('Should transfer correct amounts when right order is fully filled and values pass isRoundingErrorFloor but fail isRoundingErrorCeil', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAddress: makerAddressLeft,
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(17), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(98), 0),
+ feeRecipientAddress: feeRecipientAddressLeft,
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAddress: makerAddressRight,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(75), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
+ feeRecipientAddress: feeRecipientAddressRight,
+ });
+ // Assert is rounding error ceil & not rounding error floor
+ // These assertions are taken from MixinMatchOrders::calculateMatchedFillResults
+ // The rounding error is derived computating how much the left maker will sell.
+ const numerator = signedOrderLeft.makerAssetAmount;
+ const denominator = signedOrderLeft.takerAssetAmount;
+ const target = signedOrderRight.makerAssetAmount;
+ const isRoundingErrorCeil = await testExchange.publicIsRoundingErrorCeil.callAsync(
+ numerator,
+ denominator,
+ target,
+ );
+ expect(isRoundingErrorCeil).to.be.true();
+ const isRoundingErrorFloor = await testExchange.publicIsRoundingErrorFloor.callAsync(
+ numerator,
+ denominator,
+ target,
+ );
+ expect(isRoundingErrorFloor).to.be.false();
+ // Match signedOrderLeft with signedOrderRight
+ // Note that the left maker received a slightly better sell price.
+ // This is intentional; see note in MixinMatchOrders.calculateMatchedFillResults.
+ // Because the left maker received a slightly more favorable sell price, the fee
+ // paid by the left taker is slightly higher than that paid by the left maker.
+ // Fees can be thought of as a tax paid by the seller, derived from the sale price.
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(75), 0),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('76.4705882352941176'), 16), // 76.47%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(75), 0),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 0),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber('76.5306122448979591'), 16), // 76.53%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('Should transfer correct amounts when left order is fully filled and values pass isRoundingErrorCeil but fail isRoundingErrorFloor', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAddress: makerAddressLeft,
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(15), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 0),
+ feeRecipientAddress: feeRecipientAddressLeft,
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAddress: makerAddressRight,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(97), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(14), 0),
+ feeRecipientAddress: feeRecipientAddressRight,
+ });
+ // Assert is rounding error floor & not rounding error ceil
+ // These assertions are taken from MixinMatchOrders::calculateMatchedFillResults
+ // The rounding error is derived computating how much the right maker will buy.
+ const numerator = signedOrderRight.takerAssetAmount;
+ const denominator = signedOrderRight.makerAssetAmount;
+ const target = signedOrderLeft.takerAssetAmount;
+ const isRoundingErrorFloor = await testExchange.publicIsRoundingErrorFloor.callAsync(
+ numerator,
+ denominator,
+ target,
+ );
+ expect(isRoundingErrorFloor).to.be.true();
+ const isRoundingErrorCeil = await testExchange.publicIsRoundingErrorCeil.callAsync(
+ numerator,
+ denominator,
+ target,
+ );
+ expect(isRoundingErrorCeil).to.be.false();
+ // Match signedOrderLeft with signedOrderRight
+ // Note that the right maker received a slightly better purchase price.
+ // This is intentional; see note in MixinMatchOrders.calculateMatchedFillResults.
+ // Because the right maker received a slightly more favorable buy price, the fee
+ // paid by the right taker is slightly higher than that paid by the right maker.
+ // Fees can be thought of as a tax paid by the seller, derived from the sale price.
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(15), 0),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 0),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 0),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('92.7835051546391752'), 16), // 92.78%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 0),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber('92.8571428571428571'), 16), // 92.85%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('Should give right maker a better buy price when rounding', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAddress: makerAddressLeft,
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(16), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
+ feeRecipientAddress: feeRecipientAddressLeft,
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAddress: makerAddressRight,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(83), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(49), 0),
+ feeRecipientAddress: feeRecipientAddressRight,
+ });
+ // Note:
+ // The correct price buy price for the right maker would yield (49/83) * 22 = 12.988 units
+ // of the left maker asset. This gets rounded up to 13, giving the right maker a better price.
+ // Note:
+ // The maker/taker fee percentage paid on the right order differs because
+ // they received different sale prices. The right maker pays a
+ // fee slightly lower than the right taker.
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(16), 0),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('26.5060240963855421'), 16), // 26.506%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 0),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber('26.5306122448979591'), 16), // 26.531%
+ };
+ // Match signedOrderLeft with signedOrderRight
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('Should give left maker a better sell price when rounding', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAddress: makerAddressLeft,
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(12), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(97), 0),
+ feeRecipientAddress: feeRecipientAddressLeft,
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAddress: makerAddressRight,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
+ feeRecipientAddress: feeRecipientAddressRight,
+ });
+ // Note:
+ // The maker/taker fee percentage paid on the left order differs because
+ // they received different sale prices. The left maker pays a fee
+ // slightly lower than the left taker.
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(11), 0),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('91.6666666666666666'), 16), // 91.6%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 0),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber('91.7525773195876288'), 16), // 91.75%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ // Match signedOrderLeft with signedOrderRight
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('Should give right maker and right taker a favorable fee price when rounding', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAddress: makerAddressLeft,
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(16), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
+ feeRecipientAddress: feeRecipientAddressLeft,
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAddress: makerAddressRight,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(83), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(49), 0),
+ feeRecipientAddress: feeRecipientAddressRight,
+ makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 0),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 0),
+ });
+ // Note:
+ // The maker/taker fee percentage paid on the right order differs because
+ // they received different sale prices. The right maker pays a
+ // fee slightly lower than the right taker.
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(16), 0),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2650), 0), // 2650.6 rounded down tro 2650
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 0),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(2653), 0), // 2653.1 rounded down to 2653
+ };
+ // Match signedOrderLeft with signedOrderRight
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('Should give left maker and left taker a favorable fee price when rounding', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAddress: makerAddressLeft,
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(12), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(97), 0),
+ feeRecipientAddress: feeRecipientAddressLeft,
+ makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 0),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 0),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAddress: makerAddressRight,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
+ feeRecipientAddress: feeRecipientAddressRight,
+ });
+ // Note:
+ // The maker/taker fee percentage paid on the left order differs because
+ // they received different sale prices. The left maker pays a
+ // fee slightly lower than the left taker.
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(11), 0),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(9166), 0), // 9166.6 rounded down to 9166
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 0),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(9175), 0), // 9175.2 rounded down to 9175
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ // Match signedOrderLeft with signedOrderRight
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('Should transfer correct amounts when right order fill amount deviates from amount derived by `Exchange.fillOrder`', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAddress: makerAddressLeft,
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1005), 0),
+ feeRecipientAddress: feeRecipientAddressLeft,
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAddress: makerAddressRight,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2126), 0),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1063), 0),
+ feeRecipientAddress: feeRecipientAddressRight,
+ });
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 0),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1005), 0),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ // Notes:
+ // i.
+ // The left order is fully filled by the right order, so the right maker must sell 1005 units of their asset to the left maker.
+ // By selling 1005 units, the right maker should theoretically receive 502.5 units of the left maker's asset.
+ // Since the transfer amount must be an integer, this value must be rounded down to 502 or up to 503.
+ // ii.
+ // If the right order were filled via `Exchange.fillOrder` the respective fill amounts would be [1004, 502] or [1006, 503].
+ // It follows that we cannot trigger a sale of 1005 units of the right maker's asset through `Exchange.fillOrder`.
+ // iii.
+ // For an optimal match, the algorithm must choose either [1005, 502] or [1005, 503] as fill amounts for the right order.
+ // The algorithm favors the right maker when the exchange rate must be rounded, so the final fill for the right order is [1005, 503].
+ // iv.
+ // The right maker fee differs from the right taker fee because their exchange rate differs.
+ // The right maker always receives the better exchange and fee price.
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1005), 0),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(503), 0),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('47.2718720602069614'), 16), // 47.27%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(497), 0),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber('47.3189087488240827'), 16), // 47.31%
+ };
+ // Match signedOrderLeft with signedOrderRight
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow matchOrders to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAddress: makerAddressRight,
+ takerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feeRecipientAddress: feeRecipientAddressRight,
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await expectTransactionFailedAsync(
+ exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
+ RevertReason.TransferFailed,
+ );
+ });
+ });
+ };
+ describe('matchOrders reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should transfer the correct amounts when orders completely fill each other', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match signedOrderLeft with signedOrderRight
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('should transfer the correct amounts when orders completely fill each other and taker doesnt take a profit', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ });
+ // Match signedOrderLeft with signedOrderRight
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ // Match signedOrderLeft with signedOrderRight
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('should transfer the correct amounts when left order is completely filled and right order is partially filled', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
+ });
+ // Match signedOrderLeft with signedOrderRight
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 16), // 50%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 16), // 50%
+ };
+ // Match signedOrderLeft with signedOrderRight
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('should transfer the correct amounts when right order is completely filled and left order is partially filled', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match signedOrderLeft with signedOrderRight
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 16), // 10%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 16), // 10%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ // Match signedOrderLeft with signedOrderRight
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('should transfer the correct amounts when consecutive calls are used to completely fill the left order', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match orders
+ let newERC20BalancesByOwner: ERC20BalancesByOwner;
+ let newERC721TokenIdsByOwner: ERC721TokenIdsByOwner;
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 16), // 10%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 16), // 10%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ // prettier-ignore
+ [
+ newERC20BalancesByOwner,
+ // tslint:disable-next-line:trailing-comma
+ newERC721TokenIdsByOwner
+ ] = await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ // Construct second right order
+ // Note: This order needs makerAssetAmount=90/takerAssetAmount=[anything <= 45] to fully fill the right order.
+ // However, we use 100/50 to ensure a partial fill as we want to go down the "left fill"
+ // branch in the contract twice for this test.
+ const signedOrderRight2 = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
+ });
+ // Match signedOrderLeft with signedOrderRight2
+ const leftTakerAssetFilledAmount = signedOrderRight.makerAssetAmount;
+ const rightTakerAssetFilledAmount = new BigNumber(0);
+ const expectedTransferAmounts2 = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(45), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 16), // 90% (10% paid earlier)
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(45), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 16), // 90%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 16), // 90% (10% paid earlier)
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 16), // 90%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight2,
+ takerAddress,
+ newERC20BalancesByOwner,
+ newERC721TokenIdsByOwner,
+ expectedTransferAmounts2,
+ leftTakerAssetFilledAmount,
+ rightTakerAssetFilledAmount,
+ );
+ });
+
+ it('should transfer the correct amounts when consecutive calls are used to completely fill the right order', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ });
+ // Match orders
+ let newERC20BalancesByOwner: ERC20BalancesByOwner;
+ let newERC721TokenIdsByOwner: ERC721TokenIdsByOwner;
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 16), // 4%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(6), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 16), // 4%
+ };
+ // prettier-ignore
+ [
+ newERC20BalancesByOwner,
+ // tslint:disable-next-line:trailing-comma
+ newERC721TokenIdsByOwner
+ ] = await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+
+ // Create second left order
+ // Note: This order needs makerAssetAmount=96/takerAssetAmount=48 to fully fill the right order.
+ // However, we use 100/50 to ensure a partial fill as we want to go down the "right fill"
+ // branch in the contract twice for this test.
+ const signedOrderLeft2 = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
+ });
+ // Match signedOrderLeft2 with signedOrderRight
+ const leftTakerAssetFilledAmount = new BigNumber(0);
+ const takerAmountReceived = newERC20BalancesByOwner[takerAddress][defaultERC20MakerAssetAddress].minus(
+ erc20BalancesByOwner[takerAddress][defaultERC20MakerAssetAddress],
+ );
+ const rightTakerAssetFilledAmount = signedOrderLeft.makerAssetAmount.minus(takerAmountReceived);
+ const expectedTransferAmounts2 = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(48), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 16), // 96%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(48), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 16), // 96%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 16), // 96%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 16), // 96%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft2,
+ signedOrderRight,
+ takerAddress,
+ newERC20BalancesByOwner,
+ newERC721TokenIdsByOwner,
+ expectedTransferAmounts2,
+ leftTakerAssetFilledAmount,
+ rightTakerAssetFilledAmount,
+ );
+ });
+
+ it('should transfer the correct amounts if fee recipient is the same across both matched orders', async () => {
+ const feeRecipientAddress = feeRecipientAddressLeft;
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feeRecipientAddress,
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feeRecipientAddress,
+ });
+ // Match orders
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('should transfer the correct amounts if taker is also the left order maker', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match orders
+ takerAddress = signedOrderLeft.makerAddress;
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('should transfer the correct amounts if taker is also the right order maker', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match orders
+ takerAddress = signedOrderRight.makerAddress;
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('should transfer the correct amounts if taker is also the left fee recipient', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match orders
+ takerAddress = feeRecipientAddressLeft;
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('should transfer the correct amounts if taker is also the right fee recipient', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match orders
+ takerAddress = feeRecipientAddressRight;
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('should transfer the correct amounts if left maker is the left fee recipient and right maker is the right fee recipient', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match orders
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('Should throw if left order is not fillable', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Cancel left order
+ await exchangeWrapper.cancelOrderAsync(signedOrderLeft, signedOrderLeft.makerAddress);
+ // Match orders
+ return expectTransactionFailedAsync(
+ exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
+ RevertReason.OrderUnfillable,
+ );
+ });
+
+ it('Should throw if right order is not fillable', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Cancel right order
+ await exchangeWrapper.cancelOrderAsync(signedOrderRight, signedOrderRight.makerAddress);
+ // Match orders
+ return expectTransactionFailedAsync(
+ exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
+ RevertReason.OrderUnfillable,
+ );
+ });
+
+ it('should throw if there is not a positive spread', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
+ });
+ // Match orders
+ return expectTransactionFailedAsync(
+ exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
+ RevertReason.NegativeSpreadRequired,
+ );
+ });
+
+ it('should throw if the left maker asset is not equal to the right taker asset ', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match orders
+ return expectTransactionFailedAsync(
+ exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
+ // We are assuming assetData fields of the right order are the
+ // reverse of the left order, rather than checking equality. This
+ // saves a bunch of gas, but as a result if the assetData fields are
+ // off then the failure ends up happening at signature validation
+ RevertReason.InvalidOrderSignature,
+ );
+ });
+
+ it('should throw if the right maker asset is not equal to the left taker asset', async () => {
+ // Create orders to match
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ });
+ // Match orders
+ return expectTransactionFailedAsync(
+ exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
+ RevertReason.InvalidOrderSignature,
+ );
+ });
+
+ it('should transfer correct amounts when left order maker asset is an ERC721 token', async () => {
+ // Create orders to match
+ const erc721TokenToTransfer = erc721LeftMakerAssetIds[0];
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ takerAssetData: assetDataUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: new BigNumber(1),
+ });
+ // Match orders
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 50%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+
+ it('should transfer correct amounts when right order maker asset is an ERC721 token', async () => {
+ // Create orders to match
+ const erc721TokenToTransfer = erc721RightMakerAssetIds[0];
+ const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
+ takerAssetData: assetDataUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ takerAssetAmount: new BigNumber(1),
+ });
+ const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(8), 18),
+ });
+ // Match orders
+ const expectedTransferAmounts = {
+ // Left Maker
+ amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
+ amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
+ feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Right Maker
+ amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
+ amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(8), 18),
+ feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ // Taker
+ amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
+ feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
+ };
+ await matchOrderTester.matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ });
+ });
+}); // tslint:disable-line:max-file-line-count
diff --git a/contracts/protocol/test/exchange/signature_validator.ts b/contracts/protocol/test/exchange/signature_validator.ts
new file mode 100644
index 000000000..3f1786b5b
--- /dev/null
+++ b/contracts/protocol/test/exchange/signature_validator.ts
@@ -0,0 +1,526 @@
+import { artifacts as examplesArtifacts, ValidatorContract, WalletContract } from '@0x/contracts-examples';
+import {
+ addressUtils,
+ chaiSetup,
+ constants,
+ expectContractCallFailedAsync,
+ LogDecoder,
+ OrderFactory,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, orderHashUtils, signatureUtils } from '@0x/order-utils';
+import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import ethUtil = require('ethereumjs-util');
+
+import {
+ artifacts,
+ TestSignatureValidatorContract,
+ TestSignatureValidatorSignatureValidatorApprovalEventArgs,
+ TestStaticCallReceiverContract,
+} from '../../src';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+// tslint:disable:no-unnecessary-type-assertion
+describe('MixinSignatureValidator', () => {
+ let signedOrder: SignedOrder;
+ let orderFactory: OrderFactory;
+ let signatureValidator: TestSignatureValidatorContract;
+ let testWallet: WalletContract;
+ let testValidator: ValidatorContract;
+ let maliciousWallet: TestStaticCallReceiverContract;
+ let maliciousValidator: TestStaticCallReceiverContract;
+ let signerAddress: string;
+ let signerPrivateKey: Buffer;
+ let notSignerAddress: string;
+ let notSignerPrivateKey: Buffer;
+ let signatureValidatorLogDecoder: LogDecoder;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const makerAddress = accounts[0];
+ signerAddress = makerAddress;
+ notSignerAddress = accounts[1];
+ signatureValidator = await TestSignatureValidatorContract.deployFrom0xArtifactAsync(
+ artifacts.TestSignatureValidator,
+ provider,
+ txDefaults,
+ );
+ testWallet = await WalletContract.deployFrom0xArtifactAsync(
+ examplesArtifacts.Wallet,
+ provider,
+ txDefaults,
+ signerAddress,
+ );
+ testValidator = await ValidatorContract.deployFrom0xArtifactAsync(
+ examplesArtifacts.Validator,
+ provider,
+ txDefaults,
+ signerAddress,
+ );
+ maliciousWallet = maliciousValidator = await TestStaticCallReceiverContract.deployFrom0xArtifactAsync(
+ artifacts.TestStaticCallReceiver,
+ provider,
+ txDefaults,
+ );
+ signatureValidatorLogDecoder = new LogDecoder(web3Wrapper, { ...artifacts, ...tokensArtifacts });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(testValidator.address, true, {
+ from: signerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(
+ maliciousValidator.address,
+ true,
+ {
+ from: signerAddress,
+ },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const defaultOrderParams = {
+ ...constants.STATIC_ORDER_PARAMS,
+ exchangeAddress: signatureValidator.address,
+ makerAddress,
+ feeRecipientAddress: addressUtils.generatePseudoRandomAddress(),
+ makerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
+ };
+ signerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
+ notSignerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(notSignerAddress)];
+ orderFactory = new OrderFactory(signerPrivateKey, defaultOrderParams);
+ });
+
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('isValidSignature', () => {
+ beforeEach(async () => {
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ });
+
+ it('should revert when signature is empty', async () => {
+ const emptySignature = '0x';
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ return expectContractCallFailedAsync(
+ signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signedOrder.makerAddress,
+ emptySignature,
+ ),
+ RevertReason.LengthGreaterThan0Required,
+ );
+ });
+
+ it('should revert when signature type is unsupported', async () => {
+ const unsupportedSignatureType = SignatureType.NSignatureTypes;
+ const unsupportedSignatureHex = `0x${Buffer.from([unsupportedSignatureType]).toString('hex')}`;
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ return expectContractCallFailedAsync(
+ signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signedOrder.makerAddress,
+ unsupportedSignatureHex,
+ ),
+ RevertReason.SignatureUnsupported,
+ );
+ });
+
+ it('should revert when SignatureType=Illegal', async () => {
+ const unsupportedSignatureHex = `0x${Buffer.from([SignatureType.Illegal]).toString('hex')}`;
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ return expectContractCallFailedAsync(
+ signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signedOrder.makerAddress,
+ unsupportedSignatureHex,
+ ),
+ RevertReason.SignatureIllegal,
+ );
+ });
+
+ it('should return false when SignatureType=Invalid and signature has a length of zero', async () => {
+ const signatureHex = `0x${Buffer.from([SignatureType.Invalid]).toString('hex')}`;
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signedOrder.makerAddress,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.false();
+ });
+
+ it('should revert when SignatureType=Invalid and signature length is non-zero', async () => {
+ const fillerData = ethUtil.toBuffer('0xdeadbeef');
+ const signatureType = ethUtil.toBuffer(`0x${SignatureType.Invalid}`);
+ const signatureBuffer = Buffer.concat([fillerData, signatureType]);
+ const signatureHex = ethUtil.bufferToHex(signatureBuffer);
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ return expectContractCallFailedAsync(
+ signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signedOrder.makerAddress,
+ signatureHex,
+ ),
+ RevertReason.Length0Required,
+ );
+ });
+
+ it('should return true when SignatureType=EIP712 and signature is valid', async () => {
+ // Create EIP712 signature
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
+ const ecSignature = ethUtil.ecsign(orderHashBuffer, signerPrivateKey);
+ // Create 0x signature from EIP712 signature
+ const signature = Buffer.concat([
+ ethUtil.toBuffer(ecSignature.v),
+ ecSignature.r,
+ ecSignature.s,
+ ethUtil.toBuffer(`0x${SignatureType.EIP712}`),
+ ]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ // Validate signature
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signerAddress,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.true();
+ });
+
+ it('should return false when SignatureType=EIP712 and signature is invalid', async () => {
+ // Create EIP712 signature
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
+ const ecSignature = ethUtil.ecsign(orderHashBuffer, signerPrivateKey);
+ // Create 0x signature from EIP712 signature
+ const signature = Buffer.concat([
+ ethUtil.toBuffer(ecSignature.v),
+ ecSignature.r,
+ ecSignature.s,
+ ethUtil.toBuffer(`0x${SignatureType.EIP712}`),
+ ]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ // Validate signature.
+ // This will fail because `signerAddress` signed the message, but we're passing in `notSignerAddress`
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ notSignerAddress,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.false();
+ });
+
+ it('should return true when SignatureType=EthSign and signature is valid', async () => {
+ // Create EthSign signature
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const orderHashWithEthSignPrefixHex = signatureUtils.addSignedMessagePrefix(orderHashHex);
+ const orderHashWithEthSignPrefixBuffer = ethUtil.toBuffer(orderHashWithEthSignPrefixHex);
+ const ecSignature = ethUtil.ecsign(orderHashWithEthSignPrefixBuffer, signerPrivateKey);
+ // Create 0x signature from EthSign signature
+ const signature = Buffer.concat([
+ ethUtil.toBuffer(ecSignature.v),
+ ecSignature.r,
+ ecSignature.s,
+ ethUtil.toBuffer(`0x${SignatureType.EthSign}`),
+ ]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ // Validate signature
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signerAddress,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.true();
+ });
+
+ it('should return false when SignatureType=EthSign and signature is invalid', async () => {
+ // Create EthSign signature
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const orderHashWithEthSignPrefixHex = signatureUtils.addSignedMessagePrefix(orderHashHex);
+ const orderHashWithEthSignPrefixBuffer = ethUtil.toBuffer(orderHashWithEthSignPrefixHex);
+ const ecSignature = ethUtil.ecsign(orderHashWithEthSignPrefixBuffer, signerPrivateKey);
+ // Create 0x signature from EthSign signature
+ const signature = Buffer.concat([
+ ethUtil.toBuffer(ecSignature.v),
+ ecSignature.r,
+ ecSignature.s,
+ ethUtil.toBuffer(`0x${SignatureType.EthSign}`),
+ ]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ // Validate signature.
+ // This will fail because `signerAddress` signed the message, but we're passing in `notSignerAddress`
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ notSignerAddress,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.false();
+ });
+
+ it('should return true when SignatureType=Wallet and signature is valid', async () => {
+ // Create EIP712 signature
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
+ const ecSignature = ethUtil.ecsign(orderHashBuffer, signerPrivateKey);
+ // Create 0x signature from EIP712 signature
+ const signature = Buffer.concat([
+ ethUtil.toBuffer(ecSignature.v),
+ ecSignature.r,
+ ecSignature.s,
+ ethUtil.toBuffer(`0x${SignatureType.Wallet}`),
+ ]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ // Validate signature
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ testWallet.address,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.true();
+ });
+
+ it('should return false when SignatureType=Wallet and signature is invalid', async () => {
+ // Create EIP712 signature using a private key that does not belong to the wallet owner.
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
+ const notWalletOwnerPrivateKey = notSignerPrivateKey;
+ const ecSignature = ethUtil.ecsign(orderHashBuffer, notWalletOwnerPrivateKey);
+ // Create 0x signature from EIP712 signature
+ const signature = Buffer.concat([
+ ethUtil.toBuffer(ecSignature.v),
+ ecSignature.r,
+ ecSignature.s,
+ ethUtil.toBuffer(`0x${SignatureType.Wallet}`),
+ ]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ // Validate signature
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ testWallet.address,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.false();
+ });
+
+ it('should revert when `isValidSignature` attempts to update state and SignatureType=Wallet', async () => {
+ // Create EIP712 signature
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
+ const ecSignature = ethUtil.ecsign(orderHashBuffer, signerPrivateKey);
+ // Create 0x signature from EIP712 signature
+ const signature = Buffer.concat([
+ ethUtil.toBuffer(ecSignature.v),
+ ecSignature.r,
+ ecSignature.s,
+ ethUtil.toBuffer(`0x${SignatureType.Wallet}`),
+ ]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ await expectContractCallFailedAsync(
+ signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ maliciousWallet.address,
+ signatureHex,
+ ),
+ RevertReason.WalletError,
+ );
+ });
+
+ it('should return true when SignatureType=Validator, signature is valid and validator is approved', async () => {
+ const validatorAddress = ethUtil.toBuffer(`${testValidator.address}`);
+ const signatureType = ethUtil.toBuffer(`0x${SignatureType.Validator}`);
+ const signature = Buffer.concat([validatorAddress, signatureType]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signerAddress,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.true();
+ });
+
+ it('should return false when SignatureType=Validator, signature is invalid and validator is approved', async () => {
+ const validatorAddress = ethUtil.toBuffer(`${testValidator.address}`);
+ const signatureType = ethUtil.toBuffer(`0x${SignatureType.Validator}`);
+ const signature = Buffer.concat([validatorAddress, signatureType]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ // This will return false because we signed the message with `signerAddress`, but
+ // are validating against `notSignerAddress`
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ notSignerAddress,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.false();
+ });
+
+ it('should revert when `isValidSignature` attempts to update state and SignatureType=Validator', async () => {
+ const validatorAddress = ethUtil.toBuffer(`${maliciousValidator.address}`);
+ const signatureType = ethUtil.toBuffer(`0x${SignatureType.Validator}`);
+ const signature = Buffer.concat([validatorAddress, signatureType]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ await expectContractCallFailedAsync(
+ signatureValidator.publicIsValidSignature.callAsync(orderHashHex, signerAddress, signatureHex),
+ RevertReason.ValidatorError,
+ );
+ });
+ it('should return false when SignatureType=Validator, signature is valid and validator is not approved', async () => {
+ // Set approval of signature validator to false
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(
+ testValidator.address,
+ false,
+ { from: signerAddress },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Validate signature
+ const validatorAddress = ethUtil.toBuffer(`${testValidator.address}`);
+ const signatureType = ethUtil.toBuffer(`0x${SignatureType.Validator}`);
+ const signature = Buffer.concat([validatorAddress, signatureType]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signerAddress,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.false();
+ });
+
+ it('should return true when SignatureType=Presigned and signer has presigned hash', async () => {
+ // Presign hash
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await signatureValidator.preSign.sendTransactionAsync(
+ orderHashHex,
+ signedOrder.makerAddress,
+ signedOrder.signature,
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ // Validate presigned signature
+ const signature = ethUtil.toBuffer(`0x${SignatureType.PreSigned}`);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signedOrder.makerAddress,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.true();
+ });
+
+ it('should return false when SignatureType=Presigned and signer has not presigned hash', async () => {
+ const signature = ethUtil.toBuffer(`0x${SignatureType.PreSigned}`);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ orderHashHex,
+ signedOrder.makerAddress,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.false();
+ });
+
+ it('should return true when message was signed by a Trezor One (firmware version 1.6.2)', async () => {
+ // messageHash translates to 0x2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
+ const messageHash = ethUtil.bufferToHex(ethUtil.toBuffer('++++++++++++++++++++++++++++++++'));
+ const signer = '0xc28b145f10f0bcf0fc000e778615f8fd73490bad';
+ const v = ethUtil.toBuffer('0x1c');
+ const r = ethUtil.toBuffer('0x7b888b596ccf87f0bacab0dcb483124973f7420f169b4824d7a12534ac1e9832');
+ const s = ethUtil.toBuffer('0x0c8e14f7edc01459e13965f1da56e0c23ed11e2cca932571eee1292178f90424');
+ const trezorSignatureType = ethUtil.toBuffer(`0x${SignatureType.EthSign}`);
+ const signature = Buffer.concat([v, r, s, trezorSignatureType]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ messageHash,
+ signer,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.true();
+ });
+
+ it('should return true when message was signed by a Trezor Model T (firmware version 2.0.7)', async () => {
+ // messageHash translates to 0x2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
+ const messageHash = ethUtil.bufferToHex(ethUtil.toBuffer('++++++++++++++++++++++++++++++++'));
+ const signer = '0x98ce6d9345e8ffa7d99ee0822272fae9d2c0e895';
+ const v = ethUtil.toBuffer('0x1c');
+ const r = ethUtil.toBuffer('0x423b71062c327f0ec4fe199b8da0f34185e59b4c1cb4cc23df86cac4a601fb3f');
+ const s = ethUtil.toBuffer('0x53810d6591b5348b7ee08ee812c874b0fdfb942c9849d59512c90e295221091f');
+ const trezorSignatureType = ethUtil.toBuffer(`0x${SignatureType.EthSign}`);
+ const signature = Buffer.concat([v, r, s, trezorSignatureType]);
+ const signatureHex = ethUtil.bufferToHex(signature);
+ const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
+ messageHash,
+ signer,
+ signatureHex,
+ );
+ expect(isValidSignature).to.be.true();
+ });
+ });
+
+ describe('setSignatureValidatorApproval', () => {
+ it('should emit a SignatureValidatorApprovalSet with correct args when a validator is approved', async () => {
+ const approval = true;
+ const res = await signatureValidatorLogDecoder.getTxWithDecodedLogsAsync(
+ await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(
+ testValidator.address,
+ approval,
+ {
+ from: signerAddress,
+ },
+ ),
+ );
+ expect(res.logs.length).to.equal(1);
+ const log = res.logs[0] as LogWithDecodedArgs<TestSignatureValidatorSignatureValidatorApprovalEventArgs>;
+ const logArgs = log.args;
+ expect(logArgs.signerAddress).to.equal(signerAddress);
+ expect(logArgs.validatorAddress).to.equal(testValidator.address);
+ expect(logArgs.approved).to.equal(approval);
+ });
+ it('should emit a SignatureValidatorApprovalSet with correct args when a validator is disapproved', async () => {
+ const approval = false;
+ const res = await signatureValidatorLogDecoder.getTxWithDecodedLogsAsync(
+ await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(
+ testValidator.address,
+ approval,
+ {
+ from: signerAddress,
+ },
+ ),
+ );
+ expect(res.logs.length).to.equal(1);
+ const log = res.logs[0] as LogWithDecodedArgs<TestSignatureValidatorSignatureValidatorApprovalEventArgs>;
+ const logArgs = log.args;
+ expect(logArgs.signerAddress).to.equal(signerAddress);
+ expect(logArgs.validatorAddress).to.equal(testValidator.address);
+ expect(logArgs.approved).to.equal(approval);
+ });
+ });
+});
+// tslint:disable:max-file-line-count
+// tslint:enable:no-unnecessary-type-assertion
diff --git a/contracts/protocol/test/exchange/transactions.ts b/contracts/protocol/test/exchange/transactions.ts
new file mode 100644
index 000000000..746f3cb04
--- /dev/null
+++ b/contracts/protocol/test/exchange/transactions.ts
@@ -0,0 +1,466 @@
+import { artifacts as examplesArtifacts, ExchangeWrapperContract, WhitelistContract } from '@0x/contracts-examples';
+import {
+ chaiSetup,
+ constants,
+ ERC20BalancesByOwner,
+ expectTransactionFailedAsync,
+ OrderFactory,
+ orderUtils,
+ provider,
+ SignedTransaction,
+ TransactionFactory,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { DummyERC20TokenContract } from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
+import { OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ExchangeContract } from '../../generated-wrappers/exchange';
+import { artifacts } from '../../src/artifacts';
+import { ERC20Wrapper } from '../utils/erc20_wrapper';
+import { ExchangeWrapper } from '../utils/exchange_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+describe('Exchange transactions', () => {
+ let senderAddress: string;
+ let owner: string;
+ let makerAddress: string;
+ let takerAddress: string;
+ let feeRecipientAddress: string;
+
+ let erc20TokenA: DummyERC20TokenContract;
+ let erc20TokenB: DummyERC20TokenContract;
+ let zrxToken: DummyERC20TokenContract;
+ let exchange: ExchangeContract;
+ let erc20Proxy: ERC20ProxyContract;
+
+ let erc20Balances: ERC20BalancesByOwner;
+ let signedOrder: SignedOrder;
+ let signedTx: SignedTransaction;
+ let orderWithoutExchangeAddress: OrderWithoutExchangeAddress;
+ let orderFactory: OrderFactory;
+ let makerTransactionFactory: TransactionFactory;
+ let takerTransactionFactory: TransactionFactory;
+ let exchangeWrapper: ExchangeWrapper;
+ let erc20Wrapper: ERC20Wrapper;
+
+ let defaultMakerTokenAddress: string;
+ let defaultTakerTokenAddress: string;
+ let makerPrivateKey: Buffer;
+ let takerPrivateKey: Buffer;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const usedAddresses = ([owner, senderAddress, makerAddress, takerAddress, feeRecipientAddress] = _.slice(
+ accounts,
+ 0,
+ 5,
+ ));
+
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+
+ const numDummyErc20ToDeploy = 3;
+ [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
+ numDummyErc20ToDeploy,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
+ erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
+ assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ );
+ exchangeWrapper = new ExchangeWrapper(exchange, provider);
+ await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
+
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ defaultMakerTokenAddress = erc20TokenA.address;
+ defaultTakerTokenAddress = erc20TokenB.address;
+
+ const defaultOrderParams = {
+ ...constants.STATIC_ORDER_PARAMS,
+ senderAddress,
+ exchangeAddress: exchange.address,
+ makerAddress,
+ feeRecipientAddress,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerTokenAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerTokenAddress),
+ };
+ makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
+ takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
+ orderFactory = new OrderFactory(makerPrivateKey, defaultOrderParams);
+ makerTransactionFactory = new TransactionFactory(makerPrivateKey, exchange.address);
+ takerTransactionFactory = new TransactionFactory(takerPrivateKey, exchange.address);
+ });
+ describe('executeTransaction', () => {
+ describe('fillOrder', () => {
+ let takerAssetFillAmount: BigNumber;
+ beforeEach(async () => {
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ signedOrder = await orderFactory.newSignedOrderAsync();
+ orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
+
+ takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ const data = exchange.fillOrder.getABIEncodedTransactionData(
+ orderWithoutExchangeAddress,
+ takerAssetFillAmount,
+ signedOrder.signature,
+ );
+ signedTx = takerTransactionFactory.newSignedTransaction(data);
+ });
+
+ it('should throw if not called by specified sender', async () => {
+ return expectTransactionFailedAsync(
+ exchangeWrapper.executeTransactionAsync(signedTx, takerAddress),
+ RevertReason.FailedExecution,
+ );
+ });
+
+ it('should transfer the correct amounts when signed by taker and called by sender', async () => {
+ await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerAssetFillAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
+ const makerFeePaid = signedOrder.makerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ const takerFeePaid = signedOrder.takerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid),
+ );
+ expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ );
+ });
+
+ it('should throw if the a 0x transaction with the same transactionHash has already been executed', async () => {
+ await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
+ return expectTransactionFailedAsync(
+ exchangeWrapper.executeTransactionAsync(signedTx, senderAddress),
+ RevertReason.InvalidTxHash,
+ );
+ });
+
+ it('should reset the currentContextAddress', async () => {
+ await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
+ const currentContextAddress = await exchange.currentContextAddress.callAsync();
+ expect(currentContextAddress).to.equal(constants.NULL_ADDRESS);
+ });
+ });
+
+ describe('cancelOrder', () => {
+ beforeEach(async () => {
+ const data = exchange.cancelOrder.getABIEncodedTransactionData(orderWithoutExchangeAddress);
+ signedTx = makerTransactionFactory.newSignedTransaction(data);
+ });
+
+ it('should throw if not called by specified sender', async () => {
+ return expectTransactionFailedAsync(
+ exchangeWrapper.executeTransactionAsync(signedTx, makerAddress),
+ RevertReason.FailedExecution,
+ );
+ });
+
+ it('should cancel the order when signed by maker and called by sender', async () => {
+ await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrderAsync(signedOrder, senderAddress),
+ RevertReason.OrderUnfillable,
+ );
+ });
+ });
+
+ describe('cancelOrdersUpTo', () => {
+ let exchangeWrapperContract: ExchangeWrapperContract;
+
+ before(async () => {
+ exchangeWrapperContract = await ExchangeWrapperContract.deployFrom0xArtifactAsync(
+ examplesArtifacts.ExchangeWrapper,
+ provider,
+ txDefaults,
+ exchange.address,
+ );
+ });
+
+ it("should cancel an order if called from the order's sender", async () => {
+ const orderSalt = new BigNumber(0);
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ senderAddress: exchangeWrapperContract.address,
+ salt: orderSalt,
+ });
+ const targetOrderEpoch = orderSalt.add(1);
+ const cancelData = exchange.cancelOrdersUpTo.getABIEncodedTransactionData(targetOrderEpoch);
+ const signedCancelTx = makerTransactionFactory.newSignedTransaction(cancelData);
+ await exchangeWrapperContract.cancelOrdersUpTo.sendTransactionAsync(
+ targetOrderEpoch,
+ signedCancelTx.salt,
+ signedCancelTx.signature,
+ {
+ from: makerAddress,
+ },
+ );
+
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
+ const fillData = exchange.fillOrder.getABIEncodedTransactionData(
+ orderWithoutExchangeAddress,
+ takerAssetFillAmount,
+ signedOrder.signature,
+ );
+ const signedFillTx = takerTransactionFactory.newSignedTransaction(fillData);
+ return expectTransactionFailedAsync(
+ exchangeWrapperContract.fillOrder.sendTransactionAsync(
+ orderWithoutExchangeAddress,
+ takerAssetFillAmount,
+ signedFillTx.salt,
+ signedOrder.signature,
+ signedFillTx.signature,
+ { from: takerAddress },
+ ),
+ RevertReason.FailedExecution,
+ );
+ });
+
+ it("should not cancel an order if not called from the order's sender", async () => {
+ const orderSalt = new BigNumber(0);
+ signedOrder = await orderFactory.newSignedOrderAsync({
+ senderAddress: exchangeWrapperContract.address,
+ salt: orderSalt,
+ });
+ const targetOrderEpoch = orderSalt.add(1);
+ await exchangeWrapper.cancelOrdersUpToAsync(targetOrderEpoch, makerAddress);
+
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
+ const data = exchange.fillOrder.getABIEncodedTransactionData(
+ orderWithoutExchangeAddress,
+ takerAssetFillAmount,
+ signedOrder.signature,
+ );
+ signedTx = takerTransactionFactory.newSignedTransaction(data);
+ await exchangeWrapperContract.fillOrder.sendTransactionAsync(
+ orderWithoutExchangeAddress,
+ takerAssetFillAmount,
+ signedTx.salt,
+ signedOrder.signature,
+ signedTx.signature,
+ { from: takerAddress },
+ );
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerAssetFillAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
+ const makerFeePaid = signedOrder.makerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ const takerFeePaid = signedOrder.takerFee
+ .times(makerAssetFillAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid),
+ );
+ expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ );
+ });
+ });
+ });
+
+ describe('Whitelist', () => {
+ let whitelist: WhitelistContract;
+ let whitelistOrderFactory: OrderFactory;
+
+ before(async () => {
+ whitelist = await WhitelistContract.deployFrom0xArtifactAsync(
+ examplesArtifacts.Whitelist,
+ provider,
+ txDefaults,
+ exchange.address,
+ );
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await exchange.setSignatureValidatorApproval.sendTransactionAsync(whitelist.address, isApproved, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const defaultOrderParams = {
+ ...constants.STATIC_ORDER_PARAMS,
+ senderAddress: whitelist.address,
+ exchangeAddress: exchange.address,
+ makerAddress,
+ feeRecipientAddress,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerTokenAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerTokenAddress),
+ };
+ whitelistOrderFactory = new OrderFactory(makerPrivateKey, defaultOrderParams);
+ });
+
+ beforeEach(async () => {
+ signedOrder = await whitelistOrderFactory.newSignedOrderAsync();
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ });
+
+ it('should revert if maker has not been whitelisted', async () => {
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await whitelist.updateWhitelistStatus.sendTransactionAsync(takerAddress, isApproved, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ const salt = generatePseudoRandomSalt();
+ return expectTransactionFailedAsync(
+ whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
+ orderWithoutExchangeAddress,
+ takerAssetFillAmount,
+ salt,
+ signedOrder.signature,
+ { from: takerAddress },
+ ),
+ RevertReason.MakerNotWhitelisted,
+ );
+ });
+
+ it('should revert if taker has not been whitelisted', async () => {
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await whitelist.updateWhitelistStatus.sendTransactionAsync(makerAddress, isApproved, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ const salt = generatePseudoRandomSalt();
+ return expectTransactionFailedAsync(
+ whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
+ orderWithoutExchangeAddress,
+ takerAssetFillAmount,
+ salt,
+ signedOrder.signature,
+ { from: takerAddress },
+ ),
+ RevertReason.TakerNotWhitelisted,
+ );
+ });
+
+ it('should fill the order if maker and taker have been whitelisted', async () => {
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await whitelist.updateWhitelistStatus.sendTransactionAsync(makerAddress, isApproved, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await whitelist.updateWhitelistStatus.sendTransactionAsync(takerAddress, isApproved, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ const salt = generatePseudoRandomSalt();
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
+ orderWithoutExchangeAddress,
+ takerAssetFillAmount,
+ salt,
+ signedOrder.signature,
+ { from: takerAddress },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const makerAssetFillAmount = signedOrder.makerAssetAmount;
+ const makerFeePaid = signedOrder.makerFee;
+ const takerFeePaid = signedOrder.takerFee;
+
+ expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid),
+ );
+ expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
+ );
+ });
+ });
+});
diff --git a/contracts/protocol/test/exchange/wrapper.ts b/contracts/protocol/test/exchange/wrapper.ts
new file mode 100644
index 000000000..c9efb0c9d
--- /dev/null
+++ b/contracts/protocol/test/exchange/wrapper.ts
@@ -0,0 +1,1461 @@
+import {
+ chaiSetup,
+ constants,
+ ERC20BalancesByOwner,
+ expectTransactionFailedAsync,
+ getLatestBlockTimestampAsync,
+ increaseTimeAndMineBlockAsync,
+ OrderFactory,
+ OrderStatus,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import {
+ artifacts as tokensArtifacts,
+ DummyERC20TokenContract,
+ DummyERC721TokenContract,
+ ReentrantERC20TokenContract,
+} from '@0x/contracts-tokens';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { ExchangeContract } from '../../generated-wrappers/exchange';
+import { artifacts } from '../../src/artifacts';
+import { ERC20Wrapper } from '../utils/erc20_wrapper';
+import { ERC721Wrapper } from '../utils/erc721_wrapper';
+import { ExchangeWrapper } from '../utils/exchange_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+describe('Exchange wrappers', () => {
+ let makerAddress: string;
+ let owner: string;
+ let takerAddress: string;
+ let feeRecipientAddress: string;
+
+ let erc20TokenA: DummyERC20TokenContract;
+ let erc20TokenB: DummyERC20TokenContract;
+ let zrxToken: DummyERC20TokenContract;
+ let erc721Token: DummyERC721TokenContract;
+ let exchange: ExchangeContract;
+ let erc20Proxy: ERC20ProxyContract;
+ let erc721Proxy: ERC721ProxyContract;
+ let reentrantErc20Token: ReentrantERC20TokenContract;
+
+ let exchangeWrapper: ExchangeWrapper;
+ let erc20Wrapper: ERC20Wrapper;
+ let erc721Wrapper: ERC721Wrapper;
+ let erc20Balances: ERC20BalancesByOwner;
+ let orderFactory: OrderFactory;
+
+ let erc721MakerAssetId: BigNumber;
+ let erc721TakerAssetId: BigNumber;
+
+ let defaultMakerAssetAddress: string;
+ let defaultTakerAssetAddress: string;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = _.slice(accounts, 0, 4));
+
+ erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
+ erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
+
+ const numDummyErc20ToDeploy = 3;
+ [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
+ numDummyErc20ToDeploy,
+ constants.DUMMY_TOKEN_DECIMALS,
+ );
+ erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+
+ [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
+ erc721Proxy = await erc721Wrapper.deployProxyAsync();
+ await erc721Wrapper.setBalancesAndAllowancesAsync();
+ const erc721Balances = await erc721Wrapper.getBalancesAsync();
+ erc721MakerAssetId = erc721Balances[makerAddress][erc721Token.address][0];
+ erc721TakerAssetId = erc721Balances[takerAddress][erc721Token.address][0];
+
+ exchange = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
+ assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ );
+ exchangeWrapper = new ExchangeWrapper(exchange, provider);
+ await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
+ await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
+
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ from: owner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
+ tokensArtifacts.ReentrantERC20Token,
+ provider,
+ txDefaults,
+ exchange.address,
+ );
+
+ defaultMakerAssetAddress = erc20TokenA.address;
+ defaultTakerAssetAddress = erc20TokenB.address;
+
+ const defaultOrderParams = {
+ ...constants.STATIC_ORDER_PARAMS,
+ exchangeAddress: exchange.address,
+ makerAddress,
+ feeRecipientAddress,
+ makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
+ };
+ const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
+ orderFactory = new OrderFactory(privateKey, defaultOrderParams);
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ erc20Balances = await erc20Wrapper.getBalancesAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('fillOrKillOrder', () => {
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow fillOrKillOrder to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await expectTransactionFailedAsync(
+ exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
+ RevertReason.TransferFailed,
+ );
+ });
+ });
+ };
+ describe('fillOrKillOrder reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should transfer the correct amounts', async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
+ });
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ await exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress, {
+ takerAssetFillAmount,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
+ const makerFee = signedOrder.makerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ const takerFee = signedOrder.takerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
+ );
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
+ );
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ );
+ });
+
+ it('should throw if a signedOrder is expired', async () => {
+ const currentTimestamp = await getLatestBlockTimestampAsync();
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ expirationTimeSeconds: new BigNumber(currentTimestamp).sub(10),
+ });
+
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
+ RevertReason.OrderUnfillable,
+ );
+ });
+
+ it('should throw if entire takerAssetFillAmount not filled', async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync();
+
+ await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
+ takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
+ });
+
+ return expectTransactionFailedAsync(
+ exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
+ RevertReason.CompleteFillFailed,
+ );
+ });
+ });
+
+ describe('fillOrderNoThrow', () => {
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow fillOrderNoThrow to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(erc20Balances).to.deep.equal(newBalances);
+ });
+ });
+ };
+ describe('fillOrderNoThrow reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should transfer the correct amounts', async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
+ });
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, {
+ takerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 250000,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
+ const makerFee = signedOrder.makerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ const takerFee = signedOrder.takerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
+ );
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
+ );
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ );
+ });
+
+ it('should not change erc20Balances if maker erc20Balances are too low to fill order', async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
+ });
+
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should not change erc20Balances if taker erc20Balances are too low to fill order', async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
+ });
+
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should not change erc20Balances if maker allowances are too low to fill order', async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync();
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
+ from: makerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should not change erc20Balances if taker allowances are too low to fill order', async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync();
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
+ from: takerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should not change erc20Balances if makerAssetAddress is ZRX, makerAssetAmount + makerFee > maker balance', async () => {
+ const makerZRXBalance = new BigNumber(erc20Balances[makerAddress][zrxToken.address]);
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: makerZRXBalance,
+ makerFee: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ });
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should not change erc20Balances if makerAssetAddress is ZRX, makerAssetAmount + makerFee > maker allowance', async () => {
+ const makerZRXAllowance = await zrxToken.allowance.callAsync(makerAddress, erc20Proxy.address);
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(makerZRXAllowance),
+ makerFee: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ });
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should not change erc20Balances if takerAssetAddress is ZRX, takerAssetAmount + takerFee > taker balance', async () => {
+ const takerZRXBalance = new BigNumber(erc20Balances[takerAddress][zrxToken.address]);
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ takerAssetAmount: takerZRXBalance,
+ takerFee: new BigNumber(1),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ });
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should not change erc20Balances if takerAssetAddress is ZRX, takerAssetAmount + takerFee > taker allowance', async () => {
+ const takerZRXAllowance = await zrxToken.allowance.callAsync(takerAddress, erc20Proxy.address);
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ takerAssetAmount: new BigNumber(takerZRXAllowance),
+ takerFee: new BigNumber(1),
+ takerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ });
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should successfully exchange ERC721 tokens', async () => {
+ // Construct Exchange parameters
+ const makerAssetId = erc721MakerAssetId;
+ const takerAssetId = erc721TakerAssetId;
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetAmount: new BigNumber(1),
+ takerAssetAmount: new BigNumber(1),
+ makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
+ takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
+ });
+ // Verify pre-conditions
+ const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
+ const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
+ // Call Exchange
+ const takerAssetFillAmount = signedOrder.takerAssetAmount;
+ await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, {
+ takerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 280000,
+ });
+ // Verify post-conditions
+ const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
+ expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
+ const newOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
+ expect(newOwnerTakerAsset).to.be.bignumber.equal(makerAddress);
+ });
+ });
+
+ describe('batch functions', () => {
+ let signedOrders: SignedOrder[];
+ beforeEach(async () => {
+ signedOrders = [
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync(),
+ ];
+ });
+
+ describe('batchFillOrders', () => {
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow batchFillOrders to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await expectTransactionFailedAsync(
+ exchangeWrapper.batchFillOrdersAsync([signedOrder], takerAddress),
+ RevertReason.TransferFailed,
+ );
+ });
+ });
+ };
+ describe('batchFillOrders reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should transfer the correct amounts', async () => {
+ const takerAssetFillAmounts: BigNumber[] = [];
+ const makerAssetAddress = erc20TokenA.address;
+ const takerAssetAddress = erc20TokenB.address;
+ _.forEach(signedOrders, signedOrder => {
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
+ const makerFee = signedOrder.makerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ const takerFee = signedOrder.takerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ takerAssetFillAmounts.push(takerAssetFillAmount);
+ erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
+ makerAssetAddress
+ ].minus(makerAssetFilledAmount);
+ erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
+ takerAssetFillAmount,
+ );
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ makerFee,
+ );
+ erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
+ makerAssetFilledAmount,
+ );
+ erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
+ takerAssetAddress
+ ].minus(takerAssetFillAmount);
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
+ ].add(makerFee.add(takerFee));
+ });
+
+ await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress, {
+ takerAssetFillAmounts,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+ });
+
+ describe('batchFillOrKillOrders', () => {
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow batchFillOrKillOrders to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await expectTransactionFailedAsync(
+ exchangeWrapper.batchFillOrKillOrdersAsync([signedOrder], takerAddress),
+ RevertReason.TransferFailed,
+ );
+ });
+ });
+ };
+ describe('batchFillOrKillOrders reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should transfer the correct amounts', async () => {
+ const takerAssetFillAmounts: BigNumber[] = [];
+ const makerAssetAddress = erc20TokenA.address;
+ const takerAssetAddress = erc20TokenB.address;
+ _.forEach(signedOrders, signedOrder => {
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
+ const makerFee = signedOrder.makerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ const takerFee = signedOrder.takerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ takerAssetFillAmounts.push(takerAssetFillAmount);
+ erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
+ makerAssetAddress
+ ].minus(makerAssetFilledAmount);
+ erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
+ takerAssetFillAmount,
+ );
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ makerFee,
+ );
+ erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
+ makerAssetFilledAmount,
+ );
+ erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
+ takerAssetAddress
+ ].minus(takerAssetFillAmount);
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
+ ].add(makerFee.add(takerFee));
+ });
+
+ await exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
+ takerAssetFillAmounts,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should throw if a single signedOrder does not fill the expected amount', async () => {
+ const takerAssetFillAmounts: BigNumber[] = [];
+ _.forEach(signedOrders, signedOrder => {
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ takerAssetFillAmounts.push(takerAssetFillAmount);
+ });
+
+ await exchangeWrapper.fillOrKillOrderAsync(signedOrders[0], takerAddress);
+
+ return expectTransactionFailedAsync(
+ exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
+ takerAssetFillAmounts,
+ }),
+ RevertReason.OrderUnfillable,
+ );
+ });
+ });
+
+ describe('batchFillOrdersNoThrow', async () => {
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow batchFillOrdersNoThrow to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await exchangeWrapper.batchFillOrdersNoThrowAsync([signedOrder], takerAddress);
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(erc20Balances).to.deep.equal(newBalances);
+ });
+ });
+ };
+ describe('batchFillOrdersNoThrow reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should transfer the correct amounts', async () => {
+ const takerAssetFillAmounts: BigNumber[] = [];
+ const makerAssetAddress = erc20TokenA.address;
+ const takerAssetAddress = erc20TokenB.address;
+ _.forEach(signedOrders, signedOrder => {
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
+ const makerFee = signedOrder.makerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ const takerFee = signedOrder.takerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ takerAssetFillAmounts.push(takerAssetFillAmount);
+ erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
+ makerAssetAddress
+ ].minus(makerAssetFilledAmount);
+ erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
+ takerAssetFillAmount,
+ );
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ makerFee,
+ );
+ erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
+ makerAssetFilledAmount,
+ );
+ erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
+ takerAssetAddress
+ ].minus(takerAssetFillAmount);
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
+ ].add(makerFee.add(takerFee));
+ });
+
+ await exchangeWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress, {
+ takerAssetFillAmounts,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should not throw if an order is invalid and fill the remaining orders', async () => {
+ const takerAssetFillAmounts: BigNumber[] = [];
+ const makerAssetAddress = erc20TokenA.address;
+ const takerAssetAddress = erc20TokenB.address;
+
+ const invalidOrder = {
+ ...signedOrders[0],
+ signature: '0x00',
+ };
+ const validOrders = signedOrders.slice(1);
+
+ takerAssetFillAmounts.push(invalidOrder.takerAssetAmount.div(2));
+ _.forEach(validOrders, signedOrder => {
+ const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
+ const makerAssetFilledAmount = takerAssetFillAmount
+ .times(signedOrder.makerAssetAmount)
+ .dividedToIntegerBy(signedOrder.takerAssetAmount);
+ const makerFee = signedOrder.makerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ const takerFee = signedOrder.takerFee
+ .times(makerAssetFilledAmount)
+ .dividedToIntegerBy(signedOrder.makerAssetAmount);
+ takerAssetFillAmounts.push(takerAssetFillAmount);
+ erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
+ makerAssetAddress
+ ].minus(makerAssetFilledAmount);
+ erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
+ takerAssetFillAmount,
+ );
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ makerFee,
+ );
+ erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
+ makerAssetFilledAmount,
+ );
+ erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
+ takerAssetAddress
+ ].minus(takerAssetFillAmount);
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
+ ].add(makerFee.add(takerFee));
+ });
+
+ const newOrders = [invalidOrder, ...validOrders];
+ await exchangeWrapper.batchFillOrdersNoThrowAsync(newOrders, takerAddress, {
+ takerAssetFillAmounts,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 450000,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+ });
+
+ describe('marketSellOrders', () => {
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow marketSellOrders to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await expectTransactionFailedAsync(
+ exchangeWrapper.marketSellOrdersAsync([signedOrder], takerAddress, {
+ takerAssetFillAmount: signedOrder.takerAssetAmount,
+ }),
+ RevertReason.TransferFailed,
+ );
+ });
+ });
+ };
+ describe('marketSellOrders reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should stop when the entire takerAssetFillAmount is filled', async () => {
+ const takerAssetFillAmount = signedOrders[0].takerAssetAmount.plus(
+ signedOrders[1].takerAssetAmount.div(2),
+ );
+ await exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
+ takerAssetFillAmount,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const makerAssetFilledAmount = signedOrders[0].makerAssetAmount.add(
+ signedOrders[1].makerAssetAmount.dividedToIntegerBy(2),
+ );
+ const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
+ const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
+ );
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
+ );
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ );
+ });
+
+ it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
+ const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
+ _.forEach(signedOrders, signedOrder => {
+ erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
+ defaultMakerAssetAddress
+ ].minus(signedOrder.makerAssetAmount);
+ erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
+ defaultTakerAssetAddress
+ ].add(signedOrder.takerAssetAmount);
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ signedOrder.makerFee,
+ );
+ erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
+ defaultMakerAssetAddress
+ ].add(signedOrder.makerAssetAmount);
+ erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
+ defaultTakerAssetAddress
+ ].minus(signedOrder.takerAssetAmount);
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ signedOrder.takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
+ ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ });
+ await exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
+ takerAssetFillAmount,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should throw when a signedOrder does not use the same takerAssetAddress', async () => {
+ signedOrders = [
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync({
+ takerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ }),
+ await orderFactory.newSignedOrderAsync(),
+ ];
+
+ return expectTransactionFailedAsync(
+ exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
+ takerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
+ }),
+ // We simply use the takerAssetData from the first order for all orders.
+ // If they are not the same, the contract throws when validating the order signature
+ RevertReason.InvalidOrderSignature,
+ );
+ });
+ });
+
+ describe('marketSellOrdersNoThrow', () => {
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow marketSellOrdersNoThrow to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await exchangeWrapper.marketSellOrdersNoThrowAsync([signedOrder], takerAddress, {
+ takerAssetFillAmount: signedOrder.takerAssetAmount,
+ });
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(erc20Balances).to.deep.equal(newBalances);
+ });
+ });
+ };
+ describe('marketSellOrdersNoThrow reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should stop when the entire takerAssetFillAmount is filled', async () => {
+ const takerAssetFillAmount = signedOrders[0].takerAssetAmount.plus(
+ signedOrders[1].takerAssetAmount.div(2),
+ );
+ await exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
+ takerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 6000000,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const makerAssetFilledAmount = signedOrders[0].makerAssetAmount.add(
+ signedOrders[1].makerAssetAmount.dividedToIntegerBy(2),
+ );
+ const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
+ const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
+ );
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
+ );
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ );
+ });
+
+ it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
+ const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
+ _.forEach(signedOrders, signedOrder => {
+ erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
+ defaultMakerAssetAddress
+ ].minus(signedOrder.makerAssetAmount);
+ erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
+ defaultTakerAssetAddress
+ ].add(signedOrder.takerAssetAmount);
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ signedOrder.makerFee,
+ );
+ erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
+ defaultMakerAssetAddress
+ ].add(signedOrder.makerAssetAmount);
+ erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
+ defaultTakerAssetAddress
+ ].minus(signedOrder.takerAssetAmount);
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ signedOrder.takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
+ ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ });
+ await exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
+ takerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should not fill a signedOrder that does not use the same takerAssetAddress', async () => {
+ signedOrders = [
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync({
+ takerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ }),
+ ];
+ const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
+ const filledSignedOrders = signedOrders.slice(0, -1);
+ _.forEach(filledSignedOrders, signedOrder => {
+ erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
+ defaultMakerAssetAddress
+ ].minus(signedOrder.makerAssetAmount);
+ erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
+ defaultTakerAssetAddress
+ ].add(signedOrder.takerAssetAmount);
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ signedOrder.makerFee,
+ );
+ erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
+ defaultMakerAssetAddress
+ ].add(signedOrder.makerAssetAmount);
+ erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
+ defaultTakerAssetAddress
+ ].minus(signedOrder.takerAssetAmount);
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ signedOrder.takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
+ ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ });
+ await exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
+ takerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+ });
+
+ describe('marketBuyOrders', () => {
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow marketBuyOrders to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await expectTransactionFailedAsync(
+ exchangeWrapper.marketBuyOrdersAsync([signedOrder], takerAddress, {
+ makerAssetFillAmount: signedOrder.makerAssetAmount,
+ }),
+ RevertReason.TransferFailed,
+ );
+ });
+ });
+ };
+ describe('marketBuyOrders reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should stop when the entire makerAssetFillAmount is filled', async () => {
+ const makerAssetFillAmount = signedOrders[0].makerAssetAmount.plus(
+ signedOrders[1].makerAssetAmount.div(2),
+ );
+ await exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
+ makerAssetFillAmount,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const makerAmountBought = signedOrders[0].takerAssetAmount.add(
+ signedOrders[1].takerAssetAmount.dividedToIntegerBy(2),
+ );
+ const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
+ const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
+ );
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
+ );
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ );
+ });
+
+ it('should fill all signedOrders if cannot fill entire makerAssetFillAmount', async () => {
+ const makerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
+ _.forEach(signedOrders, signedOrder => {
+ erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
+ defaultMakerAssetAddress
+ ].minus(signedOrder.makerAssetAmount);
+ erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
+ defaultTakerAssetAddress
+ ].add(signedOrder.takerAssetAmount);
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ signedOrder.makerFee,
+ );
+ erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
+ defaultMakerAssetAddress
+ ].add(signedOrder.makerAssetAmount);
+ erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
+ defaultTakerAssetAddress
+ ].minus(signedOrder.takerAssetAmount);
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ signedOrder.takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
+ ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ });
+ await exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
+ makerAssetFillAmount,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should throw when a signedOrder does not use the same makerAssetAddress', async () => {
+ signedOrders = [
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ }),
+ await orderFactory.newSignedOrderAsync(),
+ ];
+
+ return expectTransactionFailedAsync(
+ exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
+ makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
+ }),
+ RevertReason.InvalidOrderSignature,
+ );
+ });
+ });
+
+ describe('marketBuyOrdersNoThrow', () => {
+ const reentrancyTest = (functionNames: string[]) => {
+ _.forEach(functionNames, async (functionName: string, functionId: number) => {
+ const description = `should not allow marketBuyOrdersNoThrow to reenter the Exchange contract via ${functionName}`;
+ it(description, async () => {
+ const signedOrder = await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
+ });
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await exchangeWrapper.marketBuyOrdersNoThrowAsync([signedOrder], takerAddress, {
+ makerAssetFillAmount: signedOrder.makerAssetAmount,
+ });
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(erc20Balances).to.deep.equal(newBalances);
+ });
+ });
+ };
+ describe('marketBuyOrdersNoThrow reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
+
+ it('should stop when the entire makerAssetFillAmount is filled', async () => {
+ const makerAssetFillAmount = signedOrders[0].makerAssetAmount.plus(
+ signedOrders[1].makerAssetAmount.div(2),
+ );
+ await exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
+ makerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+
+ const makerAmountBought = signedOrders[0].takerAssetAmount.add(
+ signedOrders[1].takerAssetAmount.dividedToIntegerBy(2),
+ );
+ const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
+ const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
+ expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
+ );
+ expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
+ );
+ expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
+ );
+ expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
+ );
+ expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
+ );
+ expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
+ );
+ expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
+ erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
+ );
+ });
+
+ it('should fill all signedOrders if cannot fill entire makerAssetFillAmount', async () => {
+ const makerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
+ _.forEach(signedOrders, signedOrder => {
+ erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
+ defaultMakerAssetAddress
+ ].minus(signedOrder.makerAssetAmount);
+ erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
+ defaultTakerAssetAddress
+ ].add(signedOrder.takerAssetAmount);
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ signedOrder.makerFee,
+ );
+ erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
+ defaultMakerAssetAddress
+ ].add(signedOrder.makerAssetAmount);
+ erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
+ defaultTakerAssetAddress
+ ].minus(signedOrder.takerAssetAmount);
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ signedOrder.takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
+ ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ });
+ await exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
+ makerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+
+ it('should not fill a signedOrder that does not use the same makerAssetAddress', async () => {
+ signedOrders = [
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync({
+ makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
+ }),
+ ];
+
+ const makerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
+ const filledSignedOrders = signedOrders.slice(0, -1);
+ _.forEach(filledSignedOrders, signedOrder => {
+ erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
+ defaultMakerAssetAddress
+ ].minus(signedOrder.makerAssetAmount);
+ erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
+ defaultTakerAssetAddress
+ ].add(signedOrder.takerAssetAmount);
+ erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
+ signedOrder.makerFee,
+ );
+ erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
+ defaultMakerAssetAddress
+ ].add(signedOrder.makerAssetAmount);
+ erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
+ defaultTakerAssetAddress
+ ].minus(signedOrder.takerAssetAmount);
+ erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
+ signedOrder.takerFee,
+ );
+ erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
+ zrxToken.address
+ ].add(signedOrder.makerFee.add(signedOrder.takerFee));
+ });
+ await exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
+ makerAssetFillAmount,
+ // HACK(albrow): We need to hardcode the gas estimate here because
+ // the Geth gas estimator doesn't work with the way we use
+ // delegatecall and swallow errors.
+ gas: 600000,
+ });
+
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(newBalances).to.be.deep.equal(erc20Balances);
+ });
+ });
+
+ describe('batchCancelOrders', () => {
+ it('should be able to cancel multiple signedOrders', async () => {
+ const takerAssetCancelAmounts = _.map(signedOrders, signedOrder => signedOrder.takerAssetAmount);
+ await exchangeWrapper.batchCancelOrdersAsync(signedOrders, makerAddress);
+
+ await exchangeWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress, {
+ takerAssetFillAmounts: takerAssetCancelAmounts,
+ });
+ const newBalances = await erc20Wrapper.getBalancesAsync();
+ expect(erc20Balances).to.be.deep.equal(newBalances);
+ });
+ });
+
+ describe('getOrdersInfo', () => {
+ beforeEach(async () => {
+ signedOrders = [
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync(),
+ await orderFactory.newSignedOrderAsync(),
+ ];
+ });
+ it('should get the correct information for multiple unfilled orders', async () => {
+ const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
+ expect(ordersInfo.length).to.be.equal(3);
+ _.forEach(signedOrders, (signedOrder, index) => {
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = new BigNumber(0);
+ const expectedOrderStatus = OrderStatus.FILLABLE;
+ const orderInfo = ordersInfo[index];
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ });
+ it('should get the correct information for multiple partially filled orders', async () => {
+ const takerAssetFillAmounts = _.map(signedOrders, signedOrder => signedOrder.takerAssetAmount.div(2));
+ await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress, { takerAssetFillAmounts });
+ const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
+ expect(ordersInfo.length).to.be.equal(3);
+ _.forEach(signedOrders, (signedOrder, index) => {
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount.div(2);
+ const expectedOrderStatus = OrderStatus.FILLABLE;
+ const orderInfo = ordersInfo[index];
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ });
+ it('should get the correct information for multiple fully filled orders', async () => {
+ await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress);
+ const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
+ expect(ordersInfo.length).to.be.equal(3);
+ _.forEach(signedOrders, (signedOrder, index) => {
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount;
+ const expectedOrderStatus = OrderStatus.FULLY_FILLED;
+ const orderInfo = ordersInfo[index];
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ });
+ it('should get the correct information for multiple cancelled and unfilled orders', async () => {
+ await exchangeWrapper.batchCancelOrdersAsync(signedOrders, makerAddress);
+ const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
+ expect(ordersInfo.length).to.be.equal(3);
+ _.forEach(signedOrders, (signedOrder, index) => {
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = new BigNumber(0);
+ const expectedOrderStatus = OrderStatus.CANCELLED;
+ const orderInfo = ordersInfo[index];
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ });
+ it('should get the correct information for multiple cancelled and partially filled orders', async () => {
+ const takerAssetFillAmounts = _.map(signedOrders, signedOrder => signedOrder.takerAssetAmount.div(2));
+ await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress, { takerAssetFillAmounts });
+ await exchangeWrapper.batchCancelOrdersAsync(signedOrders, makerAddress);
+ const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
+ expect(ordersInfo.length).to.be.equal(3);
+ _.forEach(signedOrders, (signedOrder, index) => {
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount.div(2);
+ const expectedOrderStatus = OrderStatus.CANCELLED;
+ const orderInfo = ordersInfo[index];
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ });
+ it('should get the correct information for multiple expired and unfilled orders', async () => {
+ const currentTimestamp = await getLatestBlockTimestampAsync();
+ const timeUntilExpiration = signedOrders[0].expirationTimeSeconds.minus(currentTimestamp).toNumber();
+ await increaseTimeAndMineBlockAsync(timeUntilExpiration);
+ const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
+ expect(ordersInfo.length).to.be.equal(3);
+ _.forEach(signedOrders, (signedOrder, index) => {
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = new BigNumber(0);
+ const expectedOrderStatus = OrderStatus.EXPIRED;
+ const orderInfo = ordersInfo[index];
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ });
+ it('should get the correct information for multiple expired and partially filled orders', async () => {
+ const takerAssetFillAmounts = _.map(signedOrders, signedOrder => signedOrder.takerAssetAmount.div(2));
+ await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress, { takerAssetFillAmounts });
+ const currentTimestamp = await getLatestBlockTimestampAsync();
+ const timeUntilExpiration = signedOrders[0].expirationTimeSeconds.minus(currentTimestamp).toNumber();
+ await increaseTimeAndMineBlockAsync(timeUntilExpiration);
+ const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
+ expect(ordersInfo.length).to.be.equal(3);
+ _.forEach(signedOrders, (signedOrder, index) => {
+ const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount.div(2);
+ const expectedOrderStatus = OrderStatus.EXPIRED;
+ const orderInfo = ordersInfo[index];
+ expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
+ expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
+ expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
+ });
+ });
+ it('should get the correct information for a mix of unfilled, partially filled, fully filled, cancelled, and expired orders', async () => {
+ const unfilledOrder = await orderFactory.newSignedOrderAsync();
+ const partiallyFilledOrder = await orderFactory.newSignedOrderAsync();
+ await exchangeWrapper.fillOrderAsync(partiallyFilledOrder, takerAddress, {
+ takerAssetFillAmount: partiallyFilledOrder.takerAssetAmount.div(2),
+ });
+ const fullyFilledOrder = await orderFactory.newSignedOrderAsync();
+ await exchangeWrapper.fillOrderAsync(fullyFilledOrder, takerAddress);
+ const cancelledOrder = await orderFactory.newSignedOrderAsync();
+ await exchangeWrapper.cancelOrderAsync(cancelledOrder, makerAddress);
+ const currentTimestamp = await getLatestBlockTimestampAsync();
+ const expiredOrder = await orderFactory.newSignedOrderAsync({
+ expirationTimeSeconds: new BigNumber(currentTimestamp),
+ });
+ signedOrders = [unfilledOrder, partiallyFilledOrder, fullyFilledOrder, cancelledOrder, expiredOrder];
+ const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
+ expect(ordersInfo.length).to.be.equal(5);
+
+ const expectedUnfilledOrderHash = orderHashUtils.getOrderHashHex(unfilledOrder);
+ const expectedUnfilledTakerAssetFilledAmount = new BigNumber(0);
+ const expectedUnfilledOrderStatus = OrderStatus.FILLABLE;
+ const unfilledOrderInfo = ordersInfo[0];
+ expect(unfilledOrderInfo.orderHash).to.be.equal(expectedUnfilledOrderHash);
+ expect(unfilledOrderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(
+ expectedUnfilledTakerAssetFilledAmount,
+ );
+ expect(unfilledOrderInfo.orderStatus).to.be.equal(expectedUnfilledOrderStatus);
+
+ const expectedPartialOrderHash = orderHashUtils.getOrderHashHex(partiallyFilledOrder);
+ const expectedPartialTakerAssetFilledAmount = partiallyFilledOrder.takerAssetAmount.div(2);
+ const expectedPartialOrderStatus = OrderStatus.FILLABLE;
+ const partialOrderInfo = ordersInfo[1];
+ expect(partialOrderInfo.orderHash).to.be.equal(expectedPartialOrderHash);
+ expect(partialOrderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(
+ expectedPartialTakerAssetFilledAmount,
+ );
+ expect(partialOrderInfo.orderStatus).to.be.equal(expectedPartialOrderStatus);
+
+ const expectedFilledOrderHash = orderHashUtils.getOrderHashHex(fullyFilledOrder);
+ const expectedFilledTakerAssetFilledAmount = fullyFilledOrder.takerAssetAmount;
+ const expectedFilledOrderStatus = OrderStatus.FULLY_FILLED;
+ const filledOrderInfo = ordersInfo[2];
+ expect(filledOrderInfo.orderHash).to.be.equal(expectedFilledOrderHash);
+ expect(filledOrderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(
+ expectedFilledTakerAssetFilledAmount,
+ );
+ expect(filledOrderInfo.orderStatus).to.be.equal(expectedFilledOrderStatus);
+
+ const expectedCancelledOrderHash = orderHashUtils.getOrderHashHex(cancelledOrder);
+ const expectedCancelledTakerAssetFilledAmount = new BigNumber(0);
+ const expectedCancelledOrderStatus = OrderStatus.CANCELLED;
+ const cancelledOrderInfo = ordersInfo[3];
+ expect(cancelledOrderInfo.orderHash).to.be.equal(expectedCancelledOrderHash);
+ expect(cancelledOrderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(
+ expectedCancelledTakerAssetFilledAmount,
+ );
+ expect(cancelledOrderInfo.orderStatus).to.be.equal(expectedCancelledOrderStatus);
+
+ const expectedExpiredOrderHash = orderHashUtils.getOrderHashHex(expiredOrder);
+ const expectedExpiredTakerAssetFilledAmount = new BigNumber(0);
+ const expectedExpiredOrderStatus = OrderStatus.EXPIRED;
+ const expiredOrderInfo = ordersInfo[4];
+ expect(expiredOrderInfo.orderHash).to.be.equal(expectedExpiredOrderHash);
+ expect(expiredOrderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(
+ expectedExpiredTakerAssetFilledAmount,
+ );
+ expect(expiredOrderInfo.orderStatus).to.be.equal(expectedExpiredOrderStatus);
+ });
+ });
+ });
+}); // tslint:disable-line:max-file-line-count
diff --git a/contracts/protocol/test/global_hooks.ts b/contracts/protocol/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/protocol/test/global_hooks.ts
@@ -0,0 +1,17 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage, profiler, provider } from '@0x/contracts-test-utils';
+before('start web3 provider', () => {
+ provider.start();
+});
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+ provider.stop();
+});
diff --git a/contracts/protocol/test/multisig/asset_proxy_owner.ts b/contracts/protocol/test/multisig/asset_proxy_owner.ts
new file mode 100644
index 000000000..daebfb7fb
--- /dev/null
+++ b/contracts/protocol/test/multisig/asset_proxy_owner.ts
@@ -0,0 +1,506 @@
+import {
+ chaiSetup,
+ constants,
+ expectContractCallFailedAsync,
+ expectContractCreationFailedAsync,
+ expectTransactionFailedAsync,
+ expectTransactionFailedWithoutReasonAsync,
+ increaseTimeAndMineBlockAsync,
+ provider,
+ sendTransactionResult,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+
+import {
+ AssetProxyOwnerAssetProxyRegistrationEventArgs,
+ AssetProxyOwnerContract,
+ AssetProxyOwnerExecutionEventArgs,
+ AssetProxyOwnerExecutionFailureEventArgs,
+ AssetProxyOwnerSubmissionEventArgs,
+} 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 { AssetProxyOwnerWrapper } from '../utils/asset_proxy_owner_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+// tslint:disable:no-unnecessary-type-assertion
+describe('AssetProxyOwner', () => {
+ let owners: string[];
+ let authorized: string;
+ let notOwner: string;
+ const REQUIRED_APPROVALS = new BigNumber(2);
+ const SECONDS_TIME_LOCKED = new BigNumber(1000000);
+
+ let erc20Proxy: MixinAuthorizableContract;
+ let erc721Proxy: MixinAuthorizableContract;
+ let testAssetProxyOwner: TestAssetProxyOwnerContract;
+ let assetProxyOwnerWrapper: AssetProxyOwnerWrapper;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ owners = [accounts[0], accounts[1]];
+ authorized = accounts[2];
+ notOwner = accounts[3];
+ const initialOwner = accounts[0];
+ erc20Proxy = await MixinAuthorizableContract.deployFrom0xArtifactAsync(
+ artifacts.MixinAuthorizable,
+ provider,
+ txDefaults,
+ );
+ erc721Proxy = await MixinAuthorizableContract.deployFrom0xArtifactAsync(
+ artifacts.MixinAuthorizable,
+ provider,
+ txDefaults,
+ );
+ const defaultAssetProxyContractAddresses: string[] = [];
+ testAssetProxyOwner = await TestAssetProxyOwnerContract.deployFrom0xArtifactAsync(
+ artifacts.TestAssetProxyOwner,
+ provider,
+ txDefaults,
+ owners,
+ defaultAssetProxyContractAddresses,
+ REQUIRED_APPROVALS,
+ SECONDS_TIME_LOCKED,
+ );
+ assetProxyOwnerWrapper = new AssetProxyOwnerWrapper(testAssetProxyOwner, provider);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.transferOwnership.sendTransactionAsync(testAssetProxyOwner.address, {
+ from: initialOwner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.transferOwnership.sendTransactionAsync(testAssetProxyOwner.address, {
+ from: initialOwner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('constructor', () => {
+ it('should register passed in assetProxyContracts', async () => {
+ const assetProxyContractAddresses = [erc20Proxy.address, erc721Proxy.address];
+ const newMultiSig = await AssetProxyOwnerContract.deployFrom0xArtifactAsync(
+ artifacts.AssetProxyOwner,
+ provider,
+ txDefaults,
+ owners,
+ assetProxyContractAddresses,
+ REQUIRED_APPROVALS,
+ SECONDS_TIME_LOCKED,
+ );
+ const isErc20ProxyRegistered = await newMultiSig.isAssetProxyRegistered.callAsync(erc20Proxy.address);
+ const isErc721ProxyRegistered = await newMultiSig.isAssetProxyRegistered.callAsync(erc721Proxy.address);
+ expect(isErc20ProxyRegistered).to.equal(true);
+ expect(isErc721ProxyRegistered).to.equal(true);
+ });
+ it('should throw if a null address is included in assetProxyContracts', async () => {
+ const assetProxyContractAddresses = [erc20Proxy.address, constants.NULL_ADDRESS];
+ return expectContractCreationFailedAsync(
+ (AssetProxyOwnerContract.deployFrom0xArtifactAsync(
+ artifacts.AssetProxyOwner,
+ provider,
+ txDefaults,
+ owners,
+ assetProxyContractAddresses,
+ REQUIRED_APPROVALS,
+ SECONDS_TIME_LOCKED,
+ ) as any) as sendTransactionResult,
+ RevertReason.InvalidAssetProxy,
+ );
+ });
+ });
+
+ describe('isFunctionRemoveAuthorizedAddressAtIndex', () => {
+ it('should return false if data is not for removeAuthorizedAddressAtIndex', async () => {
+ const notRemoveAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(
+ owners[0],
+ );
+
+ const isFunctionRemoveAuthorizedAddressAtIndex = await testAssetProxyOwner.isFunctionRemoveAuthorizedAddressAtIndex.callAsync(
+ notRemoveAuthorizedAddressData,
+ );
+ expect(isFunctionRemoveAuthorizedAddressAtIndex).to.be.false();
+ });
+
+ it('should return true if data is for removeAuthorizedAddressAtIndex', async () => {
+ const index = new BigNumber(0);
+ const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
+ owners[0],
+ index,
+ );
+ const isFunctionRemoveAuthorizedAddressAtIndex = await testAssetProxyOwner.isFunctionRemoveAuthorizedAddressAtIndex.callAsync(
+ removeAuthorizedAddressAtIndexData,
+ );
+ expect(isFunctionRemoveAuthorizedAddressAtIndex).to.be.true();
+ });
+ });
+
+ describe('registerAssetProxy', () => {
+ it('should throw if not called by multisig', async () => {
+ const isRegistered = true;
+ return expectTransactionFailedWithoutReasonAsync(
+ testAssetProxyOwner.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, isRegistered, {
+ from: owners[0],
+ }),
+ );
+ });
+
+ it('should register an address if called by multisig after timelock', async () => {
+ const addressToRegister = erc20Proxy.address;
+ const isRegistered = true;
+ const registerAssetProxyData = testAssetProxyOwner.registerAssetProxy.getABIEncodedTransactionData(
+ addressToRegister,
+ isRegistered,
+ );
+ const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ testAssetProxyOwner.address,
+ registerAssetProxyData,
+ owners[0],
+ );
+
+ const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = log.args.transactionId;
+
+ await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
+ await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
+
+ const executeTxRes = await assetProxyOwnerWrapper.executeTransactionAsync(txId, owners[0]);
+ const registerLog = executeTxRes.logs[0] as LogWithDecodedArgs<
+ AssetProxyOwnerAssetProxyRegistrationEventArgs
+ >;
+ expect(registerLog.args.assetProxyContract).to.equal(addressToRegister);
+ expect(registerLog.args.isRegistered).to.equal(isRegistered);
+
+ const isAssetProxyRegistered = await testAssetProxyOwner.isAssetProxyRegistered.callAsync(
+ addressToRegister,
+ );
+ expect(isAssetProxyRegistered).to.equal(isRegistered);
+ });
+
+ it('should fail if registering a null address', async () => {
+ const addressToRegister = constants.NULL_ADDRESS;
+ const isRegistered = true;
+ const registerAssetProxyData = testAssetProxyOwner.registerAssetProxy.getABIEncodedTransactionData(
+ addressToRegister,
+ isRegistered,
+ );
+ const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ testAssetProxyOwner.address,
+ registerAssetProxyData,
+ owners[0],
+ );
+ const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = log.args.transactionId;
+
+ await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
+ await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
+
+ const executeTxRes = await assetProxyOwnerWrapper.executeTransactionAsync(txId, owners[0]);
+ const failureLog = executeTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerExecutionFailureEventArgs>;
+ expect(failureLog.args.transactionId).to.be.bignumber.equal(txId);
+
+ const isAssetProxyRegistered = await testAssetProxyOwner.isAssetProxyRegistered.callAsync(
+ addressToRegister,
+ );
+ expect(isAssetProxyRegistered).to.equal(false);
+ });
+ });
+
+ describe('Calling removeAuthorizedAddressAtIndex', () => {
+ const erc20Index = new BigNumber(0);
+ const erc721Index = new BigNumber(1);
+ before('authorize both proxies and register erc20 proxy', async () => {
+ // Only register ERC20 proxy
+ const addressToRegister = erc20Proxy.address;
+ const isRegistered = true;
+ const registerAssetProxyData = testAssetProxyOwner.registerAssetProxy.getABIEncodedTransactionData(
+ addressToRegister,
+ isRegistered,
+ );
+ const registerAssetProxySubmitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ testAssetProxyOwner.address,
+ registerAssetProxyData,
+ owners[0],
+ );
+ const registerAssetProxySubmitLog = registerAssetProxySubmitRes.logs[0] as LogWithDecodedArgs<
+ AssetProxyOwnerSubmissionEventArgs
+ >;
+
+ const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(authorized);
+ const erc20AddAuthorizedAddressSubmitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc20Proxy.address,
+ addAuthorizedAddressData,
+ owners[0],
+ );
+ const erc721AddAuthorizedAddressSubmitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc721Proxy.address,
+ addAuthorizedAddressData,
+ owners[0],
+ );
+ const erc20AddAuthorizedAddressSubmitLog = erc20AddAuthorizedAddressSubmitRes.logs[0] as LogWithDecodedArgs<
+ AssetProxyOwnerSubmissionEventArgs
+ >;
+ const erc721AddAuthorizedAddressSubmitLog = erc721AddAuthorizedAddressSubmitRes
+ .logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+
+ const registerAssetProxyTxId = registerAssetProxySubmitLog.args.transactionId;
+ const erc20AddAuthorizedAddressTxId = erc20AddAuthorizedAddressSubmitLog.args.transactionId;
+ const erc721AddAuthorizedAddressTxId = erc721AddAuthorizedAddressSubmitLog.args.transactionId;
+
+ await assetProxyOwnerWrapper.confirmTransactionAsync(registerAssetProxyTxId, owners[1]);
+ await assetProxyOwnerWrapper.confirmTransactionAsync(erc20AddAuthorizedAddressTxId, owners[1]);
+ await assetProxyOwnerWrapper.confirmTransactionAsync(erc721AddAuthorizedAddressTxId, owners[1]);
+ await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
+ await assetProxyOwnerWrapper.executeTransactionAsync(registerAssetProxyTxId, owners[0]);
+ await assetProxyOwnerWrapper.executeTransactionAsync(erc20AddAuthorizedAddressTxId, owners[0], {
+ gas: constants.MAX_EXECUTE_TRANSACTION_GAS,
+ });
+ await assetProxyOwnerWrapper.executeTransactionAsync(erc721AddAuthorizedAddressTxId, owners[0], {
+ gas: constants.MAX_EXECUTE_TRANSACTION_GAS,
+ });
+ });
+
+ describe('validRemoveAuthorizedAddressAtIndexTx', () => {
+ it('should revert if data is not for removeAuthorizedAddressAtIndex and proxy is registered', async () => {
+ const notRemoveAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(
+ authorized,
+ );
+ const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc20Proxy.address,
+ notRemoveAuthorizedAddressData,
+ owners[0],
+ );
+ const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = log.args.transactionId;
+ return expectContractCallFailedAsync(
+ testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(txId),
+ RevertReason.InvalidFunctionSelector,
+ );
+ });
+
+ it('should return true if data is for removeAuthorizedAddressAtIndex and proxy is registered', async () => {
+ const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
+ authorized,
+ erc20Index,
+ );
+ const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc20Proxy.address,
+ removeAuthorizedAddressAtIndexData,
+ owners[0],
+ );
+ const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = log.args.transactionId;
+ const isValidRemoveAuthorizedAddressAtIndexTx = await testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(
+ txId,
+ );
+ expect(isValidRemoveAuthorizedAddressAtIndexTx).to.be.true();
+ });
+
+ it('should revert if data is for removeAuthorizedAddressAtIndex and proxy is not registered', async () => {
+ const removeAuthorizedAddressAtIndexData = erc721Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
+ authorized,
+ erc721Index,
+ );
+ const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc721Proxy.address,
+ removeAuthorizedAddressAtIndexData,
+ owners[0],
+ );
+ const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = log.args.transactionId;
+ return expectContractCallFailedAsync(
+ testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(txId),
+ RevertReason.UnregisteredAssetProxy,
+ );
+ });
+ });
+
+ describe('executeRemoveAuthorizedAddressAtIndex', () => {
+ it('should throw without the required confirmations', async () => {
+ const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
+ authorized,
+ erc20Index,
+ );
+ const res = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc20Proxy.address,
+ removeAuthorizedAddressAtIndexData,
+ owners[0],
+ );
+ const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = log.args.transactionId;
+
+ return expectTransactionFailedAsync(
+ testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
+ from: owners[1],
+ }),
+ RevertReason.TxNotFullyConfirmed,
+ );
+ });
+
+ it('should throw if tx destination is not registered', async () => {
+ const removeAuthorizedAddressAtIndexData = erc721Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
+ authorized,
+ erc721Index,
+ );
+ const res = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc721Proxy.address,
+ removeAuthorizedAddressAtIndexData,
+ owners[0],
+ );
+ const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = log.args.transactionId;
+
+ await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
+
+ return expectTransactionFailedAsync(
+ testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
+ from: owners[1],
+ }),
+ RevertReason.UnregisteredAssetProxy,
+ );
+ });
+
+ it('should throw if tx data is not for removeAuthorizedAddressAtIndex', async () => {
+ const newAuthorized = owners[1];
+ const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(
+ newAuthorized,
+ );
+ const res = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc20Proxy.address,
+ addAuthorizedAddressData,
+ owners[0],
+ );
+ const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = log.args.transactionId;
+
+ await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
+
+ return expectTransactionFailedAsync(
+ testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
+ from: owners[1],
+ }),
+ RevertReason.InvalidFunctionSelector,
+ );
+ });
+
+ it('should execute removeAuthorizedAddressAtIndex for registered address if fully confirmed and called by owner', async () => {
+ const isAuthorizedBefore = await erc20Proxy.authorized.callAsync(authorized);
+ expect(isAuthorizedBefore).to.equal(true);
+
+ const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
+ authorized,
+ erc20Index,
+ );
+ const submitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc20Proxy.address,
+ removeAuthorizedAddressAtIndexData,
+ owners[0],
+ );
+ const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = submitLog.args.transactionId;
+
+ await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
+
+ const execRes = await assetProxyOwnerWrapper.executeRemoveAuthorizedAddressAtIndexAsync(
+ txId,
+ owners[0],
+ );
+ const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
+ expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
+
+ const tx = await testAssetProxyOwner.transactions.callAsync(txId);
+ const isExecuted = tx[3];
+ expect(isExecuted).to.equal(true);
+
+ const isAuthorizedAfter = await erc20Proxy.authorized.callAsync(authorized);
+ expect(isAuthorizedAfter).to.equal(false);
+ });
+
+ it('should execute removeAuthorizedAddressAtIndex for registered address if fully confirmed and called by non-owner', async () => {
+ const isAuthorizedBefore = await erc20Proxy.authorized.callAsync(authorized);
+ expect(isAuthorizedBefore).to.equal(true);
+
+ const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
+ authorized,
+ erc20Index,
+ );
+ const submitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc20Proxy.address,
+ removeAuthorizedAddressAtIndexData,
+ owners[0],
+ );
+ const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = submitLog.args.transactionId;
+
+ await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
+
+ const execRes = await assetProxyOwnerWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, notOwner);
+ const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
+ expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
+
+ const tx = await testAssetProxyOwner.transactions.callAsync(txId);
+ const isExecuted = tx[3];
+ expect(isExecuted).to.equal(true);
+
+ const isAuthorizedAfter = await erc20Proxy.authorized.callAsync(authorized);
+ expect(isAuthorizedAfter).to.equal(false);
+ });
+
+ it('should throw if already executed', async () => {
+ const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
+ authorized,
+ erc20Index,
+ );
+ const submitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
+ erc20Proxy.address,
+ removeAuthorizedAddressAtIndexData,
+ owners[0],
+ );
+ const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
+ const txId = submitLog.args.transactionId;
+
+ await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
+
+ const execRes = await assetProxyOwnerWrapper.executeRemoveAuthorizedAddressAtIndexAsync(
+ txId,
+ owners[0],
+ );
+ const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
+ expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
+
+ const tx = await testAssetProxyOwner.transactions.callAsync(txId);
+ const isExecuted = tx[3];
+ expect(isExecuted).to.equal(true);
+
+ return expectTransactionFailedWithoutReasonAsync(
+ testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
+ from: owners[1],
+ }),
+ );
+ });
+ });
+ });
+});
+// tslint:disable-line max-file-line-count
diff --git a/contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts b/contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts
new file mode 100644
index 000000000..df23658d8
--- /dev/null
+++ b/contracts/protocol/test/utils/asset_proxy_owner_wrapper.ts
@@ -0,0 +1,70 @@
+import { LogDecoder } from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner';
+import { artifacts } from '../../src/artifacts';
+
+export class AssetProxyOwnerWrapper {
+ private readonly _assetProxyOwner: AssetProxyOwnerContract;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _logDecoder: LogDecoder;
+ constructor(assetproxyOwnerContract: AssetProxyOwnerContract, provider: Provider) {
+ this._assetProxyOwner = assetproxyOwnerContract;
+ this._web3Wrapper = new Web3Wrapper(provider);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...tokensArtifacts });
+ }
+ public async submitTransactionAsync(
+ destination: string,
+ data: string,
+ from: string,
+ opts: { value?: BigNumber } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value;
+ const txHash = await this._assetProxyOwner.submitTransaction.sendTransactionAsync(destination, value, data, {
+ from,
+ });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async confirmTransactionAsync(txId: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._assetProxyOwner.confirmTransaction.sendTransactionAsync(txId, { from });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async revokeConfirmationAsync(txId: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._assetProxyOwner.revokeConfirmation.sendTransactionAsync(txId, { from });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async executeTransactionAsync(
+ txId: BigNumber,
+ from: string,
+ opts: { gas?: number } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._assetProxyOwner.executeTransaction.sendTransactionAsync(txId, {
+ from,
+ gas: opts.gas,
+ });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async executeRemoveAuthorizedAddressAtIndexAsync(
+ txId: BigNumber,
+ from: string,
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const txHash = await (this
+ ._assetProxyOwner as AssetProxyOwnerContract).executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(
+ txId,
+ {
+ from,
+ },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+}
diff --git a/contracts/protocol/test/utils/asset_wrapper.ts b/contracts/protocol/test/utils/asset_wrapper.ts
new file mode 100644
index 000000000..e4090ad74
--- /dev/null
+++ b/contracts/protocol/test/utils/asset_wrapper.ts
@@ -0,0 +1,222 @@
+import { AbstractAssetWrapper, constants } from '@0x/contracts-test-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { AssetProxyId } from '@0x/types';
+import { BigNumber, errorUtils } from '@0x/utils';
+import * as _ from 'lodash';
+
+import { ERC20Wrapper } from './erc20_wrapper';
+import { ERC721Wrapper } from './erc721_wrapper';
+
+interface ProxyIdToAssetWrappers {
+ [proxyId: string]: AbstractAssetWrapper;
+}
+
+/**
+ * This class abstracts away the differences between ERC20 and ERC721 tokens so that
+ * the logic that uses it does not need to care what standard a token belongs to.
+ */
+export class AssetWrapper {
+ private readonly _proxyIdToAssetWrappers: ProxyIdToAssetWrappers;
+ constructor(assetWrappers: AbstractAssetWrapper[]) {
+ this._proxyIdToAssetWrappers = {};
+ _.each(assetWrappers, assetWrapper => {
+ const proxyId = assetWrapper.getProxyId();
+ this._proxyIdToAssetWrappers[proxyId] = assetWrapper;
+ });
+ }
+ public async getBalanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
+ const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ switch (proxyId) {
+ case AssetProxyId.ERC20: {
+ const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
+ const balance = await erc20Wrapper.getBalanceAsync(userAddress, assetData);
+ return balance;
+ }
+ case AssetProxyId.ERC721: {
+ const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
+ const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
+ const isOwner = await assetWrapper.isOwnerAsync(
+ userAddress,
+ assetProxyData.tokenAddress,
+ assetProxyData.tokenId,
+ );
+ const balance = isOwner ? new BigNumber(1) : new BigNumber(0);
+ return balance;
+ }
+ default:
+ throw errorUtils.spawnSwitchErr('proxyId', proxyId);
+ }
+ }
+ public async setBalanceAsync(userAddress: string, assetData: string, desiredBalance: BigNumber): Promise<void> {
+ const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ switch (proxyId) {
+ case AssetProxyId.ERC20: {
+ const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
+ await erc20Wrapper.setBalanceAsync(userAddress, assetData, desiredBalance);
+ return;
+ }
+ case AssetProxyId.ERC721: {
+ if (!desiredBalance.eq(0) && !desiredBalance.eq(1)) {
+ throw new Error(`Balance for ERC721 token can only be set to 0 or 1. Got: ${desiredBalance}`);
+ }
+ const erc721Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
+ const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
+ const doesTokenExist = erc721Wrapper.doesTokenExistAsync(
+ assetProxyData.tokenAddress,
+ assetProxyData.tokenId,
+ );
+ if (!doesTokenExist && desiredBalance.eq(1)) {
+ await erc721Wrapper.mintAsync(assetProxyData.tokenAddress, assetProxyData.tokenId, userAddress);
+ return;
+ } else if (!doesTokenExist && desiredBalance.eq(0)) {
+ return; // noop
+ }
+ const tokenOwner = await erc721Wrapper.ownerOfAsync(
+ assetProxyData.tokenAddress,
+ assetProxyData.tokenId,
+ );
+ if (userAddress !== tokenOwner && desiredBalance.eq(1)) {
+ await erc721Wrapper.transferFromAsync(
+ assetProxyData.tokenAddress,
+ assetProxyData.tokenId,
+ tokenOwner,
+ userAddress,
+ );
+ } else if (tokenOwner === userAddress && desiredBalance.eq(0)) {
+ // Transfer token to someone else
+ const userAddresses = await (erc721Wrapper as any)._web3Wrapper.getAvailableAddressesAsync();
+ const nonOwner = _.find(userAddresses, a => a !== userAddress);
+ await erc721Wrapper.transferFromAsync(
+ assetProxyData.tokenAddress,
+ assetProxyData.tokenId,
+ tokenOwner,
+ nonOwner,
+ );
+ return;
+ } else if (
+ (userAddress !== tokenOwner && desiredBalance.eq(0)) ||
+ (tokenOwner === userAddress && desiredBalance.eq(1))
+ ) {
+ return; // noop
+ }
+ break;
+ }
+ default:
+ throw errorUtils.spawnSwitchErr('proxyId', proxyId);
+ }
+ }
+ public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
+ const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ switch (proxyId) {
+ case AssetProxyId.ERC20: {
+ const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
+ const allowance = await erc20Wrapper.getProxyAllowanceAsync(userAddress, assetData);
+ return allowance;
+ }
+ case AssetProxyId.ERC721: {
+ const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
+ const erc721ProxyData = assetDataUtils.decodeERC721AssetData(assetData);
+ const isProxyApprovedForAll = await assetWrapper.isProxyApprovedForAllAsync(
+ userAddress,
+ erc721ProxyData.tokenAddress,
+ );
+ if (isProxyApprovedForAll) {
+ return constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
+ }
+
+ const isProxyApproved = await assetWrapper.isProxyApprovedAsync(
+ erc721ProxyData.tokenAddress,
+ erc721ProxyData.tokenId,
+ );
+ const allowance = isProxyApproved ? new BigNumber(1) : new BigNumber(0);
+ return allowance;
+ }
+ default:
+ throw errorUtils.spawnSwitchErr('proxyId', proxyId);
+ }
+ }
+ public async setProxyAllowanceAsync(
+ userAddress: string,
+ assetData: string,
+ desiredAllowance: BigNumber,
+ ): Promise<void> {
+ const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ switch (proxyId) {
+ case AssetProxyId.ERC20: {
+ const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
+ await erc20Wrapper.setAllowanceAsync(userAddress, assetData, desiredAllowance);
+ return;
+ }
+ case AssetProxyId.ERC721: {
+ if (
+ !desiredAllowance.eq(0) &&
+ !desiredAllowance.eq(1) &&
+ !desiredAllowance.eq(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
+ ) {
+ throw new Error(
+ `Allowance for ERC721 token can only be set to 0, 1 or 2^256-1. Got: ${desiredAllowance}`,
+ );
+ }
+ const erc721Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
+ const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
+
+ const doesTokenExist = await erc721Wrapper.doesTokenExistAsync(
+ assetProxyData.tokenAddress,
+ assetProxyData.tokenId,
+ );
+ if (!doesTokenExist) {
+ throw new Error(
+ `Cannot setProxyAllowance on non-existent token: ${assetProxyData.tokenAddress} ${
+ assetProxyData.tokenId
+ }`,
+ );
+ }
+ const isProxyApprovedForAll = await erc721Wrapper.isProxyApprovedForAllAsync(
+ userAddress,
+ assetProxyData.tokenAddress,
+ );
+ if (!isProxyApprovedForAll && desiredAllowance.eq(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS)) {
+ const isApproved = true;
+ await erc721Wrapper.approveProxyForAllAsync(
+ assetProxyData.tokenAddress,
+ assetProxyData.tokenId,
+ isApproved,
+ );
+ } else if (isProxyApprovedForAll && desiredAllowance.eq(0)) {
+ const isApproved = false;
+ await erc721Wrapper.approveProxyForAllAsync(
+ assetProxyData.tokenAddress,
+ assetProxyData.tokenId,
+ isApproved,
+ );
+ } else if (isProxyApprovedForAll && desiredAllowance.eq(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS)) {
+ return; // Noop
+ }
+
+ const isProxyApproved = await erc721Wrapper.isProxyApprovedAsync(
+ assetProxyData.tokenAddress,
+ assetProxyData.tokenId,
+ );
+ if (!isProxyApproved && desiredAllowance.eq(1)) {
+ await erc721Wrapper.approveProxyAsync(assetProxyData.tokenAddress, assetProxyData.tokenId);
+ } else if (isProxyApproved && desiredAllowance.eq(0)) {
+ // Remove approval
+ await erc721Wrapper.approveAsync(
+ constants.NULL_ADDRESS,
+ assetProxyData.tokenAddress,
+ assetProxyData.tokenId,
+ );
+ } else if (
+ (!isProxyApproved && desiredAllowance.eq(0)) ||
+ (isProxyApproved && desiredAllowance.eq(1))
+ ) {
+ return; // noop
+ }
+
+ break;
+ }
+ default:
+ throw errorUtils.spawnSwitchErr('proxyId', proxyId);
+ }
+ }
+}
diff --git a/contracts/protocol/test/utils/erc20_wrapper.ts b/contracts/protocol/test/utils/erc20_wrapper.ts
new file mode 100644
index 000000000..e5ab0e36c
--- /dev/null
+++ b/contracts/protocol/test/utils/erc20_wrapper.ts
@@ -0,0 +1,179 @@
+import { constants, ERC20BalancesByOwner, txDefaults } from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts, DummyERC20TokenContract } from '@0x/contracts-tokens';
+import { assetDataUtils } from '@0x/order-utils';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import { Provider } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
+import { artifacts } from '../../src/artifacts';
+
+export class ERC20Wrapper {
+ private readonly _tokenOwnerAddresses: string[];
+ private readonly _contractOwnerAddress: string;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _provider: Provider;
+ private readonly _dummyTokenContracts: DummyERC20TokenContract[];
+ private _proxyContract?: ERC20ProxyContract;
+ private _proxyIdIfExists?: string;
+ /**
+ * Instanitates an ERC20Wrapper
+ * @param provider Web3 provider to use for all JSON RPC requests
+ * @param tokenOwnerAddresses Addresses that we want to endow as owners for dummy ERC20 tokens
+ * @param contractOwnerAddress Desired owner of the contract
+ * Instance of ERC20Wrapper
+ */
+ constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
+ this._dummyTokenContracts = [];
+ this._web3Wrapper = new Web3Wrapper(provider);
+ this._provider = provider;
+ this._tokenOwnerAddresses = tokenOwnerAddresses;
+ this._contractOwnerAddress = contractOwnerAddress;
+ }
+ public async deployDummyTokensAsync(
+ numberToDeploy: number,
+ decimals: BigNumber,
+ ): Promise<DummyERC20TokenContract[]> {
+ for (let i = 0; i < numberToDeploy; i++) {
+ this._dummyTokenContracts.push(
+ await DummyERC20TokenContract.deployFrom0xArtifactAsync(
+ tokensArtifacts.DummyERC20Token,
+ this._provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ decimals,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ ),
+ );
+ }
+ return this._dummyTokenContracts;
+ }
+ public async deployProxyAsync(): Promise<ERC20ProxyContract> {
+ this._proxyContract = await ERC20ProxyContract.deployFrom0xArtifactAsync(
+ artifacts.ERC20Proxy,
+ this._provider,
+ txDefaults,
+ );
+ this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync();
+ return this._proxyContract;
+ }
+ public getProxyId(): string {
+ this._validateProxyContractExistsOrThrow();
+ return this._proxyIdIfExists as string;
+ }
+ public async setBalancesAndAllowancesAsync(): Promise<void> {
+ this._validateDummyTokenContractsExistOrThrow();
+ this._validateProxyContractExistsOrThrow();
+ for (const dummyTokenContract of this._dummyTokenContracts) {
+ for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
+ await this._web3Wrapper.awaitTransactionSuccessAsync(
+ await dummyTokenContract.setBalance.sendTransactionAsync(
+ tokenOwnerAddress,
+ constants.INITIAL_ERC20_BALANCE,
+ { from: this._contractOwnerAddress },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await this._web3Wrapper.awaitTransactionSuccessAsync(
+ await dummyTokenContract.approve.sendTransactionAsync(
+ (this._proxyContract as ERC20ProxyContract).address,
+ constants.INITIAL_ERC20_ALLOWANCE,
+ { from: tokenOwnerAddress },
+ ),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ }
+ }
+ }
+ public async getBalanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
+ const tokenContract = this._getTokenContractFromAssetData(assetData);
+ const balance = new BigNumber(await tokenContract.balanceOf.callAsync(userAddress));
+ return balance;
+ }
+ public async setBalanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise<void> {
+ const tokenContract = this._getTokenContractFromAssetData(assetData);
+ await this._web3Wrapper.awaitTransactionSuccessAsync(
+ await tokenContract.setBalance.sendTransactionAsync(userAddress, amount, {
+ from: this._contractOwnerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ }
+ public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
+ const tokenContract = this._getTokenContractFromAssetData(assetData);
+ const proxyAddress = (this._proxyContract as ERC20ProxyContract).address;
+ const allowance = new BigNumber(await tokenContract.allowance.callAsync(userAddress, proxyAddress));
+ return allowance;
+ }
+ public async setAllowanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise<void> {
+ const tokenContract = this._getTokenContractFromAssetData(assetData);
+ const proxyAddress = (this._proxyContract as ERC20ProxyContract).address;
+ await this._web3Wrapper.awaitTransactionSuccessAsync(
+ await tokenContract.approve.sendTransactionAsync(proxyAddress, amount, {
+ from: userAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ }
+ public async getBalancesAsync(): Promise<ERC20BalancesByOwner> {
+ this._validateDummyTokenContractsExistOrThrow();
+ const balancesByOwner: ERC20BalancesByOwner = {};
+ const balances: BigNumber[] = [];
+ const balanceInfo: Array<{ tokenOwnerAddress: string; tokenAddress: string }> = [];
+ for (const dummyTokenContract of this._dummyTokenContracts) {
+ for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
+ balances.push(await dummyTokenContract.balanceOf.callAsync(tokenOwnerAddress));
+ balanceInfo.push({
+ tokenOwnerAddress,
+ tokenAddress: dummyTokenContract.address,
+ });
+ }
+ }
+ _.forEach(balances, (balance, balanceIndex) => {
+ const tokenAddress = balanceInfo[balanceIndex].tokenAddress;
+ const tokenOwnerAddress = balanceInfo[balanceIndex].tokenOwnerAddress;
+ if (_.isUndefined(balancesByOwner[tokenOwnerAddress])) {
+ balancesByOwner[tokenOwnerAddress] = {};
+ }
+ const wrappedBalance = new BigNumber(balance);
+ balancesByOwner[tokenOwnerAddress][tokenAddress] = wrappedBalance;
+ });
+ return balancesByOwner;
+ }
+ public addDummyTokenContract(dummy: DummyERC20TokenContract): void {
+ if (!_.isUndefined(this._dummyTokenContracts)) {
+ this._dummyTokenContracts.push(dummy);
+ }
+ }
+ public addTokenOwnerAddress(address: string): void {
+ this._tokenOwnerAddresses.push(address);
+ }
+ public getTokenOwnerAddresses(): string[] {
+ return this._tokenOwnerAddresses;
+ }
+ public getTokenAddresses(): string[] {
+ const tokenAddresses = _.map(this._dummyTokenContracts, dummyTokenContract => dummyTokenContract.address);
+ return tokenAddresses;
+ }
+ private _getTokenContractFromAssetData(assetData: string): DummyERC20TokenContract {
+ const erc20ProxyData = assetDataUtils.decodeERC20AssetData(assetData);
+ const tokenAddress = erc20ProxyData.tokenAddress;
+ const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
+ if (_.isUndefined(tokenContractIfExists)) {
+ throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`);
+ }
+ return tokenContractIfExists;
+ }
+ private _validateDummyTokenContractsExistOrThrow(): void {
+ if (_.isUndefined(this._dummyTokenContracts)) {
+ throw new Error('Dummy ERC20 tokens not yet deployed, please call "deployDummyTokensAsync"');
+ }
+ }
+ private _validateProxyContractExistsOrThrow(): void {
+ if (_.isUndefined(this._proxyContract)) {
+ throw new Error('ERC20 proxy contract not yet deployed, please call "deployProxyAsync"');
+ }
+ }
+}
diff --git a/contracts/protocol/test/utils/erc721_wrapper.ts b/contracts/protocol/test/utils/erc721_wrapper.ts
new file mode 100644
index 000000000..1f658ce86
--- /dev/null
+++ b/contracts/protocol/test/utils/erc721_wrapper.ts
@@ -0,0 +1,236 @@
+import { constants, ERC721TokenIdsByOwner, txDefaults } from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts, DummyERC721TokenContract } from '@0x/contracts-tokens';
+import { generatePseudoRandomSalt } from '@0x/order-utils';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import { Provider } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
+import { artifacts } from '../../src/artifacts';
+
+export class ERC721Wrapper {
+ private readonly _tokenOwnerAddresses: string[];
+ private readonly _contractOwnerAddress: string;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _provider: Provider;
+ private readonly _dummyTokenContracts: DummyERC721TokenContract[];
+ private _proxyContract?: ERC721ProxyContract;
+ private _proxyIdIfExists?: string;
+ private _initialTokenIdsByOwner: ERC721TokenIdsByOwner = {};
+ constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
+ this._web3Wrapper = new Web3Wrapper(provider);
+ this._provider = provider;
+ this._dummyTokenContracts = [];
+ this._tokenOwnerAddresses = tokenOwnerAddresses;
+ this._contractOwnerAddress = contractOwnerAddress;
+ }
+ public async deployDummyTokensAsync(): Promise<DummyERC721TokenContract[]> {
+ // tslint:disable-next-line:no-unused-variable
+ for (const i of _.times(constants.NUM_DUMMY_ERC721_TO_DEPLOY)) {
+ this._dummyTokenContracts.push(
+ await DummyERC721TokenContract.deployFrom0xArtifactAsync(
+ tokensArtifacts.DummyERC721Token,
+ this._provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ ),
+ );
+ }
+ return this._dummyTokenContracts;
+ }
+ public async deployProxyAsync(): Promise<ERC721ProxyContract> {
+ this._proxyContract = await ERC721ProxyContract.deployFrom0xArtifactAsync(
+ artifacts.ERC721Proxy,
+ this._provider,
+ txDefaults,
+ );
+ this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync();
+ return this._proxyContract;
+ }
+ public getProxyId(): string {
+ this._validateProxyContractExistsOrThrow();
+ return this._proxyIdIfExists as string;
+ }
+ public async setBalancesAndAllowancesAsync(): Promise<void> {
+ this._validateDummyTokenContractsExistOrThrow();
+ this._validateProxyContractExistsOrThrow();
+ this._initialTokenIdsByOwner = {};
+ for (const dummyTokenContract of this._dummyTokenContracts) {
+ for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
+ // tslint:disable-next-line:no-unused-variable
+ for (const i of _.times(constants.NUM_ERC721_TOKENS_TO_MINT)) {
+ const tokenId = generatePseudoRandomSalt();
+ await this.mintAsync(dummyTokenContract.address, tokenId, tokenOwnerAddress);
+ if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress])) {
+ this._initialTokenIdsByOwner[tokenOwnerAddress] = {
+ [dummyTokenContract.address]: [],
+ };
+ }
+ if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address])) {
+ this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address] = [];
+ }
+ this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address].push(tokenId);
+
+ await this.approveProxyAsync(dummyTokenContract.address, tokenId);
+ }
+ }
+ }
+ }
+ public async doesTokenExistAsync(tokenAddress: string, tokenId: BigNumber): Promise<boolean> {
+ const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
+ const owner = await tokenContract.ownerOf.callAsync(tokenId);
+ const doesExist = owner !== constants.NULL_ADDRESS;
+ return doesExist;
+ }
+ public async approveProxyAsync(tokenAddress: string, tokenId: BigNumber): Promise<void> {
+ const proxyAddress = (this._proxyContract as ERC721ProxyContract).address;
+ await this.approveAsync(proxyAddress, tokenAddress, tokenId);
+ }
+ public async approveProxyForAllAsync(tokenAddress: string, tokenId: BigNumber, isApproved: boolean): Promise<void> {
+ const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
+ const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId);
+ const proxyAddress = (this._proxyContract as ERC721ProxyContract).address;
+ await this._web3Wrapper.awaitTransactionSuccessAsync(
+ await tokenContract.setApprovalForAll.sendTransactionAsync(proxyAddress, isApproved, {
+ from: tokenOwner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ }
+ public async approveAsync(to: string, tokenAddress: string, tokenId: BigNumber): Promise<void> {
+ const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
+ const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId);
+ await this._web3Wrapper.awaitTransactionSuccessAsync(
+ await tokenContract.approve.sendTransactionAsync(to, tokenId, {
+ from: tokenOwner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ }
+ public async transferFromAsync(
+ tokenAddress: string,
+ tokenId: BigNumber,
+ currentOwner: string,
+ userAddress: string,
+ ): Promise<void> {
+ const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
+ await this._web3Wrapper.awaitTransactionSuccessAsync(
+ await tokenContract.transferFrom.sendTransactionAsync(currentOwner, userAddress, tokenId, {
+ from: currentOwner,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ }
+ public async mintAsync(tokenAddress: string, tokenId: BigNumber, userAddress: string): Promise<void> {
+ const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
+ await this._web3Wrapper.awaitTransactionSuccessAsync(
+ await tokenContract.mint.sendTransactionAsync(userAddress, tokenId, {
+ from: this._contractOwnerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ }
+ public async burnAsync(tokenAddress: string, tokenId: BigNumber, owner: string): Promise<void> {
+ const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
+ await this._web3Wrapper.awaitTransactionSuccessAsync(
+ await tokenContract.burn.sendTransactionAsync(owner, tokenId, {
+ from: this._contractOwnerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ }
+ public async ownerOfAsync(tokenAddress: string, tokenId: BigNumber): Promise<string> {
+ const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
+ const owner = await tokenContract.ownerOf.callAsync(tokenId);
+ return owner;
+ }
+ public async isOwnerAsync(userAddress: string, tokenAddress: string, tokenId: BigNumber): Promise<boolean> {
+ const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
+ const tokenOwner = await tokenContract.ownerOf.callAsync(tokenId);
+ const isOwner = tokenOwner === userAddress;
+ return isOwner;
+ }
+ public async isProxyApprovedForAllAsync(userAddress: string, tokenAddress: string): Promise<boolean> {
+ this._validateProxyContractExistsOrThrow();
+ const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
+ const operator = (this._proxyContract as ERC721ProxyContract).address;
+ const didApproveAll = await tokenContract.isApprovedForAll.callAsync(userAddress, operator);
+ return didApproveAll;
+ }
+ public async isProxyApprovedAsync(tokenAddress: string, tokenId: BigNumber): Promise<boolean> {
+ this._validateProxyContractExistsOrThrow();
+ const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
+ const approvedAddress = await tokenContract.getApproved.callAsync(tokenId);
+ const proxyAddress = (this._proxyContract as ERC721ProxyContract).address;
+ const isProxyAnApprovedOperator = approvedAddress === proxyAddress;
+ return isProxyAnApprovedOperator;
+ }
+ public async getBalancesAsync(): Promise<ERC721TokenIdsByOwner> {
+ this._validateDummyTokenContractsExistOrThrow();
+ this._validateBalancesAndAllowancesSetOrThrow();
+ const tokenIdsByOwner: ERC721TokenIdsByOwner = {};
+ const tokenOwnerAddresses: string[] = [];
+ const tokenInfo: Array<{ tokenId: BigNumber; tokenAddress: string }> = [];
+ for (const dummyTokenContract of this._dummyTokenContracts) {
+ for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
+ const initialTokenOwnerIds = this._initialTokenIdsByOwner[tokenOwnerAddress][
+ dummyTokenContract.address
+ ];
+ for (const tokenId of initialTokenOwnerIds) {
+ tokenOwnerAddresses.push(await dummyTokenContract.ownerOf.callAsync(tokenId));
+ tokenInfo.push({
+ tokenId,
+ tokenAddress: dummyTokenContract.address,
+ });
+ }
+ }
+ }
+ _.forEach(tokenOwnerAddresses, (tokenOwnerAddress, ownerIndex) => {
+ const tokenAddress = tokenInfo[ownerIndex].tokenAddress;
+ const tokenId = tokenInfo[ownerIndex].tokenId;
+ if (_.isUndefined(tokenIdsByOwner[tokenOwnerAddress])) {
+ tokenIdsByOwner[tokenOwnerAddress] = {
+ [tokenAddress]: [],
+ };
+ }
+ if (_.isUndefined(tokenIdsByOwner[tokenOwnerAddress][tokenAddress])) {
+ tokenIdsByOwner[tokenOwnerAddress][tokenAddress] = [];
+ }
+ tokenIdsByOwner[tokenOwnerAddress][tokenAddress].push(tokenId);
+ });
+ return tokenIdsByOwner;
+ }
+ public getTokenOwnerAddresses(): string[] {
+ return this._tokenOwnerAddresses;
+ }
+ public getTokenAddresses(): string[] {
+ const tokenAddresses = _.map(this._dummyTokenContracts, dummyTokenContract => dummyTokenContract.address);
+ return tokenAddresses;
+ }
+ private _getTokenContractFromAssetData(tokenAddress: string): DummyERC721TokenContract {
+ const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
+ if (_.isUndefined(tokenContractIfExists)) {
+ throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`);
+ }
+ return tokenContractIfExists;
+ }
+ private _validateDummyTokenContractsExistOrThrow(): void {
+ if (_.isUndefined(this._dummyTokenContracts)) {
+ throw new Error('Dummy ERC721 tokens not yet deployed, please call "deployDummyTokensAsync"');
+ }
+ }
+ private _validateProxyContractExistsOrThrow(): void {
+ if (_.isUndefined(this._proxyContract)) {
+ throw new Error('ERC721 proxy contract not yet deployed, please call "deployProxyAsync"');
+ }
+ }
+ private _validateBalancesAndAllowancesSetOrThrow(): void {
+ if (_.keys(this._initialTokenIdsByOwner).length === 0) {
+ throw new Error(
+ 'Dummy ERC721 balances and allowances not yet set, please call "setBalancesAndAllowancesAsync"',
+ );
+ }
+ }
+}
diff --git a/contracts/protocol/test/utils/exchange_wrapper.ts b/contracts/protocol/test/utils/exchange_wrapper.ts
new file mode 100644
index 000000000..cb6dce901
--- /dev/null
+++ b/contracts/protocol/test/utils/exchange_wrapper.ts
@@ -0,0 +1,281 @@
+import {
+ FillResults,
+ formatters,
+ LogDecoder,
+ OrderInfo,
+ orderUtils,
+ SignedTransaction,
+} from '@0x/contracts-test-utils';
+import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+
+import { ExchangeContract } from '../../generated-wrappers/exchange';
+import { artifacts } from '../../src/artifacts';
+
+export class ExchangeWrapper {
+ private readonly _exchange: ExchangeContract;
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _logDecoder: LogDecoder;
+ constructor(exchangeContract: ExchangeContract, provider: Provider) {
+ this._exchange = exchangeContract;
+ this._web3Wrapper = new Web3Wrapper(provider);
+ this._logDecoder = new LogDecoder(this._web3Wrapper, { ...artifacts, ...tokensArtifacts });
+ }
+ public async fillOrderAsync(
+ signedOrder: SignedOrder,
+ from: string,
+ opts: { takerAssetFillAmount?: BigNumber } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
+ const txHash = await this._exchange.fillOrder.sendTransactionAsync(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ { from },
+ );
+ const txReceipt = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return txReceipt;
+ }
+ public async cancelOrderAsync(signedOrder: SignedOrder, from: string): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createCancel(signedOrder);
+ const txHash = await this._exchange.cancelOrder.sendTransactionAsync(params.order, { from });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async fillOrKillOrderAsync(
+ signedOrder: SignedOrder,
+ from: string,
+ opts: { takerAssetFillAmount?: BigNumber } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
+ const txHash = await this._exchange.fillOrKillOrder.sendTransactionAsync(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ { from },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async fillOrderNoThrowAsync(
+ signedOrder: SignedOrder,
+ from: string,
+ opts: { takerAssetFillAmount?: BigNumber; gas?: number } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
+ const txHash = await this._exchange.fillOrderNoThrow.sendTransactionAsync(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ { from, gas: opts.gas },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async batchFillOrdersAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { takerAssetFillAmounts?: BigNumber[] } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
+ const txHash = await this._exchange.batchFillOrders.sendTransactionAsync(
+ params.orders,
+ params.takerAssetFillAmounts,
+ params.signatures,
+ { from },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async batchFillOrKillOrdersAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { takerAssetFillAmounts?: BigNumber[] } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
+ const txHash = await this._exchange.batchFillOrKillOrders.sendTransactionAsync(
+ params.orders,
+ params.takerAssetFillAmounts,
+ params.signatures,
+ { from },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async batchFillOrdersNoThrowAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { takerAssetFillAmounts?: BigNumber[]; gas?: number } = {},
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
+ const txHash = await this._exchange.batchFillOrdersNoThrow.sendTransactionAsync(
+ params.orders,
+ params.takerAssetFillAmounts,
+ params.signatures,
+ { from, gas: opts.gas },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async marketSellOrdersAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { takerAssetFillAmount: BigNumber },
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount);
+ const txHash = await this._exchange.marketSellOrders.sendTransactionAsync(
+ params.orders,
+ params.takerAssetFillAmount,
+ params.signatures,
+ { from },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async marketSellOrdersNoThrowAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { takerAssetFillAmount: BigNumber; gas?: number },
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount);
+ const txHash = await this._exchange.marketSellOrdersNoThrow.sendTransactionAsync(
+ params.orders,
+ params.takerAssetFillAmount,
+ params.signatures,
+ { from, gas: opts.gas },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async marketBuyOrdersAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { makerAssetFillAmount: BigNumber },
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
+ const txHash = await this._exchange.marketBuyOrders.sendTransactionAsync(
+ params.orders,
+ params.makerAssetFillAmount,
+ params.signatures,
+ { from },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async marketBuyOrdersNoThrowAsync(
+ orders: SignedOrder[],
+ from: string,
+ opts: { makerAssetFillAmount: BigNumber; gas?: number },
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
+ const txHash = await this._exchange.marketBuyOrdersNoThrow.sendTransactionAsync(
+ params.orders,
+ params.makerAssetFillAmount,
+ params.signatures,
+ { from, gas: opts.gas },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async batchCancelOrdersAsync(
+ orders: SignedOrder[],
+ from: string,
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = formatters.createBatchCancel(orders);
+ const txHash = await this._exchange.batchCancelOrders.sendTransactionAsync(params.orders, { from });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async cancelOrdersUpToAsync(salt: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._exchange.cancelOrdersUpTo.sendTransactionAsync(salt, { from });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async registerAssetProxyAsync(
+ assetProxyAddress: string,
+ from: string,
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._exchange.registerAssetProxy.sendTransactionAsync(assetProxyAddress, { from });
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async executeTransactionAsync(
+ signedTx: SignedTransaction,
+ from: string,
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const txHash = await this._exchange.executeTransaction.sendTransactionAsync(
+ signedTx.salt,
+ signedTx.signerAddress,
+ signedTx.data,
+ signedTx.signature,
+ { from },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async getTakerAssetFilledAmountAsync(orderHashHex: string): Promise<BigNumber> {
+ const filledAmount = await this._exchange.filled.callAsync(orderHashHex);
+ return filledAmount;
+ }
+ public async isCancelledAsync(orderHashHex: string): Promise<boolean> {
+ const isCancelled = await this._exchange.cancelled.callAsync(orderHashHex);
+ return isCancelled;
+ }
+ public async getOrderEpochAsync(makerAddress: string, senderAddress: string): Promise<BigNumber> {
+ const orderEpoch = await this._exchange.orderEpoch.callAsync(makerAddress, senderAddress);
+ return orderEpoch;
+ }
+ public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> {
+ const orderInfo = await this._exchange.getOrderInfo.callAsync(signedOrder);
+ return orderInfo;
+ }
+ public async getOrdersInfoAsync(signedOrders: SignedOrder[]): Promise<OrderInfo[]> {
+ const ordersInfo = (await this._exchange.getOrdersInfo.callAsync(signedOrders)) as OrderInfo[];
+ return ordersInfo;
+ }
+ public async matchOrdersAsync(
+ signedOrderLeft: SignedOrder,
+ signedOrderRight: SignedOrder,
+ from: string,
+ ): Promise<TransactionReceiptWithDecodedLogs> {
+ const params = orderUtils.createMatchOrders(signedOrderLeft, signedOrderRight);
+ const txHash = await this._exchange.matchOrders.sendTransactionAsync(
+ params.left,
+ params.right,
+ params.leftSignature,
+ params.rightSignature,
+ { from },
+ );
+ const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
+ return tx;
+ }
+ public async getFillOrderResultsAsync(
+ signedOrder: SignedOrder,
+ from: string,
+ opts: { takerAssetFillAmount?: BigNumber } = {},
+ ): Promise<FillResults> {
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
+ const fillResults = await this._exchange.fillOrder.callAsync(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ { from },
+ );
+ return fillResults;
+ }
+ public abiEncodeFillOrder(signedOrder: SignedOrder, opts: { takerAssetFillAmount?: BigNumber } = {}): string {
+ const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
+ const data = this._exchange.fillOrder.getABIEncodedTransactionData(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ );
+ return data;
+ }
+ public getExchangeAddress(): string {
+ return this._exchange.address;
+ }
+}
diff --git a/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts b/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts
new file mode 100644
index 000000000..5d0ea07a8
--- /dev/null
+++ b/contracts/protocol/test/utils/fill_order_combinatorial_utils.ts
@@ -0,0 +1,928 @@
+import { artifacts as libsArtifacts, TestLibsContract } from '@0x/contracts-libs';
+import {
+ AllowanceAmountScenario,
+ AssetDataScenario,
+ BalanceAmountScenario,
+ chaiSetup,
+ constants,
+ expectTransactionFailedAsync,
+ ExpirationTimeSecondsScenario,
+ FeeRecipientAddressScenario,
+ FillScenario,
+ OrderAssetAmountScenario,
+ orderUtils,
+ signingUtils,
+ TakerAssetFillAmountScenario,
+ TakerScenario,
+ TraderStateScenario,
+} from '@0x/contracts-test-utils';
+import {
+ assetDataUtils,
+ BalanceAndProxyAllowanceLazyStore,
+ ExchangeTransferSimulator,
+ orderHashUtils,
+ OrderStateUtils,
+ OrderValidationUtils,
+} from '@0x/order-utils';
+import { AssetProxyId, RevertReason, SignatureType, SignedOrder } from '@0x/types';
+import { BigNumber, errorUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+import { LogWithDecodedArgs, Provider, TxData } from 'ethereum-types';
+import * as _ from 'lodash';
+import 'make-promises-safe';
+
+import { ExchangeContract, ExchangeFillEventArgs } from '../../generated-wrappers/exchange';
+import { artifacts } from '../../src/artifacts';
+
+import { AssetWrapper } from './asset_wrapper';
+import { ERC20Wrapper } from './erc20_wrapper';
+import { ERC721Wrapper } from './erc721_wrapper';
+import { ExchangeWrapper } from './exchange_wrapper';
+import { OrderFactoryFromScenario } from './order_factory_from_scenario';
+import { SimpleAssetBalanceAndProxyAllowanceFetcher } from './simple_asset_balance_and_proxy_allowance_fetcher';
+import { SimpleOrderFilledCancelledFetcher } from './simple_order_filled_cancelled_fetcher';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+/**
+ * Instantiates a new instance of FillOrderCombinatorialUtils. Since this method has some
+ * required async setup, a factory method is required.
+ * @param web3Wrapper Web3Wrapper instance
+ * @param txDefaults Default Ethereum tx options
+ * @return FillOrderCombinatorialUtils instance
+ */
+export async function fillOrderCombinatorialUtilsFactoryAsync(
+ web3Wrapper: Web3Wrapper,
+ txDefaults: Partial<TxData>,
+): Promise<FillOrderCombinatorialUtils> {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ const userAddresses = _.slice(accounts, 0, 5);
+ const [ownerAddress, makerAddress, takerAddress] = userAddresses;
+ const makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[userAddresses.indexOf(makerAddress)];
+
+ const provider = web3Wrapper.getProvider();
+ const erc20Wrapper = new ERC20Wrapper(provider, userAddresses, ownerAddress);
+ const erc721Wrapper = new ERC721Wrapper(provider, userAddresses, ownerAddress);
+
+ const erc20EighteenDecimalTokenCount = 3;
+ const eighteenDecimals = new BigNumber(18);
+ const [
+ erc20EighteenDecimalTokenA,
+ erc20EighteenDecimalTokenB,
+ zrxToken,
+ ] = await erc20Wrapper.deployDummyTokensAsync(erc20EighteenDecimalTokenCount, eighteenDecimals);
+ const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
+
+ const erc20FiveDecimalTokenCount = 2;
+ const fiveDecimals = new BigNumber(5);
+ const [erc20FiveDecimalTokenA, erc20FiveDecimalTokenB] = await erc20Wrapper.deployDummyTokensAsync(
+ erc20FiveDecimalTokenCount,
+ fiveDecimals,
+ );
+ const zeroDecimals = new BigNumber(0);
+ const erc20ZeroDecimalTokenCount = 2;
+ const [erc20ZeroDecimalTokenA, erc20ZeroDecimalTokenB] = await erc20Wrapper.deployDummyTokensAsync(
+ erc20ZeroDecimalTokenCount,
+ zeroDecimals,
+ );
+ const erc20Proxy = await erc20Wrapper.deployProxyAsync();
+ await erc20Wrapper.setBalancesAndAllowancesAsync();
+
+ const [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
+ const erc721Proxy = await erc721Wrapper.deployProxyAsync();
+ await erc721Wrapper.setBalancesAndAllowancesAsync();
+ const erc721Balances = await erc721Wrapper.getBalancesAsync();
+
+ const assetWrapper = new AssetWrapper([erc20Wrapper, erc721Wrapper]);
+
+ const exchangeContract = await ExchangeContract.deployFrom0xArtifactAsync(
+ artifacts.Exchange,
+ provider,
+ txDefaults,
+ zrxAssetData,
+ );
+ const exchangeWrapper = new ExchangeWrapper(exchangeContract, provider);
+ await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, ownerAddress);
+ await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, ownerAddress);
+
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeContract.address, {
+ from: ownerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeContract.address, {
+ from: ownerAddress,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const orderFactory = new OrderFactoryFromScenario(
+ userAddresses,
+ zrxToken.address,
+ [erc20EighteenDecimalTokenA.address, erc20EighteenDecimalTokenB.address],
+ [erc20FiveDecimalTokenA.address, erc20FiveDecimalTokenB.address],
+ [erc20ZeroDecimalTokenA.address, erc20ZeroDecimalTokenB.address],
+ erc721Token,
+ erc721Balances,
+ exchangeContract.address,
+ );
+
+ const testLibsContract = await TestLibsContract.deployFrom0xArtifactAsync(
+ libsArtifacts.TestLibs,
+ provider,
+ txDefaults,
+ );
+
+ const fillOrderCombinatorialUtils = new FillOrderCombinatorialUtils(
+ orderFactory,
+ ownerAddress,
+ makerAddress,
+ makerPrivateKey,
+ takerAddress,
+ zrxAssetData,
+ exchangeWrapper,
+ assetWrapper,
+ testLibsContract,
+ );
+ return fillOrderCombinatorialUtils;
+}
+
+export class FillOrderCombinatorialUtils {
+ public orderFactory: OrderFactoryFromScenario;
+ public ownerAddress: string;
+ public makerAddress: string;
+ public makerPrivateKey: Buffer;
+ public takerAddress: string;
+ public zrxAssetData: string;
+ public exchangeWrapper: ExchangeWrapper;
+ public assetWrapper: AssetWrapper;
+ public testLibsContract: TestLibsContract;
+ public static generateFillOrderCombinations(): FillScenario[] {
+ const takerScenarios = [
+ TakerScenario.Unspecified,
+ // TakerScenario.CorrectlySpecified,
+ // TakerScenario.IncorrectlySpecified,
+ ];
+ const feeRecipientScenarios = [
+ FeeRecipientAddressScenario.EthUserAddress,
+ // FeeRecipientAddressScenario.BurnAddress,
+ ];
+ const makerAssetAmountScenario = [
+ OrderAssetAmountScenario.Large,
+ // OrderAssetAmountScenario.Zero,
+ // OrderAssetAmountScenario.Small,
+ ];
+ const takerAssetAmountScenario = [
+ OrderAssetAmountScenario.Large,
+ // OrderAssetAmountScenario.Zero,
+ // OrderAssetAmountScenario.Small,
+ ];
+ const makerFeeScenario = [
+ OrderAssetAmountScenario.Large,
+ // OrderAssetAmountScenario.Small,
+ // OrderAssetAmountScenario.Zero,
+ ];
+ const takerFeeScenario = [
+ OrderAssetAmountScenario.Large,
+ // OrderAssetAmountScenario.Small,
+ // OrderAssetAmountScenario.Zero,
+ ];
+ const expirationTimeSecondsScenario = [
+ ExpirationTimeSecondsScenario.InFuture,
+ ExpirationTimeSecondsScenario.InPast,
+ ];
+ const makerAssetDataScenario = [
+ AssetDataScenario.ERC20FiveDecimals,
+ AssetDataScenario.ERC20NonZRXEighteenDecimals,
+ AssetDataScenario.ERC721,
+ AssetDataScenario.ZRXFeeToken,
+ ];
+ const takerAssetDataScenario = [
+ AssetDataScenario.ERC20FiveDecimals,
+ AssetDataScenario.ERC20NonZRXEighteenDecimals,
+ AssetDataScenario.ERC721,
+ AssetDataScenario.ZRXFeeToken,
+ ];
+ const takerAssetFillAmountScenario = [
+ TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
+ // TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount,
+ // TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount,
+ ];
+ const makerAssetBalanceScenario = [
+ BalanceAmountScenario.Higher,
+ // BalanceAmountScenario.Exact,
+ // BalanceAmountScenario.TooLow,
+ ];
+ const makerAssetAllowanceScenario = [
+ AllowanceAmountScenario.Higher,
+ // AllowanceAmountScenario.Exact,
+ // AllowanceAmountScenario.TooLow,
+ // AllowanceAmountScenario.Unlimited,
+ ];
+ const makerZRXBalanceScenario = [
+ BalanceAmountScenario.Higher,
+ // BalanceAmountScenario.Exact,
+ // BalanceAmountScenario.TooLow,
+ ];
+ const makerZRXAllowanceScenario = [
+ AllowanceAmountScenario.Higher,
+ // AllowanceAmountScenario.Exact,
+ // AllowanceAmountScenario.TooLow,
+ // AllowanceAmountScenario.Unlimited,
+ ];
+ const takerAssetBalanceScenario = [
+ BalanceAmountScenario.Higher,
+ // BalanceAmountScenario.Exact,
+ // BalanceAmountScenario.TooLow,
+ ];
+ const takerAssetAllowanceScenario = [
+ AllowanceAmountScenario.Higher,
+ // AllowanceAmountScenario.Exact,
+ // AllowanceAmountScenario.TooLow,
+ // AllowanceAmountScenario.Unlimited,
+ ];
+ const takerZRXBalanceScenario = [
+ BalanceAmountScenario.Higher,
+ // BalanceAmountScenario.Exact,
+ // BalanceAmountScenario.TooLow,
+ ];
+ const takerZRXAllowanceScenario = [
+ AllowanceAmountScenario.Higher,
+ // AllowanceAmountScenario.Exact,
+ // AllowanceAmountScenario.TooLow,
+ // AllowanceAmountScenario.Unlimited,
+ ];
+ const fillScenarioArrays = FillOrderCombinatorialUtils._getAllCombinations([
+ takerScenarios,
+ feeRecipientScenarios,
+ makerAssetAmountScenario,
+ takerAssetAmountScenario,
+ makerFeeScenario,
+ takerFeeScenario,
+ expirationTimeSecondsScenario,
+ makerAssetDataScenario,
+ takerAssetDataScenario,
+ takerAssetFillAmountScenario,
+ makerAssetBalanceScenario,
+ makerAssetAllowanceScenario,
+ makerZRXBalanceScenario,
+ makerZRXAllowanceScenario,
+ takerAssetBalanceScenario,
+ takerAssetAllowanceScenario,
+ takerZRXBalanceScenario,
+ takerZRXAllowanceScenario,
+ ]);
+
+ const fillScenarios = _.map(fillScenarioArrays, fillScenarioArray => {
+ // tslint:disable:custom-no-magic-numbers
+ const fillScenario: FillScenario = {
+ orderScenario: {
+ takerScenario: fillScenarioArray[0] as TakerScenario,
+ feeRecipientScenario: fillScenarioArray[1] as FeeRecipientAddressScenario,
+ makerAssetAmountScenario: fillScenarioArray[2] as OrderAssetAmountScenario,
+ takerAssetAmountScenario: fillScenarioArray[3] as OrderAssetAmountScenario,
+ makerFeeScenario: fillScenarioArray[4] as OrderAssetAmountScenario,
+ takerFeeScenario: fillScenarioArray[5] as OrderAssetAmountScenario,
+ expirationTimeSecondsScenario: fillScenarioArray[6] as ExpirationTimeSecondsScenario,
+ makerAssetDataScenario: fillScenarioArray[7] as AssetDataScenario,
+ takerAssetDataScenario: fillScenarioArray[8] as AssetDataScenario,
+ },
+ takerAssetFillAmountScenario: fillScenarioArray[9] as TakerAssetFillAmountScenario,
+ makerStateScenario: {
+ traderAssetBalance: fillScenarioArray[10] as BalanceAmountScenario,
+ traderAssetAllowance: fillScenarioArray[11] as AllowanceAmountScenario,
+ zrxFeeBalance: fillScenarioArray[12] as BalanceAmountScenario,
+ zrxFeeAllowance: fillScenarioArray[13] as AllowanceAmountScenario,
+ },
+ takerStateScenario: {
+ traderAssetBalance: fillScenarioArray[14] as BalanceAmountScenario,
+ traderAssetAllowance: fillScenarioArray[15] as AllowanceAmountScenario,
+ zrxFeeBalance: fillScenarioArray[16] as BalanceAmountScenario,
+ zrxFeeAllowance: fillScenarioArray[17] as AllowanceAmountScenario,
+ },
+ };
+ // tslint:enable:custom-no-magic-numbers
+ return fillScenario;
+ });
+
+ return fillScenarios;
+ }
+ /**
+ * Recursive implementation of generating all combinations of the supplied
+ * string-containing arrays.
+ */
+ private static _getAllCombinations(arrays: string[][]): string[][] {
+ // Base case
+ if (arrays.length === 1) {
+ const remainingValues = _.map(arrays[0], val => {
+ return [val];
+ });
+ return remainingValues;
+ } else {
+ const result = [];
+ const restOfArrays = arrays.slice(1);
+ const allCombinationsOfRemaining = FillOrderCombinatorialUtils._getAllCombinations(restOfArrays); // recur with the rest of array
+ // tslint:disable:prefer-for-of
+ for (let i = 0; i < allCombinationsOfRemaining.length; i++) {
+ for (let j = 0; j < arrays[0].length; j++) {
+ result.push([arrays[0][j], ...allCombinationsOfRemaining[i]]);
+ }
+ }
+ // tslint:enable:prefer-for-of
+ return result;
+ }
+ }
+ constructor(
+ orderFactory: OrderFactoryFromScenario,
+ ownerAddress: string,
+ makerAddress: string,
+ makerPrivateKey: Buffer,
+ takerAddress: string,
+ zrxAssetData: string,
+ exchangeWrapper: ExchangeWrapper,
+ assetWrapper: AssetWrapper,
+ testLibsContract: TestLibsContract,
+ ) {
+ this.orderFactory = orderFactory;
+ this.ownerAddress = ownerAddress;
+ this.makerAddress = makerAddress;
+ this.makerPrivateKey = makerPrivateKey;
+ this.takerAddress = takerAddress;
+ this.zrxAssetData = zrxAssetData;
+ this.exchangeWrapper = exchangeWrapper;
+ this.assetWrapper = assetWrapper;
+ this.testLibsContract = testLibsContract;
+ }
+ public async testFillOrderScenarioAsync(
+ provider: Provider,
+ fillScenario: FillScenario,
+ isVerbose: boolean = false,
+ ): Promise<void> {
+ // 1. Generate order
+ const order = this.orderFactory.generateOrder(fillScenario.orderScenario);
+
+ // 2. Sign order
+ const orderHashBuff = orderHashUtils.getOrderHashBuffer(order);
+ const signature = signingUtils.signMessage(orderHashBuff, this.makerPrivateKey, SignatureType.EthSign);
+ const signedOrder = {
+ ...order,
+ signature: `0x${signature.toString('hex')}`,
+ };
+
+ const balanceAndProxyAllowanceFetcher = new SimpleAssetBalanceAndProxyAllowanceFetcher(this.assetWrapper);
+ const orderFilledCancelledFetcher = new SimpleOrderFilledCancelledFetcher(
+ this.exchangeWrapper,
+ this.zrxAssetData,
+ );
+
+ // 3. Figure out fill amount
+ const takerAssetFillAmount = await this._getTakerAssetFillAmountAsync(
+ signedOrder,
+ fillScenario.takerAssetFillAmountScenario,
+ balanceAndProxyAllowanceFetcher,
+ orderFilledCancelledFetcher,
+ );
+
+ // 4. Permutate the maker and taker balance/allowance scenarios
+ await this._modifyTraderStateAsync(
+ fillScenario.makerStateScenario,
+ fillScenario.takerStateScenario,
+ signedOrder,
+ takerAssetFillAmount,
+ );
+
+ // 5. If I fill it by X, what are the resulting balances/allowances/filled amounts expected?
+ const orderValidationUtils = new OrderValidationUtils(orderFilledCancelledFetcher, provider);
+ const lazyStore = new BalanceAndProxyAllowanceLazyStore(balanceAndProxyAllowanceFetcher);
+ const exchangeTransferSimulator = new ExchangeTransferSimulator(lazyStore);
+
+ let fillRevertReasonIfExists;
+ try {
+ await orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
+ exchangeTransferSimulator,
+ provider,
+ signedOrder,
+ takerAssetFillAmount,
+ this.takerAddress,
+ this.zrxAssetData,
+ );
+ if (isVerbose) {
+ logUtils.log(`Expecting fillOrder to succeed.`);
+ }
+ } catch (err) {
+ fillRevertReasonIfExists = err.message;
+ if (isVerbose) {
+ logUtils.log(`Expecting fillOrder to fail with:`);
+ logUtils.log(err);
+ }
+ }
+
+ // 6. Fill the order
+ await this._fillOrderAndAssertOutcomeAsync(
+ signedOrder,
+ takerAssetFillAmount,
+ lazyStore,
+ fillRevertReasonIfExists,
+ );
+
+ await this._abiEncodeFillOrderAndAssertOutcomeAsync(signedOrder, takerAssetFillAmount);
+ }
+ private async _fillOrderAndAssertOutcomeAsync(
+ signedOrder: SignedOrder,
+ takerAssetFillAmount: BigNumber,
+ lazyStore: BalanceAndProxyAllowanceLazyStore,
+ fillRevertReasonIfExists: RevertReason | undefined,
+ ): Promise<void> {
+ if (!_.isUndefined(fillRevertReasonIfExists)) {
+ return expectTransactionFailedAsync(
+ this.exchangeWrapper.fillOrderAsync(signedOrder, this.takerAddress, { takerAssetFillAmount }),
+ fillRevertReasonIfExists,
+ );
+ }
+
+ const makerAddress = signedOrder.makerAddress;
+ const makerAssetData = signedOrder.makerAssetData;
+ const takerAssetData = signedOrder.takerAssetData;
+ const feeRecipient = signedOrder.feeRecipientAddress;
+
+ const expMakerAssetBalanceOfMaker = await lazyStore.getBalanceAsync(makerAssetData, makerAddress);
+ const expMakerAssetAllowanceOfMaker = await lazyStore.getProxyAllowanceAsync(makerAssetData, makerAddress);
+ const expTakerAssetBalanceOfMaker = await lazyStore.getBalanceAsync(takerAssetData, makerAddress);
+ const expZRXAssetBalanceOfMaker = await lazyStore.getBalanceAsync(this.zrxAssetData, makerAddress);
+ const expZRXAssetAllowanceOfMaker = await lazyStore.getProxyAllowanceAsync(this.zrxAssetData, makerAddress);
+ const expTakerAssetBalanceOfTaker = await lazyStore.getBalanceAsync(takerAssetData, this.takerAddress);
+ const expTakerAssetAllowanceOfTaker = await lazyStore.getProxyAllowanceAsync(takerAssetData, this.takerAddress);
+ const expMakerAssetBalanceOfTaker = await lazyStore.getBalanceAsync(makerAssetData, this.takerAddress);
+ const expZRXAssetBalanceOfTaker = await lazyStore.getBalanceAsync(this.zrxAssetData, this.takerAddress);
+ const expZRXAssetAllowanceOfTaker = await lazyStore.getProxyAllowanceAsync(
+ this.zrxAssetData,
+ this.takerAddress,
+ );
+ const expZRXAssetBalanceOfFeeRecipient = await lazyStore.getBalanceAsync(this.zrxAssetData, feeRecipient);
+
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ const alreadyFilledTakerAmount = await this.exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash);
+ const remainingTakerAmountToFill = signedOrder.takerAssetAmount.minus(alreadyFilledTakerAmount);
+ const expFilledTakerAmount = takerAssetFillAmount.gt(remainingTakerAmountToFill)
+ ? remainingTakerAmountToFill
+ : alreadyFilledTakerAmount.add(takerAssetFillAmount);
+
+ const expFilledMakerAmount = orderUtils.getPartialAmountFloor(
+ expFilledTakerAmount,
+ signedOrder.takerAssetAmount,
+ signedOrder.makerAssetAmount,
+ );
+ const expMakerFeePaid = orderUtils.getPartialAmountFloor(
+ expFilledTakerAmount,
+ signedOrder.takerAssetAmount,
+ signedOrder.makerFee,
+ );
+ const expTakerFeePaid = orderUtils.getPartialAmountFloor(
+ expFilledTakerAmount,
+ signedOrder.takerAssetAmount,
+ signedOrder.takerFee,
+ );
+ const fillResults = await this.exchangeWrapper.getFillOrderResultsAsync(signedOrder, this.takerAddress, {
+ takerAssetFillAmount,
+ });
+ expect(fillResults.takerAssetFilledAmount).to.be.bignumber.equal(
+ expFilledTakerAmount,
+ 'takerAssetFilledAmount',
+ );
+ expect(fillResults.makerAssetFilledAmount).to.be.bignumber.equal(
+ expFilledMakerAmount,
+ 'makerAssetFilledAmount',
+ );
+ expect(fillResults.takerFeePaid).to.be.bignumber.equal(expTakerFeePaid, 'takerFeePaid');
+ expect(fillResults.makerFeePaid).to.be.bignumber.equal(expMakerFeePaid, 'makerFeePaid');
+
+ // - Let's fill the order!
+ const txReceipt = await this.exchangeWrapper.fillOrderAsync(signedOrder, this.takerAddress, {
+ takerAssetFillAmount,
+ });
+
+ const actFilledTakerAmount = await this.exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash);
+ expect(actFilledTakerAmount).to.be.bignumber.equal(expFilledTakerAmount, 'filledTakerAmount');
+
+ const exchangeLogs = _.filter(
+ txReceipt.logs,
+ txLog => txLog.address === this.exchangeWrapper.getExchangeAddress(),
+ );
+ expect(exchangeLogs.length).to.be.equal(1, 'logs length');
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const log = txReceipt.logs[0] as LogWithDecodedArgs<ExchangeFillEventArgs>;
+ expect(log.args.makerAddress).to.be.equal(makerAddress, 'log.args.makerAddress');
+ expect(log.args.takerAddress).to.be.equal(this.takerAddress, 'log.args.this.takerAddress');
+ expect(log.args.feeRecipientAddress).to.be.equal(feeRecipient, 'log.args.feeRecipientAddress');
+ expect(log.args.makerAssetFilledAmount).to.be.bignumber.equal(
+ expFilledMakerAmount,
+ 'log.args.makerAssetFilledAmount',
+ );
+ expect(log.args.takerAssetFilledAmount).to.be.bignumber.equal(
+ expFilledTakerAmount,
+ 'log.args.takerAssetFilledAmount',
+ );
+ expect(log.args.makerFeePaid).to.be.bignumber.equal(expMakerFeePaid, 'log.args.makerFeePaid');
+ expect(log.args.takerFeePaid).to.be.bignumber.equal(expTakerFeePaid, 'logs.args.takerFeePaid');
+ expect(log.args.orderHash).to.be.equal(orderHash, 'log.args.orderHash');
+ expect(log.args.makerAssetData).to.be.equal(makerAssetData, 'log.args.makerAssetData');
+ expect(log.args.takerAssetData).to.be.equal(takerAssetData, 'log.args.takerAssetData');
+
+ const actMakerAssetBalanceOfMaker = await this.assetWrapper.getBalanceAsync(makerAddress, makerAssetData);
+ expect(actMakerAssetBalanceOfMaker).to.be.bignumber.equal(
+ expMakerAssetBalanceOfMaker,
+ 'makerAssetBalanceOfMaker',
+ );
+
+ const actMakerAssetAllowanceOfMaker = await this.assetWrapper.getProxyAllowanceAsync(
+ makerAddress,
+ makerAssetData,
+ );
+ expect(actMakerAssetAllowanceOfMaker).to.be.bignumber.equal(
+ expMakerAssetAllowanceOfMaker,
+ 'makerAssetAllowanceOfMaker',
+ );
+
+ const actTakerAssetBalanceOfMaker = await this.assetWrapper.getBalanceAsync(makerAddress, takerAssetData);
+ expect(actTakerAssetBalanceOfMaker).to.be.bignumber.equal(
+ expTakerAssetBalanceOfMaker,
+ 'takerAssetBalanceOfMaker',
+ );
+
+ const actZRXAssetBalanceOfMaker = await this.assetWrapper.getBalanceAsync(makerAddress, this.zrxAssetData);
+ expect(actZRXAssetBalanceOfMaker).to.be.bignumber.equal(expZRXAssetBalanceOfMaker, 'ZRXAssetBalanceOfMaker');
+
+ const actZRXAssetAllowanceOfMaker = await this.assetWrapper.getProxyAllowanceAsync(
+ makerAddress,
+ this.zrxAssetData,
+ );
+ expect(actZRXAssetAllowanceOfMaker).to.be.bignumber.equal(
+ expZRXAssetAllowanceOfMaker,
+ 'ZRXAssetAllowanceOfMaker',
+ );
+
+ const actTakerAssetBalanceOfTaker = await this.assetWrapper.getBalanceAsync(this.takerAddress, takerAssetData);
+ expect(actTakerAssetBalanceOfTaker).to.be.bignumber.equal(
+ expTakerAssetBalanceOfTaker,
+ 'TakerAssetBalanceOfTaker',
+ );
+
+ const actTakerAssetAllowanceOfTaker = await this.assetWrapper.getProxyAllowanceAsync(
+ this.takerAddress,
+ takerAssetData,
+ );
+
+ expect(actTakerAssetAllowanceOfTaker).to.be.bignumber.equal(
+ expTakerAssetAllowanceOfTaker,
+ 'TakerAssetAllowanceOfTaker',
+ );
+
+ const actMakerAssetBalanceOfTaker = await this.assetWrapper.getBalanceAsync(this.takerAddress, makerAssetData);
+ expect(actMakerAssetBalanceOfTaker).to.be.bignumber.equal(
+ expMakerAssetBalanceOfTaker,
+ 'MakerAssetBalanceOfTaker',
+ );
+
+ const actZRXAssetBalanceOfTaker = await this.assetWrapper.getBalanceAsync(this.takerAddress, this.zrxAssetData);
+ expect(actZRXAssetBalanceOfTaker).to.be.bignumber.equal(expZRXAssetBalanceOfTaker, 'ZRXAssetBalanceOfTaker');
+
+ const actZRXAssetAllowanceOfTaker = await this.assetWrapper.getProxyAllowanceAsync(
+ this.takerAddress,
+ this.zrxAssetData,
+ );
+ expect(actZRXAssetAllowanceOfTaker).to.be.bignumber.equal(
+ expZRXAssetAllowanceOfTaker,
+ 'ZRXAssetAllowanceOfTaker',
+ );
+
+ const actZRXAssetBalanceOfFeeRecipient = await this.assetWrapper.getBalanceAsync(
+ feeRecipient,
+ this.zrxAssetData,
+ );
+ expect(actZRXAssetBalanceOfFeeRecipient).to.be.bignumber.equal(
+ expZRXAssetBalanceOfFeeRecipient,
+ 'ZRXAssetBalanceOfFeeRecipient',
+ );
+ }
+ private async _abiEncodeFillOrderAndAssertOutcomeAsync(
+ signedOrder: SignedOrder,
+ takerAssetFillAmount: BigNumber,
+ ): Promise<void> {
+ const params = orderUtils.createFill(signedOrder, takerAssetFillAmount);
+ const expectedAbiEncodedData = this.exchangeWrapper.abiEncodeFillOrder(signedOrder, { takerAssetFillAmount });
+ const libsAbiEncodedData = await this.testLibsContract.publicAbiEncodeFillOrder.callAsync(
+ params.order,
+ params.takerAssetFillAmount,
+ params.signature,
+ );
+ expect(libsAbiEncodedData).to.be.equal(expectedAbiEncodedData, 'ABIEncodedFillOrderData');
+ }
+ private async _getTakerAssetFillAmountAsync(
+ signedOrder: SignedOrder,
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario,
+ balanceAndProxyAllowanceFetcher: SimpleAssetBalanceAndProxyAllowanceFetcher,
+ orderFilledCancelledFetcher: SimpleOrderFilledCancelledFetcher,
+ ): Promise<BigNumber> {
+ const orderStateUtils = new OrderStateUtils(balanceAndProxyAllowanceFetcher, orderFilledCancelledFetcher);
+ const fillableTakerAssetAmount = await orderStateUtils.getMaxFillableTakerAssetAmountAsync(
+ signedOrder,
+ this.takerAddress,
+ );
+
+ let takerAssetFillAmount;
+ switch (takerAssetFillAmountScenario) {
+ case TakerAssetFillAmountScenario.Zero:
+ takerAssetFillAmount = new BigNumber(0);
+ break;
+
+ case TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount:
+ takerAssetFillAmount = fillableTakerAssetAmount;
+ break;
+
+ case TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount:
+ takerAssetFillAmount = fillableTakerAssetAmount.add(1);
+ break;
+
+ case TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount:
+ const takerAssetProxyId = assetDataUtils.decodeAssetProxyId(signedOrder.takerAssetData);
+ const makerAssetProxyId = assetDataUtils.decodeAssetProxyId(signedOrder.makerAssetData);
+ const isEitherAssetERC721 =
+ takerAssetProxyId === AssetProxyId.ERC721 || makerAssetProxyId === AssetProxyId.ERC721;
+ if (isEitherAssetERC721) {
+ throw new Error(
+ 'Cannot test `TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount` together with ERC721 assets since orders involving ERC721 must always be filled exactly.',
+ );
+ }
+ takerAssetFillAmount = fillableTakerAssetAmount.div(2).floor();
+ break;
+
+ default:
+ throw errorUtils.spawnSwitchErr('TakerAssetFillAmountScenario', takerAssetFillAmountScenario);
+ }
+
+ return takerAssetFillAmount;
+ }
+ private async _modifyTraderStateAsync(
+ makerStateScenario: TraderStateScenario,
+ takerStateScenario: TraderStateScenario,
+ signedOrder: SignedOrder,
+ takerAssetFillAmount: BigNumber,
+ ): Promise<void> {
+ const makerAssetFillAmount = orderUtils.getPartialAmountFloor(
+ takerAssetFillAmount,
+ signedOrder.takerAssetAmount,
+ signedOrder.makerAssetAmount,
+ );
+ switch (makerStateScenario.traderAssetBalance) {
+ case BalanceAmountScenario.Higher:
+ break; // Noop since this is already the default
+
+ case BalanceAmountScenario.TooLow:
+ if (makerAssetFillAmount.eq(0)) {
+ throw new Error(`Cannot set makerAssetBalanceOfMaker TooLow if makerAssetFillAmount is 0`);
+ }
+ const tooLowBalance = makerAssetFillAmount.minus(1);
+ await this.assetWrapper.setBalanceAsync(
+ signedOrder.makerAddress,
+ signedOrder.makerAssetData,
+ tooLowBalance,
+ );
+ break;
+
+ case BalanceAmountScenario.Exact:
+ const exactBalance = makerAssetFillAmount;
+ await this.assetWrapper.setBalanceAsync(
+ signedOrder.makerAddress,
+ signedOrder.makerAssetData,
+ exactBalance,
+ );
+ break;
+
+ default:
+ throw errorUtils.spawnSwitchErr(
+ 'makerStateScenario.traderAssetBalance',
+ makerStateScenario.traderAssetBalance,
+ );
+ }
+
+ const makerFee = orderUtils.getPartialAmountFloor(
+ takerAssetFillAmount,
+ signedOrder.takerAssetAmount,
+ signedOrder.makerFee,
+ );
+ switch (makerStateScenario.zrxFeeBalance) {
+ case BalanceAmountScenario.Higher:
+ break; // Noop since this is already the default
+
+ case BalanceAmountScenario.TooLow:
+ if (makerFee.eq(0)) {
+ throw new Error(`Cannot set zrxAsserBalanceOfMaker TooLow if makerFee is 0`);
+ }
+ const tooLowBalance = makerFee.minus(1);
+ await this.assetWrapper.setBalanceAsync(signedOrder.makerAddress, this.zrxAssetData, tooLowBalance);
+ break;
+
+ case BalanceAmountScenario.Exact:
+ const exactBalance = makerFee;
+ await this.assetWrapper.setBalanceAsync(signedOrder.makerAddress, this.zrxAssetData, exactBalance);
+ break;
+
+ default:
+ throw errorUtils.spawnSwitchErr('makerStateScenario.zrxFeeBalance', makerStateScenario.zrxFeeBalance);
+ }
+
+ switch (makerStateScenario.traderAssetAllowance) {
+ case AllowanceAmountScenario.Higher:
+ break; // Noop since this is already the default
+
+ case AllowanceAmountScenario.TooLow:
+ const tooLowAllowance = makerAssetFillAmount.minus(1);
+ await this.assetWrapper.setProxyAllowanceAsync(
+ signedOrder.makerAddress,
+ signedOrder.makerAssetData,
+ tooLowAllowance,
+ );
+ break;
+
+ case AllowanceAmountScenario.Exact:
+ const exactAllowance = makerAssetFillAmount;
+ await this.assetWrapper.setProxyAllowanceAsync(
+ signedOrder.makerAddress,
+ signedOrder.makerAssetData,
+ exactAllowance,
+ );
+ break;
+
+ case AllowanceAmountScenario.Unlimited:
+ await this.assetWrapper.setProxyAllowanceAsync(
+ signedOrder.makerAddress,
+ signedOrder.makerAssetData,
+ constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
+ );
+ break;
+
+ default:
+ throw errorUtils.spawnSwitchErr(
+ 'makerStateScenario.traderAssetAllowance',
+ makerStateScenario.traderAssetAllowance,
+ );
+ }
+
+ switch (makerStateScenario.zrxFeeAllowance) {
+ case AllowanceAmountScenario.Higher:
+ break; // Noop since this is already the default
+
+ case AllowanceAmountScenario.TooLow:
+ const tooLowAllowance = makerFee.minus(1);
+ await this.assetWrapper.setProxyAllowanceAsync(
+ signedOrder.makerAddress,
+ this.zrxAssetData,
+ tooLowAllowance,
+ );
+ break;
+
+ case AllowanceAmountScenario.Exact:
+ const exactAllowance = makerFee;
+ await this.assetWrapper.setProxyAllowanceAsync(
+ signedOrder.makerAddress,
+ this.zrxAssetData,
+ exactAllowance,
+ );
+ break;
+
+ case AllowanceAmountScenario.Unlimited:
+ await this.assetWrapper.setProxyAllowanceAsync(
+ signedOrder.makerAddress,
+ this.zrxAssetData,
+ constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
+ );
+ break;
+
+ default:
+ throw errorUtils.spawnSwitchErr(
+ 'makerStateScenario.zrxFeeAllowance',
+ makerStateScenario.zrxFeeAllowance,
+ );
+ }
+
+ switch (takerStateScenario.traderAssetBalance) {
+ case BalanceAmountScenario.Higher:
+ break; // Noop since this is already the default
+
+ case BalanceAmountScenario.TooLow:
+ if (takerAssetFillAmount.eq(0)) {
+ throw new Error(`Cannot set takerAssetBalanceOfTaker TooLow if takerAssetFillAmount is 0`);
+ }
+ const tooLowBalance = takerAssetFillAmount.minus(1);
+ await this.assetWrapper.setBalanceAsync(this.takerAddress, signedOrder.takerAssetData, tooLowBalance);
+ break;
+
+ case BalanceAmountScenario.Exact:
+ const exactBalance = takerAssetFillAmount;
+ await this.assetWrapper.setBalanceAsync(this.takerAddress, signedOrder.takerAssetData, exactBalance);
+ break;
+
+ default:
+ throw errorUtils.spawnSwitchErr(
+ 'takerStateScenario.traderAssetBalance',
+ takerStateScenario.traderAssetBalance,
+ );
+ }
+
+ const takerFee = orderUtils.getPartialAmountFloor(
+ takerAssetFillAmount,
+ signedOrder.takerAssetAmount,
+ signedOrder.takerFee,
+ );
+ switch (takerStateScenario.zrxFeeBalance) {
+ case BalanceAmountScenario.Higher:
+ break; // Noop since this is already the default
+
+ case BalanceAmountScenario.TooLow:
+ if (takerFee.eq(0)) {
+ throw new Error(`Cannot set zrxAssetBalanceOfTaker TooLow if takerFee is 0`);
+ }
+ const tooLowBalance = takerFee.minus(1);
+ await this.assetWrapper.setBalanceAsync(this.takerAddress, this.zrxAssetData, tooLowBalance);
+ break;
+
+ case BalanceAmountScenario.Exact:
+ const exactBalance = takerFee;
+ await this.assetWrapper.setBalanceAsync(this.takerAddress, this.zrxAssetData, exactBalance);
+ break;
+
+ default:
+ throw errorUtils.spawnSwitchErr('takerStateScenario.zrxFeeBalance', takerStateScenario.zrxFeeBalance);
+ }
+
+ switch (takerStateScenario.traderAssetAllowance) {
+ case AllowanceAmountScenario.Higher:
+ break; // Noop since this is already the default
+
+ case AllowanceAmountScenario.TooLow:
+ const tooLowAllowance = takerAssetFillAmount.minus(1);
+ await this.assetWrapper.setProxyAllowanceAsync(
+ this.takerAddress,
+ signedOrder.takerAssetData,
+ tooLowAllowance,
+ );
+ break;
+
+ case AllowanceAmountScenario.Exact:
+ const exactAllowance = takerAssetFillAmount;
+ await this.assetWrapper.setProxyAllowanceAsync(
+ this.takerAddress,
+ signedOrder.takerAssetData,
+ exactAllowance,
+ );
+ break;
+
+ case AllowanceAmountScenario.Unlimited:
+ await this.assetWrapper.setProxyAllowanceAsync(
+ this.takerAddress,
+ signedOrder.takerAssetData,
+ constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
+ );
+ break;
+
+ default:
+ throw errorUtils.spawnSwitchErr(
+ 'takerStateScenario.traderAssetAllowance',
+ takerStateScenario.traderAssetAllowance,
+ );
+ }
+
+ switch (takerStateScenario.zrxFeeAllowance) {
+ case AllowanceAmountScenario.Higher:
+ break; // Noop since this is already the default
+
+ case AllowanceAmountScenario.TooLow:
+ const tooLowAllowance = takerFee.minus(1);
+ await this.assetWrapper.setProxyAllowanceAsync(this.takerAddress, this.zrxAssetData, tooLowAllowance);
+ break;
+
+ case AllowanceAmountScenario.Exact:
+ const exactAllowance = takerFee;
+ await this.assetWrapper.setProxyAllowanceAsync(this.takerAddress, this.zrxAssetData, exactAllowance);
+ break;
+
+ case AllowanceAmountScenario.Unlimited:
+ await this.assetWrapper.setProxyAllowanceAsync(
+ this.takerAddress,
+ this.zrxAssetData,
+ constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
+ );
+ break;
+
+ default:
+ throw errorUtils.spawnSwitchErr(
+ 'takerStateScenario.zrxFeeAllowance',
+ takerStateScenario.zrxFeeAllowance,
+ );
+ }
+ }
+} // tslint:disable:max-file-line-count
diff --git a/contracts/protocol/test/utils/index.ts b/contracts/protocol/test/utils/index.ts
new file mode 100644
index 000000000..75cd88666
--- /dev/null
+++ b/contracts/protocol/test/utils/index.ts
@@ -0,0 +1,3 @@
+export * from './exchange_wrapper';
+export * from './erc20_wrapper';
+export * from './erc721_wrapper';
diff --git a/contracts/protocol/test/utils/match_order_tester.ts b/contracts/protocol/test/utils/match_order_tester.ts
new file mode 100644
index 000000000..8f574704e
--- /dev/null
+++ b/contracts/protocol/test/utils/match_order_tester.ts
@@ -0,0 +1,562 @@
+import {
+ chaiSetup,
+ ERC20BalancesByOwner,
+ ERC721TokenIdsByOwner,
+ OrderInfo,
+ OrderStatus,
+ TransferAmountsByMatchOrders as TransferAmounts,
+ TransferAmountsLoggedByMatchOrders as LoggedTransferAmounts,
+} from '@0x/contracts-test-utils';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { AssetProxyId, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { TransactionReceiptWithDecodedLogs } from '../../../../node_modules/ethereum-types';
+
+import { ERC20Wrapper } from './erc20_wrapper';
+import { ERC721Wrapper } from './erc721_wrapper';
+import { ExchangeWrapper } from './exchange_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+export class MatchOrderTester {
+ private readonly _exchangeWrapper: ExchangeWrapper;
+ private readonly _erc20Wrapper: ERC20Wrapper;
+ private readonly _erc721Wrapper: ERC721Wrapper;
+ private readonly _feeTokenAddress: string;
+ /// @dev Checks values from the logs produced by Exchange.matchOrders against the expected transfer amounts.
+ /// Values include the amounts transferred from the left/right makers and taker, along with
+ /// the fees paid on each matched order. These are also the return values of MatchOrders.
+ /// @param signedOrderLeft First matched order.
+ /// @param signedOrderRight Second matched order.
+ /// @param transactionReceipt Transaction receipt and logs produced by Exchange.matchOrders.
+ /// @param takerAddress Address of taker (account that called Exchange.matchOrders)
+ /// @param expectedTransferAmounts Expected amounts transferred as a result of order matching.
+ private static async _assertLogsAsync(
+ signedOrderLeft: SignedOrder,
+ signedOrderRight: SignedOrder,
+ transactionReceipt: TransactionReceiptWithDecodedLogs,
+ takerAddress: string,
+ expectedTransferAmounts: TransferAmounts,
+ ): Promise<void> {
+ // Should have two fill event logs -- one for each order.
+ const transactionFillLogs = _.filter(transactionReceipt.logs, ['event', 'Fill']);
+ expect(transactionFillLogs.length, 'Checking number of logs').to.be.equal(2);
+ // First log is for left fill
+ const leftLog = (transactionFillLogs[0] as any).args as LoggedTransferAmounts;
+ expect(leftLog.makerAddress, 'Checking logged maker address of left order').to.be.equal(
+ signedOrderLeft.makerAddress,
+ );
+ expect(leftLog.takerAddress, 'Checking logged taker address of right order').to.be.equal(takerAddress);
+ const amountBoughtByLeftMaker = new BigNumber(leftLog.takerAssetFilledAmount);
+ const amountSoldByLeftMaker = new BigNumber(leftLog.makerAssetFilledAmount);
+ const feePaidByLeftMaker = new BigNumber(leftLog.makerFeePaid);
+ const feePaidByTakerLeft = new BigNumber(leftLog.takerFeePaid);
+ // Second log is for right fill
+ const rightLog = (transactionFillLogs[1] as any).args as LoggedTransferAmounts;
+ expect(rightLog.makerAddress, 'Checking logged maker address of right order').to.be.equal(
+ signedOrderRight.makerAddress,
+ );
+ expect(rightLog.takerAddress, 'Checking loggerd taker address of right order').to.be.equal(takerAddress);
+ const amountBoughtByRightMaker = new BigNumber(rightLog.takerAssetFilledAmount);
+ const amountSoldByRightMaker = new BigNumber(rightLog.makerAssetFilledAmount);
+ const feePaidByRightMaker = new BigNumber(rightLog.makerFeePaid);
+ const feePaidByTakerRight = new BigNumber(rightLog.takerFeePaid);
+ // Derive amount received by taker
+ const amountReceivedByTaker = amountSoldByLeftMaker.sub(amountBoughtByRightMaker);
+ // Assert log values - left order
+ expect(amountBoughtByLeftMaker, 'Checking logged amount bought by left maker').to.be.bignumber.equal(
+ expectedTransferAmounts.amountBoughtByLeftMaker,
+ );
+ expect(amountSoldByLeftMaker, 'Checking logged amount sold by left maker').to.be.bignumber.equal(
+ expectedTransferAmounts.amountSoldByLeftMaker,
+ );
+ expect(feePaidByLeftMaker, 'Checking logged fee paid by left maker').to.be.bignumber.equal(
+ expectedTransferAmounts.feePaidByLeftMaker,
+ );
+ expect(feePaidByTakerLeft, 'Checking logged fee paid on left order by taker').to.be.bignumber.equal(
+ expectedTransferAmounts.feePaidByTakerLeft,
+ );
+ // Assert log values - right order
+ expect(amountBoughtByRightMaker, 'Checking logged amount bought by right maker').to.be.bignumber.equal(
+ expectedTransferAmounts.amountBoughtByRightMaker,
+ );
+ expect(amountSoldByRightMaker, 'Checking logged amount sold by right maker').to.be.bignumber.equal(
+ expectedTransferAmounts.amountSoldByRightMaker,
+ );
+ expect(feePaidByRightMaker, 'Checking logged fee paid by right maker').to.be.bignumber.equal(
+ expectedTransferAmounts.feePaidByRightMaker,
+ );
+ expect(feePaidByTakerRight, 'Checking logged fee paid on right order by taker').to.be.bignumber.equal(
+ expectedTransferAmounts.feePaidByTakerRight,
+ );
+ // Assert derived amount received by taker
+ expect(amountReceivedByTaker, 'Checking logged amount received by taker').to.be.bignumber.equal(
+ expectedTransferAmounts.amountReceivedByTaker,
+ );
+ }
+ /// @dev Asserts all expected ERC20 and ERC721 account holdings match the real holdings.
+ /// @param expectedERC20BalancesByOwner Expected ERC20 balances.
+ /// @param realERC20BalancesByOwner Real ERC20 balances.
+ /// @param expectedERC721TokenIdsByOwner Expected ERC721 token owners.
+ /// @param realERC721TokenIdsByOwner Real ERC20 token owners.
+ private static async _assertAllKnownBalancesAsync(
+ expectedERC20BalancesByOwner: ERC20BalancesByOwner,
+ realERC20BalancesByOwner: ERC20BalancesByOwner,
+ expectedERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
+ realERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
+ ): Promise<void> {
+ // ERC20 Balances
+ const areERC20BalancesEqual = _.isEqual(expectedERC20BalancesByOwner, realERC20BalancesByOwner);
+ expect(areERC20BalancesEqual, 'Checking all known ERC20 account balances').to.be.true();
+ // ERC721 Token Ids
+ const sortedExpectedNewERC721TokenIdsByOwner = _.mapValues(expectedERC721TokenIdsByOwner, tokenIdsByOwner => {
+ _.mapValues(tokenIdsByOwner, tokenIds => {
+ _.sortBy(tokenIds);
+ });
+ });
+ const sortedNewERC721TokenIdsByOwner = _.mapValues(realERC721TokenIdsByOwner, tokenIdsByOwner => {
+ _.mapValues(tokenIdsByOwner, tokenIds => {
+ _.sortBy(tokenIds);
+ });
+ });
+ const areERC721TokenIdsEqual = _.isEqual(
+ sortedExpectedNewERC721TokenIdsByOwner,
+ sortedNewERC721TokenIdsByOwner,
+ );
+ expect(areERC721TokenIdsEqual, 'Checking all known ERC721 account balances').to.be.true();
+ }
+ /// @dev Constructs new MatchOrderTester.
+ /// @param exchangeWrapper Used to call to the Exchange.
+ /// @param erc20Wrapper Used to fetch ERC20 balances.
+ /// @param erc721Wrapper Used to fetch ERC721 token owners.
+ /// @param feeTokenAddress Address of ERC20 fee token.
+ constructor(
+ exchangeWrapper: ExchangeWrapper,
+ erc20Wrapper: ERC20Wrapper,
+ erc721Wrapper: ERC721Wrapper,
+ feeTokenAddress: string,
+ ) {
+ this._exchangeWrapper = exchangeWrapper;
+ this._erc20Wrapper = erc20Wrapper;
+ this._erc721Wrapper = erc721Wrapper;
+ this._feeTokenAddress = feeTokenAddress;
+ }
+ /// @dev Matches two complementary orders and asserts results.
+ /// @param signedOrderLeft First matched order.
+ /// @param signedOrderRight Second matched order.
+ /// @param takerAddress Address of taker (the address who matched the two orders)
+ /// @param erc20BalancesByOwner Current ERC20 balances.
+ /// @param erc721TokenIdsByOwner Current ERC721 token owners.
+ /// @param expectedTransferAmounts Expected amounts transferred as a result of order matching.
+ /// @param initialLeftOrderFilledAmount How much left order has been filled, prior to matching orders.
+ /// @param initialRightOrderFilledAmount How much the right order has been filled, prior to matching orders.
+ /// @return New ERC20 balances & ERC721 token owners.
+ public async matchOrdersAndAssertEffectsAsync(
+ signedOrderLeft: SignedOrder,
+ signedOrderRight: SignedOrder,
+ takerAddress: string,
+ erc20BalancesByOwner: ERC20BalancesByOwner,
+ erc721TokenIdsByOwner: ERC721TokenIdsByOwner,
+ expectedTransferAmounts: TransferAmounts,
+ initialLeftOrderFilledAmount: BigNumber = new BigNumber(0),
+ initialRightOrderFilledAmount: BigNumber = new BigNumber(0),
+ ): Promise<[ERC20BalancesByOwner, ERC721TokenIdsByOwner]> {
+ // Assert initial order states
+ await this._assertInitialOrderStatesAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ initialLeftOrderFilledAmount,
+ initialRightOrderFilledAmount,
+ );
+ // Match left & right orders
+ const transactionReceipt = await this._exchangeWrapper.matchOrdersAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ );
+ const newERC20BalancesByOwner = await this._erc20Wrapper.getBalancesAsync();
+ const newERC721TokenIdsByOwner = await this._erc721Wrapper.getBalancesAsync();
+ // Assert logs
+ await MatchOrderTester._assertLogsAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ transactionReceipt,
+ takerAddress,
+ expectedTransferAmounts,
+ );
+ // Assert exchange state
+ await this._assertExchangeStateAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ initialLeftOrderFilledAmount,
+ initialRightOrderFilledAmount,
+ expectedTransferAmounts,
+ );
+ // Assert balances of makers, taker, and fee recipients
+ await this._assertBalancesAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ erc20BalancesByOwner,
+ erc721TokenIdsByOwner,
+ newERC20BalancesByOwner,
+ newERC721TokenIdsByOwner,
+ expectedTransferAmounts,
+ takerAddress,
+ );
+ return [newERC20BalancesByOwner, newERC721TokenIdsByOwner];
+ }
+ /// @dev Asserts initial exchange state for the left and right orders.
+ /// @param signedOrderLeft First matched order.
+ /// @param signedOrderRight Second matched order.
+ /// @param expectedOrderFilledAmountLeft How much left order has been filled, prior to matching orders.
+ /// @param expectedOrderFilledAmountRight How much the right order has been filled, prior to matching orders.
+ private async _assertInitialOrderStatesAsync(
+ signedOrderLeft: SignedOrder,
+ signedOrderRight: SignedOrder,
+ expectedOrderFilledAmountLeft: BigNumber,
+ expectedOrderFilledAmountRight: BigNumber,
+ ): Promise<void> {
+ // Assert left order initial state
+ const orderTakerAssetFilledAmountLeft = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
+ orderHashUtils.getOrderHashHex(signedOrderLeft),
+ );
+ expect(orderTakerAssetFilledAmountLeft, 'Checking inital state of left order').to.be.bignumber.equal(
+ expectedOrderFilledAmountLeft,
+ );
+ // Assert right order initial state
+ const orderTakerAssetFilledAmountRight = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
+ orderHashUtils.getOrderHashHex(signedOrderRight),
+ );
+ expect(orderTakerAssetFilledAmountRight, 'Checking inital state of right order').to.be.bignumber.equal(
+ expectedOrderFilledAmountRight,
+ );
+ }
+ /// @dev Asserts the exchange state against the expected amounts transferred by from matching orders.
+ /// @param signedOrderLeft First matched order.
+ /// @param signedOrderRight Second matched order.
+ /// @param initialLeftOrderFilledAmount How much left order has been filled, prior to matching orders.
+ /// @param initialRightOrderFilledAmount How much the right order has been filled, prior to matching orders.
+ /// @return TransferAmounts A struct containing the expected transfer amounts.
+ private async _assertExchangeStateAsync(
+ signedOrderLeft: SignedOrder,
+ signedOrderRight: SignedOrder,
+ initialLeftOrderFilledAmount: BigNumber,
+ initialRightOrderFilledAmount: BigNumber,
+ expectedTransferAmounts: TransferAmounts,
+ ): Promise<void> {
+ // Assert state for left order: amount bought by left maker
+ let amountBoughtByLeftMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
+ orderHashUtils.getOrderHashHex(signedOrderLeft),
+ );
+ amountBoughtByLeftMaker = amountBoughtByLeftMaker.minus(initialLeftOrderFilledAmount);
+ expect(amountBoughtByLeftMaker, 'Checking exchange state for left order').to.be.bignumber.equal(
+ expectedTransferAmounts.amountBoughtByLeftMaker,
+ );
+ // Assert state for right order: amount bought by right maker
+ let amountBoughtByRightMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
+ orderHashUtils.getOrderHashHex(signedOrderRight),
+ );
+ amountBoughtByRightMaker = amountBoughtByRightMaker.minus(initialRightOrderFilledAmount);
+ expect(amountBoughtByRightMaker, 'Checking exchange state for right order').to.be.bignumber.equal(
+ expectedTransferAmounts.amountBoughtByRightMaker,
+ );
+ // Assert left order status
+ const maxAmountBoughtByLeftMaker = signedOrderLeft.takerAssetAmount.minus(initialLeftOrderFilledAmount);
+ const leftOrderInfo: OrderInfo = await this._exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
+ const leftExpectedStatus = expectedTransferAmounts.amountBoughtByLeftMaker.equals(maxAmountBoughtByLeftMaker)
+ ? OrderStatus.FULLY_FILLED
+ : OrderStatus.FILLABLE;
+ expect(leftOrderInfo.orderStatus, 'Checking exchange status for left order').to.be.equal(leftExpectedStatus);
+ // Assert right order status
+ const maxAmountBoughtByRightMaker = signedOrderRight.takerAssetAmount.minus(initialRightOrderFilledAmount);
+ const rightOrderInfo: OrderInfo = await this._exchangeWrapper.getOrderInfoAsync(signedOrderRight);
+ const rightExpectedStatus = expectedTransferAmounts.amountBoughtByRightMaker.equals(maxAmountBoughtByRightMaker)
+ ? OrderStatus.FULLY_FILLED
+ : OrderStatus.FILLABLE;
+ expect(rightOrderInfo.orderStatus, 'Checking exchange status for right order').to.be.equal(rightExpectedStatus);
+ }
+ /// @dev Asserts account balances after matching orders.
+ /// @param signedOrderLeft First matched order.
+ /// @param signedOrderRight Second matched order.
+ /// @param initialERC20BalancesByOwner ERC20 balances prior to order matching.
+ /// @param initialERC721TokenIdsByOwner ERC721 token owners prior to order matching.
+ /// @param finalERC20BalancesByOwner ERC20 balances after order matching.
+ /// @param finalERC721TokenIdsByOwner ERC721 token owners after order matching.
+ /// @param expectedTransferAmounts Expected amounts transferred as a result of order matching.
+ /// @param takerAddress Address of taker (account that called Exchange.matchOrders).
+ private async _assertBalancesAsync(
+ signedOrderLeft: SignedOrder,
+ signedOrderRight: SignedOrder,
+ initialERC20BalancesByOwner: ERC20BalancesByOwner,
+ initialERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
+ finalERC20BalancesByOwner: ERC20BalancesByOwner,
+ finalERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
+ expectedTransferAmounts: TransferAmounts,
+ takerAddress: string,
+ ): Promise<void> {
+ let expectedERC20BalancesByOwner: ERC20BalancesByOwner;
+ let expectedERC721TokenIdsByOwner: ERC721TokenIdsByOwner;
+ [expectedERC20BalancesByOwner, expectedERC721TokenIdsByOwner] = this._calculateExpectedBalances(
+ signedOrderLeft,
+ signedOrderRight,
+ takerAddress,
+ initialERC20BalancesByOwner,
+ initialERC721TokenIdsByOwner,
+ expectedTransferAmounts,
+ );
+ // Assert balances of makers, taker, and fee recipients
+ await this._assertMakerTakerAndFeeRecipientBalancesAsync(
+ signedOrderLeft,
+ signedOrderRight,
+ expectedERC20BalancesByOwner,
+ finalERC20BalancesByOwner,
+ expectedERC721TokenIdsByOwner,
+ finalERC721TokenIdsByOwner,
+ takerAddress,
+ );
+ // Assert balances for all known accounts
+ await MatchOrderTester._assertAllKnownBalancesAsync(
+ expectedERC20BalancesByOwner,
+ finalERC20BalancesByOwner,
+ expectedERC721TokenIdsByOwner,
+ finalERC721TokenIdsByOwner,
+ );
+ }
+ /// @dev Calculates the expected balances of order makers, fee recipients, and the taker,
+ /// as a result of matching two orders.
+ /// @param signedOrderRight First matched order.
+ /// @param signedOrderRight Second matched order.
+ /// @param takerAddress Address of taker (the address who matched the two orders)
+ /// @param erc20BalancesByOwner Current ERC20 balances.
+ /// @param erc721TokenIdsByOwner Current ERC721 token owners.
+ /// @param expectedTransferAmounts Expected amounts transferred as a result of order matching.
+ /// @return Expected ERC20 balances & ERC721 token owners after orders have been matched.
+ private _calculateExpectedBalances(
+ signedOrderLeft: SignedOrder,
+ signedOrderRight: SignedOrder,
+ takerAddress: string,
+ erc20BalancesByOwner: ERC20BalancesByOwner,
+ erc721TokenIdsByOwner: ERC721TokenIdsByOwner,
+ expectedTransferAmounts: TransferAmounts,
+ ): [ERC20BalancesByOwner, ERC721TokenIdsByOwner] {
+ const makerAddressLeft = signedOrderLeft.makerAddress;
+ const makerAddressRight = signedOrderRight.makerAddress;
+ const feeRecipientAddressLeft = signedOrderLeft.feeRecipientAddress;
+ const feeRecipientAddressRight = signedOrderRight.feeRecipientAddress;
+ // Operations are performed on copies of the balances
+ const expectedNewERC20BalancesByOwner = _.cloneDeep(erc20BalancesByOwner);
+ const expectedNewERC721TokenIdsByOwner = _.cloneDeep(erc721TokenIdsByOwner);
+ // Left Maker Asset (Right Taker Asset)
+ const makerAssetProxyIdLeft = assetDataUtils.decodeAssetProxyId(signedOrderLeft.makerAssetData);
+ if (makerAssetProxyIdLeft === AssetProxyId.ERC20) {
+ // Decode asset data
+ const erc20AssetData = assetDataUtils.decodeERC20AssetData(signedOrderLeft.makerAssetData);
+ const makerAssetAddressLeft = erc20AssetData.tokenAddress;
+ const takerAssetAddressRight = makerAssetAddressLeft;
+ // Left Maker
+ expectedNewERC20BalancesByOwner[makerAddressLeft][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
+ makerAddressLeft
+ ][makerAssetAddressLeft].minus(expectedTransferAmounts.amountSoldByLeftMaker);
+ // Right Maker
+ expectedNewERC20BalancesByOwner[makerAddressRight][
+ takerAssetAddressRight
+ ] = expectedNewERC20BalancesByOwner[makerAddressRight][takerAssetAddressRight].add(
+ expectedTransferAmounts.amountBoughtByRightMaker,
+ );
+ // Taker
+ expectedNewERC20BalancesByOwner[takerAddress][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
+ takerAddress
+ ][makerAssetAddressLeft].add(expectedTransferAmounts.amountReceivedByTaker);
+ } else if (makerAssetProxyIdLeft === AssetProxyId.ERC721) {
+ // Decode asset data
+ const erc721AssetData = assetDataUtils.decodeERC721AssetData(signedOrderLeft.makerAssetData);
+ const makerAssetAddressLeft = erc721AssetData.tokenAddress;
+ const makerAssetIdLeft = erc721AssetData.tokenId;
+ const takerAssetAddressRight = makerAssetAddressLeft;
+ const takerAssetIdRight = makerAssetIdLeft;
+ // Left Maker
+ _.remove(expectedNewERC721TokenIdsByOwner[makerAddressLeft][makerAssetAddressLeft], makerAssetIdLeft);
+ // Right Maker
+ expectedNewERC721TokenIdsByOwner[makerAddressRight][takerAssetAddressRight].push(takerAssetIdRight);
+ // Taker: Since there is only 1 asset transferred, the taker does not receive any of the left maker asset.
+ }
+ // Left Taker Asset (Right Maker Asset)
+ // Note: This exchange is only between the order makers: the Taker does not receive any of the left taker asset.
+ const takerAssetProxyIdLeft = assetDataUtils.decodeAssetProxyId(signedOrderLeft.takerAssetData);
+ if (takerAssetProxyIdLeft === AssetProxyId.ERC20) {
+ // Decode asset data
+ const erc20AssetData = assetDataUtils.decodeERC20AssetData(signedOrderLeft.takerAssetData);
+ const takerAssetAddressLeft = erc20AssetData.tokenAddress;
+ const makerAssetAddressRight = takerAssetAddressLeft;
+ // Left Maker
+ expectedNewERC20BalancesByOwner[makerAddressLeft][takerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
+ makerAddressLeft
+ ][takerAssetAddressLeft].add(expectedTransferAmounts.amountBoughtByLeftMaker);
+ // Right Maker
+ expectedNewERC20BalancesByOwner[makerAddressRight][
+ makerAssetAddressRight
+ ] = expectedNewERC20BalancesByOwner[makerAddressRight][makerAssetAddressRight].minus(
+ expectedTransferAmounts.amountSoldByRightMaker,
+ );
+ } else if (takerAssetProxyIdLeft === AssetProxyId.ERC721) {
+ // Decode asset data
+ const erc721AssetData = assetDataUtils.decodeERC721AssetData(signedOrderRight.makerAssetData);
+ const makerAssetAddressRight = erc721AssetData.tokenAddress;
+ const makerAssetIdRight = erc721AssetData.tokenId;
+ const takerAssetAddressLeft = makerAssetAddressRight;
+ const takerAssetIdLeft = makerAssetIdRight;
+ // Right Maker
+ _.remove(expectedNewERC721TokenIdsByOwner[makerAddressRight][makerAssetAddressRight], makerAssetIdRight);
+ // Left Maker
+ expectedNewERC721TokenIdsByOwner[makerAddressLeft][takerAssetAddressLeft].push(takerAssetIdLeft);
+ }
+ // Left Maker Fees
+ expectedNewERC20BalancesByOwner[makerAddressLeft][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[
+ makerAddressLeft
+ ][this._feeTokenAddress].minus(expectedTransferAmounts.feePaidByLeftMaker);
+ // Right Maker Fees
+ expectedNewERC20BalancesByOwner[makerAddressRight][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[
+ makerAddressRight
+ ][this._feeTokenAddress].minus(expectedTransferAmounts.feePaidByRightMaker);
+ // Taker Fees
+ expectedNewERC20BalancesByOwner[takerAddress][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[
+ takerAddress
+ ][this._feeTokenAddress].minus(
+ expectedTransferAmounts.feePaidByTakerLeft.add(expectedTransferAmounts.feePaidByTakerRight),
+ );
+ // Left Fee Recipient Fees
+ expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][
+ this._feeTokenAddress
+ ] = expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][this._feeTokenAddress].add(
+ expectedTransferAmounts.feePaidByLeftMaker.add(expectedTransferAmounts.feePaidByTakerLeft),
+ );
+ // Right Fee Recipient Fees
+ expectedNewERC20BalancesByOwner[feeRecipientAddressRight][
+ this._feeTokenAddress
+ ] = expectedNewERC20BalancesByOwner[feeRecipientAddressRight][this._feeTokenAddress].add(
+ expectedTransferAmounts.feePaidByRightMaker.add(expectedTransferAmounts.feePaidByTakerRight),
+ );
+
+ return [expectedNewERC20BalancesByOwner, expectedNewERC721TokenIdsByOwner];
+ }
+ /// @dev Asserts ERC20 account balances and ERC721 token holdings that result from order matching.
+ /// Specifically checks balances of makers, taker and fee recipients.
+ /// @param signedOrderLeft First matched order.
+ /// @param signedOrderRight Second matched order.
+ /// @param expectedERC20BalancesByOwner Expected ERC20 balances.
+ /// @param realERC20BalancesByOwner Real ERC20 balances.
+ /// @param expectedERC721TokenIdsByOwner Expected ERC721 token owners.
+ /// @param realERC721TokenIdsByOwner Real ERC20 token owners.
+ /// @param takerAddress Address of taker (account that called Exchange.matchOrders).
+ private async _assertMakerTakerAndFeeRecipientBalancesAsync(
+ signedOrderLeft: SignedOrder,
+ signedOrderRight: SignedOrder,
+ expectedERC20BalancesByOwner: ERC20BalancesByOwner,
+ realERC20BalancesByOwner: ERC20BalancesByOwner,
+ expectedERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
+ realERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
+ takerAddress: string,
+ ): Promise<void> {
+ // Individual balance comparisons
+ const makerAssetProxyIdLeft = assetDataUtils.decodeAssetProxyId(signedOrderLeft.makerAssetData);
+ const makerERC20AssetDataLeft =
+ makerAssetProxyIdLeft === AssetProxyId.ERC20
+ ? assetDataUtils.decodeERC20AssetData(signedOrderLeft.makerAssetData)
+ : assetDataUtils.decodeERC721AssetData(signedOrderLeft.makerAssetData);
+ const makerAssetAddressLeft = makerERC20AssetDataLeft.tokenAddress;
+ const makerAssetProxyIdRight = assetDataUtils.decodeAssetProxyId(signedOrderRight.makerAssetData);
+ const makerERC20AssetDataRight =
+ makerAssetProxyIdRight === AssetProxyId.ERC20
+ ? assetDataUtils.decodeERC20AssetData(signedOrderRight.makerAssetData)
+ : assetDataUtils.decodeERC721AssetData(signedOrderRight.makerAssetData);
+ const makerAssetAddressRight = makerERC20AssetDataRight.tokenAddress;
+ if (makerAssetProxyIdLeft === AssetProxyId.ERC20) {
+ expect(
+ realERC20BalancesByOwner[signedOrderLeft.makerAddress][makerAssetAddressLeft],
+ 'Checking left maker egress ERC20 account balance',
+ ).to.be.bignumber.equal(expectedERC20BalancesByOwner[signedOrderLeft.makerAddress][makerAssetAddressLeft]);
+ expect(
+ realERC20BalancesByOwner[signedOrderRight.makerAddress][makerAssetAddressLeft],
+ 'Checking right maker ingress ERC20 account balance',
+ ).to.be.bignumber.equal(expectedERC20BalancesByOwner[signedOrderRight.makerAddress][makerAssetAddressLeft]);
+ expect(
+ realERC20BalancesByOwner[takerAddress][makerAssetAddressLeft],
+ 'Checking taker ingress ERC20 account balance',
+ ).to.be.bignumber.equal(expectedERC20BalancesByOwner[takerAddress][makerAssetAddressLeft]);
+ } else if (makerAssetProxyIdLeft === AssetProxyId.ERC721) {
+ expect(
+ realERC721TokenIdsByOwner[signedOrderLeft.makerAddress][makerAssetAddressLeft].sort(),
+ 'Checking left maker egress ERC721 account holdings',
+ ).to.be.deep.equal(
+ expectedERC721TokenIdsByOwner[signedOrderLeft.makerAddress][makerAssetAddressLeft].sort(),
+ );
+ expect(
+ realERC721TokenIdsByOwner[signedOrderRight.makerAddress][makerAssetAddressLeft].sort(),
+ 'Checking right maker ERC721 account holdings',
+ ).to.be.deep.equal(
+ expectedERC721TokenIdsByOwner[signedOrderRight.makerAddress][makerAssetAddressLeft].sort(),
+ );
+ expect(
+ realERC721TokenIdsByOwner[takerAddress][makerAssetAddressLeft].sort(),
+ 'Checking taker ingress ERC721 account holdings',
+ ).to.be.deep.equal(expectedERC721TokenIdsByOwner[takerAddress][makerAssetAddressLeft].sort());
+ } else {
+ throw new Error(`Unhandled Asset Proxy ID: ${makerAssetProxyIdLeft}`);
+ }
+ if (makerAssetProxyIdRight === AssetProxyId.ERC20) {
+ expect(
+ realERC20BalancesByOwner[signedOrderLeft.makerAddress][makerAssetAddressRight],
+ 'Checking left maker ingress ERC20 account balance',
+ ).to.be.bignumber.equal(expectedERC20BalancesByOwner[signedOrderLeft.makerAddress][makerAssetAddressRight]);
+ expect(
+ realERC20BalancesByOwner[signedOrderRight.makerAddress][makerAssetAddressRight],
+ 'Checking right maker egress ERC20 account balance',
+ ).to.be.bignumber.equal(
+ expectedERC20BalancesByOwner[signedOrderRight.makerAddress][makerAssetAddressRight],
+ );
+ } else if (makerAssetProxyIdRight === AssetProxyId.ERC721) {
+ expect(
+ realERC721TokenIdsByOwner[signedOrderLeft.makerAddress][makerAssetAddressRight].sort(),
+ 'Checking left maker ingress ERC721 account holdings',
+ ).to.be.deep.equal(
+ expectedERC721TokenIdsByOwner[signedOrderLeft.makerAddress][makerAssetAddressRight].sort(),
+ );
+ expect(
+ realERC721TokenIdsByOwner[signedOrderRight.makerAddress][makerAssetAddressRight],
+ 'Checking right maker agress ERC721 account holdings',
+ ).to.be.deep.equal(expectedERC721TokenIdsByOwner[signedOrderRight.makerAddress][makerAssetAddressRight]);
+ } else {
+ throw new Error(`Unhandled Asset Proxy ID: ${makerAssetProxyIdRight}`);
+ }
+ // Paid fees
+ expect(
+ realERC20BalancesByOwner[signedOrderLeft.makerAddress][this._feeTokenAddress],
+ 'Checking left maker egress ERC20 account fees',
+ ).to.be.bignumber.equal(expectedERC20BalancesByOwner[signedOrderLeft.makerAddress][this._feeTokenAddress]);
+ expect(
+ realERC20BalancesByOwner[signedOrderRight.makerAddress][this._feeTokenAddress],
+ 'Checking right maker egress ERC20 account fees',
+ ).to.be.bignumber.equal(expectedERC20BalancesByOwner[signedOrderRight.makerAddress][this._feeTokenAddress]);
+ expect(
+ realERC20BalancesByOwner[takerAddress][this._feeTokenAddress],
+ 'Checking taker egress ERC20 account fees',
+ ).to.be.bignumber.equal(expectedERC20BalancesByOwner[takerAddress][this._feeTokenAddress]);
+ // Received fees
+ expect(
+ realERC20BalancesByOwner[signedOrderLeft.feeRecipientAddress][this._feeTokenAddress],
+ 'Checking left fee recipient ingress ERC20 account fees',
+ ).to.be.bignumber.equal(
+ expectedERC20BalancesByOwner[signedOrderLeft.feeRecipientAddress][this._feeTokenAddress],
+ );
+ expect(
+ realERC20BalancesByOwner[signedOrderRight.feeRecipientAddress][this._feeTokenAddress],
+ 'Checking right fee receipient ingress ERC20 account fees',
+ ).to.be.bignumber.equal(
+ expectedERC20BalancesByOwner[signedOrderRight.feeRecipientAddress][this._feeTokenAddress],
+ );
+ }
+} // tslint:disable-line:max-file-line-count
diff --git a/contracts/protocol/test/utils/order_factory_from_scenario.ts b/contracts/protocol/test/utils/order_factory_from_scenario.ts
new file mode 100644
index 000000000..ecb4b2e28
--- /dev/null
+++ b/contracts/protocol/test/utils/order_factory_from_scenario.ts
@@ -0,0 +1,294 @@
+import {
+ AssetDataScenario,
+ constants,
+ ERC721TokenIdsByOwner,
+ ExpirationTimeSecondsScenario,
+ FeeRecipientAddressScenario,
+ OrderAssetAmountScenario,
+ OrderScenario,
+ TakerScenario,
+} from '@0x/contracts-test-utils';
+import { DummyERC721TokenContract } from '@0x/contracts-tokens';
+import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
+import { Order } from '@0x/types';
+import { BigNumber, errorUtils } from '@0x/utils';
+
+const TEN_UNITS_EIGHTEEN_DECIMALS = new BigNumber(10_000_000_000_000_000_000);
+const FIVE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(5_000_000_000_000_000_000);
+const POINT_ONE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(100_000_000_000_000_000);
+const POINT_ZERO_FIVE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(50_000_000_000_000_000);
+const TEN_UNITS_FIVE_DECIMALS = new BigNumber(1_000_000);
+const FIVE_UNITS_FIVE_DECIMALS = new BigNumber(500_000);
+const TEN_UNITS_ZERO_DECIMALS = new BigNumber(10);
+const ONE_THOUSAND_UNITS_ZERO_DECIMALS = new BigNumber(1000);
+const ONE_NFT_UNIT = new BigNumber(1);
+
+export class OrderFactoryFromScenario {
+ private readonly _userAddresses: string[];
+ private readonly _zrxAddress: string;
+ private readonly _nonZrxERC20EighteenDecimalTokenAddresses: string[];
+ private readonly _erc20FiveDecimalTokenAddresses: string[];
+ private readonly _erc20ZeroDecimalTokenAddresses: string[];
+ private readonly _erc721Token: DummyERC721TokenContract;
+ private readonly _erc721Balances: ERC721TokenIdsByOwner;
+ private readonly _exchangeAddress: string;
+ constructor(
+ userAddresses: string[],
+ zrxAddress: string,
+ nonZrxERC20EighteenDecimalTokenAddresses: string[],
+ erc20FiveDecimalTokenAddresses: string[],
+ erc20ZeroDecimalTokenAddresses: string[],
+ erc721Token: DummyERC721TokenContract,
+ erc721Balances: ERC721TokenIdsByOwner,
+ exchangeAddress: string,
+ ) {
+ this._userAddresses = userAddresses;
+ this._zrxAddress = zrxAddress;
+ this._nonZrxERC20EighteenDecimalTokenAddresses = nonZrxERC20EighteenDecimalTokenAddresses;
+ this._erc20FiveDecimalTokenAddresses = erc20FiveDecimalTokenAddresses;
+ this._erc20ZeroDecimalTokenAddresses = erc20ZeroDecimalTokenAddresses;
+ this._erc721Token = erc721Token;
+ this._erc721Balances = erc721Balances;
+ this._exchangeAddress = exchangeAddress;
+ }
+ public generateOrder(orderScenario: OrderScenario): Order {
+ const makerAddress = this._userAddresses[1];
+ let takerAddress = this._userAddresses[2];
+ const erc721MakerAssetIds = this._erc721Balances[makerAddress][this._erc721Token.address];
+ const erc721TakerAssetIds = this._erc721Balances[takerAddress][this._erc721Token.address];
+ let feeRecipientAddress;
+ let makerAssetAmount;
+ let takerAssetAmount;
+ let makerFee;
+ let takerFee;
+ let expirationTimeSeconds;
+ let makerAssetData;
+ let takerAssetData;
+
+ switch (orderScenario.feeRecipientScenario) {
+ case FeeRecipientAddressScenario.BurnAddress:
+ feeRecipientAddress = constants.NULL_ADDRESS;
+ break;
+ case FeeRecipientAddressScenario.EthUserAddress:
+ feeRecipientAddress = this._userAddresses[4];
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('FeeRecipientAddressScenario', orderScenario.feeRecipientScenario);
+ }
+
+ switch (orderScenario.makerAssetDataScenario) {
+ case AssetDataScenario.ZRXFeeToken:
+ makerAssetData = assetDataUtils.encodeERC20AssetData(this._zrxAddress);
+ break;
+ case AssetDataScenario.ERC20NonZRXEighteenDecimals:
+ makerAssetData = assetDataUtils.encodeERC20AssetData(this._nonZrxERC20EighteenDecimalTokenAddresses[0]);
+ break;
+ case AssetDataScenario.ERC20FiveDecimals:
+ makerAssetData = assetDataUtils.encodeERC20AssetData(this._erc20FiveDecimalTokenAddresses[0]);
+ break;
+ case AssetDataScenario.ERC721:
+ makerAssetData = assetDataUtils.encodeERC721AssetData(
+ this._erc721Token.address,
+ erc721MakerAssetIds[0],
+ );
+ break;
+ case AssetDataScenario.ERC20ZeroDecimals:
+ makerAssetData = assetDataUtils.encodeERC20AssetData(this._erc20ZeroDecimalTokenAddresses[0]);
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.makerAssetDataScenario);
+ }
+
+ switch (orderScenario.takerAssetDataScenario) {
+ case AssetDataScenario.ZRXFeeToken:
+ takerAssetData = assetDataUtils.encodeERC20AssetData(this._zrxAddress);
+ break;
+ case AssetDataScenario.ERC20NonZRXEighteenDecimals:
+ takerAssetData = assetDataUtils.encodeERC20AssetData(this._nonZrxERC20EighteenDecimalTokenAddresses[1]);
+ break;
+ case AssetDataScenario.ERC20FiveDecimals:
+ takerAssetData = assetDataUtils.encodeERC20AssetData(this._erc20FiveDecimalTokenAddresses[1]);
+ break;
+ case AssetDataScenario.ERC721:
+ takerAssetData = assetDataUtils.encodeERC721AssetData(
+ this._erc721Token.address,
+ erc721TakerAssetIds[0],
+ );
+ break;
+ case AssetDataScenario.ERC20ZeroDecimals:
+ takerAssetData = assetDataUtils.encodeERC20AssetData(this._erc20ZeroDecimalTokenAddresses[1]);
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.takerAssetDataScenario);
+ }
+
+ switch (orderScenario.makerAssetAmountScenario) {
+ case OrderAssetAmountScenario.Large:
+ switch (orderScenario.makerAssetDataScenario) {
+ case AssetDataScenario.ZRXFeeToken:
+ case AssetDataScenario.ERC20NonZRXEighteenDecimals:
+ makerAssetAmount = TEN_UNITS_EIGHTEEN_DECIMALS;
+ break;
+ case AssetDataScenario.ERC20FiveDecimals:
+ makerAssetAmount = TEN_UNITS_FIVE_DECIMALS;
+ break;
+ case AssetDataScenario.ERC721:
+ makerAssetAmount = ONE_NFT_UNIT;
+ break;
+ case AssetDataScenario.ERC20ZeroDecimals:
+ makerAssetAmount = ONE_THOUSAND_UNITS_ZERO_DECIMALS;
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.makerAssetDataScenario);
+ }
+ break;
+ case OrderAssetAmountScenario.Small:
+ switch (orderScenario.makerAssetDataScenario) {
+ case AssetDataScenario.ZRXFeeToken:
+ case AssetDataScenario.ERC20NonZRXEighteenDecimals:
+ makerAssetAmount = FIVE_UNITS_EIGHTEEN_DECIMALS;
+ break;
+ case AssetDataScenario.ERC20FiveDecimals:
+ makerAssetAmount = FIVE_UNITS_FIVE_DECIMALS;
+ break;
+ case AssetDataScenario.ERC721:
+ makerAssetAmount = ONE_NFT_UNIT;
+ break;
+ case AssetDataScenario.ERC20ZeroDecimals:
+ makerAssetAmount = TEN_UNITS_ZERO_DECIMALS;
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.makerAssetDataScenario);
+ }
+ break;
+ case OrderAssetAmountScenario.Zero:
+ makerAssetAmount = new BigNumber(0);
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.makerAssetAmountScenario);
+ }
+
+ switch (orderScenario.takerAssetAmountScenario) {
+ case OrderAssetAmountScenario.Large:
+ switch (orderScenario.takerAssetDataScenario) {
+ case AssetDataScenario.ERC20NonZRXEighteenDecimals:
+ case AssetDataScenario.ZRXFeeToken:
+ takerAssetAmount = TEN_UNITS_EIGHTEEN_DECIMALS;
+ break;
+ case AssetDataScenario.ERC20FiveDecimals:
+ takerAssetAmount = TEN_UNITS_FIVE_DECIMALS;
+ break;
+ case AssetDataScenario.ERC721:
+ takerAssetAmount = ONE_NFT_UNIT;
+ break;
+ case AssetDataScenario.ERC20ZeroDecimals:
+ takerAssetAmount = ONE_THOUSAND_UNITS_ZERO_DECIMALS;
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.takerAssetDataScenario);
+ }
+ break;
+ case OrderAssetAmountScenario.Small:
+ switch (orderScenario.takerAssetDataScenario) {
+ case AssetDataScenario.ERC20NonZRXEighteenDecimals:
+ case AssetDataScenario.ZRXFeeToken:
+ takerAssetAmount = FIVE_UNITS_EIGHTEEN_DECIMALS;
+ break;
+ case AssetDataScenario.ERC20FiveDecimals:
+ takerAssetAmount = FIVE_UNITS_FIVE_DECIMALS;
+ break;
+ case AssetDataScenario.ERC721:
+ takerAssetAmount = ONE_NFT_UNIT;
+ break;
+ case AssetDataScenario.ERC20ZeroDecimals:
+ takerAssetAmount = TEN_UNITS_ZERO_DECIMALS;
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.takerAssetDataScenario);
+ }
+ break;
+ case OrderAssetAmountScenario.Zero:
+ takerAssetAmount = new BigNumber(0);
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.takerAssetAmountScenario);
+ }
+
+ switch (orderScenario.makerFeeScenario) {
+ case OrderAssetAmountScenario.Large:
+ makerFee = POINT_ONE_UNITS_EIGHTEEN_DECIMALS;
+ break;
+ case OrderAssetAmountScenario.Small:
+ makerFee = POINT_ZERO_FIVE_UNITS_EIGHTEEN_DECIMALS;
+ break;
+ case OrderAssetAmountScenario.Zero:
+ makerFee = new BigNumber(0);
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.makerFeeScenario);
+ }
+
+ switch (orderScenario.takerFeeScenario) {
+ case OrderAssetAmountScenario.Large:
+ takerFee = POINT_ONE_UNITS_EIGHTEEN_DECIMALS;
+ break;
+ case OrderAssetAmountScenario.Small:
+ takerFee = POINT_ZERO_FIVE_UNITS_EIGHTEEN_DECIMALS;
+ break;
+ case OrderAssetAmountScenario.Zero:
+ takerFee = new BigNumber(0);
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.takerFeeScenario);
+ }
+
+ switch (orderScenario.expirationTimeSecondsScenario) {
+ case ExpirationTimeSecondsScenario.InFuture:
+ expirationTimeSeconds = new BigNumber(2524604400); // Close to infinite
+ break;
+ case ExpirationTimeSecondsScenario.InPast:
+ expirationTimeSeconds = new BigNumber(0); // Jan 1, 1970
+ break;
+ default:
+ throw errorUtils.spawnSwitchErr(
+ 'ExpirationTimeSecondsScenario',
+ orderScenario.expirationTimeSecondsScenario,
+ );
+ }
+
+ switch (orderScenario.takerScenario) {
+ case TakerScenario.CorrectlySpecified:
+ break; // noop since takerAddress is already specified
+
+ case TakerScenario.IncorrectlySpecified:
+ const notTaker = this._userAddresses[3];
+ takerAddress = notTaker;
+ break;
+
+ case TakerScenario.Unspecified:
+ takerAddress = constants.NULL_ADDRESS;
+ break;
+
+ default:
+ throw errorUtils.spawnSwitchErr('TakerScenario', orderScenario.takerScenario);
+ }
+
+ const order = {
+ senderAddress: constants.NULL_ADDRESS,
+ makerAddress,
+ takerAddress,
+ makerFee,
+ takerFee,
+ makerAssetAmount,
+ takerAssetAmount,
+ makerAssetData,
+ takerAssetData,
+ salt: generatePseudoRandomSalt(),
+ exchangeAddress: this._exchangeAddress,
+ feeRecipientAddress,
+ expirationTimeSeconds,
+ };
+
+ return order;
+ }
+}
diff --git a/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts b/contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
index 64b7dedbe..64b7dedbe 100644
--- a/packages/contracts/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
+++ b/contracts/protocol/test/utils/simple_asset_balance_and_proxy_allowance_fetcher.ts
diff --git a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts b/contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts
index af959e00e..af959e00e 100644
--- a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts
+++ b/contracts/protocol/test/utils/simple_order_filled_cancelled_fetcher.ts
diff --git a/contracts/protocol/tsconfig.json b/contracts/protocol/tsconfig.json
new file mode 100644
index 000000000..db872fc32
--- /dev/null
+++ b/contracts/protocol/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/AssetProxyOwner.json",
+ "./generated-artifacts/ERC20Proxy.json",
+ "./generated-artifacts/ERC721Proxy.json",
+ "./generated-artifacts/Exchange.json",
+ "./generated-artifacts/MixinAuthorizable.json",
+ "./generated-artifacts/MultiAssetProxy.json",
+ "./generated-artifacts/TestAssetProxyDispatcher.json",
+ "./generated-artifacts/TestAssetProxyOwner.json",
+ "./generated-artifacts/TestExchangeInternals.json",
+ "./generated-artifacts/TestSignatureValidator.json",
+ "./generated-artifacts/TestStaticCallReceiver.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/protocol/tslint.json b/contracts/protocol/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/protocol/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/test-utils/CHANGELOG.json b/contracts/test-utils/CHANGELOG.json
new file mode 100644
index 000000000..6e4682b7e
--- /dev/null
+++ b/contracts/test-utils/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ }
+]
diff --git a/contracts/test-utils/CHANGELOG.md b/contracts/test-utils/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/test-utils/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/test-utils/README.md b/contracts/test-utils/README.md
new file mode 100644
index 000000000..73fd93f45
--- /dev/null
+++ b/contracts/test-utils/README.md
@@ -0,0 +1,73 @@
+## Contracts test utils
+
+This package contains test utilities used by other smart contracts packages.
+
+## Usage
+
+```typescript
+import {
+ chaiSetup,
+ constants,
+ expectContractCallFailedAsync,
+ expectContractCreationFailedAsync,
+ expectTransactionFailedAsync,
+ expectTransactionFailedWithoutReasonAsync,
+ increaseTimeAndMineBlockAsync,
+ provider,
+ sendTransactionResult,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+```
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-test-utils yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-test-utils yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
diff --git a/contracts/test-utils/package.json b/contracts/test-utils/package.json
new file mode 100644
index 000000000..18ec8f6a8
--- /dev/null
+++ b/contracts/test-utils/package.json
@@ -0,0 +1,75 @@
+{
+ "name": "@0x/contracts-test-utils",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Test utils for 0x contracts",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "tsc -b",
+ "build:ci": "yarn build",
+ "test": "yarn run_mocha",
+ "test:coverage": "run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "clean": "shx rm -rf lib",
+ "lint": "tslint --format stylish --project tsconfig.lint.json",
+ "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"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/test-utils/README.md",
+ "devDependencies": {
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1"
+ },
+ "dependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "@types/bn.js": "^4.11.0",
+ "@types/ethereumjs-abi": "^0.6.0",
+ "@types/js-combinatorics": "^0.5.29",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "bn.js": "^4.11.8",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "ethereum-types": "^1.1.4",
+ "ethereumjs-abi": "0.6.5",
+ "ethereumjs-util": "^5.1.1",
+ "ethers": "~4.0.4",
+ "js-combinatorics": "^0.5.3",
+ "lodash": "^4.17.5",
+ "make-promises-safe": "^1.1.0"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/packages/contracts/test/utils/abstract_asset_wrapper.ts b/contracts/test-utils/src/abstract_asset_wrapper.ts
index 4b56a8502..4b56a8502 100644
--- a/packages/contracts/test/utils/abstract_asset_wrapper.ts
+++ b/contracts/test-utils/src/abstract_asset_wrapper.ts
diff --git a/packages/contracts/test/utils/address_utils.ts b/contracts/test-utils/src/address_utils.ts
index 634da0c16..634da0c16 100644
--- a/packages/contracts/test/utils/address_utils.ts
+++ b/contracts/test-utils/src/address_utils.ts
diff --git a/contracts/test-utils/src/assertions.ts b/contracts/test-utils/src/assertions.ts
new file mode 100644
index 000000000..f31651f4d
--- /dev/null
+++ b/contracts/test-utils/src/assertions.ts
@@ -0,0 +1,199 @@
+import { RevertReason } from '@0x/types';
+import { logUtils } from '@0x/utils';
+import { NodeType } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+import { TransactionReceipt, TransactionReceiptStatus, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { web3Wrapper } from './web3_wrapper';
+
+const expect = chai.expect;
+
+let nodeType: NodeType | undefined;
+
+// Represents the return value of a `sendTransaction` call. The Promise should
+// resolve with either a transaction receipt or a transaction hash.
+export type sendTransactionResult = Promise<TransactionReceipt | TransactionReceiptWithDecodedLogs | string>;
+
+/**
+ * Returns ganacheError if the backing Ethereum node is Ganache and gethError
+ * if it is Geth.
+ * @param ganacheError the error to be returned if the backing node is Ganache.
+ * @param gethError the error to be returned if the backing node is Geth.
+ * @returns either the given ganacheError or gethError depending on the backing
+ * node.
+ */
+async function _getGanacheOrGethErrorAsync(ganacheError: string, gethError: string): Promise<string> {
+ if (_.isUndefined(nodeType)) {
+ nodeType = await web3Wrapper.getNodeTypeAsync();
+ }
+ switch (nodeType) {
+ case NodeType.Ganache:
+ return ganacheError;
+ case NodeType.Geth:
+ return gethError;
+ default:
+ throw new Error(`Unknown node type: ${nodeType}`);
+ }
+}
+
+async function _getInsufficientFundsErrorMessageAsync(): Promise<string> {
+ return _getGanacheOrGethErrorAsync("sender doesn't have enough funds", 'insufficient funds');
+}
+
+async function _getTransactionFailedErrorMessageAsync(): Promise<string> {
+ return _getGanacheOrGethErrorAsync('revert', 'always failing transaction');
+}
+
+async function _getContractCallFailedErrorMessageAsync(): Promise<string> {
+ return _getGanacheOrGethErrorAsync('revert', 'Contract call failed');
+}
+
+/**
+ * Returns the expected error message for an 'invalid opcode' resulting from a
+ * contract call. The exact error message depends on the backing Ethereum node.
+ */
+export async function getInvalidOpcodeErrorMessageForCallAsync(): Promise<string> {
+ return _getGanacheOrGethErrorAsync('invalid opcode', 'Contract call failed');
+}
+
+/**
+ * Returns the expected error message for the given revert reason resulting from
+ * a sendTransaction call. The exact error message depends on the backing
+ * Ethereum node and whether it supports revert reasons.
+ * @param reason a specific revert reason.
+ * @returns the expected error message.
+ */
+export async function getRevertReasonOrErrorMessageForSendTransactionAsync(reason: RevertReason): Promise<string> {
+ return _getGanacheOrGethErrorAsync(reason, 'always failing transaction');
+}
+
+/**
+ * Rejects if the given Promise does not reject with an error indicating
+ * insufficient funds.
+ * @param p a promise resulting from a contract call or sendTransaction call.
+ * @returns a new Promise which will reject if the conditions are not met and
+ * otherwise resolve with no value.
+ */
+export async function expectInsufficientFundsAsync<T>(p: Promise<T>): Promise<void> {
+ const errMessage = await _getInsufficientFundsErrorMessageAsync();
+ return expect(p).to.be.rejectedWith(errMessage);
+}
+
+/**
+ * Resolves if the the sendTransaction call fails with the given revert reason.
+ * However, since Geth does not support revert reasons for sendTransaction, this
+ * falls back to expectTransactionFailedWithoutReasonAsync if the backing
+ * Ethereum node is Geth.
+ * @param p a Promise resulting from a sendTransaction call
+ * @param reason a specific revert reason
+ * @returns a new Promise which will reject if the conditions are not met and
+ * otherwise resolve with no value.
+ */
+export async function expectTransactionFailedAsync(p: sendTransactionResult, reason: RevertReason): Promise<void> {
+ // HACK(albrow): This dummy `catch` should not be necessary, but if you
+ // remove it, there is an uncaught exception and the Node process will
+ // forcibly exit. It's possible this is a false positive in
+ // make-promises-safe.
+ p.catch(e => {
+ _.noop(e);
+ });
+
+ if (_.isUndefined(nodeType)) {
+ nodeType = await web3Wrapper.getNodeTypeAsync();
+ }
+ switch (nodeType) {
+ case NodeType.Ganache:
+ return expect(p).to.be.rejectedWith(reason);
+ case NodeType.Geth:
+ logUtils.warn(
+ 'WARNING: Geth does not support revert reasons for sendTransaction. This test will pass if the transaction fails for any reason.',
+ );
+ return expectTransactionFailedWithoutReasonAsync(p);
+ default:
+ throw new Error(`Unknown node type: ${nodeType}`);
+ }
+}
+
+/**
+ * Resolves if the transaction fails without a revert reason, or if the
+ * corresponding transactionReceipt has a status of 0 or '0', indicating
+ * failure.
+ * @param p a Promise resulting from a sendTransaction call
+ * @returns a new Promise which will reject if the conditions are not met and
+ * otherwise resolve with no value.
+ */
+export async function expectTransactionFailedWithoutReasonAsync(p: sendTransactionResult): Promise<void> {
+ return p
+ .then(async result => {
+ let txReceiptStatus: TransactionReceiptStatus;
+ if (_.isString(result)) {
+ // Result is a txHash. We need to make a web3 call to get the
+ // receipt, then get the status from the receipt.
+ const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(result);
+ txReceiptStatus = txReceipt.status;
+ } else if ('status' in result) {
+ // Result is a transaction receipt, so we can get the status
+ // directly.
+ txReceiptStatus = result.status;
+ } else {
+ throw new Error(`Unexpected result type: ${typeof result}`);
+ }
+ expect(_.toString(txReceiptStatus)).to.equal(
+ '0',
+ 'Expected transaction to fail but receipt had a non-zero status, indicating success',
+ );
+ })
+ .catch(async err => {
+ // If the promise rejects, we expect a specific error message,
+ // depending on the backing Ethereum node type.
+ const errMessage = await _getTransactionFailedErrorMessageAsync();
+ expect(err.message).to.include(errMessage);
+ });
+}
+
+/**
+ * Resolves if the the contract call fails with the given revert reason.
+ * @param p a Promise resulting from a contract call
+ * @param reason a specific revert reason
+ * @returns a new Promise which will reject if the conditions are not met and
+ * otherwise resolve with no value.
+ */
+export async function expectContractCallFailedAsync<T>(p: Promise<T>, reason: RevertReason): Promise<void> {
+ return expect(p).to.be.rejectedWith(reason);
+}
+
+/**
+ * Resolves if the contract call fails without a revert reason.
+ * @param p a Promise resulting from a contract call
+ * @returns a new Promise which will reject if the conditions are not met and
+ * otherwise resolve with no value.
+ */
+export async function expectContractCallFailedWithoutReasonAsync<T>(p: Promise<T>): Promise<void> {
+ const errMessage = await _getContractCallFailedErrorMessageAsync();
+ return expect(p).to.be.rejectedWith(errMessage);
+}
+
+/**
+ * Resolves if the contract creation/deployment fails without a revert reason.
+ * @param p a Promise resulting from a contract creation/deployment
+ * @returns a new Promise which will reject if the conditions are not met and
+ * otherwise resolve with no value.
+ */
+export async function expectContractCreationFailedAsync<T>(
+ p: sendTransactionResult,
+ reason: RevertReason,
+): Promise<void> {
+ return expectTransactionFailedAsync(p, reason);
+}
+
+/**
+ * Resolves if the contract creation/deployment fails without a revert reason.
+ * @param p a Promise resulting from a contract creation/deployment
+ * @returns a new Promise which will reject if the conditions are not met and
+ * otherwise resolve with no value.
+ */
+export async function expectContractCreationFailedWithoutReasonAsync<T>(p: Promise<T>): Promise<void> {
+ const errMessage = await _getTransactionFailedErrorMessageAsync();
+ return expect(p).to.be.rejectedWith(errMessage);
+}
diff --git a/packages/contracts/test/utils/block_timestamp.ts b/contracts/test-utils/src/block_timestamp.ts
index 66c13eed1..66c13eed1 100644
--- a/packages/contracts/test/utils/block_timestamp.ts
+++ b/contracts/test-utils/src/block_timestamp.ts
diff --git a/packages/contracts/test/utils/chai_setup.ts b/contracts/test-utils/src/chai_setup.ts
index 1a8733093..1a8733093 100644
--- a/packages/contracts/test/utils/chai_setup.ts
+++ b/contracts/test-utils/src/chai_setup.ts
diff --git a/packages/contracts/test/utils/combinatorial_utils.ts b/contracts/test-utils/src/combinatorial_utils.ts
index bb1b55b4d..bb1b55b4d 100644
--- a/packages/contracts/test/utils/combinatorial_utils.ts
+++ b/contracts/test-utils/src/combinatorial_utils.ts
diff --git a/contracts/test-utils/src/constants.ts b/contracts/test-utils/src/constants.ts
new file mode 100644
index 000000000..f631dc81a
--- /dev/null
+++ b/contracts/test-utils/src/constants.ts
@@ -0,0 +1,68 @@
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+const TESTRPC_PRIVATE_KEYS_STRINGS = [
+ '0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d',
+ '0x5d862464fe9303452126c8bc94274b8c5f9874cbd219789b3eb2128075a76f72',
+ '0xdf02719c4df8b9b8ac7f551fcb5d9ef48fa27eef7a66453879f4d8fdc6e78fb1',
+ '0xff12e391b79415e941a94de3bf3a9aee577aed0731e297d5cfa0b8a1e02fa1d0',
+ '0x752dd9cf65e68cfaba7d60225cbdbc1f4729dd5e5507def72815ed0d8abc6249',
+ '0xefb595a0178eb79a8df953f87c5148402a224cdf725e88c0146727c6aceadccd',
+ '0x83c6d2cc5ddcf9711a6d59b417dc20eb48afd58d45290099e5987e3d768f328f',
+ '0xbb2d3f7c9583780a7d3904a2f55d792707c345f21de1bacb2d389934d82796b2',
+ '0xb2fd4d29c1390b71b8795ae81196bfd60293adf99f9d32a0aff06288fcdac55f',
+ '0x23cb7121166b9a2f93ae0b7c05bde02eae50d64449b2cbb42bc84e9d38d6cc89',
+];
+
+export const constants = {
+ BASE_16: 16,
+ INVALID_OPCODE: 'invalid opcode',
+ TESTRPC_NETWORK_ID: 50,
+ // Note(albrow): In practice V8 and most other engines limit the minimum
+ // interval for setInterval to 10ms. We still set it to 0 here in order to
+ // ensure we always use the minimum interval.
+ AWAIT_TRANSACTION_MINED_MS: 0,
+ MAX_ETHERTOKEN_WITHDRAW_GAS: 43000,
+ MAX_EXECUTE_TRANSACTION_GAS: 1000000,
+ MAX_TOKEN_TRANSFERFROM_GAS: 80000,
+ MAX_TOKEN_APPROVE_GAS: 60000,
+ MAX_TRANSFER_FROM_GAS: 150000,
+ MAX_MATCH_ORDERS_GAS: 400000,
+ DUMMY_TOKEN_NAME: '',
+ DUMMY_TOKEN_SYMBOL: '',
+ DUMMY_TOKEN_DECIMALS: new BigNumber(18),
+ DUMMY_TOKEN_TOTAL_SUPPLY: new BigNumber(0),
+ NULL_BYTES: '0x',
+ NUM_DUMMY_ERC20_TO_DEPLOY: 3,
+ NUM_DUMMY_ERC721_TO_DEPLOY: 2,
+ NUM_ERC721_TOKENS_TO_MINT: 2,
+ NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
+ UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1),
+ TESTRPC_PRIVATE_KEYS: _.map(TESTRPC_PRIVATE_KEYS_STRINGS, privateKeyString => ethUtil.toBuffer(privateKeyString)),
+ INITIAL_ERC20_BALANCE: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18),
+ INITIAL_ERC20_ALLOWANCE: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18),
+ STATIC_ORDER_PARAMS: {
+ makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
+ takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
+ makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
+ takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
+ },
+ WORD_LENGTH: 32,
+ ZERO_AMOUNT: new BigNumber(0),
+ PERCENTAGE_DENOMINATOR: new BigNumber(10).pow(18),
+ FUNCTIONS_WITH_MUTEX: [
+ 'FILL_ORDER',
+ 'FILL_OR_KILL_ORDER',
+ 'BATCH_FILL_ORDERS',
+ 'BATCH_FILL_OR_KILL_ORDERS',
+ 'MARKET_BUY_ORDERS',
+ 'MARKET_SELL_ORDERS',
+ 'MATCH_ORDERS',
+ 'CANCEL_ORDER',
+ 'BATCH_CANCEL_ORDERS',
+ 'CANCEL_ORDERS_UP_TO',
+ 'SET_SIGNATURE_VALIDATOR_APPROVAL',
+ ],
+};
diff --git a/packages/contracts/test/utils/coverage.ts b/contracts/test-utils/src/coverage.ts
index 5becfa1b6..5becfa1b6 100644
--- a/packages/contracts/test/utils/coverage.ts
+++ b/contracts/test-utils/src/coverage.ts
diff --git a/packages/contracts/test/utils/formatters.ts b/contracts/test-utils/src/formatters.ts
index 813eb45db..813eb45db 100644
--- a/packages/contracts/test/utils/formatters.ts
+++ b/contracts/test-utils/src/formatters.ts
diff --git a/contracts/test-utils/src/global_hooks.ts b/contracts/test-utils/src/global_hooks.ts
new file mode 100644
index 000000000..307dd0777
--- /dev/null
+++ b/contracts/test-utils/src/global_hooks.ts
@@ -0,0 +1,15 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage } from './coverage';
+import { profiler } from './profiler';
+
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+});
diff --git a/contracts/test-utils/src/index.ts b/contracts/test-utils/src/index.ts
new file mode 100644
index 000000000..7880de0bf
--- /dev/null
+++ b/contracts/test-utils/src/index.ts
@@ -0,0 +1,55 @@
+export { AbstractAssetWrapper } from './abstract_asset_wrapper';
+export { chaiSetup } from './chai_setup';
+export { constants } from './constants';
+export {
+ expectContractCallFailedAsync,
+ expectContractCallFailedWithoutReasonAsync,
+ expectContractCreationFailedAsync,
+ expectContractCreationFailedWithoutReasonAsync,
+ expectInsufficientFundsAsync,
+ expectTransactionFailedAsync,
+ sendTransactionResult,
+ expectTransactionFailedWithoutReasonAsync,
+ getInvalidOpcodeErrorMessageForCallAsync,
+ getRevertReasonOrErrorMessageForSendTransactionAsync,
+} from './assertions';
+export { getLatestBlockTimestampAsync, increaseTimeAndMineBlockAsync } from './block_timestamp';
+export { provider, txDefaults, web3Wrapper } from './web3_wrapper';
+export { LogDecoder } from './log_decoder';
+export { formatters } from './formatters';
+export { signingUtils } from './signing_utils';
+export { orderUtils } from './order_utils';
+export { typeEncodingUtils } from './type_encoding_utils';
+export { profiler } from './profiler';
+export { coverage } from './coverage';
+export { addressUtils } from './address_utils';
+export { OrderFactory } from './order_factory';
+export { bytes32Values, testCombinatoriallyWithReferenceFuncAsync, uint256Values } from './combinatorial_utils';
+export { TransactionFactory } from './transaction_factory';
+export { testWithReferenceFuncAsync } from './test_with_reference';
+export {
+ MarketBuyOrders,
+ MarketSellOrders,
+ ERC721TokenIdsByOwner,
+ SignedTransaction,
+ OrderStatus,
+ AllowanceAmountScenario,
+ AssetDataScenario,
+ BalanceAmountScenario,
+ ContractName,
+ ExpirationTimeSecondsScenario,
+ TransferAmountsLoggedByMatchOrders,
+ TransferAmountsByMatchOrders,
+ OrderScenario,
+ TraderStateScenario,
+ TransactionDataParams,
+ Token,
+ FillScenario,
+ FeeRecipientAddressScenario,
+ OrderAssetAmountScenario,
+ TakerAssetFillAmountScenario,
+ TakerScenario,
+ OrderInfo,
+ ERC20BalancesByOwner,
+ FillResults,
+} from './types';
diff --git a/contracts/test-utils/src/log_decoder.ts b/contracts/test-utils/src/log_decoder.ts
new file mode 100644
index 000000000..54666ea5f
--- /dev/null
+++ b/contracts/test-utils/src/log_decoder.ts
@@ -0,0 +1,51 @@
+import { AbiDecoder, BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import {
+ AbiDefinition,
+ ContractArtifact,
+ DecodedLogArgs,
+ LogEntry,
+ LogWithDecodedArgs,
+ RawLog,
+ TransactionReceiptWithDecodedLogs,
+} from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { constants } from './constants';
+
+export class LogDecoder {
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _abiDecoder: AbiDecoder;
+ public static wrapLogBigNumbers(log: any): any {
+ const argNames = _.keys(log.args);
+ for (const argName of argNames) {
+ const isWeb3BigNumber = _.startsWith(log.args[argName].constructor.toString(), 'function BigNumber(');
+ if (isWeb3BigNumber) {
+ log.args[argName] = new BigNumber(log.args[argName]);
+ }
+ }
+ }
+ constructor(web3Wrapper: Web3Wrapper, artifacts: { [contractName: string]: ContractArtifact }) {
+ this._web3Wrapper = web3Wrapper;
+ const abiArrays: AbiDefinition[][] = [];
+ _.forEach(artifacts, (artifact: ContractArtifact) => {
+ const compilerOutput = artifact.compilerOutput;
+ abiArrays.push(compilerOutput.abi);
+ });
+ this._abiDecoder = new AbiDecoder(abiArrays);
+ }
+ public decodeLogOrThrow<ArgsType extends DecodedLogArgs>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog {
+ const logWithDecodedArgsOrLog = this._abiDecoder.tryToDecodeLogOrNoop(log);
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ if (_.isUndefined((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args)) {
+ throw new Error(`Unable to decode log: ${JSON.stringify(log)}`);
+ }
+ LogDecoder.wrapLogBigNumbers(logWithDecodedArgsOrLog);
+ return logWithDecodedArgsOrLog;
+ }
+ public async getTxWithDecodedLogsAsync(txHash: string): Promise<TransactionReceiptWithDecodedLogs> {
+ const tx = await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
+ tx.logs = _.map(tx.logs, log => this.decodeLogOrThrow(log));
+ return tx;
+ }
+}
diff --git a/packages/contracts/test/utils/order_factory.ts b/contracts/test-utils/src/order_factory.ts
index 2449d1a8a..2449d1a8a 100644
--- a/packages/contracts/test/utils/order_factory.ts
+++ b/contracts/test-utils/src/order_factory.ts
diff --git a/packages/contracts/test/utils/order_utils.ts b/contracts/test-utils/src/order_utils.ts
index 4f7a34011..4f7a34011 100644
--- a/packages/contracts/test/utils/order_utils.ts
+++ b/contracts/test-utils/src/order_utils.ts
diff --git a/packages/contracts/test/utils/profiler.ts b/contracts/test-utils/src/profiler.ts
index 2c7c1d66c..2c7c1d66c 100644
--- a/packages/contracts/test/utils/profiler.ts
+++ b/contracts/test-utils/src/profiler.ts
diff --git a/packages/contracts/test/utils/revert_trace.ts b/contracts/test-utils/src/revert_trace.ts
index 3f74fd28b..3f74fd28b 100644
--- a/packages/contracts/test/utils/revert_trace.ts
+++ b/contracts/test-utils/src/revert_trace.ts
diff --git a/packages/contracts/test/utils/signing_utils.ts b/contracts/test-utils/src/signing_utils.ts
index 21f864bfa..21f864bfa 100644
--- a/packages/contracts/test/utils/signing_utils.ts
+++ b/contracts/test-utils/src/signing_utils.ts
diff --git a/contracts/test-utils/src/test_with_reference.ts b/contracts/test-utils/src/test_with_reference.ts
new file mode 100644
index 000000000..75d15b0aa
--- /dev/null
+++ b/contracts/test-utils/src/test_with_reference.ts
@@ -0,0 +1,139 @@
+import * as chai from 'chai';
+import * as _ from 'lodash';
+
+import { chaiSetup } from './chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+class Value<T> {
+ public value: T;
+ constructor(value: T) {
+ this.value = value;
+ }
+}
+
+// tslint:disable-next-line: max-classes-per-file
+class ErrorMessage {
+ public error: string;
+ constructor(message: string) {
+ this.error = message;
+ }
+}
+
+type PromiseResult<T> = Value<T> | ErrorMessage;
+
+// TODO(albrow): This seems like a generic utility function that could exist in
+// lodash. We should replace it by a library implementation, or move it to our
+// own.
+async function evaluatePromiseAsync<T>(promise: Promise<T>): Promise<PromiseResult<T>> {
+ try {
+ return new Value<T>(await promise);
+ } catch (e) {
+ return new ErrorMessage(e.message);
+ }
+}
+
+export async function testWithReferenceFuncAsync<P0, R>(
+ referenceFunc: (p0: P0) => Promise<R>,
+ testFunc: (p0: P0) => Promise<R>,
+ values: [P0],
+): Promise<void>;
+export async function testWithReferenceFuncAsync<P0, P1, R>(
+ referenceFunc: (p0: P0, p1: P1) => Promise<R>,
+ testFunc: (p0: P0, p1: P1) => Promise<R>,
+ values: [P0, P1],
+): Promise<void>;
+export async function testWithReferenceFuncAsync<P0, P1, P2, R>(
+ referenceFunc: (p0: P0, p1: P1, p2: P2) => Promise<R>,
+ testFunc: (p0: P0, p1: P1, p2: P2) => Promise<R>,
+ values: [P0, P1, P2],
+): Promise<void>;
+export async function testWithReferenceFuncAsync<P0, P1, P2, P3, R>(
+ referenceFunc: (p0: P0, p1: P1, p2: P2, p3: P3) => Promise<R>,
+ testFunc: (p0: P0, p1: P1, p2: P2, p3: P3) => Promise<R>,
+ values: [P0, P1, P2, P3],
+): Promise<void>;
+export async function testWithReferenceFuncAsync<P0, P1, P2, P3, P4, R>(
+ referenceFunc: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) => Promise<R>,
+ testFunc: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) => Promise<R>,
+ values: [P0, P1, P2, P3, P4],
+): Promise<void>;
+
+/**
+ * Tests the behavior of a test function by comparing it to the expected
+ * behavior (defined by a reference function).
+ *
+ * First the reference function will be called to obtain an "expected result",
+ * or if the reference function throws/rejects, an "expected error". Next, the
+ * test function will be called to obtain an "actual result", or if the test
+ * function throws/rejects, an "actual error". The test passes if at least one
+ * of the following conditions is met:
+ *
+ * 1) Neither the reference function or the test function throw and the
+ * "expected result" equals the "actual result".
+ *
+ * 2) Both the reference function and the test function throw and the "actual
+ * error" message *contains* the "expected error" message.
+ *
+ * @param referenceFuncAsync a reference function implemented in pure
+ * JavaScript/TypeScript which accepts N arguments and returns the "expected
+ * result" or throws/rejects with the "expected error".
+ * @param testFuncAsync a test function which, e.g., makes a call or sends a
+ * transaction to a contract. It accepts the same N arguments returns the
+ * "actual result" or throws/rejects with the "actual error".
+ * @param values an array of N values, where each value corresponds in-order to
+ * an argument to both the test function and the reference function.
+ * @return A Promise that resolves if the test passes and rejects if the test
+ * fails, according to the rules described above.
+ */
+export async function testWithReferenceFuncAsync(
+ referenceFuncAsync: (...args: any[]) => Promise<any>,
+ testFuncAsync: (...args: any[]) => Promise<any>,
+ values: any[],
+): Promise<void> {
+ // Measure correct behaviour
+ const expected = await evaluatePromiseAsync(referenceFuncAsync(...values));
+
+ // Measure actual behaviour
+ const actual = await evaluatePromiseAsync(testFuncAsync(...values));
+
+ // Compare behaviour
+ if (expected instanceof ErrorMessage) {
+ // If we expected an error, check if the actual error message contains the
+ // expected error message.
+ if (!(actual instanceof ErrorMessage)) {
+ throw new Error(
+ `Expected error containing ${expected.error} but got no error\n\tTest case: ${_getTestCaseString(
+ referenceFuncAsync,
+ values,
+ )}`,
+ );
+ }
+ expect(actual.error).to.contain(
+ expected.error,
+ `${actual.error}\n\tTest case: ${_getTestCaseString(referenceFuncAsync, values)}`,
+ );
+ } else {
+ // If we do not expect an error, compare actual and expected directly.
+ expect(actual).to.deep.equal(expected, `Test case ${_getTestCaseString(referenceFuncAsync, values)}`);
+ }
+}
+
+function _getTestCaseString(referenceFuncAsync: (...args: any[]) => Promise<any>, values: any[]): string {
+ const paramNames = _getParameterNames(referenceFuncAsync);
+ return JSON.stringify(_.zipObject(paramNames, values));
+}
+
+// Source: https://stackoverflow.com/questions/1007981/how-to-get-function-parameter-names-values-dynamically
+function _getParameterNames(func: (...args: any[]) => any): string[] {
+ return _.toString(func)
+ .replace(/[/][/].*$/gm, '') // strip single-line comments
+ .replace(/\s+/g, '') // strip white space
+ .replace(/[/][*][^/*]*[*][/]/g, '') // strip multi-line comments
+ .split('){', 1)[0]
+ .replace(/^[^(]*[(]/, '') // extract the parameters
+ .replace(/=[^,]+/g, '') // strip any ES6 defaults
+ .split(',')
+ .filter(Boolean); // split & filter [""]
+}
diff --git a/packages/contracts/test/utils/transaction_factory.ts b/contracts/test-utils/src/transaction_factory.ts
index dbab3ade4..dbab3ade4 100644
--- a/packages/contracts/test/utils/transaction_factory.ts
+++ b/contracts/test-utils/src/transaction_factory.ts
diff --git a/packages/contracts/test/utils/type_encoding_utils.ts b/contracts/test-utils/src/type_encoding_utils.ts
index bfd9c9ef5..bfd9c9ef5 100644
--- a/packages/contracts/test/utils/type_encoding_utils.ts
+++ b/contracts/test-utils/src/type_encoding_utils.ts
diff --git a/contracts/test-utils/src/types.ts b/contracts/test-utils/src/types.ts
new file mode 100644
index 000000000..1630eab0d
--- /dev/null
+++ b/contracts/test-utils/src/types.ts
@@ -0,0 +1,243 @@
+import { OrderWithoutExchangeAddress } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { AbiDefinition } from 'ethereum-types';
+
+export interface ERC20BalancesByOwner {
+ [ownerAddress: string]: {
+ [tokenAddress: string]: BigNumber;
+ };
+}
+
+export interface ERC721TokenIdsByOwner {
+ [ownerAddress: string]: {
+ [tokenAddress: string]: BigNumber[];
+ };
+}
+
+export interface SubmissionContractEventArgs {
+ transactionId: BigNumber;
+}
+
+export interface BatchFillOrders {
+ orders: OrderWithoutExchangeAddress[];
+ signatures: string[];
+ takerAssetFillAmounts: BigNumber[];
+}
+
+export interface MarketSellOrders {
+ orders: OrderWithoutExchangeAddress[];
+ signatures: string[];
+ takerAssetFillAmount: BigNumber;
+}
+
+export interface MarketBuyOrders {
+ orders: OrderWithoutExchangeAddress[];
+ signatures: string[];
+ makerAssetFillAmount: BigNumber;
+}
+
+export interface BatchCancelOrders {
+ orders: OrderWithoutExchangeAddress[];
+}
+
+export interface CancelOrdersBefore {
+ salt: BigNumber;
+}
+
+export interface TransactionDataParams {
+ name: string;
+ abi: AbiDefinition[];
+ args: any[];
+}
+
+export interface MultiSigConfig {
+ owners: string[];
+ confirmationsRequired: number;
+ secondsRequired: number;
+}
+
+export interface MultiSigConfigByNetwork {
+ [networkName: string]: MultiSigConfig;
+}
+
+export interface Token {
+ address?: string;
+ name: string;
+ symbol: string;
+ decimals: number;
+ ipfsHash: string;
+ swarmHash: string;
+}
+
+export enum OrderStatus {
+ INVALID,
+ INVALID_MAKER_ASSET_AMOUNT,
+ INVALID_TAKER_ASSET_AMOUNT,
+ FILLABLE,
+ EXPIRED,
+ FULLY_FILLED,
+ CANCELLED,
+}
+
+export enum ContractName {
+ TokenRegistry = 'TokenRegistry',
+ MultiSigWalletWithTimeLock = 'MultiSigWalletWithTimeLock',
+ Exchange = 'Exchange',
+ ZRXToken = 'ZRXToken',
+ DummyERC20Token = 'DummyERC20Token',
+ EtherToken = 'WETH9',
+ DutchAuction = 'DutchAuction',
+ AssetProxyOwner = 'AssetProxyOwner',
+ AccountLevels = 'AccountLevels',
+ EtherDelta = 'EtherDelta',
+ Arbitrage = 'Arbitrage',
+ TestAssetDataDecoders = 'TestAssetDataDecoders',
+ TestAssetProxyDispatcher = 'TestAssetProxyDispatcher',
+ TestLibs = 'TestLibs',
+ TestSignatureValidator = 'TestSignatureValidator',
+ ERC20Proxy = 'ERC20Proxy',
+ ERC721Proxy = 'ERC721Proxy',
+ DummyERC721Receiver = 'DummyERC721Receiver',
+ DummyERC721Token = 'DummyERC721Token',
+ TestLibBytes = 'TestLibBytes',
+ TestWallet = 'TestWallet',
+ Authorizable = 'Authorizable',
+ Whitelist = 'Whitelist',
+ Forwarder = 'Forwarder',
+ BalanceThresholdFilter = 'BalanceThresholdFilter',
+}
+
+export interface SignedTransaction {
+ exchangeAddress: string;
+ salt: BigNumber;
+ signerAddress: string;
+ data: string;
+ signature: string;
+}
+
+export interface TransferAmountsByMatchOrders {
+ // Left Maker
+ amountBoughtByLeftMaker: BigNumber;
+ amountSoldByLeftMaker: BigNumber;
+ feePaidByLeftMaker: BigNumber;
+ // Right Maker
+ amountBoughtByRightMaker: BigNumber;
+ amountSoldByRightMaker: BigNumber;
+ feePaidByRightMaker: BigNumber;
+ // Taker
+ amountReceivedByTaker: BigNumber;
+ feePaidByTakerLeft: BigNumber;
+ feePaidByTakerRight: BigNumber;
+}
+
+export interface TransferAmountsLoggedByMatchOrders {
+ makerAddress: string;
+ takerAddress: string;
+ makerAssetFilledAmount: string;
+ takerAssetFilledAmount: string;
+ makerFeePaid: string;
+ takerFeePaid: string;
+}
+
+export interface OrderInfo {
+ orderStatus: number;
+ orderHash: string;
+ orderTakerAssetFilledAmount: BigNumber;
+}
+
+export interface CancelOrder {
+ order: OrderWithoutExchangeAddress;
+ takerAssetCancelAmount: BigNumber;
+}
+
+export interface MatchOrder {
+ left: OrderWithoutExchangeAddress;
+ right: OrderWithoutExchangeAddress;
+ leftSignature: string;
+ rightSignature: string;
+}
+
+// Combinatorial testing types
+
+export enum FeeRecipientAddressScenario {
+ BurnAddress = 'BURN_ADDRESS',
+ EthUserAddress = 'ETH_USER_ADDRESS',
+}
+
+export enum OrderAssetAmountScenario {
+ Zero = 'ZERO',
+ Large = 'LARGE',
+ Small = 'SMALL',
+}
+
+export enum TakerScenario {
+ CorrectlySpecified = 'CORRECTLY_SPECIFIED',
+ IncorrectlySpecified = 'INCORRECTLY_SPECIFIED',
+ Unspecified = 'UNSPECIFIED',
+}
+
+export enum ExpirationTimeSecondsScenario {
+ InPast = 'IN_PAST',
+ InFuture = 'IN_FUTURE',
+}
+
+export enum AssetDataScenario {
+ ERC20ZeroDecimals = 'ERC20_ZERO_DECIMALS',
+ ZRXFeeToken = 'ZRX_FEE_TOKEN',
+ ERC20FiveDecimals = 'ERC20_FIVE_DECIMALS',
+ ERC20NonZRXEighteenDecimals = 'ERC20_NON_ZRX_EIGHTEEN_DECIMALS',
+ ERC721 = 'ERC721',
+}
+
+export enum TakerAssetFillAmountScenario {
+ Zero = 'ZERO',
+ GreaterThanRemainingFillableTakerAssetAmount = 'GREATER_THAN_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT',
+ LessThanRemainingFillableTakerAssetAmount = 'LESS_THAN_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT',
+ ExactlyRemainingFillableTakerAssetAmount = 'EXACTLY_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT',
+}
+
+export interface OrderScenario {
+ takerScenario: TakerScenario;
+ feeRecipientScenario: FeeRecipientAddressScenario;
+ makerAssetAmountScenario: OrderAssetAmountScenario;
+ takerAssetAmountScenario: OrderAssetAmountScenario;
+ makerFeeScenario: OrderAssetAmountScenario;
+ takerFeeScenario: OrderAssetAmountScenario;
+ expirationTimeSecondsScenario: ExpirationTimeSecondsScenario;
+ makerAssetDataScenario: AssetDataScenario;
+ takerAssetDataScenario: AssetDataScenario;
+}
+
+export enum BalanceAmountScenario {
+ Exact = 'EXACT',
+ TooLow = 'TOO_LOW',
+ Higher = 'HIGHER',
+}
+
+export enum AllowanceAmountScenario {
+ Exact = 'EXACT',
+ TooLow = 'TOO_LOW',
+ Higher = 'HIGHER',
+ Unlimited = 'UNLIMITED',
+}
+
+export interface TraderStateScenario {
+ traderAssetBalance: BalanceAmountScenario;
+ traderAssetAllowance: AllowanceAmountScenario;
+ zrxFeeBalance: BalanceAmountScenario;
+ zrxFeeAllowance: AllowanceAmountScenario;
+}
+
+export interface FillScenario {
+ orderScenario: OrderScenario;
+ takerAssetFillAmountScenario: TakerAssetFillAmountScenario;
+ makerStateScenario: TraderStateScenario;
+ takerStateScenario: TraderStateScenario;
+}
+
+export interface FillResults {
+ makerAssetFilledAmount: BigNumber;
+ takerAssetFilledAmount: BigNumber;
+ makerFeePaid: BigNumber;
+ takerFeePaid: BigNumber;
+}
diff --git a/contracts/test-utils/src/web3_wrapper.ts b/contracts/test-utils/src/web3_wrapper.ts
new file mode 100644
index 000000000..cb33476f3
--- /dev/null
+++ b/contracts/test-utils/src/web3_wrapper.ts
@@ -0,0 +1,85 @@
+import { devConstants, env, EnvVars, web3Factory } from '@0x/dev-utils';
+import { prependSubprovider, Web3ProviderEngine } from '@0x/subproviders';
+import { logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as _ from 'lodash';
+
+import { coverage } from './coverage';
+import { profiler } from './profiler';
+import { revertTrace } from './revert_trace';
+
+enum ProviderType {
+ Ganache = 'ganache',
+ Geth = 'geth',
+}
+
+let testProvider: ProviderType;
+switch (process.env.TEST_PROVIDER) {
+ case undefined:
+ testProvider = ProviderType.Ganache;
+ break;
+ case 'ganache':
+ testProvider = ProviderType.Ganache;
+ break;
+ case 'geth':
+ testProvider = ProviderType.Geth;
+ break;
+ default:
+ throw new Error(`Unknown TEST_PROVIDER: ${process.env.TEST_PROVIDER}`);
+}
+
+const ganacheTxDefaults = {
+ from: devConstants.TESTRPC_FIRST_ADDRESS,
+ gas: devConstants.GAS_LIMIT,
+};
+const gethTxDefaults = {
+ from: devConstants.TESTRPC_FIRST_ADDRESS,
+};
+export const txDefaults = testProvider === ProviderType.Ganache ? ganacheTxDefaults : gethTxDefaults;
+
+const gethConfigs = {
+ shouldUseInProcessGanache: false,
+ rpcUrl: 'http://localhost:8501',
+ shouldUseFakeGasEstimate: false,
+};
+const ganacheConfigs = {
+ shouldUseInProcessGanache: true,
+};
+const providerConfigs = testProvider === ProviderType.Ganache ? ganacheConfigs : gethConfigs;
+
+export const provider: Web3ProviderEngine = web3Factory.getRpcProvider(providerConfigs);
+provider.stop();
+const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage);
+const isProfilerEnabled = env.parseBoolean(EnvVars.SolidityProfiler);
+const isRevertTraceEnabled = env.parseBoolean(EnvVars.SolidityRevertTrace);
+const enabledSubproviderCount = _.filter(
+ [isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled],
+ _.identity.bind(_),
+).length;
+if (enabledSubproviderCount > 1) {
+ throw new Error(`Only one of coverage, profiler, or revert trace subproviders can be enabled at a time`);
+}
+if (isCoverageEnabled) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ prependSubprovider(provider, coverageSubprovider);
+}
+if (isProfilerEnabled) {
+ if (testProvider === ProviderType.Ganache) {
+ logUtils.warn(
+ "Gas costs in Ganache traces are incorrect and we don't recommend using it for profiling. Please switch to Geth",
+ );
+ process.exit(1);
+ }
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ logUtils.log(
+ "By default profilerSubprovider is stopped so that you don't get noise from setup code. Don't forget to start it before the code you want to profile and stop it afterwards",
+ );
+ profilerSubprovider.stop();
+ prependSubprovider(provider, profilerSubprovider);
+}
+if (isRevertTraceEnabled) {
+ const revertTraceSubprovider = revertTrace.getRevertTraceSubproviderSingleton();
+ prependSubprovider(provider, revertTraceSubprovider);
+}
+
+export const web3Wrapper = new Web3Wrapper(provider);
diff --git a/contracts/test-utils/test/test_with_reference.ts b/contracts/test-utils/test/test_with_reference.ts
new file mode 100644
index 000000000..1c1211003
--- /dev/null
+++ b/contracts/test-utils/test/test_with_reference.ts
@@ -0,0 +1,63 @@
+import * as chai from 'chai';
+
+import { chaiSetup } from '../src/chai_setup';
+import { testWithReferenceFuncAsync } from '../src/test_with_reference';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+async function divAsync(x: number, y: number): Promise<number> {
+ if (y === 0) {
+ throw new Error('MathError: divide by zero');
+ }
+ return x / y;
+}
+
+// returns an async function that always returns the given value.
+function alwaysValueFunc(value: number): (x: number, y: number) => Promise<number> {
+ return async (x: number, y: number) => value;
+}
+
+// returns an async function which always throws/rejects with the given error
+// message.
+function alwaysFailFunc(errMessage: string): (x: number, y: number) => Promise<number> {
+ return async (x: number, y: number) => {
+ throw new Error(errMessage);
+ };
+}
+
+describe('testWithReferenceFuncAsync', () => {
+ it('passes when both succeed and actual === expected', async () => {
+ await testWithReferenceFuncAsync(alwaysValueFunc(0.5), divAsync, [1, 2]);
+ });
+
+ it('passes when both fail and actual error contains expected error', async () => {
+ await testWithReferenceFuncAsync(alwaysFailFunc('divide by zero'), divAsync, [1, 0]);
+ });
+
+ it('fails when both succeed and actual !== expected', async () => {
+ expect(testWithReferenceFuncAsync(alwaysValueFunc(3), divAsync, [1, 2])).to.be.rejectedWith(
+ 'Test case {"x":1,"y":2}: expected { value: 0.5 } to deeply equal { value: 3 }',
+ );
+ });
+
+ it('fails when both fail and actual error does not contain expected error', async () => {
+ expect(
+ testWithReferenceFuncAsync(alwaysFailFunc('Unexpected math error'), divAsync, [1, 0]),
+ ).to.be.rejectedWith(
+ 'MathError: divide by zero\n\tTest case: {"x":1,"y":0}: expected \'MathError: divide by zero\' to include \'Unexpected math error\'',
+ );
+ });
+
+ it('fails when referenceFunc succeeds and testFunc fails', async () => {
+ expect(testWithReferenceFuncAsync(alwaysValueFunc(0), divAsync, [1, 0])).to.be.rejectedWith(
+ 'Test case {"x":1,"y":0}: expected { error: \'MathError: divide by zero\' } to deeply equal { value: 0 }',
+ );
+ });
+
+ it('fails when referenceFunc fails and testFunc succeeds', async () => {
+ expect(testWithReferenceFuncAsync(alwaysFailFunc('divide by zero'), divAsync, [1, 2])).to.be.rejectedWith(
+ 'Expected error containing divide by zero but got no error\n\tTest case: {"x":1,"y":2}',
+ );
+ });
+});
diff --git a/contracts/test-utils/tsconfig.json b/contracts/test-utils/tsconfig.json
new file mode 100644
index 000000000..e35816553
--- /dev/null
+++ b/contracts/test-utils/tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib"
+ },
+ "include": ["./src/**/*", "./test/**/*"]
+}
diff --git a/contracts/test-utils/tsconfig.lint.json b/contracts/test-utils/tsconfig.lint.json
new file mode 100644
index 000000000..b557e706a
--- /dev/null
+++ b/contracts/test-utils/tsconfig.lint.json
@@ -0,0 +1,7 @@
+{
+ // This file is a workaround that issue: https://github.com/palantir/tslint/issues/4148#issuecomment-419872702
+ "extends": "./tsconfig",
+ "compilerOptions": {
+ "composite": false
+ }
+}
diff --git a/contracts/test-utils/tslint.json b/contracts/test-utils/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/test-utils/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/packages/contracts/.solhintignore b/contracts/tokens/.solhintignore
index 1e33ec53b..1e33ec53b 100644
--- a/packages/contracts/.solhintignore
+++ b/contracts/tokens/.solhintignore
diff --git a/contracts/tokens/CHANGELOG.json b/contracts/tokens/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/tokens/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/tokens/CHANGELOG.md b/contracts/tokens/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/tokens/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/tokens/DEPLOYS.json b/contracts/tokens/DEPLOYS.json
new file mode 100644
index 000000000..5ff58c035
--- /dev/null
+++ b/contracts/tokens/DEPLOYS.json
@@ -0,0 +1,16 @@
+[
+ {
+ "name": "ZRXToken",
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "protocol v1 deploy",
+ "networks": {
+ "1": "0xe41d2489571d322189246dafa5ebde1f4699f498",
+ "3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
+ "42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa"
+ }
+ }
+ ]
+ }
+]
diff --git a/contracts/tokens/README.md b/contracts/tokens/README.md
new file mode 100644
index 000000000..9c4106d41
--- /dev/null
+++ b/contracts/tokens/README.md
@@ -0,0 +1,74 @@
+## Token contracts
+
+Token smart contracts that are used in the 0x protocol. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [CHANGELOG](./CHANGELOG.json) of this package.
+
+## Usage
+
+Token contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+
+* [tokens](./contracts/tokens)
+ * This directory contains implementations of different tokens and token standards, including [wETH](https://weth.io/), ZRX, [ERC20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md), and [ERC721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md).
+* [test](./contracts/test)
+ * This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+
+## Bug bounty
+
+A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-tokens yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-tokens yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/tokens/compiler.json b/contracts/tokens/compiler.json
new file mode 100644
index 000000000..498c5d826
--- /dev/null
+++ b/contracts/tokens/compiler.json
@@ -0,0 +1,44 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": [
+ "DummyERC20Token",
+ "DummyMultipleReturnERC20Token",
+ "DummyNoReturnERC20Token",
+ "DummyERC721Receiver",
+ "InvalidERC721Receiver",
+ "DummyERC721Token",
+ "ReentrantERC20Token",
+ "ERC20Token",
+ "IERC20Token",
+ "MintableERC20Token",
+ "UnlimitedAllowanceERC20Token",
+ "ERC721Token",
+ "IERC721Receiver",
+ "IERC721Token",
+ "MintableERC721Token",
+ "IEtherToken",
+ "WETH9",
+ "ERC20Token_v1",
+ "Token_v1",
+ "UnlimitedAllowanceToken_v1",
+ "ZRXToken"
+ ]
+}
diff --git a/contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol b/contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol
new file mode 100644
index 000000000..33028db0c
--- /dev/null
+++ b/contracts/tokens/contracts/test/DummyERC20Token/DummyERC20Token.sol
@@ -0,0 +1,77 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+import "../../tokens/ERC20Token/MintableERC20Token.sol";
+
+
+contract DummyERC20Token is
+ Ownable,
+ MintableERC20Token
+{
+ string public name;
+ string public symbol;
+ uint256 public decimals;
+ uint256 public constant MAX_MINT_AMOUNT = 10000000000000000000000;
+
+ constructor (
+ string _name,
+ string _symbol,
+ uint256 _decimals,
+ uint256 _totalSupply
+ )
+ public
+ {
+ name = _name;
+ symbol = _symbol;
+ decimals = _decimals;
+ _totalSupply = _totalSupply;
+ balances[msg.sender] = _totalSupply;
+ }
+
+ /// @dev Sets the balance of target address
+ /// @param _target Address or which balance will be updated
+ /// @param _value New balance of target address
+ function setBalance(address _target, uint256 _value)
+ external
+ onlyOwner
+ {
+ uint256 currBalance = balances[_target];
+ if (_value < currBalance) {
+ _totalSupply = safeSub(_totalSupply, safeSub(currBalance, _value));
+ } else {
+ _totalSupply = safeAdd(_totalSupply, safeSub(_value, currBalance));
+ }
+ balances[_target] = _value;
+ }
+
+ /// @dev Mints new tokens for sender
+ /// @param _value Amount of tokens to mint
+ function mint(uint256 _value)
+ external
+ {
+ require(
+ _value <= MAX_MINT_AMOUNT,
+ "VALUE_TOO_LARGE"
+ );
+
+ _mint(msg.sender, _value);
+ }
+}
diff --git a/packages/contracts/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol b/contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
index 733d4437e..733d4437e 100644
--- a/packages/contracts/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
+++ b/contracts/tokens/contracts/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol
diff --git a/packages/contracts/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol b/contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol
index e16825a16..e16825a16 100644
--- a/packages/contracts/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol
+++ b/contracts/tokens/contracts/test/DummyERC20Token/DummyNoReturnERC20Token.sol
diff --git a/packages/contracts/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol b/contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol
index 6c8371559..6c8371559 100644
--- a/packages/contracts/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol
+++ b/contracts/tokens/contracts/test/DummyERC721Receiver/DummyERC721Receiver.sol
diff --git a/packages/contracts/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol b/contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol
index 309633bf5..309633bf5 100644
--- a/packages/contracts/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol
+++ b/contracts/tokens/contracts/test/DummyERC721Receiver/InvalidERC721Receiver.sol
diff --git a/contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol b/contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol
new file mode 100644
index 000000000..4c978b2df
--- /dev/null
+++ b/contracts/tokens/contracts/test/DummyERC721Token/DummyERC721Token.sol
@@ -0,0 +1,63 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+import "../../tokens/ERC721Token/MintableERC721Token.sol";
+import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
+
+
+// solhint-disable no-empty-blocks
+contract DummyERC721Token is
+ Ownable,
+ MintableERC721Token
+{
+ string public name;
+ string public symbol;
+
+ constructor (
+ string _name,
+ string _symbol
+ )
+ public
+ {
+ name = _name;
+ symbol = _symbol;
+ }
+
+ /// @dev Function to mint a new token
+ /// Reverts if the given token ID already exists
+ /// @param _to Address of the beneficiary that will own the minted token
+ /// @param _tokenId ID of the token to be minted by the msg.sender
+ function mint(address _to, uint256 _tokenId)
+ external
+ {
+ _mint(_to, _tokenId);
+ }
+
+ /// @dev Function to burn a token
+ /// Reverts if the given token ID doesn't exist or not called by contract owner
+ /// @param _owner Owner of token with given token ID
+ /// @param _tokenId ID of the token to be burned by the msg.sender
+ function burn(address _owner, uint256 _tokenId)
+ external
+ onlyOwner
+ {
+ _burn(_owner, _tokenId);
+ }
+}
diff --git a/contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol b/contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
new file mode 100644
index 000000000..d8c65929d
--- /dev/null
+++ b/contracts/tokens/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
@@ -0,0 +1,188 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+pragma experimental ABIEncoderV2;
+
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+import "../../tokens/ERC20Token/ERC20Token.sol";
+import "@0x/contracts-interfaces/contracts/protocol/Exchange/IExchange.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+
+
+// solhint-disable no-unused-vars
+contract ReentrantERC20Token is
+ ERC20Token
+{
+ using LibBytes for bytes;
+
+ // solhint-disable-next-line var-name-mixedcase
+ IExchange internal EXCHANGE;
+
+ bytes internal constant REENTRANCY_ILLEGAL_REVERT_REASON = abi.encodeWithSelector(
+ bytes4(keccak256("Error(string)")),
+ "REENTRANCY_ILLEGAL"
+ );
+
+ // All of these functions are potentially vulnerable to reentrancy
+ // We do not test any "noThrow" functions because `fillOrderNoThrow` makes a delegatecall to `fillOrder`
+ enum ExchangeFunction {
+ FILL_ORDER,
+ FILL_OR_KILL_ORDER,
+ BATCH_FILL_ORDERS,
+ BATCH_FILL_OR_KILL_ORDERS,
+ MARKET_BUY_ORDERS,
+ MARKET_SELL_ORDERS,
+ MATCH_ORDERS,
+ CANCEL_ORDER,
+ BATCH_CANCEL_ORDERS,
+ CANCEL_ORDERS_UP_TO,
+ SET_SIGNATURE_VALIDATOR_APPROVAL
+ }
+
+ uint8 internal currentFunctionId = 0;
+
+ constructor (address _exchange)
+ public
+ {
+ EXCHANGE = IExchange(_exchange);
+ }
+
+ /// @dev Set the current function that will be called when `transferFrom` is called.
+ /// @param _currentFunctionId Id that corresponds to function name.
+ function setCurrentFunction(uint8 _currentFunctionId)
+ external
+ {
+ currentFunctionId = _currentFunctionId;
+ }
+
+ /// @dev A version of `transferFrom` that attempts to reenter the Exchange contract.
+ /// @param _from The address of the sender
+ /// @param _to The address of the recipient
+ /// @param _value The amount of token to be transferred
+ function transferFrom(
+ address _from,
+ address _to,
+ uint256 _value
+ )
+ external
+ returns (bool)
+ {
+ // This order would normally be invalid, but it will be used strictly for testing reentrnacy.
+ // Any reentrancy checks will happen before any other checks that invalidate the order.
+ LibOrder.Order memory order;
+
+ // Initialize remaining null parameters
+ bytes memory signature;
+ LibOrder.Order[] memory orders;
+ uint256[] memory takerAssetFillAmounts;
+ bytes[] memory signatures;
+ bytes memory callData;
+
+ // Create callData for function that corresponds to currentFunctionId
+ if (currentFunctionId == uint8(ExchangeFunction.FILL_ORDER)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.fillOrder.selector,
+ order,
+ 0,
+ signature
+ );
+ } else if (currentFunctionId == uint8(ExchangeFunction.FILL_OR_KILL_ORDER)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.fillOrKillOrder.selector,
+ order,
+ 0,
+ signature
+ );
+ } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_FILL_ORDERS)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.batchFillOrders.selector,
+ orders,
+ takerAssetFillAmounts,
+ signatures
+ );
+ } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_FILL_OR_KILL_ORDERS)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.batchFillOrKillOrders.selector,
+ orders,
+ takerAssetFillAmounts,
+ signatures
+ );
+ } else if (currentFunctionId == uint8(ExchangeFunction.MARKET_BUY_ORDERS)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.marketBuyOrders.selector,
+ orders,
+ 0,
+ signatures
+ );
+ } else if (currentFunctionId == uint8(ExchangeFunction.MARKET_SELL_ORDERS)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.marketSellOrders.selector,
+ orders,
+ 0,
+ signatures
+ );
+ } else if (currentFunctionId == uint8(ExchangeFunction.MATCH_ORDERS)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.matchOrders.selector,
+ order,
+ order,
+ signature,
+ signature
+ );
+ } else if (currentFunctionId == uint8(ExchangeFunction.CANCEL_ORDER)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.cancelOrder.selector,
+ order
+ );
+ } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_CANCEL_ORDERS)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.batchCancelOrders.selector,
+ orders
+ );
+ } else if (currentFunctionId == uint8(ExchangeFunction.CANCEL_ORDERS_UP_TO)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.cancelOrdersUpTo.selector,
+ 0
+ );
+ } else if (currentFunctionId == uint8(ExchangeFunction.SET_SIGNATURE_VALIDATOR_APPROVAL)) {
+ callData = abi.encodeWithSelector(
+ EXCHANGE.setSignatureValidatorApproval.selector,
+ address(0),
+ false
+ );
+ }
+
+ // Call Exchange function, swallow error
+ address(EXCHANGE).call(callData);
+
+ // Revert reason is 100 bytes
+ bytes memory returnData = new bytes(100);
+
+ // Copy return data
+ assembly {
+ returndatacopy(add(returnData, 32), 0, 100)
+ }
+
+ // Revert if function reverted with REENTRANCY_ILLEGAL error
+ require(!REENTRANCY_ILLEGAL_REVERT_REASON.equals(returnData));
+
+ // Transfer will return true if function failed for any other reason
+ return true;
+ }
+} \ No newline at end of file
diff --git a/contracts/tokens/contracts/tokens/ERC20Token/ERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/ERC20Token.sol
new file mode 100644
index 000000000..190eead76
--- /dev/null
+++ b/contracts/tokens/contracts/tokens/ERC20Token/ERC20Token.sol
@@ -0,0 +1,148 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "./IERC20Token.sol";
+
+
+contract ERC20Token is
+ IERC20Token
+{
+ mapping (address => uint256) internal balances;
+ mapping (address => mapping (address => uint256)) internal allowed;
+
+ uint256 internal _totalSupply;
+
+ /// @dev send `value` token to `to` from `msg.sender`
+ /// @param _to The address of the recipient
+ /// @param _value The amount of token to be transferred
+ /// @return True if transfer was successful
+ function transfer(address _to, uint256 _value)
+ external
+ returns (bool)
+ {
+ require(
+ balances[msg.sender] >= _value,
+ "ERC20_INSUFFICIENT_BALANCE"
+ );
+ require(
+ balances[_to] + _value >= balances[_to],
+ "UINT256_OVERFLOW"
+ );
+
+ balances[msg.sender] -= _value;
+ balances[_to] += _value;
+
+ emit Transfer(
+ msg.sender,
+ _to,
+ _value
+ );
+
+ return true;
+ }
+
+ /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`
+ /// @param _from The address of the sender
+ /// @param _to The address of the recipient
+ /// @param _value The amount of token to be transferred
+ /// @return True if transfer was successful
+ function transferFrom(
+ address _from,
+ address _to,
+ uint256 _value
+ )
+ external
+ returns (bool)
+ {
+ require(
+ balances[_from] >= _value,
+ "ERC20_INSUFFICIENT_BALANCE"
+ );
+ require(
+ allowed[_from][msg.sender] >= _value,
+ "ERC20_INSUFFICIENT_ALLOWANCE"
+ );
+ require(
+ balances[_to] + _value >= balances[_to],
+ "UINT256_OVERFLOW"
+ );
+
+ balances[_to] += _value;
+ balances[_from] -= _value;
+ allowed[_from][msg.sender] -= _value;
+
+ emit Transfer(
+ _from,
+ _to,
+ _value
+ );
+
+ return true;
+ }
+
+ /// @dev `msg.sender` approves `_spender` to spend `_value` tokens
+ /// @param _spender The address of the account able to transfer the tokens
+ /// @param _value The amount of wei to be approved for transfer
+ /// @return Always true if the call has enough gas to complete execution
+ function approve(address _spender, uint256 _value)
+ external
+ returns (bool)
+ {
+ allowed[msg.sender][_spender] = _value;
+ emit Approval(
+ msg.sender,
+ _spender,
+ _value
+ );
+ return true;
+ }
+
+ /// @dev Query total supply of token
+ /// @return Total supply of token
+ function totalSupply()
+ external
+ view
+ returns (uint256)
+ {
+ return _totalSupply;
+ }
+
+ /// @dev Query the balance of owner
+ /// @param _owner The address from which the balance will be retrieved
+ /// @return Balance of owner
+ function balanceOf(address _owner)
+ external
+ view
+ returns (uint256)
+ {
+ return balances[_owner];
+ }
+
+ /// @param _owner The address of the account owning tokens
+ /// @param _spender The address of the account able to transfer the tokens
+ /// @return Amount of remaining tokens allowed to spent
+ function allowance(address _owner, address _spender)
+ external
+ view
+ returns (uint256)
+ {
+ return allowed[_owner][_spender];
+ }
+}
diff --git a/contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol
new file mode 100644
index 000000000..9f9b89585
--- /dev/null
+++ b/contracts/tokens/contracts/tokens/ERC20Token/IERC20Token.sol
@@ -0,0 +1,87 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract IERC20Token {
+
+ // solhint-disable no-simple-event-func-name
+ event Transfer(
+ address indexed _from,
+ address indexed _to,
+ uint256 _value
+ );
+
+ event Approval(
+ address indexed _owner,
+ address indexed _spender,
+ uint256 _value
+ );
+
+ /// @dev send `value` token to `to` from `msg.sender`
+ /// @param _to The address of the recipient
+ /// @param _value The amount of token to be transferred
+ /// @return True if transfer was successful
+ function transfer(address _to, uint256 _value)
+ external
+ returns (bool);
+
+ /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`
+ /// @param _from The address of the sender
+ /// @param _to The address of the recipient
+ /// @param _value The amount of token to be transferred
+ /// @return True if transfer was successful
+ function transferFrom(
+ address _from,
+ address _to,
+ uint256 _value
+ )
+ external
+ returns (bool);
+
+ /// @dev `msg.sender` approves `_spender` to spend `_value` tokens
+ /// @param _spender The address of the account able to transfer the tokens
+ /// @param _value The amount of wei to be approved for transfer
+ /// @return Always true if the call has enough gas to complete execution
+ function approve(address _spender, uint256 _value)
+ external
+ returns (bool);
+
+ /// @dev Query total supply of token
+ /// @return Total supply of token
+ function totalSupply()
+ external
+ view
+ returns (uint256);
+
+ /// @param _owner The address from which the balance will be retrieved
+ /// @return Balance of owner
+ function balanceOf(address _owner)
+ external
+ view
+ returns (uint256);
+
+ /// @param _owner The address of the account owning tokens
+ /// @param _spender The address of the account able to transfer the tokens
+ /// @return Amount of remaining tokens allowed to spent
+ function allowance(address _owner, address _spender)
+ external
+ view
+ returns (uint256);
+}
diff --git a/contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol
new file mode 100644
index 000000000..a66031f03
--- /dev/null
+++ b/contracts/tokens/contracts/tokens/ERC20Token/MintableERC20Token.sol
@@ -0,0 +1,60 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
+import "./UnlimitedAllowanceERC20Token.sol";
+
+
+contract MintableERC20Token is
+ SafeMath,
+ UnlimitedAllowanceERC20Token
+{
+ /// @dev Mints new tokens
+ /// @param _to Address of the beneficiary that will own the minted token
+ /// @param _value Amount of tokens to mint
+ function _mint(address _to, uint256 _value)
+ internal
+ {
+ balances[_to] = safeAdd(_value, balances[_to]);
+ _totalSupply = safeAdd(_totalSupply, _value);
+
+ emit Transfer(
+ address(0),
+ _to,
+ _value
+ );
+ }
+
+ /// @dev Mints new tokens
+ /// @param _owner Owner of tokens that will be burned
+ /// @param _value Amount of tokens to burn
+ function _burn(address _owner, uint256 _value)
+ internal
+ {
+ balances[_owner] = safeSub(balances[_owner], _value);
+ _totalSupply = safeSub(_totalSupply, _value);
+
+ emit Transfer(
+ _owner,
+ address(0),
+ _value
+ );
+ }
+}
diff --git a/contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol b/contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
new file mode 100644
index 000000000..869d16147
--- /dev/null
+++ b/contracts/tokens/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
@@ -0,0 +1,70 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "../ERC20Token/ERC20Token.sol";
+
+
+contract UnlimitedAllowanceERC20Token is
+ ERC20Token
+{
+ uint256 constant internal MAX_UINT = 2**256 - 1;
+
+ /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717
+ /// @param _from Address to transfer from.
+ /// @param _to Address to transfer to.
+ /// @param _value Amount to transfer.
+ /// @return Success of transfer.
+ function transferFrom(
+ address _from,
+ address _to,
+ uint256 _value
+ )
+ external
+ returns (bool)
+ {
+ uint256 allowance = allowed[_from][msg.sender];
+ require(
+ balances[_from] >= _value,
+ "ERC20_INSUFFICIENT_BALANCE"
+ );
+ require(
+ allowance >= _value,
+ "ERC20_INSUFFICIENT_ALLOWANCE"
+ );
+ require(
+ balances[_to] + _value >= balances[_to],
+ "UINT256_OVERFLOW"
+ );
+
+ balances[_to] += _value;
+ balances[_from] -= _value;
+ if (allowance < MAX_UINT) {
+ allowed[_from][msg.sender] -= _value;
+ }
+
+ emit Transfer(
+ _from,
+ _to,
+ _value
+ );
+
+ return true;
+ }
+}
diff --git a/contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol b/contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol
new file mode 100644
index 000000000..c46bd0af4
--- /dev/null
+++ b/contracts/tokens/contracts/tokens/ERC721Token/ERC721Token.sol
@@ -0,0 +1,277 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "./IERC721Token.sol";
+import "./IERC721Receiver.sol";
+import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
+
+
+contract ERC721Token is
+ IERC721Token,
+ SafeMath
+{
+ // Function selector for ERC721Receiver.onERC721Received
+ // 0x150b7a02
+ bytes4 constant internal ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
+
+ // Mapping of tokenId => owner
+ mapping (uint256 => address) internal owners;
+
+ // Mapping of tokenId => approved address
+ mapping (uint256 => address) internal approvals;
+
+ // Mapping of owner => number of tokens owned
+ mapping (address => uint256) internal balances;
+
+ // Mapping of owner => operator => approved
+ mapping (address => mapping (address => bool)) internal operatorApprovals;
+
+ /// @notice Transfers the ownership of an NFT from one address to another address
+ /// @dev Throws unless `msg.sender` is the current owner, an authorized
+ /// operator, or the approved address for this NFT. Throws if `_from` is
+ /// not the current owner. Throws if `_to` is the zero address. Throws if
+ /// `_tokenId` is not a valid NFT. When transfer is complete, this function
+ /// checks if `_to` is a smart contract (code size > 0). If so, it calls
+ /// `onERC721Received` on `_to` and throws if the return value is not
+ /// `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
+ /// @param _from The current owner of the NFT
+ /// @param _to The new owner
+ /// @param _tokenId The NFT to transfer
+ /// @param _data Additional data with no specified format, sent in call to `_to`
+ function safeTransferFrom(
+ address _from,
+ address _to,
+ uint256 _tokenId,
+ bytes _data
+ )
+ external
+ {
+ transferFrom(
+ _from,
+ _to,
+ _tokenId
+ );
+
+ uint256 receiverCodeSize;
+ assembly {
+ receiverCodeSize := extcodesize(_to)
+ }
+ if (receiverCodeSize > 0) {
+ bytes4 selector = IERC721Receiver(_to).onERC721Received(
+ msg.sender,
+ _from,
+ _tokenId,
+ _data
+ );
+ require(
+ selector == ERC721_RECEIVED,
+ "ERC721_INVALID_SELECTOR"
+ );
+ }
+ }
+
+ /// @notice Transfers the ownership of an NFT from one address to another address
+ /// @dev This works identically to the other function with an extra data parameter,
+ /// except this function just sets data to "".
+ /// @param _from The current owner of the NFT
+ /// @param _to The new owner
+ /// @param _tokenId The NFT to transfer
+ function safeTransferFrom(
+ address _from,
+ address _to,
+ uint256 _tokenId
+ )
+ external
+ {
+ transferFrom(
+ _from,
+ _to,
+ _tokenId
+ );
+
+ uint256 receiverCodeSize;
+ assembly {
+ receiverCodeSize := extcodesize(_to)
+ }
+ if (receiverCodeSize > 0) {
+ bytes4 selector = IERC721Receiver(_to).onERC721Received(
+ msg.sender,
+ _from,
+ _tokenId,
+ ""
+ );
+ require(
+ selector == ERC721_RECEIVED,
+ "ERC721_INVALID_SELECTOR"
+ );
+ }
+ }
+
+ /// @notice Change or reaffirm the approved address for an NFT
+ /// @dev The zero address indicates there is no approved address.
+ /// Throws unless `msg.sender` is the current NFT owner, or an authorized
+ /// operator of the current owner.
+ /// @param _approved The new approved NFT controller
+ /// @param _tokenId The NFT to approve
+ function approve(address _approved, uint256 _tokenId)
+ external
+ {
+ address owner = ownerOf(_tokenId);
+ require(
+ msg.sender == owner || isApprovedForAll(owner, msg.sender),
+ "ERC721_INVALID_SENDER"
+ );
+
+ approvals[_tokenId] = _approved;
+ emit Approval(
+ owner,
+ _approved,
+ _tokenId
+ );
+ }
+
+ /// @notice Enable or disable approval for a third party ("operator") to manage
+ /// all of `msg.sender`'s assets
+ /// @dev Emits the ApprovalForAll event. The contract MUST allow
+ /// multiple operators per owner.
+ /// @param _operator Address to add to the set of authorized operators
+ /// @param _approved True if the operator is approved, false to revoke approval
+ function setApprovalForAll(address _operator, bool _approved)
+ external
+ {
+ operatorApprovals[msg.sender][_operator] = _approved;
+ emit ApprovalForAll(
+ msg.sender,
+ _operator,
+ _approved
+ );
+ }
+
+ /// @notice Count all NFTs assigned to an owner
+ /// @dev NFTs assigned to the zero address are considered invalid, and this
+ /// function throws for queries about the zero address.
+ /// @param _owner An address for whom to query the balance
+ /// @return The number of NFTs owned by `_owner`, possibly zero
+ function balanceOf(address _owner)
+ external
+ view
+ returns (uint256)
+ {
+ require(
+ _owner != address(0),
+ "ERC721_ZERO_OWNER"
+ );
+ return balances[_owner];
+ }
+
+ /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
+ /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
+ /// THEY MAY BE PERMANENTLY LOST
+ /// @dev Throws unless `msg.sender` is the current owner, an authorized
+ /// operator, or the approved address for this NFT. Throws if `_from` is
+ /// not the current owner. Throws if `_to` is the zero address. Throws if
+ /// `_tokenId` is not a valid NFT.
+ /// @param _from The current owner of the NFT
+ /// @param _to The new owner
+ /// @param _tokenId The NFT to transfer
+ function transferFrom(
+ address _from,
+ address _to,
+ uint256 _tokenId
+ )
+ public
+ {
+ require(
+ _to != address(0),
+ "ERC721_ZERO_TO_ADDRESS"
+ );
+
+ address owner = ownerOf(_tokenId);
+ require(
+ _from == owner,
+ "ERC721_OWNER_MISMATCH"
+ );
+
+ address spender = msg.sender;
+ address approvedAddress = getApproved(_tokenId);
+ require(
+ spender == owner ||
+ isApprovedForAll(owner, spender) ||
+ approvedAddress == spender,
+ "ERC721_INVALID_SPENDER"
+ );
+
+ if (approvedAddress != address(0)) {
+ approvals[_tokenId] = address(0);
+ }
+
+ owners[_tokenId] = _to;
+ balances[_from] = safeSub(balances[_from], 1);
+ balances[_to] = safeAdd(balances[_to], 1);
+
+ emit Transfer(
+ _from,
+ _to,
+ _tokenId
+ );
+ }
+
+ /// @notice Find the owner of an NFT
+ /// @dev NFTs assigned to zero address are considered invalid, and queries
+ /// about them do throw.
+ /// @param _tokenId The identifier for an NFT
+ /// @return The address of the owner of the NFT
+ function ownerOf(uint256 _tokenId)
+ public
+ view
+ returns (address)
+ {
+ address owner = owners[_tokenId];
+ require(
+ owner != address(0),
+ "ERC721_ZERO_OWNER"
+ );
+ return owner;
+ }
+
+ /// @notice Get the approved address for a single NFT
+ /// @dev Throws if `_tokenId` is not a valid NFT.
+ /// @param _tokenId The NFT to find the approved address for
+ /// @return The approved address for this NFT, or the zero address if there is none
+ function getApproved(uint256 _tokenId)
+ public
+ view
+ returns (address)
+ {
+ return approvals[_tokenId];
+ }
+
+ /// @notice Query if an address is an authorized operator for another address
+ /// @param _owner The address that owns the NFTs
+ /// @param _operator The address that acts on behalf of the owner
+ /// @return True if `_operator` is an approved operator for `_owner`, false otherwise
+ function isApprovedForAll(address _owner, address _operator)
+ public
+ view
+ returns (bool)
+ {
+ return operatorApprovals[_owner][_operator];
+ }
+}
diff --git a/contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol
new file mode 100644
index 000000000..c3ad35ede
--- /dev/null
+++ b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Receiver.sol
@@ -0,0 +1,44 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract IERC721Receiver {
+
+ /// @notice Handle the receipt of an NFT
+ /// @dev The ERC721 smart contract calls this function on the recipient
+ /// after a `transfer`. This function MAY throw to revert and reject the
+ /// transfer. Return of other than the magic value MUST result in the
+ /// transaction being reverted.
+ /// Note: the contract address is always the message sender.
+ /// @param _operator The address which called `safeTransferFrom` function
+ /// @param _from The address which previously owned the token
+ /// @param _tokenId The NFT identifier which is being transferred
+ /// @param _data Additional data with no specified format
+ /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
+ /// unless throwing
+ function onERC721Received(
+ address _operator,
+ address _from,
+ uint256 _tokenId,
+ bytes _data
+ )
+ external
+ returns (bytes4);
+}
diff --git a/contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol
new file mode 100644
index 000000000..56a3314df
--- /dev/null
+++ b/contracts/tokens/contracts/tokens/ERC721Token/IERC721Token.sol
@@ -0,0 +1,158 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract IERC721Token {
+
+ /// @dev This emits when ownership of any NFT changes by any mechanism.
+ /// This event emits when NFTs are created (`from` == 0) and destroyed
+ /// (`to` == 0). Exception: during contract creation, any number of NFTs
+ /// may be created and assigned without emitting Transfer. At the time of
+ /// any transfer, the approved address for that NFT (if any) is reset to none.
+ event Transfer(
+ address indexed _from,
+ address indexed _to,
+ uint256 indexed _tokenId
+ );
+
+ /// @dev This emits when the approved address for an NFT is changed or
+ /// reaffirmed. The zero address indicates there is no approved address.
+ /// When a Transfer event emits, this also indicates that the approved
+ /// address for that NFT (if any) is reset to none.
+ event Approval(
+ address indexed _owner,
+ address indexed _approved,
+ uint256 indexed _tokenId
+ );
+
+ /// @dev This emits when an operator is enabled or disabled for an owner.
+ /// The operator can manage all NFTs of the owner.
+ event ApprovalForAll(
+ address indexed _owner,
+ address indexed _operator,
+ bool _approved
+ );
+
+ /// @notice Transfers the ownership of an NFT from one address to another address
+ /// @dev Throws unless `msg.sender` is the current owner, an authorized
+ /// perator, or the approved address for this NFT. Throws if `_from` is
+ /// not the current owner. Throws if `_to` is the zero address. Throws if
+ /// `_tokenId` is not a valid NFT. When transfer is complete, this function
+ /// checks if `_to` is a smart contract (code size > 0). If so, it calls
+ /// `onERC721Received` on `_to` and throws if the return value is not
+ /// `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
+ /// @param _from The current owner of the NFT
+ /// @param _to The new owner
+ /// @param _tokenId The NFT to transfer
+ /// @param _data Additional data with no specified format, sent in call to `_to`
+ function safeTransferFrom(
+ address _from,
+ address _to,
+ uint256 _tokenId,
+ bytes _data
+ )
+ external;
+
+ /// @notice Transfers the ownership of an NFT from one address to another address
+ /// @dev This works identically to the other function with an extra data parameter,
+ /// except this function just sets data to "".
+ /// @param _from The current owner of the NFT
+ /// @param _to The new owner
+ /// @param _tokenId The NFT to transfer
+ function safeTransferFrom(
+ address _from,
+ address _to,
+ uint256 _tokenId
+ )
+ external;
+
+ /// @notice Change or reaffirm the approved address for an NFT
+ /// @dev The zero address indicates there is no approved address.
+ /// Throws unless `msg.sender` is the current NFT owner, or an authorized
+ /// operator of the current owner.
+ /// @param _approved The new approved NFT controller
+ /// @param _tokenId The NFT to approve
+ function approve(address _approved, uint256 _tokenId)
+ external;
+
+ /// @notice Enable or disable approval for a third party ("operator") to manage
+ /// all of `msg.sender`'s assets
+ /// @dev Emits the ApprovalForAll event. The contract MUST allow
+ /// multiple operators per owner.
+ /// @param _operator Address to add to the set of authorized operators
+ /// @param _approved True if the operator is approved, false to revoke approval
+ function setApprovalForAll(address _operator, bool _approved)
+ external;
+
+ /// @notice Count all NFTs assigned to an owner
+ /// @dev NFTs assigned to the zero address are considered invalid, and this
+ /// function throws for queries about the zero address.
+ /// @param _owner An address for whom to query the balance
+ /// @return The number of NFTs owned by `_owner`, possibly zero
+ function balanceOf(address _owner)
+ external
+ view
+ returns (uint256);
+
+ /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
+ /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
+ /// THEY MAY BE PERMANENTLY LOST
+ /// @dev Throws unless `msg.sender` is the current owner, an authorized
+ /// operator, or the approved address for this NFT. Throws if `_from` is
+ /// not the current owner. Throws if `_to` is the zero address. Throws if
+ /// `_tokenId` is not a valid NFT.
+ /// @param _from The current owner of the NFT
+ /// @param _to The new owner
+ /// @param _tokenId The NFT to transfer
+ function transferFrom(
+ address _from,
+ address _to,
+ uint256 _tokenId
+ )
+ public;
+
+ /// @notice Find the owner of an NFT
+ /// @dev NFTs assigned to zero address are considered invalid, and queries
+ /// about them do throw.
+ /// @param _tokenId The identifier for an NFT
+ /// @return The address of the owner of the NFT
+ function ownerOf(uint256 _tokenId)
+ public
+ view
+ returns (address);
+
+ /// @notice Get the approved address for a single NFT
+ /// @dev Throws if `_tokenId` is not a valid NFT.
+ /// @param _tokenId The NFT to find the approved address for
+ /// @return The approved address for this NFT, or the zero address if there is none
+ function getApproved(uint256 _tokenId)
+ public
+ view
+ returns (address);
+
+ /// @notice Query if an address is an authorized operator for another address
+ /// @param _owner The address that owns the NFTs
+ /// @param _operator The address that acts on behalf of the owner
+ /// @return True if `_operator` is an approved operator for `_owner`, false otherwise
+ function isApprovedForAll(address _owner, address _operator)
+ public
+ view
+ returns (bool);
+}
diff --git a/contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol b/contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol
new file mode 100644
index 000000000..27326d857
--- /dev/null
+++ b/contracts/tokens/contracts/tokens/ERC721Token/MintableERC721Token.sol
@@ -0,0 +1,82 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "./ERC721Token.sol";
+
+
+contract MintableERC721Token is
+ ERC721Token
+{
+ /// @dev Function to mint a new token
+ /// Reverts if the given token ID already exists
+ /// @param _to Address of the beneficiary that will own the minted token
+ /// @param _tokenId ID of the token to be minted by the msg.sender
+ function _mint(address _to, uint256 _tokenId)
+ internal
+ {
+ require(
+ _to != address(0),
+ "ERC721_ZERO_TO_ADDRESS"
+ );
+
+ address owner = owners[_tokenId];
+ require(
+ owner == address(0),
+ "ERC721_OWNER_ALREADY_EXISTS"
+ );
+
+ owners[_tokenId] = _to;
+ balances[_to] = safeAdd(balances[_to], 1);
+
+ emit Transfer(
+ address(0),
+ _to,
+ _tokenId
+ );
+ }
+
+ /// @dev Function to burn a token
+ /// Reverts if the given token ID doesn't exist
+ /// @param _owner Owner of token with given token ID
+ /// @param _tokenId ID of the token to be burned by the msg.sender
+ function _burn(address _owner, uint256 _tokenId)
+ internal
+ {
+ require(
+ _owner != address(0),
+ "ERC721_ZERO_OWNER_ADDRESS"
+ );
+
+ address owner = owners[_tokenId];
+ require(
+ owner == _owner,
+ "ERC721_OWNER_MISMATCH"
+ );
+
+ owners[_tokenId] = address(0);
+ balances[_owner] = safeSub(balances[_owner], 1);
+
+ emit Transfer(
+ _owner,
+ address(0),
+ _tokenId
+ );
+ }
+}
diff --git a/contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol b/contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol
new file mode 100644
index 000000000..32baa3eb0
--- /dev/null
+++ b/contracts/tokens/contracts/tokens/EtherToken/IEtherToken.sol
@@ -0,0 +1,33 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+import "../ERC20Token/IERC20Token.sol";
+
+
+contract IEtherToken is
+ IERC20Token
+{
+ function deposit()
+ public
+ payable;
+
+ function withdraw(uint256 amount)
+ public;
+}
diff --git a/packages/contracts/contracts/tokens/EtherToken/WETH9.sol b/contracts/tokens/contracts/tokens/EtherToken/WETH9.sol
index 17876b86d..17876b86d 100644
--- a/packages/contracts/contracts/tokens/EtherToken/WETH9.sol
+++ b/contracts/tokens/contracts/tokens/EtherToken/WETH9.sol
diff --git a/packages/contracts/contracts/tokens/ZRXToken/ERC20Token_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol
index 4920c4aac..4920c4aac 100644
--- a/packages/contracts/contracts/tokens/ZRXToken/ERC20Token_v1.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/ERC20Token_v1.sol
diff --git a/packages/contracts/contracts/tokens/ZRXToken/Token_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol
index de619fb7e..de619fb7e 100644
--- a/packages/contracts/contracts/tokens/ZRXToken/Token_v1.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/Token_v1.sol
diff --git a/packages/contracts/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol b/contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol
index bf1b0335a..bf1b0335a 100644
--- a/packages/contracts/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol
diff --git a/packages/contracts/contracts/tokens/ZRXToken/ZRXToken.sol b/contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol
index 831e1822c..831e1822c 100644
--- a/packages/contracts/contracts/tokens/ZRXToken/ZRXToken.sol
+++ b/contracts/tokens/contracts/tokens/ZRXToken/ZRXToken.sol
diff --git a/contracts/tokens/package.json b/contracts/tokens/package.json
new file mode 100644
index 000000000..79afc4820
--- /dev/null
+++ b/contracts/tokens/package.json
@@ -0,0 +1,93 @@
+{
+ "name": "@0x/contracts-tokens",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Token contracts used by 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
+ "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "compile": "sol-compiler",
+ "watch": "sol-compiler -w",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "coverage:report:text": "istanbul report text",
+ "coverage:report:html": "istanbul report html && open coverage/index.html",
+ "profiler:report:html": "istanbul report html && open coverage/index.html",
+ "coverage:report:lcov": "istanbul report lcov",
+ "test:circleci": "yarn test",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(DummyERC20Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|DummyERC721Receiver|InvalidERC721Receiver|DummyERC721Token|ReentrantERC20Token|ERC20Token|IERC20Token|MintableERC20Token|UnlimitedAllowanceERC20Token|ERC721Token|IERC721Receiver|IERC721Token|MintableERC721Token|IEtherToken|WETH9|ERC20Token_v1|Token_v1|UnlimitedAllowanceToken_v1|ZRXToken).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-interfaces": "^1.0.2",
+ "@0x/contracts-libs": "^1.0.2",
+ "@0x/contracts-multisig": "^1.0.2",
+ "@0x/contracts-utils": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.4",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/tokens/src/artifacts/index.ts b/contracts/tokens/src/artifacts/index.ts
new file mode 100644
index 000000000..977d01c3e
--- /dev/null
+++ b/contracts/tokens/src/artifacts/index.ts
@@ -0,0 +1,50 @@
+import { ContractArtifact } from 'ethereum-types';
+
+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 ERC20Token from '../../generated-artifacts/ERC20Token.json';
+import * as ERC20Token_v1 from '../../generated-artifacts/ERC20Token_v1.json';
+import * as ERC721Token from '../../generated-artifacts/ERC721Token.json';
+import * as IERC20Token from '../../generated-artifacts/IERC20Token.json';
+import * as IERC721Receiver from '../../generated-artifacts/IERC721Receiver.json';
+import * as IERC721Token from '../../generated-artifacts/IERC721Token.json';
+import * as IEtherToken from '../../generated-artifacts/IEtherToken.json';
+import * as InvalidERC721Receiver from '../../generated-artifacts/InvalidERC721Receiver.json';
+import * as MintableERC20Token from '../../generated-artifacts/MintableERC20Token.json';
+import * as MintableERC721Token from '../../generated-artifacts/MintableERC721Token.json';
+import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20Token.json';
+import * as Token_v1 from '../../generated-artifacts/Token_v1.json';
+import * as UnlimitedAllowanceERC20Token from '../../generated-artifacts/UnlimitedAllowanceERC20Token.json';
+import * as UnlimitedAllowanceToken_v1 from '../../generated-artifacts/UnlimitedAllowanceToken_v1.json';
+import * as WETH9 from '../../generated-artifacts/WETH9.json';
+import * as ZRXToken from '../../generated-artifacts/ZRXToken.json';
+
+// tslint:disable:no-unnecessary-type-assertion
+export const artifacts = {
+ DummyERC20Token: DummyERC20Token as ContractArtifact,
+ DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,
+ DummyNoReturnERC20Token: DummyNoReturnERC20Token as ContractArtifact,
+ DummyERC721Receiver: DummyERC721Receiver as ContractArtifact,
+ InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact,
+ DummyERC721Token: DummyERC721Token as ContractArtifact,
+ ReentrantERC20Token: ReentrantERC20Token as ContractArtifact,
+ ERC20Token: ERC20Token as ContractArtifact,
+ IERC20Token: IERC20Token as ContractArtifact,
+ MintableERC20Token: MintableERC20Token as ContractArtifact,
+ UnlimitedAllowanceERC20Token: UnlimitedAllowanceERC20Token as ContractArtifact,
+ ERC721Token: ERC721Token as ContractArtifact,
+ IERC721Receiver: IERC721Receiver as ContractArtifact,
+ IERC721Token: IERC721Token as ContractArtifact,
+ MintableERC721Token: MintableERC721Token as ContractArtifact,
+ IEtherToken: IEtherToken as ContractArtifact,
+ WETH9: WETH9 as ContractArtifact,
+ ERC20Token_v1: ERC20Token_v1 as ContractArtifact,
+ Token_v1: Token_v1 as ContractArtifact,
+ UnlimitedAllowanceToken_v1: UnlimitedAllowanceToken_v1 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/contracts/tokens/src/index.ts b/contracts/tokens/src/index.ts
new file mode 100644
index 000000000..91dd7e0e3
--- /dev/null
+++ b/contracts/tokens/src/index.ts
@@ -0,0 +1,2 @@
+export * from './wrappers';
+export * from './artifacts';
diff --git a/contracts/tokens/src/wrappers/index.ts b/contracts/tokens/src/wrappers/index.ts
new file mode 100644
index 000000000..98bf26657
--- /dev/null
+++ b/contracts/tokens/src/wrappers/index.ts
@@ -0,0 +1,21 @@
+export * from '../../generated-wrappers/zrx_token';
+export * from '../../generated-wrappers/weth9';
+export * from '../../generated-wrappers/unlimitedallowancetoken_v1';
+export * from '../../generated-wrappers/unlimited_allowance_erc20_token';
+export * from '../../generated-wrappers/token_v1';
+export * from '../../generated-wrappers/reentrant_erc20_token';
+export * from '../../generated-wrappers/mintable_erc721_token';
+export * from '../../generated-wrappers/mintable_erc20_token';
+export * from '../../generated-wrappers/invalid_erc721_receiver';
+export * from '../../generated-wrappers/i_ether_token';
+export * from '../../generated-wrappers/i_erc721_token';
+export * from '../../generated-wrappers/i_erc721_receiver';
+export * from '../../generated-wrappers/i_erc20_token';
+export * from '../../generated-wrappers/erc721_token';
+export * from '../../generated-wrappers/erc20token_v1';
+export * from '../../generated-wrappers/erc20_token';
+export * from '../../generated-wrappers/dummy_no_return_erc20_token';
+export * from '../../generated-wrappers/dummy_multiple_return_erc20_token';
+export * from '../../generated-wrappers/dummy_erc721_token';
+export * from '../../generated-wrappers/dummy_erc721_receiver';
+export * from '../../generated-wrappers/dummy_erc20_token';
diff --git a/contracts/tokens/test/erc721_token.ts b/contracts/tokens/test/erc721_token.ts
new file mode 100644
index 000000000..13332cd35
--- /dev/null
+++ b/contracts/tokens/test/erc721_token.ts
@@ -0,0 +1,282 @@
+import {
+ chaiSetup,
+ constants,
+ expectTransactionFailedAsync,
+ expectTransactionFailedWithoutReasonAsync,
+ LogDecoder,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+
+import {
+ artifacts,
+ DummyERC721ReceiverContract,
+ DummyERC721ReceiverTokenReceivedEventArgs,
+ DummyERC721TokenContract,
+ DummyERC721TokenTransferEventArgs,
+ InvalidERC721ReceiverContract,
+} from '../src';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+// tslint:disable:no-unnecessary-type-assertion
+describe('ERC721Token', () => {
+ let owner: string;
+ let spender: string;
+ let token: DummyERC721TokenContract;
+ let erc721Receiver: DummyERC721ReceiverContract;
+ let logDecoder: LogDecoder;
+ const tokenId = new BigNumber(1);
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ owner = accounts[0];
+ spender = accounts[1];
+ token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC721Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ );
+ erc721Receiver = await DummyERC721ReceiverContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC721Receiver,
+ provider,
+ txDefaults,
+ );
+ logDecoder = new LogDecoder(web3Wrapper, artifacts);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.mint.sendTransactionAsync(owner, tokenId, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('transferFrom', () => {
+ it('should revert if the tokenId is not owner', async () => {
+ const from = owner;
+ const to = erc721Receiver.address;
+ const unownedTokenId = new BigNumber(2);
+ await expectTransactionFailedAsync(
+ token.transferFrom.sendTransactionAsync(from, to, unownedTokenId),
+ RevertReason.Erc721ZeroOwner,
+ );
+ });
+ it('should revert if transferring to a null address', async () => {
+ const from = owner;
+ const to = constants.NULL_ADDRESS;
+ await expectTransactionFailedAsync(
+ token.transferFrom.sendTransactionAsync(from, to, tokenId),
+ RevertReason.Erc721ZeroToAddress,
+ );
+ });
+ it('should revert if the from address does not own the token', async () => {
+ const from = spender;
+ const to = erc721Receiver.address;
+ await expectTransactionFailedAsync(
+ token.transferFrom.sendTransactionAsync(from, to, tokenId),
+ RevertReason.Erc721OwnerMismatch,
+ );
+ });
+ it('should revert if spender does not own the token, is not approved, and is not approved for all', async () => {
+ const from = owner;
+ const to = erc721Receiver.address;
+ await expectTransactionFailedAsync(
+ token.transferFrom.sendTransactionAsync(from, to, tokenId, { from: spender }),
+ RevertReason.Erc721InvalidSpender,
+ );
+ });
+ it('should transfer the token if called by owner', async () => {
+ const from = owner;
+ const to = erc721Receiver.address;
+ const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
+ await token.transferFrom.sendTransactionAsync(from, to, tokenId),
+ );
+ const newOwner = await token.ownerOf.callAsync(tokenId);
+ expect(newOwner).to.be.equal(to);
+ const log = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
+ expect(log.args._from).to.be.equal(from);
+ expect(log.args._to).to.be.equal(to);
+ expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
+ });
+ it('should transfer the token if spender is approved for all', async () => {
+ const isApproved = true;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.setApprovalForAll.sendTransactionAsync(spender, isApproved),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const from = owner;
+ const to = erc721Receiver.address;
+ const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
+ await token.transferFrom.sendTransactionAsync(from, to, tokenId),
+ );
+ const newOwner = await token.ownerOf.callAsync(tokenId);
+ expect(newOwner).to.be.equal(to);
+ const log = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
+ expect(log.args._from).to.be.equal(from);
+ expect(log.args._to).to.be.equal(to);
+ expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
+ });
+ it('should transfer the token if spender is individually approved', async () => {
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, tokenId),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const from = owner;
+ const to = erc721Receiver.address;
+ const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
+ await token.transferFrom.sendTransactionAsync(from, to, tokenId),
+ );
+ const newOwner = await token.ownerOf.callAsync(tokenId);
+ expect(newOwner).to.be.equal(to);
+
+ const approvedAddress = await token.getApproved.callAsync(tokenId);
+ expect(approvedAddress).to.be.equal(constants.NULL_ADDRESS);
+ const log = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
+ expect(log.args._from).to.be.equal(from);
+ expect(log.args._to).to.be.equal(to);
+ expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
+ });
+ });
+ describe('safeTransferFrom without data', () => {
+ it('should transfer token to a non-contract address if called by owner', async () => {
+ const from = owner;
+ const to = spender;
+ const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
+ await token.safeTransferFrom1.sendTransactionAsync(from, to, tokenId),
+ );
+ const newOwner = await token.ownerOf.callAsync(tokenId);
+ expect(newOwner).to.be.equal(to);
+ const log = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
+ expect(log.args._from).to.be.equal(from);
+ expect(log.args._to).to.be.equal(to);
+ expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
+ });
+ it('should revert if transferring to a contract address without onERC721Received', async () => {
+ const contract = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC721Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ );
+ const from = owner;
+ const to = contract.address;
+ await expectTransactionFailedWithoutReasonAsync(
+ token.safeTransferFrom1.sendTransactionAsync(from, to, tokenId),
+ );
+ });
+ it('should revert if onERC721Received does not return the correct value', async () => {
+ const invalidErc721Receiver = await InvalidERC721ReceiverContract.deployFrom0xArtifactAsync(
+ artifacts.InvalidERC721Receiver,
+ provider,
+ txDefaults,
+ );
+ const from = owner;
+ const to = invalidErc721Receiver.address;
+ await expectTransactionFailedAsync(
+ token.safeTransferFrom1.sendTransactionAsync(from, to, tokenId),
+ RevertReason.Erc721InvalidSelector,
+ );
+ });
+ it('should transfer to contract and call onERC721Received with correct return value', async () => {
+ const from = owner;
+ const to = erc721Receiver.address;
+ const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
+ await token.safeTransferFrom1.sendTransactionAsync(from, to, tokenId),
+ );
+ const newOwner = await token.ownerOf.callAsync(tokenId);
+ expect(newOwner).to.be.equal(to);
+ const transferLog = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
+ const receiverLog = txReceipt.logs[1] as LogWithDecodedArgs<DummyERC721ReceiverTokenReceivedEventArgs>;
+ expect(transferLog.args._from).to.be.equal(from);
+ expect(transferLog.args._to).to.be.equal(to);
+ expect(transferLog.args._tokenId).to.be.bignumber.equal(tokenId);
+ expect(receiverLog.args.operator).to.be.equal(owner);
+ expect(receiverLog.args.from).to.be.equal(from);
+ expect(receiverLog.args.tokenId).to.be.bignumber.equal(tokenId);
+ expect(receiverLog.args.data).to.be.equal(constants.NULL_BYTES);
+ });
+ });
+ describe('safeTransferFrom with data', () => {
+ const data = '0x0102030405060708090a0b0c0d0e0f';
+ it('should transfer token to a non-contract address if called by owner', async () => {
+ const from = owner;
+ const to = spender;
+ const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
+ await token.safeTransferFrom2.sendTransactionAsync(from, to, tokenId, data),
+ );
+ const newOwner = await token.ownerOf.callAsync(tokenId);
+ expect(newOwner).to.be.equal(to);
+ const log = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
+ expect(log.args._from).to.be.equal(from);
+ expect(log.args._to).to.be.equal(to);
+ expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
+ });
+ it('should revert if transferring to a contract address without onERC721Received', async () => {
+ const contract = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC721Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ );
+ const from = owner;
+ const to = contract.address;
+ await expectTransactionFailedWithoutReasonAsync(
+ token.safeTransferFrom2.sendTransactionAsync(from, to, tokenId, data),
+ );
+ });
+ it('should revert if onERC721Received does not return the correct value', async () => {
+ const invalidErc721Receiver = await InvalidERC721ReceiverContract.deployFrom0xArtifactAsync(
+ artifacts.InvalidERC721Receiver,
+ provider,
+ txDefaults,
+ );
+ const from = owner;
+ const to = invalidErc721Receiver.address;
+ await expectTransactionFailedAsync(
+ token.safeTransferFrom2.sendTransactionAsync(from, to, tokenId, data),
+ RevertReason.Erc721InvalidSelector,
+ );
+ });
+ it('should transfer to contract and call onERC721Received with correct return value', async () => {
+ const from = owner;
+ const to = erc721Receiver.address;
+ const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
+ await token.safeTransferFrom2.sendTransactionAsync(from, to, tokenId, data),
+ );
+ const newOwner = await token.ownerOf.callAsync(tokenId);
+ expect(newOwner).to.be.equal(to);
+ const transferLog = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
+ const receiverLog = txReceipt.logs[1] as LogWithDecodedArgs<DummyERC721ReceiverTokenReceivedEventArgs>;
+ expect(transferLog.args._from).to.be.equal(from);
+ expect(transferLog.args._to).to.be.equal(to);
+ expect(transferLog.args._tokenId).to.be.bignumber.equal(tokenId);
+ expect(receiverLog.args.operator).to.be.equal(owner);
+ expect(receiverLog.args.from).to.be.equal(from);
+ expect(receiverLog.args.tokenId).to.be.bignumber.equal(tokenId);
+ expect(receiverLog.args.data).to.be.equal(data);
+ });
+ });
+});
+// tslint:enable:no-unnecessary-type-assertion
diff --git a/contracts/tokens/test/global_hooks.ts b/contracts/tokens/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/tokens/test/global_hooks.ts
@@ -0,0 +1,17 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage, profiler, provider } from '@0x/contracts-test-utils';
+before('start web3 provider', () => {
+ provider.start();
+});
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+ provider.stop();
+});
diff --git a/contracts/tokens/test/unlimited_allowance_token.ts b/contracts/tokens/test/unlimited_allowance_token.ts
new file mode 100644
index 000000000..6d5a29b23
--- /dev/null
+++ b/contracts/tokens/test/unlimited_allowance_token.ts
@@ -0,0 +1,194 @@
+import {
+ chaiSetup,
+ constants,
+ expectContractCallFailedAsync,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+
+import { artifacts, DummyERC20TokenContract } from '../src';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+describe('UnlimitedAllowanceToken', () => {
+ let owner: string;
+ let spender: string;
+ const MAX_MINT_VALUE = new BigNumber(10000000000000000000000);
+ let token: DummyERC20TokenContract;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ owner = accounts[0];
+ spender = accounts[1];
+ token = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC20Token,
+ provider,
+ txDefaults,
+ constants.DUMMY_TOKEN_NAME,
+ constants.DUMMY_TOKEN_SYMBOL,
+ constants.DUMMY_TOKEN_DECIMALS,
+ constants.DUMMY_TOKEN_TOTAL_SUPPLY,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.mint.sendTransactionAsync(MAX_MINT_VALUE, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('transfer', () => {
+ it('should throw if owner has insufficient balance', async () => {
+ const ownerBalance = await token.balanceOf.callAsync(owner);
+ const amountToTransfer = ownerBalance.plus(1);
+ return expectContractCallFailedAsync(
+ token.transfer.callAsync(spender, amountToTransfer, { from: owner }),
+ RevertReason.Erc20InsufficientBalance,
+ );
+ });
+
+ it('should transfer balance from sender to receiver', async () => {
+ const receiver = spender;
+ const initOwnerBalance = await token.balanceOf.callAsync(owner);
+ const amountToTransfer = new BigNumber(1);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const finalOwnerBalance = await token.balanceOf.callAsync(owner);
+ const finalReceiverBalance = await token.balanceOf.callAsync(receiver);
+
+ const expectedFinalOwnerBalance = initOwnerBalance.minus(amountToTransfer);
+ const expectedFinalReceiverBalance = amountToTransfer;
+ expect(finalOwnerBalance).to.be.bignumber.equal(expectedFinalOwnerBalance);
+ expect(finalReceiverBalance).to.be.bignumber.equal(expectedFinalReceiverBalance);
+ });
+
+ it('should return true on a 0 value transfer', async () => {
+ const didReturnTrue = await token.transfer.callAsync(spender, new BigNumber(0), {
+ from: owner,
+ });
+ expect(didReturnTrue).to.be.true();
+ });
+ });
+
+ describe('transferFrom', () => {
+ it('should throw if owner has insufficient balance', async () => {
+ const ownerBalance = await token.balanceOf.callAsync(owner);
+ const amountToTransfer = ownerBalance.plus(1);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ return expectContractCallFailedAsync(
+ token.transferFrom.callAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ }),
+ RevertReason.Erc20InsufficientBalance,
+ );
+ });
+
+ it('should throw if spender has insufficient allowance', async () => {
+ const ownerBalance = await token.balanceOf.callAsync(owner);
+ const amountToTransfer = ownerBalance;
+
+ const spenderAllowance = await token.allowance.callAsync(owner, spender);
+ const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
+ expect(isSpenderAllowanceInsufficient).to.be.true();
+
+ return expectContractCallFailedAsync(
+ token.transferFrom.callAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ }),
+ RevertReason.Erc20InsufficientAllowance,
+ );
+ });
+
+ it('should return true on a 0 value transfer', async () => {
+ const amountToTransfer = new BigNumber(0);
+ const didReturnTrue = await token.transferFrom.callAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ });
+ expect(didReturnTrue).to.be.true();
+ });
+
+ it('should not modify spender allowance if spender allowance is 2^256 - 1', async () => {
+ const initOwnerBalance = await token.balanceOf.callAsync(owner);
+ const amountToTransfer = initOwnerBalance;
+ const initSpenderAllowance = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const newSpenderAllowance = await token.allowance.callAsync(owner, spender);
+ expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
+ });
+
+ it('should transfer the correct balances if spender has sufficient allowance', async () => {
+ const initOwnerBalance = await token.balanceOf.callAsync(owner);
+ const amountToTransfer = initOwnerBalance;
+ const initSpenderAllowance = initOwnerBalance;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const newOwnerBalance = await token.balanceOf.callAsync(owner);
+ const newSpenderBalance = await token.balanceOf.callAsync(spender);
+
+ expect(newOwnerBalance).to.be.bignumber.equal(0);
+ expect(newSpenderBalance).to.be.bignumber.equal(initOwnerBalance);
+ });
+
+ it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
+ const initOwnerBalance = await token.balanceOf.callAsync(owner);
+ const amountToTransfer = initOwnerBalance;
+ const initSpenderAllowance = initOwnerBalance;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const newSpenderAllowance = await token.allowance.callAsync(owner, spender);
+ expect(newSpenderAllowance).to.be.bignumber.equal(0);
+ });
+ });
+});
diff --git a/contracts/tokens/test/weth9.ts b/contracts/tokens/test/weth9.ts
new file mode 100644
index 000000000..6a3948e2c
--- /dev/null
+++ b/contracts/tokens/test/weth9.ts
@@ -0,0 +1,142 @@
+import {
+ chaiSetup,
+ constants,
+ expectInsufficientFundsAsync,
+ expectTransactionFailedWithoutReasonAsync,
+ provider,
+ txDefaults,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+
+import { artifacts, WETH9Contract } from '../src';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+describe('EtherToken', () => {
+ let account: string;
+ const gasPrice = Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 9);
+ let etherToken: WETH9Contract;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ account = accounts[0];
+
+ etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, {
+ gasPrice,
+ ...txDefaults,
+ });
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('deposit', () => {
+ it('should throw if caller attempts to deposit more Ether than caller balance', async () => {
+ const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
+ const ethToDeposit = initEthBalance.plus(1);
+
+ return expectInsufficientFundsAsync(etherToken.deposit.sendTransactionAsync({ value: ethToDeposit }));
+ });
+
+ it('should convert deposited Ether to wrapped Ether tokens', async () => {
+ const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
+ const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
+
+ const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
+
+ const txHash = await etherToken.deposit.sendTransactionAsync({ value: ethToDeposit });
+ const receipt = await web3Wrapper.awaitTransactionSuccessAsync(
+ txHash,
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
+ const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
+ const finalEthTokenBalance = await etherToken.balanceOf.callAsync(account);
+
+ expect(finalEthBalance).to.be.bignumber.equal(initEthBalance.minus(ethToDeposit.plus(ethSpentOnGas)));
+ expect(finalEthTokenBalance).to.be.bignumber.equal(initEthTokenBalance.plus(ethToDeposit));
+ });
+ });
+
+ describe('withdraw', () => {
+ it('should throw if caller attempts to withdraw greater than caller balance', async () => {
+ const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
+ const ethTokensToWithdraw = initEthTokenBalance.plus(1);
+
+ return expectTransactionFailedWithoutReasonAsync(
+ etherToken.withdraw.sendTransactionAsync(ethTokensToWithdraw),
+ );
+ });
+
+ it('should convert ether tokens to ether with sufficient balance', async () => {
+ const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await etherToken.deposit.sendTransactionAsync({ value: ethToDeposit }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
+ const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
+ const ethTokensToWithdraw = initEthTokenBalance;
+ expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
+ const txHash = await etherToken.withdraw.sendTransactionAsync(ethTokensToWithdraw, {
+ gas: constants.MAX_ETHERTOKEN_WITHDRAW_GAS,
+ });
+ const receipt = await web3Wrapper.awaitTransactionSuccessAsync(
+ txHash,
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
+ const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
+ const finalEthTokenBalance = await etherToken.balanceOf.callAsync(account);
+
+ expect(finalEthBalance).to.be.bignumber.equal(
+ initEthBalance.plus(ethTokensToWithdraw.minus(ethSpentOnGas)),
+ );
+ expect(finalEthTokenBalance).to.be.bignumber.equal(initEthTokenBalance.minus(ethTokensToWithdraw));
+ });
+ });
+
+ describe('fallback', () => {
+ it('should convert sent ether to ether tokens', async () => {
+ const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
+ const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
+
+ const ethToDeposit = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18);
+
+ const txHash = await web3Wrapper.sendTransactionAsync({
+ from: account,
+ to: etherToken.address,
+ value: ethToDeposit,
+ gasPrice,
+ });
+
+ const receipt = await web3Wrapper.awaitTransactionSuccessAsync(
+ txHash,
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
+ const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
+ const finalEthTokenBalance = await etherToken.balanceOf.callAsync(account);
+
+ expect(finalEthBalance).to.be.bignumber.equal(initEthBalance.minus(ethToDeposit.plus(ethSpentOnGas)));
+ expect(finalEthTokenBalance).to.be.bignumber.equal(initEthTokenBalance.plus(ethToDeposit));
+ });
+ });
+});
diff --git a/contracts/tokens/test/zrx_token.ts b/contracts/tokens/test/zrx_token.ts
new file mode 100644
index 000000000..5dc8447f6
--- /dev/null
+++ b/contracts/tokens/test/zrx_token.ts
@@ -0,0 +1,203 @@
+import { chaiSetup, constants, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+
+import { artifacts, ZRXTokenContract } from '../src';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+describe('ZRXToken', () => {
+ let owner: string;
+ let spender: string;
+ let MAX_UINT: BigNumber;
+ let zrxToken: ZRXTokenContract;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ owner = accounts[0];
+ spender = accounts[1];
+ zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRXToken, provider, txDefaults);
+ MAX_UINT = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('constants', () => {
+ it('should have 18 decimals', async () => {
+ const decimals = new BigNumber(await zrxToken.decimals.callAsync());
+ const expectedDecimals = 18;
+ expect(decimals).to.be.bignumber.equal(expectedDecimals);
+ });
+
+ it('should have a total supply of 1 billion tokens', async () => {
+ const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
+ const expectedTotalSupply = 1000000000;
+ expect(Web3Wrapper.toUnitAmount(totalSupply, 18)).to.be.bignumber.equal(expectedTotalSupply);
+ });
+
+ it('should be named 0x Protocol Token', async () => {
+ const name = await zrxToken.name.callAsync();
+ const expectedName = '0x Protocol Token';
+ expect(name).to.be.equal(expectedName);
+ });
+
+ it('should have the symbol ZRX', async () => {
+ const symbol = await zrxToken.symbol.callAsync();
+ const expectedSymbol = 'ZRX';
+ expect(symbol).to.be.equal(expectedSymbol);
+ });
+ });
+
+ describe('constructor', () => {
+ it('should initialize owner balance to totalSupply', async () => {
+ const ownerBalance = await zrxToken.balanceOf.callAsync(owner);
+ const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
+ expect(totalSupply).to.be.bignumber.equal(ownerBalance);
+ });
+ });
+
+ describe('transfer', () => {
+ it('should transfer balance from sender to receiver', async () => {
+ const receiver = spender;
+ const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
+ const amountToTransfer = new BigNumber(1);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const finalOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
+ const finalReceiverBalance = await zrxToken.balanceOf.callAsync(receiver);
+
+ const expectedFinalOwnerBalance = initOwnerBalance.minus(amountToTransfer);
+ const expectedFinalReceiverBalance = amountToTransfer;
+ expect(finalOwnerBalance).to.be.bignumber.equal(expectedFinalOwnerBalance);
+ expect(finalReceiverBalance).to.be.bignumber.equal(expectedFinalReceiverBalance);
+ });
+
+ it('should return true on a 0 value transfer', async () => {
+ const didReturnTrue = await zrxToken.transfer.callAsync(spender, new BigNumber(0), {
+ from: owner,
+ });
+ expect(didReturnTrue).to.be.true();
+ });
+ });
+
+ describe('transferFrom', () => {
+ it('should return false if owner has insufficient balance', async () => {
+ const ownerBalance = await zrxToken.balanceOf.callAsync(owner);
+ const amountToTransfer = ownerBalance.plus(1);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(spender, amountToTransfer, {
+ from: owner,
+ gas: constants.MAX_TOKEN_APPROVE_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ });
+ expect(didReturnTrue).to.be.false();
+ });
+
+ it('should return false if spender has insufficient allowance', async () => {
+ const ownerBalance = await zrxToken.balanceOf.callAsync(owner);
+ const amountToTransfer = ownerBalance;
+
+ const spenderAllowance = await zrxToken.allowance.callAsync(owner, spender);
+ const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
+ expect(isSpenderAllowanceInsufficient).to.be.true();
+
+ const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ });
+ expect(didReturnTrue).to.be.false();
+ });
+
+ it('should return true on a 0 value transfer', async () => {
+ const amountToTransfer = new BigNumber(0);
+ const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ });
+ expect(didReturnTrue).to.be.true();
+ });
+
+ it('should not modify spender allowance if spender allowance is 2^256 - 1', async () => {
+ const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
+ const amountToTransfer = initOwnerBalance;
+ const initSpenderAllowance = MAX_UINT;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(spender, initSpenderAllowance, {
+ from: owner,
+ gas: constants.MAX_TOKEN_APPROVE_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const newSpenderAllowance = await zrxToken.allowance.callAsync(owner, spender);
+ expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
+ });
+
+ it('should transfer the correct balances if spender has sufficient allowance', async () => {
+ const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
+ const initSpenderBalance = await zrxToken.balanceOf.callAsync(spender);
+ const amountToTransfer = initOwnerBalance;
+ const initSpenderAllowance = initOwnerBalance;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(spender, initSpenderAllowance),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const newOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
+ const newSpenderBalance = await zrxToken.balanceOf.callAsync(spender);
+
+ expect(newOwnerBalance).to.be.bignumber.equal(0);
+ expect(newSpenderBalance).to.be.bignumber.equal(initSpenderBalance.plus(initOwnerBalance));
+ });
+
+ it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
+ const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
+ const amountToTransfer = initOwnerBalance;
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.approve.sendTransactionAsync(spender, amountToTransfer),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
+ from: spender,
+ gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
+ }),
+ constants.AWAIT_TRANSACTION_MINED_MS,
+ );
+
+ const newSpenderAllowance = await zrxToken.allowance.callAsync(owner, spender);
+ expect(newSpenderAllowance).to.be.bignumber.equal(0);
+ });
+ });
+});
diff --git a/contracts/tokens/tsconfig.json b/contracts/tokens/tsconfig.json
new file mode 100644
index 000000000..0d5f98cb8
--- /dev/null
+++ b/contracts/tokens/tsconfig.json
@@ -0,0 +1,33 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/DummyERC20Token.json",
+ "./generated-artifacts/DummyMultipleReturnERC20Token.json",
+ "./generated-artifacts/DummyNoReturnERC20Token.json",
+ "./generated-artifacts/DummyERC721Receiver.json",
+ "./generated-artifacts/InvalidERC721Receiver.json",
+ "./generated-artifacts/DummyERC721Token.json",
+ "./generated-artifacts/ReentrantERC20Token.json",
+ "./generated-artifacts/ERC20Token.json",
+ "./generated-artifacts/IERC20Token.json",
+ "./generated-artifacts/MintableERC20Token.json",
+ "./generated-artifacts/UnlimitedAllowanceERC20Token.json",
+ "./generated-artifacts/ERC721Token.json",
+ "./generated-artifacts/IERC721Receiver.json",
+ "./generated-artifacts/IERC721Token.json",
+ "./generated-artifacts/MintableERC721Token.json",
+ "./generated-artifacts/IEtherToken.json",
+ "./generated-artifacts/WETH9.json",
+ "./generated-artifacts/ERC20Token_v1.json",
+ "./generated-artifacts/Token_v1.json",
+ "./generated-artifacts/UnlimitedAllowanceToken_v1.json",
+ "./generated-artifacts/ZRXToken.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/tokens/tslint.json b/contracts/tokens/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/tokens/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/contracts/utils/CHANGELOG.json b/contracts/utils/CHANGELOG.json
new file mode 100644
index 000000000..19ac770af
--- /dev/null
+++ b/contracts/utils/CHANGELOG.json
@@ -0,0 +1,11 @@
+[
+ {
+ "timestamp": 1544741676,
+ "version": "1.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/contracts/utils/CHANGELOG.md b/contracts/utils/CHANGELOG.md
new file mode 100644
index 000000000..716353d05
--- /dev/null
+++ b/contracts/utils/CHANGELOG.md
@@ -0,0 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.2 - _December 13, 2018_
+
+ * Dependencies updated
diff --git a/contracts/utils/README.md b/contracts/utils/README.md
new file mode 100644
index 000000000..e7c7b49ff
--- /dev/null
+++ b/contracts/utils/README.md
@@ -0,0 +1,70 @@
+## Contracts utils
+
+Smart contracts utils used in the 0x protocol.
+
+## Usage
+
+Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+
+* [utils](./contracts/utils)
+ * This directory contains libraries and utils.
+* [test](./contracts/test)
+ * This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-utils yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-utils yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/utils/compiler.json b/contracts/utils/compiler.json
new file mode 100644
index 000000000..1524c1eaa
--- /dev/null
+++ b/contracts/utils/compiler.json
@@ -0,0 +1,22 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": ["TestConstants", "TestLibBytes", "LibBytes", "Ownable", "IOwnable", "ReentrancyGuard", "SafeMath"]
+}
diff --git a/contracts/utils/contracts/test/TestConstants/TestConstants.sol b/contracts/utils/contracts/test/TestConstants/TestConstants.sol
new file mode 100644
index 000000000..3c852173b
--- /dev/null
+++ b/contracts/utils/contracts/test/TestConstants/TestConstants.sol
@@ -0,0 +1,57 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+
+
+// solhint-disable max-line-length
+contract TestConstants {
+
+ using LibBytes for bytes;
+
+ bytes4 constant internal ERC20_PROXY_ID = bytes4(keccak256("ERC20Token(address)"));
+
+ address constant internal KOVAN_ZRX_ADDRESS = 0x6Ff6C0Ff1d68b964901F986d4C9FA3ac68346570;
+ bytes constant internal KOVAN_ZRX_ASSET_DATA = "\xf4\x72\x61\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6f\xf6\xc0\xff\x1d\x68\xb9\x64\x90\x1f\x98\x6d\x4c\x9f\xa3\xac\x68\x34\x65\x70";
+
+ address constant internal MAINNET_ZRX_ADDRESS = 0xE41d2489571d322189246DaFA5ebDe1F4699F498;
+ bytes constant public MAINNET_ZRX_ASSET_DATA = "\xf4\x72\x61\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\x1d\x24\x89\x57\x1d\x32\x21\x89\x24\x6d\xaf\xa5\xeb\xde\x1f\x46\x99\xf4\x98";
+
+ function assertValidZrxAssetData()
+ public
+ pure
+ returns (bool)
+ {
+ bytes memory kovanZrxAssetData = abi.encodeWithSelector(ERC20_PROXY_ID, KOVAN_ZRX_ADDRESS);
+ require(
+ kovanZrxAssetData.equals(KOVAN_ZRX_ASSET_DATA),
+ "INVALID_KOVAN_ZRX_ASSET_DATA"
+ );
+
+ bytes memory mainetZrxAssetData = abi.encodeWithSelector(ERC20_PROXY_ID, MAINNET_ZRX_ADDRESS);
+ require(
+ mainetZrxAssetData.equals(MAINNET_ZRX_ASSET_DATA),
+ "INVALID_MAINNET_ZRX_ASSET_DATA"
+ );
+
+ return true;
+ }
+}
+// solhint-enable max-line-length \ No newline at end of file
diff --git a/contracts/utils/contracts/test/TestLibBytes/TestLibBytes.sol b/contracts/utils/contracts/test/TestLibBytes/TestLibBytes.sol
new file mode 100644
index 000000000..444a3e717
--- /dev/null
+++ b/contracts/utils/contracts/test/TestLibBytes/TestLibBytes.sol
@@ -0,0 +1,269 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity 0.4.24;
+
+import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
+
+
+contract TestLibBytes {
+
+ using LibBytes for bytes;
+
+ /// @dev Pops the last byte off of a byte array by modifying its length.
+ /// @param b Byte array that will be modified.
+ /// @return The byte that was popped off.
+ function publicPopLastByte(bytes memory b)
+ public
+ pure
+ returns (bytes memory, bytes1 result)
+ {
+ result = b.popLastByte();
+ return (b, result);
+ }
+
+ /// @dev Pops the last 20 bytes off of a byte array by modifying its length.
+ /// @param b Byte array that will be modified.
+ /// @return The 20 byte address that was popped off.
+ function publicPopLast20Bytes(bytes memory b)
+ public
+ pure
+ returns (bytes memory, address result)
+ {
+ result = b.popLast20Bytes();
+ return (b, result);
+ }
+
+ /// @dev Tests equality of two byte arrays.
+ /// @param lhs First byte array to compare.
+ /// @param rhs Second byte array to compare.
+ /// @return True if arrays are the same. False otherwise.
+ function publicEquals(bytes memory lhs, bytes memory rhs)
+ public
+ pure
+ returns (bool equal)
+ {
+ equal = lhs.equals(rhs);
+ return equal;
+ }
+
+ function publicEqualsPop1(bytes memory lhs, bytes memory rhs)
+ public
+ pure
+ returns (bool equal)
+ {
+ lhs.popLastByte();
+ rhs.popLastByte();
+ equal = lhs.equals(rhs);
+ return equal;
+ }
+
+ /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.
+ /// @param dest Byte array that will be overwritten with source bytes.
+ /// @param source Byte array to copy onto dest bytes.
+ function publicDeepCopyBytes(
+ bytes memory dest,
+ bytes memory source
+ )
+ public
+ pure
+ returns (bytes memory)
+ {
+ LibBytes.deepCopyBytes(dest, source);
+ return dest;
+ }
+
+ /// @dev Reads an address from a position in a byte array.
+ /// @param b Byte array containing an address.
+ /// @param index Index in byte array of address.
+ /// @return address from byte array.
+ function publicReadAddress(
+ bytes memory b,
+ uint256 index
+ )
+ public
+ pure
+ returns (address result)
+ {
+ result = b.readAddress(index);
+ return result;
+ }
+
+ /// @dev Writes an address into a specific position in a byte array.
+ /// @param b Byte array to insert address into.
+ /// @param index Index in byte array of address.
+ /// @param input Address to put into byte array.
+ function publicWriteAddress(
+ bytes memory b,
+ uint256 index,
+ address input
+ )
+ public
+ pure
+ returns (bytes memory)
+ {
+ b.writeAddress(index, input);
+ return b;
+ }
+
+ /// @dev Reads a bytes32 value from a position in a byte array.
+ /// @param b Byte array containing a bytes32 value.
+ /// @param index Index in byte array of bytes32 value.
+ /// @return bytes32 value from byte array.
+ function publicReadBytes32(
+ bytes memory b,
+ uint256 index
+ )
+ public
+ pure
+ returns (bytes32 result)
+ {
+ result = b.readBytes32(index);
+ return result;
+ }
+
+ /// @dev Writes a bytes32 into a specific position in a byte array.
+ /// @param b Byte array to insert <input> into.
+ /// @param index Index in byte array of <input>.
+ /// @param input bytes32 to put into byte array.
+ function publicWriteBytes32(
+ bytes memory b,
+ uint256 index,
+ bytes32 input
+ )
+ public
+ pure
+ returns (bytes memory)
+ {
+ b.writeBytes32(index, input);
+ return b;
+ }
+
+ /// @dev Reads a uint256 value from a position in a byte array.
+ /// @param b Byte array containing a uint256 value.
+ /// @param index Index in byte array of uint256 value.
+ /// @return uint256 value from byte array.
+ function publicReadUint256(
+ bytes memory b,
+ uint256 index
+ )
+ public
+ pure
+ returns (uint256 result)
+ {
+ result = b.readUint256(index);
+ return result;
+ }
+
+ /// @dev Writes a uint256 into a specific position in a byte array.
+ /// @param b Byte array to insert <input> into.
+ /// @param index Index in byte array of <input>.
+ /// @param input uint256 to put into byte array.
+ function publicWriteUint256(
+ bytes memory b,
+ uint256 index,
+ uint256 input
+ )
+ public
+ pure
+ returns (bytes memory)
+ {
+ b.writeUint256(index, input);
+ return b;
+ }
+
+ /// @dev Reads an unpadded bytes4 value from a position in a byte array.
+ /// @param b Byte array containing a bytes4 value.
+ /// @param index Index in byte array of bytes4 value.
+ /// @return bytes4 value from byte array.
+ function publicReadBytes4(
+ bytes memory b,
+ uint256 index
+ )
+ public
+ pure
+ returns (bytes4 result)
+ {
+ result = b.readBytes4(index);
+ return result;
+ }
+
+ /// @dev Reads nested bytes from a specific position.
+ /// @param b Byte array containing nested bytes.
+ /// @param index Index of nested bytes.
+ /// @return result Nested bytes.
+ function publicReadBytesWithLength(
+ bytes memory b,
+ uint256 index
+ )
+ public
+ pure
+ returns (bytes memory result)
+ {
+ result = b.readBytesWithLength(index);
+ return result;
+ }
+
+ /// @dev Inserts bytes at a specific position in a byte array.
+ /// @param b Byte array to insert <input> into.
+ /// @param index Index in byte array of <input>.
+ /// @param input bytes to insert.
+ /// @return b Updated input byte array
+ function publicWriteBytesWithLength(
+ bytes memory b,
+ uint256 index,
+ bytes memory input
+ )
+ public
+ pure
+ returns (bytes memory)
+ {
+ b.writeBytesWithLength(index, input);
+ return b;
+ }
+
+ /// @dev Copies a block of memory from one location to another.
+ /// @param mem Memory contents we want to apply memCopy to
+ /// @param dest Destination offset into <mem>.
+ /// @param source Source offset into <mem>.
+ /// @param length Length of bytes to copy from <source> to <dest>
+ /// @return mem Memory contents after calling memCopy.
+ function testMemcpy(
+ bytes mem,
+ uint256 dest,
+ uint256 source,
+ uint256 length
+ )
+ public // not external, we need input in memory
+ pure
+ returns (bytes)
+ {
+ // Sanity check. Overflows are not checked.
+ require(source + length <= mem.length);
+ require(dest + length <= mem.length);
+
+ // Get pointer to memory contents
+ uint256 offset = mem.contentAddress();
+
+ // Execute memCopy adjusted for memory array location
+ LibBytes.memCopy(offset + dest, offset + source, length);
+
+ // Return modified memory contents
+ return mem;
+ }
+}
diff --git a/contracts/utils/contracts/utils/LibBytes/LibBytes.sol b/contracts/utils/contracts/utils/LibBytes/LibBytes.sol
new file mode 100644
index 000000000..4ee6228d5
--- /dev/null
+++ b/contracts/utils/contracts/utils/LibBytes/LibBytes.sol
@@ -0,0 +1,567 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+library LibBytes {
+
+ using LibBytes for bytes;
+
+ /// @dev Gets the memory address for a byte array.
+ /// @param input Byte array to lookup.
+ /// @return memoryAddress Memory address of byte array. This
+ /// points to the header of the byte array which contains
+ /// the length.
+ function rawAddress(bytes memory input)
+ internal
+ pure
+ returns (uint256 memoryAddress)
+ {
+ assembly {
+ memoryAddress := input
+ }
+ return memoryAddress;
+ }
+
+ /// @dev Gets the memory address for the contents of a byte array.
+ /// @param input Byte array to lookup.
+ /// @return memoryAddress Memory address of the contents of the byte array.
+ function contentAddress(bytes memory input)
+ internal
+ pure
+ returns (uint256 memoryAddress)
+ {
+ assembly {
+ memoryAddress := add(input, 32)
+ }
+ return memoryAddress;
+ }
+
+ /// @dev Copies `length` bytes from memory location `source` to `dest`.
+ /// @param dest memory address to copy bytes to.
+ /// @param source memory address to copy bytes from.
+ /// @param length number of bytes to copy.
+ function memCopy(
+ uint256 dest,
+ uint256 source,
+ uint256 length
+ )
+ internal
+ pure
+ {
+ if (length < 32) {
+ // Handle a partial word by reading destination and masking
+ // off the bits we are interested in.
+ // This correctly handles overlap, zero lengths and source == dest
+ assembly {
+ let mask := sub(exp(256, sub(32, length)), 1)
+ let s := and(mload(source), not(mask))
+ let d := and(mload(dest), mask)
+ mstore(dest, or(s, d))
+ }
+ } else {
+ // Skip the O(length) loop when source == dest.
+ if (source == dest) {
+ return;
+ }
+
+ // For large copies we copy whole words at a time. The final
+ // word is aligned to the end of the range (instead of after the
+ // previous) to handle partial words. So a copy will look like this:
+ //
+ // ####
+ // ####
+ // ####
+ // ####
+ //
+ // We handle overlap in the source and destination range by
+ // changing the copying direction. This prevents us from
+ // overwriting parts of source that we still need to copy.
+ //
+ // This correctly handles source == dest
+ //
+ if (source > dest) {
+ assembly {
+ // We subtract 32 from `sEnd` and `dEnd` because it
+ // is easier to compare with in the loop, and these
+ // are also the addresses we need for copying the
+ // last bytes.
+ length := sub(length, 32)
+ let sEnd := add(source, length)
+ let dEnd := add(dest, length)
+
+ // Remember the last 32 bytes of source
+ // This needs to be done here and not after the loop
+ // because we may have overwritten the last bytes in
+ // source already due to overlap.
+ let last := mload(sEnd)
+
+ // Copy whole words front to back
+ // Note: the first check is always true,
+ // this could have been a do-while loop.
+ // solhint-disable-next-line no-empty-blocks
+ for {} lt(source, sEnd) {} {
+ mstore(dest, mload(source))
+ source := add(source, 32)
+ dest := add(dest, 32)
+ }
+
+ // Write the last 32 bytes
+ mstore(dEnd, last)
+ }
+ } else {
+ assembly {
+ // We subtract 32 from `sEnd` and `dEnd` because those
+ // are the starting points when copying a word at the end.
+ length := sub(length, 32)
+ let sEnd := add(source, length)
+ let dEnd := add(dest, length)
+
+ // Remember the first 32 bytes of source
+ // This needs to be done here and not after the loop
+ // because we may have overwritten the first bytes in
+ // source already due to overlap.
+ let first := mload(source)
+
+ // Copy whole words back to front
+ // We use a signed comparisson here to allow dEnd to become
+ // negative (happens when source and dest < 32). Valid
+ // addresses in local memory will never be larger than
+ // 2**255, so they can be safely re-interpreted as signed.
+ // Note: the first check is always true,
+ // this could have been a do-while loop.
+ // solhint-disable-next-line no-empty-blocks
+ for {} slt(dest, dEnd) {} {
+ mstore(dEnd, mload(sEnd))
+ sEnd := sub(sEnd, 32)
+ dEnd := sub(dEnd, 32)
+ }
+
+ // Write the first 32 bytes
+ mstore(dest, first)
+ }
+ }
+ }
+ }
+
+ /// @dev Returns a slices from a byte array.
+ /// @param b The byte array to take a slice from.
+ /// @param from The starting index for the slice (inclusive).
+ /// @param to The final index for the slice (exclusive).
+ /// @return result The slice containing bytes at indices [from, to)
+ function slice(
+ bytes memory b,
+ uint256 from,
+ uint256 to
+ )
+ internal
+ pure
+ returns (bytes memory result)
+ {
+ require(
+ from <= to,
+ "FROM_LESS_THAN_TO_REQUIRED"
+ );
+ require(
+ to < b.length,
+ "TO_LESS_THAN_LENGTH_REQUIRED"
+ );
+
+ // Create a new bytes structure and copy contents
+ result = new bytes(to - from);
+ memCopy(
+ result.contentAddress(),
+ b.contentAddress() + from,
+ result.length
+ );
+ return result;
+ }
+
+ /// @dev Returns a slice from a byte array without preserving the input.
+ /// @param b The byte array to take a slice from. Will be destroyed in the process.
+ /// @param from The starting index for the slice (inclusive).
+ /// @param to The final index for the slice (exclusive).
+ /// @return result The slice containing bytes at indices [from, to)
+ /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.
+ function sliceDestructive(
+ bytes memory b,
+ uint256 from,
+ uint256 to
+ )
+ internal
+ pure
+ returns (bytes memory result)
+ {
+ require(
+ from <= to,
+ "FROM_LESS_THAN_TO_REQUIRED"
+ );
+ require(
+ to < b.length,
+ "TO_LESS_THAN_LENGTH_REQUIRED"
+ );
+
+ // Create a new bytes structure around [from, to) in-place.
+ assembly {
+ result := add(b, from)
+ mstore(result, sub(to, from))
+ }
+ return result;
+ }
+
+ /// @dev Pops the last byte off of a byte array by modifying its length.
+ /// @param b Byte array that will be modified.
+ /// @return The byte that was popped off.
+ function popLastByte(bytes memory b)
+ internal
+ pure
+ returns (bytes1 result)
+ {
+ require(
+ b.length > 0,
+ "GREATER_THAN_ZERO_LENGTH_REQUIRED"
+ );
+
+ // Store last byte.
+ result = b[b.length - 1];
+
+ assembly {
+ // Decrement length of byte array.
+ let newLen := sub(mload(b), 1)
+ mstore(b, newLen)
+ }
+ return result;
+ }
+
+ /// @dev Pops the last 20 bytes off of a byte array by modifying its length.
+ /// @param b Byte array that will be modified.
+ /// @return The 20 byte address that was popped off.
+ function popLast20Bytes(bytes memory b)
+ internal
+ pure
+ returns (address result)
+ {
+ require(
+ b.length >= 20,
+ "GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED"
+ );
+
+ // Store last 20 bytes.
+ result = readAddress(b, b.length - 20);
+
+ assembly {
+ // Subtract 20 from byte array length.
+ let newLen := sub(mload(b), 20)
+ mstore(b, newLen)
+ }
+ return result;
+ }
+
+ /// @dev Tests equality of two byte arrays.
+ /// @param lhs First byte array to compare.
+ /// @param rhs Second byte array to compare.
+ /// @return True if arrays are the same. False otherwise.
+ function equals(
+ bytes memory lhs,
+ bytes memory rhs
+ )
+ internal
+ pure
+ returns (bool equal)
+ {
+ // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.
+ // We early exit on unequal lengths, but keccak would also correctly
+ // handle this.
+ return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);
+ }
+
+ /// @dev Reads an address from a position in a byte array.
+ /// @param b Byte array containing an address.
+ /// @param index Index in byte array of address.
+ /// @return address from byte array.
+ function readAddress(
+ bytes memory b,
+ uint256 index
+ )
+ internal
+ pure
+ returns (address result)
+ {
+ require(
+ b.length >= index + 20, // 20 is length of address
+ "GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED"
+ );
+
+ // Add offset to index:
+ // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)
+ // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)
+ index += 20;
+
+ // Read address from array memory
+ assembly {
+ // 1. Add index to address of bytes array
+ // 2. Load 32-byte word from memory
+ // 3. Apply 20-byte mask to obtain address
+ result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)
+ }
+ return result;
+ }
+
+ /// @dev Writes an address into a specific position in a byte array.
+ /// @param b Byte array to insert address into.
+ /// @param index Index in byte array of address.
+ /// @param input Address to put into byte array.
+ function writeAddress(
+ bytes memory b,
+ uint256 index,
+ address input
+ )
+ internal
+ pure
+ {
+ require(
+ b.length >= index + 20, // 20 is length of address
+ "GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED"
+ );
+
+ // Add offset to index:
+ // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)
+ // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)
+ index += 20;
+
+ // Store address into array memory
+ assembly {
+ // The address occupies 20 bytes and mstore stores 32 bytes.
+ // First fetch the 32-byte word where we'll be storing the address, then
+ // apply a mask so we have only the bytes in the word that the address will not occupy.
+ // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.
+
+ // 1. Add index to address of bytes array
+ // 2. Load 32-byte word from memory
+ // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address
+ let neighbors := and(
+ mload(add(b, index)),
+ 0xffffffffffffffffffffffff0000000000000000000000000000000000000000
+ )
+
+ // Make sure input address is clean.
+ // (Solidity does not guarantee this)
+ input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
+
+ // Store the neighbors and address into memory
+ mstore(add(b, index), xor(input, neighbors))
+ }
+ }
+
+ /// @dev Reads a bytes32 value from a position in a byte array.
+ /// @param b Byte array containing a bytes32 value.
+ /// @param index Index in byte array of bytes32 value.
+ /// @return bytes32 value from byte array.
+ function readBytes32(
+ bytes memory b,
+ uint256 index
+ )
+ internal
+ pure
+ returns (bytes32 result)
+ {
+ require(
+ b.length >= index + 32,
+ "GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED"
+ );
+
+ // Arrays are prefixed by a 256 bit length parameter
+ index += 32;
+
+ // Read the bytes32 from array memory
+ assembly {
+ result := mload(add(b, index))
+ }
+ return result;
+ }
+
+ /// @dev Writes a bytes32 into a specific position in a byte array.
+ /// @param b Byte array to insert <input> into.
+ /// @param index Index in byte array of <input>.
+ /// @param input bytes32 to put into byte array.
+ function writeBytes32(
+ bytes memory b,
+ uint256 index,
+ bytes32 input
+ )
+ internal
+ pure
+ {
+ require(
+ b.length >= index + 32,
+ "GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED"
+ );
+
+ // Arrays are prefixed by a 256 bit length parameter
+ index += 32;
+
+ // Read the bytes32 from array memory
+ assembly {
+ mstore(add(b, index), input)
+ }
+ }
+
+ /// @dev Reads a uint256 value from a position in a byte array.
+ /// @param b Byte array containing a uint256 value.
+ /// @param index Index in byte array of uint256 value.
+ /// @return uint256 value from byte array.
+ function readUint256(
+ bytes memory b,
+ uint256 index
+ )
+ internal
+ pure
+ returns (uint256 result)
+ {
+ result = uint256(readBytes32(b, index));
+ return result;
+ }
+
+ /// @dev Writes a uint256 into a specific position in a byte array.
+ /// @param b Byte array to insert <input> into.
+ /// @param index Index in byte array of <input>.
+ /// @param input uint256 to put into byte array.
+ function writeUint256(
+ bytes memory b,
+ uint256 index,
+ uint256 input
+ )
+ internal
+ pure
+ {
+ writeBytes32(b, index, bytes32(input));
+ }
+
+ /// @dev Reads an unpadded bytes4 value from a position in a byte array.
+ /// @param b Byte array containing a bytes4 value.
+ /// @param index Index in byte array of bytes4 value.
+ /// @return bytes4 value from byte array.
+ function readBytes4(
+ bytes memory b,
+ uint256 index
+ )
+ internal
+ pure
+ returns (bytes4 result)
+ {
+ require(
+ b.length >= index + 4,
+ "GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED"
+ );
+
+ // Arrays are prefixed by a 32 byte length field
+ index += 32;
+
+ // Read the bytes4 from array memory
+ assembly {
+ result := mload(add(b, index))
+ // Solidity does not require us to clean the trailing bytes.
+ // We do it anyway
+ result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
+ }
+ return result;
+ }
+
+ /// @dev Reads nested bytes from a specific position.
+ /// @dev NOTE: the returned value overlaps with the input value.
+ /// Both should be treated as immutable.
+ /// @param b Byte array containing nested bytes.
+ /// @param index Index of nested bytes.
+ /// @return result Nested bytes.
+ function readBytesWithLength(
+ bytes memory b,
+ uint256 index
+ )
+ internal
+ pure
+ returns (bytes memory result)
+ {
+ // Read length of nested bytes
+ uint256 nestedBytesLength = readUint256(b, index);
+ index += 32;
+
+ // Assert length of <b> is valid, given
+ // length of nested bytes
+ require(
+ b.length >= index + nestedBytesLength,
+ "GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED"
+ );
+
+ // Return a pointer to the byte array as it exists inside `b`
+ assembly {
+ result := add(b, index)
+ }
+ return result;
+ }
+
+ /// @dev Inserts bytes at a specific position in a byte array.
+ /// @param b Byte array to insert <input> into.
+ /// @param index Index in byte array of <input>.
+ /// @param input bytes to insert.
+ function writeBytesWithLength(
+ bytes memory b,
+ uint256 index,
+ bytes memory input
+ )
+ internal
+ pure
+ {
+ // Assert length of <b> is valid, given
+ // length of input
+ require(
+ b.length >= index + 32 + input.length, // 32 bytes to store length
+ "GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED"
+ );
+
+ // Copy <input> into <b>
+ memCopy(
+ b.contentAddress() + index,
+ input.rawAddress(), // includes length of <input>
+ input.length + 32 // +32 bytes to store <input> length
+ );
+ }
+
+ /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.
+ /// @param dest Byte array that will be overwritten with source bytes.
+ /// @param source Byte array to copy onto dest bytes.
+ function deepCopyBytes(
+ bytes memory dest,
+ bytes memory source
+ )
+ internal
+ pure
+ {
+ uint256 sourceLen = source.length;
+ // Dest length must be >= source length, or some bytes would not be copied.
+ require(
+ dest.length >= sourceLen,
+ "GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED"
+ );
+ memCopy(
+ dest.contentAddress(),
+ source.contentAddress(),
+ sourceLen
+ );
+ }
+}
diff --git a/contracts/utils/contracts/utils/Ownable/IOwnable.sol b/contracts/utils/contracts/utils/Ownable/IOwnable.sol
new file mode 100644
index 000000000..c0cbfddfd
--- /dev/null
+++ b/contracts/utils/contracts/utils/Ownable/IOwnable.sol
@@ -0,0 +1,8 @@
+pragma solidity ^0.4.24;
+
+
+contract IOwnable {
+
+ function transferOwnership(address newOwner)
+ public;
+}
diff --git a/contracts/utils/contracts/utils/Ownable/Ownable.sol b/contracts/utils/contracts/utils/Ownable/Ownable.sol
new file mode 100644
index 000000000..aa74a72d2
--- /dev/null
+++ b/contracts/utils/contracts/utils/Ownable/Ownable.sol
@@ -0,0 +1,33 @@
+pragma solidity ^0.4.24;
+
+import "./IOwnable.sol";
+
+
+contract Ownable is
+ IOwnable
+{
+ address public owner;
+
+ constructor ()
+ public
+ {
+ owner = msg.sender;
+ }
+
+ modifier onlyOwner() {
+ require(
+ msg.sender == owner,
+ "ONLY_CONTRACT_OWNER"
+ );
+ _;
+ }
+
+ function transferOwnership(address newOwner)
+ public
+ onlyOwner
+ {
+ if (newOwner != address(0)) {
+ owner = newOwner;
+ }
+ }
+}
diff --git a/contracts/utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol b/contracts/utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol
new file mode 100644
index 000000000..1a02c88a4
--- /dev/null
+++ b/contracts/utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol
@@ -0,0 +1,45 @@
+/*
+
+ Copyright 2018 ZeroEx Intl.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+pragma solidity ^0.4.24;
+
+
+contract ReentrancyGuard {
+
+ // Locked state of mutex
+ bool private locked = false;
+
+ /// @dev Functions with this modifer cannot be reentered. The mutex will be locked
+ /// before function execution and unlocked after.
+ modifier nonReentrant() {
+ // Ensure mutex is unlocked
+ require(
+ !locked,
+ "REENTRANCY_ILLEGAL"
+ );
+
+ // Lock mutex before function call
+ locked = true;
+
+ // Perform function call
+ _;
+
+ // Unlock mutex after function call
+ locked = false;
+ }
+}
diff --git a/contracts/utils/contracts/utils/SafeMath/SafeMath.sol b/contracts/utils/contracts/utils/SafeMath/SafeMath.sol
new file mode 100644
index 000000000..d7a4a603e
--- /dev/null
+++ b/contracts/utils/contracts/utils/SafeMath/SafeMath.sol
@@ -0,0 +1,87 @@
+pragma solidity ^0.4.24;
+
+
+contract SafeMath {
+
+ function safeMul(uint256 a, uint256 b)
+ internal
+ pure
+ returns (uint256)
+ {
+ if (a == 0) {
+ return 0;
+ }
+ uint256 c = a * b;
+ require(
+ c / a == b,
+ "UINT256_OVERFLOW"
+ );
+ return c;
+ }
+
+ function safeDiv(uint256 a, uint256 b)
+ internal
+ pure
+ returns (uint256)
+ {
+ uint256 c = a / b;
+ return c;
+ }
+
+ function safeSub(uint256 a, uint256 b)
+ internal
+ pure
+ returns (uint256)
+ {
+ require(
+ b <= a,
+ "UINT256_UNDERFLOW"
+ );
+ return a - b;
+ }
+
+ function safeAdd(uint256 a, uint256 b)
+ internal
+ pure
+ returns (uint256)
+ {
+ uint256 c = a + b;
+ require(
+ c >= a,
+ "UINT256_OVERFLOW"
+ );
+ return c;
+ }
+
+ function max64(uint64 a, uint64 b)
+ internal
+ pure
+ returns (uint256)
+ {
+ return a >= b ? a : b;
+ }
+
+ function min64(uint64 a, uint64 b)
+ internal
+ pure
+ returns (uint256)
+ {
+ return a < b ? a : b;
+ }
+
+ function max256(uint256 a, uint256 b)
+ internal
+ pure
+ returns (uint256)
+ {
+ return a >= b ? a : b;
+ }
+
+ function min256(uint256 a, uint256 b)
+ internal
+ pure
+ returns (uint256)
+ {
+ return a < b ? a : b;
+ }
+}
diff --git a/contracts/utils/package.json b/contracts/utils/package.json
new file mode 100644
index 000000000..cf94af0f6
--- /dev/null
+++ b/contracts/utils/package.json
@@ -0,0 +1,89 @@
+{
+ "name": "@0x/contracts-utils",
+ "version": "1.0.2",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract utils of 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
+ "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "compile": "sol-compiler",
+ "watch": "sol-compiler -w",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "coverage:report:text": "istanbul report text",
+ "coverage:report:html": "istanbul report html && open coverage/index.html",
+ "profiler:report:html": "istanbul report html && open coverage/index.html",
+ "coverage:report:lcov": "istanbul report lcov",
+ "test:circleci": "yarn test",
+ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(IOwnable|Ownable|LibBytes|ReentrancyGuard|SafeMath|TestConstants|TestLibBytes).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/utils/README.md",
+ "devDependencies": {
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "bn.js": "^4.11.8",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "ethereumjs-abi": "0.6.5",
+ "make-promises-safe": "^1.1.0",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.4.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contracts-multisig": "^1.0.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/utils/src/artifacts/index.ts b/contracts/utils/src/artifacts/index.ts
new file mode 100644
index 000000000..a5c2b215c
--- /dev/null
+++ b/contracts/utils/src/artifacts/index.ts
@@ -0,0 +1,19 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as IOwnable from '../../generated-artifacts/IOwnable.json';
+import * as LibBytes from '../../generated-artifacts/LibBytes.json';
+import * as Ownable from '../../generated-artifacts/Ownable.json';
+import * as ReentrancyGuard from '../../generated-artifacts/ReentrancyGuard.json';
+import * as SafeMath from '../../generated-artifacts/SafeMath.json';
+import * as TestConstants from '../../generated-artifacts/TestConstants.json';
+import * as TestLibBytes from '../../generated-artifacts/TestLibBytes.json';
+
+export const artifacts = {
+ TestConstants: TestConstants as ContractArtifact,
+ TestLibBytes: TestLibBytes as ContractArtifact,
+ IOwnable: IOwnable as ContractArtifact,
+ LibBytes: LibBytes as ContractArtifact,
+ Ownable: Ownable as ContractArtifact,
+ SafeMath: SafeMath as ContractArtifact,
+ ReentrancyGuard: ReentrancyGuard as ContractArtifact,
+};
diff --git a/contracts/utils/src/index.ts b/contracts/utils/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/utils/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/utils/src/wrappers/index.ts b/contracts/utils/src/wrappers/index.ts
new file mode 100644
index 000000000..823b7fa4b
--- /dev/null
+++ b/contracts/utils/src/wrappers/index.ts
@@ -0,0 +1,2 @@
+export * from '../../generated-wrappers/test_constants';
+export * from '../../generated-wrappers/test_lib_bytes';
diff --git a/contracts/utils/test/global_hooks.ts b/contracts/utils/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/utils/test/global_hooks.ts
@@ -0,0 +1,17 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage, profiler, provider } from '@0x/contracts-test-utils';
+before('start web3 provider', () => {
+ provider.start();
+});
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+ provider.stop();
+});
diff --git a/contracts/utils/test/lib_bytes.ts b/contracts/utils/test/lib_bytes.ts
new file mode 100644
index 000000000..6fb859c67
--- /dev/null
+++ b/contracts/utils/test/lib_bytes.ts
@@ -0,0 +1,875 @@
+import {
+ chaiSetup,
+ constants,
+ expectContractCallFailedAsync,
+ provider,
+ txDefaults,
+ typeEncodingUtils,
+ web3Wrapper,
+} from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { generatePseudoRandomSalt } from '@0x/order-utils';
+import { RevertReason } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import BN = require('bn.js');
+import * as chai from 'chai';
+import ethUtil = require('ethereumjs-util');
+import * as _ from 'lodash';
+
+import { TestLibBytesContract } from '../generated-wrappers/test_lib_bytes';
+import { artifacts } from '../src';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+// BUG: Ideally we would use Buffer.from(memory).toString('hex')
+// https://github.com/Microsoft/TypeScript/issues/23155
+const toHex = (buf: Uint8Array): string => buf.reduce((a, v) => a + `00${v.toString(16)}`.slice(-2), '0x');
+
+const fromHex = (str: string): Uint8Array => Uint8Array.from(Buffer.from(str.slice(2), 'hex'));
+
+describe('LibBytes', () => {
+ let libBytes: TestLibBytesContract;
+ const byteArrayShorterThan32Bytes = '0x012345';
+ const byteArrayShorterThan20Bytes = byteArrayShorterThan32Bytes;
+ const byteArrayLongerThan32Bytes =
+ '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
+ const byteArrayLongerThan32BytesFirstBytesSwapped =
+ '0x2301456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
+ const byteArrayLongerThan32BytesLastBytesSwapped =
+ '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abefcd';
+ let testAddress: string;
+ let testAddressB: string;
+ const testBytes32 = '0x102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f01020';
+ const testBytes32B = '0x534877abd8443578526845cdfef020047528759477fedef87346527659aced32';
+ const testUint256 = new BigNumber(testBytes32, 16);
+ const testUint256B = new BigNumber(testBytes32B, 16);
+ const testBytes4 = '0xabcdef12';
+ const testByte = '0xab';
+ let shortData: string;
+ let shortTestBytes: string;
+ let shortTestBytesAsBuffer: Buffer;
+ let wordOfData: string;
+ let wordOfTestBytes: string;
+ let wordOfTestBytesAsBuffer: Buffer;
+ let longData: string;
+ let longTestBytes: string;
+ let longTestBytesAsBuffer: Buffer;
+
+ before(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ before(async () => {
+ // Setup accounts & addresses
+ const accounts = await web3Wrapper.getAvailableAddressesAsync();
+ testAddress = accounts[1];
+ testAddressB = accounts[2];
+ // Deploy LibBytes
+ libBytes = await TestLibBytesContract.deployFrom0xArtifactAsync(artifacts.TestLibBytes, provider, txDefaults);
+ // Verify lengths of test data
+ const byteArrayShorterThan32BytesLength = ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength;
+ expect(byteArrayShorterThan32BytesLength).to.be.lessThan(32);
+ const byteArrayLongerThan32BytesLength = ethUtil.toBuffer(byteArrayLongerThan32Bytes).byteLength;
+ expect(byteArrayLongerThan32BytesLength).to.be.greaterThan(32);
+ const testBytes32Length = ethUtil.toBuffer(testBytes32).byteLength;
+ expect(testBytes32Length).to.be.equal(32);
+ // Create short test bytes
+ shortData = '0xffffaa';
+ const encodedShortData = ethUtil.toBuffer(shortData);
+ const shortDataLength = new BigNumber(encodedShortData.byteLength);
+ const encodedShortDataLength = typeEncodingUtils.encodeUint256(shortDataLength);
+ shortTestBytesAsBuffer = Buffer.concat([encodedShortDataLength, encodedShortData]);
+ shortTestBytes = ethUtil.bufferToHex(shortTestBytesAsBuffer);
+ // Create test bytes one word in length
+ wordOfData = ethUtil.bufferToHex(typeEncodingUtils.encodeUint256(generatePseudoRandomSalt()));
+ const encodedWordOfData = ethUtil.toBuffer(wordOfData);
+ const wordOfDataLength = new BigNumber(encodedWordOfData.byteLength);
+ const encodedWordOfDataLength = typeEncodingUtils.encodeUint256(wordOfDataLength);
+ wordOfTestBytesAsBuffer = Buffer.concat([encodedWordOfDataLength, encodedWordOfData]);
+ wordOfTestBytes = ethUtil.bufferToHex(wordOfTestBytesAsBuffer);
+ // Create long test bytes (combines short test bytes with word of test bytes)
+ longData = ethUtil.bufferToHex(Buffer.concat([encodedShortData, encodedWordOfData]));
+ const longDataLength = new BigNumber(encodedShortData.byteLength + encodedWordOfData.byteLength);
+ const encodedLongDataLength = typeEncodingUtils.encodeUint256(longDataLength);
+ longTestBytesAsBuffer = Buffer.concat([encodedLongDataLength, encodedShortData, encodedWordOfData]);
+ longTestBytes = ethUtil.bufferToHex(longTestBytesAsBuffer);
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('popLastByte', () => {
+ it('should revert if length is 0', async () => {
+ return expectContractCallFailedAsync(
+ libBytes.publicPopLastByte.callAsync(constants.NULL_BYTES),
+ RevertReason.LibBytesGreaterThanZeroLengthRequired,
+ );
+ });
+ it('should pop the last byte from the input and return it when array holds more than 1 byte', async () => {
+ const [newBytes, poppedByte] = await libBytes.publicPopLastByte.callAsync(byteArrayLongerThan32Bytes);
+ const expectedNewBytes = byteArrayLongerThan32Bytes.slice(0, -2);
+ const expectedPoppedByte = `0x${byteArrayLongerThan32Bytes.slice(-2)}`;
+ expect(newBytes).to.equal(expectedNewBytes);
+ expect(poppedByte).to.equal(expectedPoppedByte);
+ });
+ it('should pop the last byte from the input and return it when array is exactly 1 byte', async () => {
+ const [newBytes, poppedByte] = await libBytes.publicPopLastByte.callAsync(testByte);
+ const expectedNewBytes = '0x';
+ expect(newBytes).to.equal(expectedNewBytes);
+ return expect(poppedByte).to.be.equal(testByte);
+ });
+ });
+
+ describe('popLast20Bytes', () => {
+ it('should revert if length is less than 20', async () => {
+ return expectContractCallFailedAsync(
+ libBytes.publicPopLast20Bytes.callAsync(byteArrayShorterThan20Bytes),
+ RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
+ );
+ });
+ it('should pop the last 20 bytes from the input and return it when array holds more than 20 bytes', async () => {
+ const [newBytes, poppedAddress] = await libBytes.publicPopLast20Bytes.callAsync(byteArrayLongerThan32Bytes);
+ const expectedNewBytes = byteArrayLongerThan32Bytes.slice(0, -40);
+ const expectedPoppedAddress = `0x${byteArrayLongerThan32Bytes.slice(-40)}`;
+ expect(newBytes).to.equal(expectedNewBytes);
+ expect(poppedAddress).to.equal(expectedPoppedAddress);
+ });
+ it('should pop the last 20 bytes from the input and return it when array is exactly 20 bytes', async () => {
+ const [newBytes, poppedAddress] = await libBytes.publicPopLast20Bytes.callAsync(testAddress);
+ const expectedNewBytes = '0x';
+ const expectedPoppedAddress = testAddress;
+ expect(newBytes).to.equal(expectedNewBytes);
+ expect(poppedAddress).to.equal(expectedPoppedAddress);
+ });
+ });
+
+ describe('equals', () => {
+ it('should return true if byte arrays are equal (both arrays < 32 bytes)', async () => {
+ const isEqual = await libBytes.publicEquals.callAsync(
+ byteArrayShorterThan32Bytes,
+ byteArrayShorterThan32Bytes,
+ );
+ return expect(isEqual).to.be.true();
+ });
+ it('should return true if byte arrays are equal (both arrays > 32 bytes)', async () => {
+ const isEqual = await libBytes.publicEquals.callAsync(
+ byteArrayLongerThan32Bytes,
+ byteArrayLongerThan32Bytes,
+ );
+ return expect(isEqual).to.be.true();
+ });
+ it('should return false if byte arrays are not equal (first array < 32 bytes, second array > 32 bytes)', async () => {
+ const isEqual = await libBytes.publicEquals.callAsync(
+ byteArrayShorterThan32Bytes,
+ byteArrayLongerThan32Bytes,
+ );
+ return expect(isEqual).to.be.false();
+ });
+ it('should return false if byte arrays are not equal (first array > 32 bytes, second array < 32 bytes)', async () => {
+ const isEqual = await libBytes.publicEquals.callAsync(
+ byteArrayLongerThan32Bytes,
+ byteArrayShorterThan32Bytes,
+ );
+ return expect(isEqual).to.be.false();
+ });
+ it('should return false if byte arrays are not equal (same length, but a byte in first word differs)', async () => {
+ const isEqual = await libBytes.publicEquals.callAsync(
+ byteArrayLongerThan32BytesFirstBytesSwapped,
+ byteArrayLongerThan32Bytes,
+ );
+ return expect(isEqual).to.be.false();
+ });
+ it('should return false if byte arrays are not equal (same length, but a byte in last word differs)', async () => {
+ const isEqual = await libBytes.publicEquals.callAsync(
+ byteArrayLongerThan32BytesLastBytesSwapped,
+ byteArrayLongerThan32Bytes,
+ );
+ return expect(isEqual).to.be.false();
+ });
+
+ describe('should ignore trailing data', () => {
+ it('should return true when both < 32 bytes', async () => {
+ const isEqual = await libBytes.publicEqualsPop1.callAsync('0x0102', '0x0103');
+ return expect(isEqual).to.be.true();
+ });
+ });
+ });
+
+ describe('deepCopyBytes', () => {
+ it('should revert if dest is shorter than source', async () => {
+ return expectContractCallFailedAsync(
+ libBytes.publicDeepCopyBytes.callAsync(byteArrayShorterThan32Bytes, byteArrayLongerThan32Bytes),
+ RevertReason.LibBytesGreaterOrEqualToSourceBytesLengthRequired,
+ );
+ });
+ it('should overwrite dest with source if source and dest have equal length', async () => {
+ const zeroedByteArrayLongerThan32Bytes = `0x${_.repeat('0', byteArrayLongerThan32Bytes.length - 2)}`;
+ const zeroedBytesAfterCopy = await libBytes.publicDeepCopyBytes.callAsync(
+ zeroedByteArrayLongerThan32Bytes,
+ byteArrayLongerThan32Bytes,
+ );
+ return expect(zeroedBytesAfterCopy).to.be.equal(byteArrayLongerThan32Bytes);
+ });
+ it('should overwrite the leftmost len(source) bytes of dest if dest is larger than source', async () => {
+ const zeroedByteArrayLongerThan32Bytes = `0x${_.repeat('0', byteArrayLongerThan32Bytes.length * 2)}`;
+ const zeroedBytesAfterCopy = await libBytes.publicDeepCopyBytes.callAsync(
+ zeroedByteArrayLongerThan32Bytes,
+ byteArrayLongerThan32Bytes,
+ );
+ const copiedBytes = zeroedBytesAfterCopy.slice(0, byteArrayLongerThan32Bytes.length);
+ return expect(copiedBytes).to.be.equal(byteArrayLongerThan32Bytes);
+ });
+ it('should not overwrite the rightmost bytes of dest if dest is larger than source', async () => {
+ const zeroedByteArrayLongerThan32Bytes = `0x${_.repeat('0', byteArrayLongerThan32Bytes.length * 2)}`;
+ const zeroedBytesAfterCopy = await libBytes.publicDeepCopyBytes.callAsync(
+ zeroedByteArrayLongerThan32Bytes,
+ byteArrayLongerThan32Bytes,
+ );
+ const expectedNotCopiedBytes = zeroedByteArrayLongerThan32Bytes.slice(byteArrayLongerThan32Bytes.length);
+ const notCopiedBytes = zeroedBytesAfterCopy.slice(byteArrayLongerThan32Bytes.length);
+ return expect(notCopiedBytes).to.be.equal(expectedNotCopiedBytes);
+ });
+ });
+
+ describe('readAddress', () => {
+ it('should successfully read address when the address takes up the whole array', async () => {
+ const byteArray = ethUtil.addHexPrefix(testAddress);
+ const testAddressOffset = new BigNumber(0);
+ const address = await libBytes.publicReadAddress.callAsync(byteArray, testAddressOffset);
+ return expect(address).to.be.equal(testAddress);
+ });
+ it('should successfully read address when it is offset in the array', async () => {
+ const addressByteArrayBuffer = ethUtil.toBuffer(testAddress);
+ const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
+ const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, addressByteArrayBuffer]);
+ const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
+ const testAddressOffset = new BigNumber(prefixByteArrayBuffer.byteLength);
+ const address = await libBytes.publicReadAddress.callAsync(combinedByteArray, testAddressOffset);
+ return expect(address).to.be.equal(testAddress);
+ });
+ it('should fail if the byte array is too short to hold an address', async () => {
+ const shortByteArray = '0xabcdef';
+ const offset = new BigNumber(0);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadAddress.callAsync(shortByteArray, offset),
+ RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
+ );
+ });
+ it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
+ const byteArray = testAddress;
+ const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadAddress.callAsync(byteArray, badOffset),
+ RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
+ );
+ });
+ });
+
+ describe('writeAddress', () => {
+ it('should successfully write address when the address takes up the whole array', async () => {
+ const byteArray = testAddress;
+ const testAddressOffset = new BigNumber(0);
+ const newByteArray = await libBytes.publicWriteAddress.callAsync(
+ byteArray,
+ testAddressOffset,
+ testAddressB,
+ );
+ return expect(newByteArray).to.be.equal(testAddressB);
+ });
+ it('should successfully write address when it is offset in the array', async () => {
+ const addressByteArrayBuffer = ethUtil.toBuffer(testAddress);
+ const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
+ const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, addressByteArrayBuffer]);
+ const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
+ const testAddressOffset = new BigNumber(prefixByteArrayBuffer.byteLength);
+ const newByteArray = await libBytes.publicWriteAddress.callAsync(
+ combinedByteArray,
+ testAddressOffset,
+ testAddressB,
+ );
+ const newByteArrayBuffer = ethUtil.toBuffer(newByteArray);
+ const addressFromOffsetBuffer = newByteArrayBuffer.slice(prefixByteArrayBuffer.byteLength);
+ const addressFromOffset = ethUtil.addHexPrefix(ethUtil.bufferToHex(addressFromOffsetBuffer));
+ return expect(addressFromOffset).to.be.equal(testAddressB);
+ });
+ it('should fail if the byte array is too short to hold an address', async () => {
+ const offset = new BigNumber(0);
+ return expectContractCallFailedAsync(
+ libBytes.publicWriteAddress.callAsync(byteArrayShorterThan20Bytes, offset, testAddress),
+ RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
+ );
+ });
+ it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
+ const byteArray = byteArrayLongerThan32Bytes;
+ const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
+ return expectContractCallFailedAsync(
+ libBytes.publicWriteAddress.callAsync(byteArray, badOffset, testAddress),
+ RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
+ );
+ });
+ });
+
+ describe('readBytes32', () => {
+ it('should successfully read bytes32 when the bytes32 takes up the whole array', async () => {
+ const testBytes32Offset = new BigNumber(0);
+ const bytes32 = await libBytes.publicReadBytes32.callAsync(testBytes32, testBytes32Offset);
+ return expect(bytes32).to.be.equal(testBytes32);
+ });
+ it('should successfully read bytes32 when it is offset in the array', async () => {
+ const bytes32ByteArrayBuffer = ethUtil.toBuffer(testBytes32);
+ const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
+ const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes32ByteArrayBuffer]);
+ const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
+ const testBytes32Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
+ const bytes32 = await libBytes.publicReadBytes32.callAsync(combinedByteArray, testBytes32Offset);
+ return expect(bytes32).to.be.equal(testBytes32);
+ });
+ it('should fail if the byte array is too short to hold a bytes32', async () => {
+ const offset = new BigNumber(0);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
+ const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadBytes32.callAsync(testBytes32, badOffset),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ });
+
+ describe('writeBytes32', () => {
+ it('should successfully write bytes32 when the address takes up the whole array', async () => {
+ const byteArray = testBytes32;
+ const testBytes32Offset = new BigNumber(0);
+ const newByteArray = await libBytes.publicWriteBytes32.callAsync(
+ byteArray,
+ testBytes32Offset,
+ testBytes32B,
+ );
+ return expect(newByteArray).to.be.equal(testBytes32B);
+ });
+ it('should successfully write bytes32 when it is offset in the array', async () => {
+ const bytes32ByteArrayBuffer = ethUtil.toBuffer(testBytes32);
+ const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
+ const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes32ByteArrayBuffer]);
+ const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
+ const testBytes32Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
+ const newByteArray = await libBytes.publicWriteBytes32.callAsync(
+ combinedByteArray,
+ testBytes32Offset,
+ testBytes32B,
+ );
+ const newByteArrayBuffer = ethUtil.toBuffer(newByteArray);
+ const bytes32FromOffsetBuffer = newByteArrayBuffer.slice(prefixByteArrayBuffer.byteLength);
+ const bytes32FromOffset = ethUtil.addHexPrefix(ethUtil.bufferToHex(bytes32FromOffsetBuffer));
+ return expect(bytes32FromOffset).to.be.equal(testBytes32B);
+ });
+ it('should fail if the byte array is too short to hold a bytes32', async () => {
+ const offset = new BigNumber(0);
+ return expectContractCallFailedAsync(
+ libBytes.publicWriteBytes32.callAsync(byteArrayShorterThan32Bytes, offset, testBytes32),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
+ const byteArray = byteArrayLongerThan32Bytes;
+ const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
+ return expectContractCallFailedAsync(
+ libBytes.publicWriteBytes32.callAsync(byteArray, badOffset, testBytes32),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ });
+
+ describe('readUint256', () => {
+ it('should successfully read uint256 when the uint256 takes up the whole array', async () => {
+ const formattedTestUint256 = new BN(testUint256.toString(10));
+ const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256);
+ const byteArray = ethUtil.bufferToHex(testUint256AsBuffer);
+ const testUint256Offset = new BigNumber(0);
+ const uint256 = await libBytes.publicReadUint256.callAsync(byteArray, testUint256Offset);
+ return expect(uint256).to.bignumber.equal(testUint256);
+ });
+ it('should successfully read uint256 when it is offset in the array', async () => {
+ const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
+ const formattedTestUint256 = new BN(testUint256.toString(10));
+ const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256);
+ const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, testUint256AsBuffer]);
+ const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
+ const testUint256Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
+ const uint256 = await libBytes.publicReadUint256.callAsync(combinedByteArray, testUint256Offset);
+ return expect(uint256).to.bignumber.equal(testUint256);
+ });
+ it('should fail if the byte array is too short to hold a uint256', async () => {
+ const offset = new BigNumber(0);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => {
+ const formattedTestUint256 = new BN(testUint256.toString(10));
+ const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256);
+ const byteArray = ethUtil.bufferToHex(testUint256AsBuffer);
+ const badOffset = new BigNumber(testUint256AsBuffer.byteLength);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadUint256.callAsync(byteArray, badOffset),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ });
+
+ describe('writeUint256', () => {
+ it('should successfully write uint256 when the address takes up the whole array', async () => {
+ const byteArray = testBytes32;
+ const testUint256Offset = new BigNumber(0);
+ const newByteArray = await libBytes.publicWriteUint256.callAsync(
+ byteArray,
+ testUint256Offset,
+ testUint256B,
+ );
+ const newByteArrayAsUint256 = new BigNumber(newByteArray, 16);
+ return expect(newByteArrayAsUint256).to.be.bignumber.equal(testUint256B);
+ });
+ it('should successfully write uint256 when it is offset in the array', async () => {
+ const bytes32ByteArrayBuffer = ethUtil.toBuffer(testBytes32);
+ const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
+ const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes32ByteArrayBuffer]);
+ const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
+ const testUint256Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
+ const newByteArray = await libBytes.publicWriteUint256.callAsync(
+ combinedByteArray,
+ testUint256Offset,
+ testUint256B,
+ );
+ const newByteArrayBuffer = ethUtil.toBuffer(newByteArray);
+ const uint256FromOffsetBuffer = newByteArrayBuffer.slice(prefixByteArrayBuffer.byteLength);
+ const uint256FromOffset = new BigNumber(
+ ethUtil.addHexPrefix(ethUtil.bufferToHex(uint256FromOffsetBuffer)),
+ 16,
+ );
+ return expect(uint256FromOffset).to.be.bignumber.equal(testUint256B);
+ });
+ it('should fail if the byte array is too short to hold a uint256', async () => {
+ const offset = new BigNumber(0);
+ return expectContractCallFailedAsync(
+ libBytes.publicWriteUint256.callAsync(byteArrayShorterThan32Bytes, offset, testUint256),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => {
+ const byteArray = byteArrayLongerThan32Bytes;
+ const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
+ return expectContractCallFailedAsync(
+ libBytes.publicWriteUint256.callAsync(byteArray, badOffset, testUint256),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ });
+
+ describe('readBytes4', () => {
+ // AssertionError: expected promise to be rejected with an error including 'revert' but it was fulfilled with '0x08c379a0'
+ it('should revert if byte array has a length < 4', async () => {
+ const byteArrayLessThan4Bytes = '0x010101';
+ const offset = new BigNumber(0);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, offset),
+ RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
+ );
+ });
+ it('should return the first 4 bytes of a byte array of arbitrary length', async () => {
+ const first4Bytes = await libBytes.publicReadBytes4.callAsync(byteArrayLongerThan32Bytes, new BigNumber(0));
+ const expectedFirst4Bytes = byteArrayLongerThan32Bytes.slice(0, 10);
+ expect(first4Bytes).to.equal(expectedFirst4Bytes);
+ });
+ it('should successfully read bytes4 when the bytes4 takes up the whole array', async () => {
+ const testBytes4Offset = new BigNumber(0);
+ const bytes4 = await libBytes.publicReadBytes4.callAsync(testBytes4, testBytes4Offset);
+ return expect(bytes4).to.be.equal(testBytes4);
+ });
+ it('should successfully read bytes4 when it is offset in the array', async () => {
+ const bytes4ByteArrayBuffer = ethUtil.toBuffer(testBytes4);
+ const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
+ const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes4ByteArrayBuffer]);
+ const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
+ const testBytes4Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
+ const bytes4 = await libBytes.publicReadBytes4.callAsync(combinedByteArray, testBytes4Offset);
+ return expect(bytes4).to.be.equal(testBytes4);
+ });
+ it('should fail if the length between the offset and end of the byte array is too short to hold a bytes4', async () => {
+ const badOffset = new BigNumber(ethUtil.toBuffer(testBytes4).byteLength);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadBytes4.callAsync(testBytes4, badOffset),
+ RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
+ );
+ });
+ });
+
+ describe('readBytesWithLength', () => {
+ it('should successfully read short, nested array of bytes when it takes up the whole array', async () => {
+ const testBytesOffset = new BigNumber(0);
+ const bytes = await libBytes.publicReadBytesWithLength.callAsync(shortTestBytes, testBytesOffset);
+ return expect(bytes).to.be.equal(shortData);
+ });
+ it('should successfully read short, nested array of bytes when it is offset in the array', async () => {
+ const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
+ const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, shortTestBytesAsBuffer]);
+ const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
+ const testUint256Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
+ const bytes = await libBytes.publicReadBytesWithLength.callAsync(combinedByteArray, testUint256Offset);
+ return expect(bytes).to.be.equal(shortData);
+ });
+ it('should successfully read a nested array of bytes - one word in length - when it takes up the whole array', async () => {
+ const testBytesOffset = new BigNumber(0);
+ const bytes = await libBytes.publicReadBytesWithLength.callAsync(wordOfTestBytes, testBytesOffset);
+ return expect(bytes).to.be.equal(wordOfData);
+ });
+ it('should successfully read a nested array of bytes - one word in length - when it is offset in the array', async () => {
+ const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
+ const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, wordOfTestBytesAsBuffer]);
+ const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
+ const testUint256Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
+ const bytes = await libBytes.publicReadBytesWithLength.callAsync(combinedByteArray, testUint256Offset);
+ return expect(bytes).to.be.equal(wordOfData);
+ });
+ it('should successfully read long, nested array of bytes when it takes up the whole array', async () => {
+ const testBytesOffset = new BigNumber(0);
+ const bytes = await libBytes.publicReadBytesWithLength.callAsync(longTestBytes, testBytesOffset);
+ return expect(bytes).to.be.equal(longData);
+ });
+ it('should successfully read long, nested array of bytes when it is offset in the array', async () => {
+ const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
+ const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, longTestBytesAsBuffer]);
+ const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
+ const testUint256Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
+ const bytes = await libBytes.publicReadBytesWithLength.callAsync(combinedByteArray, testUint256Offset);
+ return expect(bytes).to.be.equal(longData);
+ });
+ it('should fail if the byte array is too short to hold the length of a nested byte array', async () => {
+ // The length of the nested array is 32 bytes. By storing less than 32 bytes, a length cannot be read.
+ const offset = new BigNumber(0);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, offset),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ it('should fail if we store a nested byte array length, without a nested byte array', async () => {
+ const offset = new BigNumber(0);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadBytesWithLength.callAsync(testBytes32, offset),
+ RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
+ );
+ });
+ it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array', async () => {
+ const badOffset = new BigNumber(ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, badOffset),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ it('should fail if the length between the offset and end of the byte array is too short to hold the nested byte array', async () => {
+ const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength);
+ return expectContractCallFailedAsync(
+ libBytes.publicReadBytesWithLength.callAsync(testBytes32, badOffset),
+ RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
+ );
+ });
+ });
+
+ describe('writeBytesWithLength', () => {
+ it('should successfully write short, nested array of bytes when it takes up the whole array', async () => {
+ const testBytesOffset = new BigNumber(0);
+ const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength));
+ const bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
+ emptyByteArray,
+ testBytesOffset,
+ shortData,
+ );
+ const bytesRead = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
+ return expect(bytesRead).to.be.equal(shortData);
+ });
+ it('should successfully write short, nested array of bytes when it is offset in the array', async () => {
+ // Write a prefix to the array
+ const prefixData = '0xabcdef';
+ const prefixDataAsBuffer = ethUtil.toBuffer(prefixData);
+ const prefixOffset = new BigNumber(0);
+ const emptyByteArray = ethUtil.bufferToHex(
+ new Buffer(prefixDataAsBuffer.byteLength + shortTestBytesAsBuffer.byteLength),
+ );
+ let bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
+ emptyByteArray,
+ prefixOffset,
+ prefixData,
+ );
+ // Write data after prefix
+ const testBytesOffset = new BigNumber(prefixDataAsBuffer.byteLength);
+ bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
+ bytesWritten,
+ testBytesOffset,
+ shortData,
+ );
+ // Read data after prefix and validate
+ const bytes = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
+ return expect(bytes).to.be.equal(shortData);
+ });
+ it('should successfully write a nested array of bytes - one word in length - when it takes up the whole array', async () => {
+ const testBytesOffset = new BigNumber(0);
+ const emptyByteArray = ethUtil.bufferToHex(new Buffer(wordOfTestBytesAsBuffer.byteLength));
+ const bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
+ emptyByteArray,
+ testBytesOffset,
+ wordOfData,
+ );
+ const bytesRead = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
+ return expect(bytesRead).to.be.equal(wordOfData);
+ });
+ it('should successfully write a nested array of bytes - one word in length - when it is offset in the array', async () => {
+ // Write a prefix to the array
+ const prefixData = '0xabcdef';
+ const prefixDataAsBuffer = ethUtil.toBuffer(prefixData);
+ const prefixOffset = new BigNumber(0);
+ const emptyByteArray = ethUtil.bufferToHex(
+ new Buffer(prefixDataAsBuffer.byteLength + wordOfTestBytesAsBuffer.byteLength),
+ );
+ let bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
+ emptyByteArray,
+ prefixOffset,
+ prefixData,
+ );
+ // Write data after prefix
+ const testBytesOffset = new BigNumber(prefixDataAsBuffer.byteLength);
+ bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
+ bytesWritten,
+ testBytesOffset,
+ wordOfData,
+ );
+ // Read data after prefix and validate
+ const bytes = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
+ return expect(bytes).to.be.equal(wordOfData);
+ });
+ it('should successfully write a long, nested bytes when it takes up the whole array', async () => {
+ const testBytesOffset = new BigNumber(0);
+ const emptyByteArray = ethUtil.bufferToHex(new Buffer(longTestBytesAsBuffer.byteLength));
+ const bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
+ emptyByteArray,
+ testBytesOffset,
+ longData,
+ );
+ const bytesRead = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
+ return expect(bytesRead).to.be.equal(longData);
+ });
+ it('should successfully write long, nested array of bytes when it is offset in the array', async () => {
+ // Write a prefix to the array
+ const prefixData = '0xabcdef';
+ const prefixDataAsBuffer = ethUtil.toBuffer(prefixData);
+ const prefixOffset = new BigNumber(0);
+ const emptyByteArray = ethUtil.bufferToHex(
+ new Buffer(prefixDataAsBuffer.byteLength + longTestBytesAsBuffer.byteLength),
+ );
+ let bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
+ emptyByteArray,
+ prefixOffset,
+ prefixData,
+ );
+ // Write data after prefix
+ const testBytesOffset = new BigNumber(prefixDataAsBuffer.byteLength);
+ bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(bytesWritten, testBytesOffset, longData);
+ // Read data after prefix and validate
+ const bytes = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
+ return expect(bytes).to.be.equal(longData);
+ });
+ it('should fail if the byte array is too short to hold the length of a nested byte array', async () => {
+ const offset = new BigNumber(0);
+ const emptyByteArray = ethUtil.bufferToHex(new Buffer(1));
+ return expectContractCallFailedAsync(
+ libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, offset, longData),
+ RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
+ );
+ });
+ it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array', async () => {
+ const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength));
+ const badOffset = new BigNumber(ethUtil.toBuffer(shortTestBytesAsBuffer).byteLength);
+ return expectContractCallFailedAsync(
+ libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, badOffset, shortData),
+ RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
+ );
+ });
+ });
+
+ describe('memCopy', () => {
+ // Create memory 0x000102...FF
+ const memSize = 256;
+ // tslint:disable:no-shadowed-variable
+ const memory = new Uint8Array(memSize).map((_, i) => i);
+ const memHex = toHex(memory);
+
+ // Reference implementation to test against
+ const refMemcpy = (mem: Uint8Array, dest: number, source: number, length: number): Uint8Array =>
+ Uint8Array.from(mem).copyWithin(dest, source, source + length);
+
+ // Test vectors: destination, source, length, job description
+ type Tests = Array<[number, number, number, string]>;
+
+ const test = (tests: Tests) =>
+ tests.forEach(([dest, source, length, job]) =>
+ it(job, async () => {
+ const expected = refMemcpy(memory, dest, source, length);
+ const resultStr = await libBytes.testMemcpy.callAsync(
+ memHex,
+ new BigNumber(dest),
+ new BigNumber(source),
+ new BigNumber(length),
+ );
+ const result = fromHex(resultStr);
+ expect(result).to.deep.equal(expected);
+ }),
+ );
+
+ test([[0, 0, 0, 'copies zero bytes with overlap']]);
+
+ describe('copies forward', () =>
+ test([
+ [128, 0, 0, 'zero bytes'],
+ [128, 0, 1, 'one byte'],
+ [128, 0, 11, 'eleven bytes'],
+ [128, 0, 31, 'thirty-one bytes'],
+ [128, 0, 32, 'one word'],
+ [128, 0, 64, 'two words'],
+ [128, 0, 96, 'three words'],
+ [128, 0, 33, 'one word and one byte'],
+ [128, 0, 72, 'two words and eight bytes'],
+ [128, 0, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies forward within one word', () =>
+ test([
+ [16, 0, 0, 'zero bytes'],
+ [16, 0, 1, 'one byte'],
+ [16, 0, 11, 'eleven bytes'],
+ [16, 0, 16, 'sixteen bytes'],
+ ]));
+
+ describe('copies forward with one byte overlap', () =>
+ test([
+ [0, 0, 1, 'one byte'],
+ [10, 0, 11, 'eleven bytes'],
+ [30, 0, 31, 'thirty-one bytes'],
+ [31, 0, 32, 'one word'],
+ [32, 0, 33, 'one word and one byte'],
+ [71, 0, 72, 'two words and eight bytes'],
+ [99, 0, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies forward with thirty-one bytes overlap', () =>
+ test([
+ [0, 0, 31, 'thirty-one bytes'],
+ [1, 0, 32, 'one word'],
+ [2, 0, 33, 'one word and one byte'],
+ [41, 0, 72, 'two words and eight bytes'],
+ [69, 0, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies forward with one word overlap', () =>
+ test([
+ [0, 0, 32, 'one word'],
+ [1, 0, 33, 'one word and one byte'],
+ [41, 0, 72, 'two words and eight bytes'],
+ [69, 0, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies forward with one word and one byte overlap', () =>
+ test([
+ [0, 0, 33, 'one word and one byte'],
+ [40, 0, 72, 'two words and eight bytes'],
+ [68, 0, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies forward with two words overlap', () =>
+ test([
+ [0, 0, 64, 'two words'],
+ [8, 0, 72, 'two words and eight bytes'],
+ [36, 0, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies forward within one word and one byte overlap', () =>
+ test([[0, 0, 1, 'one byte'], [10, 0, 11, 'eleven bytes'], [15, 0, 16, 'sixteen bytes']]));
+
+ describe('copies backward', () =>
+ test([
+ [0, 128, 0, 'zero bytes'],
+ [0, 128, 1, 'one byte'],
+ [0, 128, 11, 'eleven bytes'],
+ [0, 128, 31, 'thirty-one bytes'],
+ [0, 128, 32, 'one word'],
+ [0, 128, 64, 'two words'],
+ [0, 128, 96, 'three words'],
+ [0, 128, 33, 'one word and one byte'],
+ [0, 128, 72, 'two words and eight bytes'],
+ [0, 128, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies backward within one word', () =>
+ test([
+ [0, 16, 0, 'zero bytes'],
+ [0, 16, 1, 'one byte'],
+ [0, 16, 11, 'eleven bytes'],
+ [0, 16, 16, 'sixteen bytes'],
+ ]));
+
+ describe('copies backward with one byte overlap', () =>
+ test([
+ [0, 0, 1, 'one byte'],
+ [0, 10, 11, 'eleven bytes'],
+ [0, 30, 31, 'thirty-one bytes'],
+ [0, 31, 32, 'one word'],
+ [0, 32, 33, 'one word and one byte'],
+ [0, 71, 72, 'two words and eight bytes'],
+ [0, 99, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies backward with thirty-one bytes overlap', () =>
+ test([
+ [0, 0, 31, 'thirty-one bytes'],
+ [0, 1, 32, 'one word'],
+ [0, 2, 33, 'one word and one byte'],
+ [0, 41, 72, 'two words and eight bytes'],
+ [0, 69, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies backward with one word overlap', () =>
+ test([
+ [0, 0, 32, 'one word'],
+ [0, 1, 33, 'one word and one byte'],
+ [0, 41, 72, 'two words and eight bytes'],
+ [0, 69, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies backward with one word and one byte overlap', () =>
+ test([
+ [0, 0, 33, 'one word and one byte'],
+ [0, 40, 72, 'two words and eight bytes'],
+ [0, 68, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies backward with two words overlap', () =>
+ test([
+ [0, 0, 64, 'two words'],
+ [0, 8, 72, 'two words and eight bytes'],
+ [0, 36, 100, 'three words and four bytes'],
+ ]));
+
+ describe('copies forward within one word and one byte overlap', () =>
+ test([[0, 0, 1, 'one byte'], [0, 10, 11, 'eleven bytes'], [0, 15, 16, 'sixteen bytes']]));
+ });
+});
+// tslint:disable:max-file-line-count
diff --git a/contracts/utils/test/libs.ts b/contracts/utils/test/libs.ts
new file mode 100644
index 000000000..81596b2e4
--- /dev/null
+++ b/contracts/utils/test/libs.ts
@@ -0,0 +1,34 @@
+import { chaiSetup, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import * as chai from 'chai';
+
+import { TestConstantsContract } from '../generated-wrappers/test_constants';
+import { artifacts } from '../src';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+describe('Libs', () => {
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+
+ describe('LibConstants', () => {
+ describe('ZRX_ASSET_DATA', () => {
+ it('should have the correct ZRX_ASSET_DATA', async () => {
+ const testConstants = await TestConstantsContract.deployFrom0xArtifactAsync(
+ artifacts.TestConstants,
+ provider,
+ txDefaults,
+ );
+ const isValid = await testConstants.assertValidZrxAssetData.callAsync();
+ expect(isValid).to.be.equal(true);
+ });
+ });
+ });
+});
diff --git a/contracts/utils/tsconfig.json b/contracts/utils/tsconfig.json
new file mode 100644
index 000000000..68251e6b0
--- /dev/null
+++ b/contracts/utils/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/TestConstants.json",
+ "./generated-artifacts/TestLibBytes.json",
+ "./generated-artifacts/IOwnable.json",
+ "./generated-artifacts/Ownable.json",
+ "./generated-artifacts/LibBytes.json",
+ "./generated-artifacts/SafeMath.json",
+ "./generated-artifacts/ReentrancyGuard.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/utils/tslint.json b/contracts/utils/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/utils/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/lerna.json b/lerna.json
index e2147be85..fa9ef5aff 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,6 +1,6 @@
{
"lerna": "3.0.0-beta.23",
- "packages": ["packages/*"],
+ "packages": ["packages/*", "contracts/*"],
"version": "independent",
"command": {
"publish": {
diff --git a/package.json b/package.json
index 953f51eb3..16b7a10f9 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,8 @@
"node": ">=6.12"
},
"workspaces": [
- "packages/*"
+ "packages/*",
+ "contracts/*"
],
"scripts": {
"ganache": "ganache-cli -p 8545 --gasLimit 10000000 --networkId 50 -m \"${npm_package_config_mnemonic}\"",
@@ -22,13 +23,13 @@
"install:all": "yarn install",
"wsrun": "wsrun",
"lerna": "lerna",
- "build": "wsrun build $PKG --fast-exit -r --stages",
- "build:no_website": "wsrun build $PKG --fast-exit -r --stages --exclude @0x/website",
- "build:ci:no_website": "wsrun build:ci $PKG --fast-exit -r --stages --exclude @0x/website",
+ "build": "wsrun build $PKG --fast-exit -r --stages --exclude-missing",
+ "build:no_website": "wsrun build $PKG --fast-exit -r --stages --exclude @0x/website --exclude-missing",
+ "build:ci:no_website": "wsrun build:ci $PKG --fast-exit -r --stages --exclude @0x/website --exclude-missing",
"build:monorepo_scripts": "PKG=@0x/monorepo-scripts yarn build",
"build:ts": "tsc -b",
"watch:ts": "tsc -b -w",
- "clean": "wsrun clean $PKG --fast-exit -r --parallel",
+ "clean": "wsrun clean $PKG --fast-exit -r --parallel --exclude-missing",
"remove_node_modules": "lerna clean --yes; rm -rf node_modules",
"rebuild": "run-s clean build",
"rebuild:no_website": "run-s clean build:no_website",
@@ -40,7 +41,7 @@
},
"config": {
"mnemonic": "concert load couple harbor equip island argue ramp clarify fence smart topic",
- "packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-cov ethereum-types asset-buyer"
+ "packagesWithDocPages": "0x.js connect json-schemas subproviders web3-wrapper contract-wrappers order-utils order-watcher sol-compiler sol-cov ethereum-types asset-buyer migrations"
},
"bundlewatch": {
"files": [
@@ -65,7 +66,7 @@
"graceful-fs": "4.1.15"
},
"devDependencies": {
- "@0x-lerna-fork/lerna": "3.0.0-beta.25",
+ "@0x-lerna-fork/lerna": "3.0.0-beta.26",
"@0xproject/npm-cli-login": "^0.0.11",
"async-child-process": "^1.1.1",
"bundlewatch": "^0.2.1",
diff --git a/packages/0x.js/.npmignore b/packages/0x.js/.npmignore
index d7ee80c97..312a23faa 100644
--- a/packages/0x.js/.npmignore
+++ b/packages/0x.js/.npmignore
@@ -4,7 +4,7 @@ webpack.config.js
yarn-error.log
test/
/src/
-/contract_templates/
+/abi-gen-templates/
/generated_docs/
/scripts/
/lib/src/monorepo_scripts/
diff --git a/packages/0x.js/CHANGELOG.json b/packages/0x.js/CHANGELOG.json
index 0321ee200..f73de96aa 100644
--- a/packages/0x.js/CHANGELOG.json
+++ b/packages/0x.js/CHANGELOG.json
@@ -1,5 +1,51 @@
[
{
+ "version": "3.0.0",
+ "changes": [
+ {
+ "note":
+ "Export `MultiAssetData`, `MultiAssetDataWithRecursiveDecoding`, `ObjectMap`, and `SingleAssetData` from types. No longer export `AssetData`.",
+ "pr": 1363
+ }
+ ]
+ },
+ {
+ "version": "2.0.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.0.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "2.0.6",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "2.0.5",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "2.0.4",
"changes": [
diff --git a/packages/0x.js/CHANGELOG.md b/packages/0x.js/CHANGELOG.md
index 2467311bf..2923fdf03 100644
--- a/packages/0x.js/CHANGELOG.md
+++ b/packages/0x.js/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.8 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.0.7 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v2.0.6 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v2.0.5 - _November 21, 2018_
+
+ * Dependencies updated
+
## v2.0.4 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json
index 755ff7512..2960c9e4b 100644
--- a/packages/0x.js/package.json
+++ b/packages/0x.js/package.json
@@ -1,6 +1,6 @@
{
"name": "0x.js",
- "version": "2.0.4",
+ "version": "2.0.8",
"engines": {
"node": ">=6.12"
},
@@ -42,12 +42,11 @@
},
"license": "Apache-2.0",
"devDependencies": {
- "@0x/abi-gen": "^1.0.16",
- "@0x/abi-gen-wrappers": "^1.0.5",
- "@0x/contract-addresses": "^1.1.0",
- "@0x/dev-utils": "^1.0.17",
- "@0x/migrations": "^2.0.4",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/contract-addresses": "^2.0.0",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/migrations": "^2.2.2",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/node": "*",
@@ -73,18 +72,18 @@
"webpack": "^4.20.2"
},
"dependencies": {
- "@0x/assert": "^1.0.17",
- "@0x/base-contract": "^3.0.6",
- "@0x/contract-wrappers": "^4.0.2",
- "@0x/order-utils": "^3.0.2",
- "@0x/order-watcher": "^2.2.4",
- "@0x/subproviders": "^2.1.4",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/assert": "^1.0.20",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contract-wrappers": "^4.1.3",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/order-watcher": "^2.2.8",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/web3-provider-engine": "^14.0.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"web3-provider-engine": "14.0.6"
diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts
index 2df360b96..006e4cf29 100644
--- a/packages/0x.js/src/index.ts
+++ b/packages/0x.js/src/index.ts
@@ -4,6 +4,7 @@ export { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtil
export {
ContractWrappers,
+ DutchAuctionWrapper,
ERC20TokenWrapper,
ERC721TokenWrapper,
EtherTokenWrapper,
@@ -27,6 +28,7 @@ export {
OrderAndTraderInfo,
TraderInfo,
ValidateOrderFillableOpts,
+ DutchAuctionData,
} from '@0x/contract-wrappers';
export {
@@ -80,11 +82,16 @@ export {
OrderState,
AssetProxyId,
AssetData,
+ SingleAssetData,
ERC20AssetData,
ERC721AssetData,
+ MultiAssetData,
+ MultiAssetDataWithRecursiveDecoding,
SignatureType,
+ ObjectMap,
OrderRelevantState,
Stats,
+ DutchAuctionDetails,
} from '@0x/types';
export {
diff --git a/packages/abi-gen-templates/CHANGELOG.json b/packages/abi-gen-templates/CHANGELOG.json
new file mode 100644
index 000000000..baf852ad5
--- /dev/null
+++ b/packages/abi-gen-templates/CHANGELOG.json
@@ -0,0 +1,20 @@
+[
+ {
+ "timestamp": 1543401373,
+ "version": "1.0.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "version": "1.0.0",
+ "changes": [
+ {
+ "note": "Initial publish",
+ "pr": 1305
+ }
+ ]
+ }
+]
diff --git a/packages/abi-gen-templates/CHANGELOG.md b/packages/abi-gen-templates/CHANGELOG.md
new file mode 100644
index 000000000..1c3f21c6c
--- /dev/null
+++ b/packages/abi-gen-templates/CHANGELOG.md
@@ -0,0 +1,14 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+
+## v1.0.1 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v1.0.0 - _Invalid date_
+
+ * Initial publish (#1305)
diff --git a/packages/contract_templates/README.md b/packages/abi-gen-templates/README.md
index c6cc3b1b3..c6cc3b1b3 100644
--- a/packages/contract_templates/README.md
+++ b/packages/abi-gen-templates/README.md
diff --git a/packages/abi-gen-templates/contract.handlebars b/packages/abi-gen-templates/contract.handlebars
new file mode 100644
index 000000000..9b2a2b336
--- /dev/null
+++ b/packages/abi-gen-templates/contract.handlebars
@@ -0,0 +1,91 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+{{#if events}}
+export type {{contractName}}EventArgs =
+{{#each events}}
+ | {{@root.contractName}}{{name}}EventArgs{{#if @last}};{{/if}}
+{{/each}}
+
+export enum {{contractName}}Events {
+ {{#each events}}
+ {{name}} = '{{name}}',
+ {{/each}}
+}
+
+{{#each events}}
+{{> event}}
+
+{{/each}}
+{{/if}}
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class {{contractName}}Contract extends BaseContract {
+{{#each methods}}
+ {{#this.constant}}
+ {{> call contractName=../contractName}}
+ {{/this.constant}}
+ {{^this.constant}}
+ {{> tx contractName=../contractName}}
+ {{/this.constant}}
+{{/each}}
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact | SimpleContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ {{> typed_params inputs=ctor.inputs}}
+ ): Promise<{{contractName}}Contract> {
+ 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 {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, {{> params inputs=ctor.inputs}});
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ {{> typed_params inputs=ctor.inputs}}
+ ): Promise<{{contractName}}Contract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [{{> params inputs=ctor.inputs}}] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [{{> params inputs=ctor.inputs}}],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [{{> params inputs=ctor.inputs}}]);
+ 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(`{{contractName}} successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new {{contractName}}Contract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('{{contractName}}', 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-templates/package.json b/packages/abi-gen-templates/package.json
new file mode 100644
index 000000000..09872ab49
--- /dev/null
+++ b/packages/abi-gen-templates/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "@0x/abi-gen-templates",
+ "version": "1.0.1",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Handlebars templates used by abi-gen to generate contract-wrappers",
+ "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-templates/README.md",
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/packages/contract_templates/partials/call.handlebars b/packages/abi-gen-templates/partials/call.handlebars
index 7c9c934c3..7c9c934c3 100644
--- a/packages/contract_templates/partials/call.handlebars
+++ b/packages/abi-gen-templates/partials/call.handlebars
diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/abi-gen-templates/partials/callAsync.handlebars
index ddbbe7508..ddbbe7508 100644
--- a/packages/contract_templates/partials/callAsync.handlebars
+++ b/packages/abi-gen-templates/partials/callAsync.handlebars
diff --git a/packages/contract_templates/partials/event.handlebars b/packages/abi-gen-templates/partials/event.handlebars
index 61d523ca2..61d523ca2 100644
--- a/packages/contract_templates/partials/event.handlebars
+++ b/packages/abi-gen-templates/partials/event.handlebars
diff --git a/packages/contract_templates/partials/params.handlebars b/packages/abi-gen-templates/partials/params.handlebars
index 2d9bb8ed9..2d9bb8ed9 100644
--- a/packages/contract_templates/partials/params.handlebars
+++ b/packages/abi-gen-templates/partials/params.handlebars
diff --git a/packages/contract_templates/partials/return_type.handlebars b/packages/abi-gen-templates/partials/return_type.handlebars
index 77d96e8c4..77d96e8c4 100644
--- a/packages/contract_templates/partials/return_type.handlebars
+++ b/packages/abi-gen-templates/partials/return_type.handlebars
diff --git a/packages/contract_templates/partials/tx.handlebars b/packages/abi-gen-templates/partials/tx.handlebars
index b39156583..b39156583 100644
--- a/packages/contract_templates/partials/tx.handlebars
+++ b/packages/abi-gen-templates/partials/tx.handlebars
diff --git a/packages/contract_templates/partials/typed_params.handlebars b/packages/abi-gen-templates/partials/typed_params.handlebars
index c100e58f7..c100e58f7 100644
--- a/packages/contract_templates/partials/typed_params.handlebars
+++ b/packages/abi-gen-templates/partials/typed_params.handlebars
diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json
index fff2bc41e..214920a08 100644
--- a/packages/abi-gen-wrappers/CHANGELOG.json
+++ b/packages/abi-gen-wrappers/CHANGELOG.json
@@ -1,5 +1,53 @@
[
{
+ "version": "2.1.0",
+ "changes": [
+ {
+ "note": "Added Dutch Auction Wrapper",
+ "pr": 1465
+ }
+ ]
+ },
+ {
+ "version": "2.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.0.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "version": "2.0.0",
+ "changes": [
+ {
+ "pr": 1309,
+ "note": "Update Exchange artifact to receive ZRX asset data as a constructor argument"
+ }
+ ],
+ "timestamp": 1543401373
+ },
+ {
+ "version": "1.1.0",
+ "changes": [
+ {
+ "note":
+ "`deployFrom0xArtifactAsync` additionally accepts artifacts that conform to the `SimpleContractArtifact` interface",
+ "pr": 1298
+ }
+ ],
+ "timestamp": 1542821676
+ },
+ {
"timestamp": 1542208198,
"version": "1.0.5",
"changes": [
diff --git a/packages/abi-gen-wrappers/CHANGELOG.md b/packages/abi-gen-wrappers/CHANGELOG.md
index 4dea965f1..c13c7a60f 100644
--- a/packages/abi-gen-wrappers/CHANGELOG.md
+++ b/packages/abi-gen-wrappers/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.2 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.0.1 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v2.0.0 - _November 28, 2018_
+
+ * Update Exchange artifact to receive ZRX asset data as a constructor argument (#1309)
+
+## v1.1.0 - _November 21, 2018_
+
+ * `deployFrom0xArtifactAsync` additionally accepts artifacts that conform to the `SimpleContractArtifact` interface (#1298)
+
## v1.0.5 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json
index 7236cf6ff..38b5e9a9b 100644
--- a/packages/abi-gen-wrappers/package.json
+++ b/packages/abi-gen-wrappers/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen-wrappers",
- "version": "1.0.5",
+ "version": "2.0.2",
"engines": {
"node": ">=6.12"
},
@@ -15,10 +15,10 @@
"lint": "tslint --format stylish --project .",
"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"
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output 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"
+ "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
},
"repository": {
"type": "git",
@@ -30,17 +30,19 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
"devDependencies": {
- "@0x/abi-gen": "^1.0.16",
- "@0x/tslint-config": "^1.0.10",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
- "ethereum-types": "^1.1.2",
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/abi-gen-templates": "^1.0.1",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/types": "^1.4.1",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"shx": "^0.2.2"
},
"dependencies": {
- "@0x/base-contract": "^3.0.6"
+ "@0x/base-contract": "^3.0.10"
},
"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
index 8ca70e026..27f108ebc 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -1800,7 +1801,7 @@ export class AssetProxyOwnerContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_owners: string[],
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
index 1efeeed0a..3995c6d87 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -968,7 +969,7 @@ export class DummyERC20TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_name: string,
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
index cc5f9679f..a7af2d158 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -1264,7 +1265,7 @@ export class DummyERC721TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_name: string,
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts
new file mode 100644
index 000000000..90e233756
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts
@@ -0,0 +1,322 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
+import { Web3Wrapper } from '@0x/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 DutchAuctionContract extends BaseContract {
+ public getAuctionDetails = {
+ 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 DutchAuctionContract;
+ const inputAbi = self._lookupAbi('getAuctionDetails({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('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.getAuctionDetails.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 DutchAuctionContract;
+ const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
+ [order
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.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 DutchAuctionContract;
+ const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
+ [order
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.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<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber}
+ > {
+ const self = this as any as DutchAuctionContract;
+ const functionSignature = 'getAuctionDetails({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.getAuctionDetails;
+ 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: 'getAuctionDetails'}) 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 matchOrders = {
+ async sendTransactionAsync(
+ buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ buySignature: string,
+ sellSignature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DutchAuctionContract;
+ 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;
+ [buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ]);
+ 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([buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.matchOrders.estimateGasAsync.bind(
+ self,
+ buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ buySignature: string,
+ sellSignature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DutchAuctionContract;
+ 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;
+ [buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ], 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([buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ buySignature: string,
+ sellSignature: string,
+ ): string {
+ const self = this as any as DutchAuctionContract;
+ 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;
+ [buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ], 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([buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
+ buySignature: string,
+ sellSignature: 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 DutchAuctionContract;
+ 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;
+ [buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.matchOrders;
+ const encodedData = ethersFunction.encode([buyOrder,
+ sellOrder,
+ buySignature,
+ sellSignature
+ ]);
+ 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 static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact | SimpleContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _exchange: string,
+ ): Promise<DutchAuctionContract> {
+ 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 DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _exchange: string,
+ ): Promise<DutchAuctionContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_exchange
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_exchange
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_exchange
+]);
+ 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(`DutchAuction successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new DutchAuctionContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_exchange
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('DutchAuction', 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
index ab207b38e..474472e43 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -601,7 +602,7 @@ export class ERC20ProxyContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC20ProxyContract> {
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
index 8ee563b7e..ab208cbf5 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -508,7 +509,7 @@ export class ERC20TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC20TokenContract> {
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
index 691c55578..f9730a072 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -601,7 +602,7 @@ export class ERC721ProxyContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC721ProxyContract> {
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts
index d1a2d5670..251dfa5f9 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -845,7 +846,7 @@ export class ERC721TokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ERC721TokenContract> {
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
index ffd498055..11b5e7024 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -3024,32 +3025,38 @@ export class ExchangeContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
+ _zrxAssetData: string,
): 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, );
+ return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, _zrxAssetData
+);
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
+ _zrxAssetData: string,
): Promise<ExchangeContract> {
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
- [] = BaseContract._formatABIDataItemList(
+ [_zrxAssetData
+] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
- [],
+ [_zrxAssetData
+],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
- const txData = deployInfo.encode(bytecode, []);
+ const txData = deployInfo.encode(bytecode, [_zrxAssetData
+]);
const web3Wrapper = new Web3Wrapper(provider);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{data: txData},
@@ -3061,7 +3068,8 @@ export class ExchangeContract extends BaseContract {
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 = [];
+ contractInstance.constructorArgs = [_zrxAssetData
+];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
index 80bbc52c7..8a88431b3 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -661,7 +662,7 @@ export class ForwarderContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_exchange: string,
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts
index 203a66b6d..5f38ffdac 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -60,7 +61,7 @@ export class IValidatorContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<IValidatorContract> {
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
index 99809a049..5fa6f1577 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -55,7 +56,7 @@ export class IWalletContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<IWalletContract> {
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts
index 38233af3f..ce47b76fc 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -295,7 +296,7 @@ export class OrderValidatorContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_exchange: string,
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
index 86d1031db..12ec55ae9 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -787,7 +788,7 @@ export class WETH9Contract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<WETH9Contract> {
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
index 98079e77b..877ffd12d 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
@@ -4,6 +4,7 @@
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
@@ -598,7 +599,7 @@ export class ZRXTokenContract extends BaseContract {
},
};
public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
+ artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
): Promise<ZRXTokenContract> {
diff --git a/packages/abi-gen-wrappers/src/index.ts b/packages/abi-gen-wrappers/src/index.ts
index de418214b..b5a7d0cfe 100644
--- a/packages/abi-gen-wrappers/src/index.ts
+++ b/packages/abi-gen-wrappers/src/index.ts
@@ -1,6 +1,7 @@
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/dutch_auction';
export * from './generated-wrappers/erc20_proxy';
export * from './generated-wrappers/erc20_token';
export * from './generated-wrappers/erc721_proxy';
diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json
index 1735c6b53..253fb124d 100644
--- a/packages/abi-gen/CHANGELOG.json
+++ b/packages/abi-gen/CHANGELOG.json
@@ -1,5 +1,32 @@
[
{
+ "version": "1.0.19",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.18",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "1.0.17",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "1.0.16",
"changes": [
diff --git a/packages/abi-gen/CHANGELOG.md b/packages/abi-gen/CHANGELOG.md
index 23e2f8914..4ca19ad7e 100644
--- a/packages/abi-gen/CHANGELOG.md
+++ b/packages/abi-gen/CHANGELOG.md
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.19 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.18 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v1.0.17 - _November 21, 2018_
+
+ * Dependencies updated
+
## v1.0.16 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/abi-gen/README.md b/packages/abi-gen/README.md
index 20b9d4f30..214d8f257 100644
--- a/packages/abi-gen/README.md
+++ b/packages/abi-gen/README.md
@@ -4,7 +4,7 @@ This package allows you to generate TypeScript contract wrappers from ABI files.
It's heavily inspired by [Geth abigen](https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts) but takes a different approach.
You can write your custom handlebars templates which will allow you to seamlessly integrate the generated code into your existing codebase with existing conventions.
-[Here](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) are the templates used to generate the contract wrappers used by 0x.js.e
+[Here](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/abi-gen-templates) are the templates used to generate the contract wrappers used by 0x.js.e
## Installation
@@ -44,7 +44,7 @@ You need to also specify the location of your main template used for every contr
## How to write custom templates?
-The best way to get started is to copy [0x.js templates](https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates) and start adjusting them for your needs.
+The best way to get started is to copy [0x.js templates](https://github.com/0xProject/0x-monorepo/tree/development/packages/abi-gen-templates) and start adjusting them for your needs.
We use [handlebars](http://handlebarsjs.com/) template engine under the hood.
You need to have a master template called `contract.mustache`. it will be used to generate each contract wrapper. Although - you don't need and probably shouldn't write all your logic in a single template file. You can write [partial templates](http://handlebarsjs.com/partials.html) and as long as they are within a partials folder - they will be registered and available.
diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json
index f69d24116..b122c742d 100644
--- a/packages/abi-gen/package.json
+++ b/packages/abi-gen/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen",
- "version": "1.0.16",
+ "version": "1.0.19",
"engines": {
"node": ">=6.12"
},
@@ -31,10 +31,10 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
"dependencies": {
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
"chalk": "^2.3.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"glob": "^7.1.2",
"handlebars": "^4.0.11",
"lodash": "^4.17.5",
@@ -45,7 +45,7 @@
"yargs": "^10.0.3"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/glob": "5.0.35",
"@types/handlebars": "^4.0.36",
"@types/mkdirp": "^0.5.1",
diff --git a/packages/assert/CHANGELOG.json b/packages/assert/CHANGELOG.json
index 2b4a3e7a1..3805a044f 100644
--- a/packages/assert/CHANGELOG.json
+++ b/packages/assert/CHANGELOG.json
@@ -1,5 +1,32 @@
[
{
+ "version": "1.0.20",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.19",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "1.0.18",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "1.0.17",
"changes": [
diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md
index 66f0971c1..ef84c48d4 100644
--- a/packages/assert/CHANGELOG.md
+++ b/packages/assert/CHANGELOG.md
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.20 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.19 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v1.0.18 - _November 21, 2018_
+
+ * Dependencies updated
+
## v1.0.17 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/assert/package.json b/packages/assert/package.json
index ec093a5be..cec1748cd 100644
--- a/packages/assert/package.json
+++ b/packages/assert/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/assert",
- "version": "1.0.17",
+ "version": "1.0.20",
"engines": {
"node": ">=6.12"
},
@@ -29,7 +29,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/assert/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/valid-url": "^1.0.2",
@@ -44,9 +44,9 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/json-schemas": "^2.1.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
"lodash": "^4.17.5",
"valid-url": "^1.0.9"
},
diff --git a/packages/asset-buyer/CHANGELOG.json b/packages/asset-buyer/CHANGELOG.json
index 394f29ff6..470d9b03b 100644
--- a/packages/asset-buyer/CHANGELOG.json
+++ b/packages/asset-buyer/CHANGELOG.json
@@ -1,12 +1,40 @@
[
{
+ "version": "3.0.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "3.0.3",
+ "changes": [
+ {
+ "note": "Update SRA order provider to include Dai"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "3.0.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "3.0.1",
"changes": [
{
"note": "Dependencies updated",
"pr": 1276
}
- ]
+ ],
+ "timestamp": 1542821676
},
{
"version": "3.0.0",
diff --git a/packages/asset-buyer/CHANGELOG.md b/packages/asset-buyer/CHANGELOG.md
index d6013e53e..cadb1acf8 100644
--- a/packages/asset-buyer/CHANGELOG.md
+++ b/packages/asset-buyer/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.4 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.0.3 - _December 11, 2018_
+
+ * Update SRA order provider to include Dai
+
+## v3.0.2 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v3.0.1 - _November 21, 2018_
+
+ * Dependencies updated (#1276)
+
## v3.0.0 - _November 14, 2018_
* update `getBuyQuoteAsync` to return eth spent on assets instead of per unit amount (#1252)
diff --git a/packages/asset-buyer/README.md b/packages/asset-buyer/README.md
index 383a3836a..b854bda11 100644
--- a/packages/asset-buyer/README.md
+++ b/packages/asset-buyer/README.md
@@ -1,7 +1,5 @@
## @0x/asset-buyer
-**Warning: In Beta, has not been extensively tested.**
-
Convenience package for buying assets represented on the Ethereum blockchain using 0x. In its simplest form, the package helps in the usage of the [0x forwarder contract](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md), which allows users to execute [Wrapped Ether](https://weth.io/) based 0x orders without having to set allowances, wrap Ether or own ZRX, meaning they can buy tokens with Ether alone. Given some liquidity (0x signed orders), it helps estimate the Ether cost of buying a certain asset (giving a range) and then buying that asset.
In its more advanced and useful form, it integrates with the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api) and takes care of sourcing liquidity for you given an SRA compliant endpoint. The final result is a library that tells you what assets are available, provides an Ether based quote for any asset desired, and allows you to buy that asset using Ether alone.
diff --git a/packages/asset-buyer/package.json b/packages/asset-buyer/package.json
index f6a331844..401aec120 100644
--- a/packages/asset-buyer/package.json
+++ b/packages/asset-buyer/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/asset-buyer",
- "version": "3.0.0",
+ "version": "3.0.4",
"engines": {
"node": ">=6.12"
},
@@ -36,21 +36,21 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md",
"dependencies": {
- "@0x/assert": "^1.0.17",
- "@0x/connect": "^3.0.6",
- "@0x/contract-wrappers": "^4.0.2",
- "@0x/json-schemas": "^2.1.1",
- "@0x/order-utils": "^3.0.2",
- "@0x/subproviders": "^2.1.4",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
- "ethereum-types": "^1.1.2",
+ "@0x/assert": "^1.0.20",
+ "@0x/connect": "^3.0.10",
+ "@0x/contract-wrappers": "^4.1.3",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "^4.14.116",
"@types/mocha": "^2.2.42",
"@types/node": "*",
diff --git a/packages/asset-buyer/src/order_providers/standard_relayer_api_order_provider.ts b/packages/asset-buyer/src/order_providers/standard_relayer_api_order_provider.ts
index be1fc55d6..813c9923b 100644
--- a/packages/asset-buyer/src/order_providers/standard_relayer_api_order_provider.ts
+++ b/packages/asset-buyer/src/order_providers/standard_relayer_api_order_provider.ts
@@ -100,6 +100,12 @@ export class StandardRelayerAPIOrderProvider implements OrderProvider {
} catch (err) {
throw new Error(AssetBuyerError.StandardRelayerApiError);
}
- return _.map(response.records, item => item.assetDataB.assetData);
+ return _.map(response.records, item => {
+ if (item.assetDataA.assetData === takerAssetData) {
+ return item.assetDataB.assetData;
+ } else {
+ return item.assetDataA.assetData;
+ }
+ });
}
}
diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json
index dc30ac076..a4cd17d42 100644
--- a/packages/base-contract/CHANGELOG.json
+++ b/packages/base-contract/CHANGELOG.json
@@ -1,5 +1,41 @@
[
{
+ "version": "3.0.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "3.0.9",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "3.0.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "3.0.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "3.0.6",
"changes": [
diff --git a/packages/base-contract/CHANGELOG.md b/packages/base-contract/CHANGELOG.md
index cf1b80b6d..a8ce346d7 100644
--- a/packages/base-contract/CHANGELOG.md
+++ b/packages/base-contract/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.10 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.0.9 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v3.0.8 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v3.0.7 - _November 21, 2018_
+
+ * Dependencies updated
+
## v3.0.6 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json
index b1cdc3cc6..87d70dd5f 100644
--- a/packages/base-contract/package.json
+++ b/packages/base-contract/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/base-contract",
- "version": "3.0.6",
+ "version": "3.0.10",
"engines": {
"node": ">=6.12"
},
@@ -29,7 +29,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/base-contract/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"chai": "^4.0.1",
"make-promises-safe": "^1.1.0",
@@ -40,10 +40,10 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
- "ethereum-types": "^1.1.2",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5"
},
diff --git a/packages/connect/CHANGELOG.json b/packages/connect/CHANGELOG.json
index 6960e1d97..e5bde40ae 100644
--- a/packages/connect/CHANGELOG.json
+++ b/packages/connect/CHANGELOG.json
@@ -1,5 +1,41 @@
[
{
+ "version": "3.0.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "3.0.9",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "3.0.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "3.0.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "3.0.6",
"changes": [
diff --git a/packages/connect/CHANGELOG.md b/packages/connect/CHANGELOG.md
index 13afad09b..a5f95b988 100644
--- a/packages/connect/CHANGELOG.md
+++ b/packages/connect/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.10 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.0.9 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v3.0.8 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v3.0.7 - _November 21, 2018_
+
+ * Dependencies updated
+
## v3.0.6 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 8e3f3ac8f..4985d0410 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/connect",
- "version": "3.0.6",
+ "version": "3.0.10",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
"dependencies": {
- "@0x/assert": "^1.0.17",
- "@0x/json-schemas": "^2.1.1",
- "@0x/order-utils": "^3.0.2",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
+ "@0x/assert": "^1.0.20",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
"lodash": "^4.17.5",
"query-string": "^5.0.1",
"sinon": "^4.0.0",
@@ -57,7 +57,7 @@
"websocket": "^1.0.25"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/fetch-mock": "^6.0.3",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
diff --git a/packages/contract-addresses/CHANGELOG.json b/packages/contract-addresses/CHANGELOG.json
index 86c6a5c31..ca79290da 100644
--- a/packages/contract-addresses/CHANGELOG.json
+++ b/packages/contract-addresses/CHANGELOG.json
@@ -1,11 +1,35 @@
[
{
+ "version": "2.1.0",
+ "changes": [
+ {
+ "note": "Added testnet entries for Dutch Auction contract (kovan,rinkeby,ropsten)",
+ "pr": 1465
+ }
+ ]
+ },
+ {
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Redeployed Rinkeby with testnet Exchange artifact",
+ "pr": 1318
+ },
+ {
+ "note": "Added Ganache snapshot addresses for network 50",
+ "pr": 1318
+ }
+ ],
+ "timestamp": 1543401373
+ },
+ {
"version": "1.2.0",
"changes": [
{
"note": "Rinkeby Deployment"
}
- ]
+ ],
+ "timestamp": 1542821676
},
{
"version": "1.1.0",
diff --git a/packages/contract-addresses/CHANGELOG.md b/packages/contract-addresses/CHANGELOG.md
index 20e52cd8b..c006c3b22 100644
--- a/packages/contract-addresses/CHANGELOG.md
+++ b/packages/contract-addresses/CHANGELOG.md
@@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.0 - _November 28, 2018_
+
+ * Redeployed Rinkeby with testnet Exchange artifact (#1318)
+ * Added Ganache snapshot addresses for network 50 (#1318)
+
+## v1.2.0 - _November 21, 2018_
+
+ * Rinkeby Deployment
+
## v1.1.0 - _November 9, 2018_
* Update Forwarder addresses (#1192)
diff --git a/packages/contract-addresses/package.json b/packages/contract-addresses/package.json
index 47258edef..c75ae6efa 100644
--- a/packages/contract-addresses/package.json
+++ b/packages/contract-addresses/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/contract-addresses",
- "version": "1.1.0",
+ "version": "2.0.0",
"engines": {
"node": ">=6.12"
},
diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts
index 57358dd38..d181a1bec 100644
--- a/packages/contract-addresses/src/index.ts
+++ b/packages/contract-addresses/src/index.ts
@@ -9,6 +9,7 @@ export interface ContractAddresses {
assetProxyOwner: string;
forwarder: string;
orderValidator: string;
+ dutchAuction: string;
}
export enum NetworkId {
@@ -16,8 +17,11 @@ export enum NetworkId {
Ropsten = 3,
Rinkeby = 4,
Kovan = 42,
+ Ganache = 50,
}
+const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
+
const networkToAddresses: { [networkId: number]: ContractAddresses } = {
1: {
erc20Proxy: '0x2240dab907db71e64d3e0dba4800c83b5c502d4e',
@@ -28,6 +32,8 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0x17992e4ffb22730138e4b62aaa6367fa9d3699a6',
forwarder: '0x5468a1dc173652ee28d249c271fa9933144746b1',
orderValidator: '0x9463e518dea6810309563c81d5266c1b1d149138',
+ // @todo hysz/dekz: Add mainnet address once deployed.
+ dutchAuction: NULL_ADDRESS,
},
3: {
erc20Proxy: '0xb1408f4c245a23c31b98d2c626777d4c0d766caa',
@@ -38,16 +44,18 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b',
forwarder: '0x2240dab907db71e64d3e0dba4800c83b5c502d4e',
orderValidator: '0x90431a90516ab49af23a0530e04e8c7836e7122f',
+ dutchAuction: '0x2df6b59309f35ada230ec7d61d7d97355017a1df',
},
4: {
- erc20Proxy: '0x3e809c563c15a295e832e37053798ddc8d6c8dab',
- erc721Proxy: '0x8e1ff02637cb5e39f2fa36c14706aa348b065b09',
- zrxToken: '0x2727e688b8fd40b198cd5fe6e408e00494a06f07',
+ exchange: '0xbce0b5f6eb618c565c3e5f5cd69652bbc279f44e',
+ erc20Proxy: '0x2f5ae4f6106e89b4147651688a92256885c5f410',
+ erc721Proxy: '0x7656d773e11ff7383a14dcf09a9c50990481cd10',
+ zrxToken: '0x8080c7e4b81ecf23aa6f877cfbfd9b0c228c6ffa',
etherToken: '0xc778417e063141139fce010982780140aa0cd5ab',
- exchange: '0x22ebc052f43a88efa06379426120718170f2204e',
- assetProxyOwner: '0x1da52d1d3a3acfa0a1836b737393b4e9931268fc',
- forwarder: '0xd2dbf3250a764eaaa94fa0c84ed87c0edc8ed04e',
- orderValidator: '0x39c3fc9f4d8430af2713306ce80c584752d9e1c7',
+ assetProxyOwner: '0xe1703da878afcebff5b7624a826902af475b9c03',
+ forwarder: '0x2d40589abbdee84961f3a7656b9af7adb0ee5ab4',
+ orderValidator: '0x0c5173a51e26b29d6126c686756fb9fbef71f762',
+ dutchAuction: '0xdd7bd6437e67c422879364740ab5855fe3dc41f7',
},
42: {
erc20Proxy: '0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e',
@@ -58,6 +66,19 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0x2c824d2882baa668e0d5202b1e7f2922278703f8',
forwarder: '0x17992e4ffb22730138e4b62aaa6367fa9d3699a6',
orderValidator: '0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d',
+ dutchAuction: '0xe11667fb51f34c5367f40d7e379327ce32ee7150',
+ },
+ // NetworkId 50 represents our Ganache snapshot generated from migrations.
+ 50: {
+ exchange: '0x48bacb9266a570d521063ef5dd96e61686dbe788',
+ erc20Proxy: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48',
+ erc721Proxy: '0x1d7022f5b17d2f8b695918fb48fa1089c9f85401',
+ zrxToken: '0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c',
+ etherToken: '0x0b1ba0af832d7c05fd64161e0db78e85978e8082',
+ assetProxyOwner: '0x34d402f14d58e001d8efbe6585051bf9706aa064',
+ forwarder: '0xb69e673309512a9d726f87304c6984054f87a93b',
+ orderValidator: '0xe86bb98fcf9bff3512c74589b78fb168200cc546',
+ dutchAuction: '0xdc688d29394a3f1e6f1e5100862776691afaf3d2',
},
};
diff --git a/packages/contract-artifacts/CHANGELOG.json b/packages/contract-artifacts/CHANGELOG.json
index 8833255ed..b033943d2 100644
--- a/packages/contract-artifacts/CHANGELOG.json
+++ b/packages/contract-artifacts/CHANGELOG.json
@@ -1,5 +1,24 @@
[
{
+ "version": "1.2.0",
+ "changes": [
+ {
+ "pr": 1465,
+ "note": "Added artifact for Dutch Auction contract"
+ }
+ ]
+ },
+ {
+ "version": "1.1.2",
+ "changes": [
+ {
+ "pr": 1309,
+ "note": "Update Exchange artifact to receive ZRX asset data as a constructor argument"
+ }
+ ],
+ "timestamp": 1543401373
+ },
+ {
"version": "1.1.0",
"changes": [
{
diff --git a/packages/contract-artifacts/CHANGELOG.md b/packages/contract-artifacts/CHANGELOG.md
index b3c399985..9e48058f5 100644
--- a/packages/contract-artifacts/CHANGELOG.md
+++ b/packages/contract-artifacts/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.1.2 - _November 28, 2018_
+
+ * Update Exchange artifact to receive ZRX asset data as a constructor argument (#1309)
+
## v1.1.0 - _November 9, 2018_
* Update Forwarder artifact (#1192)
diff --git a/packages/contract-artifacts/artifacts/DutchAuction.json b/packages/contract-artifacts/artifacts/DutchAuction.json
new file mode 100644
index 000000000..3c1cb8c4c
--- /dev/null
+++ b/packages/contract-artifacts/artifacts/DutchAuction.json
@@ -0,0 +1,310 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "DutchAuction",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ }
+ ],
+ "name": "getAuctionDetails",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "beginTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "endTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "beginAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "endAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "currentAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "currentTimeSeconds",
+ "type": "uint256"
+ }
+ ],
+ "name": "auctionDetails",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "buyOrder",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "sellOrder",
+ "type": "tuple"
+ },
+ {
+ "name": "buySignature",
+ "type": "bytes"
+ },
+ {
+ "name": "sellSignature",
+ "type": "bytes"
+ }
+ ],
+ "name": "matchOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "left",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "right",
+ "type": "tuple"
+ },
+ {
+ "name": "leftMakerAssetSpreadAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "matchedFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_exchange",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b50604051602080611352833981018060405261002f9190810190610067565b60008054600160a060020a031916600160a060020a0392909216919091179055610099565b6000610060825161008d565b9392505050565b60006020828403121561007957600080fd5b60006100858484610054565b949350505050565b600160a060020a031690565b6112aa806100a86000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632e9cd03381146100505780633c28d86114610086575b600080fd5b34801561005c57600080fd5b5061007061006b366004610b25565b6100b3565b60405161007d919061110a565b60405180910390f35b34801561009257600080fd5b506100a66100a1366004610b5a565b61029c565b60405161007d9190611118565b6100bb6107b1565b610140820151516000808080808080606488101561010e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110aa565b60405180910390fd5b6101408a0151610146907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08a0163ffffffff6105f216565b6101408b0151909750610181907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08a0163ffffffff6105f216565b9550868a61010001511115156101c3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110ba565b868a61010001510394508960a001519350838611151561020f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110fa565b50505083865261010087018051602088015260408701849052606087018290524260a088018190529051828503919081900386821015610255576080890186905261028f565b6101008a0151821061026d576080890184905261028f565b6102898461028461027e8487610607565b8861066d565b610684565b60808a01525b5050505050505050919050565b6102a46107e8565b6102ac6107b1565b6000606060008060006102be8a6100b3565b805160a08201519197501115610300576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110ea565b60a08601516101008b015111610342576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110ca565b608080870151908c01511015610384576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110fa565b6000546040517f3c28d86100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690633c28d861906103e0908e908e908e908e90600401611127565b61012060405180830381600087803b1580156103fb57600080fd5b505af115801561040f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104339190810190610b06565b96508660400151945060008511156105e4576101608a0151935061045e84601063ffffffff6106c316565b92506104728b608001518760800151610724565b915061047e8583610724565b905060008111156105325789516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169163a9059cbb916104de9190859060040161105f565b602060405180830381600087803b1580156104f857600080fd5b505af115801561050c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105309190810190610ae0565b505b60008211156105e4578a516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169163a9059cbb916105909190869060040161105f565b602060405180830381600087803b1580156105aa57600080fd5b505af11580156105be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105e29190810190610ae0565b505b505050505050949350505050565b60006105fe8383610766565b90505b92915050565b60008083151561061a5760009150610666565b5082820282848281151561062a57fe5b0414610662576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101059061109a565b8091505b5092915050565b600080828481151561067b57fe5b04949350505050565b600082820183811015610662576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101059061109a565b600081601401835110151515610705576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110da565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b600082821115610760576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101059061107a565b50900390565b6000816020018351101515156107a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101059061108a565b50016020015190565b60c0604051908101604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b610120604051908101604052806107fd610817565b815260200161080a610817565b8152602001600081525090565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b600061084c82356111ef565b9392505050565b600061084c825161120b565b6000601f8201831361087057600080fd5b813561088361087e826111a5565b61117e565b9150808252602083016020830185838301111561089f57600080fd5b6108aa838284611210565b50505092915050565b6000608082840312156108c557600080fd5b6108cf608061117e565b905060006108dd8484610ad4565b82525060206108ee84848301610ad4565b602083015250604061090284828501610ad4565b604083015250606061091684828501610ad4565b60608301525092915050565b6000610120828403121561093557600080fd5b61093f606061117e565b9050600061094d84846108b3565b825250608061095e848483016108b3565b60208301525061010061097384828501610ad4565b60408301525092915050565b6000610180828403121561099257600080fd5b61099d61018061117e565b905060006109ab8484610840565b82525060206109bc84848301610840565b60208301525060406109d084828501610840565b60408301525060606109e484828501610840565b60608301525060806109f884828501610ac8565b60808301525060a0610a0c84828501610ac8565b60a08301525060c0610a2084828501610ac8565b60c08301525060e0610a3484828501610ac8565b60e083015250610100610a4984828501610ac8565b61010083015250610120610a5f84828501610ac8565b6101208301525061014082013567ffffffffffffffff811115610a8157600080fd5b610a8d8482850161085f565b6101408301525061016082013567ffffffffffffffff811115610aaf57600080fd5b610abb8482850161085f565b6101608301525092915050565b600061084c8235611208565b600061084c8251611208565b600060208284031215610af257600080fd5b6000610afe8484610853565b949350505050565b60006101208284031215610b1957600080fd5b6000610afe8484610922565b600060208284031215610b3757600080fd5b813567ffffffffffffffff811115610b4e57600080fd5b610afe8482850161097f565b60008060008060808587031215610b7057600080fd5b843567ffffffffffffffff811115610b8757600080fd5b610b938782880161097f565b945050602085013567ffffffffffffffff811115610bb057600080fd5b610bbc8782880161097f565b935050604085013567ffffffffffffffff811115610bd957600080fd5b610be58782880161085f565b925050606085013567ffffffffffffffff811115610c0257600080fd5b610c0e8782880161085f565b91505092959194509250565b610c23816111ef565b82525050565b6000610c34826111eb565b808452610c4881602086016020860161121c565b610c5181611248565b9093016020019392505050565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b601281527f494e56414c49445f41535345545f444154410000000000000000000000000000602082015260400190565b601281527f494e56414c49445f424547494e5f54494d450000000000000000000000000000602082015260400190565b600f81527f41554354494f4e5f455850495245440000000000000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601381527f41554354494f4e5f4e4f545f5354415254454400000000000000000000000000602082015260400190565b600e81527f494e56414c49445f414d4f554e54000000000000000000000000000000000000602082015260400190565b805160c0830190610e6b8482611056565b506020820151610e7e6020850182611056565b506040820151610e916040850182611056565b506060820151610ea46060850182611056565b506080820151610eb76080850182611056565b5060a0820151610eca60a0850182611056565b50505050565b80516080830190610ee18482611056565b506020820151610ef46020850182611056565b506040820151610f076040850182611056565b506060820151610eca6060850182611056565b8051610120830190610f2c8482610ed0565b506020820151610f3f6080850182610ed0565b506040820151610eca610100850182611056565b8051600090610180840190610f688582610c1a565b506020830151610f7b6020860182610c1a565b506040830151610f8e6040860182610c1a565b506060830151610fa16060860182610c1a565b506080830151610fb46080860182611056565b5060a0830151610fc760a0860182611056565b5060c0830151610fda60c0860182611056565b5060e0830151610fed60e0860182611056565b50610100830151611002610100860182611056565b50610120830151611017610120860182611056565b506101408301518482036101408601526110318282610c29565b91505061016083015184820361016086015261104d8282610c29565b95945050505050565b610c2381611208565b6040810161106d8285610c1a565b61084c6020830184611056565b6020808252810161060181610c5e565b6020808252810161060181610c8e565b6020808252810161060181610ce4565b6020808252810161060181610d14565b6020808252810161060181610d44565b6020808252810161060181610d74565b6020808252810161060181610da4565b6020808252810161060181610dfa565b6020808252810161060181610e2a565b60c081016106018284610e5a565b61012081016106018284610f1a565b608080825281016111388187610f53565b9050818103602083015261114c8186610f53565b905081810360408301526111608185610c29565b905081810360608301526111748184610c29565b9695505050505050565b60405181810167ffffffffffffffff8111828210171561119d57600080fd5b604052919050565b600067ffffffffffffffff8211156111bc57600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b151590565b82818337506000910152565b60005b8381101561123757818101518382015260200161121f565b83811115610eca5750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a723058209cf70b04b75fc23e6762ae4c6c8f25ccad25dfcb39cf1dd3966eb27ce513de036c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP1 PUSH2 0x1352 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH2 0x2F SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x67 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH2 0x99 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x60 DUP3 MLOAD PUSH2 0x8D JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x79 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x85 DUP5 DUP5 PUSH2 0x54 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH2 0x12AA DUP1 PUSH2 0xA8 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4B JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x2E9CD033 DUP2 EQ PUSH2 0x50 JUMPI DUP1 PUSH4 0x3C28D861 EQ PUSH2 0x86 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x6B CALLDATASIZE PUSH1 0x4 PUSH2 0xB25 JUMP JUMPDEST PUSH2 0xB3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x7D SWAP2 SWAP1 PUSH2 0x110A JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x92 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xA6 PUSH2 0xA1 CALLDATASIZE PUSH1 0x4 PUSH2 0xB5A JUMP JUMPDEST PUSH2 0x29C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x7D SWAP2 SWAP1 PUSH2 0x1118 JUMP JUMPDEST PUSH2 0xBB PUSH2 0x7B1 JUMP JUMPDEST PUSH2 0x140 DUP3 ADD MLOAD MLOAD PUSH1 0x0 DUP1 DUP1 DUP1 DUP1 DUP1 DUP1 PUSH1 0x64 DUP9 LT ISZERO PUSH2 0x10E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10AA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x140 DUP11 ADD MLOAD PUSH2 0x146 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0 DUP11 ADD PUSH4 0xFFFFFFFF PUSH2 0x5F2 AND JUMP JUMPDEST PUSH2 0x140 DUP12 ADD MLOAD SWAP1 SWAP8 POP PUSH2 0x181 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP11 ADD PUSH4 0xFFFFFFFF PUSH2 0x5F2 AND JUMP JUMPDEST SWAP6 POP DUP7 DUP11 PUSH2 0x100 ADD MLOAD GT ISZERO ISZERO PUSH2 0x1C3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10BA JUMP JUMPDEST DUP7 DUP11 PUSH2 0x100 ADD MLOAD SUB SWAP5 POP DUP10 PUSH1 0xA0 ADD MLOAD SWAP4 POP DUP4 DUP7 GT ISZERO ISZERO PUSH2 0x20F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10FA JUMP JUMPDEST POP POP POP DUP4 DUP7 MSTORE PUSH2 0x100 DUP8 ADD DUP1 MLOAD PUSH1 0x20 DUP9 ADD MSTORE PUSH1 0x40 DUP8 ADD DUP5 SWAP1 MSTORE PUSH1 0x60 DUP8 ADD DUP3 SWAP1 MSTORE TIMESTAMP PUSH1 0xA0 DUP9 ADD DUP2 SWAP1 MSTORE SWAP1 MLOAD DUP3 DUP6 SUB SWAP2 SWAP1 DUP2 SWAP1 SUB DUP7 DUP3 LT ISZERO PUSH2 0x255 JUMPI PUSH1 0x80 DUP10 ADD DUP7 SWAP1 MSTORE PUSH2 0x28F JUMP JUMPDEST PUSH2 0x100 DUP11 ADD MLOAD DUP3 LT PUSH2 0x26D JUMPI PUSH1 0x80 DUP10 ADD DUP5 SWAP1 MSTORE PUSH2 0x28F JUMP JUMPDEST PUSH2 0x289 DUP5 PUSH2 0x284 PUSH2 0x27E DUP5 DUP8 PUSH2 0x607 JUMP JUMPDEST DUP9 PUSH2 0x66D JUMP JUMPDEST PUSH2 0x684 JUMP JUMPDEST PUSH1 0x80 DUP11 ADD MSTORE JUMPDEST POP POP POP POP POP POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x2A4 PUSH2 0x7E8 JUMP JUMPDEST PUSH2 0x2AC PUSH2 0x7B1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x2BE DUP11 PUSH2 0xB3 JUMP JUMPDEST DUP1 MLOAD PUSH1 0xA0 DUP3 ADD MLOAD SWAP2 SWAP8 POP GT ISZERO PUSH2 0x300 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10EA JUMP JUMPDEST PUSH1 0xA0 DUP7 ADD MLOAD PUSH2 0x100 DUP12 ADD MLOAD GT PUSH2 0x342 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10CA JUMP JUMPDEST PUSH1 0x80 DUP1 DUP8 ADD MLOAD SWAP1 DUP13 ADD MLOAD LT ISZERO PUSH2 0x384 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10FA JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0x3C28D86100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0x3C28D861 SWAP1 PUSH2 0x3E0 SWAP1 DUP15 SWAP1 DUP15 SWAP1 DUP15 SWAP1 DUP15 SWAP1 PUSH1 0x4 ADD PUSH2 0x1127 JUMP JUMPDEST PUSH2 0x120 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x3FB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x40F JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x433 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xB06 JUMP JUMPDEST SWAP7 POP DUP7 PUSH1 0x40 ADD MLOAD SWAP5 POP PUSH1 0x0 DUP6 GT ISZERO PUSH2 0x5E4 JUMPI PUSH2 0x160 DUP11 ADD MLOAD SWAP4 POP PUSH2 0x45E DUP5 PUSH1 0x10 PUSH4 0xFFFFFFFF PUSH2 0x6C3 AND JUMP JUMPDEST SWAP3 POP PUSH2 0x472 DUP12 PUSH1 0x80 ADD MLOAD DUP8 PUSH1 0x80 ADD MLOAD PUSH2 0x724 JUMP JUMPDEST SWAP2 POP PUSH2 0x47E DUP6 DUP4 PUSH2 0x724 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 DUP2 GT ISZERO PUSH2 0x532 JUMPI DUP10 MLOAD PUSH1 0x40 MLOAD PUSH32 0xA9059CBB00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP2 PUSH4 0xA9059CBB SWAP2 PUSH2 0x4DE SWAP2 SWAP1 DUP6 SWAP1 PUSH1 0x4 ADD PUSH2 0x105F JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x4F8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x50C JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x530 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xAE0 JUMP JUMPDEST POP JUMPDEST PUSH1 0x0 DUP3 GT ISZERO PUSH2 0x5E4 JUMPI DUP11 MLOAD PUSH1 0x40 MLOAD PUSH32 0xA9059CBB00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP2 PUSH4 0xA9059CBB SWAP2 PUSH2 0x590 SWAP2 SWAP1 DUP7 SWAP1 PUSH1 0x4 ADD PUSH2 0x105F JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x5AA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x5BE JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x5E2 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xAE0 JUMP JUMPDEST POP JUMPDEST POP POP POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x5FE DUP4 DUP4 PUSH2 0x766 JUMP JUMPDEST SWAP1 POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 ISZERO ISZERO PUSH2 0x61A JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x666 JUMP JUMPDEST POP DUP3 DUP3 MUL DUP3 DUP5 DUP3 DUP2 ISZERO ISZERO PUSH2 0x62A JUMPI INVALID JUMPDEST DIV EQ PUSH2 0x662 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x109A JUMP JUMPDEST DUP1 SWAP2 POP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 DUP5 DUP2 ISZERO ISZERO PUSH2 0x67B JUMPI INVALID JUMPDEST DIV SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x662 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x109A JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x705 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10DA JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0x760 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x107A JUMP JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x7A8 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x108A JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0xC0 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH2 0x120 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH2 0x7FD PUSH2 0x817 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x80A PUSH2 0x817 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x80 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x84C DUP3 CALLDATALOAD PUSH2 0x11EF JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x84C DUP3 MLOAD PUSH2 0x120B JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x870 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x883 PUSH2 0x87E DUP3 PUSH2 0x11A5 JUMP JUMPDEST PUSH2 0x117E JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x89F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x8AA DUP4 DUP3 DUP5 PUSH2 0x1210 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x8C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x8CF PUSH1 0x80 PUSH2 0x117E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x8DD DUP5 DUP5 PUSH2 0xAD4 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x8EE DUP5 DUP5 DUP4 ADD PUSH2 0xAD4 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x902 DUP5 DUP3 DUP6 ADD PUSH2 0xAD4 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x916 DUP5 DUP3 DUP6 ADD PUSH2 0xAD4 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x120 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x935 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x93F PUSH1 0x60 PUSH2 0x117E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x94D DUP5 DUP5 PUSH2 0x8B3 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x80 PUSH2 0x95E DUP5 DUP5 DUP4 ADD PUSH2 0x8B3 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x973 DUP5 DUP3 DUP6 ADD PUSH2 0xAD4 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x992 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x99D PUSH2 0x180 PUSH2 0x117E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x9AB DUP5 DUP5 PUSH2 0x840 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x9BC DUP5 DUP5 DUP4 ADD PUSH2 0x840 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x9D0 DUP5 DUP3 DUP6 ADD PUSH2 0x840 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x9E4 DUP5 DUP3 DUP6 ADD PUSH2 0x840 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x9F8 DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0xA0C DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0xA20 DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0xA34 DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0xA49 DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0xA5F DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xA81 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xA8D DUP5 DUP3 DUP6 ADD PUSH2 0x85F JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xAAF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xABB DUP5 DUP3 DUP6 ADD PUSH2 0x85F JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x84C DUP3 CALLDATALOAD PUSH2 0x1208 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x84C DUP3 MLOAD PUSH2 0x1208 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xAF2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xAFE DUP5 DUP5 PUSH2 0x853 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x120 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xB19 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xAFE DUP5 DUP5 PUSH2 0x922 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xB37 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xB4E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xAFE DUP5 DUP3 DUP6 ADD PUSH2 0x97F JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0xB70 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xB87 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xB93 DUP8 DUP3 DUP9 ADD PUSH2 0x97F JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xBB0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xBBC DUP8 DUP3 DUP9 ADD PUSH2 0x97F JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xBD9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xBE5 DUP8 DUP3 DUP9 ADD PUSH2 0x85F JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xC02 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xC0E DUP8 DUP3 DUP9 ADD PUSH2 0x85F JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH2 0xC23 DUP2 PUSH2 0x11EF JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC34 DUP3 PUSH2 0x11EB JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0xC48 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x121C JUMP JUMPDEST PUSH2 0xC51 DUP2 PUSH2 0x1248 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x494E56414C49445F41535345545F444154410000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x494E56414C49445F424547494E5F54494D450000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xF DUP2 MSTORE PUSH32 0x41554354494F4E5F455850495245440000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x13 DUP2 MSTORE PUSH32 0x41554354494F4E5F4E4F545F5354415254454400000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x494E56414C49445F414D4F554E54000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0xC0 DUP4 ADD SWAP1 PUSH2 0xE6B DUP5 DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0xE7E PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0xE91 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0xEA4 PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x80 DUP3 ADD MLOAD PUSH2 0xEB7 PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0xA0 DUP3 ADD MLOAD PUSH2 0xECA PUSH1 0xA0 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x80 DUP4 ADD SWAP1 PUSH2 0xEE1 DUP5 DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0xEF4 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0xF07 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0xECA PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST DUP1 MLOAD PUSH2 0x120 DUP4 ADD SWAP1 PUSH2 0xF2C DUP5 DUP3 PUSH2 0xED0 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0xF3F PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0xED0 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0xECA PUSH2 0x100 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0xF68 DUP6 DUP3 PUSH2 0xC1A JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0xF7B PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0xC1A JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0xF8E PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0xC1A JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0xFA1 PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0xC1A JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0xFB4 PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0xFC7 PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0xFDA PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0xFED PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0x1002 PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0x1017 PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0x1031 DUP3 DUP3 PUSH2 0xC29 JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0x104D DUP3 DUP3 PUSH2 0xC29 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0xC23 DUP2 PUSH2 0x1208 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x106D DUP3 DUP6 PUSH2 0xC1A JUMP JUMPDEST PUSH2 0x84C PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x1056 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xC5E JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xC8E JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xCE4 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xD14 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xD44 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xD74 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xDA4 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xDFA JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xE2A JUMP JUMPDEST PUSH1 0xC0 DUP2 ADD PUSH2 0x601 DUP3 DUP5 PUSH2 0xE5A JUMP JUMPDEST PUSH2 0x120 DUP2 ADD PUSH2 0x601 DUP3 DUP5 PUSH2 0xF1A JUMP JUMPDEST PUSH1 0x80 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1138 DUP2 DUP8 PUSH2 0xF53 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x114C DUP2 DUP7 PUSH2 0xF53 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1160 DUP2 DUP6 PUSH2 0xC29 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0x1174 DUP2 DUP5 PUSH2 0xC29 JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x119D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x11BC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1237 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x121F JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0xECA JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 SWAP13 0xf7 SIGNEXTEND DIV 0xb7 0x5f 0xc2 RETURNDATACOPY PUSH8 0x62AE4C6C8F25CCAD 0x25 0xdf 0xcb CODECOPY 0xcf SAR 0xd3 SWAP7 PUSH15 0xB27CE513DE036C6578706572696D65 PUSH15 0x74616CF50037000000000000000000 ",
+ "sourceMap": "986:9378:28:-;;;1673:99;8:9:-1;5:2;;;30:1;27;20:12;5:2;1673:99:28;;;;;;;;;;;;;;;;;;;;;;1734:8;:31;;-1:-1:-1;;;;;;1734:31:28;-1:-1:-1;;;;;1734:31:28;;;;;;;;;;986:9378;;5:122:-1;;83:39;114:6;108:13;83:39;;;74:48;68:59;-1:-1;;;68:59;134:263;;249:2;237:9;228:7;224:23;220:32;217:2;;;265:1;262;255:12;217:2;300:1;317:64;373:7;353:9;317:64;;;307:74;211:186;-1:-1;;;;211:186;404:128;-1:-1;;;;;473:54;;456:76;;986:9378:28;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416632e9cd03381146100505780633c28d86114610086575b600080fd5b34801561005c57600080fd5b5061007061006b366004610b25565b6100b3565b60405161007d919061110a565b60405180910390f35b34801561009257600080fd5b506100a66100a1366004610b5a565b61029c565b60405161007d9190611118565b6100bb6107b1565b610140820151516000808080808080606488101561010e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110aa565b60405180910390fd5b6101408a0151610146907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08a0163ffffffff6105f216565b6101408b0151909750610181907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08a0163ffffffff6105f216565b9550868a61010001511115156101c3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110ba565b868a61010001510394508960a001519350838611151561020f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110fa565b50505083865261010087018051602088015260408701849052606087018290524260a088018190529051828503919081900386821015610255576080890186905261028f565b6101008a0151821061026d576080890184905261028f565b6102898461028461027e8487610607565b8861066d565b610684565b60808a01525b5050505050505050919050565b6102a46107e8565b6102ac6107b1565b6000606060008060006102be8a6100b3565b805160a08201519197501115610300576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110ea565b60a08601516101008b015111610342576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110ca565b608080870151908c01511015610384576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110fa565b6000546040517f3c28d86100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690633c28d861906103e0908e908e908e908e90600401611127565b61012060405180830381600087803b1580156103fb57600080fd5b505af115801561040f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104339190810190610b06565b96508660400151945060008511156105e4576101608a0151935061045e84601063ffffffff6106c316565b92506104728b608001518760800151610724565b915061047e8583610724565b905060008111156105325789516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169163a9059cbb916104de9190859060040161105f565b602060405180830381600087803b1580156104f857600080fd5b505af115801561050c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105309190810190610ae0565b505b60008211156105e4578a516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169163a9059cbb916105909190869060040161105f565b602060405180830381600087803b1580156105aa57600080fd5b505af11580156105be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105e29190810190610ae0565b505b505050505050949350505050565b60006105fe8383610766565b90505b92915050565b60008083151561061a5760009150610666565b5082820282848281151561062a57fe5b0414610662576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101059061109a565b8091505b5092915050565b600080828481151561067b57fe5b04949350505050565b600082820183811015610662576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101059061109a565b600081601401835110151515610705576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610105906110da565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b600082821115610760576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101059061107a565b50900390565b6000816020018351101515156107a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101059061108a565b50016020015190565b60c0604051908101604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b610120604051908101604052806107fd610817565b815260200161080a610817565b8152602001600081525090565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b600061084c82356111ef565b9392505050565b600061084c825161120b565b6000601f8201831361087057600080fd5b813561088361087e826111a5565b61117e565b9150808252602083016020830185838301111561089f57600080fd5b6108aa838284611210565b50505092915050565b6000608082840312156108c557600080fd5b6108cf608061117e565b905060006108dd8484610ad4565b82525060206108ee84848301610ad4565b602083015250604061090284828501610ad4565b604083015250606061091684828501610ad4565b60608301525092915050565b6000610120828403121561093557600080fd5b61093f606061117e565b9050600061094d84846108b3565b825250608061095e848483016108b3565b60208301525061010061097384828501610ad4565b60408301525092915050565b6000610180828403121561099257600080fd5b61099d61018061117e565b905060006109ab8484610840565b82525060206109bc84848301610840565b60208301525060406109d084828501610840565b60408301525060606109e484828501610840565b60608301525060806109f884828501610ac8565b60808301525060a0610a0c84828501610ac8565b60a08301525060c0610a2084828501610ac8565b60c08301525060e0610a3484828501610ac8565b60e083015250610100610a4984828501610ac8565b61010083015250610120610a5f84828501610ac8565b6101208301525061014082013567ffffffffffffffff811115610a8157600080fd5b610a8d8482850161085f565b6101408301525061016082013567ffffffffffffffff811115610aaf57600080fd5b610abb8482850161085f565b6101608301525092915050565b600061084c8235611208565b600061084c8251611208565b600060208284031215610af257600080fd5b6000610afe8484610853565b949350505050565b60006101208284031215610b1957600080fd5b6000610afe8484610922565b600060208284031215610b3757600080fd5b813567ffffffffffffffff811115610b4e57600080fd5b610afe8482850161097f565b60008060008060808587031215610b7057600080fd5b843567ffffffffffffffff811115610b8757600080fd5b610b938782880161097f565b945050602085013567ffffffffffffffff811115610bb057600080fd5b610bbc8782880161097f565b935050604085013567ffffffffffffffff811115610bd957600080fd5b610be58782880161085f565b925050606085013567ffffffffffffffff811115610c0257600080fd5b610c0e8782880161085f565b91505092959194509250565b610c23816111ef565b82525050565b6000610c34826111eb565b808452610c4881602086016020860161121c565b610c5181611248565b9093016020019392505050565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b601281527f494e56414c49445f41535345545f444154410000000000000000000000000000602082015260400190565b601281527f494e56414c49445f424547494e5f54494d450000000000000000000000000000602082015260400190565b600f81527f41554354494f4e5f455850495245440000000000000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601381527f41554354494f4e5f4e4f545f5354415254454400000000000000000000000000602082015260400190565b600e81527f494e56414c49445f414d4f554e54000000000000000000000000000000000000602082015260400190565b805160c0830190610e6b8482611056565b506020820151610e7e6020850182611056565b506040820151610e916040850182611056565b506060820151610ea46060850182611056565b506080820151610eb76080850182611056565b5060a0820151610eca60a0850182611056565b50505050565b80516080830190610ee18482611056565b506020820151610ef46020850182611056565b506040820151610f076040850182611056565b506060820151610eca6060850182611056565b8051610120830190610f2c8482610ed0565b506020820151610f3f6080850182610ed0565b506040820151610eca610100850182611056565b8051600090610180840190610f688582610c1a565b506020830151610f7b6020860182610c1a565b506040830151610f8e6040860182610c1a565b506060830151610fa16060860182610c1a565b506080830151610fb46080860182611056565b5060a0830151610fc760a0860182611056565b5060c0830151610fda60c0860182611056565b5060e0830151610fed60e0860182611056565b50610100830151611002610100860182611056565b50610120830151611017610120860182611056565b506101408301518482036101408601526110318282610c29565b91505061016083015184820361016086015261104d8282610c29565b95945050505050565b610c2381611208565b6040810161106d8285610c1a565b61084c6020830184611056565b6020808252810161060181610c5e565b6020808252810161060181610c8e565b6020808252810161060181610ce4565b6020808252810161060181610d14565b6020808252810161060181610d44565b6020808252810161060181610d74565b6020808252810161060181610da4565b6020808252810161060181610dfa565b6020808252810161060181610e2a565b60c081016106018284610e5a565b61012081016106018284610f1a565b608080825281016111388187610f53565b9050818103602083015261114c8186610f53565b905081810360408301526111608185610c29565b905081810360608301526111748184610c29565b9695505050505050565b60405181810167ffffffffffffffff8111828210171561119d57600080fd5b604052919050565b600067ffffffffffffffff8211156111bc57600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b151590565b82818337506000910152565b60005b8381101561123757818101518382015260200161121f565b83811115610eca5750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a723058209cf70b04b75fc23e6762ae4c6c8f25ccad25dfcb39cf1dd3966eb27ce513de036c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4B JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x2E9CD033 DUP2 EQ PUSH2 0x50 JUMPI DUP1 PUSH4 0x3C28D861 EQ PUSH2 0x86 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x6B CALLDATASIZE PUSH1 0x4 PUSH2 0xB25 JUMP JUMPDEST PUSH2 0xB3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x7D SWAP2 SWAP1 PUSH2 0x110A JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x92 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xA6 PUSH2 0xA1 CALLDATASIZE PUSH1 0x4 PUSH2 0xB5A JUMP JUMPDEST PUSH2 0x29C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x7D SWAP2 SWAP1 PUSH2 0x1118 JUMP JUMPDEST PUSH2 0xBB PUSH2 0x7B1 JUMP JUMPDEST PUSH2 0x140 DUP3 ADD MLOAD MLOAD PUSH1 0x0 DUP1 DUP1 DUP1 DUP1 DUP1 DUP1 PUSH1 0x64 DUP9 LT ISZERO PUSH2 0x10E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10AA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH2 0x140 DUP11 ADD MLOAD PUSH2 0x146 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0 DUP11 ADD PUSH4 0xFFFFFFFF PUSH2 0x5F2 AND JUMP JUMPDEST PUSH2 0x140 DUP12 ADD MLOAD SWAP1 SWAP8 POP PUSH2 0x181 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP11 ADD PUSH4 0xFFFFFFFF PUSH2 0x5F2 AND JUMP JUMPDEST SWAP6 POP DUP7 DUP11 PUSH2 0x100 ADD MLOAD GT ISZERO ISZERO PUSH2 0x1C3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10BA JUMP JUMPDEST DUP7 DUP11 PUSH2 0x100 ADD MLOAD SUB SWAP5 POP DUP10 PUSH1 0xA0 ADD MLOAD SWAP4 POP DUP4 DUP7 GT ISZERO ISZERO PUSH2 0x20F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10FA JUMP JUMPDEST POP POP POP DUP4 DUP7 MSTORE PUSH2 0x100 DUP8 ADD DUP1 MLOAD PUSH1 0x20 DUP9 ADD MSTORE PUSH1 0x40 DUP8 ADD DUP5 SWAP1 MSTORE PUSH1 0x60 DUP8 ADD DUP3 SWAP1 MSTORE TIMESTAMP PUSH1 0xA0 DUP9 ADD DUP2 SWAP1 MSTORE SWAP1 MLOAD DUP3 DUP6 SUB SWAP2 SWAP1 DUP2 SWAP1 SUB DUP7 DUP3 LT ISZERO PUSH2 0x255 JUMPI PUSH1 0x80 DUP10 ADD DUP7 SWAP1 MSTORE PUSH2 0x28F JUMP JUMPDEST PUSH2 0x100 DUP11 ADD MLOAD DUP3 LT PUSH2 0x26D JUMPI PUSH1 0x80 DUP10 ADD DUP5 SWAP1 MSTORE PUSH2 0x28F JUMP JUMPDEST PUSH2 0x289 DUP5 PUSH2 0x284 PUSH2 0x27E DUP5 DUP8 PUSH2 0x607 JUMP JUMPDEST DUP9 PUSH2 0x66D JUMP JUMPDEST PUSH2 0x684 JUMP JUMPDEST PUSH1 0x80 DUP11 ADD MSTORE JUMPDEST POP POP POP POP POP POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x2A4 PUSH2 0x7E8 JUMP JUMPDEST PUSH2 0x2AC PUSH2 0x7B1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x2BE DUP11 PUSH2 0xB3 JUMP JUMPDEST DUP1 MLOAD PUSH1 0xA0 DUP3 ADD MLOAD SWAP2 SWAP8 POP GT ISZERO PUSH2 0x300 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10EA JUMP JUMPDEST PUSH1 0xA0 DUP7 ADD MLOAD PUSH2 0x100 DUP12 ADD MLOAD GT PUSH2 0x342 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10CA JUMP JUMPDEST PUSH1 0x80 DUP1 DUP8 ADD MLOAD SWAP1 DUP13 ADD MLOAD LT ISZERO PUSH2 0x384 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10FA JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0x3C28D86100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0x3C28D861 SWAP1 PUSH2 0x3E0 SWAP1 DUP15 SWAP1 DUP15 SWAP1 DUP15 SWAP1 DUP15 SWAP1 PUSH1 0x4 ADD PUSH2 0x1127 JUMP JUMPDEST PUSH2 0x120 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x3FB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x40F JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x433 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xB06 JUMP JUMPDEST SWAP7 POP DUP7 PUSH1 0x40 ADD MLOAD SWAP5 POP PUSH1 0x0 DUP6 GT ISZERO PUSH2 0x5E4 JUMPI PUSH2 0x160 DUP11 ADD MLOAD SWAP4 POP PUSH2 0x45E DUP5 PUSH1 0x10 PUSH4 0xFFFFFFFF PUSH2 0x6C3 AND JUMP JUMPDEST SWAP3 POP PUSH2 0x472 DUP12 PUSH1 0x80 ADD MLOAD DUP8 PUSH1 0x80 ADD MLOAD PUSH2 0x724 JUMP JUMPDEST SWAP2 POP PUSH2 0x47E DUP6 DUP4 PUSH2 0x724 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 DUP2 GT ISZERO PUSH2 0x532 JUMPI DUP10 MLOAD PUSH1 0x40 MLOAD PUSH32 0xA9059CBB00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP2 PUSH4 0xA9059CBB SWAP2 PUSH2 0x4DE SWAP2 SWAP1 DUP6 SWAP1 PUSH1 0x4 ADD PUSH2 0x105F JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x4F8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x50C JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x530 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xAE0 JUMP JUMPDEST POP JUMPDEST PUSH1 0x0 DUP3 GT ISZERO PUSH2 0x5E4 JUMPI DUP11 MLOAD PUSH1 0x40 MLOAD PUSH32 0xA9059CBB00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP2 PUSH4 0xA9059CBB SWAP2 PUSH2 0x590 SWAP2 SWAP1 DUP7 SWAP1 PUSH1 0x4 ADD PUSH2 0x105F JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x5AA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x5BE JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x5E2 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xAE0 JUMP JUMPDEST POP JUMPDEST POP POP POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x5FE DUP4 DUP4 PUSH2 0x766 JUMP JUMPDEST SWAP1 POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 ISZERO ISZERO PUSH2 0x61A JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x666 JUMP JUMPDEST POP DUP3 DUP3 MUL DUP3 DUP5 DUP3 DUP2 ISZERO ISZERO PUSH2 0x62A JUMPI INVALID JUMPDEST DIV EQ PUSH2 0x662 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x109A JUMP JUMPDEST DUP1 SWAP2 POP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 DUP5 DUP2 ISZERO ISZERO PUSH2 0x67B JUMPI INVALID JUMPDEST DIV SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x662 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x109A JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x705 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x10DA JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0x760 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x107A JUMP JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x7A8 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x105 SWAP1 PUSH2 0x108A JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0xC0 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH2 0x120 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH2 0x7FD PUSH2 0x817 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x80A PUSH2 0x817 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x80 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x84C DUP3 CALLDATALOAD PUSH2 0x11EF JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x84C DUP3 MLOAD PUSH2 0x120B JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x870 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x883 PUSH2 0x87E DUP3 PUSH2 0x11A5 JUMP JUMPDEST PUSH2 0x117E JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x89F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x8AA DUP4 DUP3 DUP5 PUSH2 0x1210 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x8C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x8CF PUSH1 0x80 PUSH2 0x117E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x8DD DUP5 DUP5 PUSH2 0xAD4 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x8EE DUP5 DUP5 DUP4 ADD PUSH2 0xAD4 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x902 DUP5 DUP3 DUP6 ADD PUSH2 0xAD4 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x916 DUP5 DUP3 DUP6 ADD PUSH2 0xAD4 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x120 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x935 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x93F PUSH1 0x60 PUSH2 0x117E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x94D DUP5 DUP5 PUSH2 0x8B3 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x80 PUSH2 0x95E DUP5 DUP5 DUP4 ADD PUSH2 0x8B3 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x973 DUP5 DUP3 DUP6 ADD PUSH2 0xAD4 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x992 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x99D PUSH2 0x180 PUSH2 0x117E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x9AB DUP5 DUP5 PUSH2 0x840 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x9BC DUP5 DUP5 DUP4 ADD PUSH2 0x840 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x9D0 DUP5 DUP3 DUP6 ADD PUSH2 0x840 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x9E4 DUP5 DUP3 DUP6 ADD PUSH2 0x840 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x9F8 DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0xA0C DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0xA20 DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0xA34 DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0xA49 DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0xA5F DUP5 DUP3 DUP6 ADD PUSH2 0xAC8 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xA81 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xA8D DUP5 DUP3 DUP6 ADD PUSH2 0x85F JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xAAF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xABB DUP5 DUP3 DUP6 ADD PUSH2 0x85F JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x84C DUP3 CALLDATALOAD PUSH2 0x1208 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x84C DUP3 MLOAD PUSH2 0x1208 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xAF2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xAFE DUP5 DUP5 PUSH2 0x853 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x120 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xB19 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xAFE DUP5 DUP5 PUSH2 0x922 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xB37 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xB4E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xAFE DUP5 DUP3 DUP6 ADD PUSH2 0x97F JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0xB70 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xB87 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xB93 DUP8 DUP3 DUP9 ADD PUSH2 0x97F JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xBB0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xBBC DUP8 DUP3 DUP9 ADD PUSH2 0x97F JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xBD9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xBE5 DUP8 DUP3 DUP9 ADD PUSH2 0x85F JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xC02 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xC0E DUP8 DUP3 DUP9 ADD PUSH2 0x85F JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH2 0xC23 DUP2 PUSH2 0x11EF JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC34 DUP3 PUSH2 0x11EB JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0xC48 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x121C JUMP JUMPDEST PUSH2 0xC51 DUP2 PUSH2 0x1248 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x494E56414C49445F41535345545F444154410000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x494E56414C49445F424547494E5F54494D450000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xF DUP2 MSTORE PUSH32 0x41554354494F4E5F455850495245440000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x13 DUP2 MSTORE PUSH32 0x41554354494F4E5F4E4F545F5354415254454400000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x494E56414C49445F414D4F554E54000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0xC0 DUP4 ADD SWAP1 PUSH2 0xE6B DUP5 DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0xE7E PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0xE91 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0xEA4 PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x80 DUP3 ADD MLOAD PUSH2 0xEB7 PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0xA0 DUP3 ADD MLOAD PUSH2 0xECA PUSH1 0xA0 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x80 DUP4 ADD SWAP1 PUSH2 0xEE1 DUP5 DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0xEF4 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0xF07 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0xECA PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST DUP1 MLOAD PUSH2 0x120 DUP4 ADD SWAP1 PUSH2 0xF2C DUP5 DUP3 PUSH2 0xED0 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0xF3F PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0xED0 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0xECA PUSH2 0x100 DUP6 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0xF68 DUP6 DUP3 PUSH2 0xC1A JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0xF7B PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0xC1A JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0xF8E PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0xC1A JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0xFA1 PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0xC1A JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0xFB4 PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0xFC7 PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0xFDA PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0xFED PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0x1002 PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0x1017 PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0x1056 JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0x1031 DUP3 DUP3 PUSH2 0xC29 JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0x104D DUP3 DUP3 PUSH2 0xC29 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0xC23 DUP2 PUSH2 0x1208 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x106D DUP3 DUP6 PUSH2 0xC1A JUMP JUMPDEST PUSH2 0x84C PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x1056 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xC5E JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xC8E JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xCE4 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xD14 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xD44 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xD74 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xDA4 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xDFA JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x601 DUP2 PUSH2 0xE2A JUMP JUMPDEST PUSH1 0xC0 DUP2 ADD PUSH2 0x601 DUP3 DUP5 PUSH2 0xE5A JUMP JUMPDEST PUSH2 0x120 DUP2 ADD PUSH2 0x601 DUP3 DUP5 PUSH2 0xF1A JUMP JUMPDEST PUSH1 0x80 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1138 DUP2 DUP8 PUSH2 0xF53 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x114C DUP2 DUP7 PUSH2 0xF53 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1160 DUP2 DUP6 PUSH2 0xC29 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0x1174 DUP2 DUP5 PUSH2 0xC29 JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x119D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x11BC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1237 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x121F JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0xECA JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 SWAP13 0xf7 SIGNEXTEND DIV 0xb7 0x5f 0xc2 RETURNDATACOPY PUSH8 0x62AE4C6C8F25CCAD 0x25 0xdf 0xcb CODECOPY 0xcf SAR 0xd3 SWAP7 PUSH15 0xB27CE513DE036C6578706572696D65 PUSH15 0x74616CF50037000000000000000000 ",
+ "sourceMap": "986:9378:28:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;7335:3027;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7335:3027:28;;;;;;;;;;;;;;;;;;;;;;;;;3690:3508;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3690:3508:28;;;;;;;;;;;;;;;;;7335:3027;7437:36;;:::i;:::-;7520:20;;;;:27;7489:28;;;;;;;8295:3;8271:27;;;8250:92;;;;;;;;;;;;;;;;;;;;;;8386:20;;;;:59;;8419:25;;;8386:59;:32;:59;:::i;:::-;8484:20;;;;8352:93;;-1:-1:-1;8484:59:28;;8517:25;;;8484:59;:32;:59;:::i;:::-;8455:88;;8657:23;8627:5;:27;;;:53;8606:118;;;;;;;;;;;;;;;;8795:23;8767:5;:27;;;:51;8734:84;;8900:5;:22;;;8880:42;;8974:9;8953:18;:30;8932:91;;;;;;;;;;;;;;;;-1:-1:-1;;;9192:57:28;;;9291:27;;;;;9259:29;;;:59;9328:26;;;:47;;;9385:24;;;:36;;;9167:15;9431:33;;;:45;;;9522:27;;9055:28;;;;9167:15;9522:37;;;9573:35;;;9569:756;;;9717:28;;;:49;;;9569:756;;;9800:27;;;;9787:40;;9783:542;;10009:28;;;:40;;;9783:542;;;10111:203;10136:9;10163:137;10192:46;10200:24;10226:11;10192:7;:46::i;:::-;10260:22;10163:7;:137::i;:::-;10111:7;:203::i;:::-;10080:28;;;:234;9783:542;7335:3027;;;;;;;;;;;:::o;3690:3508::-;3901:59;;:::i;:::-;3976:36;;:::i;:::-;5398:34;6127:22;6190:13;6404:25;6510:26;4015:28;4033:9;4015:17;:28::i;:::-;4161:31;;4124:33;;;;3976:67;;-1:-1:-1;;4124:68:28;4103:134;;;;;;;;;;;;;;4413:33;;;;4379:31;;;;:67;4358:129;;;;;;;;;;;;;;4627:28;;;;;4598:25;;;;:57;;4577:118;;;;;;;;;;;;;;4780:8;;:128;;;;;:8;;;;;:20;;:128;;4814:8;;4836:9;;4859:12;;4885:13;;4780:128;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4780:128:28;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4780:128:28;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;4780:128:28;;;;;;;;;4759:149;;5435:18;:45;;;5398:82;;5523:1;5494:26;:30;5490:1667;;;6152:24;;;;;-1:-1:-1;6206:25:28;6152:24;6228:2;6206:25;:21;:25;:::i;:::-;6190:41;;6432:64;6440:8;:25;;;6467:14;:28;;;6432:7;:64::i;:::-;6404:92;;6539:54;6547:26;6575:17;6539:7;:54::i;:::-;6510:83;;6766:1;6745:18;:22;6741:132;;;6815:22;;6787:71;;;;;:27;;;;;;:71;;6815:22;6839:18;;6787:71;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6787:71:28;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6787:71:28;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;6787:71:28;;;;;;;;;;6741:132;7042:1;7022:17;:21;7018:129;;;7091:21;;7063:69;;;;;:27;;;;;;:69;;7091:21;7114:17;;7063:69;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;7063:69:28;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;7063:69:28;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;7063:69:28;;;;;;;;;;7018:129;3690:3508;;;;;;;;;;;;:::o;14708:220:17:-;14829:14;14876:21;14888:1;14891:5;14876:11;:21::i;:::-;14868:30;-1:-1:-1;14708:220:17;;;;;:::o;51:288:20:-;137:7;;164:6;;160:45;;;193:1;186:8;;;;160:45;-1:-1:-1;226:5:20;;;230:1;226;:5;262;;;;;;;;:10;241:73;;;;;;;;;;;;;;331:1;324:8;;51:288;;;;;;:::o;345:151::-;431:7;454:9;470:1;466;:5;;;;;;;;;345:151;-1:-1:-1;;;;345:151:20:o;716:230::-;802:7;837:5;;;873:6;;;;852:69;;;;;;;;;;;;;10268:886:17;10389:14;10452:5;10460:2;10452:10;10440:1;:8;:22;;10419:135;;;;;;;;;;;;;;;;-1:-1:-1;11056:13:17;10801:2;11056:13;11050:20;11072:42;11046:69;;10268:886::o;502:208:20:-;588:7;632:6;;;;611:70;;;;;;;;;;;;;;-1:-1:-1;698:5:20;;;502:208::o;13290:490:17:-;13411:14;13474:5;13482:2;13474:10;13462:1;:8;:22;;13441:107;;;;;;;;;;;;;;;;-1:-1:-1;13727:13:17;13629:2;13727:13;13721:20;;13290:490::o;986:9378:28:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;;63:55;57:66;-1:-1;;;57:66;130:116;;205:36;233:6;227:13;205:36;;254:432;;344:4;332:17;;328:27;-1:-1;318:2;;369:1;366;359:12;318:2;406:6;393:20;428:60;443:44;480:6;443:44;;;428:60;;;419:69;;508:6;501:5;494:21;544:4;536:6;532:17;577:4;570:5;566:16;612:3;603:6;598:3;594:16;591:25;588:2;;;629:1;626;619:12;588:2;639:41;673:6;668:3;663;639:41;;;311:375;;;;;;;;1183:861;;1308:4;1296:9;1291:3;1287:19;1283:30;1280:2;;;1326:1;1323;1316:12;1280:2;1344:20;1359:4;1344:20;;;1335:29;-1:-1;1432:1;1463:60;1519:3;1499:9;1463:60;;;1439:85;;-1:-1;1603:2;1636:60;1692:3;1668:22;;;1636:60;;;1629:4;1622:5;1618:16;1611:86;1545:163;1766:2;1799:60;1855:3;1846:6;1835:9;1831:22;1799:60;;;1792:4;1785:5;1781:16;1774:86;1718:153;1929:2;1962:60;2018:3;2009:6;1998:9;1994:22;1962:60;;;1955:4;1948:5;1944:16;1937:86;1881:153;1274:770;;;;;2098:741;;2234:5;2222:9;2217:3;2213:19;2209:31;2206:2;;;2253:1;2250;2243:12;2206:2;2271:20;2286:4;2271:20;;;2262:29;-1:-1;2341:1;2372:85;2453:3;2433:9;2372:85;;;2348:110;;-1:-1;2520:3;2554:85;2635:3;2611:22;;;2554:85;;;2547:4;2540:5;2536:16;2529:111;2479:172;2723:3;2757:60;2813:3;2804:6;2793:9;2789:22;2757:60;;;2750:4;2743:5;2739:16;2732:86;2661:168;2200:639;;;;;2874:2208;;2985:5;2973:9;2968:3;2964:19;2960:31;2957:2;;;3004:1;3001;2994:12;2957:2;3022:21;3037:5;3022:21;;;3013:30;-1:-1;3101:1;3132:49;3177:3;3157:9;3132:49;;;3108:74;;-1:-1;3251:2;3284:49;3329:3;3305:22;;;3284:49;;;3277:4;3270:5;3266:16;3259:75;3203:142;3410:2;3443:49;3488:3;3479:6;3468:9;3464:22;3443:49;;;3436:4;3429:5;3425:16;3418:75;3355:149;3563:2;3596:49;3641:3;3632:6;3621:9;3617:22;3596:49;;;3589:4;3582:5;3578:16;3571:75;3514:143;3719:3;3753:49;3798:3;3789:6;3778:9;3774:22;3753:49;;;3746:4;3739:5;3735:16;3728:75;3667:147;3876:3;3910:49;3955:3;3946:6;3935:9;3931:22;3910:49;;;3903:4;3896:5;3892:16;3885:75;3824:147;4025:3;4059:49;4104:3;4095:6;4084:9;4080:22;4059:49;;;4052:4;4045:5;4041:16;4034:75;3981:139;4174:3;4208:49;4253:3;4244:6;4233:9;4229:22;4208:49;;;4201:4;4194:5;4190:16;4183:75;4130:139;4336:3;4371:49;4416:3;4407:6;4396:9;4392:22;4371:49;;;4363:5;4356;4352:17;4345:76;4279:153;4482:3;4517:49;4562:3;4553:6;4542:9;4538:22;4517:49;;;4509:5;4502;4498:17;4491:76;4442:136;4666:3;4655:9;4651:19;4638:33;4691:18;4683:6;4680:30;4677:2;;;4723:1;4720;4713:12;4677:2;4759:54;4809:3;4800:6;4789:9;4785:22;4759:54;;;4751:5;4744;4740:17;4733:81;4588:237;4913:3;4902:9;4898:19;4885:33;4938:18;4930:6;4927:30;4924:2;;;4970:1;4967;4960:12;4924:2;5006:54;5056:3;5047:6;5036:9;5032:22;5006:54;;;4998:5;4991;4987:17;4980:81;4835:237;2951:2131;;;;;5089:118;;5156:46;5194:6;5181:20;5156:46;;5214:122;;5292:39;5323:6;5317:13;5292:39;;5343:257;;5455:2;5443:9;5434:7;5430:23;5426:32;5423:2;;;5471:1;5468;5461:12;5423:2;5506:1;5523:61;5576:7;5556:9;5523:61;;;5513:71;5417:183;-1:-1;;;;5417:183;5607:336;;5758:3;5746:9;5737:7;5733:23;5729:33;5726:2;;;5775:1;5772;5765:12;5726:2;5810:1;5827:100;5919:7;5899:9;5827:100;;5950:371;;6076:2;6064:9;6055:7;6051:23;6047:32;6044:2;;;6092:1;6089;6082:12;6044:2;6127:31;;6178:18;6167:30;;6164:2;;;6210:1;6207;6200:12;6164:2;6230:75;6297:7;6288:6;6277:9;6273:22;6230:75;;6328:1085;;;;;6545:3;6533:9;6524:7;6520:23;6516:33;6513:2;;;6562:1;6559;6552:12;6513:2;6597:31;;6648:18;6637:30;;6634:2;;;6680:1;6677;6670:12;6634:2;6700:75;6767:7;6758:6;6747:9;6743:22;6700:75;;;6690:85;;6576:205;6840:2;6829:9;6825:18;6812:32;6864:18;6856:6;6853:30;6850:2;;;6896:1;6893;6886:12;6850:2;6916:75;6983:7;6974:6;6963:9;6959:22;6916:75;;;6906:85;;6791:206;7056:2;7045:9;7041:18;7028:32;7080:18;7072:6;7069:30;7066:2;;;7112:1;7109;7102:12;7066:2;7132:62;7186:7;7177:6;7166:9;7162:22;7132:62;;;7122:72;;7007:193;7259:2;7248:9;7244:18;7231:32;7283:18;7275:6;7272:30;7269:2;;;7315:1;7312;7305:12;7269:2;7335:62;7389:7;7380:6;7369:9;7365:22;7335:62;;;7325:72;;7210:193;6507:906;;;;;;;;7420:110;7493:31;7518:5;7493:31;;;7488:3;7481:44;7475:55;;;7537:297;;7637:38;7669:5;7637:38;;;7692:6;7687:3;7680:19;7704:63;7760:6;7753:4;7748:3;7744:14;7737:4;7730:5;7726:16;7704:63;;;7799:29;7821:6;7799:29;;;7779:50;;;7792:4;7779:50;;7617:217;-1:-1;;;7617:217;8138:296;8293:2;8281:15;;8330:66;8325:2;8316:12;;8309:88;8425:2;8416:12;;8274:160;8443:397;8598:2;8586:15;;8635:66;8630:2;8621:12;;8614:88;8736:66;8731:2;8722:12;;8715:88;8831:2;8822:12;;8579:261;8849:296;9004:2;8992:15;;9041:66;9036:2;9027:12;;9020:88;9136:2;9127:12;;8985:160;9154:296;9309:2;9297:15;;9346:66;9341:2;9332:12;;9325:88;9441:2;9432:12;;9290:160;9459:296;9614:2;9602:15;;9651:66;9646:2;9637:12;;9630:88;9746:2;9737:12;;9595:160;9764:296;9919:2;9907:15;;9956:66;9951:2;9942:12;;9935:88;10051:2;10042:12;;9900:160;10069:397;10224:2;10212:15;;10261:66;10256:2;10247:12;;10240:88;10362:66;10357:2;10348:12;;10341:88;10457:2;10448:12;;10205:261;10475:296;10630:2;10618:15;;10667:66;10662:2;10653:12;;10646:88;10762:2;10753:12;;10611:160;10780:296;10935:2;10923:15;;10972:66;10967:2;10958:12;;10951:88;11067:2;11058:12;;10916:160;11163:1231;11387:22;;11306:4;11297:14;;;11421:61;11301:3;11387:22;11421:61;;;11326:168;11580:4;11573:5;11569:16;11563:23;11598:62;11654:4;11649:3;11645:14;11632:11;11598:62;;;11504:168;11755:4;11748:5;11744:16;11738:23;11773:62;11829:4;11824:3;11820:14;11807:11;11773:62;;;11682:165;11928:4;11921:5;11917:16;11911:23;11946:62;12002:4;11997:3;11993:14;11980:11;11946:62;;;11857:163;12105:4;12098:5;12094:16;12088:23;12123:62;12179:4;12174:3;12170:14;12157:11;12123:62;;;12030:167;12287:4;12280:5;12276:16;12270:23;12305:62;12361:4;12356:3;12352:14;12339:11;12305:62;;;12207:172;11279:1115;;;;12478:884;12702:22;;12615:4;12606:14;;;12736:61;12610:3;12702:22;12736:61;;;12635:174;12903:4;12896:5;12892:16;12886:23;12921:62;12977:4;12972:3;12968:14;12955:11;12921:62;;;12819:176;13079:4;13072:5;13068:16;13062:23;13097:62;13153:4;13148:3;13144:14;13131:11;13097:62;;;13005:166;13255:4;13248:5;13244:16;13238:23;13273:62;13329:4;13324:3;13320:14;13307:11;13273:62;;13460:815;13685:22;;13615:5;13606:15;;;13719:115;13610:3;13685:22;13719:115;;;13636:210;13923:4;13916:5;13912:16;13906:23;13941:116;14051:4;14046:3;14042:14;14029:11;13941:116;;;13856:213;14167:4;14160:5;14156:16;14150:23;14185:63;14241:5;14236:3;14232:15;14219:11;14185:63;;14335:2417;14548:22;;14335:2417;;14470:5;14461:15;;;14582:61;14465:3;14548:22;14582:61;;;14491:164;14739:4;14732:5;14728:16;14722:23;14757:62;14813:4;14808:3;14804:14;14791:11;14757:62;;;14665:166;14922:4;14915:5;14911:16;14905:23;14940:62;14996:4;14991:3;14987:14;14974:11;14940:62;;;14841:173;15099:4;15092:5;15088:16;15082:23;15117:62;15173:4;15168:3;15164:14;15151:11;15117:62;;;15024:167;15279:4;15272:5;15268:16;15262:23;15297:62;15353:4;15348:3;15344:14;15331:11;15297:62;;;15201:170;15459:4;15452:5;15448:16;15442:23;15477:62;15533:4;15528:3;15524:14;15511:11;15477:62;;;15381:170;15631:4;15624:5;15620:16;15614:23;15649:62;15705:4;15700:3;15696:14;15683:11;15649:62;;;15561:162;15803:4;15796:5;15792:16;15786:23;15821:62;15877:4;15872:3;15868:14;15855:11;15821:62;;;15733:162;15988:5;15981;15977:17;15971:24;16007:63;16063:5;16058:3;16054:15;16041:11;16007:63;;;15905:177;16158:5;16151;16147:17;16141:24;16177:63;16233:5;16228:3;16224:15;16211:11;16177:63;;;16092:160;16338:5;16331;16327:17;16321:24;16391:3;16385:4;16381:14;16373:5;16368:3;16364:15;16357:39;16411:66;16472:4;16459:11;16411:66;;;16403:74;;16262:227;16575:5;16568;16564:17;16558:24;16628:3;16622:4;16618:14;16610:5;16605:3;16601:15;16594:39;16648:66;16709:4;16696:11;16648:66;;;16640:74;14443:2309;-1:-1;;;;;14443:2309;16759:110;16832:31;16857:5;16832:31;;16876:294;17012:2;16997:18;;17026:61;17001:9;17060:6;17026:61;;;17098:62;17156:2;17145:9;17141:18;17132:6;17098:62;;17177:387;17358:2;17372:47;;;17343:18;;17433:121;17343:18;17433:121;;17571:387;17752:2;17766:47;;;17737:18;;17827:121;17737:18;17827:121;;17965:387;18146:2;18160:47;;;18131:18;;18221:121;18131:18;18221:121;;18359:387;18540:2;18554:47;;;18525:18;;18615:121;18525:18;18615:121;;18753:387;18934:2;18948:47;;;18919:18;;19009:121;18919:18;19009:121;;19147:387;19328:2;19342:47;;;19313:18;;19403:121;19313:18;19403:121;;19541:387;19722:2;19736:47;;;19707:18;;19797:121;19707:18;19797:121;;19935:387;20116:2;20130:47;;;20101:18;;20191:121;20101:18;20191:121;;20329:387;20510:2;20524:47;;;20495:18;;20585:121;20495:18;20585:121;;20723:314;20891:3;20876:19;;20906:121;20880:9;21000:6;20906:121;;21044:338;21224:3;21209:19;;21239:133;21213:9;21345:6;21239:133;;21389:937;21705:3;21720:47;;;21690:19;;21781:92;21690:19;21859:6;21781:92;;;21773:100;;21921:9;21915:4;21911:20;21906:2;21895:9;21891:18;21884:48;21946:92;22033:4;22024:6;21946:92;;;21938:100;;22086:9;22080:4;22076:20;22071:2;22060:9;22056:18;22049:48;22111:66;22172:4;22163:6;22111:66;;;22103:74;;22225:9;22219:4;22215:20;22210:2;22199:9;22195:18;22188:48;22250:66;22311:4;22302:6;22250:66;;;22242:74;21676:650;-1:-1;;;;;;21676:650;22333:256;22395:2;22389:9;22421:17;;;22496:18;22481:34;;22517:22;;;22478:62;22475:2;;;22553:1;22550;22543:12;22475:2;22569;22562:22;22373:216;;-1:-1;22373:216;22596:254;;22735:18;22727:6;22724:30;22721:2;;;22767:1;22764;22757:12;22721:2;-1:-1;22840:4;22811;22788:17;;;;22807:9;22784:33;22830:15;;22658:192;23122:87;23192:12;;23176:33;23314:128;23394:42;23383:54;;23366:76;23449:79;23518:5;23501:27;23670:92;23743:13;23736:21;;23719:43;23856:145;23937:6;23932:3;23927;23914:30;-1:-1;23993:1;23975:16;;23968:27;23907:94;24010:268;24075:1;24082:101;24096:6;24093:1;24090:13;24082:101;;;24163:11;;;24157:18;24144:11;;;24137:39;24118:2;24111:10;24082:101;;;24198:6;24195:1;24192:13;24189:2;;;-1:-1;;24263:1;24245:16;;24238:27;24059:219;24286:97;24374:2;24354:14;24370:7;24350:28;;24334:49"
+ }
+ }
+ },
+ "networks": {}
+}
diff --git a/packages/contract-artifacts/artifacts/Exchange.json b/packages/contract-artifacts/artifacts/Exchange.json
index 893bc5eae..6e586b899 100644
--- a/packages/contract-artifacts/artifacts/Exchange.json
+++ b/packages/contract-artifacts/artifacts/Exchange.json
@@ -1798,7 +1798,12 @@
"type": "function"
},
{
- "inputs": [],
+ "inputs": [
+ {
+ "name": "_zrxAssetData",
+ "type": "bytes"
+ }
+ ],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
@@ -1968,7 +1973,7 @@
"bytecode": {
"linkReferences": {},
"object":
- "0x60806040526000805460ff191690553480156200001b57600080fd5b50604080517f454950373132446f6d61696e28000000000000000000000000000000000000006020808301919091527f737472696e67206e616d652c0000000000000000000000000000000000000000602d8301527f737472696e672076657273696f6e2c000000000000000000000000000000000060398301527f6164647265737320766572696679696e67436f6e74726163740000000000000060488301527f2900000000000000000000000000000000000000000000000000000000000000606183015282516042818403018152606290920192839052815191929182918401908083835b60208310620001245780518252601f19909201916020918201910162000103565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208285018552600b8084527f30782050726f746f636f6c000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b60208310620001ae5780518252601f1990920191602091820191016200018d565b51815160209384036101000a600019018019909216911617905260408051929094018290038220828501855260018084527f3200000000000000000000000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b60208310620002385780518252601f19909201916020918201910162000217565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208282019890985281840196909652606081019690965250306080808701919091528151808703909101815260a09095019081905284519093849350850191508083835b60208310620002c35780518252601f199092019160209182019101620002a2565b5181516000196020949094036101000a939093019283169219169190911790526040519201829003909120600155505060028054600160a060020a03191633179055506158b380620003166000396000f3006080604052600436106101b65763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663288cdc9181146101bb578063297bb70b146101f15780632ac126221461021e5780633683ef8e1461024b5780633c28d8611461026d5780633e228bae1461029a5780633fd3c997146102ba5780634ac14782146102e75780634d0ae546146103075780634f9559b11461032757806350dde190146103475780636070410814610367578063642f2eaf1461039457806364a3bc15146103b457806377fcce68146103d45780637b8e3514146103f45780637e1d9808146104145780637e9d74dc1461043457806382c174d0146104615780638da5cb5b146104815780639363470214610496578063a3e20380146104b6578063b4be83d5146104d6578063bfc8bfce146104f6578063c585bb9314610516578063c75e0a8114610536578063d46b02c314610563578063d9bfa73e14610583578063db123b1a146105a3578063dd1c7d18146105c5578063e306f779146105e5578063e5fa431b146105fa578063eea086ba1461061a578063f2fde38b1461062f578063ffa1ad741461064f575b600080fd5b3480156101c757600080fd5b506101db6101d6366004614800565b610664565b6040516101e89190615425565b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004614723565b610676565b6040516101e891906156ff565b34801561022a57600080fd5b5061023e610239366004614800565b6107a1565b6040516101e89190615417565b34801561025757600080fd5b5061026b61026636600461483d565b6107b6565b005b34801561027957600080fd5b5061028d610288366004614971565b6108a3565b6040516101e8919061570d565b3480156102a657600080fd5b506102116102b5366004614a31565b610a3a565b3480156102c657600080fd5b506102da6102d5366004614900565b610a90565b6040516101e891906154e1565b3480156102f357600080fd5b5061026b6103023660046146ee565b610ab8565b34801561031357600080fd5b50610211610322366004614723565b610b85565b34801561033357600080fd5b5061026b610342366004614800565b610c75565b34801561035357600080fd5b50610211610362366004614723565b610e2a565b34801561037357600080fd5b50610387610382366004614900565b610ebe565b6040516101e89190615337565b3480156103a057600080fd5b5061023e6103af366004614800565b610f0c565b3480156103c057600080fd5b506102116103cf366004614a31565b610f21565b3480156103e057600080fd5b5061026b6103ef3660046146be565b610fcc565b34801561040057600080fd5b5061023e61040f366004614684565b611106565b34801561042057600080fd5b5061021161042f3660046147b7565b611126565b34801561044057600080fd5b5061045461044f3660046146ee565b61128a565b6040516101e89190615406565b34801561046d57600080fd5b5061023e61047c36600461481e565b61131f565b34801561048d57600080fd5b5061038761133f565b3480156104a257600080fd5b5061023e6104b13660046148a5565b61135b565b3480156104c257600080fd5b506102116104d13660046147b7565b6118de565b3480156104e257600080fd5b506102116104f1366004614a31565b6119f1565b34801561050257600080fd5b5061026b610511366004614a7a565b611a6c565b34801561052257600080fd5b5061026b610531366004614666565b611d05565b34801561054257600080fd5b5061055661055136600461493c565b611f30565b6040516101e8919061571c565b34801561056f57600080fd5b5061026b61057e36600461493c565b61202a565b34801561058f57600080fd5b506101db61059e366004614684565b6120c6565b3480156105af57600080fd5b506105b86120e3565b6040516101e891906154d0565b3480156105d157600080fd5b506102116105e03660046147b7565b612143565b3480156105f157600080fd5b506101db612218565b34801561060657600080fd5b506102116106153660046147b7565b61221e565b34801561062657600080fd5b50610387612390565b34801561063b57600080fd5b5061026b61064a366004614666565b6123ac565b34801561065b57600080fd5b506105b861245d565b60036020526000908152604090205481565b61067e614298565b600080610689614298565b60005460ff16156106cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461076f57610758878381518110151561071957fe5b90602001906020020151878481518110151561073157fe5b90602001906020020151878581518110151561074957fe5b90602001906020020151612494565b90506107648482612532565b600190910190610701565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509392505050565b60046020526000908152604090205460ff1681565b73ffffffffffffffffffffffffffffffffffffffff831633146108465761080e848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375061135b945050505050565b1515610846576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155af565b5050600091825260066020908152604080842073ffffffffffffffffffffffffffffffffffffffff9093168452919052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b6108ab6142c1565b6108b36142f0565b6108bb6142f0565b6000805460ff16156108f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561016080890151610140808a01919091528901519088015261094588611f30565b925061095087611f30565b915061095a612594565b9050610968888483896125c6565b610974878383886125c6565b61097e888861275e565b6109928888856040015185604001516127be565b8051602081015190519195506109ad918a9186918190612945565b6020808501519081015190516109c99189918591908190612945565b6109e28882856020015186604001518860000151612a5e565b6109fb8782846020015185604001518860200151612a5e565b610a0788888387612b0a565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550949350505050565b610a42614298565b6060610a4f858585612c92565b9050608081825160208401305af48015610a8657815183526020820151602084015260408201516040840152606082015160608401525b505b509392505050565b600a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60008054819060ff1615610af8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558151905b808214610b5857610b508382815181101515610b4157fe5b90602001906020020151612e64565b600101610b29565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b610b8d614298565b600080610b98614298565b60005460ff1615610bd5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461076f57610c5e8783815181101515610c1f57fe5b906020019060200201518784815181101515610c3757fe5b906020019060200201518785815181101515610c4f57fe5b90602001906020020151612e8f565b9050610c6a8482612532565b600190910190610c07565b6000805481908190819060ff1615610cb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610cec612594565b935073ffffffffffffffffffffffffffffffffffffffff84163314610d115733610d14565b60005b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600560209081526040808320938516835292905220549093506001860192509050808211610d8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061563f565b73ffffffffffffffffffffffffffffffffffffffff80851660008181526005602090815260408083209488168084529490915290819020859055517f82af639571738f4ebd4268fb0363d8957ebe1bbb9e78dba5ebd69eed39b154f090610df3908690615425565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055505050565b610e32614298565b600080610e3d614298565b86519250600091505b818314610eb457610e9d8783815181101515610e5e57fe5b906020019060200201518784815181101515610e7657fe5b906020019060200201518785815181101515610e8e57fe5b90602001906020020151610a3a565b9050610ea98482612532565b600190910190610e46565b5050509392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600a602052604090205473ffffffffffffffffffffffffffffffffffffffff165b919050565b60086020526000908152604090205460ff1681565b610f29614298565b60005460ff1615610f66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610f9c848484612e8f565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055949350505050565b6000805460ff161561100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561103d612594565b73ffffffffffffffffffffffffffffffffffffffff8181166000818152600760209081526040808320948916808452949091529081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168715151790555192935090917fa8656e308026eeabce8f0bc18048433252318ab80ac79da0b3d3d8697dfba891906110d1908690615417565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b600760209081526000928352604080842090915290825290205460ff1681565b61112e614298565b6060600080600061113d614298565b60005460ff161561117a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117815589518a919081106111b257fe5b906020019060200201516101600151945088519350600092505b828414611255578489848151811015156111e257fe5b906020019060200201516101600181905250611202888760200151612ee2565b915061122e898481518110151561121557fe5b9060200190602002015183898681518110151561074957fe5b905061123a8682612532565b6020860151881161124a57611255565b6001909201916111cc565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509195945050505050565b606060006060600084519250826040519080825280602002602001820160405280156112d057816020015b6112bd6142f0565b8152602001906001900390816112b55790505b509150600090505b808314610a88576112ff85828151811015156112f057fe5b90602001906020020151611f30565b828281518110151561130d57fe5b602090810290910101526001016112d8565b600660209081526000928352604080842090915290825290205460ff1681565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600080600080600089511115156113a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061562f565b6113ad89612f29565b7f010000000000000000000000000000000000000000000000000000000000000090049650600760ff88161061140f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061554f565b8660ff16600781111561141e57fe5b9550600086600781111561142e57fe5b1415611466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061561f565b600186600781111561147457fe5b14156114bc578851156114b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156ef565b600097506118d0565b60028660078111156114ca57fe5b141561160557885160411461150b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906154ef565b88600081518110151561151a57fe5b01602001517f010000000000000000000000000000000000000000000000000000000000000090819004810204945061155a89600163ffffffff612fed16565b935061156d89602163ffffffff612fed16565b925060018b868686604051600081526020016040526040516115929493929190615480565b60206040516020810390808403906000865af11580156115b6573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff8c811690821614995092506118d09050565b600386600781111561161357fe5b14156117b9578851604114611654576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906154ef565b88600081518110151561166357fe5b01602001517f01000000000000000000000000000000000000000000000000000000000000009081900481020494506116a389600163ffffffff612fed16565b93506116b689602163ffffffff612fed16565b925060018b60405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b6020831061175757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161171a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260408051929094018290038220600083529101928390526115929450925089918991508890615480565b60048660078111156117c757fe5b14156117df576117d88b8b8b613038565b97506118d0565b60058660078111156117ed57fe5b1415611850576117fc8961318d565b73ffffffffffffffffffffffffffffffffffffffff808c1660009081526007602090815260408083209385168352929052205490915060ff16151561184457600097506118d0565b6117d8818c8c8c613206565b600686600781111561185e57fe5b141561189e5760008b815260066020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290205460ff1697506118d0565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061554f565b505050505050509392505050565b6118e6614298565b60606000806000806118f6614298565b89600081518110151561190557fe5b906020019060200201516101400151955089519450600093505b8385146119e457858a8581518110151561193557fe5b6020908102909101015161014001528651611951908a90612ee2565b92506119948a8581518110151561196457fe5b9060200190602002015160a001518b8681518110151561198057fe5b906020019060200201516080015185613362565b91506119c08a858151811015156119a757fe5b90602001906020020151838a87815181101515610e8e57fe5b90506119cc8782612532565b865189116119d9576119e4565b60019093019261191f565b5050505050509392505050565b6119f9614298565b60005460ff1615611a36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610f9c848484612494565b60095460009073ffffffffffffffffffffffffffffffffffffffff1615611abf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b611b02611afd888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437506133b8945050505050565b6135f9565b60008181526008602052604090205490915060ff1615611b4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061559f565b73ffffffffffffffffffffffffffffffffffffffff86163314611c1f57611ba6818785858080601f0160208091040260200160405190810160405280939291908181526020018383808284375061135b945050505050565b1515611bde576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156df565b600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555b6000818152600860205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555130908690869080838380828437820191505092505050600060405180830381855af49150501515611cb6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155cf565b73ffffffffffffffffffffffffffffffffffffffff86163314611cfc57600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b50505050505050565b6002546000908190819073ffffffffffffffffffffffffffffffffffffffff163314611d5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061568f565b8392508273ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611dc457600080fd5b505af1158015611dd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611dfc919081019061491e565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600a602052604090205490925073ffffffffffffffffffffffffffffffffffffffff1690508015611e81576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061552f565b7fffffffff0000000000000000000000000000000000000000000000000000000082166000908152600a60205260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c0319490611f2290849087906154b5565b60405180910390a150505050565b611f386142f0565b611f4182613639565b6020808301829052600091825260039052604090819020549082015260808201511515611f755760015b60ff168152610f07565b60a08201511515611f87576002611f6b565b60a0820151604082015110611f9d576005611f6b565b6101008201514210611fb0576004611f6b565b60208082015160009081526004909152604090205460ff1615611fd4576006611f6b565b610120820151825173ffffffffffffffffffffffffffffffffffffffff90811660009081526005602090815260408083206060880151909416835292905220541115612021576006611f6b565b60038152919050565b60005460ff1615612067576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561209b81612e64565b50600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600560209081526000928352604080842090915290825290205481565b606060405190810160405280602481526020017ff47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f81526020017f4699f4980000000000000000000000000000000000000000000000000000000081525081565b61214b614298565b6060600080600061215a614298565b88600081518110151561216957fe5b906020019060200201516101600151945088519350600092505b82841461220c5784898481518110151561219957fe5b9060200190602002015161016001819052506121b9888760200151612ee2565b91506121e589848151811015156121cc57fe5b90602001906020020151838986815181101515610e8e57fe5b90506121f18682612532565b602086015188116122015761220c565b600190920191612183565b50505050509392505050565b60015481565b612226614298565b6060600080600080612236614298565b60005460ff1615612273576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567f565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558a518b919081106122ab57fe5b906020019060200201516101400151955089519450600093505b83851461235a57858a858151811015156122db57fe5b60209081029091010151610140015286516122f7908a90612ee2565b925061230a8a8581518110151561196457fe5b91506123368a8581518110151561231d57fe5b90602001906020020151838a8781518110151561074957fe5b90506123428782612532565b8651891161234f5761235a565b6001909301926122c5565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550929695505050505050565b60095473ffffffffffffffffffffffffffffffffffffffff1681565b60025473ffffffffffffffffffffffffffffffffffffffff1633146123fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061568f565b73ffffffffffffffffffffffffffffffffffffffff81161561245a57600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60408051808201909152600581527f322e302e30000000000000000000000000000000000000000000000000000000602082015281565b61249c614298565b6124a46142f0565b60008060006124b288611f30565b93506124bc612594565b92506124ca888585896125c6565b6124dc8860a001518560400151612ee2565b91506124e88783613647565b90506124fb888589848960000151612945565b612505888261365d565b945061251c88848660200151876040015189612a5e565b6125278884876136be565b505050509392505050565b815181516125409190613776565b8252602080830151908201516125569190613776565b60208301526040808301519082015161256f9190613776565b6040830152606080830151908201516125889190613776565b60609092019190915250565b60095460009073ffffffffffffffffffffffffffffffffffffffff168181156125bd57816125bf565b335b9392505050565b825160ff16600314612604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156af565b606084015173ffffffffffffffffffffffffffffffffffffffff161561267757606084015173ffffffffffffffffffffffffffffffffffffffff163314612677576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156bf565b602084015173ffffffffffffffffffffffffffffffffffffffff1615612702578173ffffffffffffffffffffffffffffffffffffffff16846020015173ffffffffffffffffffffffffffffffffffffffff16141515612702576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906154ff565b6040830151151561275857612720836020015185600001518361135b565b1515612758576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061556f565b50505050565b6127708260a001518260a001516137c0565b612782836080015183608001516137c0565b10156127ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156cf565b5050565b6127c66142c1565b6000806000806127da8960a0015188612ee2565b93506127ef89608001518a60a001518661381b565b92506127ff8860a0015187612ee2565b915061281488608001518960a001518461381b565b90508084106128575760208086018051839052805182018490525151865182015260808a015160a08b015187519092015161284f929061381b565b855152612894565b845183905284516020908101859052855181015190860180519190915260a089015160808a015191515161288b9290613898565b60208087015101525b84515160208087015101516128a99190612ee2565b604086015284515160808a015160c08b01516128c692919061381b565b85516040015284516020015160a08a015160e08b01516128e792919061381b565b855160600152602085015151608089015160c08a015161290892919061381b565b856020015160400181815250506129308560200151602001518960a001518a60e0015161381b565b60208601516060015250505050949350505050565b82151561297e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155ef565b828211156129b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155df565b8460a001516129cb856040015184613776565b1115612a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061550f565b612a118560800151836137c0565b612a1f828760a001516137c0565b1115612a57576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061566f565b5050505050565b612a6c828260200151613776565b600084815260036020908152604091829020929092558681015187518451938501518584015160608701516101408c01516101608d015196518b9873ffffffffffffffffffffffffffffffffffffffff9788169897909616967f0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c37112996612afb968f96339692959194909390615345565b60405180910390a45050505050565b60608060405190810160405280602481526020017ff47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f81526020017f4699f498000000000000000000000000000000000000000000000000000000008152509050612b8b85610140015186600001518660000151856020015160200151613935565b61014084015184518651845160200151612ba793929190613935565b612bc08561014001518660000151858560400151613935565b612bdc8186600001518760400151856000015160400151613935565b612bf88185600001518660400151856020015160400151613935565b836040015173ffffffffffffffffffffffffffffffffffffffff16856040015173ffffffffffffffffffffffffffffffffffffffff161415612c6257612c5d81848760400151612c58866000015160600151876020015160600151613776565b613935565b612a57565b612c7a81848760400151856000015160600151613935565b612a5781848660400151856020015160600151613935565b604080517fb4be83d5000000000000000000000000000000000000000000000000000000006020808301919091526060602483018181528751608485019081528884015160a48601529488015160c48501529087015160e4840152608087015161010484015260a087015161012484015260c087015161014484015260e08701516101648401526101008701516101848401526101208701516101a4840152610140870180516101c485019081526101608901516101e4860152610180905251805161020485018190529394919384936044870192849261022489019291820191601f82010460005b81811015612d99578351855260209485019490930192600101612d7b565b50505050818103610160808401919091528a0151805180835260209283019291820191601f82010460005b81811015612de2578351855260209485019490930192600101612dc4565b50505089845250848103602093840190815288518083529093918201918981019190601f82010460005b81811015612e2a578351855260209485019490930192600101612e0c565b5050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08883030188525060405250505050509392505050565b612e6c6142f0565b612e7582611f30565b9050612e818282613aff565b6127ba828260200151613c16565b612e97614298565b612ea2848484612494565b602081015190915083146125bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061565f565b600082821115612f1e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061551f565b508082035b92915050565b6000808251111515612f67576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061560f565b815182907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110612f9757fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909252507f0100000000000000000000000000000000000000000000000000000000000000908190040290565b60008160200183511015151561302f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061553f565b50016020015190565b6040516000906060907f1626ba7e00000000000000000000000000000000000000000000000000000000906130739087908690602401615460565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093178352815191935090829081885afa808015613110576001811461318157612527565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0c57414c4c45545f4552524f5200000000000000000000000000000000604052600060605260646000fd5b50505195945050505050565b600060148251101515156131cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061569f565b6131db826014845103613cbd565b82517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec019092525090565b6040516000906060907f93634702000000000000000000000000000000000000000000000000000000009061324390879087908790602401615433565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931783528151919350908290818a5afa8080156132e0576001811461335157613356565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f56414c494441544f525f4552524f5200000000000000000000000000604052600060605260646000fd5b825194505b50505050949350505050565b600080831161339d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061555f565b6133b06133aa85846137c0565b84613d1e565b949350505050565b604080517f5a65726f45785472616e73616374696f6e2800000000000000000000000000006020808301919091527f75696e743235362073616c742c0000000000000000000000000000000000000060328301527f61646472657373207369676e6572416464726573732c00000000000000000000603f8301527f627974657320646174610000000000000000000000000000000000000000000060558301527f2900000000000000000000000000000000000000000000000000000000000000605f830152825180830384018152606090920192839052815160009384938493909282918401908083835b602083106134e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016134a4565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260405191909301819003812089519097508995509093508392850191508083835b6020831061357757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161353a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822097825281019a909a525073ffffffffffffffffffffffffffffffffffffffff97909716968801969096525050606085015250506080909120919050565b6001546040517f19010000000000000000000000000000000000000000000000000000000000008152600281019190915260228101919091526042902090565b6000612f23611afd83613d35565b600081831061365657816125bf565b5090919050565b613665614298565b6020810182905260a0830151608084015161368191849161381b565b808252608084015160c085015161369992919061381b565b604082015260a083015160e08401516136b391849161381b565b606082015292915050565b60408051606081018252602481527ff47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f60208201527f4699f4980000000000000000000000000000000000000000000000000000000091810191909152610140840151845183516137319291908690613935565b61374a8461016001518486600001518560200151613935565b61376281856000015186604001518560400151613935565b612758818486604001518560600151613935565b6000828201838110156137b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061558f565b8091505b5092915050565b6000808315156137d357600091506137b9565b508282028284828115156137e357fe5b04146137b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061558f565b6000808311613856576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061555f565b61386184848461418e565b1561339d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155bf565b60008083116138d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061555f565b6138de848484614213565b15613915576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155bf565b6133b06133aa61392586856137c0565b613930866001612ee2565b613776565b60008060008311801561397457508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15613af75785516003106139b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564f565b50506020848101517fffffffff00000000000000000000000000000000000000000000000000000000166000818152600a90925260409091205473ffffffffffffffffffffffffffffffffffffffff16801515613a3d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155ff565b604051660fffffffffffe0603f885101168060840182017fa85e59e40000000000000000000000000000000000000000000000000000000083526080600484015273ffffffffffffffffffffffffffffffffffffffff8816602484015273ffffffffffffffffffffffffffffffffffffffff87166044840152856064840152608483015b81811015613ad957895181526020998a019901613ac1565b61020084858403866000895af1801515613af1573d85fd5b50505050505b505050505050565b805160009060ff16600314613b40576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156af565b606083015173ffffffffffffffffffffffffffffffffffffffff1615613bb357606083015173ffffffffffffffffffffffffffffffffffffffff163314613bb3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156bf565b613bbb612594565b835190915073ffffffffffffffffffffffffffffffffffffffff808316911614613c11576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061557f565b505050565b6000818152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558281015183516101408501516101608601519351859473ffffffffffffffffffffffffffffffffffffffff9485169493909316927fdc47b3613d9fe400085f6dbdc99453462279057e6207385042827ed6b1a62cf792613cb1923392906153c9565b60405180910390a45050565b600081601401835110151515613cff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061569f565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000808284811515613d2c57fe5b04949350505050565b604080517f4f726465722800000000000000000000000000000000000000000000000000006020808301919091527f61646472657373206d616b6572416464726573732c000000000000000000000060268301527f616464726573732074616b6572416464726573732c0000000000000000000000603b8301527f6164647265737320666565526563697069656e74416464726573732c0000000060508301527f616464726573732073656e646572416464726573732c00000000000000000000606c8301527f75696e74323536206d616b65724173736574416d6f756e742c0000000000000060828301527f75696e743235362074616b65724173736574416d6f756e742c00000000000000609b8301527f75696e74323536206d616b65724665652c00000000000000000000000000000060b48301527f75696e743235362074616b65724665652c00000000000000000000000000000060c58301527f75696e743235362065787069726174696f6e54696d655365636f6e64732c000060d68301527f75696e743235362073616c742c0000000000000000000000000000000000000060f48301527f6279746573206d616b65724173736574446174612c00000000000000000000006101018301527f62797465732074616b65724173736574446174610000000000000000000000006101168301527f290000000000000000000000000000000000000000000000000000000000000061012a830152825161010b81840301815261012b90920192839052815160009384938493849391929182918401908083835b60208310613fbd57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613f80565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101408b0151805191995095509093508392850191508083835b6020831061405857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161401b565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101608b0151805191985095509093508392850191508083835b602083106140f357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016140b6565b5181516020939093036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909116921691909117905260405192018290039091207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0890180516101408b018051610160909c0180519a84529881529288526101a0822091529890525050509190525090919050565b6000808084116141ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061555f565b8215806141d5575084155b156141e35760009150610a88565b838015156141ed57fe5b85840990506141fc85846137c0565b6142086103e8836137c0565b101595945050505050565b60008080841161424f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061555f565b82158061425a575084155b156142685760009150610a88565b8380151561427257fe5b8584099050836142828583612ee2565b81151561428b57fe5b0690506141fc85846137c0565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b610120604051908101604052806142d6614298565b81526020016142e3614298565b8152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b60006125bf82356157c2565b6000601f8201831361432d57600080fd5b813561434061433b82615751565b61572a565b81815260209384019390925082018360005b8381101561437e578135860161436888826144ce565b8452506020928301929190910190600101614352565b5050505092915050565b6000601f8201831361439957600080fd5b81356143a761433b82615751565b81815260209384019390925082018360005b8381101561437e57813586016143cf888261451d565b84525060209283019291909101906001016143b9565b6000601f820183136143f657600080fd5b813561440461433b82615751565b9150818183526020840193506020810190508385602084028201111561442957600080fd5b60005b8381101561437e578161443f8882614461565b845250602092830192919091019060010161442c565b60006125bf82356157db565b60006125bf82356157e0565b60006125bf82356157e3565b60006125bf82516157e3565b600080601f8301841361449757600080fd5b50813567ffffffffffffffff8111156144af57600080fd5b6020830191508360018202830111156144c757600080fd5b9250929050565b6000601f820183136144df57600080fd5b81356144ed61433b82615772565b9150808252602083016020830185838301111561450957600080fd5b614514838284615819565b50505092915050565b6000610180828403121561453057600080fd5b61453b61018061572a565b905060006145498484614310565b825250602061455a84848301614310565b602083015250604061456e84828501614310565b604083015250606061458284828501614310565b606083015250608061459684828501614461565b60808301525060a06145aa84828501614461565b60a08301525060c06145be84828501614461565b60c08301525060e06145d284828501614461565b60e0830152506101006145e784828501614461565b610100830152506101206145fd84828501614461565b6101208301525061014082013567ffffffffffffffff81111561461f57600080fd5b61462b848285016144ce565b6101408301525061016082013567ffffffffffffffff81111561464d57600080fd5b614659848285016144ce565b6101608301525092915050565b60006020828403121561467857600080fd5b60006133b08484614310565b6000806040838503121561469757600080fd5b60006146a38585614310565b92505060206146b485828601614310565b9150509250929050565b600080604083850312156146d157600080fd5b60006146dd8585614310565b92505060206146b485828601614455565b60006020828403121561470057600080fd5b813567ffffffffffffffff81111561471757600080fd5b6133b084828501614388565b60008060006060848603121561473857600080fd5b833567ffffffffffffffff81111561474f57600080fd5b61475b86828701614388565b935050602084013567ffffffffffffffff81111561477857600080fd5b614784868287016143e5565b925050604084013567ffffffffffffffff8111156147a157600080fd5b6147ad8682870161431c565b9150509250925092565b6000806000606084860312156147cc57600080fd5b833567ffffffffffffffff8111156147e357600080fd5b6147ef86828701614388565b935050602061478486828701614461565b60006020828403121561481257600080fd5b60006133b08484614461565b6000806040838503121561483157600080fd5b60006146a38585614461565b6000806000806060858703121561485357600080fd5b600061485f8787614461565b945050602061487087828801614310565b935050604085013567ffffffffffffffff81111561488d57600080fd5b61489987828801614485565b95989497509550505050565b6000806000606084860312156148ba57600080fd5b60006148c68686614461565b93505060206148d786828701614310565b925050604084013567ffffffffffffffff8111156148f457600080fd5b6147ad868287016144ce565b60006020828403121561491257600080fd5b60006133b0848461446d565b60006020828403121561493057600080fd5b60006133b08484614479565b60006020828403121561494e57600080fd5b813567ffffffffffffffff81111561496557600080fd5b6133b08482850161451d565b6000806000806080858703121561498757600080fd5b843567ffffffffffffffff81111561499e57600080fd5b6149aa8782880161451d565b945050602085013567ffffffffffffffff8111156149c757600080fd5b6149d38782880161451d565b935050604085013567ffffffffffffffff8111156149f057600080fd5b6149fc878288016144ce565b925050606085013567ffffffffffffffff811115614a1957600080fd5b614a25878288016144ce565b91505092959194509250565b600080600060608486031215614a4657600080fd5b833567ffffffffffffffff811115614a5d57600080fd5b614a698682870161451d565b93505060206148d786828701614461565b60008060008060008060808789031215614a9357600080fd5b6000614a9f8989614461565b9650506020614ab089828a01614310565b955050604087013567ffffffffffffffff811115614acd57600080fd5b614ad989828a01614485565b9450945050606087013567ffffffffffffffff811115614af857600080fd5b614b0489828a01614485565b92509250509295509295509295565b614b1c816157c2565b82525050565b6000614b2d826157be565b808452602084019350614b3f836157b8565b60005b82811015614b6f57614b558683516152f7565b614b5e826157b8565b606096909601959150600101614b42565b5093949350505050565b614b1c816157db565b614b1c816157e0565b614b1c816157e3565b6000614b9f826157be565b808452614bb3816020860160208601615825565b614bbc81615851565b9093016020019392505050565b614b1c8161580e565b601281527f4c454e4754485f36355f52455155495245440000000000000000000000000000602082015260400190565b600d81527f494e56414c49445f54414b455200000000000000000000000000000000000000602082015260400190565b600e81527f4f524445525f4f56455246494c4c000000000000000000000000000000000000602082015260400190565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f414c52454144595f455849535453000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601581527f5349474e41545552455f554e535550504f525445440000000000000000000000602082015260400190565b601081527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000602082015260400190565b601781527f494e56414c49445f4f524445525f5349474e4154555245000000000000000000602082015260400190565b600d81527f494e56414c49445f4d414b455200000000000000000000000000000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b600f81527f494e56414c49445f54585f484153480000000000000000000000000000000000602082015260400190565b601181527f494e56414c49445f5349474e4154555245000000000000000000000000000000602082015260400190565b600e81527f524f554e44494e475f4552524f52000000000000000000000000000000000000602082015260400190565b601081527f4641494c45445f455845435554494f4e00000000000000000000000000000000602082015260400190565b600d81527f54414b45525f4f56455250415900000000000000000000000000000000000000602082015260400190565b601481527f494e56414c49445f54414b45525f414d4f554e54000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f444f45535f4e4f545f4558495354000000000000602082015260400190565b602181527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560208201527f4400000000000000000000000000000000000000000000000000000000000000604082015260600190565b601181527f5349474e41545552455f494c4c4547414c000000000000000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f305f52455155495245440000602082015260400190565b601781527f494e56414c49445f4e45575f4f524445525f45504f4348000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f335f52455155495245440000602082015260400190565b601481527f434f4d504c4554455f46494c4c5f4641494c4544000000000000000000000000602082015260400190565b601281527f494e56414c49445f46494c4c5f50524943450000000000000000000000000000602082015260400190565b601281527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000602082015260400190565b601381527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601081527f4f524445525f554e46494c4c41424c4500000000000000000000000000000000602082015260400190565b600e81527f494e56414c49445f53454e444552000000000000000000000000000000000000602082015260400190565b601881527f4e454741544956455f5350524541445f52455155495245440000000000000000602082015260400190565b601481527f494e56414c49445f54585f5349474e4154555245000000000000000000000000602082015260400190565b601181527f4c454e4754485f305f5245515549524544000000000000000000000000000000602082015260400190565b805160808301906152858482614b82565b5060208201516152986020850182614b82565b5060408201516152ab6040850182614b82565b5060608201516127586060850182614b82565b80516101208301906152d08482615274565b5060208201516152e36080850182615274565b506040820151612758610100850182614b82565b80516060830190615308848261532e565b50602082015161531b6020850182614b82565b5060408201516127586040850182614b82565b614b1c81615808565b60208101612f238284614b13565b6101008101615354828b614b13565b615361602083018a614b13565b61536e6040830189614b82565b61537b6060830188614b82565b6153886080830187614b82565b61539560a0830186614b82565b81810360c08301526153a78185614b94565b905081810360e08301526153bb8184614b94565b9a9950505050505050505050565b606081016153d78286614b13565b81810360208301526153e98185614b94565b905081810360408301526153fd8184614b94565b95945050505050565b602080825281016125bf8184614b22565b60208101612f238284614b79565b60208101612f238284614b82565b606081016154418286614b82565b61544e6020830185614b13565b81810360408301526153fd8184614b94565b6040810161546e8285614b82565b81810360208301526133b08184614b94565b6080810161548e8287614b82565b61549b602083018661532e565b6154a86040830185614b82565b6153fd6060830184614b82565b604081016154c38285614b8b565b6125bf6020830184614b13565b602080825281016125bf8184614b94565b60208101612f238284614bc9565b60208082528101612f2381614bd2565b60208082528101612f2381614c02565b60208082528101612f2381614c32565b60208082528101612f2381614c62565b60208082528101612f2381614c92565b60208082528101612f2381614cc2565b60208082528101612f2381614d18565b60208082528101612f2381614d48565b60208082528101612f2381614d78565b60208082528101612f2381614da8565b60208082528101612f2381614dd8565b60208082528101612f2381614e08565b60208082528101612f2381614e38565b60208082528101612f2381614e68565b60208082528101612f2381614e98565b60208082528101612f2381614ec8565b60208082528101612f2381614ef8565b60208082528101612f2381614f28565b60208082528101612f2381614f58565b60208082528101612f2381614fae565b60208082528101612f2381614fde565b60208082528101612f238161500e565b60208082528101612f238161503e565b60208082528101612f238161506e565b60208082528101612f238161509e565b60208082528101612f23816150ce565b60208082528101612f23816150fe565b60208082528101612f238161512e565b60208082528101612f2381615184565b60208082528101612f23816151b4565b60208082528101612f23816151e4565b60208082528101612f2381615214565b60208082528101612f2381615244565b60808101612f238284615274565b6101208101612f2382846152be565b60608101612f2382846152f7565b60405181810167ffffffffffffffff8111828210171561574957600080fd5b604052919050565b600067ffffffffffffffff82111561576857600080fd5b5060209081020190565b600067ffffffffffffffff82111561578957600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b6000612f23826157c2565b82818337506000910152565b60005b83811015615840578181015183820152602001615828565b838111156127585750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820b19c92201032603398c007dccf80930c626ef89fa6c848c8b7ef5267d07cd4ed6c6578706572696d656e74616cf50037"
+ "0x60806040526000805460ff191690553480156200001b57600080fd5b5060405162005ec038038062005ec083398101806040526200004191908101906200044d565b80518190620000589060019060208401906200034c565b5050604080517f454950373132446f6d61696e28000000000000000000000000000000000000006020808301919091527f737472696e67206e616d652c0000000000000000000000000000000000000000602d8301527f737472696e672076657273696f6e2c000000000000000000000000000000000060398301527f6164647265737320766572696679696e67436f6e74726163740000000000000060488301527f2900000000000000000000000000000000000000000000000000000000000000606183015282516042818403018152606290920192839052815191929182918401908083835b60208310620001625780518252601f19909201916020918201910162000141565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208285018552600b8084527f30782050726f746f636f6c000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b60208310620001ec5780518252601f199092019160209182019101620001cb565b51815160209384036101000a600019018019909216911617905260408051929094018290038220828501855260018084527f3200000000000000000000000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b60208310620002765780518252601f19909201916020918201910162000255565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208282019890985281840196909652606081019690965250306080808701919091528151808703909101815260a09095019081905284519093849350850191508083835b60208310620003015780518252601f199092019160209182019101620002e0565b5181516000196020949094036101000a939093019283169219169190911790526040519201829003909120600255505060038054600160a060020a03191633179055506200050f9050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200038f57805160ff1916838001178555620003bf565b82800160010185558215620003bf579182015b82811115620003bf578251825591602001919060010190620003a2565b50620003cd929150620003d1565b5090565b620003ee91905b80821115620003cd5760008155600101620003d8565b90565b6000601f820183136200040357600080fd5b81516200041a6200041482620004b4565b6200048d565b915080825260208301602083018583830111156200043757600080fd5b62000444838284620004dc565b50505092915050565b6000602082840312156200046057600080fd5b81516001604060020a038111156200047757600080fd5b6200048584828501620003f1565b949350505050565b6040518181016001604060020a0381118282101715620004ac57600080fd5b604052919050565b60006001604060020a03821115620004cb57600080fd5b506020601f91909101601f19160190565b60005b83811015620004f9578181015183820152602001620004df565b8381111562000509576000848401525b50505050565b6159a1806200051f6000396000f3006080604052600436106101b65763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663288cdc9181146101bb578063297bb70b146101f15780632ac126221461021e5780633683ef8e1461024b5780633c28d8611461026d5780633e228bae1461029a5780633fd3c997146102ba5780634ac14782146102e75780634d0ae546146103075780634f9559b11461032757806350dde190146103475780636070410814610367578063642f2eaf1461039457806364a3bc15146103b457806377fcce68146103d45780637b8e3514146103f45780637e1d9808146104145780637e9d74dc1461043457806382c174d0146104615780638da5cb5b146104815780639363470214610496578063a3e20380146104b6578063b4be83d5146104d6578063bfc8bfce146104f6578063c585bb9314610516578063c75e0a8114610536578063d46b02c314610563578063d9bfa73e14610583578063db123b1a146105a3578063dd1c7d18146105c5578063e306f779146105e5578063e5fa431b146105fa578063eea086ba1461061a578063f2fde38b1461062f578063ffa1ad741461064f575b600080fd5b3480156101c757600080fd5b506101db6101d63660046148ee565b610664565b6040516101e89190615513565b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004614811565b610676565b6040516101e891906157ed565b34801561022a57600080fd5b5061023e6102393660046148ee565b6107a1565b6040516101e89190615505565b34801561025757600080fd5b5061026b61026636600461492b565b6107b6565b005b34801561027957600080fd5b5061028d610288366004614a5f565b6108a3565b6040516101e891906157fb565b3480156102a657600080fd5b506102116102b5366004614b1f565b610a3a565b3480156102c657600080fd5b506102da6102d53660046149ee565b610a90565b6040516101e891906155cf565b3480156102f357600080fd5b5061026b6103023660046147dc565b610ab8565b34801561031357600080fd5b50610211610322366004614811565b610b85565b34801561033357600080fd5b5061026b6103423660046148ee565b610c75565b34801561035357600080fd5b50610211610362366004614811565b610e2a565b34801561037357600080fd5b506103876103823660046149ee565b610ebe565b6040516101e89190615425565b3480156103a057600080fd5b5061023e6103af3660046148ee565b610f0c565b3480156103c057600080fd5b506102116103cf366004614b1f565b610f21565b3480156103e057600080fd5b5061026b6103ef3660046147ac565b610fcc565b34801561040057600080fd5b5061023e61040f366004614772565b611106565b34801561042057600080fd5b5061021161042f3660046148a5565b611126565b34801561044057600080fd5b5061045461044f3660046147dc565b61128a565b6040516101e891906154f4565b34801561046d57600080fd5b5061023e61047c36600461490c565b61131f565b34801561048d57600080fd5b5061038761133f565b3480156104a257600080fd5b5061023e6104b1366004614993565b61135b565b3480156104c257600080fd5b506102116104d13660046148a5565b6118de565b3480156104e257600080fd5b506102116104f1366004614b1f565b6119f1565b34801561050257600080fd5b5061026b610511366004614b68565b611a6c565b34801561052257600080fd5b5061026b610531366004614754565b611d05565b34801561054257600080fd5b50610556610551366004614a2a565b611f30565b6040516101e8919061580a565b34801561056f57600080fd5b5061026b61057e366004614a2a565b61202a565b34801561058f57600080fd5b506101db61059e366004614772565b6120c6565b3480156105af57600080fd5b506105b86120e3565b6040516101e891906155be565b3480156105d157600080fd5b506102116105e03660046148a5565b61218e565b3480156105f157600080fd5b506101db612263565b34801561060657600080fd5b506102116106153660046148a5565b612269565b34801561062657600080fd5b506103876123db565b34801561063b57600080fd5b5061026b61064a366004614754565b6123f7565b34801561065b57600080fd5b506105b86124a8565b60046020526000908152604090205481565b61067e614386565b600080610689614386565b60005460ff16156106cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461076f57610758878381518110151561071957fe5b90602001906020020151878481518110151561073157fe5b90602001906020020151878581518110151561074957fe5b906020019060200201516124df565b9050610764848261257d565b600190910190610701565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509392505050565b60056020526000908152604090205460ff1681565b73ffffffffffffffffffffffffffffffffffffffff831633146108465761080e848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375061135b945050505050565b1515610846576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061569d565b5050600091825260076020908152604080842073ffffffffffffffffffffffffffffffffffffffff9093168452919052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b6108ab6143af565b6108b36143de565b6108bb6143de565b6000805460ff16156108f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561016080890151610140808a01919091528901519088015261094588611f30565b925061095087611f30565b915061095a6125df565b905061096888848389612611565b61097487838388612611565b61097e88886127a9565b610992888885604001518560400151612809565b8051602081015190519195506109ad918a9186918190612990565b6020808501519081015190516109c99189918591908190612990565b6109e28882856020015186604001518860000151612aa9565b6109fb8782846020015185604001518860200151612aa9565b610a0788888387612b55565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550949350505050565b610a42614386565b6060610a4f858585612d2d565b9050608081825160208401305af48015610a8657815183526020820151602084015260408201516040840152606082015160608401525b505b509392505050565b600b6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60008054819060ff1615610af8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558151905b808214610b5857610b508382815181101515610b4157fe5b90602001906020020151612eff565b600101610b29565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b610b8d614386565b600080610b98614386565b60005460ff1615610bd5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461076f57610c5e8783815181101515610c1f57fe5b906020019060200201518784815181101515610c3757fe5b906020019060200201518785815181101515610c4f57fe5b90602001906020020151612f2a565b9050610c6a848261257d565b600190910190610c07565b6000805481908190819060ff1615610cb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610cec6125df565b935073ffffffffffffffffffffffffffffffffffffffff84163314610d115733610d14565b60005b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600660209081526040808320938516835292905220549093506001860192509050808211610d8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061572d565b73ffffffffffffffffffffffffffffffffffffffff80851660008181526006602090815260408083209488168084529490915290819020859055517f82af639571738f4ebd4268fb0363d8957ebe1bbb9e78dba5ebd69eed39b154f090610df3908690615513565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055505050565b610e32614386565b600080610e3d614386565b86519250600091505b818314610eb457610e9d8783815181101515610e5e57fe5b906020019060200201518784815181101515610e7657fe5b906020019060200201518785815181101515610e8e57fe5b90602001906020020151610a3a565b9050610ea9848261257d565b600190910190610e46565b5050509392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600b602052604090205473ffffffffffffffffffffffffffffffffffffffff165b919050565b60096020526000908152604090205460ff1681565b610f29614386565b60005460ff1615610f66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610f9c848484612f2a565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055949350505050565b6000805460ff161561100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561103d6125df565b73ffffffffffffffffffffffffffffffffffffffff8181166000818152600860209081526040808320948916808452949091529081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168715151790555192935090917fa8656e308026eeabce8f0bc18048433252318ab80ac79da0b3d3d8697dfba891906110d1908690615505565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b600860209081526000928352604080842090915290825290205460ff1681565b61112e614386565b6060600080600061113d614386565b60005460ff161561117a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117815589518a919081106111b257fe5b906020019060200201516101600151945088519350600092505b828414611255578489848151811015156111e257fe5b906020019060200201516101600181905250611202888760200151612f7d565b915061122e898481518110151561121557fe5b9060200190602002015183898681518110151561074957fe5b905061123a868261257d565b6020860151881161124a57611255565b6001909201916111cc565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509195945050505050565b606060006060600084519250826040519080825280602002602001820160405280156112d057816020015b6112bd6143de565b8152602001906001900390816112b55790505b509150600090505b808314610a88576112ff85828151811015156112f057fe5b90602001906020020151611f30565b828281518110151561130d57fe5b602090810290910101526001016112d8565b600760209081526000928352604080842090915290825290205460ff1681565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600080600080600089511115156113a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061571d565b6113ad89612fc4565b7f010000000000000000000000000000000000000000000000000000000000000090049650600760ff88161061140f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061563d565b8660ff16600781111561141e57fe5b9550600086600781111561142e57fe5b1415611466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061570d565b600186600781111561147457fe5b14156114bc578851156114b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157dd565b600097506118d0565b60028660078111156114ca57fe5b141561160557885160411461150b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155dd565b88600081518110151561151a57fe5b01602001517f010000000000000000000000000000000000000000000000000000000000000090819004810204945061155a89600163ffffffff61308816565b935061156d89602163ffffffff61308816565b925060018b86868660405160008152602001604052604051611592949392919061556e565b60206040516020810390808403906000865af11580156115b6573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff8c811690821614995092506118d09050565b600386600781111561161357fe5b14156117b9578851604114611654576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155dd565b88600081518110151561166357fe5b01602001517f01000000000000000000000000000000000000000000000000000000000000009081900481020494506116a389600163ffffffff61308816565b93506116b689602163ffffffff61308816565b925060018b60405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b6020831061175757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161171a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822060008352910192839052611592945092508991899150889061556e565b60048660078111156117c757fe5b14156117df576117d88b8b8b6130d3565b97506118d0565b60058660078111156117ed57fe5b1415611850576117fc89613228565b73ffffffffffffffffffffffffffffffffffffffff808c1660009081526008602090815260408083209385168352929052205490915060ff16151561184457600097506118d0565b6117d8818c8c8c6132a1565b600686600781111561185e57fe5b141561189e5760008b815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290205460ff1697506118d0565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061563d565b505050505050509392505050565b6118e6614386565b60606000806000806118f6614386565b89600081518110151561190557fe5b906020019060200201516101400151955089519450600093505b8385146119e457858a8581518110151561193557fe5b6020908102909101015161014001528651611951908a90612f7d565b92506119948a8581518110151561196457fe5b9060200190602002015160a001518b8681518110151561198057fe5b9060200190602002015160800151856133fd565b91506119c08a858151811015156119a757fe5b90602001906020020151838a87815181101515610e8e57fe5b90506119cc878261257d565b865189116119d9576119e4565b60019093019261191f565b5050505050509392505050565b6119f9614386565b60005460ff1615611a36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610f9c8484846124df565b600a5460009073ffffffffffffffffffffffffffffffffffffffff1615611abf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b611b02611afd888888888080601f01602080910402602001604051908101604052809392919081815260200183838082843750613453945050505050565b613694565b60008181526009602052604090205490915060ff1615611b4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061568d565b73ffffffffffffffffffffffffffffffffffffffff86163314611c1f57611ba6818785858080601f0160208091040260200160405190810160405280939291908181526020018383808284375061135b945050505050565b1515611bde576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157cd565b600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555b6000818152600960205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555130908690869080838380828437820191505092505050600060405180830381855af49150501515611cb6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156bd565b73ffffffffffffffffffffffffffffffffffffffff86163314611cfc57600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b50505050505050565b6003546000908190819073ffffffffffffffffffffffffffffffffffffffff163314611d5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061577d565b8392508273ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611dc457600080fd5b505af1158015611dd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611dfc9190810190614a0c565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600b602052604090205490925073ffffffffffffffffffffffffffffffffffffffff1690508015611e81576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061561d565b7fffffffff0000000000000000000000000000000000000000000000000000000082166000908152600b60205260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c0319490611f2290849087906155a3565b60405180910390a150505050565b611f386143de565b611f41826136d1565b6020808301829052600091825260049052604090819020549082015260808201511515611f755760015b60ff168152610f07565b60a08201511515611f87576002611f6b565b60a0820151604082015110611f9d576005611f6b565b6101008201514210611fb0576004611f6b565b60208082015160009081526005909152604090205460ff1615611fd4576006611f6b565b610120820151825173ffffffffffffffffffffffffffffffffffffffff90811660009081526006602090815260408083206060880151909416835292905220541115612021576006611f6b565b60038152919050565b60005460ff1615612067576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561209b81612eff565b50600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600660209081526000928352604080842090915290825290205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156121865780601f1061215b57610100808354040283529160200191612186565b820191906000526020600020905b81548152906001019060200180831161216957829003601f168201915b505050505081565b612196614386565b606060008060006121a5614386565b8860008151811015156121b457fe5b906020019060200201516101600151945088519350600092505b828414612257578489848151811015156121e457fe5b906020019060200201516101600181905250612204888760200151612f7d565b9150612230898481518110151561221757fe5b90602001906020020151838986815181101515610e8e57fe5b905061223c868261257d565b6020860151881161224c57612257565b6001909201916121ce565b50505050509392505050565b60025481565b612271614386565b6060600080600080612281614386565b60005460ff16156122be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558a518b919081106122f657fe5b906020019060200201516101400151955089519450600093505b8385146123a557858a8581518110151561232657fe5b6020908102909101015161014001528651612342908a90612f7d565b92506123558a8581518110151561196457fe5b91506123818a8581518110151561236857fe5b90602001906020020151838a8781518110151561074957fe5b905061238d878261257d565b8651891161239a576123a5565b600190930192612310565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550929695505050505050565b600a5473ffffffffffffffffffffffffffffffffffffffff1681565b60035473ffffffffffffffffffffffffffffffffffffffff163314612448576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061577d565b73ffffffffffffffffffffffffffffffffffffffff8116156124a557600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60408051808201909152600581527f322e302e30000000000000000000000000000000000000000000000000000000602082015281565b6124e7614386565b6124ef6143de565b60008060006124fd88611f30565b93506125076125df565b925061251588858589612611565b6125278860a001518560400151612f7d565b915061253387836136df565b9050612546888589848960000151612990565b61255088826136f5565b945061256788848660200151876040015189612aa9565b612572888487613756565b505050509392505050565b8151815161258b9190613864565b8252602080830151908201516125a19190613864565b6020830152604080830151908201516125ba9190613864565b6040830152606080830151908201516125d39190613864565b60609092019190915250565b600a5460009073ffffffffffffffffffffffffffffffffffffffff16818115612608578161260a565b335b9392505050565b825160ff1660031461264f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061579d565b606084015173ffffffffffffffffffffffffffffffffffffffff16156126c257606084015173ffffffffffffffffffffffffffffffffffffffff1633146126c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157ad565b602084015173ffffffffffffffffffffffffffffffffffffffff161561274d578173ffffffffffffffffffffffffffffffffffffffff16846020015173ffffffffffffffffffffffffffffffffffffffff1614151561274d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155ed565b604083015115156127a35761276b836020015185600001518361135b565b15156127a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061565d565b50505050565b6127bb8260a001518260a001516138ae565b6127cd836080015183608001516138ae565b1015612805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157bd565b5050565b6128116143af565b6000806000806128258960a0015188612f7d565b935061283a89608001518a60a0015186613909565b925061284a8860a0015187612f7d565b915061285f88608001518960a0015184613909565b90508084106128a25760208086018051839052805182018490525151865182015260808a015160a08b015187519092015161289a9290613909565b8551526128df565b845183905284516020908101859052855181015190860180519190915260a089015160808a01519151516128d69290613986565b60208087015101525b84515160208087015101516128f49190612f7d565b604086015284515160808a015160c08b0151612911929190613909565b85516040015284516020015160a08a015160e08b0151612932929190613909565b855160600152602085015151608089015160c08a0151612953929190613909565b8560200151604001818152505061297b8560200151602001518960a001518a60e00151613909565b60208601516060015250505050949350505050565b8215156129c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156dd565b82821115612a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156cd565b8460a00151612a16856040015184613864565b1115612a4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155fd565b612a5c8560800151836138ae565b612a6a828760a001516138ae565b1115612aa2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061575d565b5050505050565b612ab7828260200151613864565b600084815260046020908152604091829020929092558681015187518451938501518584015160608701516101408c01516101608d015196518b9873ffffffffffffffffffffffffffffffffffffffff9788169897909616967f0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c37112996612b46968f96339692959194909390615433565b60405180910390a45050505050565b60018054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008789161502019095169490940493840181900481028201810190925282815260609390929091830182828015612bfe5780601f10612bd357610100808354040283529160200191612bfe565b820191906000526020600020905b815481529060010190602001808311612be157829003601f168201915b50505050509050612c2685610140015186600001518660000151856020015160200151613a23565b61014084015184518651845160200151612c4293929190613a23565b612c5b8561014001518660000151858560400151613a23565b612c778186600001518760400151856000015160400151613a23565b612c938185600001518660400151856020015160400151613a23565b836040015173ffffffffffffffffffffffffffffffffffffffff16856040015173ffffffffffffffffffffffffffffffffffffffff161415612cfd57612cf881848760400151612cf3866000015160600151876020015160600151613864565b613a23565b612aa2565b612d1581848760400151856000015160600151613a23565b612aa281848660400151856020015160600151613a23565b604080517fb4be83d5000000000000000000000000000000000000000000000000000000006020808301919091526060602483018181528751608485019081528884015160a48601529488015160c48501529087015160e4840152608087015161010484015260a087015161012484015260c087015161014484015260e08701516101648401526101008701516101848401526101208701516101a4840152610140870180516101c485019081526101608901516101e4860152610180905251805161020485018190529394919384936044870192849261022489019291820191601f82010460005b81811015612e34578351855260209485019490930192600101612e16565b50505050818103610160808401919091528a0151805180835260209283019291820191601f82010460005b81811015612e7d578351855260209485019490930192600101612e5f565b50505089845250848103602093840190815288518083529093918201918981019190601f82010460005b81811015612ec5578351855260209485019490930192600101612ea7565b5050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08883030188525060405250505050509392505050565b612f076143de565b612f1082611f30565b9050612f1c8282613bed565b612805828260200151613d04565b612f32614386565b612f3d8484846124df565b6020810151909150831461260a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061574d565b600082821115612fb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061560d565b508082035b92915050565b6000808251111515613002576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156fd565b815182907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061303257fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909252507f0100000000000000000000000000000000000000000000000000000000000000908190040290565b6000816020018351101515156130ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061562d565b50016020015190565b6040516000906060907f1626ba7e000000000000000000000000000000000000000000000000000000009061310e908790869060240161554e565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093178352815191935090829081885afa8080156131ab576001811461321c57612572565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0c57414c4c45545f4552524f5200000000000000000000000000000000604052600060605260646000fd5b50505195945050505050565b60006014825110151515613268576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061578d565b613276826014845103613dab565b82517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec019092525090565b6040516000906060907f9363470200000000000000000000000000000000000000000000000000000000906132de90879087908790602401615521565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931783528151919350908290818a5afa80801561337b57600181146133ec576133f1565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f56414c494441544f525f4552524f5200000000000000000000000000604052600060605260646000fd5b825194505b50505050949350505050565b6000808311613438576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b61344b61344585846138ae565b84613e0c565b949350505050565b604080517f5a65726f45785472616e73616374696f6e2800000000000000000000000000006020808301919091527f75696e743235362073616c742c0000000000000000000000000000000000000060328301527f61646472657373207369676e6572416464726573732c00000000000000000000603f8301527f627974657320646174610000000000000000000000000000000000000000000060558301527f2900000000000000000000000000000000000000000000000000000000000000605f830152825180830384018152606090920192839052815160009384938493909282918401908083835b6020831061357c57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161353f565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260405191909301819003812089519097508995509093508392850191508083835b6020831061361257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016135d5565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822097825281019a909a525073ffffffffffffffffffffffffffffffffffffffff97909716968801969096525050606085015250506080909120919050565b600280546040517f190100000000000000000000000000000000000000000000000000000000000081529182015260228101919091526042902090565b6000612fbe611afd83613e23565b60008183106136ee578161260a565b5090919050565b6136fd614386565b6020810182905260a08301516080840151613719918491613909565b808252608084015160c0850151613731929190613909565b604082015260a083015160e084015161374b918491613909565b606082015292915050565b60018054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156137ff5780601f106137d4576101008083540402835291602001916137ff565b820191906000526020600020905b8154815290600101906020018083116137e257829003601f168201915b5050505050905061381f8461014001518560000151858560000151613a23565b6138388461016001518486600001518560200151613a23565b61385081856000015186604001518560400151613a23565b6127a3818486604001518560600151613a23565b6000828201838110156138a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567d565b8091505b5092915050565b6000808315156138c157600091506138a7565b508282028284828115156138d157fe5b04146138a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567d565b6000808311613944576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b61394f84848461427c565b15613438576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156ad565b60008083116139c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b6139cc848484614301565b15613a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156ad565b61344b613445613a1386856138ae565b613a1e866001612f7d565b613864565b600080600083118015613a6257508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15613be5578551600310613aa2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061573d565b50506020848101517fffffffff00000000000000000000000000000000000000000000000000000000166000818152600b90925260409091205473ffffffffffffffffffffffffffffffffffffffff16801515613b2b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156ed565b604051660fffffffffffe0603f885101168060840182017fa85e59e40000000000000000000000000000000000000000000000000000000083526080600484015273ffffffffffffffffffffffffffffffffffffffff8816602484015273ffffffffffffffffffffffffffffffffffffffff87166044840152856064840152608483015b81811015613bc757895181526020998a019901613baf565b61020084858403866000895af1801515613bdf573d85fd5b50505050505b505050505050565b805160009060ff16600314613c2e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061579d565b606083015173ffffffffffffffffffffffffffffffffffffffff1615613ca157606083015173ffffffffffffffffffffffffffffffffffffffff163314613ca1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157ad565b613ca96125df565b835190915073ffffffffffffffffffffffffffffffffffffffff808316911614613cff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061566d565b505050565b6000818152600560205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558281015183516101408501516101608601519351859473ffffffffffffffffffffffffffffffffffffffff9485169493909316927fdc47b3613d9fe400085f6dbdc99453462279057e6207385042827ed6b1a62cf792613d9f923392906154b7565b60405180910390a45050565b600081601401835110151515613ded576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061578d565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000808284811515613e1a57fe5b04949350505050565b604080517f4f726465722800000000000000000000000000000000000000000000000000006020808301919091527f61646472657373206d616b6572416464726573732c000000000000000000000060268301527f616464726573732074616b6572416464726573732c0000000000000000000000603b8301527f6164647265737320666565526563697069656e74416464726573732c0000000060508301527f616464726573732073656e646572416464726573732c00000000000000000000606c8301527f75696e74323536206d616b65724173736574416d6f756e742c0000000000000060828301527f75696e743235362074616b65724173736574416d6f756e742c00000000000000609b8301527f75696e74323536206d616b65724665652c00000000000000000000000000000060b48301527f75696e743235362074616b65724665652c00000000000000000000000000000060c58301527f75696e743235362065787069726174696f6e54696d655365636f6e64732c000060d68301527f75696e743235362073616c742c0000000000000000000000000000000000000060f48301527f6279746573206d616b65724173736574446174612c00000000000000000000006101018301527f62797465732074616b65724173736574446174610000000000000000000000006101168301527f290000000000000000000000000000000000000000000000000000000000000061012a830152825161010b81840301815261012b90920192839052815160009384938493849391929182918401908083835b602083106140ab57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161406e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101408b0151805191995095509093508392850191508083835b6020831061414657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101614109565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101608b0151805191985095509093508392850191508083835b602083106141e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016141a4565b5181516020939093036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909116921691909117905260405192018290039091207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0890180516101408b018051610160909c0180519a84529881529288526101a0822091529890525050509190525090919050565b6000808084116142b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b8215806142c3575084155b156142d15760009150610a88565b838015156142db57fe5b85840990506142ea85846138ae565b6142f66103e8836138ae565b101595945050505050565b60008080841161433d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b821580614348575084155b156143565760009150610a88565b8380151561436057fe5b8584099050836143708583612f7d565b81151561437957fe5b0690506142ea85846138ae565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b610120604051908101604052806143c4614386565b81526020016143d1614386565b8152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b600061260a82356158b0565b6000601f8201831361441b57600080fd5b813561442e6144298261583f565b615818565b81815260209384019390925082018360005b8381101561446c578135860161445688826145bc565b8452506020928301929190910190600101614440565b5050505092915050565b6000601f8201831361448757600080fd5b81356144956144298261583f565b81815260209384019390925082018360005b8381101561446c57813586016144bd888261460b565b84525060209283019291909101906001016144a7565b6000601f820183136144e457600080fd5b81356144f26144298261583f565b9150818183526020840193506020810190508385602084028201111561451757600080fd5b60005b8381101561446c578161452d888261454f565b845250602092830192919091019060010161451a565b600061260a82356158c9565b600061260a82356158ce565b600061260a82356158d1565b600061260a82516158d1565b600080601f8301841361458557600080fd5b50813567ffffffffffffffff81111561459d57600080fd5b6020830191508360018202830111156145b557600080fd5b9250929050565b6000601f820183136145cd57600080fd5b81356145db61442982615860565b915080825260208301602083018583830111156145f757600080fd5b614602838284615907565b50505092915050565b6000610180828403121561461e57600080fd5b614629610180615818565b9050600061463784846143fe565b8252506020614648848483016143fe565b602083015250604061465c848285016143fe565b6040830152506060614670848285016143fe565b60608301525060806146848482850161454f565b60808301525060a06146988482850161454f565b60a08301525060c06146ac8482850161454f565b60c08301525060e06146c08482850161454f565b60e0830152506101006146d58482850161454f565b610100830152506101206146eb8482850161454f565b6101208301525061014082013567ffffffffffffffff81111561470d57600080fd5b614719848285016145bc565b6101408301525061016082013567ffffffffffffffff81111561473b57600080fd5b614747848285016145bc565b6101608301525092915050565b60006020828403121561476657600080fd5b600061344b84846143fe565b6000806040838503121561478557600080fd5b600061479185856143fe565b92505060206147a2858286016143fe565b9150509250929050565b600080604083850312156147bf57600080fd5b60006147cb85856143fe565b92505060206147a285828601614543565b6000602082840312156147ee57600080fd5b813567ffffffffffffffff81111561480557600080fd5b61344b84828501614476565b60008060006060848603121561482657600080fd5b833567ffffffffffffffff81111561483d57600080fd5b61484986828701614476565b935050602084013567ffffffffffffffff81111561486657600080fd5b614872868287016144d3565b925050604084013567ffffffffffffffff81111561488f57600080fd5b61489b8682870161440a565b9150509250925092565b6000806000606084860312156148ba57600080fd5b833567ffffffffffffffff8111156148d157600080fd5b6148dd86828701614476565b93505060206148728682870161454f565b60006020828403121561490057600080fd5b600061344b848461454f565b6000806040838503121561491f57600080fd5b6000614791858561454f565b6000806000806060858703121561494157600080fd5b600061494d878761454f565b945050602061495e878288016143fe565b935050604085013567ffffffffffffffff81111561497b57600080fd5b61498787828801614573565b95989497509550505050565b6000806000606084860312156149a857600080fd5b60006149b4868661454f565b93505060206149c5868287016143fe565b925050604084013567ffffffffffffffff8111156149e257600080fd5b61489b868287016145bc565b600060208284031215614a0057600080fd5b600061344b848461455b565b600060208284031215614a1e57600080fd5b600061344b8484614567565b600060208284031215614a3c57600080fd5b813567ffffffffffffffff811115614a5357600080fd5b61344b8482850161460b565b60008060008060808587031215614a7557600080fd5b843567ffffffffffffffff811115614a8c57600080fd5b614a988782880161460b565b945050602085013567ffffffffffffffff811115614ab557600080fd5b614ac18782880161460b565b935050604085013567ffffffffffffffff811115614ade57600080fd5b614aea878288016145bc565b925050606085013567ffffffffffffffff811115614b0757600080fd5b614b13878288016145bc565b91505092959194509250565b600080600060608486031215614b3457600080fd5b833567ffffffffffffffff811115614b4b57600080fd5b614b578682870161460b565b93505060206149c58682870161454f565b60008060008060008060808789031215614b8157600080fd5b6000614b8d898961454f565b9650506020614b9e89828a016143fe565b955050604087013567ffffffffffffffff811115614bbb57600080fd5b614bc789828a01614573565b9450945050606087013567ffffffffffffffff811115614be657600080fd5b614bf289828a01614573565b92509250509295509295509295565b614c0a816158b0565b82525050565b6000614c1b826158ac565b808452602084019350614c2d836158a6565b60005b82811015614c5d57614c438683516153e5565b614c4c826158a6565b606096909601959150600101614c30565b5093949350505050565b614c0a816158c9565b614c0a816158ce565b614c0a816158d1565b6000614c8d826158ac565b808452614ca1816020860160208601615913565b614caa8161593f565b9093016020019392505050565b614c0a816158fc565b601281527f4c454e4754485f36355f52455155495245440000000000000000000000000000602082015260400190565b600d81527f494e56414c49445f54414b455200000000000000000000000000000000000000602082015260400190565b600e81527f4f524445525f4f56455246494c4c000000000000000000000000000000000000602082015260400190565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f414c52454144595f455849535453000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601581527f5349474e41545552455f554e535550504f525445440000000000000000000000602082015260400190565b601081527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000602082015260400190565b601781527f494e56414c49445f4f524445525f5349474e4154555245000000000000000000602082015260400190565b600d81527f494e56414c49445f4d414b455200000000000000000000000000000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b600f81527f494e56414c49445f54585f484153480000000000000000000000000000000000602082015260400190565b601181527f494e56414c49445f5349474e4154555245000000000000000000000000000000602082015260400190565b600e81527f524f554e44494e475f4552524f52000000000000000000000000000000000000602082015260400190565b601081527f4641494c45445f455845435554494f4e00000000000000000000000000000000602082015260400190565b600d81527f54414b45525f4f56455250415900000000000000000000000000000000000000602082015260400190565b601481527f494e56414c49445f54414b45525f414d4f554e54000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f444f45535f4e4f545f4558495354000000000000602082015260400190565b602181527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560208201527f4400000000000000000000000000000000000000000000000000000000000000604082015260600190565b601181527f5349474e41545552455f494c4c4547414c000000000000000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f305f52455155495245440000602082015260400190565b601781527f494e56414c49445f4e45575f4f524445525f45504f4348000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f335f52455155495245440000602082015260400190565b601481527f434f4d504c4554455f46494c4c5f4641494c4544000000000000000000000000602082015260400190565b601281527f494e56414c49445f46494c4c5f50524943450000000000000000000000000000602082015260400190565b601281527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000602082015260400190565b601381527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601081527f4f524445525f554e46494c4c41424c4500000000000000000000000000000000602082015260400190565b600e81527f494e56414c49445f53454e444552000000000000000000000000000000000000602082015260400190565b601881527f4e454741544956455f5350524541445f52455155495245440000000000000000602082015260400190565b601481527f494e56414c49445f54585f5349474e4154555245000000000000000000000000602082015260400190565b601181527f4c454e4754485f305f5245515549524544000000000000000000000000000000602082015260400190565b805160808301906153738482614c70565b5060208201516153866020850182614c70565b5060408201516153996040850182614c70565b5060608201516127a36060850182614c70565b80516101208301906153be8482615362565b5060208201516153d16080850182615362565b5060408201516127a3610100850182614c70565b805160608301906153f6848261541c565b5060208201516154096020850182614c70565b5060408201516127a36040850182614c70565b614c0a816158f6565b60208101612fbe8284614c01565b6101008101615442828b614c01565b61544f602083018a614c01565b61545c6040830189614c70565b6154696060830188614c70565b6154766080830187614c70565b61548360a0830186614c70565b81810360c08301526154958185614c82565b905081810360e08301526154a98184614c82565b9a9950505050505050505050565b606081016154c58286614c01565b81810360208301526154d78185614c82565b905081810360408301526154eb8184614c82565b95945050505050565b6020808252810161260a8184614c10565b60208101612fbe8284614c67565b60208101612fbe8284614c70565b6060810161552f8286614c70565b61553c6020830185614c01565b81810360408301526154eb8184614c82565b6040810161555c8285614c70565b818103602083015261344b8184614c82565b6080810161557c8287614c70565b615589602083018661541c565b6155966040830185614c70565b6154eb6060830184614c70565b604081016155b18285614c79565b61260a6020830184614c01565b6020808252810161260a8184614c82565b60208101612fbe8284614cb7565b60208082528101612fbe81614cc0565b60208082528101612fbe81614cf0565b60208082528101612fbe81614d20565b60208082528101612fbe81614d50565b60208082528101612fbe81614d80565b60208082528101612fbe81614db0565b60208082528101612fbe81614e06565b60208082528101612fbe81614e36565b60208082528101612fbe81614e66565b60208082528101612fbe81614e96565b60208082528101612fbe81614ec6565b60208082528101612fbe81614ef6565b60208082528101612fbe81614f26565b60208082528101612fbe81614f56565b60208082528101612fbe81614f86565b60208082528101612fbe81614fb6565b60208082528101612fbe81614fe6565b60208082528101612fbe81615016565b60208082528101612fbe81615046565b60208082528101612fbe8161509c565b60208082528101612fbe816150cc565b60208082528101612fbe816150fc565b60208082528101612fbe8161512c565b60208082528101612fbe8161515c565b60208082528101612fbe8161518c565b60208082528101612fbe816151bc565b60208082528101612fbe816151ec565b60208082528101612fbe8161521c565b60208082528101612fbe81615272565b60208082528101612fbe816152a2565b60208082528101612fbe816152d2565b60208082528101612fbe81615302565b60208082528101612fbe81615332565b60808101612fbe8284615362565b6101208101612fbe82846153ac565b60608101612fbe82846153e5565b60405181810167ffffffffffffffff8111828210171561583757600080fd5b604052919050565b600067ffffffffffffffff82111561585657600080fd5b5060209081020190565b600067ffffffffffffffff82111561587757600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b6000612fbe826158b0565b82818337506000910152565b60005b8381101561592e578181015183820152602001615916565b838111156127a35750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820d41ee66f45c4d1637cb6e5f109447c6d5d7fef3204a685dc442151c0f029b7da6c6578706572696d656e74616cf50037"
}
}
},
diff --git a/packages/contract-artifacts/package.json b/packages/contract-artifacts/package.json
index 9c25e3ac5..71d887545 100644
--- a/packages/contract-artifacts/package.json
+++ b/packages/contract-artifacts/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/contract-artifacts",
- "version": "1.1.0",
+ "version": "1.1.2",
"engines": {
"node": ">=6.12"
},
diff --git a/packages/contract-artifacts/src/index.ts b/packages/contract-artifacts/src/index.ts
index f30276dd9..bd5f8fee3 100644
--- a/packages/contract-artifacts/src/index.ts
+++ b/packages/contract-artifacts/src/index.ts
@@ -1,4 +1,5 @@
import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json';
+import * as DutchAuction from '../artifacts/DutchAuction.json';
import * as DummyERC20Token from '../artifacts/DummyERC20Token.json';
import * as DummyERC721Token from '../artifacts/DummyERC721Token.json';
import * as ERC20Proxy from '../artifacts/ERC20Proxy.json';
@@ -15,6 +16,7 @@ import * as ZRXToken from '../artifacts/ZRXToken.json';
export {
AssetProxyOwner,
+ DutchAuction,
DummyERC20Token,
DummyERC721Token,
ERC20Proxy,
diff --git a/packages/contract-artifacts/tsconfig.json b/packages/contract-artifacts/tsconfig.json
index cce086209..59169fceb 100644
--- a/packages/contract-artifacts/tsconfig.json
+++ b/packages/contract-artifacts/tsconfig.json
@@ -8,6 +8,7 @@
"include": ["./src/**/*"],
"files": [
"./artifacts/AssetProxyOwner.json",
+ "./artifacts/DutchAuction.json",
"./artifacts/DummyERC20Token.json",
"./artifacts/DummyERC721Token.json",
"./artifacts/ERC20Proxy.json",
diff --git a/packages/contract-wrappers/.npmignore b/packages/contract-wrappers/.npmignore
index 6a3eb57bd..6a222fd45 100644
--- a/packages/contract-wrappers/.npmignore
+++ b/packages/contract-wrappers/.npmignore
@@ -5,7 +5,7 @@ yarn-error.log
test/
/src/
/_bundles/
-/contract_templates/
+/abi-gen-templates/
/generated_docs/
/scripts/
/lib/src/monorepo_scripts/
diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json
index 1ea966fc6..677292030 100644
--- a/packages/contract-wrappers/CHANGELOG.json
+++ b/packages/contract-wrappers/CHANGELOG.json
@@ -1,5 +1,53 @@
[
{
+ "version": "4.2.0",
+ "changes": [
+ {
+ "note": "Added Dutch Auction wrapper",
+ "pr": 1465
+ }
+ ]
+ },
+ {
+ "version": "4.1.4",
+ "changes": [
+ {
+ "note": "Add support for Trust Wallet signature denial error"
+ },
+ {
+ "note": "Add balance and allowance queries for `MultiAssetProxy`",
+ "pr": 1363
+ }
+ ]
+ },
+ {
+ "version": "4.1.3",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "4.1.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "4.1.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "4.1.0",
"changes": [
{
@@ -7,7 +55,8 @@
"Add a `nonce` field for `TxOpts` so that it's now possible to re-broadcast stuck transactions with a higher gas amount",
"pr": 1292
}
- ]
+ ],
+ "timestamp": 1542821676
},
{
"timestamp": 1542208198,
diff --git a/packages/contract-wrappers/CHANGELOG.md b/packages/contract-wrappers/CHANGELOG.md
index eca1b4633..595fbcc31 100644
--- a/packages/contract-wrappers/CHANGELOG.md
+++ b/packages/contract-wrappers/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v4.1.3 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v4.1.2 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v4.1.1 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v4.1.0 - _November 21, 2018_
+
+ * Add a `nonce` field for `TxOpts` so that it's now possible to re-broadcast stuck transactions with a higher gas amount (#1292)
+
## v4.0.2 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json
index 2d6b4e3f8..e4de75ab2 100644
--- a/packages/contract-wrappers/package.json
+++ b/packages/contract-wrappers/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
- "version": "4.0.2",
+ "version": "4.1.3",
"description": "Smart TS wrappers for 0x smart contracts",
"keywords": [
"0xproject",
@@ -37,10 +37,10 @@
"node": ">=6.0.0"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.17",
- "@0x/migrations": "^2.0.4",
- "@0x/subproviders": "^2.1.4",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/migrations": "^2.2.2",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/node": "*",
@@ -65,18 +65,20 @@
"web3-provider-engine": "14.0.6"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^1.0.5",
- "@0x/assert": "^1.0.17",
- "@0x/contract-addresses": "^1.1.0",
- "@0x/contract-artifacts": "^1.1.0",
- "@0x/fill-scenarios": "^1.0.12",
- "@0x/json-schemas": "^2.1.1",
- "@0x/order-utils": "^3.0.2",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
- "ethereum-types": "^1.1.2",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/assert": "^1.0.20",
+ "@0x/contract-addresses": "^2.0.0",
+ "@0x/contract-artifacts": "^1.1.2",
+ "@0x/contracts-test-utils": "^1.0.2",
+ "@0x/fill-scenarios": "^1.0.16",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereumjs-abi": "0.6.5",
+ "ethereum-types": "^1.1.4",
"ethereumjs-blockstream": "6.0.0",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts
index 0c535bd5c..4e594593e 100644
--- a/packages/contract-wrappers/src/contract_wrappers.ts
+++ b/packages/contract-wrappers/src/contract_wrappers.ts
@@ -12,6 +12,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
import * as _ from 'lodash';
+import { DutchAuctionWrapper } from './contract_wrappers/dutch_auction_wrapper';
import { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper';
import { ERC20TokenWrapper } from './contract_wrappers/erc20_token_wrapper';
import { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper';
@@ -65,6 +66,10 @@ export class ContractWrappers {
* An instance of the OrderValidatorWrapper class containing methods for interacting with any OrderValidator smart contract.
*/
public orderValidator: OrderValidatorWrapper;
+ /**
+ * An instance of the DutchAuctionWrapper class containing methods for interacting with any DutchAuction smart contract.
+ */
+ public dutchAuction: DutchAuctionWrapper;
private readonly _web3Wrapper: Web3Wrapper;
/**
@@ -141,6 +146,11 @@ export class ContractWrappers {
config.networkId,
contractAddresses.orderValidator,
);
+ this.dutchAuction = new DutchAuctionWrapper(
+ this._web3Wrapper,
+ config.networkId,
+ contractAddresses.dutchAuction,
+ );
}
/**
* Unsubscribes from all subscriptions for all contracts.
diff --git a/packages/contract-wrappers/src/contract_wrappers/dutch_auction_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/dutch_auction_wrapper.ts
new file mode 100644
index 000000000..c1aceff47
--- /dev/null
+++ b/packages/contract-wrappers/src/contract_wrappers/dutch_auction_wrapper.ts
@@ -0,0 +1,182 @@
+import { DutchAuctionContract } from '@0x/abi-gen-wrappers';
+import { DutchAuction } from '@0x/contract-artifacts';
+import { schemas } from '@0x/json-schemas';
+import { assetDataUtils } from '@0x/order-utils';
+import { DutchAuctionDetails, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import { ContractAbi } from 'ethereum-types';
+import * as ethAbi from 'ethereumjs-abi';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { orderTxOptsSchema } from '../schemas/order_tx_opts_schema';
+import { txOptsSchema } from '../schemas/tx_opts_schema';
+import { DutchAuctionData, DutchAuctionWrapperError, OrderTransactionOpts } from '../types';
+import { assert } from '../utils/assert';
+import { _getDefaultContractAddresses } from '../utils/contract_addresses';
+
+import { ContractWrapper } from './contract_wrapper';
+
+export class DutchAuctionWrapper extends ContractWrapper {
+ public abi: ContractAbi = DutchAuction.compilerOutput.abi;
+ public address: string;
+ private _dutchAuctionContractIfExists?: DutchAuctionContract;
+ /**
+ * Dutch auction details are encoded with the asset data for a 0x order. This function produces a hex
+ * encoded assetData string, containing information both about the asset being traded and the
+ * dutch auction; which is usable in the makerAssetData or takerAssetData fields in a 0x order.
+ * @param assetData Hex encoded assetData string for the asset being auctioned.
+ * @param beginTimeSeconds Begin time of the dutch auction.
+ * @param beginAmount Starting amount being sold in the dutch auction.
+ * @return The hex encoded assetData string.
+ */
+ public static encodeDutchAuctionAssetData(
+ assetData: string,
+ beginTimeSeconds: BigNumber,
+ beginAmount: BigNumber,
+ ): string {
+ const assetDataBuffer = ethUtil.toBuffer(assetData);
+ const abiEncodedAuctionData = (ethAbi as any).rawEncode(
+ ['uint256', 'uint256'],
+ [beginTimeSeconds.toString(), beginAmount.toString()],
+ );
+ const abiEncodedAuctionDataBuffer = ethUtil.toBuffer(abiEncodedAuctionData);
+ const dutchAuctionDataBuffer = Buffer.concat([assetDataBuffer, abiEncodedAuctionDataBuffer]);
+ const dutchAuctionData = ethUtil.bufferToHex(dutchAuctionDataBuffer);
+ return dutchAuctionData;
+ }
+ /**
+ * Dutch auction details are encoded with the asset data for a 0x order. This function decodes a hex
+ * encoded assetData string, containing information both about the asset being traded and the
+ * dutch auction.
+ * @param dutchAuctionData Hex encoded assetData string for the asset being auctioned.
+ * @return An object containing the auction asset, auction begin time and auction begin amount.
+ */
+ public static decodeDutchAuctionData(dutchAuctionData: string): DutchAuctionData {
+ const dutchAuctionDataBuffer = ethUtil.toBuffer(dutchAuctionData);
+ // Decode asset data
+ const dutchAuctionDataLengthInBytes = 64;
+ const assetDataBuffer = dutchAuctionDataBuffer.slice(
+ 0,
+ dutchAuctionDataBuffer.byteLength - dutchAuctionDataLengthInBytes,
+ );
+ const assetDataHex = ethUtil.bufferToHex(assetDataBuffer);
+ const assetData = assetDataUtils.decodeAssetDataOrThrow(assetDataHex);
+ // Decode auction details
+ const dutchAuctionDetailsBuffer = dutchAuctionDataBuffer.slice(
+ dutchAuctionDataBuffer.byteLength - dutchAuctionDataLengthInBytes,
+ );
+ const [beginTimeSecondsAsBN, beginAmountAsBN] = ethAbi.rawDecode(
+ ['uint256', 'uint256'],
+ dutchAuctionDetailsBuffer,
+ );
+ const beginTimeSeconds = new BigNumber(`0x${beginTimeSecondsAsBN.toString()}`);
+ const beginAmount = new BigNumber(`0x${beginAmountAsBN.toString()}`);
+ return {
+ assetData,
+ beginTimeSeconds,
+ beginAmount,
+ };
+ }
+ /**
+ * Instantiate DutchAuctionWrapper
+ * @param web3Wrapper Web3Wrapper instance to use.
+ * @param networkId Desired networkId.
+ * @param address The address of the Dutch Auction contract. If undefined, will
+ * default to the known address corresponding to the networkId.
+ */
+ public constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
+ super(web3Wrapper, networkId);
+ this.address = _.isUndefined(address) ? _getDefaultContractAddresses(networkId).dutchAuction : address;
+ }
+ /**
+ * Matches the buy and sell orders at an amount given the following: the current block time, the auction
+ * start time and the auction begin amount. The sell order is a an order at the lowest amount
+ * at the end of the auction. Excess from the match is transferred to the seller.
+ * Over time the price moves from beginAmount to endAmount given the current block.timestamp.
+ * @param buyOrder The Buyer's order. This order is for the current expected price of the auction.
+ * @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
+ * @param takerAddress The user Ethereum address who would like to fill this order. Must be available via the supplied
+ * Provider provided at instantiation.
+ * @return Transaction hash.
+ */
+ public async matchOrdersAsync(
+ buyOrder: SignedOrder,
+ sellOrder: SignedOrder,
+ takerAddress: string,
+ orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true },
+ ): Promise<string> {
+ // type assertions
+ assert.doesConformToSchema('buyOrder', buyOrder, schemas.signedOrderSchema);
+ assert.doesConformToSchema('sellOrder', sellOrder, schemas.signedOrderSchema);
+ await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
+ assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]);
+ const normalizedTakerAddress = takerAddress.toLowerCase();
+ // other assertions
+ if (
+ sellOrder.makerAssetData !== buyOrder.takerAssetData ||
+ sellOrder.takerAssetData !== buyOrder.makerAssetData
+ ) {
+ throw new Error(DutchAuctionWrapperError.AssetDataMismatch);
+ }
+ // get contract
+ const dutchAuctionInstance = await this._getDutchAuctionContractAsync();
+ // validate transaction
+ if (orderTransactionOpts.shouldValidate) {
+ await dutchAuctionInstance.matchOrders.callAsync(
+ buyOrder,
+ sellOrder,
+ buyOrder.signature,
+ sellOrder.signature,
+ {
+ from: normalizedTakerAddress,
+ gas: orderTransactionOpts.gasLimit,
+ gasPrice: orderTransactionOpts.gasPrice,
+ nonce: orderTransactionOpts.nonce,
+ },
+ );
+ }
+ // send transaction
+ const txHash = await dutchAuctionInstance.matchOrders.sendTransactionAsync(
+ buyOrder,
+ sellOrder,
+ buyOrder.signature,
+ sellOrder.signature,
+ {
+ from: normalizedTakerAddress,
+ gas: orderTransactionOpts.gasLimit,
+ gasPrice: orderTransactionOpts.gasPrice,
+ nonce: orderTransactionOpts.nonce,
+ },
+ );
+ return txHash;
+ }
+ /**
+ * Fetches the Auction Details for the given order
+ * @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
+ * @return The dutch auction details.
+ */
+ public async getAuctionDetailsAsync(sellOrder: SignedOrder): Promise<DutchAuctionDetails> {
+ // type assertions
+ assert.doesConformToSchema('sellOrder', sellOrder, schemas.signedOrderSchema);
+ // get contract
+ const dutchAuctionInstance = await this._getDutchAuctionContractAsync();
+ // call contract
+ const auctionDetails = await dutchAuctionInstance.getAuctionDetails.callAsync(sellOrder);
+ return auctionDetails;
+ }
+ private async _getDutchAuctionContractAsync(): Promise<DutchAuctionContract> {
+ if (!_.isUndefined(this._dutchAuctionContractIfExists)) {
+ return this._dutchAuctionContractIfExists;
+ }
+ const contractInstance = new DutchAuctionContract(
+ this.abi,
+ this.address,
+ this._web3Wrapper.getProvider(),
+ this._web3Wrapper.getContractDefaults(),
+ );
+ this._dutchAuctionContractIfExists = contractInstance;
+ return this._dutchAuctionContractIfExists;
+ }
+}
diff --git a/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts b/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
index d10cffe57..1ff130a48 100644
--- a/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
+++ b/packages/contract-wrappers/src/fetchers/asset_balance_and_proxy_allowance_fetcher.ts
@@ -1,8 +1,7 @@
-// tslint:disable:no-unnecessary-type-assertion
import { AbstractBalanceAndProxyAllowanceFetcher, assetDataUtils } from '@0x/order-utils';
-import { AssetProxyId, ERC20AssetData, ERC721AssetData } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { BlockParamLiteral } from 'ethereum-types';
+import * as _ from 'lodash';
import { ERC20TokenWrapper } from '../contract_wrappers/erc20_token_wrapper';
import { ERC721TokenWrapper } from '../contract_wrappers/erc721_token_wrapper';
@@ -18,42 +17,45 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
}
public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
- if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
- const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
- const balance = await this._erc20Token.getBalanceAsync(decodedERC20AssetData.tokenAddress, userAddress, {
+ let balance: BigNumber | undefined;
+ if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
+ balance = await this._erc20Token.getBalanceAsync(decodedAssetData.tokenAddress, userAddress, {
defaultBlock: this._stateLayer,
});
- return balance;
- } else {
- const decodedERC721AssetData = decodedAssetData as ERC721AssetData;
+ } else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
const tokenOwner = await this._erc721Token.getOwnerOfAsync(
- decodedERC721AssetData.tokenAddress,
- decodedERC721AssetData.tokenId,
+ decodedAssetData.tokenAddress,
+ decodedAssetData.tokenId,
{
defaultBlock: this._stateLayer,
},
);
- const balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0);
- return balance;
+ balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0);
+ } else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
+ // The `balance` for MultiAssetData is the total units of the entire `assetData` that are held by the `userAddress`.
+ for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
+ const nestedAmountElement = decodedAssetData.amounts[index];
+ const nestedAssetBalance = (await this.getBalanceAsync(
+ nestedAssetDataElement,
+ userAddress,
+ )).dividedToIntegerBy(nestedAmountElement);
+ if (_.isUndefined(balance) || nestedAssetBalance.lessThan(balance)) {
+ balance = nestedAssetBalance;
+ }
+ }
}
+ return balance as BigNumber;
}
public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
- if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
- const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
- const proxyAllowance = await this._erc20Token.getProxyAllowanceAsync(
- decodedERC20AssetData.tokenAddress,
- userAddress,
- {
- defaultBlock: this._stateLayer,
- },
- );
- return proxyAllowance;
- } else {
- const decodedERC721AssetData = decodedAssetData as ERC721AssetData;
-
+ let proxyAllowance: BigNumber | undefined;
+ if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
+ proxyAllowance = await this._erc20Token.getProxyAllowanceAsync(decodedAssetData.tokenAddress, userAddress, {
+ defaultBlock: this._stateLayer,
+ });
+ } else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
const isApprovedForAll = await this._erc721Token.isProxyApprovedForAllAsync(
- decodedERC721AssetData.tokenAddress,
+ decodedAssetData.tokenAddress,
userAddress,
{
defaultBlock: this._stateLayer,
@@ -63,15 +65,27 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
return new BigNumber(this._erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
} else {
const isApproved = await this._erc721Token.isProxyApprovedAsync(
- decodedERC721AssetData.tokenAddress,
- decodedERC721AssetData.tokenId,
+ decodedAssetData.tokenAddress,
+ decodedAssetData.tokenId,
{
defaultBlock: this._stateLayer,
},
);
- const proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0);
- return proxyAllowance;
+ proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0);
+ }
+ } else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
+ // The `proxyAllowance` for MultiAssetData is the total units of the entire `assetData` that the proxies have been approved to spend by the `userAddress`.
+ for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
+ const nestedAmountElement = decodedAssetData.amounts[index];
+ const nestedAssetAllowance = (await this.getProxyAllowanceAsync(
+ nestedAssetDataElement,
+ userAddress,
+ )).dividedToIntegerBy(nestedAmountElement);
+ if (_.isUndefined(proxyAllowance) || nestedAssetAllowance.lessThan(proxyAllowance)) {
+ proxyAllowance = nestedAssetAllowance;
+ }
}
}
+ return proxyAllowance as BigNumber;
}
}
diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts
index d66ff5c9c..69bbe3c91 100644
--- a/packages/contract-wrappers/src/index.ts
+++ b/packages/contract-wrappers/src/index.ts
@@ -34,6 +34,7 @@ export { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper';
export { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper';
export { ForwarderWrapper } from './contract_wrappers/forwarder_wrapper';
export { OrderValidatorWrapper } from './contract_wrappers/order_validator_wrapper';
+export { DutchAuctionWrapper } from './contract_wrappers/dutch_auction_wrapper';
export { TransactionEncoder } from './utils/transaction_encoder';
@@ -54,9 +55,21 @@ export {
OrderAndTraderInfo,
TraderInfo,
ValidateOrderFillableOpts,
+ DutchAuctionData,
} from './types';
-export { Order, SignedOrder, AssetProxyId } from '@0x/types';
+export {
+ AssetData,
+ ERC20AssetData,
+ ERC721AssetData,
+ SingleAssetData,
+ MultiAssetData,
+ MultiAssetDataWithRecursiveDecoding,
+ DutchAuctionDetails,
+ Order,
+ SignedOrder,
+ AssetProxyId,
+} from '@0x/types';
export {
BlockParamLiteral,
diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts
index 14d4649ae..945ca88cd 100644
--- a/packages/contract-wrappers/src/types.ts
+++ b/packages/contract-wrappers/src/types.ts
@@ -9,7 +9,7 @@ import {
WETH9Events,
} from '@0x/abi-gen-wrappers';
import { ContractAddresses } from '@0x/contract-addresses';
-import { OrderState, SignedOrder } from '@0x/types';
+import { AssetData, OrderState, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { BlockParam, ContractEventArg, DecodedLogArgs, LogEntryEvent, LogWithDecodedArgs } from 'ethereum-types';
@@ -206,3 +206,13 @@ export interface BalanceAndAllowance {
balance: BigNumber;
allowance: BigNumber;
}
+
+export enum DutchAuctionWrapperError {
+ AssetDataMismatch = 'ASSET_DATA_MISMATCH',
+}
+
+export interface DutchAuctionData {
+ assetData: AssetData;
+ beginTimeSeconds: BigNumber;
+ beginAmount: BigNumber;
+}
diff --git a/packages/contract-wrappers/src/utils/constants.ts b/packages/contract-wrappers/src/utils/constants.ts
index c587ba526..94afdc112 100644
--- a/packages/contract-wrappers/src/utils/constants.ts
+++ b/packages/contract-wrappers/src/utils/constants.ts
@@ -14,5 +14,6 @@ export const constants = {
ZERO_AMOUNT: new BigNumber(0),
ONE_AMOUNT: new BigNumber(1),
ETHER_TOKEN_DECIMALS: 18,
- USER_DENIED_SIGNATURE_PATTERN: 'User denied transaction signature',
+ METAMASK_USER_DENIED_SIGNATURE_PATTERN: 'User denied transaction signature',
+ TRUST_WALLET_USER_DENIED_SIGNATURE_PATTERN: 'cancelled',
};
diff --git a/packages/contract-wrappers/src/utils/decorators.ts b/packages/contract-wrappers/src/utils/decorators.ts
index a4207ae4c..3acfa3a88 100644
--- a/packages/contract-wrappers/src/utils/decorators.ts
+++ b/packages/contract-wrappers/src/utils/decorators.ts
@@ -30,7 +30,10 @@ const schemaErrorTransformer = (error: Error) => {
};
const signatureRequestErrorTransformer = (error: Error) => {
- if (_.includes(error.message, constants.USER_DENIED_SIGNATURE_PATTERN)) {
+ if (
+ _.includes(error.message, constants.METAMASK_USER_DENIED_SIGNATURE_PATTERN) ||
+ _.includes(error.message, constants.TRUST_WALLET_USER_DENIED_SIGNATURE_PATTERN)
+ ) {
const errMsg = ContractWrappersError.SignatureRequestDenied;
return new Error(errMsg);
}
diff --git a/packages/contract-wrappers/test/dutch_auction_wrapper_test.ts b/packages/contract-wrappers/test/dutch_auction_wrapper_test.ts
new file mode 100644
index 000000000..d7a6ca015
--- /dev/null
+++ b/packages/contract-wrappers/test/dutch_auction_wrapper_test.ts
@@ -0,0 +1,128 @@
+import { expectTransactionFailedAsync, getLatestBlockTimestampAsync } from '@0x/contracts-test-utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { assetDataUtils } from '@0x/order-utils';
+import { RevertReason, SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+
+import { ContractWrappers } from '../src';
+
+import { chaiSetup } from './utils/chai_setup';
+import { constants } from './utils/constants';
+import { DutchAuctionUtils } from './utils/dutch_auction_utils';
+import { migrateOnceAsync } from './utils/migrate';
+import { tokenUtils } from './utils/token_utils';
+import { provider, web3Wrapper } from './utils/web3_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+// tslint:disable:custom-no-magic-numbers
+describe('DutchAuctionWrapper', () => {
+ const makerAssetAmount = new BigNumber(5);
+ const auctionEndTakerAmount = new BigNumber(10);
+ const auctionBeginTakerAmount = auctionEndTakerAmount.times(2);
+ const tenMinutesInSeconds = 10 * 60;
+ let contractWrappers: ContractWrappers;
+ let exchangeContractAddress: string;
+ let userAddresses: string[];
+ let makerAddress: string;
+ let takerAddress: string;
+ let makerTokenAddress: string;
+ let takerTokenAddress: string;
+ let buyOrder: SignedOrder;
+ let sellOrder: SignedOrder;
+ let makerTokenAssetData: string;
+ let takerTokenAssetData: string;
+ let auctionBeginTimeSeconds: BigNumber;
+ let auctionEndTimeSeconds: BigNumber;
+ before(async () => {
+ // setup contract wrappers & addresses
+ 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.address;
+ userAddresses = await web3Wrapper.getAvailableAddressesAsync();
+ [, makerAddress, takerAddress] = userAddresses;
+ [makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
+ // construct asset data for tokens being swapped
+ [makerTokenAssetData, takerTokenAssetData] = [
+ assetDataUtils.encodeERC20AssetData(makerTokenAddress),
+ assetDataUtils.encodeERC20AssetData(takerTokenAddress),
+ ];
+ // setup auction details in maker asset data
+ const currentBlockTimestamp: number = await getLatestBlockTimestampAsync();
+ auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
+ auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp + tenMinutesInSeconds);
+ // create auction orders
+ const coinbase = userAddresses[0];
+ const dutchAuctionUtils = new DutchAuctionUtils(
+ web3Wrapper,
+ coinbase,
+ exchangeContractAddress,
+ contractWrappers.erc20Proxy.address,
+ );
+ sellOrder = await dutchAuctionUtils.createSignedSellOrderAsync(
+ auctionBeginTimeSeconds,
+ auctionEndTimeSeconds,
+ auctionBeginTakerAmount,
+ auctionEndTakerAmount,
+ makerAssetAmount,
+ makerTokenAssetData,
+ takerTokenAssetData,
+ makerAddress,
+ constants.NULL_ADDRESS,
+ );
+ buyOrder = await dutchAuctionUtils.createSignedBuyOrderAsync(sellOrder, takerAddress);
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ beforeEach(async () => {
+ await blockchainLifecycle.startAsync();
+ });
+ afterEach(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ describe('#matchOrdersAsync', () => {
+ it('should match two orders', async () => {
+ const txHash = await contractWrappers.dutchAuction.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
+ });
+ it('should throw when invalid transaction and shouldValidate is true', async () => {
+ // request match with bad buy/sell orders
+ const badSellOrder = buyOrder;
+ const badBuyOrder = sellOrder;
+ return expectTransactionFailedAsync(
+ contractWrappers.dutchAuction.matchOrdersAsync(badBuyOrder, badSellOrder, takerAddress, {
+ shouldValidate: true,
+ }),
+ RevertReason.InvalidAssetData,
+ );
+ });
+ });
+
+ describe('#getAuctionDetailsAsync', () => {
+ it('should get auction details', async () => {
+ // get auction details
+ const auctionDetails = await contractWrappers.dutchAuction.getAuctionDetailsAsync(sellOrder);
+ // run some basic sanity checks on the return value
+ expect(auctionDetails.beginTimeSeconds, 'auctionDetails.beginTimeSeconds').to.be.bignumber.equal(
+ auctionBeginTimeSeconds,
+ );
+ expect(auctionDetails.beginAmount, 'auctionDetails.beginAmount').to.be.bignumber.equal(
+ auctionBeginTakerAmount,
+ );
+ expect(auctionDetails.endTimeSeconds, 'auctionDetails.endTimeSeconds').to.be.bignumber.equal(
+ auctionEndTimeSeconds,
+ );
+ });
+ });
+});
diff --git a/packages/contract-wrappers/test/utils/dutch_auction_utils.ts b/packages/contract-wrappers/test/utils/dutch_auction_utils.ts
new file mode 100644
index 000000000..8e2aef217
--- /dev/null
+++ b/packages/contract-wrappers/test/utils/dutch_auction_utils.ts
@@ -0,0 +1,153 @@
+import { DummyERC20TokenContract } from '@0x/abi-gen-wrappers';
+import * as artifacts from '@0x/contract-artifacts';
+import { assetDataUtils } from '@0x/order-utils';
+import { orderFactory } from '@0x/order-utils/lib/src/order_factory';
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+
+import { DutchAuctionWrapper } from '../../src/contract_wrappers/dutch_auction_wrapper';
+
+import { constants } from './constants';
+
+export class DutchAuctionUtils {
+ private readonly _web3Wrapper: Web3Wrapper;
+ private readonly _coinbase: string;
+ private readonly _exchangeAddress: string;
+ private readonly _erc20ProxyAddress: string;
+
+ constructor(web3Wrapper: Web3Wrapper, coinbase: string, exchangeAddress: string, erc20ProxyAddress: string) {
+ this._web3Wrapper = web3Wrapper;
+ this._coinbase = coinbase;
+ this._exchangeAddress = exchangeAddress;
+ this._erc20ProxyAddress = erc20ProxyAddress;
+ }
+ public async createSignedSellOrderAsync(
+ auctionBeginTimeSections: BigNumber,
+ acutionEndTimeSeconds: BigNumber,
+ auctionBeginTakerAssetAmount: BigNumber,
+ auctionEndTakerAssetAmount: BigNumber,
+ makerAssetAmount: BigNumber,
+ makerAssetData: string,
+ takerAssetData: string,
+ makerAddress: string,
+ takerAddress: string,
+ senderAddress?: string,
+ makerFee?: BigNumber,
+ takerFee?: BigNumber,
+ feeRecipientAddress?: string,
+ ): Promise<SignedOrder> {
+ // Notes on sell order:
+ // - The `takerAssetAmount` is set to the `auctionEndTakerAssetAmount`, which is the lowest amount the
+ // the seller can expect to receive
+ // - The `makerAssetData` is overloaded to include the auction begin time and begin taker asset amount
+ const makerAssetDataWithAuctionDetails = DutchAuctionWrapper.encodeDutchAuctionAssetData(
+ makerAssetData,
+ auctionBeginTimeSections,
+ auctionBeginTakerAssetAmount,
+ );
+ const signedOrder = await orderFactory.createSignedOrderAsync(
+ this._web3Wrapper.getProvider(),
+ makerAddress,
+ makerAssetAmount,
+ makerAssetDataWithAuctionDetails,
+ auctionEndTakerAssetAmount,
+ takerAssetData,
+ this._exchangeAddress,
+ {
+ takerAddress,
+ senderAddress,
+ makerFee,
+ takerFee,
+ feeRecipientAddress,
+ expirationTimeSeconds: acutionEndTimeSeconds,
+ },
+ );
+ const erc20AssetData = assetDataUtils.decodeERC20AssetData(makerAssetData);
+ await this._increaseERC20BalanceAndAllowanceAsync(erc20AssetData.tokenAddress, makerAddress, makerAssetAmount);
+ return signedOrder;
+ }
+ public async createSignedBuyOrderAsync(
+ sellOrder: SignedOrder,
+ buyerAddress: string,
+ senderAddress?: string,
+ makerFee?: BigNumber,
+ takerFee?: BigNumber,
+ feeRecipientAddress?: string,
+ expirationTimeSeconds?: BigNumber,
+ ): Promise<SignedOrder> {
+ const dutchAuctionData = DutchAuctionWrapper.decodeDutchAuctionData(sellOrder.makerAssetData);
+ // Notes on buy order:
+ // - The `makerAssetAmount` is set to `dutchAuctionData.beginAmount`, which is
+ // the highest amount the buyer would have to pay out at any point during the auction.
+ // - The `takerAssetAmount` is set to the seller's `makerAssetAmount`, as the buyer
+ // receives the entire amount being sold by the seller.
+ // - The `makerAssetData`/`takerAssetData` are reversed from the sell order
+ const signedOrder = await orderFactory.createSignedOrderAsync(
+ this._web3Wrapper.getProvider(),
+ buyerAddress,
+ dutchAuctionData.beginAmount,
+ sellOrder.takerAssetData,
+ sellOrder.makerAssetAmount,
+ sellOrder.makerAssetData,
+ sellOrder.exchangeAddress,
+ {
+ senderAddress,
+ makerFee,
+ takerFee,
+ feeRecipientAddress,
+ expirationTimeSeconds,
+ },
+ );
+ const buyerERC20AssetData = assetDataUtils.decodeERC20AssetData(sellOrder.takerAssetData);
+ await this._increaseERC20BalanceAndAllowanceAsync(
+ buyerERC20AssetData.tokenAddress,
+ buyerAddress,
+ dutchAuctionData.beginAmount,
+ );
+ return signedOrder;
+ }
+ private async _increaseERC20BalanceAndAllowanceAsync(
+ tokenAddress: string,
+ address: string,
+ amount: BigNumber,
+ ): Promise<void> {
+ if (amount.isZero() || address === constants.NULL_ADDRESS) {
+ return; // noop
+ }
+ await Promise.all([
+ this._increaseERC20BalanceAsync(tokenAddress, address, amount),
+ this._increaseERC20AllowanceAsync(tokenAddress, address, amount),
+ ]);
+ }
+ private async _increaseERC20BalanceAsync(tokenAddress: string, address: string, amount: BigNumber): Promise<void> {
+ const erc20Token = new DummyERC20TokenContract(
+ artifacts.DummyERC20Token.compilerOutput.abi,
+ tokenAddress,
+ this._web3Wrapper.getProvider(),
+ this._web3Wrapper.getContractDefaults(),
+ );
+ const txHash = await erc20Token.transfer.sendTransactionAsync(address, amount, {
+ from: this._coinbase,
+ });
+ await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
+ }
+ private async _increaseERC20AllowanceAsync(
+ tokenAddress: string,
+ address: string,
+ amount: BigNumber,
+ ): Promise<void> {
+ const erc20Token = new DummyERC20TokenContract(
+ artifacts.DummyERC20Token.compilerOutput.abi,
+ tokenAddress,
+ this._web3Wrapper.getProvider(),
+ this._web3Wrapper.getContractDefaults(),
+ );
+ const oldMakerAllowance = await erc20Token.allowance.callAsync(address, this._erc20ProxyAddress);
+ const newMakerAllowance = oldMakerAllowance.plus(amount);
+ const txHash = await erc20Token.approve.sendTransactionAsync(this._erc20ProxyAddress, newMakerAllowance, {
+ from: address,
+ });
+ await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
+ }
+}
diff --git a/packages/contract_templates/contract.handlebars b/packages/contract_templates/contract.handlebars
deleted file mode 100644
index 9c1952ed4..000000000
--- a/packages/contract_templates/contract.handlebars
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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 '@0x/base-contract';
-import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
-import { BigNumber, classUtils, logUtils } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as ethers from 'ethers';
-import * as _ from 'lodash';
-// tslint:enable:no-unused-variable
-
-{{#if events}}
-export type {{contractName}}EventArgs =
-{{#each events}}
- | {{@root.contractName}}{{name}}EventArgs{{#if @last}};{{/if}}
-{{/each}}
-
-export enum {{contractName}}Events {
- {{#each events}}
- {{name}} = '{{name}}',
- {{/each}}
-}
-
-{{#each events}}
-{{> event}}
-
-{{/each}}
-{{/if}}
-
-/* istanbul ignore next */
-// tslint:disable:no-parameter-reassignment
-// tslint:disable-next-line:class-name
-export class {{contractName}}Contract extends BaseContract {
-{{#each methods}}
- {{#this.constant}}
- {{> call contractName=../contractName}}
- {{/this.constant}}
- {{^this.constant}}
- {{> tx contractName=../contractName}}
- {{/this.constant}}
-{{/each}}
- public static async deployFrom0xArtifactAsync(
- artifact: ContractArtifact,
- provider: Provider,
- txDefaults: Partial<TxData>,
- {{> typed_params inputs=ctor.inputs}}
- ): Promise<{{contractName}}Contract> {
- 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 {{contractName}}Contract.deployAsync(bytecode, abi, provider, txDefaults, {{> params inputs=ctor.inputs}});
- }
- public static async deployAsync(
- bytecode: string,
- abi: ContractAbi,
- provider: Provider,
- txDefaults: Partial<TxData>,
- {{> typed_params inputs=ctor.inputs}}
- ): Promise<{{contractName}}Contract> {
- const constructorAbi = BaseContract._lookupConstructorAbi(abi);
- [{{> params inputs=ctor.inputs}}] = BaseContract._formatABIDataItemList(
- constructorAbi.inputs,
- [{{> params inputs=ctor.inputs}}],
- BaseContract._bigNumberToString,
- );
- const iface = new ethers.utils.Interface(abi);
- const deployInfo = iface.deployFunction;
- const txData = deployInfo.encode(bytecode, [{{> params inputs=ctor.inputs}}]);
- 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(`{{contractName}} successfully deployed at ${txReceipt.contractAddress}`);
- const contractInstance = new {{contractName}}Contract(abi, txReceipt.contractAddress as string, provider, txDefaults);
- contractInstance.constructorArgs = [{{> params inputs=ctor.inputs}}];
- return contractInstance;
- }
- constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
- super('{{contractName}}', 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/contracts/.solhint.json b/packages/contracts/.solhint.json
deleted file mode 100644
index 076afe9f3..000000000
--- a/packages/contracts/.solhint.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "extends": "default",
- "rules": {
- "avoid-low-level-calls": false,
- "avoid-tx-origin": "warn",
- "bracket-align": false,
- "code-complexity": false,
- "const-name-snakecase": "error",
- "expression-indent": "error",
- "function-max-lines": false,
- "func-order": "error",
- "indent": ["error", 4],
- "max-line-length": ["warn", 160],
- "no-inline-assembly": false,
- "quotes": ["error", "double"],
- "separate-by-one-line-in-contract": "error",
- "space-after-comma": "error",
- "statement-indent": "error"
- }
-}
diff --git a/packages/contracts/CHANGELOG.json b/packages/contracts/CHANGELOG.json
deleted file mode 100644
index 3f57a33d6..000000000
--- a/packages/contracts/CHANGELOG.json
+++ /dev/null
@@ -1,115 +0,0 @@
-[
- {
- "name": "Forwarder",
- "version": "1.1.0",
- "changes": [
- {
- "note": "Round up when calculating remaining amounts in marketBuy functions",
- "pr": 1162,
- "networks": {
- "1": "0x5468a1dc173652ee28d249c271fa9933144746b1",
- "3": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
- "42": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6"
- }
- }
- ]
- },
- {
- "name": "Forwarder",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x7afc2d5107af94c462a194d2c21b5bdd238709d6",
- "3": "0x3983e204b12b3c02fb0638caf2cd406a62e0ead3",
- "42": "0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8"
- }
- }
- ]
- },
- {
- "name": "OrderValidator",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x9463e518dea6810309563c81d5266c1b1d149138",
- "3": "0x90431a90516ab49af23a0530e04e8c7836e7122f",
- "42": "0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d"
- }
- }
- ]
- },
- {
- "name": "Exchange",
- "version": "2.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b",
- "3": "0x4530c0483a1633c7a1c97d2c53721caff2caaaaf",
- "42": "0x35dd2932454449b14cee11a94d3674a936d5d7b2"
- }
- }
- ]
- },
- {
- "name": "ERC20Proxy",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e",
- "3": "0xb1408f4c245a23c31b98d2c626777d4c0d766caa",
- "42": "0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e"
- }
- }
- ]
- },
- {
- "name": "ERC721Proxy",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x208e41fb445f1bb1b6780d58356e81405f3e6127",
- "3": "0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4",
- "42": "0x2a9127c745688a165106c11cd4d647d2220af821"
- }
- }
- ]
- },
- {
- "name": "AssetProxyOwner",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v2 deploy",
- "networks": {
- "1": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6",
- "3": "0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b",
- "42": "0x2c824d2882baa668e0d5202b1e7f2922278703f8"
- }
- }
- ]
- },
- {
- "name": "ZRXToken",
- "version": "1.0.0",
- "changes": [
- {
- "note": "protocol v1 deploy",
- "networks": {
- "1": "0xe41d2489571d322189246dafa5ebde1f4699f498",
- "3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00",
- "42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa"
- }
- }
- ]
- }
-]
diff --git a/packages/contracts/README.md b/packages/contracts/README.md
deleted file mode 100644
index 97a2816ff..000000000
--- a/packages/contracts/README.md
+++ /dev/null
@@ -1,129 +0,0 @@
-## Contracts
-
-Smart contracts that implement the 0x protocol. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [CHANGELOG](./CHANGELOG.json) of this package.
-
-## Usage
-
-Contracts that make up and interact with version 2.0.0 of the protocol can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
-
-* [protocol](./contracts/protocol)
- * This directory contains the contracts that make up version 2.0.0. A full specification can be found [here](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md).
-* [extensions](./contracts/extensions)
- * This directory contains contracts that interact with the 2.0.0 contracts and will be used in production, such as the [Forwarder](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md) contract.
-* [examples](./contracts/examples)
- * This directory contains example implementations of contracts that interact with the protocol but are _not_ intended for use in production. Examples include [filter](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#filter-contracts) contracts, a [Wallet](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#wallet) contract, and a [Validator](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#validator) contract, among others.
-* [tokens](./contracts/tokens)
- * This directory contains implementations of different tokens and token standards, including [wETH](https://weth.io/), ZRX, [ERC20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md), and [ERC721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md).
-* [multisig](./contracts/multisig)
- * This directory contains the [Gnosis MultiSigWallet](https://github.com/gnosis/MultiSigWallet) and a custom extension that adds a timelock to transactions within the MultiSigWallet.
-* [utils](./contracts/utils)
- * This directory contains libraries and utils that are shared across all of the other directories.
-* [test](./contracts/test)
- * This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
-
-## Bug bounty
-
-A bug bounty for the 2.0.0 contracts is ongoing! Instructions can be found [here](https://0xproject.com/wiki#Bug-Bounty).
-
-## Contributing
-
-We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
-
-For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
-
-Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
-
-### Install Dependencies
-
-If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
-
-```bash
-yarn config set workspaces-experimental true
-```
-
-Then install dependencies
-
-```bash
-yarn install
-```
-
-### Build
-
-To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
-
-```bash
-PKG=contracts yarn build
-```
-
-Or continuously rebuild on change:
-
-```bash
-PKG=contracts yarn watch
-```
-
-### Clean
-
-```bash
-yarn clean
-```
-
-### Lint
-
-```bash
-yarn lint
-```
-
-### Run Tests
-
-```bash
-yarn test
-```
-
-#### Testing options
-
-###### Revert stack traces
-
-If you want to see helpful stack traces (incl. line number, code snippet) for smart contract reverts, run the tests with:
-
-```
-yarn test:trace
-```
-
-**Note:** This currently slows down the test runs and is therefore not enabled by default.
-
-###### Backing Ethereum node
-
-By default, our tests run against an in-process [Ganache](https://github.com/trufflesuite/ganache-core) instance. In order to run the tests against [Geth](https://github.com/ethereum/go-ethereum), first follow the instructions in the README for the devnet package to start the devnet Geth node. Then run:
-
-```bash
-TEST_PROVIDER=geth yarn test
-```
-
-###### Code coverage
-
-In order to see the Solidity code coverage output generated by `@0x/sol-cov`, run:
-
-```
-yarn test:coverage
-```
-
-###### Gas profiler
-
-In order to profile the gas costs for a specific smart contract call/transaction, you can run the tests in `profiler` mode.
-
-**Note:** Traces emitted by ganache have incorrect gas costs so we recommend using Geth for profiling.
-
-```
-TEST_PROVIDER=geth yarn test:profiler
-```
-
-You'll see a warning that you need to explicitly enable and disable the profiler before and after the block of code you want to profile.
-
-```typescript
-import { profiler } from './utils/profiler';
-profiler.start();
-// Some call to a smart contract
-profiler.stop();
-```
-
-Without explicitly starting and stopping the profiler, the profiler output will be too busy, and therefore unusable.
diff --git a/packages/contracts/compiler.json b/packages/contracts/compiler.json
deleted file mode 100644
index af3980b4e..000000000
--- a/packages/contracts/compiler.json
+++ /dev/null
@@ -1,59 +0,0 @@
-{
- "artifactsDir": "./generated-artifacts",
- "contractsDir": "./contracts",
- "compilerSettings": {
- "optimizer": {
- "enabled": true,
- "runs": 1000000
- },
- "outputSelection": {
- "*": {
- "*": [
- "abi",
- "evm.bytecode.object",
- "evm.bytecode.sourceMap",
- "evm.deployedBytecode.object",
- "evm.deployedBytecode.sourceMap"
- ]
- }
- }
- },
- "contracts": [
- "AssetProxyOwner",
- "DummyERC20Token",
- "DummyERC721Receiver",
- "DummyERC721Token",
- "DummyMultipleReturnERC20Token",
- "DummyNoReturnERC20Token",
- "ERC20Proxy",
- "ERC20Token",
- "ERC721Token",
- "ERC721Proxy",
- "Exchange",
- "ExchangeWrapper",
- "Forwarder",
- "IAssetData",
- "IAssetProxy",
- "InvalidERC721Receiver",
- "IValidator",
- "IWallet",
- "MixinAuthorizable",
- "MultiSigWallet",
- "MultiSigWalletWithTimeLock",
- "OrderValidator",
- "ReentrantERC20Token",
- "TestAssetProxyOwner",
- "TestAssetProxyDispatcher",
- "TestConstants",
- "TestLibBytes",
- "TestLibs",
- "TestExchangeInternals",
- "TestSignatureValidator",
- "TestStaticCallReceiver",
- "Validator",
- "Wallet",
- "WETH9",
- "Whitelist",
- "ZRXToken"
- ]
-}
diff --git a/packages/contracts/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol b/packages/contracts/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol
deleted file mode 100644
index 2fa0e3c5e..000000000
--- a/packages/contracts/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol
+++ /dev/null
@@ -1,100 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-
-
-contract ExchangeWrapper {
-
- // Exchange contract.
- // solhint-disable-next-line var-name-mixedcase
- IExchange internal EXCHANGE;
-
- constructor (address _exchange)
- public
- {
- EXCHANGE = IExchange(_exchange);
- }
-
- /// @dev Cancels all orders created by sender with a salt less than or equal to the targetOrderEpoch
- /// and senderAddress equal to this contract.
- /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
- /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.
- /// @param makerSignature Proof that maker wishes to call this function with given params.
- function cancelOrdersUpTo(
- uint256 targetOrderEpoch,
- uint256 salt,
- bytes makerSignature
- )
- external
- {
- address makerAddress = msg.sender;
-
- // Encode arguments into byte array.
- bytes memory data = abi.encodeWithSelector(
- EXCHANGE.cancelOrdersUpTo.selector,
- targetOrderEpoch
- );
-
- // Call `cancelOrdersUpTo` via `executeTransaction`.
- EXCHANGE.executeTransaction(
- salt,
- makerAddress,
- data,
- makerSignature
- );
- }
-
- /// @dev Fills an order using `msg.sender` as the taker.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.
- /// @param orderSignature Proof that order has been created by maker.
- /// @param takerSignature Proof that taker wishes to call this function with given params.
- function fillOrder(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- uint256 salt,
- bytes memory orderSignature,
- bytes memory takerSignature
- )
- public
- {
- address takerAddress = msg.sender;
-
- // Encode arguments into byte array.
- bytes memory data = abi.encodeWithSelector(
- EXCHANGE.fillOrder.selector,
- order,
- takerAssetFillAmount,
- orderSignature
- );
-
- // Call `fillOrder` via `executeTransaction`.
- EXCHANGE.executeTransaction(
- salt,
- takerAddress,
- data,
- takerSignature
- );
- }
-}
diff --git a/packages/contracts/contracts/examples/Validator/Validator.sol b/packages/contracts/contracts/examples/Validator/Validator.sol
deleted file mode 100644
index 72ed528ba..000000000
--- a/packages/contracts/contracts/examples/Validator/Validator.sol
+++ /dev/null
@@ -1,56 +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.24;
-
-import "../../protocol/Exchange/interfaces/IValidator.sol";
-
-
-contract Validator is
- IValidator
-{
-
- // The single valid signer for this wallet.
- // solhint-disable-next-line var-name-mixedcase
- address internal VALID_SIGNER;
-
- /// @dev constructs a new `Validator` with a single valid signer.
- /// @param validSigner The sole, valid signer.
- constructor (address validSigner) public {
- VALID_SIGNER = validSigner;
- }
-
- /// @dev Verifies that a signature is valid. `signer` must match `VALID_SIGNER`.
- /// @param hash Message hash that is signed.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof of signing.
- /// @return Validity of signature.
- // solhint-disable no-unused-vars
- function isValidSignature(
- bytes32 hash,
- address signerAddress,
- bytes signature
- )
- external
- view
- returns (bool isValid)
- {
- return (signerAddress == VALID_SIGNER);
- }
- // solhint-enable no-unused-vars
-}
diff --git a/packages/contracts/contracts/examples/Wallet/Wallet.sol b/packages/contracts/contracts/examples/Wallet/Wallet.sol
deleted file mode 100644
index b75021a31..000000000
--- a/packages/contracts/contracts/examples/Wallet/Wallet.sol
+++ /dev/null
@@ -1,65 +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.24;
-
-import "../../protocol/Exchange/interfaces/IWallet.sol";
-import "../../utils/LibBytes/LibBytes.sol";
-
-
-contract Wallet is
- IWallet
-{
- using LibBytes for bytes;
-
- // The owner of this wallet.
- // solhint-disable-next-line var-name-mixedcase
- address internal WALLET_OWNER;
-
- /// @dev constructs a new `Wallet` with a single owner.
- /// @param walletOwner The owner of this wallet.
- constructor (address walletOwner) public {
- WALLET_OWNER = walletOwner;
- }
-
- /// @dev Validates an EIP712 signature.
- /// The signer must match the owner of this wallet.
- /// @param hash Message hash that is signed.
- /// @param eip712Signature Proof of signing.
- /// @return Validity of signature.
- function isValidSignature(
- bytes32 hash,
- bytes eip712Signature
- )
- external
- view
- returns (bool isValid)
- {
- require(
- eip712Signature.length == 65,
- "LENGTH_65_REQUIRED"
- );
-
- uint8 v = uint8(eip712Signature[0]);
- bytes32 r = eip712Signature.readBytes32(1);
- bytes32 s = eip712Signature.readBytes32(33);
- address recoveredAddress = ecrecover(hash, v, r, s);
- isValid = WALLET_OWNER == recoveredAddress;
- return isValid;
- }
-}
diff --git a/packages/contracts/contracts/examples/Whitelist/Whitelist.sol b/packages/contracts/contracts/examples/Whitelist/Whitelist.sol
deleted file mode 100644
index e4e25038c..000000000
--- a/packages/contracts/contracts/examples/Whitelist/Whitelist.sol
+++ /dev/null
@@ -1,136 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-import "../../utils/Ownable/Ownable.sol";
-
-
-contract Whitelist is
- Ownable
-{
-
- // Mapping of address => whitelist status.
- mapping (address => bool) public isWhitelisted;
-
- // Exchange contract.
- // solhint-disable var-name-mixedcase
- IExchange internal EXCHANGE;
- bytes internal TX_ORIGIN_SIGNATURE;
- // solhint-enable var-name-mixedcase
-
- byte constant internal VALIDATOR_SIGNATURE_BYTE = "\x05";
-
- constructor (address _exchange)
- public
- {
- EXCHANGE = IExchange(_exchange);
- TX_ORIGIN_SIGNATURE = abi.encodePacked(address(this), VALIDATOR_SIGNATURE_BYTE);
- }
-
- /// @dev Adds or removes an address from the whitelist.
- /// @param target Address to add or remove from whitelist.
- /// @param isApproved Whitelist status to assign to address.
- function updateWhitelistStatus(
- address target,
- bool isApproved
- )
- external
- onlyOwner
- {
- isWhitelisted[target] = isApproved;
- }
-
- /// @dev Verifies signer is same as signer of current Ethereum transaction.
- /// NOTE: This function can currently be used to validate signatures coming from outside of this contract.
- /// Extra safety checks can be added for a production contract.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof of signing.
- /// @return Validity of order signature.
- // solhint-disable no-unused-vars
- function isValidSignature(
- bytes32 hash,
- address signerAddress,
- bytes signature
- )
- external
- view
- returns (bool isValid)
- {
- // solhint-disable-next-line avoid-tx-origin
- return signerAddress == tx.origin;
- }
- // solhint-enable no-unused-vars
-
- /// @dev Fills an order using `msg.sender` as the taker.
- /// The transaction will revert if both the maker and taker are not whitelisted.
- /// Orders should specify this contract as the `senderAddress` in order to gaurantee
- /// that both maker and taker have been whitelisted.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.
- /// @param orderSignature Proof that order has been created by maker.
- function fillOrderIfWhitelisted(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- uint256 salt,
- bytes memory orderSignature
- )
- public
- {
- address takerAddress = msg.sender;
-
- // This contract must be the entry point for the transaction.
- require(
- // solhint-disable-next-line avoid-tx-origin
- takerAddress == tx.origin,
- "INVALID_SENDER"
- );
-
- // Check if maker is on the whitelist.
- require(
- isWhitelisted[order.makerAddress],
- "MAKER_NOT_WHITELISTED"
- );
-
- // Check if taker is on the whitelist.
- require(
- isWhitelisted[takerAddress],
- "TAKER_NOT_WHITELISTED"
- );
-
- // Encode arguments into byte array.
- bytes memory data = abi.encodeWithSelector(
- EXCHANGE.fillOrder.selector,
- order,
- takerAssetFillAmount,
- orderSignature
- );
-
- // Call `fillOrder` via `executeTransaction`.
- EXCHANGE.executeTransaction(
- salt,
- takerAddress,
- data,
- TX_ORIGIN_SIGNATURE
- );
- }
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/MixinAssets.sol b/packages/contracts/contracts/extensions/Forwarder/MixinAssets.sol
deleted file mode 100644
index 43efb5ff3..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/MixinAssets.sol
+++ /dev/null
@@ -1,143 +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.24;
-
-import "../../utils/LibBytes/LibBytes.sol";
-import "../../utils/Ownable/Ownable.sol";
-import "../../tokens/ERC20Token/IERC20Token.sol";
-import "../../tokens/ERC721Token/IERC721Token.sol";
-import "./libs/LibConstants.sol";
-import "./mixins/MAssets.sol";
-
-
-contract MixinAssets is
- Ownable,
- LibConstants,
- MAssets
-{
- using LibBytes for bytes;
-
- bytes4 constant internal ERC20_TRANSFER_SELECTOR = bytes4(keccak256("transfer(address,uint256)"));
-
- /// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
- /// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
- /// used to withdraw assets that were accidentally sent to this contract.
- /// @param assetData Byte array encoded for the respective asset proxy.
- /// @param amount Amount of ERC20 token to withdraw.
- function withdrawAsset(
- bytes assetData,
- uint256 amount
- )
- external
- onlyOwner
- {
- transferAssetToSender(assetData, amount);
- }
-
- /// @dev Transfers given amount of asset to sender.
- /// @param assetData Byte array encoded for the respective asset proxy.
- /// @param amount Amount of asset to transfer to sender.
- function transferAssetToSender(
- bytes memory assetData,
- uint256 amount
- )
- internal
- {
- bytes4 proxyId = assetData.readBytes4(0);
-
- if (proxyId == ERC20_DATA_ID) {
- transferERC20Token(assetData, amount);
- } else if (proxyId == ERC721_DATA_ID) {
- transferERC721Token(assetData, amount);
- } else {
- revert("UNSUPPORTED_ASSET_PROXY");
- }
- }
-
- /// @dev Decodes ERC20 assetData and transfers given amount to sender.
- /// @param assetData Byte array encoded for the respective asset proxy.
- /// @param amount Amount of asset to transfer to sender.
- function transferERC20Token(
- bytes memory assetData,
- uint256 amount
- )
- internal
- {
- address token = assetData.readAddress(16);
-
- // Transfer tokens.
- // We do a raw call so we can check the success separate
- // from the return data.
- bool success = token.call(abi.encodeWithSelector(
- ERC20_TRANSFER_SELECTOR,
- msg.sender,
- amount
- ));
- require(
- success,
- "TRANSFER_FAILED"
- );
-
- // Check return data.
- // If there is no return data, we assume the token incorrectly
- // does not return a bool. In this case we expect it to revert
- // on failure, which was handled above.
- // If the token does return data, we require that it is a single
- // value that evaluates to true.
- assembly {
- if returndatasize {
- success := 0
- if eq(returndatasize, 32) {
- // First 64 bytes of memory are reserved scratch space
- returndatacopy(0, 0, 32)
- success := mload(0)
- }
- }
- }
- require(
- success,
- "TRANSFER_FAILED"
- );
- }
-
- /// @dev Decodes ERC721 assetData and transfers given amount to sender.
- /// @param assetData Byte array encoded for the respective asset proxy.
- /// @param amount Amount of asset to transfer to sender.
- function transferERC721Token(
- bytes memory assetData,
- uint256 amount
- )
- internal
- {
- require(
- amount == 1,
- "INVALID_AMOUNT"
- );
- // Decode asset data.
- address token = assetData.readAddress(16);
- uint256 tokenId = assetData.readUint256(36);
-
- // Perform transfer.
- IERC721Token(token).transferFrom(
- address(this),
- msg.sender,
- tokenId
- );
- }
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/MixinExchangeWrapper.sol b/packages/contracts/contracts/extensions/Forwarder/MixinExchangeWrapper.sol
deleted file mode 100644
index 4991c0ea5..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/MixinExchangeWrapper.sol
+++ /dev/null
@@ -1,260 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "./libs/LibConstants.sol";
-import "./mixins/MExchangeWrapper.sol";
-import "../../protocol/Exchange/libs/LibAbiEncoder.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-import "../../protocol/Exchange/libs/LibFillResults.sol";
-import "../../protocol/Exchange/libs/LibMath.sol";
-
-
-contract MixinExchangeWrapper is
- LibAbiEncoder,
- LibFillResults,
- LibMath,
- LibConstants,
- MExchangeWrapper
-{
- /// @dev Fills the input order.
- /// Returns false if the transaction would otherwise revert.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- /// @return Amounts filled and fees paid by maker and taker.
- function fillOrderNoThrow(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- internal
- returns (FillResults memory fillResults)
- {
- // ABI encode calldata for `fillOrder`
- bytes memory fillOrderCalldata = abiEncodeFillOrder(
- order,
- takerAssetFillAmount,
- signature
- );
-
- address exchange = address(EXCHANGE);
-
- // Call `fillOrder` and handle any exceptions gracefully
- assembly {
- let success := call(
- gas, // forward all gas
- exchange, // call address of Exchange contract
- 0, // transfer 0 wei
- add(fillOrderCalldata, 32), // pointer to start of input (skip array length in first 32 bytes)
- mload(fillOrderCalldata), // length of input
- fillOrderCalldata, // write output over input
- 128 // output size is 128 bytes
- )
- if success {
- mstore(fillResults, mload(fillOrderCalldata))
- mstore(add(fillResults, 32), mload(add(fillOrderCalldata, 32)))
- mstore(add(fillResults, 64), mload(add(fillOrderCalldata, 64)))
- mstore(add(fillResults, 96), mload(add(fillOrderCalldata, 96)))
- }
- }
- // fillResults values will be 0 by default if call was unsuccessful
- return fillResults;
- }
-
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of WETH has been sold by taker.
- /// Returns false if the transaction would otherwise revert.
- /// @param orders Array of order specifications.
- /// @param wethSellAmount Desired amount of WETH to sell.
- /// @param signatures Proofs that orders have been signed by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketSellWeth(
- LibOrder.Order[] memory orders,
- uint256 wethSellAmount,
- bytes[] memory signatures
- )
- internal
- returns (FillResults memory totalFillResults)
- {
- bytes memory makerAssetData = orders[0].makerAssetData;
- bytes memory wethAssetData = WETH_ASSET_DATA;
-
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
-
- // We assume that asset being bought by taker is the same for each order.
- // We assume that asset being sold by taker is WETH for each order.
- orders[i].makerAssetData = makerAssetData;
- orders[i].takerAssetData = wethAssetData;
-
- // Calculate the remaining amount of WETH to sell
- uint256 remainingTakerAssetFillAmount = safeSub(wethSellAmount, totalFillResults.takerAssetFilledAmount);
-
- // Attempt to sell the remaining amount of WETH
- FillResults memory singleFillResults = fillOrderNoThrow(
- orders[i],
- remainingTakerAssetFillAmount,
- signatures[i]
- );
-
- // Update amounts filled and fees paid by maker and taker
- addFillResults(totalFillResults, singleFillResults);
-
- // Stop execution if the entire amount of takerAsset has been sold
- if (totalFillResults.takerAssetFilledAmount >= wethSellAmount) {
- break;
- }
- }
- return totalFillResults;
- }
-
- /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.
- /// Returns false if the transaction would otherwise revert.
- /// The asset being sold by taker must always be WETH.
- /// @param orders Array of order specifications.
- /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
- /// @param signatures Proofs that orders have been signed by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketBuyExactAmountWithWeth(
- LibOrder.Order[] memory orders,
- uint256 makerAssetFillAmount,
- bytes[] memory signatures
- )
- internal
- returns (FillResults memory totalFillResults)
- {
- bytes memory makerAssetData = orders[0].makerAssetData;
- bytes memory wethAssetData = WETH_ASSET_DATA;
-
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
-
- // We assume that asset being bought by taker is the same for each order.
- // We assume that asset being sold by taker is WETH for each order.
- orders[i].makerAssetData = makerAssetData;
- orders[i].takerAssetData = wethAssetData;
-
- // Calculate the remaining amount of makerAsset to buy
- uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
-
- // Convert the remaining amount of makerAsset to buy into remaining amount
- // of takerAsset to sell, assuming entire amount can be sold in the current order.
- // We round up because the exchange rate computed by fillOrder rounds in favor
- // of the Maker. In this case we want to overestimate the amount of takerAsset.
- uint256 remainingTakerAssetFillAmount = getPartialAmountCeil(
- orders[i].takerAssetAmount,
- orders[i].makerAssetAmount,
- remainingMakerAssetFillAmount
- );
-
- // Attempt to sell the remaining amount of takerAsset
- FillResults memory singleFillResults = fillOrderNoThrow(
- orders[i],
- remainingTakerAssetFillAmount,
- signatures[i]
- );
-
- // Update amounts filled and fees paid by maker and taker
- addFillResults(totalFillResults, singleFillResults);
-
- // Stop execution if the entire amount of makerAsset has been bought
- uint256 makerAssetFilledAmount = totalFillResults.makerAssetFilledAmount;
- if (makerAssetFilledAmount >= makerAssetFillAmount) {
- break;
- }
- }
-
- require(
- makerAssetFilledAmount >= makerAssetFillAmount,
- "COMPLETE_FILL_FAILED"
- );
- return totalFillResults;
- }
-
- /// @dev Buys zrxBuyAmount of ZRX fee tokens, taking into account ZRX fees for each order. This will guarantee
- /// that at least zrxBuyAmount of ZRX is purchased (sometimes slightly over due to rounding issues).
- /// It is possible that a request to buy 200 ZRX will require purchasing 202 ZRX
- /// as 2 ZRX is required to purchase the 200 ZRX fee tokens. This guarantees at least 200 ZRX for future purchases.
- /// The asset being sold by taker must always be WETH.
- /// @param orders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset.
- /// @param zrxBuyAmount Desired amount of ZRX to buy.
- /// @param signatures Proofs that orders have been created by makers.
- /// @return totalFillResults Amounts filled and fees paid by maker and taker.
- function marketBuyExactZrxWithWeth(
- LibOrder.Order[] memory orders,
- uint256 zrxBuyAmount,
- bytes[] memory signatures
- )
- internal
- returns (FillResults memory totalFillResults)
- {
- // Do nothing if zrxBuyAmount == 0
- if (zrxBuyAmount == 0) {
- return totalFillResults;
- }
-
- bytes memory zrxAssetData = ZRX_ASSET_DATA;
- bytes memory wethAssetData = WETH_ASSET_DATA;
- uint256 zrxPurchased = 0;
-
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
-
- // All of these are ZRX/WETH, so we can drop the respective assetData from calldata.
- orders[i].makerAssetData = zrxAssetData;
- orders[i].takerAssetData = wethAssetData;
-
- // Calculate the remaining amount of ZRX to buy.
- uint256 remainingZrxBuyAmount = safeSub(zrxBuyAmount, zrxPurchased);
-
- // Convert the remaining amount of ZRX to buy into remaining amount
- // of WETH to sell, assuming entire amount can be sold in the current order.
- // We round up because the exchange rate computed by fillOrder rounds in favor
- // of the Maker. In this case we want to overestimate the amount of takerAsset.
- uint256 remainingWethSellAmount = getPartialAmountCeil(
- orders[i].takerAssetAmount,
- safeSub(orders[i].makerAssetAmount, orders[i].takerFee), // our exchange rate after fees
- remainingZrxBuyAmount
- );
-
- // Attempt to sell the remaining amount of WETH.
- FillResults memory singleFillResult = fillOrderNoThrow(
- orders[i],
- remainingWethSellAmount,
- signatures[i]
- );
-
- // Update amounts filled and fees paid by maker and taker.
- addFillResults(totalFillResults, singleFillResult);
- zrxPurchased = safeSub(totalFillResults.makerAssetFilledAmount, totalFillResults.takerFeePaid);
-
- // Stop execution if the entire amount of ZRX has been bought.
- if (zrxPurchased >= zrxBuyAmount) {
- break;
- }
- }
-
- require(
- zrxPurchased >= zrxBuyAmount,
- "COMPLETE_FILL_FAILED"
- );
- return totalFillResults;
- }
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/MixinForwarderCore.sol b/packages/contracts/contracts/extensions/Forwarder/MixinForwarderCore.sol
deleted file mode 100644
index 54487f726..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/MixinForwarderCore.sol
+++ /dev/null
@@ -1,214 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "./libs/LibConstants.sol";
-import "./mixins/MWeth.sol";
-import "./mixins/MAssets.sol";
-import "./mixins/MExchangeWrapper.sol";
-import "./interfaces/IForwarderCore.sol";
-import "../../utils/LibBytes/LibBytes.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-import "../../protocol/Exchange/libs/LibFillResults.sol";
-import "../../protocol/Exchange/libs/LibMath.sol";
-
-
-contract MixinForwarderCore is
- LibFillResults,
- LibMath,
- LibConstants,
- MWeth,
- MAssets,
- MExchangeWrapper,
- IForwarderCore
-{
- using LibBytes for bytes;
-
- /// @dev Constructor approves ERC20 proxy to transfer ZRX and WETH on this contract's behalf.
- constructor ()
- public
- {
- address proxyAddress = EXCHANGE.getAssetProxy(ERC20_DATA_ID);
- require(
- proxyAddress != address(0),
- "UNREGISTERED_ASSET_PROXY"
- );
- ETHER_TOKEN.approve(proxyAddress, MAX_UINT);
- ZRX_TOKEN.approve(proxyAddress, MAX_UINT);
- }
-
- /// @dev Purchases as much of orders' makerAssets as possible by selling up to 95% of transaction's ETH value.
- /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
- /// 5% of ETH value is reserved for paying fees to order feeRecipients (in ZRX) and forwarding contract feeRecipient (in ETH).
- /// Any ETH not spent will be refunded to sender.
- /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset.
- /// @param signatures Proofs that orders have been created by makers.
- /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.
- /// @param feeSignatures Proofs that feeOrders have been created by makers.
- /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
- /// @param feeRecipient Address that will receive ETH when orders are filled.
- /// @return Amounts filled and fees paid by maker and taker for both sets of orders.
- function marketSellOrdersWithEth(
- LibOrder.Order[] memory orders,
- bytes[] memory signatures,
- LibOrder.Order[] memory feeOrders,
- bytes[] memory feeSignatures,
- uint256 feePercentage,
- address feeRecipient
- )
- public
- payable
- returns (
- FillResults memory orderFillResults,
- FillResults memory feeOrderFillResults
- )
- {
- // Convert ETH to WETH.
- convertEthToWeth();
-
- uint256 wethSellAmount;
- uint256 zrxBuyAmount;
- uint256 makerAssetAmountPurchased;
- if (orders[0].makerAssetData.equals(ZRX_ASSET_DATA)) {
- // Calculate amount of WETH that won't be spent on ETH fees.
- wethSellAmount = getPartialAmountFloor(
- PERCENTAGE_DENOMINATOR,
- safeAdd(PERCENTAGE_DENOMINATOR, feePercentage),
- msg.value
- );
- // Market sell available WETH.
- // ZRX fees are paid with this contract's balance.
- orderFillResults = marketSellWeth(
- orders,
- wethSellAmount,
- signatures
- );
- // The fee amount must be deducted from the amount transfered back to sender.
- makerAssetAmountPurchased = safeSub(orderFillResults.makerAssetFilledAmount, orderFillResults.takerFeePaid);
- } else {
- // 5% of WETH is reserved for filling feeOrders and paying feeRecipient.
- wethSellAmount = getPartialAmountFloor(
- MAX_WETH_FILL_PERCENTAGE,
- PERCENTAGE_DENOMINATOR,
- msg.value
- );
- // Market sell 95% of WETH.
- // ZRX fees are payed with this contract's balance.
- orderFillResults = marketSellWeth(
- orders,
- wethSellAmount,
- signatures
- );
- // Buy back all ZRX spent on fees.
- zrxBuyAmount = orderFillResults.takerFeePaid;
- feeOrderFillResults = marketBuyExactZrxWithWeth(
- feeOrders,
- zrxBuyAmount,
- feeSignatures
- );
- makerAssetAmountPurchased = orderFillResults.makerAssetFilledAmount;
- }
-
- // Transfer feePercentage of total ETH spent on primary orders to feeRecipient.
- // Refund remaining ETH to msg.sender.
- transferEthFeeAndRefund(
- orderFillResults.takerAssetFilledAmount,
- feeOrderFillResults.takerAssetFilledAmount,
- feePercentage,
- feeRecipient
- );
-
- // Transfer purchased assets to msg.sender.
- transferAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);
- }
-
- /// @dev Attempt to purchase makerAssetFillAmount of makerAsset by selling ETH provided with transaction.
- /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
- /// Any ETH not spent will be refunded to sender.
- /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset.
- /// @param makerAssetFillAmount Desired amount of makerAsset to purchase.
- /// @param signatures Proofs that orders have been created by makers.
- /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.
- /// @param feeSignatures Proofs that feeOrders have been created by makers.
- /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
- /// @param feeRecipient Address that will receive ETH when orders are filled.
- /// @return Amounts filled and fees paid by maker and taker for both sets of orders.
- function marketBuyOrdersWithEth(
- LibOrder.Order[] memory orders,
- uint256 makerAssetFillAmount,
- bytes[] memory signatures,
- LibOrder.Order[] memory feeOrders,
- bytes[] memory feeSignatures,
- uint256 feePercentage,
- address feeRecipient
- )
- public
- payable
- returns (
- FillResults memory orderFillResults,
- FillResults memory feeOrderFillResults
- )
- {
- // Convert ETH to WETH.
- convertEthToWeth();
-
- uint256 zrxBuyAmount;
- uint256 makerAssetAmountPurchased;
- if (orders[0].makerAssetData.equals(ZRX_ASSET_DATA)) {
- // If the makerAsset is ZRX, it is not necessary to pay fees out of this
- // contracts's ZRX balance because fees are factored into the price of the order.
- orderFillResults = marketBuyExactZrxWithWeth(
- orders,
- makerAssetFillAmount,
- signatures
- );
- // The fee amount must be deducted from the amount transfered back to sender.
- makerAssetAmountPurchased = safeSub(orderFillResults.makerAssetFilledAmount, orderFillResults.takerFeePaid);
- } else {
- // Attemp to purchase desired amount of makerAsset.
- // ZRX fees are payed with this contract's balance.
- orderFillResults = marketBuyExactAmountWithWeth(
- orders,
- makerAssetFillAmount,
- signatures
- );
- // Buy back all ZRX spent on fees.
- zrxBuyAmount = orderFillResults.takerFeePaid;
- feeOrderFillResults = marketBuyExactZrxWithWeth(
- feeOrders,
- zrxBuyAmount,
- feeSignatures
- );
- makerAssetAmountPurchased = orderFillResults.makerAssetFilledAmount;
- }
-
- // Transfer feePercentage of total ETH spent on primary orders to feeRecipient.
- // Refund remaining ETH to msg.sender.
- transferEthFeeAndRefund(
- orderFillResults.takerAssetFilledAmount,
- feeOrderFillResults.takerAssetFilledAmount,
- feePercentage,
- feeRecipient
- );
-
- // Transfer purchased assets to msg.sender.
- transferAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);
- }
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/MixinWeth.sol b/packages/contracts/contracts/extensions/Forwarder/MixinWeth.sol
deleted file mode 100644
index d2814a49b..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/MixinWeth.sol
+++ /dev/null
@@ -1,113 +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.24;
-
-import "../../protocol/Exchange/libs/LibMath.sol";
-import "./libs/LibConstants.sol";
-import "./mixins/MWeth.sol";
-
-
-contract MixinWeth is
- LibMath,
- LibConstants,
- MWeth
-{
- /// @dev Default payabale function, this allows us to withdraw WETH
- function ()
- public
- payable
- {
- require(
- msg.sender == address(ETHER_TOKEN),
- "DEFAULT_FUNCTION_WETH_CONTRACT_ONLY"
- );
- }
-
- /// @dev Converts message call's ETH value into WETH.
- function convertEthToWeth()
- internal
- {
- require(
- msg.value > 0,
- "INVALID_MSG_VALUE"
- );
- ETHER_TOKEN.deposit.value(msg.value)();
- }
-
- /// @dev Transfers feePercentage of WETH spent on primary orders to feeRecipient.
- /// Refunds any excess ETH to msg.sender.
- /// @param wethSoldExcludingFeeOrders Amount of WETH sold when filling primary orders.
- /// @param wethSoldForZrx Amount of WETH sold when purchasing ZRX required for primary order fees.
- /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
- /// @param feeRecipient Address that will receive ETH when orders are filled.
- function transferEthFeeAndRefund(
- uint256 wethSoldExcludingFeeOrders,
- uint256 wethSoldForZrx,
- uint256 feePercentage,
- address feeRecipient
- )
- internal
- {
- // Ensure feePercentage is less than 5%.
- require(
- feePercentage <= MAX_FEE_PERCENTAGE,
- "FEE_PERCENTAGE_TOO_LARGE"
- );
-
- // Ensure that no extra WETH owned by this contract has been sold.
- uint256 wethSold = safeAdd(wethSoldExcludingFeeOrders, wethSoldForZrx);
- require(
- wethSold <= msg.value,
- "OVERSOLD_WETH"
- );
-
- // Calculate amount of WETH that hasn't been sold.
- uint256 wethRemaining = safeSub(msg.value, wethSold);
-
- // Calculate ETH fee to pay to feeRecipient.
- uint256 ethFee = getPartialAmountFloor(
- feePercentage,
- PERCENTAGE_DENOMINATOR,
- wethSoldExcludingFeeOrders
- );
-
- // Ensure fee is less than amount of WETH remaining.
- require(
- ethFee <= wethRemaining,
- "INSUFFICIENT_ETH_REMAINING"
- );
-
- // Do nothing if no WETH remaining
- if (wethRemaining > 0) {
- // Convert remaining WETH to ETH
- ETHER_TOKEN.withdraw(wethRemaining);
-
- // Pay ETH to feeRecipient
- if (ethFee > 0) {
- feeRecipient.transfer(ethFee);
- }
-
- // Refund remaining ETH to msg.sender.
- uint256 ethRefund = safeSub(wethRemaining, ethFee);
- if (ethRefund > 0) {
- msg.sender.transfer(ethRefund);
- }
- }
- }
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/interfaces/IAssets.sol b/packages/contracts/contracts/extensions/Forwarder/interfaces/IAssets.sol
deleted file mode 100644
index 1e034c003..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/interfaces/IAssets.sol
+++ /dev/null
@@ -1,34 +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.24;
-
-
-contract IAssets {
-
- /// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to
- /// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be
- /// used to withdraw assets that were accidentally sent to this contract.
- /// @param assetData Byte array encoded for the respective asset proxy.
- /// @param amount Amount of ERC20 token to withdraw.
- function withdrawAsset(
- bytes assetData,
- uint256 amount
- )
- external;
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarder.sol b/packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarder.sol
deleted file mode 100644
index f5a26e2ba..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarder.sol
+++ /dev/null
@@ -1,30 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "./IForwarderCore.sol";
-import "./IAssets.sol";
-
-
-// solhint-disable no-empty-blocks
-contract IForwarder is
- IForwarderCore,
- IAssets
-{}
diff --git a/packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol b/packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol
deleted file mode 100644
index 74c7da01d..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol
+++ /dev/null
@@ -1,80 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../../../protocol/Exchange/libs/LibOrder.sol";
-import "../../../protocol/Exchange/libs/LibFillResults.sol";
-
-
-contract IForwarderCore {
-
- /// @dev Purchases as much of orders' makerAssets as possible by selling up to 95% of transaction's ETH value.
- /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
- /// 5% of ETH value is reserved for paying fees to order feeRecipients (in ZRX) and forwarding contract feeRecipient (in ETH).
- /// Any ETH not spent will be refunded to sender.
- /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset.
- /// @param signatures Proofs that orders have been created by makers.
- /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.
- /// @param feeSignatures Proofs that feeOrders have been created by makers.
- /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
- /// @param feeRecipient Address that will receive ETH when orders are filled.
- /// @return Amounts filled and fees paid by maker and taker for both sets of orders.
- function marketSellOrdersWithEth(
- LibOrder.Order[] memory orders,
- bytes[] memory signatures,
- LibOrder.Order[] memory feeOrders,
- bytes[] memory feeSignatures,
- uint256 feePercentage,
- address feeRecipient
- )
- public
- payable
- returns (
- LibFillResults.FillResults memory orderFillResults,
- LibFillResults.FillResults memory feeOrderFillResults
- );
-
- /// @dev Attempt to purchase makerAssetFillAmount of makerAsset by selling ETH provided with transaction.
- /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.
- /// Any ETH not spent will be refunded to sender.
- /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset.
- /// @param makerAssetFillAmount Desired amount of makerAsset to purchase.
- /// @param signatures Proofs that orders have been created by makers.
- /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.
- /// @param feeSignatures Proofs that feeOrders have been created by makers.
- /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
- /// @param feeRecipient Address that will receive ETH when orders are filled.
- /// @return Amounts filled and fees paid by maker and taker for both sets of orders.
- function marketBuyOrdersWithEth(
- LibOrder.Order[] memory orders,
- uint256 makerAssetFillAmount,
- bytes[] memory signatures,
- LibOrder.Order[] memory feeOrders,
- bytes[] memory feeSignatures,
- uint256 feePercentage,
- address feeRecipient
- )
- public
- payable
- returns (
- LibFillResults.FillResults memory orderFillResults,
- LibFillResults.FillResults memory feeOrderFillResults
- );
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/libs/LibConstants.sol b/packages/contracts/contracts/extensions/Forwarder/libs/LibConstants.sol
deleted file mode 100644
index 704e42ce3..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/libs/LibConstants.sol
+++ /dev/null
@@ -1,62 +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.24;
-
-import "../../../utils/LibBytes/LibBytes.sol";
-import "../../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../../tokens/EtherToken/IEtherToken.sol";
-import "../../../tokens/ERC20Token/IERC20Token.sol";
-
-
-contract LibConstants {
-
- using LibBytes for bytes;
-
- bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256("ERC20Token(address)"));
- bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256("ERC721Token(address,uint256)"));
- uint256 constant internal MAX_UINT = 2**256 - 1;
- uint256 constant internal PERCENTAGE_DENOMINATOR = 10**18;
- uint256 constant internal MAX_FEE_PERCENTAGE = 5 * PERCENTAGE_DENOMINATOR / 100; // 5%
- uint256 constant internal MAX_WETH_FILL_PERCENTAGE = 95 * PERCENTAGE_DENOMINATOR / 100; // 95%
-
- // solhint-disable var-name-mixedcase
- IExchange internal EXCHANGE;
- IEtherToken internal ETHER_TOKEN;
- IERC20Token internal ZRX_TOKEN;
- bytes internal ZRX_ASSET_DATA;
- bytes internal WETH_ASSET_DATA;
- // solhint-enable var-name-mixedcase
-
- constructor (
- address _exchange,
- bytes memory _zrxAssetData,
- bytes memory _wethAssetData
- )
- public
- {
- EXCHANGE = IExchange(_exchange);
- ZRX_ASSET_DATA = _zrxAssetData;
- WETH_ASSET_DATA = _wethAssetData;
-
- address etherToken = _wethAssetData.readAddress(16);
- address zrxToken = _zrxAssetData.readAddress(16);
- ETHER_TOKEN = IEtherToken(etherToken);
- ZRX_TOKEN = IERC20Token(zrxToken);
- }
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol b/packages/contracts/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol
deleted file mode 100644
index fb3ade1db..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/libs/LibForwarderErrors.sol
+++ /dev/null
@@ -1,34 +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.
-
-*/
-
-// solhint-disable
-pragma solidity 0.4.24;
-
-
-/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.
-contract LibForwarderErrors {
- string constant FEE_PERCENTAGE_TOO_LARGE = "FEE_PROPORTION_TOO_LARGE"; // Provided fee percentage greater than 5%.
- string constant INSUFFICIENT_ETH_REMAINING = "INSUFFICIENT_ETH_REMAINING"; // Not enough ETH remaining to pay feeRecipient.
- string constant OVERSOLD_WETH = "OVERSOLD_WETH"; // More WETH sold than provided with current message call.
- string constant COMPLETE_FILL_FAILED = "COMPLETE_FILL_FAILED"; // Desired purchase amount not completely filled (required for ZRX fees only).
- string constant TRANSFER_FAILED = "TRANSFER_FAILED"; // Asset transfer failed.
- string constant UNSUPPORTED_ASSET_PROXY = "UNSUPPORTED_ASSET_PROXY"; // Proxy in assetData not supported.
- string constant DEFAULT_FUNCTION_WETH_CONTRACT_ONLY = "DEFAULT_FUNCTION_WETH_CONTRACT_ONLY"; // Fallback function may only be used for WETH withdrawals.
- string constant INVALID_MSG_VALUE = "INVALID_MSG_VALUE"; // msg.value must be greater than 0.
- string constant INVALID_AMOUNT = "INVALID_AMOUNT"; // Amount must equal 1.
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/mixins/MAssets.sol b/packages/contracts/contracts/extensions/Forwarder/mixins/MAssets.sol
deleted file mode 100644
index 9e7f80d97..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/mixins/MAssets.sol
+++ /dev/null
@@ -1,53 +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.24;
-
-import "../interfaces/IAssets.sol";
-
-
-contract MAssets is
- IAssets
-{
- /// @dev Transfers given amount of asset to sender.
- /// @param assetData Byte array encoded for the respective asset proxy.
- /// @param amount Amount of asset to transfer to sender.
- function transferAssetToSender(
- bytes memory assetData,
- uint256 amount
- )
- internal;
-
- /// @dev Decodes ERC20 assetData and transfers given amount to sender.
- /// @param assetData Byte array encoded for the respective asset proxy.
- /// @param amount Amount of asset to transfer to sender.
- function transferERC20Token(
- bytes memory assetData,
- uint256 amount
- )
- internal;
-
- /// @dev Decodes ERC721 assetData and transfers given amount to sender.
- /// @param assetData Byte array encoded for the respective asset proxy.
- /// @param amount Amount of asset to transfer to sender.
- function transferERC721Token(
- bytes memory assetData,
- uint256 amount
- )
- internal;
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol b/packages/contracts/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol
deleted file mode 100644
index 13c26b03a..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol
+++ /dev/null
@@ -1,87 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../../../protocol/Exchange/libs/LibOrder.sol";
-import "../../../protocol/Exchange/libs/LibFillResults.sol";
-
-
-contract MExchangeWrapper {
-
- /// @dev Fills the input order.
- /// Returns false if the transaction would otherwise revert.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- /// @return Amounts filled and fees paid by maker and taker.
- function fillOrderNoThrow(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- internal
- returns (LibFillResults.FillResults memory fillResults);
-
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of WETH has been sold by taker.
- /// Returns false if the transaction would otherwise revert.
- /// @param orders Array of order specifications.
- /// @param wethSellAmount Desired amount of WETH to sell.
- /// @param signatures Proofs that orders have been signed by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketSellWeth(
- LibOrder.Order[] memory orders,
- uint256 wethSellAmount,
- bytes[] memory signatures
- )
- internal
- returns (LibFillResults.FillResults memory totalFillResults);
-
- /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.
- /// Returns false if the transaction would otherwise revert.
- /// The asset being sold by taker must always be WETH.
- /// @param orders Array of order specifications.
- /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
- /// @param signatures Proofs that orders have been signed by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketBuyExactAmountWithWeth(
- LibOrder.Order[] memory orders,
- uint256 makerAssetFillAmount,
- bytes[] memory signatures
- )
- internal
- returns (LibFillResults.FillResults memory totalFillResults);
-
- /// @dev Buys zrxBuyAmount of ZRX fee tokens, taking into account ZRX fees for each order. This will guarantee
- /// that at least zrxBuyAmount of ZRX is purchased (sometimes slightly over due to rounding issues).
- /// It is possible that a request to buy 200 ZRX will require purchasing 202 ZRX
- /// as 2 ZRX is required to purchase the 200 ZRX fee tokens. This guarantees at least 200 ZRX for future purchases.
- /// The asset being sold by taker must always be WETH.
- /// @param orders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset.
- /// @param zrxBuyAmount Desired amount of ZRX to buy.
- /// @param signatures Proofs that orders have been created by makers.
- /// @return totalFillResults Amounts filled and fees paid by maker and taker.
- function marketBuyExactZrxWithWeth(
- LibOrder.Order[] memory orders,
- uint256 zrxBuyAmount,
- bytes[] memory signatures
- )
- internal
- returns (LibFillResults.FillResults memory totalFillResults);
-}
diff --git a/packages/contracts/contracts/extensions/Forwarder/mixins/MWeth.sol b/packages/contracts/contracts/extensions/Forwarder/mixins/MWeth.sol
deleted file mode 100644
index 88e77be4e..000000000
--- a/packages/contracts/contracts/extensions/Forwarder/mixins/MWeth.sol
+++ /dev/null
@@ -1,41 +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.24;
-
-
-contract MWeth {
-
- /// @dev Converts message call's ETH value into WETH.
- function convertEthToWeth()
- internal;
-
- /// @dev Transfers feePercentage of WETH spent on primary orders to feeRecipient.
- /// Refunds any excess ETH to msg.sender.
- /// @param wethSoldExcludingFeeOrders Amount of WETH sold when filling primary orders.
- /// @param wethSoldForZrx Amount of WETH sold when purchasing ZRX required for primary order fees.
- /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.
- /// @param feeRecipient Address that will receive ETH when orders are filled.
- function transferEthFeeAndRefund(
- uint256 wethSoldExcludingFeeOrders,
- uint256 wethSoldForZrx,
- uint256 feePercentage,
- address feeRecipient
- )
- internal;
-}
diff --git a/packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol b/packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol
deleted file mode 100644
index 8bfde3847..000000000
--- a/packages/contracts/contracts/extensions/OrderValidator/OrderValidator.sol
+++ /dev/null
@@ -1,218 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-import "../../tokens/ERC20Token/IERC20Token.sol";
-import "../../tokens/ERC721Token/IERC721Token.sol";
-import "../../utils/LibBytes/LibBytes.sol";
-
-
-contract OrderValidator {
-
- using LibBytes for bytes;
-
- bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256("ERC20Token(address)"));
- bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256("ERC721Token(address,uint256)"));
-
- struct TraderInfo {
- uint256 makerBalance; // Maker's balance of makerAsset
- uint256 makerAllowance; // Maker's allowance to corresponding AssetProxy
- uint256 takerBalance; // Taker's balance of takerAsset
- uint256 takerAllowance; // Taker's allowance to corresponding AssetProxy
- uint256 makerZrxBalance; // Maker's balance of ZRX
- uint256 makerZrxAllowance; // Maker's allowance of ZRX to ERC20Proxy
- uint256 takerZrxBalance; // Taker's balance of ZRX
- uint256 takerZrxAllowance; // Taker's allowance of ZRX to ERC20Proxy
- }
-
- // solhint-disable var-name-mixedcase
- IExchange internal EXCHANGE;
- bytes internal ZRX_ASSET_DATA;
- // solhint-enable var-name-mixedcase
-
- constructor (address _exchange, bytes memory _zrxAssetData)
- public
- {
- EXCHANGE = IExchange(_exchange);
- ZRX_ASSET_DATA = _zrxAssetData;
- }
-
- /// @dev Fetches information for order and maker/taker of order.
- /// @param order The order structure.
- /// @param takerAddress Address that will be filling the order.
- /// @return OrderInfo and TraderInfo instances for given order.
- function getOrderAndTraderInfo(LibOrder.Order memory order, address takerAddress)
- public
- view
- returns (LibOrder.OrderInfo memory orderInfo, TraderInfo memory traderInfo)
- {
- orderInfo = EXCHANGE.getOrderInfo(order);
- traderInfo = getTraderInfo(order, takerAddress);
- return (orderInfo, traderInfo);
- }
-
- /// @dev Fetches information for all passed in orders and the makers/takers of each order.
- /// @param orders Array of order specifications.
- /// @param takerAddresses Array of taker addresses corresponding to each order.
- /// @return Arrays of OrderInfo and TraderInfo instances that correspond to each order.
- function getOrdersAndTradersInfo(LibOrder.Order[] memory orders, address[] memory takerAddresses)
- public
- view
- returns (LibOrder.OrderInfo[] memory ordersInfo, TraderInfo[] memory tradersInfo)
- {
- ordersInfo = EXCHANGE.getOrdersInfo(orders);
- tradersInfo = getTradersInfo(orders, takerAddresses);
- return (ordersInfo, tradersInfo);
- }
-
- /// @dev Fetches balance and allowances for maker and taker of order.
- /// @param order The order structure.
- /// @param takerAddress Address that will be filling the order.
- /// @return Balances and allowances of maker and taker of order.
- function getTraderInfo(LibOrder.Order memory order, address takerAddress)
- public
- view
- returns (TraderInfo memory traderInfo)
- {
- (traderInfo.makerBalance, traderInfo.makerAllowance) = getBalanceAndAllowance(order.makerAddress, order.makerAssetData);
- (traderInfo.takerBalance, traderInfo.takerAllowance) = getBalanceAndAllowance(takerAddress, order.takerAssetData);
- bytes memory zrxAssetData = ZRX_ASSET_DATA;
- (traderInfo.makerZrxBalance, traderInfo.makerZrxAllowance) = getBalanceAndAllowance(order.makerAddress, zrxAssetData);
- (traderInfo.takerZrxBalance, traderInfo.takerZrxAllowance) = getBalanceAndAllowance(takerAddress, zrxAssetData);
- return traderInfo;
- }
-
- /// @dev Fetches balances and allowances of maker and taker for each provided order.
- /// @param orders Array of order specifications.
- /// @param takerAddresses Array of taker addresses corresponding to each order.
- /// @return Array of balances and allowances for maker and taker of each order.
- function getTradersInfo(LibOrder.Order[] memory orders, address[] memory takerAddresses)
- public
- view
- returns (TraderInfo[] memory)
- {
- uint256 ordersLength = orders.length;
- TraderInfo[] memory tradersInfo = new TraderInfo[](ordersLength);
- for (uint256 i = 0; i != ordersLength; i++) {
- tradersInfo[i] = getTraderInfo(orders[i], takerAddresses[i]);
- }
- return tradersInfo;
- }
-
- /// @dev Fetches token balances and allowances of an address to given assetProxy. Supports ERC20 and ERC721.
- /// @param target Address to fetch balances and allowances of.
- /// @param assetData Encoded data that can be decoded by a specified proxy contract when transferring asset.
- /// @return Balance of asset and allowance set to given proxy of asset.
- /// For ERC721 tokens, these values will always be 1 or 0.
- function getBalanceAndAllowance(address target, bytes memory assetData)
- public
- view
- returns (uint256 balance, uint256 allowance)
- {
- bytes4 assetProxyId = assetData.readBytes4(0);
- address token = assetData.readAddress(16);
- address assetProxy = EXCHANGE.getAssetProxy(assetProxyId);
-
- if (assetProxyId == ERC20_DATA_ID) {
- // Query balance
- balance = IERC20Token(token).balanceOf(target);
-
- // Query allowance
- allowance = IERC20Token(token).allowance(target, assetProxy);
- } else if (assetProxyId == ERC721_DATA_ID) {
- uint256 tokenId = assetData.readUint256(36);
-
- // Query owner of tokenId
- address owner = getERC721TokenOwner(token, tokenId);
-
- // Set balance to 1 if tokenId is owned by target
- balance = target == owner ? 1 : 0;
-
- // Check if ERC721Proxy is approved to spend tokenId
- bool isApproved = IERC721Token(token).isApprovedForAll(target, assetProxy) || IERC721Token(token).getApproved(tokenId) == assetProxy;
-
- // Set alowance to 1 if ERC721Proxy is approved to spend tokenId
- allowance = isApproved ? 1 : 0;
- } else {
- revert("UNSUPPORTED_ASSET_PROXY");
- }
- return (balance, allowance);
- }
-
- /// @dev Fetches token balances and allowances of an address for each given assetProxy. Supports ERC20 and ERC721.
- /// @param target Address to fetch balances and allowances of.
- /// @param assetData Array of encoded byte arrays that can be decoded by a specified proxy contract when transferring asset.
- /// @return Balances and allowances of assets.
- /// For ERC721 tokens, these values will always be 1 or 0.
- function getBalancesAndAllowances(address target, bytes[] memory assetData)
- public
- view
- returns (uint256[] memory, uint256[] memory)
- {
- uint256 length = assetData.length;
- uint256[] memory balances = new uint256[](length);
- uint256[] memory allowances = new uint256[](length);
- for (uint256 i = 0; i != length; i++) {
- (balances[i], allowances[i]) = getBalanceAndAllowance(target, assetData[i]);
- }
- return (balances, allowances);
- }
-
- /// @dev Calls `token.ownerOf(tokenId)`, but returns a null owner instead of reverting on an unowned token.
- /// @param token Address of ERC721 token.
- /// @param tokenId The identifier for the specific NFT.
- /// @return Owner of tokenId or null address if unowned.
- function getERC721TokenOwner(address token, uint256 tokenId)
- public
- view
- returns (address owner)
- {
- assembly {
- // load free memory pointer
- let cdStart := mload(64)
-
- // bytes4(keccak256(ownerOf(uint256))) = 0x6352211e
- mstore(cdStart, 0x6352211e00000000000000000000000000000000000000000000000000000000)
- mstore(add(cdStart, 4), tokenId)
-
- // staticcall `ownerOf(tokenId)`
- // `ownerOf` will revert if tokenId is not owned
- let success := staticcall(
- gas, // forward all gas
- token, // call token contract
- cdStart, // start of calldata
- 36, // length of input is 36 bytes
- cdStart, // write output over input
- 32 // size of output is 32 bytes
- )
-
- // Success implies that tokenId is owned
- // Copy owner from return data if successful
- if success {
- owner := mload(cdStart)
- }
- }
-
- // Owner initialized to address(0), no need to modify if call is unsuccessful
- return owner;
- }
-}
diff --git a/packages/contracts/contracts/protocol/AssetProxy/MixinAuthorizable.sol b/packages/contracts/contracts/protocol/AssetProxy/MixinAuthorizable.sol
deleted file mode 100644
index fe9bbf848..000000000
--- a/packages/contracts/contracts/protocol/AssetProxy/MixinAuthorizable.sol
+++ /dev/null
@@ -1,117 +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.24;
-
-import "../../utils/Ownable/Ownable.sol";
-import "./mixins/MAuthorizable.sol";
-
-
-contract MixinAuthorizable is
- Ownable,
- MAuthorizable
-{
- /// @dev Only authorized addresses can invoke functions with this modifier.
- modifier onlyAuthorized {
- require(
- authorized[msg.sender],
- "SENDER_NOT_AUTHORIZED"
- );
- _;
- }
-
- mapping (address => bool) public authorized;
- address[] public authorities;
-
- /// @dev Authorizes an address.
- /// @param target Address to authorize.
- function addAuthorizedAddress(address target)
- external
- onlyOwner
- {
- require(
- !authorized[target],
- "TARGET_ALREADY_AUTHORIZED"
- );
-
- authorized[target] = true;
- authorities.push(target);
- emit AuthorizedAddressAdded(target, msg.sender);
- }
-
- /// @dev Removes authorizion of an address.
- /// @param target Address to remove authorization from.
- function removeAuthorizedAddress(address target)
- external
- onlyOwner
- {
- require(
- authorized[target],
- "TARGET_NOT_AUTHORIZED"
- );
-
- delete authorized[target];
- for (uint256 i = 0; i < authorities.length; i++) {
- if (authorities[i] == target) {
- authorities[i] = authorities[authorities.length - 1];
- authorities.length -= 1;
- break;
- }
- }
- emit AuthorizedAddressRemoved(target, msg.sender);
- }
-
- /// @dev Removes authorizion of an address.
- /// @param target Address to remove authorization from.
- /// @param index Index of target in authorities array.
- function removeAuthorizedAddressAtIndex(
- address target,
- uint256 index
- )
- external
- onlyOwner
- {
- require(
- authorized[target],
- "TARGET_NOT_AUTHORIZED"
- );
- require(
- index < authorities.length,
- "INDEX_OUT_OF_BOUNDS"
- );
- require(
- authorities[index] == target,
- "AUTHORIZED_ADDRESS_MISMATCH"
- );
-
- delete authorized[target];
- authorities[index] = authorities[authorities.length - 1];
- authorities.length -= 1;
- emit AuthorizedAddressRemoved(target, msg.sender);
- }
-
- /// @dev Gets all authorized addresses.
- /// @return Array of authorized addresses.
- function getAuthorizedAddresses()
- external
- view
- returns (address[] memory)
- {
- return authorities;
- }
-}
diff --git a/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetData.sol b/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetData.sol
deleted file mode 100644
index 3e76e38dd..000000000
--- a/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetData.sol
+++ /dev/null
@@ -1,40 +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.
-
-*/
-
-// solhint-disable
-pragma solidity 0.4.24;
-
-
-// @dev Interface of the asset proxy's assetData.
-// The asset proxies take an ABI encoded `bytes assetData` as argument.
-// This argument is ABI encoded as one of the methods of this interface.
-interface IAssetData {
-
- function ERC20Token(address tokenContract)
- external
- pure;
-
- function ERC721Token(
- address tokenContract,
- uint256 tokenId,
- bytes receiverData
- )
- external
- pure;
-
-}
diff --git a/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetProxy.sol b/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetProxy.sol
deleted file mode 100644
index b25d2d75a..000000000
--- a/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAssetProxy.sol
+++ /dev/null
@@ -1,46 +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.24;
-
-import "./IAuthorizable.sol";
-
-
-contract IAssetProxy is
- IAuthorizable
-{
- /// @dev Transfers assets. Either succeeds or throws.
- /// @param assetData Byte array encoded for the respective asset proxy.
- /// @param from Address to transfer asset from.
- /// @param to Address to transfer asset to.
- /// @param amount Amount of asset to transfer.
- function transferFrom(
- bytes assetData,
- address from,
- address to,
- uint256 amount
- )
- external;
-
- /// @dev Gets the proxy id associated with the proxy address.
- /// @return Proxy id.
- function getProxyId()
- external
- pure
- returns (bytes4);
-}
diff --git a/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAuthorizable.sol b/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAuthorizable.sol
deleted file mode 100644
index ba1d4aa77..000000000
--- a/packages/contracts/contracts/protocol/AssetProxy/interfaces/IAuthorizable.sol
+++ /dev/null
@@ -1,52 +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.24;
-
-import "../../../utils/Ownable/IOwnable.sol";
-
-
-contract IAuthorizable is
- IOwnable
-{
- /// @dev Authorizes an address.
- /// @param target Address to authorize.
- function addAuthorizedAddress(address target)
- external;
-
- /// @dev Removes authorizion of an address.
- /// @param target Address to remove authorization from.
- function removeAuthorizedAddress(address target)
- external;
-
- /// @dev Removes authorizion of an address.
- /// @param target Address to remove authorization from.
- /// @param index Index of target in authorities array.
- function removeAuthorizedAddressAtIndex(
- address target,
- uint256 index
- )
- external;
-
- /// @dev Gets all authorized addresses.
- /// @return Array of authorized addresses.
- function getAuthorizedAddresses()
- external
- view
- returns (address[] memory);
-}
diff --git a/packages/contracts/contracts/protocol/AssetProxy/libs/LibAssetProxyErrors.sol b/packages/contracts/contracts/protocol/AssetProxy/libs/LibAssetProxyErrors.sol
deleted file mode 100644
index 1d9a70cc1..000000000
--- a/packages/contracts/contracts/protocol/AssetProxy/libs/LibAssetProxyErrors.sol
+++ /dev/null
@@ -1,38 +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.
-
-*/
-
-// solhint-disable
-pragma solidity 0.4.24;
-
-
-/// @dev This contract documents the revert reasons used in the AssetProxy contracts.
-/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.
-contract LibAssetProxyErrors {
-
- /// Authorizable errors ///
- string constant SENDER_NOT_AUTHORIZED = "SENDER_NOT_AUTHORIZED"; // Sender not authorized to call this method.
- string constant TARGET_NOT_AUTHORIZED = "TARGET_NOT_AUTHORIZED"; // Target address not authorized to call this method.
- string constant TARGET_ALREADY_AUTHORIZED = "TARGET_ALREADY_AUTHORIZED"; // Target address must not already be authorized.
- string constant INDEX_OUT_OF_BOUNDS = "INDEX_OUT_OF_BOUNDS"; // Specified array index is out of bounds.
- string constant AUTHORIZED_ADDRESS_MISMATCH = "AUTHORIZED_ADDRESS_MISMATCH"; // Address at index does not match given target address.
-
- /// Transfer errors ///
- string constant INVALID_AMOUNT = "INVALID_AMOUNT"; // Transfer amount must equal 1.
- string constant TRANSFER_FAILED = "TRANSFER_FAILED"; // Transfer failed.
- string constant LENGTH_GREATER_THAN_131_REQUIRED = "LENGTH_GREATER_THAN_131_REQUIRED"; // Byte array must have a length greater than 0.
-}
diff --git a/packages/contracts/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol b/packages/contracts/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol
deleted file mode 100644
index d63fb7f6d..000000000
--- a/packages/contracts/contracts/protocol/AssetProxy/mixins/MAuthorizable.sol
+++ /dev/null
@@ -1,41 +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.24;
-
-import "../interfaces/IAuthorizable.sol";
-
-
-contract MAuthorizable is
- IAuthorizable
-{
- // Event logged when a new address is authorized.
- event AuthorizedAddressAdded(
- address indexed target,
- address indexed caller
- );
-
- // Event logged when a currently authorized address is unauthorized.
- event AuthorizedAddressRemoved(
- address indexed target,
- address indexed caller
- );
-
- /// @dev Only authorized addresses can invoke functions with this modifier.
- modifier onlyAuthorized { revert(); _; }
-}
diff --git a/packages/contracts/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol b/packages/contracts/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol
deleted file mode 100644
index edb788fab..000000000
--- a/packages/contracts/contracts/protocol/AssetProxyOwner/AssetProxyOwner.sol
+++ /dev/null
@@ -1,108 +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.24;
-
-import "../../multisig/MultiSigWalletWithTimeLock.sol";
-import "../../utils/LibBytes/LibBytes.sol";
-
-
-contract AssetProxyOwner is
- MultiSigWalletWithTimeLock
-{
- using LibBytes for bytes;
-
- event AssetProxyRegistration(address assetProxyContract, bool isRegistered);
-
- // Mapping of AssetProxy contract address =>
- // if this contract is allowed to call the AssetProxy's `removeAuthorizedAddressAtIndex` method without a time lock.
- mapping (address => bool) public isAssetProxyRegistered;
-
- bytes4 constant internal REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR = bytes4(keccak256("removeAuthorizedAddressAtIndex(address,uint256)"));
-
- /// @dev Function will revert if the transaction does not call `removeAuthorizedAddressAtIndex`
- /// on an approved AssetProxy contract.
- modifier validRemoveAuthorizedAddressAtIndexTx(uint256 transactionId) {
- Transaction storage txn = transactions[transactionId];
- require(
- isAssetProxyRegistered[txn.destination],
- "UNREGISTERED_ASSET_PROXY"
- );
- require(
- txn.data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR,
- "INVALID_FUNCTION_SELECTOR"
- );
- _;
- }
-
- /// @dev Contract constructor sets initial owners, required number of confirmations,
- /// time lock, and list of AssetProxy addresses.
- /// @param _owners List of initial owners.
- /// @param _assetProxyContracts Array of AssetProxy contract addresses.
- /// @param _required Number of required confirmations.
- /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.
- constructor (
- address[] memory _owners,
- address[] memory _assetProxyContracts,
- uint256 _required,
- uint256 _secondsTimeLocked
- )
- public
- MultiSigWalletWithTimeLock(_owners, _required, _secondsTimeLocked)
- {
- for (uint256 i = 0; i < _assetProxyContracts.length; i++) {
- address assetProxy = _assetProxyContracts[i];
- require(
- assetProxy != address(0),
- "INVALID_ASSET_PROXY"
- );
- isAssetProxyRegistered[assetProxy] = true;
- }
- }
-
- /// @dev Registers or deregisters an AssetProxy to be able to execute
- /// `removeAuthorizedAddressAtIndex` without a timelock.
- /// @param assetProxyContract Address of AssetProxy contract.
- /// @param isRegistered Status of approval for AssetProxy contract.
- function registerAssetProxy(address assetProxyContract, bool isRegistered)
- public
- onlyWallet
- notNull(assetProxyContract)
- {
- isAssetProxyRegistered[assetProxyContract] = isRegistered;
- emit AssetProxyRegistration(assetProxyContract, isRegistered);
- }
-
- /// @dev Allows execution of `removeAuthorizedAddressAtIndex` without time lock.
- /// @param transactionId Transaction ID.
- function executeRemoveAuthorizedAddressAtIndex(uint256 transactionId)
- public
- notExecuted(transactionId)
- fullyConfirmed(transactionId)
- validRemoveAuthorizedAddressAtIndexTx(transactionId)
- {
- Transaction storage txn = transactions[transactionId];
- txn.executed = true;
- if (external_call(txn.destination, txn.value, txn.data.length, txn.data)) {
- emit Execution(transactionId);
- } else {
- emit ExecutionFailure(transactionId);
- txn.executed = false;
- }
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/Exchange.sol b/packages/contracts/contracts/protocol/Exchange/Exchange.sol
deleted file mode 100644
index ead36009f..000000000
--- a/packages/contracts/contracts/protocol/Exchange/Exchange.sol
+++ /dev/null
@@ -1,53 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "./libs/LibConstants.sol";
-import "./MixinExchangeCore.sol";
-import "./MixinSignatureValidator.sol";
-import "./MixinWrapperFunctions.sol";
-import "./MixinAssetProxyDispatcher.sol";
-import "./MixinTransactions.sol";
-import "./MixinMatchOrders.sol";
-
-
-// solhint-disable no-empty-blocks
-contract Exchange is
- MixinExchangeCore,
- MixinMatchOrders,
- MixinSignatureValidator,
- MixinTransactions,
- MixinAssetProxyDispatcher,
- MixinWrapperFunctions
-{
- string constant public VERSION = "2.0.1-alpha";
-
- // Mixins are instantiated in the order they are inherited
- constructor (bytes memory _zrxAssetData)
- public
- LibConstants(_zrxAssetData) // @TODO: Remove when we deploy.
- MixinExchangeCore()
- MixinMatchOrders()
- MixinSignatureValidator()
- MixinTransactions()
- MixinAssetProxyDispatcher()
- MixinWrapperFunctions()
- {}
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol b/packages/contracts/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol
deleted file mode 100644
index 87b09b6b3..000000000
--- a/packages/contracts/contracts/protocol/Exchange/MixinAssetProxyDispatcher.sol
+++ /dev/null
@@ -1,174 +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.24;
-
-import "../../utils/Ownable/Ownable.sol";
-import "./mixins/MAssetProxyDispatcher.sol";
-import "../AssetProxy/interfaces/IAssetProxy.sol";
-
-
-contract MixinAssetProxyDispatcher is
- Ownable,
- MAssetProxyDispatcher
-{
- // Mapping from Asset Proxy Id's to their respective Asset Proxy
- mapping (bytes4 => IAssetProxy) public assetProxies;
-
- /// @dev Registers an asset proxy to its asset proxy id.
- /// Once an asset proxy is registered, it cannot be unregistered.
- /// @param assetProxy Address of new asset proxy to register.
- function registerAssetProxy(address assetProxy)
- external
- onlyOwner
- {
- IAssetProxy assetProxyContract = IAssetProxy(assetProxy);
-
- // Ensure that no asset proxy exists with current id.
- bytes4 assetProxyId = assetProxyContract.getProxyId();
- address currentAssetProxy = assetProxies[assetProxyId];
- require(
- currentAssetProxy == address(0),
- "ASSET_PROXY_ALREADY_EXISTS"
- );
-
- // Add asset proxy and log registration.
- assetProxies[assetProxyId] = assetProxyContract;
- emit AssetProxyRegistered(
- assetProxyId,
- assetProxy
- );
- }
-
- /// @dev Gets an asset proxy.
- /// @param assetProxyId Id of the asset proxy.
- /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.
- function getAssetProxy(bytes4 assetProxyId)
- external
- view
- returns (address)
- {
- return assetProxies[assetProxyId];
- }
-
- /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.
- /// @param assetData Byte array encoded for the asset.
- /// @param from Address to transfer token from.
- /// @param to Address to transfer token to.
- /// @param amount Amount of token to transfer.
- function dispatchTransferFrom(
- bytes memory assetData,
- address from,
- address to,
- uint256 amount
- )
- internal
- {
- // Do nothing if no amount should be transferred.
- if (amount > 0 && from != to) {
- // Ensure assetData length is valid
- require(
- assetData.length > 3,
- "LENGTH_GREATER_THAN_3_REQUIRED"
- );
-
- // Lookup assetProxy. We do not use `LibBytes.readBytes4` for gas efficiency reasons.
- bytes4 assetProxyId;
- assembly {
- assetProxyId := and(mload(
- add(assetData, 32)),
- 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000
- )
- }
- address assetProxy = assetProxies[assetProxyId];
-
- // Ensure that assetProxy exists
- require(
- assetProxy != address(0),
- "ASSET_PROXY_DOES_NOT_EXIST"
- );
-
- // We construct calldata for the `assetProxy.transferFrom` ABI.
- // The layout of this calldata is in the table below.
- //
- // | Area | Offset | Length | Contents |
- // | -------- |--------|---------|-------------------------------------------- |
- // | Header | 0 | 4 | function selector |
- // | Params | | 4 * 32 | function parameters: |
- // | | 4 | | 1. offset to assetData (*) |
- // | | 36 | | 2. from |
- // | | 68 | | 3. to |
- // | | 100 | | 4. amount |
- // | Data | | | assetData: |
- // | | 132 | 32 | assetData Length |
- // | | 164 | ** | assetData Contents |
-
- assembly {
- /////// Setup State ///////
- // `cdStart` is the start of the calldata for `assetProxy.transferFrom` (equal to free memory ptr).
- let cdStart := mload(64)
- // `dataAreaLength` is the total number of words needed to store `assetData`
- // As-per the ABI spec, this value is padded up to the nearest multiple of 32,
- // and includes 32-bytes for length.
- let dataAreaLength := and(add(mload(assetData), 63), 0xFFFFFFFFFFFE0)
- // `cdEnd` is the end of the calldata for `assetProxy.transferFrom`.
- let cdEnd := add(cdStart, add(132, dataAreaLength))
-
-
- /////// Setup Header Area ///////
- // This area holds the 4-byte `transferFromSelector`.
- // bytes4(keccak256("transferFrom(bytes,address,address,uint256)")) = 0xa85e59e4
- mstore(cdStart, 0xa85e59e400000000000000000000000000000000000000000000000000000000)
-
- /////// Setup Params Area ///////
- // Each parameter is padded to 32-bytes. The entire Params Area is 128 bytes.
- // Notes:
- // 1. The offset to `assetData` is the length of the Params Area (128 bytes).
- // 2. A 20-byte mask is applied to addresses to zero-out the unused bytes.
- mstore(add(cdStart, 4), 128)
- mstore(add(cdStart, 36), and(from, 0xffffffffffffffffffffffffffffffffffffffff))
- mstore(add(cdStart, 68), and(to, 0xffffffffffffffffffffffffffffffffffffffff))
- mstore(add(cdStart, 100), amount)
-
- /////// Setup Data Area ///////
- // This area holds `assetData`.
- let dataArea := add(cdStart, 132)
- // solhint-disable-next-line no-empty-blocks
- for {} lt(dataArea, cdEnd) {} {
- mstore(dataArea, mload(assetData))
- dataArea := add(dataArea, 32)
- assetData := add(assetData, 32)
- }
-
- /////// Call `assetProxy.transferFrom` using the constructed calldata ///////
- let success := call(
- gas, // forward all gas
- assetProxy, // call address of asset proxy
- 0, // don't send any ETH
- cdStart, // pointer to start of input
- sub(cdEnd, cdStart), // length of input
- cdStart, // write output over input
- 512 // reserve 512 bytes for output
- )
- if iszero(success) {
- revert(cdStart, returndatasize())
- }
- }
- }
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/contracts/protocol/Exchange/MixinExchangeCore.sol
deleted file mode 100644
index 736dcd0b1..000000000
--- a/packages/contracts/contracts/protocol/Exchange/MixinExchangeCore.sol
+++ /dev/null
@@ -1,529 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../../utils/ReentrancyGuard/ReentrancyGuard.sol";
-import "./libs/LibConstants.sol";
-import "./libs/LibFillResults.sol";
-import "./libs/LibOrder.sol";
-import "./libs/LibMath.sol";
-import "./mixins/MExchangeCore.sol";
-import "./mixins/MSignatureValidator.sol";
-import "./mixins/MTransactions.sol";
-import "./mixins/MAssetProxyDispatcher.sol";
-
-
-contract MixinExchangeCore is
- ReentrancyGuard,
- LibConstants,
- LibMath,
- LibOrder,
- LibFillResults,
- MAssetProxyDispatcher,
- MExchangeCore,
- MSignatureValidator,
- MTransactions
-{
- // Mapping of orderHash => amount of takerAsset already bought by maker
- mapping (bytes32 => uint256) public filled;
-
- // Mapping of orderHash => cancelled
- mapping (bytes32 => bool) public cancelled;
-
- // Mapping of makerAddress => senderAddress => lowest salt an order can have in order to be fillable
- // Orders with specified senderAddress and with a salt less than their epoch are considered cancelled
- mapping (address => mapping (address => uint256)) public orderEpoch;
-
- /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch
- /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).
- /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
- function cancelOrdersUpTo(uint256 targetOrderEpoch)
- external
- nonReentrant
- {
- address makerAddress = getCurrentContextAddress();
- // If this function is called via `executeTransaction`, we only update the orderEpoch for the makerAddress/msg.sender combination.
- // This allows external filter contracts to add rules to how orders are cancelled via this function.
- address senderAddress = makerAddress == msg.sender ? address(0) : msg.sender;
-
- // orderEpoch is initialized to 0, so to cancelUpTo we need salt + 1
- uint256 newOrderEpoch = targetOrderEpoch + 1;
- uint256 oldOrderEpoch = orderEpoch[makerAddress][senderAddress];
-
- // Ensure orderEpoch is monotonically increasing
- require(
- newOrderEpoch > oldOrderEpoch,
- "INVALID_NEW_ORDER_EPOCH"
- );
-
- // Update orderEpoch
- orderEpoch[makerAddress][senderAddress] = newOrderEpoch;
- emit CancelUpTo(
- makerAddress,
- senderAddress,
- newOrderEpoch
- );
- }
-
- /// @dev Fills the input order.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- /// @return Amounts filled and fees paid by maker and taker.
- function fillOrder(
- Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- public
- nonReentrant
- returns (FillResults memory fillResults)
- {
- fillResults = fillOrderInternal(
- order,
- takerAssetFillAmount,
- signature
- );
- return fillResults;
- }
-
- /// @dev After calling, the order can not be filled anymore.
- /// Throws if order is invalid or sender does not have permission to cancel.
- /// @param order Order to cancel. Order must be OrderStatus.FILLABLE.
- function cancelOrder(Order memory order)
- public
- nonReentrant
- {
- cancelOrderInternal(order);
- }
-
- /// @dev Gets information about an order: status, hash, and amount filled.
- /// @param order Order to gather information on.
- /// @return OrderInfo Information about the order and its state.
- /// See LibOrder.OrderInfo for a complete description.
- function getOrderInfo(Order memory order)
- public
- view
- returns (OrderInfo memory orderInfo)
- {
- // Compute the order hash
- orderInfo.orderHash = getOrderHash(order);
-
- // Fetch filled amount
- orderInfo.orderTakerAssetFilledAmount = filled[orderInfo.orderHash];
-
- // If order.makerAssetAmount is zero, we also reject the order.
- // While the Exchange contract handles them correctly, they create
- // edge cases in the supporting infrastructure because they have
- // an 'infinite' price when computed by a simple division.
- if (order.makerAssetAmount == 0) {
- orderInfo.orderStatus = uint8(OrderStatus.INVALID_MAKER_ASSET_AMOUNT);
- return orderInfo;
- }
-
- // If order.takerAssetAmount is zero, then the order will always
- // be considered filled because 0 == takerAssetAmount == orderTakerAssetFilledAmount
- // Instead of distinguishing between unfilled and filled zero taker
- // amount orders, we choose not to support them.
- if (order.takerAssetAmount == 0) {
- orderInfo.orderStatus = uint8(OrderStatus.INVALID_TAKER_ASSET_AMOUNT);
- return orderInfo;
- }
-
- // Validate order availability
- if (orderInfo.orderTakerAssetFilledAmount >= order.takerAssetAmount) {
- orderInfo.orderStatus = uint8(OrderStatus.FULLY_FILLED);
- return orderInfo;
- }
-
- // Validate order expiration
- // solhint-disable-next-line not-rely-on-time
- if (block.timestamp >= order.expirationTimeSeconds) {
- orderInfo.orderStatus = uint8(OrderStatus.EXPIRED);
- return orderInfo;
- }
-
- // Check if order has been cancelled
- if (cancelled[orderInfo.orderHash]) {
- orderInfo.orderStatus = uint8(OrderStatus.CANCELLED);
- return orderInfo;
- }
- if (orderEpoch[order.makerAddress][order.senderAddress] > order.salt) {
- orderInfo.orderStatus = uint8(OrderStatus.CANCELLED);
- return orderInfo;
- }
-
- // All other statuses are ruled out: order is Fillable
- orderInfo.orderStatus = uint8(OrderStatus.FILLABLE);
- return orderInfo;
- }
-
- /// @dev Fills the input order.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- /// @return Amounts filled and fees paid by maker and taker.
- function fillOrderInternal(
- Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- internal
- returns (FillResults memory fillResults)
- {
- // Fetch order info
- OrderInfo memory orderInfo = getOrderInfo(order);
-
- // Fetch taker address
- address takerAddress = getCurrentContextAddress();
-
- // Assert that the order is fillable by taker
- assertFillableOrder(
- order,
- orderInfo,
- takerAddress,
- signature
- );
-
- // Get amount of takerAsset to fill
- uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderInfo.orderTakerAssetFilledAmount);
- uint256 takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetAmount);
-
- // Validate context
- assertValidFill(
- order,
- orderInfo,
- takerAssetFillAmount,
- takerAssetFilledAmount,
- fillResults.makerAssetFilledAmount
- );
-
- // Compute proportional fill amounts
- fillResults = calculateFillResults(order, takerAssetFilledAmount);
-
- // Update exchange internal state
- updateFilledState(
- order,
- takerAddress,
- orderInfo.orderHash,
- orderInfo.orderTakerAssetFilledAmount,
- fillResults
- );
-
- // Settle order
- settleOrder(
- order,
- takerAddress,
- fillResults
- );
-
- return fillResults;
- }
-
- /// @dev After calling, the order can not be filled anymore.
- /// Throws if order is invalid or sender does not have permission to cancel.
- /// @param order Order to cancel. Order must be OrderStatus.FILLABLE.
- function cancelOrderInternal(Order memory order)
- internal
- {
- // Fetch current order status
- OrderInfo memory orderInfo = getOrderInfo(order);
-
- // Validate context
- assertValidCancel(order, orderInfo);
-
- // Perform cancel
- updateCancelledState(order, orderInfo.orderHash);
- }
-
- /// @dev Updates state with results of a fill order.
- /// @param order that was filled.
- /// @param takerAddress Address of taker who filled the order.
- /// @param orderTakerAssetFilledAmount Amount of order already filled.
- function updateFilledState(
- Order memory order,
- address takerAddress,
- bytes32 orderHash,
- uint256 orderTakerAssetFilledAmount,
- FillResults memory fillResults
- )
- internal
- {
- // Update state
- filled[orderHash] = safeAdd(orderTakerAssetFilledAmount, fillResults.takerAssetFilledAmount);
-
- // Log order
- emit Fill(
- order.makerAddress,
- order.feeRecipientAddress,
- takerAddress,
- msg.sender,
- fillResults.makerAssetFilledAmount,
- fillResults.takerAssetFilledAmount,
- fillResults.makerFeePaid,
- fillResults.takerFeePaid,
- orderHash,
- order.makerAssetData,
- order.takerAssetData
- );
- }
-
- /// @dev Updates state with results of cancelling an order.
- /// State is only updated if the order is currently fillable.
- /// Otherwise, updating state would have no effect.
- /// @param order that was cancelled.
- /// @param orderHash Hash of order that was cancelled.
- function updateCancelledState(
- Order memory order,
- bytes32 orderHash
- )
- internal
- {
- // Perform cancel
- cancelled[orderHash] = true;
-
- // Log cancel
- emit Cancel(
- order.makerAddress,
- order.feeRecipientAddress,
- msg.sender,
- orderHash,
- order.makerAssetData,
- order.takerAssetData
- );
- }
-
- /// @dev Validates context for fillOrder. Succeeds or throws.
- /// @param order to be filled.
- /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
- /// @param takerAddress Address of order taker.
- /// @param signature Proof that the orders was created by its maker.
- function assertFillableOrder(
- Order memory order,
- OrderInfo memory orderInfo,
- address takerAddress,
- bytes memory signature
- )
- internal
- view
- {
- // An order can only be filled if its status is FILLABLE.
- require(
- orderInfo.orderStatus == uint8(OrderStatus.FILLABLE),
- "ORDER_UNFILLABLE"
- );
-
- // Validate sender is allowed to fill this order
- if (order.senderAddress != address(0)) {
- require(
- order.senderAddress == msg.sender,
- "INVALID_SENDER"
- );
- }
-
- // Validate taker is allowed to fill this order
- if (order.takerAddress != address(0)) {
- require(
- order.takerAddress == takerAddress,
- "INVALID_TAKER"
- );
- }
-
- // Validate Maker signature (check only if first time seen)
- if (orderInfo.orderTakerAssetFilledAmount == 0) {
- require(
- isValidSignature(
- orderInfo.orderHash,
- order.makerAddress,
- signature
- ),
- "INVALID_ORDER_SIGNATURE"
- );
- }
- }
-
- /// @dev Validates context for fillOrder. Succeeds or throws.
- /// @param order to be filled.
- /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
- /// @param takerAssetFillAmount Desired amount of order to fill by taker.
- /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
- /// @param makerAssetFilledAmount Amount of makerAsset that will be transfered.
- function assertValidFill(
- Order memory order,
- OrderInfo memory orderInfo,
- uint256 takerAssetFillAmount, // TODO: use FillResults
- uint256 takerAssetFilledAmount,
- uint256 makerAssetFilledAmount
- )
- internal
- view
- {
- // Revert if fill amount is invalid
- // TODO: reconsider necessity for v2.1
- require(
- takerAssetFillAmount != 0,
- "INVALID_TAKER_AMOUNT"
- );
-
- // Make sure taker does not pay more than desired amount
- // NOTE: This assertion should never fail, it is here
- // as an extra defence against potential bugs.
- require(
- takerAssetFilledAmount <= takerAssetFillAmount,
- "TAKER_OVERPAY"
- );
-
- // Make sure order is not overfilled
- // NOTE: This assertion should never fail, it is here
- // as an extra defence against potential bugs.
- require(
- safeAdd(orderInfo.orderTakerAssetFilledAmount, takerAssetFilledAmount) <= order.takerAssetAmount,
- "ORDER_OVERFILL"
- );
-
- // Make sure order is filled at acceptable price.
- // The order has an implied price from the makers perspective:
- // order price = order.makerAssetAmount / order.takerAssetAmount
- // i.e. the number of makerAsset maker is paying per takerAsset. The
- // maker is guaranteed to get this price or a better (lower) one. The
- // actual price maker is getting in this fill is:
- // fill price = makerAssetFilledAmount / takerAssetFilledAmount
- // We need `fill price <= order price` for the fill to be fair to maker.
- // This amounts to:
- // makerAssetFilledAmount order.makerAssetAmount
- // ------------------------ <= -----------------------
- // takerAssetFilledAmount order.takerAssetAmount
- // or, equivalently:
- // makerAssetFilledAmount * order.takerAssetAmount <=
- // order.makerAssetAmount * takerAssetFilledAmount
- // NOTE: This assertion should never fail, it is here
- // as an extra defence against potential bugs.
- require(
- safeMul(makerAssetFilledAmount, order.takerAssetAmount)
- <=
- safeMul(order.makerAssetAmount, takerAssetFilledAmount),
- "INVALID_FILL_PRICE"
- );
- }
-
- /// @dev Validates context for cancelOrder. Succeeds or throws.
- /// @param order to be cancelled.
- /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
- function assertValidCancel(
- Order memory order,
- OrderInfo memory orderInfo
- )
- internal
- view
- {
- // Ensure order is valid
- // An order can only be cancelled if its status is FILLABLE.
- require(
- orderInfo.orderStatus == uint8(OrderStatus.FILLABLE),
- "ORDER_UNFILLABLE"
- );
-
- // Validate sender is allowed to cancel this order
- if (order.senderAddress != address(0)) {
- require(
- order.senderAddress == msg.sender,
- "INVALID_SENDER"
- );
- }
-
- // Validate transaction signed by maker
- address makerAddress = getCurrentContextAddress();
- require(
- order.makerAddress == makerAddress,
- "INVALID_MAKER"
- );
- }
-
- /// @dev Calculates amounts filled and fees paid by maker and taker.
- /// @param order to be filled.
- /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
- /// @return fillResults Amounts filled and fees paid by maker and taker.
- function calculateFillResults(
- Order memory order,
- uint256 takerAssetFilledAmount
- )
- internal
- pure
- returns (FillResults memory fillResults)
- {
- // Compute proportional transfer amounts
- fillResults.takerAssetFilledAmount = takerAssetFilledAmount;
- fillResults.makerAssetFilledAmount = safeGetPartialAmountFloor(
- takerAssetFilledAmount,
- order.takerAssetAmount,
- order.makerAssetAmount
- );
- fillResults.makerFeePaid = safeGetPartialAmountFloor(
- fillResults.makerAssetFilledAmount,
- order.makerAssetAmount,
- order.makerFee
- );
- fillResults.takerFeePaid = safeGetPartialAmountFloor(
- takerAssetFilledAmount,
- order.takerAssetAmount,
- order.takerFee
- );
-
- return fillResults;
- }
-
- /// @dev Settles an order by transferring assets between counterparties.
- /// @param order Order struct containing order specifications.
- /// @param takerAddress Address selling takerAsset and buying makerAsset.
- /// @param fillResults Amounts to be filled and fees paid by maker and taker.
- function settleOrder(
- LibOrder.Order memory order,
- address takerAddress,
- LibFillResults.FillResults memory fillResults
- )
- private
- {
- bytes memory zrxAssetData = ZRX_ASSET_DATA;
- dispatchTransferFrom(
- order.makerAssetData,
- order.makerAddress,
- takerAddress,
- fillResults.makerAssetFilledAmount
- );
- dispatchTransferFrom(
- order.takerAssetData,
- takerAddress,
- order.makerAddress,
- fillResults.takerAssetFilledAmount
- );
- dispatchTransferFrom(
- zrxAssetData,
- order.makerAddress,
- order.feeRecipientAddress,
- fillResults.makerFeePaid
- );
- dispatchTransferFrom(
- zrxAssetData,
- takerAddress,
- order.feeRecipientAddress,
- fillResults.takerFeePaid
- );
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/MixinMatchOrders.sol b/packages/contracts/contracts/protocol/Exchange/MixinMatchOrders.sol
deleted file mode 100644
index b4f6bdb26..000000000
--- a/packages/contracts/contracts/protocol/Exchange/MixinMatchOrders.sol
+++ /dev/null
@@ -1,335 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../../utils/ReentrancyGuard/ReentrancyGuard.sol";
-import "./libs/LibConstants.sol";
-import "./libs/LibMath.sol";
-import "./libs/LibOrder.sol";
-import "./libs/LibFillResults.sol";
-import "./mixins/MExchangeCore.sol";
-import "./mixins/MMatchOrders.sol";
-import "./mixins/MTransactions.sol";
-import "./mixins/MAssetProxyDispatcher.sol";
-
-
-contract MixinMatchOrders is
- ReentrancyGuard,
- LibConstants,
- LibMath,
- MAssetProxyDispatcher,
- MExchangeCore,
- MMatchOrders,
- MTransactions
-{
- /// @dev Match two complementary orders that have a profitable spread.
- /// Each order is filled at their respective price point. However, the calculations are
- /// carried out as though the orders are both being filled at the right order's price point.
- /// The profit made by the left order goes to the taker (who matched the two orders).
- /// @param leftOrder First order to match.
- /// @param rightOrder Second order to match.
- /// @param leftSignature Proof that order was created by the left maker.
- /// @param rightSignature Proof that order was created by the right maker.
- /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.
- function matchOrders(
- LibOrder.Order memory leftOrder,
- LibOrder.Order memory rightOrder,
- bytes memory leftSignature,
- bytes memory rightSignature
- )
- public
- nonReentrant
- returns (LibFillResults.MatchedFillResults memory matchedFillResults)
- {
- // We assume that rightOrder.takerAssetData == leftOrder.makerAssetData and rightOrder.makerAssetData == leftOrder.takerAssetData.
- // If this assumption isn't true, the match will fail at signature validation.
- rightOrder.makerAssetData = leftOrder.takerAssetData;
- rightOrder.takerAssetData = leftOrder.makerAssetData;
-
- // Get left & right order info
- LibOrder.OrderInfo memory leftOrderInfo = getOrderInfo(leftOrder);
- LibOrder.OrderInfo memory rightOrderInfo = getOrderInfo(rightOrder);
-
- // Fetch taker address
- address takerAddress = getCurrentContextAddress();
-
- // Either our context is valid or we revert
- assertFillableOrder(
- leftOrder,
- leftOrderInfo,
- takerAddress,
- leftSignature
- );
- assertFillableOrder(
- rightOrder,
- rightOrderInfo,
- takerAddress,
- rightSignature
- );
- assertValidMatch(leftOrder, rightOrder);
-
- // Compute proportional fill amounts
- matchedFillResults = calculateMatchedFillResults(
- leftOrder,
- rightOrder,
- leftOrderInfo.orderTakerAssetFilledAmount,
- rightOrderInfo.orderTakerAssetFilledAmount
- );
-
- // Validate fill contexts
- assertValidFill(
- leftOrder,
- leftOrderInfo,
- matchedFillResults.left.takerAssetFilledAmount,
- matchedFillResults.left.takerAssetFilledAmount,
- matchedFillResults.left.makerAssetFilledAmount
- );
- assertValidFill(
- rightOrder,
- rightOrderInfo,
- matchedFillResults.right.takerAssetFilledAmount,
- matchedFillResults.right.takerAssetFilledAmount,
- matchedFillResults.right.makerAssetFilledAmount
- );
-
- // Update exchange state
- updateFilledState(
- leftOrder,
- takerAddress,
- leftOrderInfo.orderHash,
- leftOrderInfo.orderTakerAssetFilledAmount,
- matchedFillResults.left
- );
- updateFilledState(
- rightOrder,
- takerAddress,
- rightOrderInfo.orderHash,
- rightOrderInfo.orderTakerAssetFilledAmount,
- matchedFillResults.right
- );
-
- // Settle matched orders. Succeeds or throws.
- settleMatchedOrders(
- leftOrder,
- rightOrder,
- takerAddress,
- matchedFillResults
- );
-
- return matchedFillResults;
- }
-
- /// @dev Validates context for matchOrders. Succeeds or throws.
- /// @param leftOrder First order to match.
- /// @param rightOrder Second order to match.
- function assertValidMatch(
- LibOrder.Order memory leftOrder,
- LibOrder.Order memory rightOrder
- )
- internal
- pure
- {
- // Make sure there is a profitable spread.
- // There is a profitable spread iff the cost per unit bought (OrderA.MakerAmount/OrderA.TakerAmount) for each order is greater
- // than the profit per unit sold of the matched order (OrderB.TakerAmount/OrderB.MakerAmount).
- // This is satisfied by the equations below:
- // <leftOrder.makerAssetAmount> / <leftOrder.takerAssetAmount> >= <rightOrder.takerAssetAmount> / <rightOrder.makerAssetAmount>
- // AND
- // <rightOrder.makerAssetAmount> / <rightOrder.takerAssetAmount> >= <leftOrder.takerAssetAmount> / <leftOrder.makerAssetAmount>
- // These equations can be combined to get the following:
- require(
- safeMul(leftOrder.makerAssetAmount, rightOrder.makerAssetAmount) >=
- safeMul(leftOrder.takerAssetAmount, rightOrder.takerAssetAmount),
- "NEGATIVE_SPREAD_REQUIRED"
- );
- }
-
- /// @dev Calculates fill amounts for the matched orders.
- /// Each order is filled at their respective price point. However, the calculations are
- /// carried out as though the orders are both being filled at the right order's price point.
- /// The profit made by the leftOrder order goes to the taker (who matched the two orders).
- /// @param leftOrder First order to match.
- /// @param rightOrder Second order to match.
- /// @param leftOrderTakerAssetFilledAmount Amount of left order already filled.
- /// @param rightOrderTakerAssetFilledAmount Amount of right order already filled.
- /// @param matchedFillResults Amounts to fill and fees to pay by maker and taker of matched orders.
- function calculateMatchedFillResults(
- LibOrder.Order memory leftOrder,
- LibOrder.Order memory rightOrder,
- uint256 leftOrderTakerAssetFilledAmount,
- uint256 rightOrderTakerAssetFilledAmount
- )
- internal
- pure
- returns (LibFillResults.MatchedFillResults memory matchedFillResults)
- {
- // Derive maker asset amounts for left & right orders, given store taker assert amounts
- uint256 leftTakerAssetAmountRemaining = safeSub(leftOrder.takerAssetAmount, leftOrderTakerAssetFilledAmount);
- uint256 leftMakerAssetAmountRemaining = safeGetPartialAmountFloor(
- leftOrder.makerAssetAmount,
- leftOrder.takerAssetAmount,
- leftTakerAssetAmountRemaining
- );
- uint256 rightTakerAssetAmountRemaining = safeSub(rightOrder.takerAssetAmount, rightOrderTakerAssetFilledAmount);
- uint256 rightMakerAssetAmountRemaining = safeGetPartialAmountFloor(
- rightOrder.makerAssetAmount,
- rightOrder.takerAssetAmount,
- rightTakerAssetAmountRemaining
- );
-
- // Calculate fill results for maker and taker assets: at least one order will be fully filled.
- // The maximum amount the left maker can buy is `leftTakerAssetAmountRemaining`
- // The maximum amount the right maker can sell is `rightMakerAssetAmountRemaining`
- // We have two distinct cases for calculating the fill results:
- // Case 1.
- // If the left maker can buy more than the right maker can sell, then only the right order is fully filled.
- // If the left maker can buy exactly what the right maker can sell, then both orders are fully filled.
- // Case 2.
- // If the left maker cannot buy more than the right maker can sell, then only the left order is fully filled.
- if (leftTakerAssetAmountRemaining >= rightMakerAssetAmountRemaining) {
- // Case 1: Right order is fully filled
- matchedFillResults.right.makerAssetFilledAmount = rightMakerAssetAmountRemaining;
- matchedFillResults.right.takerAssetFilledAmount = rightTakerAssetAmountRemaining;
- matchedFillResults.left.takerAssetFilledAmount = matchedFillResults.right.makerAssetFilledAmount;
- // Round down to ensure the maker's exchange rate does not exceed the price specified by the order.
- // We favor the maker when the exchange rate must be rounded.
- matchedFillResults.left.makerAssetFilledAmount = safeGetPartialAmountFloor(
- leftOrder.makerAssetAmount,
- leftOrder.takerAssetAmount,
- matchedFillResults.left.takerAssetFilledAmount
- );
- } else {
- // Case 2: Left order is fully filled
- matchedFillResults.left.makerAssetFilledAmount = leftMakerAssetAmountRemaining;
- matchedFillResults.left.takerAssetFilledAmount = leftTakerAssetAmountRemaining;
- matchedFillResults.right.makerAssetFilledAmount = matchedFillResults.left.takerAssetFilledAmount;
- // Round up to ensure the maker's exchange rate does not exceed the price specified by the order.
- // We favor the maker when the exchange rate must be rounded.
- matchedFillResults.right.takerAssetFilledAmount = safeGetPartialAmountCeil(
- rightOrder.takerAssetAmount,
- rightOrder.makerAssetAmount,
- matchedFillResults.right.makerAssetFilledAmount
- );
- }
-
- // Calculate amount given to taker
- matchedFillResults.leftMakerAssetSpreadAmount = safeSub(
- matchedFillResults.left.makerAssetFilledAmount,
- matchedFillResults.right.takerAssetFilledAmount
- );
-
- // Compute fees for left order
- matchedFillResults.left.makerFeePaid = safeGetPartialAmountFloor(
- matchedFillResults.left.makerAssetFilledAmount,
- leftOrder.makerAssetAmount,
- leftOrder.makerFee
- );
- matchedFillResults.left.takerFeePaid = safeGetPartialAmountFloor(
- matchedFillResults.left.takerAssetFilledAmount,
- leftOrder.takerAssetAmount,
- leftOrder.takerFee
- );
-
- // Compute fees for right order
- matchedFillResults.right.makerFeePaid = safeGetPartialAmountFloor(
- matchedFillResults.right.makerAssetFilledAmount,
- rightOrder.makerAssetAmount,
- rightOrder.makerFee
- );
- matchedFillResults.right.takerFeePaid = safeGetPartialAmountFloor(
- matchedFillResults.right.takerAssetFilledAmount,
- rightOrder.takerAssetAmount,
- rightOrder.takerFee
- );
-
- // Return fill results
- return matchedFillResults;
- }
-
- /// @dev Settles matched order by transferring appropriate funds between order makers, taker, and fee recipient.
- /// @param leftOrder First matched order.
- /// @param rightOrder Second matched order.
- /// @param takerAddress Address that matched the orders. The taker receives the spread between orders as profit.
- /// @param matchedFillResults Struct holding amounts to transfer between makers, taker, and fee recipients.
- function settleMatchedOrders(
- LibOrder.Order memory leftOrder,
- LibOrder.Order memory rightOrder,
- address takerAddress,
- LibFillResults.MatchedFillResults memory matchedFillResults
- )
- private
- {
- bytes memory zrxAssetData = ZRX_ASSET_DATA;
- // Order makers and taker
- dispatchTransferFrom(
- leftOrder.makerAssetData,
- leftOrder.makerAddress,
- rightOrder.makerAddress,
- matchedFillResults.right.takerAssetFilledAmount
- );
- dispatchTransferFrom(
- rightOrder.makerAssetData,
- rightOrder.makerAddress,
- leftOrder.makerAddress,
- matchedFillResults.left.takerAssetFilledAmount
- );
- dispatchTransferFrom(
- leftOrder.makerAssetData,
- leftOrder.makerAddress,
- takerAddress,
- matchedFillResults.leftMakerAssetSpreadAmount
- );
-
- // Maker fees
- dispatchTransferFrom(
- zrxAssetData,
- leftOrder.makerAddress,
- leftOrder.feeRecipientAddress,
- matchedFillResults.left.makerFeePaid
- );
- dispatchTransferFrom(
- zrxAssetData,
- rightOrder.makerAddress,
- rightOrder.feeRecipientAddress,
- matchedFillResults.right.makerFeePaid
- );
-
- // Taker fees
- if (leftOrder.feeRecipientAddress == rightOrder.feeRecipientAddress) {
- dispatchTransferFrom(
- zrxAssetData,
- takerAddress,
- leftOrder.feeRecipientAddress,
- safeAdd(
- matchedFillResults.left.takerFeePaid,
- matchedFillResults.right.takerFeePaid
- )
- );
- } else {
- dispatchTransferFrom(
- zrxAssetData,
- takerAddress,
- leftOrder.feeRecipientAddress,
- matchedFillResults.left.takerFeePaid
- );
- dispatchTransferFrom(
- zrxAssetData,
- takerAddress,
- rightOrder.feeRecipientAddress,
- matchedFillResults.right.takerFeePaid
- );
- }
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/MixinSignatureValidator.sol b/packages/contracts/contracts/protocol/Exchange/MixinSignatureValidator.sol
deleted file mode 100644
index 176e28351..000000000
--- a/packages/contracts/contracts/protocol/Exchange/MixinSignatureValidator.sol
+++ /dev/null
@@ -1,324 +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.24;
-
-import "../../utils/LibBytes/LibBytes.sol";
-import "../../utils/ReentrancyGuard/ReentrancyGuard.sol";
-import "./mixins/MSignatureValidator.sol";
-import "./mixins/MTransactions.sol";
-import "./interfaces/IWallet.sol";
-import "./interfaces/IValidator.sol";
-
-
-contract MixinSignatureValidator is
- ReentrancyGuard,
- MSignatureValidator,
- MTransactions
-{
- using LibBytes for bytes;
-
- // Mapping of hash => signer => signed
- mapping (bytes32 => mapping (address => bool)) public preSigned;
-
- // Mapping of signer => validator => approved
- mapping (address => mapping (address => bool)) public allowedValidators;
-
- /// @dev Approves a hash on-chain using any valid signature type.
- /// After presigning a hash, the preSign signature type will become valid for that hash and signer.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof that the hash has been signed by signer.
- function preSign(
- bytes32 hash,
- address signerAddress,
- bytes signature
- )
- external
- {
- if (signerAddress != msg.sender) {
- require(
- isValidSignature(
- hash,
- signerAddress,
- signature
- ),
- "INVALID_SIGNATURE"
- );
- }
- preSigned[hash][signerAddress] = true;
- }
-
- /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.
- /// @param validatorAddress Address of Validator contract.
- /// @param approval Approval or disapproval of Validator contract.
- function setSignatureValidatorApproval(
- address validatorAddress,
- bool approval
- )
- external
- nonReentrant
- {
- address signerAddress = getCurrentContextAddress();
- allowedValidators[signerAddress][validatorAddress] = approval;
- emit SignatureValidatorApproval(
- signerAddress,
- validatorAddress,
- approval
- );
- }
-
- /// @dev Verifies that a hash has been signed by the given signer.
- /// @param hash Any 32 byte hash.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof that the hash has been signed by signer.
- /// @return True if the address recovered from the provided signature matches the input signer address.
- function isValidSignature(
- bytes32 hash,
- address signerAddress,
- bytes memory signature
- )
- public
- view
- returns (bool isValid)
- {
- require(
- signature.length > 0,
- "LENGTH_GREATER_THAN_0_REQUIRED"
- );
-
- // Pop last byte off of signature byte array.
- uint8 signatureTypeRaw = uint8(signature.popLastByte());
-
- // Ensure signature is supported
- require(
- signatureTypeRaw < uint8(SignatureType.NSignatureTypes),
- "SIGNATURE_UNSUPPORTED"
- );
-
- SignatureType signatureType = SignatureType(signatureTypeRaw);
-
- // Variables are not scoped in Solidity.
- uint8 v;
- bytes32 r;
- bytes32 s;
- address recovered;
-
- // Always illegal signature.
- // This is always an implicit option since a signer can create a
- // signature array with invalid type or length. We may as well make
- // it an explicit option. This aids testing and analysis. It is
- // also the initialization value for the enum type.
- if (signatureType == SignatureType.Illegal) {
- revert("SIGNATURE_ILLEGAL");
-
- // Always invalid signature.
- // Like Illegal, this is always implicitly available and therefore
- // offered explicitly. It can be implicitly created by providing
- // a correctly formatted but incorrect signature.
- } else if (signatureType == SignatureType.Invalid) {
- require(
- signature.length == 0,
- "LENGTH_0_REQUIRED"
- );
- isValid = false;
- return isValid;
-
- // Signature using EIP712
- } else if (signatureType == SignatureType.EIP712) {
- require(
- signature.length == 65,
- "LENGTH_65_REQUIRED"
- );
- v = uint8(signature[0]);
- r = signature.readBytes32(1);
- s = signature.readBytes32(33);
- recovered = ecrecover(
- hash,
- v,
- r,
- s
- );
- isValid = signerAddress == recovered;
- return isValid;
-
- // Signed using web3.eth_sign
- } else if (signatureType == SignatureType.EthSign) {
- require(
- signature.length == 65,
- "LENGTH_65_REQUIRED"
- );
- v = uint8(signature[0]);
- r = signature.readBytes32(1);
- s = signature.readBytes32(33);
- recovered = ecrecover(
- keccak256(abi.encodePacked(
- "\x19Ethereum Signed Message:\n32",
- hash
- )),
- v,
- r,
- s
- );
- isValid = signerAddress == recovered;
- return isValid;
-
- // Signature verified by wallet contract.
- // If used with an order, the maker of the order is the wallet contract.
- } else if (signatureType == SignatureType.Wallet) {
- isValid = isValidWalletSignature(
- hash,
- signerAddress,
- signature
- );
- return isValid;
-
- // Signature verified by validator contract.
- // If used with an order, the maker of the order can still be an EOA.
- // A signature using this type should be encoded as:
- // | Offset | Length | Contents |
- // | 0x00 | x | Signature to validate |
- // | 0x00 + x | 20 | Address of validator contract |
- // | 0x14 + x | 1 | Signature type is always "\x06" |
- } else if (signatureType == SignatureType.Validator) {
- // Pop last 20 bytes off of signature byte array.
- address validatorAddress = signature.popLast20Bytes();
-
- // Ensure signer has approved validator.
- if (!allowedValidators[signerAddress][validatorAddress]) {
- return false;
- }
- isValid = isValidValidatorSignature(
- validatorAddress,
- hash,
- signerAddress,
- signature
- );
- return isValid;
-
- // Signer signed hash previously using the preSign function.
- } else if (signatureType == SignatureType.PreSigned) {
- isValid = preSigned[hash][signerAddress];
- return isValid;
- }
-
- // Anything else is illegal (We do not return false because
- // the signature may actually be valid, just not in a format
- // that we currently support. In this case returning false
- // may lead the caller to incorrectly believe that the
- // signature was invalid.)
- revert("SIGNATURE_UNSUPPORTED");
- }
-
- /// @dev Verifies signature using logic defined by Wallet contract.
- /// @param hash Any 32 byte hash.
- /// @param walletAddress Address that should have signed the given hash
- /// and defines its own signature verification method.
- /// @param signature Proof that the hash has been signed by signer.
- /// @return True if signature is valid for given wallet..
- function isValidWalletSignature(
- bytes32 hash,
- address walletAddress,
- bytes signature
- )
- internal
- view
- returns (bool isValid)
- {
- bytes memory calldata = abi.encodeWithSelector(
- IWallet(walletAddress).isValidSignature.selector,
- hash,
- signature
- );
- assembly {
- let cdStart := add(calldata, 32)
- let success := staticcall(
- gas, // forward all gas
- walletAddress, // address of Wallet contract
- cdStart, // pointer to start of input
- mload(calldata), // length of input
- cdStart, // write output over input
- 32 // output size is 32 bytes
- )
-
- switch success
- case 0 {
- // Revert with `Error("WALLET_ERROR")`
- mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
- mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
- mstore(64, 0x0000000c57414c4c45545f4552524f5200000000000000000000000000000000)
- mstore(96, 0)
- revert(0, 100)
- }
- case 1 {
- // Signature is valid if call did not revert and returned true
- isValid := mload(cdStart)
- }
- }
- return isValid;
- }
-
- /// @dev Verifies signature using logic defined by Validator contract.
- /// @param validatorAddress Address of validator contract.
- /// @param hash Any 32 byte hash.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof that the hash has been signed by signer.
- /// @return True if the address recovered from the provided signature matches the input signer address.
- function isValidValidatorSignature(
- address validatorAddress,
- bytes32 hash,
- address signerAddress,
- bytes signature
- )
- internal
- view
- returns (bool isValid)
- {
- bytes memory calldata = abi.encodeWithSelector(
- IValidator(signerAddress).isValidSignature.selector,
- hash,
- signerAddress,
- signature
- );
- assembly {
- let cdStart := add(calldata, 32)
- let success := staticcall(
- gas, // forward all gas
- validatorAddress, // address of Validator contract
- cdStart, // pointer to start of input
- mload(calldata), // length of input
- cdStart, // write output over input
- 32 // output size is 32 bytes
- )
-
- switch success
- case 0 {
- // Revert with `Error("VALIDATOR_ERROR")`
- mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
- mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
- mstore(64, 0x0000000f56414c494441544f525f4552524f5200000000000000000000000000)
- mstore(96, 0)
- revert(0, 100)
- }
- case 1 {
- // Signature is valid if call did not revert and returned true
- isValid := mload(cdStart)
- }
- }
- return isValid;
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/MixinTransactions.sol b/packages/contracts/contracts/protocol/Exchange/MixinTransactions.sol
deleted file mode 100644
index 3a76ca202..000000000
--- a/packages/contracts/contracts/protocol/Exchange/MixinTransactions.sol
+++ /dev/null
@@ -1,152 +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.24;
-
-import "./libs/LibExchangeErrors.sol";
-import "./mixins/MSignatureValidator.sol";
-import "./mixins/MTransactions.sol";
-import "./libs/LibEIP712.sol";
-
-
-contract MixinTransactions is
- LibEIP712,
- MSignatureValidator,
- MTransactions
-{
- // Mapping of transaction hash => executed
- // This prevents transactions from being executed more than once.
- mapping (bytes32 => bool) public transactions;
-
- // Address of current transaction signer
- address public currentContextAddress;
-
- /// @dev Executes an exchange method call in the context of signer.
- /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
- /// @param signerAddress Address of transaction signer.
- /// @param data AbiV2 encoded calldata.
- /// @param signature Proof of signer transaction by signer.
- function executeTransaction(
- uint256 salt,
- address signerAddress,
- bytes data,
- bytes signature
- )
- external
- {
- // Prevent reentrancy
- require(
- currentContextAddress == address(0),
- "REENTRANCY_ILLEGAL"
- );
-
- bytes32 transactionHash = hashEIP712Message(hashZeroExTransaction(
- salt,
- signerAddress,
- data
- ));
-
- // Validate transaction has not been executed
- require(
- !transactions[transactionHash],
- "INVALID_TX_HASH"
- );
-
- // Transaction always valid if signer is sender of transaction
- if (signerAddress != msg.sender) {
- // Validate signature
- require(
- isValidSignature(
- transactionHash,
- signerAddress,
- signature
- ),
- "INVALID_TX_SIGNATURE"
- );
-
- // Set the current transaction signer
- currentContextAddress = signerAddress;
- }
-
- // Execute transaction
- transactions[transactionHash] = true;
- require(
- address(this).delegatecall(data),
- "FAILED_EXECUTION"
- );
-
- // Reset current transaction signer if it was previously updated
- if (signerAddress != msg.sender) {
- currentContextAddress = address(0);
- }
- }
-
- /// @dev Calculates EIP712 hash of the Transaction.
- /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
- /// @param signerAddress Address of transaction signer.
- /// @param data AbiV2 encoded calldata.
- /// @return EIP712 hash of the Transaction.
- function hashZeroExTransaction(
- uint256 salt,
- address signerAddress,
- bytes memory data
- )
- internal
- pure
- returns (bytes32 result)
- {
- bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH;
- bytes32 dataHash = keccak256(data);
-
- // Assembly for more efficiently computing:
- // keccak256(abi.encodePacked(
- // EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH,
- // salt,
- // bytes32(signerAddress),
- // keccak256(data)
- // ));
-
- assembly {
- // Load free memory pointer
- let memPtr := mload(64)
-
- mstore(memPtr, schemaHash) // hash of schema
- mstore(add(memPtr, 32), salt) // salt
- mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) // signerAddress
- mstore(add(memPtr, 96), dataHash) // hash of data
-
- // Compute hash
- result := keccak256(memPtr, 128)
- }
- return result;
- }
-
- /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).
- /// If calling a fill function, this address will represent the taker.
- /// If calling a cancel function, this address will represent the maker.
- /// @return Signer of 0x transaction if entry point is `executeTransaction`.
- /// `msg.sender` if entry point is any other function.
- function getCurrentContextAddress()
- internal
- view
- returns (address)
- {
- address currentContextAddress_ = currentContextAddress;
- address contextAddress = currentContextAddress_ == address(0) ? msg.sender : currentContextAddress_;
- return contextAddress;
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/contracts/protocol/Exchange/MixinWrapperFunctions.sol
deleted file mode 100644
index cddff0e5f..000000000
--- a/packages/contracts/contracts/protocol/Exchange/MixinWrapperFunctions.sol
+++ /dev/null
@@ -1,426 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../../utils/ReentrancyGuard/ReentrancyGuard.sol";
-import "./libs/LibMath.sol";
-import "./libs/LibOrder.sol";
-import "./libs/LibFillResults.sol";
-import "./libs/LibAbiEncoder.sol";
-import "./mixins/MExchangeCore.sol";
-import "./mixins/MWrapperFunctions.sol";
-
-
-contract MixinWrapperFunctions is
- ReentrancyGuard,
- LibMath,
- LibFillResults,
- LibAbiEncoder,
- MExchangeCore,
- MWrapperFunctions
-{
- /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- function fillOrKillOrder(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- public
- nonReentrant
- returns (FillResults memory fillResults)
- {
- fillResults = fillOrKillOrderInternal(
- order,
- takerAssetFillAmount,
- signature
- );
- return fillResults;
- }
-
- /// @dev Fills the input order.
- /// Returns false if the transaction would otherwise revert.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- /// @return Amounts filled and fees paid by maker and taker.
- function fillOrderNoThrow(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- public
- returns (FillResults memory fillResults)
- {
- // ABI encode calldata for `fillOrder`
- bytes memory fillOrderCalldata = abiEncodeFillOrder(
- order,
- takerAssetFillAmount,
- signature
- );
-
- // Delegate to `fillOrder` and handle any exceptions gracefully
- assembly {
- let success := delegatecall(
- gas, // forward all gas
- address, // call address of this contract
- add(fillOrderCalldata, 32), // pointer to start of input (skip array length in first 32 bytes)
- mload(fillOrderCalldata), // length of input
- fillOrderCalldata, // write output over input
- 128 // output size is 128 bytes
- )
- if success {
- mstore(fillResults, mload(fillOrderCalldata))
- mstore(add(fillResults, 32), mload(add(fillOrderCalldata, 32)))
- mstore(add(fillResults, 64), mload(add(fillOrderCalldata, 64)))
- mstore(add(fillResults, 96), mload(add(fillOrderCalldata, 96)))
- }
- }
- // fillResults values will be 0 by default if call was unsuccessful
- return fillResults;
- }
-
- /// @dev Synchronously executes multiple calls of fillOrder.
- /// @param orders Array of order specifications.
- /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
- /// @param signatures Proofs that orders have been created by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.
- function batchFillOrders(
- LibOrder.Order[] memory orders,
- uint256[] memory takerAssetFillAmounts,
- bytes[] memory signatures
- )
- public
- nonReentrant
- returns (FillResults memory totalFillResults)
- {
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
- FillResults memory singleFillResults = fillOrderInternal(
- orders[i],
- takerAssetFillAmounts[i],
- signatures[i]
- );
- addFillResults(totalFillResults, singleFillResults);
- }
- return totalFillResults;
- }
-
- /// @dev Synchronously executes multiple calls of fillOrKill.
- /// @param orders Array of order specifications.
- /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
- /// @param signatures Proofs that orders have been created by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.
- function batchFillOrKillOrders(
- LibOrder.Order[] memory orders,
- uint256[] memory takerAssetFillAmounts,
- bytes[] memory signatures
- )
- public
- nonReentrant
- returns (FillResults memory totalFillResults)
- {
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
- FillResults memory singleFillResults = fillOrKillOrderInternal(
- orders[i],
- takerAssetFillAmounts[i],
- signatures[i]
- );
- addFillResults(totalFillResults, singleFillResults);
- }
- return totalFillResults;
- }
-
- /// @dev Fills an order with specified parameters and ECDSA signature.
- /// Returns false if the transaction would otherwise revert.
- /// @param orders Array of order specifications.
- /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
- /// @param signatures Proofs that orders have been created by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.
- function batchFillOrdersNoThrow(
- LibOrder.Order[] memory orders,
- uint256[] memory takerAssetFillAmounts,
- bytes[] memory signatures
- )
- public
- returns (FillResults memory totalFillResults)
- {
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
- FillResults memory singleFillResults = fillOrderNoThrow(
- orders[i],
- takerAssetFillAmounts[i],
- signatures[i]
- );
- addFillResults(totalFillResults, singleFillResults);
- }
- return totalFillResults;
- }
-
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.
- /// @param orders Array of order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signatures Proofs that orders have been created by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketSellOrders(
- LibOrder.Order[] memory orders,
- uint256 takerAssetFillAmount,
- bytes[] memory signatures
- )
- public
- nonReentrant
- returns (FillResults memory totalFillResults)
- {
- bytes memory takerAssetData = orders[0].takerAssetData;
-
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
-
- // We assume that asset being sold by taker is the same for each order.
- // Rather than passing this in as calldata, we use the takerAssetData from the first order in all later orders.
- orders[i].takerAssetData = takerAssetData;
-
- // Calculate the remaining amount of takerAsset to sell
- uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
-
- // Attempt to sell the remaining amount of takerAsset
- FillResults memory singleFillResults = fillOrderInternal(
- orders[i],
- remainingTakerAssetFillAmount,
- signatures[i]
- );
-
- // Update amounts filled and fees paid by maker and taker
- addFillResults(totalFillResults, singleFillResults);
-
- // Stop execution if the entire amount of takerAsset has been sold
- if (totalFillResults.takerAssetFilledAmount >= takerAssetFillAmount) {
- break;
- }
- }
- return totalFillResults;
- }
-
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.
- /// Returns false if the transaction would otherwise revert.
- /// @param orders Array of order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signatures Proofs that orders have been signed by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketSellOrdersNoThrow(
- LibOrder.Order[] memory orders,
- uint256 takerAssetFillAmount,
- bytes[] memory signatures
- )
- public
- returns (FillResults memory totalFillResults)
- {
- bytes memory takerAssetData = orders[0].takerAssetData;
-
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
-
- // We assume that asset being sold by taker is the same for each order.
- // Rather than passing this in as calldata, we use the takerAssetData from the first order in all later orders.
- orders[i].takerAssetData = takerAssetData;
-
- // Calculate the remaining amount of takerAsset to sell
- uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);
-
- // Attempt to sell the remaining amount of takerAsset
- FillResults memory singleFillResults = fillOrderNoThrow(
- orders[i],
- remainingTakerAssetFillAmount,
- signatures[i]
- );
-
- // Update amounts filled and fees paid by maker and taker
- addFillResults(totalFillResults, singleFillResults);
-
- // Stop execution if the entire amount of takerAsset has been sold
- if (totalFillResults.takerAssetFilledAmount >= takerAssetFillAmount) {
- break;
- }
- }
- return totalFillResults;
- }
-
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.
- /// @param orders Array of order specifications.
- /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
- /// @param signatures Proofs that orders have been signed by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketBuyOrders(
- LibOrder.Order[] memory orders,
- uint256 makerAssetFillAmount,
- bytes[] memory signatures
- )
- public
- nonReentrant
- returns (FillResults memory totalFillResults)
- {
- bytes memory makerAssetData = orders[0].makerAssetData;
-
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
-
- // We assume that asset being bought by taker is the same for each order.
- // Rather than passing this in as calldata, we copy the makerAssetData from the first order onto all later orders.
- orders[i].makerAssetData = makerAssetData;
-
- // Calculate the remaining amount of makerAsset to buy
- uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
-
- // Convert the remaining amount of makerAsset to buy into remaining amount
- // of takerAsset to sell, assuming entire amount can be sold in the current order
- uint256 remainingTakerAssetFillAmount = getPartialAmountFloor(
- orders[i].takerAssetAmount,
- orders[i].makerAssetAmount,
- remainingMakerAssetFillAmount
- );
-
- // Attempt to sell the remaining amount of takerAsset
- FillResults memory singleFillResults = fillOrderInternal(
- orders[i],
- remainingTakerAssetFillAmount,
- signatures[i]
- );
-
- // Update amounts filled and fees paid by maker and taker
- addFillResults(totalFillResults, singleFillResults);
-
- // Stop execution if the entire amount of makerAsset has been bought
- if (totalFillResults.makerAssetFilledAmount >= makerAssetFillAmount) {
- break;
- }
- }
- return totalFillResults;
- }
-
- /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.
- /// Returns false if the transaction would otherwise revert.
- /// @param orders Array of order specifications.
- /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
- /// @param signatures Proofs that orders have been signed by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketBuyOrdersNoThrow(
- LibOrder.Order[] memory orders,
- uint256 makerAssetFillAmount,
- bytes[] memory signatures
- )
- public
- returns (FillResults memory totalFillResults)
- {
- bytes memory makerAssetData = orders[0].makerAssetData;
-
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
-
- // We assume that asset being bought by taker is the same for each order.
- // Rather than passing this in as calldata, we copy the makerAssetData from the first order onto all later orders.
- orders[i].makerAssetData = makerAssetData;
-
- // Calculate the remaining amount of makerAsset to buy
- uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);
-
- // Convert the remaining amount of makerAsset to buy into remaining amount
- // of takerAsset to sell, assuming entire amount can be sold in the current order
- uint256 remainingTakerAssetFillAmount = getPartialAmountFloor(
- orders[i].takerAssetAmount,
- orders[i].makerAssetAmount,
- remainingMakerAssetFillAmount
- );
-
- // Attempt to sell the remaining amount of takerAsset
- FillResults memory singleFillResults = fillOrderNoThrow(
- orders[i],
- remainingTakerAssetFillAmount,
- signatures[i]
- );
-
- // Update amounts filled and fees paid by maker and taker
- addFillResults(totalFillResults, singleFillResults);
-
- // Stop execution if the entire amount of makerAsset has been bought
- if (totalFillResults.makerAssetFilledAmount >= makerAssetFillAmount) {
- break;
- }
- }
- return totalFillResults;
- }
-
- /// @dev Synchronously cancels multiple orders in a single transaction.
- /// @param orders Array of order specifications.
- function batchCancelOrders(LibOrder.Order[] memory orders)
- public
- nonReentrant
- {
- uint256 ordersLength = orders.length;
- for (uint256 i = 0; i != ordersLength; i++) {
- cancelOrderInternal(orders[i]);
- }
- }
-
- /// @dev Fetches information for all passed in orders.
- /// @param orders Array of order specifications.
- /// @return Array of OrderInfo instances that correspond to each order.
- function getOrdersInfo(LibOrder.Order[] memory orders)
- public
- view
- returns (LibOrder.OrderInfo[] memory)
- {
- uint256 ordersLength = orders.length;
- LibOrder.OrderInfo[] memory ordersInfo = new LibOrder.OrderInfo[](ordersLength);
- for (uint256 i = 0; i != ordersLength; i++) {
- ordersInfo[i] = getOrderInfo(orders[i]);
- }
- return ordersInfo;
- }
-
- /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- function fillOrKillOrderInternal(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- internal
- returns (FillResults memory fillResults)
- {
- fillResults = fillOrderInternal(
- order,
- takerAssetFillAmount,
- signature
- );
- require(
- fillResults.takerAssetFilledAmount == takerAssetFillAmount,
- "COMPLETE_FILL_FAILED"
- );
- return fillResults;
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol
deleted file mode 100644
index 8db8d6f6c..000000000
--- a/packages/contracts/contracts/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol
+++ /dev/null
@@ -1,37 +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.24;
-
-
-contract IAssetProxyDispatcher {
-
- /// @dev Registers an asset proxy to its asset proxy id.
- /// Once an asset proxy is registered, it cannot be unregistered.
- /// @param assetProxy Address of new asset proxy to register.
- function registerAssetProxy(address assetProxy)
- external;
-
- /// @dev Gets an asset proxy.
- /// @param assetProxyId Id of the asset proxy.
- /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.
- function getAssetProxy(bytes4 assetProxyId)
- external
- view
- returns (address);
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/interfaces/IExchange.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IExchange.sol
deleted file mode 100644
index b92abba04..000000000
--- a/packages/contracts/contracts/protocol/Exchange/interfaces/IExchange.sol
+++ /dev/null
@@ -1,38 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "./IExchangeCore.sol";
-import "./IMatchOrders.sol";
-import "./ISignatureValidator.sol";
-import "./ITransactions.sol";
-import "./IAssetProxyDispatcher.sol";
-import "./IWrapperFunctions.sol";
-
-
-// solhint-disable no-empty-blocks
-contract IExchange is
- IExchangeCore,
- IMatchOrders,
- ISignatureValidator,
- ITransactions,
- IAssetProxyDispatcher,
- IWrapperFunctions
-{}
diff --git a/packages/contracts/contracts/protocol/Exchange/interfaces/IExchangeCore.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IExchangeCore.sol
deleted file mode 100644
index 9995e0385..000000000
--- a/packages/contracts/contracts/protocol/Exchange/interfaces/IExchangeCore.sol
+++ /dev/null
@@ -1,60 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
-
-
-contract IExchangeCore {
-
- /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch
- /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).
- /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.
- function cancelOrdersUpTo(uint256 targetOrderEpoch)
- external;
-
- /// @dev Fills the input order.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- /// @return Amounts filled and fees paid by maker and taker.
- function fillOrder(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- public
- returns (LibFillResults.FillResults memory fillResults);
-
- /// @dev After calling, the order can not be filled anymore.
- /// @param order Order struct containing order specifications.
- function cancelOrder(LibOrder.Order memory order)
- public;
-
- /// @dev Gets information about an order: status, hash, and amount filled.
- /// @param order Order to gather information on.
- /// @return OrderInfo Information about the order and its state.
- /// See LibOrder.OrderInfo for a complete description.
- function getOrderInfo(LibOrder.Order memory order)
- public
- view
- returns (LibOrder.OrderInfo memory orderInfo);
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/interfaces/IMatchOrders.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IMatchOrders.sol
deleted file mode 100644
index 73447f3ae..000000000
--- a/packages/contracts/contracts/protocol/Exchange/interfaces/IMatchOrders.sol
+++ /dev/null
@@ -1,44 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
-
-
-contract IMatchOrders {
-
- /// @dev Match two complementary orders that have a profitable spread.
- /// Each order is filled at their respective price point. However, the calculations are
- /// carried out as though the orders are both being filled at the right order's price point.
- /// The profit made by the left order goes to the taker (who matched the two orders).
- /// @param leftOrder First order to match.
- /// @param rightOrder Second order to match.
- /// @param leftSignature Proof that order was created by the left maker.
- /// @param rightSignature Proof that order was created by the right maker.
- /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.
- function matchOrders(
- LibOrder.Order memory leftOrder,
- LibOrder.Order memory rightOrder,
- bytes memory leftSignature,
- bytes memory rightSignature
- )
- public
- returns (LibFillResults.MatchedFillResults memory matchedFillResults);
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/interfaces/ISignatureValidator.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/ISignatureValidator.sol
deleted file mode 100644
index 1fd0eccf0..000000000
--- a/packages/contracts/contracts/protocol/Exchange/interfaces/ISignatureValidator.sol
+++ /dev/null
@@ -1,57 +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.24;
-
-
-contract ISignatureValidator {
-
- /// @dev Approves a hash on-chain using any valid signature type.
- /// After presigning a hash, the preSign signature type will become valid for that hash and signer.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof that the hash has been signed by signer.
- function preSign(
- bytes32 hash,
- address signerAddress,
- bytes signature
- )
- external;
-
- /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.
- /// @param validatorAddress Address of Validator contract.
- /// @param approval Approval or disapproval of Validator contract.
- function setSignatureValidatorApproval(
- address validatorAddress,
- bool approval
- )
- external;
-
- /// @dev Verifies that a signature is valid.
- /// @param hash Message hash that is signed.
- /// @param signerAddress Address of signer.
- /// @param signature Proof of signing.
- /// @return Validity of order signature.
- function isValidSignature(
- bytes32 hash,
- address signerAddress,
- bytes memory signature
- )
- public
- view
- returns (bool isValid);
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/interfaces/ITransactions.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/ITransactions.sol
deleted file mode 100644
index 4446c55ce..000000000
--- a/packages/contracts/contracts/protocol/Exchange/interfaces/ITransactions.sol
+++ /dev/null
@@ -1,35 +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.24;
-
-
-contract ITransactions {
-
- /// @dev Executes an exchange method call in the context of signer.
- /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
- /// @param signerAddress Address of transaction signer.
- /// @param data AbiV2 encoded calldata.
- /// @param signature Proof of signer transaction by signer.
- function executeTransaction(
- uint256 salt,
- address signerAddress,
- bytes data,
- bytes signature
- )
- external;
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/interfaces/IValidator.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IValidator.sol
deleted file mode 100644
index 2dd69100c..000000000
--- a/packages/contracts/contracts/protocol/Exchange/interfaces/IValidator.sol
+++ /dev/null
@@ -1,37 +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.24;
-
-
-contract IValidator {
-
- /// @dev Verifies that a signature is valid.
- /// @param hash Message hash that is signed.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof of signing.
- /// @return Validity of order signature.
- function isValidSignature(
- bytes32 hash,
- address signerAddress,
- bytes signature
- )
- external
- view
- returns (bool isValid);
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/interfaces/IWallet.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IWallet.sol
deleted file mode 100644
index c97161ca6..000000000
--- a/packages/contracts/contracts/protocol/Exchange/interfaces/IWallet.sol
+++ /dev/null
@@ -1,35 +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.24;
-
-
-contract IWallet {
-
- /// @dev Verifies that a signature is valid.
- /// @param hash Message hash that is signed.
- /// @param signature Proof of signing.
- /// @return Validity of order signature.
- function isValidSignature(
- bytes32 hash,
- bytes signature
- )
- external
- view
- returns (bool isValid);
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol b/packages/contracts/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol
deleted file mode 100644
index 56a533646..000000000
--- a/packages/contracts/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol
+++ /dev/null
@@ -1,160 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
-
-
-contract IWrapperFunctions {
-
- /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
- /// @param order LibOrder.Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- function fillOrKillOrder(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- public
- returns (LibFillResults.FillResults memory fillResults);
-
- /// @dev Fills an order with specified parameters and ECDSA signature.
- /// Returns false if the transaction would otherwise revert.
- /// @param order LibOrder.Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- /// @return Amounts filled and fees paid by maker and taker.
- function fillOrderNoThrow(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- public
- returns (LibFillResults.FillResults memory fillResults);
-
- /// @dev Synchronously executes multiple calls of fillOrder.
- /// @param orders Array of order specifications.
- /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
- /// @param signatures Proofs that orders have been created by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function batchFillOrders(
- LibOrder.Order[] memory orders,
- uint256[] memory takerAssetFillAmounts,
- bytes[] memory signatures
- )
- public
- returns (LibFillResults.FillResults memory totalFillResults);
-
- /// @dev Synchronously executes multiple calls of fillOrKill.
- /// @param orders Array of order specifications.
- /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
- /// @param signatures Proofs that orders have been created by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function batchFillOrKillOrders(
- LibOrder.Order[] memory orders,
- uint256[] memory takerAssetFillAmounts,
- bytes[] memory signatures
- )
- public
- returns (LibFillResults.FillResults memory totalFillResults);
-
- /// @dev Fills an order with specified parameters and ECDSA signature.
- /// Returns false if the transaction would otherwise revert.
- /// @param orders Array of order specifications.
- /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.
- /// @param signatures Proofs that orders have been created by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function batchFillOrdersNoThrow(
- LibOrder.Order[] memory orders,
- uint256[] memory takerAssetFillAmounts,
- bytes[] memory signatures
- )
- public
- returns (LibFillResults.FillResults memory totalFillResults);
-
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.
- /// @param orders Array of order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signatures Proofs that orders have been created by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketSellOrders(
- LibOrder.Order[] memory orders,
- uint256 takerAssetFillAmount,
- bytes[] memory signatures
- )
- public
- returns (LibFillResults.FillResults memory totalFillResults);
-
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.
- /// Returns false if the transaction would otherwise revert.
- /// @param orders Array of order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signatures Proofs that orders have been signed by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketSellOrdersNoThrow(
- LibOrder.Order[] memory orders,
- uint256 takerAssetFillAmount,
- bytes[] memory signatures
- )
- public
- returns (LibFillResults.FillResults memory totalFillResults);
-
- /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.
- /// @param orders Array of order specifications.
- /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
- /// @param signatures Proofs that orders have been signed by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketBuyOrders(
- LibOrder.Order[] memory orders,
- uint256 makerAssetFillAmount,
- bytes[] memory signatures
- )
- public
- returns (LibFillResults.FillResults memory totalFillResults);
-
- /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.
- /// Returns false if the transaction would otherwise revert.
- /// @param orders Array of order specifications.
- /// @param makerAssetFillAmount Desired amount of makerAsset to buy.
- /// @param signatures Proofs that orders have been signed by makers.
- /// @return Amounts filled and fees paid by makers and taker.
- function marketBuyOrdersNoThrow(
- LibOrder.Order[] memory orders,
- uint256 makerAssetFillAmount,
- bytes[] memory signatures
- )
- public
- returns (LibFillResults.FillResults memory totalFillResults);
-
- /// @dev Synchronously cancels multiple orders in a single transaction.
- /// @param orders Array of order specifications.
- function batchCancelOrders(LibOrder.Order[] memory orders)
- public;
-
- /// @dev Fetches information for all passed in orders
- /// @param orders Array of order specifications.
- /// @return Array of OrderInfo instances that correspond to each order.
- function getOrdersInfo(LibOrder.Order[] memory orders)
- public
- view
- returns (LibOrder.OrderInfo[] memory);
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/libs/LibAbiEncoder.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibAbiEncoder.sol
deleted file mode 100644
index 4aad37709..000000000
--- a/packages/contracts/contracts/protocol/Exchange/libs/LibAbiEncoder.sol
+++ /dev/null
@@ -1,215 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "./LibOrder.sol";
-
-
-contract LibAbiEncoder {
-
- /// @dev ABI encodes calldata for `fillOrder`.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- /// @return ABI encoded calldata for `fillOrder`.
- function abiEncodeFillOrder(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- internal
- pure
- returns (bytes memory fillOrderCalldata)
- {
- // We need to call MExchangeCore.fillOrder using a delegatecall in
- // assembly so that we can intercept a call that throws. For this, we
- // need the input encoded in memory in the Ethereum ABIv2 format [1].
-
- // | Area | Offset | Length | Contents |
- // | -------- |--------|---------|-------------------------------------------- |
- // | Header | 0x00 | 4 | function selector |
- // | Params | | 3 * 32 | function parameters: |
- // | | 0x00 | | 1. offset to order (*) |
- // | | 0x20 | | 2. takerAssetFillAmount |
- // | | 0x40 | | 3. offset to signature (*) |
- // | Data | | 12 * 32 | order: |
- // | | 0x000 | | 1. senderAddress |
- // | | 0x020 | | 2. makerAddress |
- // | | 0x040 | | 3. takerAddress |
- // | | 0x060 | | 4. feeRecipientAddress |
- // | | 0x080 | | 5. makerAssetAmount |
- // | | 0x0A0 | | 6. takerAssetAmount |
- // | | 0x0C0 | | 7. makerFeeAmount |
- // | | 0x0E0 | | 8. takerFeeAmount |
- // | | 0x100 | | 9. expirationTimeSeconds |
- // | | 0x120 | | 10. salt |
- // | | 0x140 | | 11. Offset to makerAssetData (*) |
- // | | 0x160 | | 12. Offset to takerAssetData (*) |
- // | | 0x180 | 32 | makerAssetData Length |
- // | | 0x1A0 | ** | makerAssetData Contents |
- // | | 0x1C0 | 32 | takerAssetData Length |
- // | | 0x1E0 | ** | takerAssetData Contents |
- // | | 0x200 | 32 | signature Length |
- // | | 0x220 | ** | signature Contents |
-
- // * Offsets are calculated from the beginning of the current area: Header, Params, Data:
- // An offset stored in the Params area is calculated from the beginning of the Params section.
- // An offset stored in the Data area is calculated from the beginning of the Data section.
-
- // ** The length of dynamic array contents are stored in the field immediately preceeding the contents.
-
- // [1]: https://solidity.readthedocs.io/en/develop/abi-spec.html
-
- assembly {
-
- // Areas below may use the following variables:
- // 1. <area>Start -- Start of this area in memory
- // 2. <area>End -- End of this area in memory. This value may
- // be precomputed (before writing contents),
- // or it may be computed as contents are written.
- // 3. <area>Offset -- Current offset into area. If an area's End
- // is precomputed, this variable tracks the
- // offsets of contents as they are written.
-
- /////// Setup Header Area ///////
- // Load free memory pointer
- fillOrderCalldata := mload(0x40)
- // bytes4(keccak256("fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"))
- // = 0xb4be83d5
- // Leave 0x20 bytes to store the length
- mstore(add(fillOrderCalldata, 0x20), 0xb4be83d500000000000000000000000000000000000000000000000000000000)
- let headerAreaEnd := add(fillOrderCalldata, 0x24)
-
- /////// Setup Params Area ///////
- // This area is preallocated and written to later.
- // This is because we need to fill in offsets that have not yet been calculated.
- let paramsAreaStart := headerAreaEnd
- let paramsAreaEnd := add(paramsAreaStart, 0x60)
- let paramsAreaOffset := paramsAreaStart
-
- /////// Setup Data Area ///////
- let dataAreaStart := paramsAreaEnd
- let dataAreaEnd := dataAreaStart
-
- // Offset from the source data we're reading from
- let sourceOffset := order
- // arrayLenBytes and arrayLenWords track the length of a dynamically-allocated bytes array.
- let arrayLenBytes := 0
- let arrayLenWords := 0
-
- /////// Write order Struct ///////
- // Write memory location of Order, relative to the start of the
- // parameter list, then increment the paramsAreaOffset respectively.
- mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))
- paramsAreaOffset := add(paramsAreaOffset, 0x20)
-
- // Write values for each field in the order
- // It would be nice to use a loop, but we save on gas by writing
- // the stores sequentially.
- mstore(dataAreaEnd, mload(sourceOffset)) // makerAddress
- mstore(add(dataAreaEnd, 0x20), mload(add(sourceOffset, 0x20))) // takerAddress
- mstore(add(dataAreaEnd, 0x40), mload(add(sourceOffset, 0x40))) // feeRecipientAddress
- mstore(add(dataAreaEnd, 0x60), mload(add(sourceOffset, 0x60))) // senderAddress
- mstore(add(dataAreaEnd, 0x80), mload(add(sourceOffset, 0x80))) // makerAssetAmount
- mstore(add(dataAreaEnd, 0xA0), mload(add(sourceOffset, 0xA0))) // takerAssetAmount
- mstore(add(dataAreaEnd, 0xC0), mload(add(sourceOffset, 0xC0))) // makerFeeAmount
- mstore(add(dataAreaEnd, 0xE0), mload(add(sourceOffset, 0xE0))) // takerFeeAmount
- mstore(add(dataAreaEnd, 0x100), mload(add(sourceOffset, 0x100))) // expirationTimeSeconds
- mstore(add(dataAreaEnd, 0x120), mload(add(sourceOffset, 0x120))) // salt
- mstore(add(dataAreaEnd, 0x140), mload(add(sourceOffset, 0x140))) // Offset to makerAssetData
- mstore(add(dataAreaEnd, 0x160), mload(add(sourceOffset, 0x160))) // Offset to takerAssetData
- dataAreaEnd := add(dataAreaEnd, 0x180)
- sourceOffset := add(sourceOffset, 0x180)
-
- // Write offset to <order.makerAssetData>
- mstore(add(dataAreaStart, mul(10, 0x20)), sub(dataAreaEnd, dataAreaStart))
-
- // Calculate length of <order.makerAssetData>
- sourceOffset := mload(add(order, 0x140)) // makerAssetData
- arrayLenBytes := mload(sourceOffset)
- sourceOffset := add(sourceOffset, 0x20)
- arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)
-
- // Write length of <order.makerAssetData>
- mstore(dataAreaEnd, arrayLenBytes)
- dataAreaEnd := add(dataAreaEnd, 0x20)
-
- // Write contents of <order.makerAssetData>
- for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {
- mstore(dataAreaEnd, mload(sourceOffset))
- dataAreaEnd := add(dataAreaEnd, 0x20)
- sourceOffset := add(sourceOffset, 0x20)
- }
-
- // Write offset to <order.takerAssetData>
- mstore(add(dataAreaStart, mul(11, 0x20)), sub(dataAreaEnd, dataAreaStart))
-
- // Calculate length of <order.takerAssetData>
- sourceOffset := mload(add(order, 0x160)) // takerAssetData
- arrayLenBytes := mload(sourceOffset)
- sourceOffset := add(sourceOffset, 0x20)
- arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)
-
- // Write length of <order.takerAssetData>
- mstore(dataAreaEnd, arrayLenBytes)
- dataAreaEnd := add(dataAreaEnd, 0x20)
-
- // Write contents of <order.takerAssetData>
- for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {
- mstore(dataAreaEnd, mload(sourceOffset))
- dataAreaEnd := add(dataAreaEnd, 0x20)
- sourceOffset := add(sourceOffset, 0x20)
- }
-
- /////// Write takerAssetFillAmount ///////
- mstore(paramsAreaOffset, takerAssetFillAmount)
- paramsAreaOffset := add(paramsAreaOffset, 0x20)
-
- /////// Write signature ///////
- // Write offset to paramsArea
- mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))
-
- // Calculate length of signature
- sourceOffset := signature
- arrayLenBytes := mload(sourceOffset)
- sourceOffset := add(sourceOffset, 0x20)
- arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)
-
- // Write length of signature
- mstore(dataAreaEnd, arrayLenBytes)
- dataAreaEnd := add(dataAreaEnd, 0x20)
-
- // Write contents of signature
- for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {
- mstore(dataAreaEnd, mload(sourceOffset))
- dataAreaEnd := add(dataAreaEnd, 0x20)
- sourceOffset := add(sourceOffset, 0x20)
- }
-
- // Set length of calldata
- mstore(fillOrderCalldata, sub(dataAreaEnd, add(fillOrderCalldata, 0x20)))
-
- // Increment free memory pointer
- mstore(0x40, dataAreaEnd)
- }
-
- return fillOrderCalldata;
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/libs/LibConstants.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibConstants.sol
deleted file mode 100644
index 8d2732cd3..000000000
--- a/packages/contracts/contracts/protocol/Exchange/libs/LibConstants.sol
+++ /dev/null
@@ -1,49 +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.24;
-
-
-// solhint-disable max-line-length
-contract LibConstants {
-
- // Asset data for ZRX token. Used for fee transfers.
- // @TODO: Hardcode constant when we deploy. Currently
- // not constant to make testing easier.
-
- // The proxyId for ZRX_ASSET_DATA is bytes4(keccak256("ERC20Token(address)")) = 0xf47261b0
-
- // Kovan ZRX address is 0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570.
- // The ABI encoded proxyId and address is 0xf47261b00000000000000000000000006ff6c0ff1d68b964901f986d4c9fa3ac68346570
- // bytes constant public ZRX_ASSET_DATA = "\xf4\x72\x61\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6f\xf6\xc0\xff\x1d\x68\xb9\x64\x90\x1f\x98\x6d\x4c\x9f\xa3\xac\x68\x34\x65\x70";
-
- // Mainnet ZRX address is 0xe41d2489571d322189246dafa5ebde1f4699f498.
- // The ABI encoded proxyId and address is 0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498
- // bytes constant public ZRX_ASSET_DATA = "\xf4\x72\x61\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\x1d\x24\x89\x57\x1d\x32\x21\x89\x24\x6d\xaf\xa5\xeb\xde\x1f\x46\x99\xf4\x98";
-
- // solhint-disable-next-line var-name-mixedcase
- bytes public ZRX_ASSET_DATA;
-
- // @TODO: Remove when we deploy.
- constructor (bytes memory zrxAssetData)
- public
- {
- ZRX_ASSET_DATA = zrxAssetData;
- }
-}
-// solhint-enable max-line-length
diff --git a/packages/contracts/contracts/protocol/Exchange/libs/LibEIP712.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibEIP712.sol
deleted file mode 100644
index 203edc1fd..000000000
--- a/packages/contracts/contracts/protocol/Exchange/libs/LibEIP712.sol
+++ /dev/null
@@ -1,87 +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.24;
-
-
-contract LibEIP712 {
-
- // EIP191 header for EIP712 prefix
- string constant internal EIP191_HEADER = "\x19\x01";
-
- // EIP712 Domain Name value
- string constant internal EIP712_DOMAIN_NAME = "0x Protocol";
-
- // EIP712 Domain Version value
- string constant internal EIP712_DOMAIN_VERSION = "2";
-
- // Hash of the EIP712 Domain Separator Schema
- bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(
- "EIP712Domain(",
- "string name,",
- "string version,",
- "address verifyingContract",
- ")"
- ));
-
- // Hash of the EIP712 Domain Separator data
- // solhint-disable-next-line var-name-mixedcase
- bytes32 public EIP712_DOMAIN_HASH;
-
- constructor ()
- public
- {
- EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(
- EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,
- keccak256(bytes(EIP712_DOMAIN_NAME)),
- keccak256(bytes(EIP712_DOMAIN_VERSION)),
- bytes32(address(this))
- ));
- }
-
- /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.
- /// @param hashStruct The EIP712 hash struct.
- /// @return EIP712 hash applied to this EIP712 Domain.
- function hashEIP712Message(bytes32 hashStruct)
- internal
- view
- returns (bytes32 result)
- {
- bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;
-
- // Assembly for more efficient computing:
- // keccak256(abi.encodePacked(
- // EIP191_HEADER,
- // EIP712_DOMAIN_HASH,
- // hashStruct
- // ));
-
- assembly {
- // Load free memory pointer
- let memPtr := mload(64)
-
- mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header
- mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash
- mstore(add(memPtr, 34), hashStruct) // Hash of struct
-
- // Compute hash
- result := keccak256(memPtr, 66)
- }
- return result;
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/libs/LibExchangeErrors.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibExchangeErrors.sol
deleted file mode 100644
index a0f75bc06..000000000
--- a/packages/contracts/contracts/protocol/Exchange/libs/LibExchangeErrors.sol
+++ /dev/null
@@ -1,70 +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.
-
-*/
-
-// solhint-disable
-pragma solidity 0.4.24;
-
-
-/// @dev This contract documents the revert reasons used in the Exchange contract.
-/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.
-contract LibExchangeErrors {
-
- /// Order validation errors ///
- string constant ORDER_UNFILLABLE = "ORDER_UNFILLABLE"; // Order cannot be filled.
- string constant INVALID_MAKER = "INVALID_MAKER"; // Invalid makerAddress.
- string constant INVALID_TAKER = "INVALID_TAKER"; // Invalid takerAddress.
- string constant INVALID_SENDER = "INVALID_SENDER"; // Invalid `msg.sender`.
- string constant INVALID_ORDER_SIGNATURE = "INVALID_ORDER_SIGNATURE"; // Signature validation failed.
-
- /// fillOrder validation errors ///
- string constant INVALID_TAKER_AMOUNT = "INVALID_TAKER_AMOUNT"; // takerAssetFillAmount cannot equal 0.
- string constant ROUNDING_ERROR = "ROUNDING_ERROR"; // Rounding error greater than 0.1% of takerAssetFillAmount.
-
- /// Signature validation errors ///
- string constant INVALID_SIGNATURE = "INVALID_SIGNATURE"; // Signature validation failed.
- string constant SIGNATURE_ILLEGAL = "SIGNATURE_ILLEGAL"; // Signature type is illegal.
- string constant SIGNATURE_UNSUPPORTED = "SIGNATURE_UNSUPPORTED"; // Signature type unsupported.
-
- /// cancelOrdersUptTo errors ///
- string constant INVALID_NEW_ORDER_EPOCH = "INVALID_NEW_ORDER_EPOCH"; // Specified salt must be greater than or equal to existing orderEpoch.
-
- /// fillOrKillOrder errors ///
- string constant COMPLETE_FILL_FAILED = "COMPLETE_FILL_FAILED"; // Desired takerAssetFillAmount could not be completely filled.
-
- /// matchOrders errors ///
- string constant NEGATIVE_SPREAD_REQUIRED = "NEGATIVE_SPREAD_REQUIRED"; // Matched orders must have a negative spread.
-
- /// Transaction errors ///
- string constant REENTRANCY_ILLEGAL = "REENTRANCY_ILLEGAL"; // Recursive reentrancy is not allowed.
- string constant INVALID_TX_HASH = "INVALID_TX_HASH"; // Transaction has already been executed.
- string constant INVALID_TX_SIGNATURE = "INVALID_TX_SIGNATURE"; // Signature validation failed.
- string constant FAILED_EXECUTION = "FAILED_EXECUTION"; // Transaction execution failed.
-
- /// registerAssetProxy errors ///
- string constant ASSET_PROXY_ALREADY_EXISTS = "ASSET_PROXY_ALREADY_EXISTS"; // AssetProxy with same id already exists.
-
- /// dispatchTransferFrom errors ///
- string constant ASSET_PROXY_DOES_NOT_EXIST = "ASSET_PROXY_DOES_NOT_EXIST"; // No assetProxy registered at given id.
- string constant TRANSFER_FAILED = "TRANSFER_FAILED"; // Asset transfer unsuccesful.
-
- /// Length validation errors ///
- string constant LENGTH_GREATER_THAN_0_REQUIRED = "LENGTH_GREATER_THAN_0_REQUIRED"; // Byte array must have a length greater than 0.
- string constant LENGTH_GREATER_THAN_3_REQUIRED = "LENGTH_GREATER_THAN_3_REQUIRED"; // Byte array must have a length greater than 3.
- string constant LENGTH_0_REQUIRED = "LENGTH_0_REQUIRED"; // Byte array must have a length of 0.
- string constant LENGTH_65_REQUIRED = "LENGTH_65_REQUIRED"; // Byte array must have a length of 65.
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/libs/LibFillResults.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibFillResults.sol
deleted file mode 100644
index 659ae9a69..000000000
--- a/packages/contracts/contracts/protocol/Exchange/libs/LibFillResults.sol
+++ /dev/null
@@ -1,53 +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.24;
-
-import "../../../utils/SafeMath/SafeMath.sol";
-
-
-contract LibFillResults is
- SafeMath
-{
- struct FillResults {
- uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.
- uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.
- uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).
- uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).
- }
-
- struct MatchedFillResults {
- FillResults left; // Amounts filled and fees paid of left order.
- FillResults right; // Amounts filled and fees paid of right order.
- uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker.
- }
-
- /// @dev Adds properties of both FillResults instances.
- /// Modifies the first FillResults instance specified.
- /// @param totalFillResults Fill results instance that will be added onto.
- /// @param singleFillResults Fill results instance that will be added to totalFillResults.
- function addFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)
- internal
- pure
- {
- totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);
- totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);
- totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);
- totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/libs/LibMath.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibMath.sol
deleted file mode 100644
index c0b85ea10..000000000
--- a/packages/contracts/contracts/protocol/Exchange/libs/LibMath.sol
+++ /dev/null
@@ -1,253 +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.24;
-
-import "../../../utils/SafeMath/SafeMath.sol";
-
-
-contract LibMath is
- SafeMath
-{
- /// @dev Calculates partial value given a numerator and denominator rounded down.
- /// Reverts if rounding error is >= 0.1%
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to calculate partial of.
- /// @return Partial value of target rounded down.
- function safeGetPartialAmountFloor(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- internal
- pure
- returns (uint256 partialAmount)
- {
- require(
- denominator > 0,
- "DIVISION_BY_ZERO"
- );
-
- require(
- !isRoundingErrorFloor(
- numerator,
- denominator,
- target
- ),
- "ROUNDING_ERROR"
- );
-
- partialAmount = safeDiv(
- safeMul(numerator, target),
- denominator
- );
- return partialAmount;
- }
-
- /// @dev Calculates partial value given a numerator and denominator rounded down.
- /// Reverts if rounding error is >= 0.1%
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to calculate partial of.
- /// @return Partial value of target rounded up.
- function safeGetPartialAmountCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- internal
- pure
- returns (uint256 partialAmount)
- {
- require(
- denominator > 0,
- "DIVISION_BY_ZERO"
- );
-
- require(
- !isRoundingErrorCeil(
- numerator,
- denominator,
- target
- ),
- "ROUNDING_ERROR"
- );
-
- // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):
- // ceil(a / b) = floor((a + b - 1) / b)
- // To implement `ceil(a / b)` using safeDiv.
- partialAmount = safeDiv(
- safeAdd(
- safeMul(numerator, target),
- safeSub(denominator, 1)
- ),
- denominator
- );
- return partialAmount;
- }
-
- /// @dev Calculates partial value given a numerator and denominator rounded down.
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to calculate partial of.
- /// @return Partial value of target rounded down.
- function getPartialAmountFloor(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- internal
- pure
- returns (uint256 partialAmount)
- {
- require(
- denominator > 0,
- "DIVISION_BY_ZERO"
- );
-
- partialAmount = safeDiv(
- safeMul(numerator, target),
- denominator
- );
- return partialAmount;
- }
-
- /// @dev Calculates partial value given a numerator and denominator rounded down.
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to calculate partial of.
- /// @return Partial value of target rounded up.
- function getPartialAmountCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- internal
- pure
- returns (uint256 partialAmount)
- {
- require(
- denominator > 0,
- "DIVISION_BY_ZERO"
- );
-
- // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):
- // ceil(a / b) = floor((a + b - 1) / b)
- // To implement `ceil(a / b)` using safeDiv.
- partialAmount = safeDiv(
- safeAdd(
- safeMul(numerator, target),
- safeSub(denominator, 1)
- ),
- denominator
- );
- return partialAmount;
- }
-
- /// @dev Checks if rounding error >= 0.1% when rounding down.
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to multiply with numerator/denominator.
- /// @return Rounding error is present.
- function isRoundingErrorFloor(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- internal
- pure
- returns (bool isError)
- {
- require(
- denominator > 0,
- "DIVISION_BY_ZERO"
- );
-
- // The absolute rounding error is the difference between the rounded
- // value and the ideal value. The relative rounding error is the
- // absolute rounding error divided by the absolute value of the
- // ideal value. This is undefined when the ideal value is zero.
- //
- // The ideal value is `numerator * target / denominator`.
- // Let's call `numerator * target % denominator` the remainder.
- // The absolute error is `remainder / denominator`.
- //
- // When the ideal value is zero, we require the absolute error to
- // be zero. Fortunately, this is always the case. The ideal value is
- // zero iff `numerator == 0` and/or `target == 0`. In this case the
- // remainder and absolute error are also zero.
- if (target == 0 || numerator == 0) {
- return false;
- }
-
- // Otherwise, we want the relative rounding error to be strictly
- // less than 0.1%.
- // The relative error is `remainder / (numerator * target)`.
- // We want the relative error less than 1 / 1000:
- // remainder / (numerator * denominator) < 1 / 1000
- // or equivalently:
- // 1000 * remainder < numerator * target
- // so we have a rounding error iff:
- // 1000 * remainder >= numerator * target
- uint256 remainder = mulmod(
- target,
- numerator,
- denominator
- );
- isError = safeMul(1000, remainder) >= safeMul(numerator, target);
- return isError;
- }
-
- /// @dev Checks if rounding error >= 0.1% when rounding up.
- /// @param numerator Numerator.
- /// @param denominator Denominator.
- /// @param target Value to multiply with numerator/denominator.
- /// @return Rounding error is present.
- function isRoundingErrorCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- internal
- pure
- returns (bool isError)
- {
- require(
- denominator > 0,
- "DIVISION_BY_ZERO"
- );
-
- // See the comments in `isRoundingError`.
- if (target == 0 || numerator == 0) {
- // When either is zero, the ideal value and rounded value are zero
- // and there is no rounding error. (Although the relative error
- // is undefined.)
- return false;
- }
- // Compute remainder as before
- uint256 remainder = mulmod(
- target,
- numerator,
- denominator
- );
- remainder = safeSub(denominator, remainder) % denominator;
- isError = safeMul(1000, remainder) >= safeMul(numerator, target);
- return isError;
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/libs/LibOrder.sol b/packages/contracts/contracts/protocol/Exchange/libs/LibOrder.sol
deleted file mode 100644
index 0fe7c2161..000000000
--- a/packages/contracts/contracts/protocol/Exchange/libs/LibOrder.sol
+++ /dev/null
@@ -1,145 +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.24;
-
-import "./LibEIP712.sol";
-
-
-contract LibOrder is
- LibEIP712
-{
- // Hash for the EIP712 Order Schema
- bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(
- "Order(",
- "address makerAddress,",
- "address takerAddress,",
- "address feeRecipientAddress,",
- "address senderAddress,",
- "uint256 makerAssetAmount,",
- "uint256 takerAssetAmount,",
- "uint256 makerFee,",
- "uint256 takerFee,",
- "uint256 expirationTimeSeconds,",
- "uint256 salt,",
- "bytes makerAssetData,",
- "bytes takerAssetData",
- ")"
- ));
-
- // A valid order remains fillable until it is expired, fully filled, or cancelled.
- // An order's state is unaffected by external factors, like account balances.
- enum OrderStatus {
- INVALID, // Default value
- INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount
- INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount
- FILLABLE, // Order is fillable
- EXPIRED, // Order has already expired
- FULLY_FILLED, // Order is fully filled
- CANCELLED // Order has been cancelled
- }
-
- // solhint-disable max-line-length
- struct Order {
- address makerAddress; // Address that created the order.
- address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order.
- address feeRecipientAddress; // Address that will recieve fees when order is filled.
- address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.
- uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0.
- uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0.
- uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.
- uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.
- uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires.
- uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash.
- bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.
- bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.
- }
- // solhint-enable max-line-length
-
- struct OrderInfo {
- uint8 orderStatus; // Status that describes order's validity and fillability.
- bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash).
- uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled.
- }
-
- /// @dev Calculates Keccak-256 hash of the order.
- /// @param order The order structure.
- /// @return Keccak-256 EIP712 hash of the order.
- function getOrderHash(Order memory order)
- internal
- view
- returns (bytes32 orderHash)
- {
- orderHash = hashEIP712Message(hashOrder(order));
- return orderHash;
- }
-
- /// @dev Calculates EIP712 hash of the order.
- /// @param order The order structure.
- /// @return EIP712 hash of the order.
- function hashOrder(Order memory order)
- internal
- pure
- returns (bytes32 result)
- {
- bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;
- bytes32 makerAssetDataHash = keccak256(order.makerAssetData);
- bytes32 takerAssetDataHash = keccak256(order.takerAssetData);
-
- // Assembly for more efficiently computing:
- // keccak256(abi.encodePacked(
- // EIP712_ORDER_SCHEMA_HASH,
- // bytes32(order.makerAddress),
- // bytes32(order.takerAddress),
- // bytes32(order.feeRecipientAddress),
- // bytes32(order.senderAddress),
- // order.makerAssetAmount,
- // order.takerAssetAmount,
- // order.makerFee,
- // order.takerFee,
- // order.expirationTimeSeconds,
- // order.salt,
- // keccak256(order.makerAssetData),
- // keccak256(order.takerAssetData)
- // ));
-
- assembly {
- // Calculate memory addresses that will be swapped out before hashing
- let pos1 := sub(order, 32)
- let pos2 := add(order, 320)
- let pos3 := add(order, 352)
-
- // Backup
- let temp1 := mload(pos1)
- let temp2 := mload(pos2)
- let temp3 := mload(pos3)
-
- // Hash in place
- mstore(pos1, schemaHash)
- mstore(pos2, makerAssetDataHash)
- mstore(pos3, takerAssetDataHash)
- result := keccak256(pos1, 416)
-
- // Restore
- mstore(pos1, temp1)
- mstore(pos2, temp2)
- mstore(pos3, temp3)
- }
- return result;
- }
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
deleted file mode 100644
index 0ddfca270..000000000
--- a/packages/contracts/contracts/protocol/Exchange/mixins/MAssetProxyDispatcher.sol
+++ /dev/null
@@ -1,45 +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.24;
-
-import "../interfaces/IAssetProxyDispatcher.sol";
-
-
-contract MAssetProxyDispatcher is
- IAssetProxyDispatcher
-{
- // Logs registration of new asset proxy
- event AssetProxyRegistered(
- bytes4 id, // Id of new registered AssetProxy.
- address assetProxy // Address of new registered AssetProxy.
- );
-
- /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.
- /// @param assetData Byte array encoded for the asset.
- /// @param from Address to transfer token from.
- /// @param to Address to transfer token to.
- /// @param amount Amount of token to transfer.
- function dispatchTransferFrom(
- bytes memory assetData,
- address from,
- address to,
- uint256 amount
- )
- internal;
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/mixins/MExchangeCore.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MExchangeCore.sol
deleted file mode 100644
index 742499568..000000000
--- a/packages/contracts/contracts/protocol/Exchange/mixins/MExchangeCore.sol
+++ /dev/null
@@ -1,157 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
-import "../interfaces/IExchangeCore.sol";
-
-
-contract MExchangeCore is
- IExchangeCore
-{
- // Fill event is emitted whenever an order is filled.
- event Fill(
- address indexed makerAddress, // Address that created the order.
- address indexed feeRecipientAddress, // Address that received fees.
- address takerAddress, // Address that filled the order.
- address senderAddress, // Address that called the Exchange contract (msg.sender).
- uint256 makerAssetFilledAmount, // Amount of makerAsset sold by maker and bought by taker.
- uint256 takerAssetFilledAmount, // Amount of takerAsset sold by taker and bought by maker.
- uint256 makerFeePaid, // Amount of ZRX paid to feeRecipient by maker.
- uint256 takerFeePaid, // Amount of ZRX paid to feeRecipient by taker.
- bytes32 indexed orderHash, // EIP712 hash of order (see LibOrder.getOrderHash).
- bytes makerAssetData, // Encoded data specific to makerAsset.
- bytes takerAssetData // Encoded data specific to takerAsset.
- );
-
- // Cancel event is emitted whenever an individual order is cancelled.
- event Cancel(
- address indexed makerAddress, // Address that created the order.
- address indexed feeRecipientAddress, // Address that would have recieved fees if order was filled.
- address senderAddress, // Address that called the Exchange contract (msg.sender).
- bytes32 indexed orderHash, // EIP712 hash of order (see LibOrder.getOrderHash).
- bytes makerAssetData, // Encoded data specific to makerAsset.
- bytes takerAssetData // Encoded data specific to takerAsset.
- );
-
- // CancelUpTo event is emitted whenever `cancelOrdersUpTo` is executed succesfully.
- event CancelUpTo(
- address indexed makerAddress, // Orders cancelled must have been created by this address.
- address indexed senderAddress, // Orders cancelled must have a `senderAddress` equal to this address.
- uint256 orderEpoch // Orders with specified makerAddress and senderAddress with a salt less than this value are considered cancelled.
- );
-
- /// @dev Fills the input order.
- /// @param order Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- /// @return Amounts filled and fees paid by maker and taker.
- function fillOrderInternal(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- internal
- returns (LibFillResults.FillResults memory fillResults);
-
- /// @dev After calling, the order can not be filled anymore.
- /// @param order Order struct containing order specifications.
- function cancelOrderInternal(LibOrder.Order memory order)
- internal;
-
- /// @dev Updates state with results of a fill order.
- /// @param order that was filled.
- /// @param takerAddress Address of taker who filled the order.
- /// @param orderTakerAssetFilledAmount Amount of order already filled.
- /// @return fillResults Amounts filled and fees paid by maker and taker.
- function updateFilledState(
- LibOrder.Order memory order,
- address takerAddress,
- bytes32 orderHash,
- uint256 orderTakerAssetFilledAmount,
- LibFillResults.FillResults memory fillResults
- )
- internal;
-
- /// @dev Updates state with results of cancelling an order.
- /// State is only updated if the order is currently fillable.
- /// Otherwise, updating state would have no effect.
- /// @param order that was cancelled.
- /// @param orderHash Hash of order that was cancelled.
- function updateCancelledState(
- LibOrder.Order memory order,
- bytes32 orderHash
- )
- internal;
-
- /// @dev Validates context for fillOrder. Succeeds or throws.
- /// @param order to be filled.
- /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
- /// @param takerAddress Address of order taker.
- /// @param signature Proof that the orders was created by its maker.
- function assertFillableOrder(
- LibOrder.Order memory order,
- LibOrder.OrderInfo memory orderInfo,
- address takerAddress,
- bytes memory signature
- )
- internal
- view;
-
- /// @dev Validates context for fillOrder. Succeeds or throws.
- /// @param order to be filled.
- /// @param orderInfo Status, orderHash, and amount already filled of order.
- /// @param takerAssetFillAmount Desired amount of order to fill by taker.
- /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
- /// @param makerAssetFilledAmount Amount of makerAsset that will be transfered.
- function assertValidFill(
- LibOrder.Order memory order,
- LibOrder.OrderInfo memory orderInfo,
- uint256 takerAssetFillAmount,
- uint256 takerAssetFilledAmount,
- uint256 makerAssetFilledAmount
- )
- internal
- view;
-
- /// @dev Validates context for cancelOrder. Succeeds or throws.
- /// @param order to be cancelled.
- /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.
- function assertValidCancel(
- LibOrder.Order memory order,
- LibOrder.OrderInfo memory orderInfo
- )
- internal
- view;
-
- /// @dev Calculates amounts filled and fees paid by maker and taker.
- /// @param order to be filled.
- /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.
- /// @return fillResults Amounts filled and fees paid by maker and taker.
- function calculateFillResults(
- LibOrder.Order memory order,
- uint256 takerAssetFilledAmount
- )
- internal
- pure
- returns (LibFillResults.FillResults memory fillResults);
-
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/mixins/MMatchOrders.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MMatchOrders.sol
deleted file mode 100644
index 96fa34bc0..000000000
--- a/packages/contracts/contracts/protocol/Exchange/mixins/MMatchOrders.sol
+++ /dev/null
@@ -1,58 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
-import "../interfaces/IMatchOrders.sol";
-
-
-contract MMatchOrders is
- IMatchOrders
-{
- /// @dev Validates context for matchOrders. Succeeds or throws.
- /// @param leftOrder First order to match.
- /// @param rightOrder Second order to match.
- function assertValidMatch(
- LibOrder.Order memory leftOrder,
- LibOrder.Order memory rightOrder
- )
- internal
- pure;
-
- /// @dev Calculates fill amounts for the matched orders.
- /// Each order is filled at their respective price point. However, the calculations are
- /// carried out as though the orders are both being filled at the right order's price point.
- /// The profit made by the leftOrder order goes to the taker (who matched the two orders).
- /// @param leftOrder First order to match.
- /// @param rightOrder Second order to match.
- /// @param leftOrderTakerAssetFilledAmount Amount of left order already filled.
- /// @param rightOrderTakerAssetFilledAmount Amount of right order already filled.
- /// @param matchedFillResults Amounts to fill and fees to pay by maker and taker of matched orders.
- function calculateMatchedFillResults(
- LibOrder.Order memory leftOrder,
- LibOrder.Order memory rightOrder,
- uint256 leftOrderTakerAssetFilledAmount,
- uint256 rightOrderTakerAssetFilledAmount
- )
- internal
- pure
- returns (LibFillResults.MatchedFillResults memory matchedFillResults);
-
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/mixins/MSignatureValidator.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MSignatureValidator.sol
deleted file mode 100644
index 1fe88b908..000000000
--- a/packages/contracts/contracts/protocol/Exchange/mixins/MSignatureValidator.sol
+++ /dev/null
@@ -1,75 +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.24;
-
-import "../interfaces/ISignatureValidator.sol";
-
-
-contract MSignatureValidator is
- ISignatureValidator
-{
- event SignatureValidatorApproval(
- address indexed signerAddress, // Address that approves or disapproves a contract to verify signatures.
- address indexed validatorAddress, // Address of signature validator contract.
- bool approved // Approval or disapproval of validator contract.
- );
-
- // Allowed signature types.
- enum SignatureType {
- Illegal, // 0x00, default value
- Invalid, // 0x01
- EIP712, // 0x02
- EthSign, // 0x03
- Wallet, // 0x04
- Validator, // 0x05
- PreSigned, // 0x06
- NSignatureTypes // 0x07, number of signature types. Always leave at end.
- }
-
- /// @dev Verifies signature using logic defined by Wallet contract.
- /// @param hash Any 32 byte hash.
- /// @param walletAddress Address that should have signed the given hash
- /// and defines its own signature verification method.
- /// @param signature Proof that the hash has been signed by signer.
- /// @return True if the address recovered from the provided signature matches the input signer address.
- function isValidWalletSignature(
- bytes32 hash,
- address walletAddress,
- bytes signature
- )
- internal
- view
- returns (bool isValid);
-
- /// @dev Verifies signature using logic defined by Validator contract.
- /// @param validatorAddress Address of validator contract.
- /// @param hash Any 32 byte hash.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof that the hash has been signed by signer.
- /// @return True if the address recovered from the provided signature matches the input signer address.
- function isValidValidatorSignature(
- address validatorAddress,
- bytes32 hash,
- address signerAddress,
- bytes signature
- )
- internal
- view
- returns (bool isValid);
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/mixins/MTransactions.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MTransactions.sol
deleted file mode 100644
index 4f61a4945..000000000
--- a/packages/contracts/contracts/protocol/Exchange/mixins/MTransactions.sol
+++ /dev/null
@@ -1,58 +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.24;
-
-import "../interfaces/ITransactions.sol";
-
-
-contract MTransactions is
- ITransactions
-{
- // Hash for the EIP712 ZeroEx Transaction Schema
- bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked(
- "ZeroExTransaction(",
- "uint256 salt,",
- "address signerAddress,",
- "bytes data",
- ")"
- ));
-
- /// @dev Calculates EIP712 hash of the Transaction.
- /// @param salt Arbitrary number to ensure uniqueness of transaction hash.
- /// @param signerAddress Address of transaction signer.
- /// @param data AbiV2 encoded calldata.
- /// @return EIP712 hash of the Transaction.
- function hashZeroExTransaction(
- uint256 salt,
- address signerAddress,
- bytes memory data
- )
- internal
- pure
- returns (bytes32 result);
-
- /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).
- /// If calling a fill function, this address will represent the taker.
- /// If calling a cancel function, this address will represent the maker.
- /// @return Signer of 0x transaction if entry point is `executeTransaction`.
- /// `msg.sender` if entry point is any other function.
- function getCurrentContextAddress()
- internal
- view
- returns (address);
-}
diff --git a/packages/contracts/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol b/packages/contracts/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
deleted file mode 100644
index 4adfbde01..000000000
--- a/packages/contracts/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
+++ /dev/null
@@ -1,41 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
-import "../interfaces/IWrapperFunctions.sol";
-
-
-contract MWrapperFunctions is
- IWrapperFunctions
-{
- /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.
- /// @param order LibOrder.Order struct containing order specifications.
- /// @param takerAssetFillAmount Desired amount of takerAsset to sell.
- /// @param signature Proof that order has been created by maker.
- function fillOrKillOrderInternal(
- LibOrder.Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- internal
- returns (LibFillResults.FillResults memory fillResults);
-}
diff --git a/packages/contracts/contracts/test/DummyERC20Token/DummyERC20Token.sol b/packages/contracts/contracts/test/DummyERC20Token/DummyERC20Token.sol
deleted file mode 100644
index 412c5d1ad..000000000
--- a/packages/contracts/contracts/test/DummyERC20Token/DummyERC20Token.sol
+++ /dev/null
@@ -1,77 +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.24;
-
-import "../../utils/Ownable/Ownable.sol";
-import "../../tokens/ERC20Token/MintableERC20Token.sol";
-
-
-contract DummyERC20Token is
- Ownable,
- MintableERC20Token
-{
- string public name;
- string public symbol;
- uint256 public decimals;
- uint256 public constant MAX_MINT_AMOUNT = 10000000000000000000000;
-
- constructor (
- string _name,
- string _symbol,
- uint256 _decimals,
- uint256 _totalSupply
- )
- public
- {
- name = _name;
- symbol = _symbol;
- decimals = _decimals;
- _totalSupply = _totalSupply;
- balances[msg.sender] = _totalSupply;
- }
-
- /// @dev Sets the balance of target address
- /// @param _target Address or which balance will be updated
- /// @param _value New balance of target address
- function setBalance(address _target, uint256 _value)
- external
- onlyOwner
- {
- uint256 currBalance = balances[_target];
- if (_value < currBalance) {
- _totalSupply = safeSub(_totalSupply, safeSub(currBalance, _value));
- } else {
- _totalSupply = safeAdd(_totalSupply, safeSub(_value, currBalance));
- }
- balances[_target] = _value;
- }
-
- /// @dev Mints new tokens for sender
- /// @param _value Amount of tokens to mint
- function mint(uint256 _value)
- external
- {
- require(
- _value <= MAX_MINT_AMOUNT,
- "VALUE_TOO_LARGE"
- );
-
- _mint(msg.sender, _value);
- }
-}
diff --git a/packages/contracts/contracts/test/DummyERC721Token/DummyERC721Token.sol b/packages/contracts/contracts/test/DummyERC721Token/DummyERC721Token.sol
deleted file mode 100644
index ac9068d1d..000000000
--- a/packages/contracts/contracts/test/DummyERC721Token/DummyERC721Token.sol
+++ /dev/null
@@ -1,63 +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.24;
-
-import "../../tokens/ERC721Token/MintableERC721Token.sol";
-import "../../utils/Ownable/Ownable.sol";
-
-
-// solhint-disable no-empty-blocks
-contract DummyERC721Token is
- Ownable,
- MintableERC721Token
-{
- string public name;
- string public symbol;
-
- constructor (
- string _name,
- string _symbol
- )
- public
- {
- name = _name;
- symbol = _symbol;
- }
-
- /// @dev Function to mint a new token
- /// Reverts if the given token ID already exists
- /// @param _to Address of the beneficiary that will own the minted token
- /// @param _tokenId ID of the token to be minted by the msg.sender
- function mint(address _to, uint256 _tokenId)
- external
- {
- _mint(_to, _tokenId);
- }
-
- /// @dev Function to burn a token
- /// Reverts if the given token ID doesn't exist or not called by contract owner
- /// @param _owner Owner of token with given token ID
- /// @param _tokenId ID of the token to be burned by the msg.sender
- function burn(address _owner, uint256 _tokenId)
- external
- onlyOwner
- {
- _burn(_owner, _tokenId);
- }
-}
diff --git a/packages/contracts/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol b/packages/contracts/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
deleted file mode 100644
index 99dd47a78..000000000
--- a/packages/contracts/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
+++ /dev/null
@@ -1,188 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../../utils/LibBytes/LibBytes.sol";
-import "../../tokens/ERC20Token/ERC20Token.sol";
-import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-
-
-// solhint-disable no-unused-vars
-contract ReentrantERC20Token is
- ERC20Token
-{
- using LibBytes for bytes;
-
- // solhint-disable-next-line var-name-mixedcase
- IExchange internal EXCHANGE;
-
- bytes internal constant REENTRANCY_ILLEGAL_REVERT_REASON = abi.encodeWithSelector(
- bytes4(keccak256("Error(string)")),
- "REENTRANCY_ILLEGAL"
- );
-
- // All of these functions are potentially vulnerable to reentrancy
- // We do not test any "noThrow" functions because `fillOrderNoThrow` makes a delegatecall to `fillOrder`
- enum ExchangeFunction {
- FILL_ORDER,
- FILL_OR_KILL_ORDER,
- BATCH_FILL_ORDERS,
- BATCH_FILL_OR_KILL_ORDERS,
- MARKET_BUY_ORDERS,
- MARKET_SELL_ORDERS,
- MATCH_ORDERS,
- CANCEL_ORDER,
- BATCH_CANCEL_ORDERS,
- CANCEL_ORDERS_UP_TO,
- SET_SIGNATURE_VALIDATOR_APPROVAL
- }
-
- uint8 internal currentFunctionId = 0;
-
- constructor (address _exchange)
- public
- {
- EXCHANGE = IExchange(_exchange);
- }
-
- /// @dev Set the current function that will be called when `transferFrom` is called.
- /// @param _currentFunctionId Id that corresponds to function name.
- function setCurrentFunction(uint8 _currentFunctionId)
- external
- {
- currentFunctionId = _currentFunctionId;
- }
-
- /// @dev A version of `transferFrom` that attempts to reenter the Exchange contract.
- /// @param _from The address of the sender
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- function transferFrom(
- address _from,
- address _to,
- uint256 _value
- )
- external
- returns (bool)
- {
- // This order would normally be invalid, but it will be used strictly for testing reentrnacy.
- // Any reentrancy checks will happen before any other checks that invalidate the order.
- LibOrder.Order memory order;
-
- // Initialize remaining null parameters
- bytes memory signature;
- LibOrder.Order[] memory orders;
- uint256[] memory takerAssetFillAmounts;
- bytes[] memory signatures;
- bytes memory calldata;
-
- // Create calldata for function that corresponds to currentFunctionId
- if (currentFunctionId == uint8(ExchangeFunction.FILL_ORDER)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.fillOrder.selector,
- order,
- 0,
- signature
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.FILL_OR_KILL_ORDER)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.fillOrKillOrder.selector,
- order,
- 0,
- signature
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_FILL_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.batchFillOrders.selector,
- orders,
- takerAssetFillAmounts,
- signatures
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_FILL_OR_KILL_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.batchFillOrKillOrders.selector,
- orders,
- takerAssetFillAmounts,
- signatures
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.MARKET_BUY_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.marketBuyOrders.selector,
- orders,
- 0,
- signatures
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.MARKET_SELL_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.marketSellOrders.selector,
- orders,
- 0,
- signatures
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.MATCH_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.matchOrders.selector,
- order,
- order,
- signature,
- signature
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.CANCEL_ORDER)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.cancelOrder.selector,
- order
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_CANCEL_ORDERS)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.batchCancelOrders.selector,
- orders
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.CANCEL_ORDERS_UP_TO)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.cancelOrdersUpTo.selector,
- 0
- );
- } else if (currentFunctionId == uint8(ExchangeFunction.SET_SIGNATURE_VALIDATOR_APPROVAL)) {
- calldata = abi.encodeWithSelector(
- EXCHANGE.setSignatureValidatorApproval.selector,
- address(0),
- false
- );
- }
-
- // Call Exchange function, swallow error
- address(EXCHANGE).call(calldata);
-
- // Revert reason is 100 bytes
- bytes memory returnData = new bytes(100);
-
- // Copy return data
- assembly {
- returndatacopy(add(returnData, 32), 0, 100)
- }
-
- // Revert if function reverted with REENTRANCY_ILLEGAL error
- require(!REENTRANCY_ILLEGAL_REVERT_REASON.equals(returnData));
-
- // Transfer will return true if function failed for any other reason
- return true;
- }
-} \ No newline at end of file
diff --git a/packages/contracts/contracts/test/TestConstants/TestConstants.sol b/packages/contracts/contracts/test/TestConstants/TestConstants.sol
deleted file mode 100644
index 1275d007b..000000000
--- a/packages/contracts/contracts/test/TestConstants/TestConstants.sol
+++ /dev/null
@@ -1,57 +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.24;
-
-import "../../utils/LibBytes/LibBytes.sol";
-
-
-// solhint-disable max-line-length
-contract TestConstants {
-
- using LibBytes for bytes;
-
- bytes4 constant internal ERC20_PROXY_ID = bytes4(keccak256("ERC20Token(address)"));
-
- address constant internal KOVAN_ZRX_ADDRESS = 0x6Ff6C0Ff1d68b964901F986d4C9FA3ac68346570;
- bytes constant internal KOVAN_ZRX_ASSET_DATA = "\xf4\x72\x61\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6f\xf6\xc0\xff\x1d\x68\xb9\x64\x90\x1f\x98\x6d\x4c\x9f\xa3\xac\x68\x34\x65\x70";
-
- address constant internal MAINNET_ZRX_ADDRESS = 0xE41d2489571d322189246DaFA5ebDe1F4699F498;
- bytes constant public MAINNET_ZRX_ASSET_DATA = "\xf4\x72\x61\xb0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe4\x1d\x24\x89\x57\x1d\x32\x21\x89\x24\x6d\xaf\xa5\xeb\xde\x1f\x46\x99\xf4\x98";
-
- function assertValidZrxAssetData()
- public
- pure
- returns (bool)
- {
- bytes memory kovanZrxAssetData = abi.encodeWithSelector(ERC20_PROXY_ID, KOVAN_ZRX_ADDRESS);
- require(
- kovanZrxAssetData.equals(KOVAN_ZRX_ASSET_DATA),
- "INVALID_KOVAN_ZRX_ASSET_DATA"
- );
-
- bytes memory mainetZrxAssetData = abi.encodeWithSelector(ERC20_PROXY_ID, MAINNET_ZRX_ADDRESS);
- require(
- mainetZrxAssetData.equals(MAINNET_ZRX_ASSET_DATA),
- "INVALID_MAINNET_ZRX_ASSET_DATA"
- );
-
- return true;
- }
-}
-// solhint-enable max-line-length \ No newline at end of file
diff --git a/packages/contracts/contracts/test/TestLibBytes/TestLibBytes.sol b/packages/contracts/contracts/test/TestLibBytes/TestLibBytes.sol
deleted file mode 100644
index 00d861e61..000000000
--- a/packages/contracts/contracts/test/TestLibBytes/TestLibBytes.sol
+++ /dev/null
@@ -1,269 +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.24;
-
-import "../../utils/LibBytes/LibBytes.sol";
-
-
-contract TestLibBytes {
-
- using LibBytes for bytes;
-
- /// @dev Pops the last byte off of a byte array by modifying its length.
- /// @param b Byte array that will be modified.
- /// @return The byte that was popped off.
- function publicPopLastByte(bytes memory b)
- public
- pure
- returns (bytes memory, bytes1 result)
- {
- result = b.popLastByte();
- return (b, result);
- }
-
- /// @dev Pops the last 20 bytes off of a byte array by modifying its length.
- /// @param b Byte array that will be modified.
- /// @return The 20 byte address that was popped off.
- function publicPopLast20Bytes(bytes memory b)
- public
- pure
- returns (bytes memory, address result)
- {
- result = b.popLast20Bytes();
- return (b, result);
- }
-
- /// @dev Tests equality of two byte arrays.
- /// @param lhs First byte array to compare.
- /// @param rhs Second byte array to compare.
- /// @return True if arrays are the same. False otherwise.
- function publicEquals(bytes memory lhs, bytes memory rhs)
- public
- pure
- returns (bool equal)
- {
- equal = lhs.equals(rhs);
- return equal;
- }
-
- function publicEqualsPop1(bytes memory lhs, bytes memory rhs)
- public
- pure
- returns (bool equal)
- {
- lhs.popLastByte();
- rhs.popLastByte();
- equal = lhs.equals(rhs);
- return equal;
- }
-
- /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.
- /// @param dest Byte array that will be overwritten with source bytes.
- /// @param source Byte array to copy onto dest bytes.
- function publicDeepCopyBytes(
- bytes memory dest,
- bytes memory source
- )
- public
- pure
- returns (bytes memory)
- {
- LibBytes.deepCopyBytes(dest, source);
- return dest;
- }
-
- /// @dev Reads an address from a position in a byte array.
- /// @param b Byte array containing an address.
- /// @param index Index in byte array of address.
- /// @return address from byte array.
- function publicReadAddress(
- bytes memory b,
- uint256 index
- )
- public
- pure
- returns (address result)
- {
- result = b.readAddress(index);
- return result;
- }
-
- /// @dev Writes an address into a specific position in a byte array.
- /// @param b Byte array to insert address into.
- /// @param index Index in byte array of address.
- /// @param input Address to put into byte array.
- function publicWriteAddress(
- bytes memory b,
- uint256 index,
- address input
- )
- public
- pure
- returns (bytes memory)
- {
- b.writeAddress(index, input);
- return b;
- }
-
- /// @dev Reads a bytes32 value from a position in a byte array.
- /// @param b Byte array containing a bytes32 value.
- /// @param index Index in byte array of bytes32 value.
- /// @return bytes32 value from byte array.
- function publicReadBytes32(
- bytes memory b,
- uint256 index
- )
- public
- pure
- returns (bytes32 result)
- {
- result = b.readBytes32(index);
- return result;
- }
-
- /// @dev Writes a bytes32 into a specific position in a byte array.
- /// @param b Byte array to insert <input> into.
- /// @param index Index in byte array of <input>.
- /// @param input bytes32 to put into byte array.
- function publicWriteBytes32(
- bytes memory b,
- uint256 index,
- bytes32 input
- )
- public
- pure
- returns (bytes memory)
- {
- b.writeBytes32(index, input);
- return b;
- }
-
- /// @dev Reads a uint256 value from a position in a byte array.
- /// @param b Byte array containing a uint256 value.
- /// @param index Index in byte array of uint256 value.
- /// @return uint256 value from byte array.
- function publicReadUint256(
- bytes memory b,
- uint256 index
- )
- public
- pure
- returns (uint256 result)
- {
- result = b.readUint256(index);
- return result;
- }
-
- /// @dev Writes a uint256 into a specific position in a byte array.
- /// @param b Byte array to insert <input> into.
- /// @param index Index in byte array of <input>.
- /// @param input uint256 to put into byte array.
- function publicWriteUint256(
- bytes memory b,
- uint256 index,
- uint256 input
- )
- public
- pure
- returns (bytes memory)
- {
- b.writeUint256(index, input);
- return b;
- }
-
- /// @dev Reads an unpadded bytes4 value from a position in a byte array.
- /// @param b Byte array containing a bytes4 value.
- /// @param index Index in byte array of bytes4 value.
- /// @return bytes4 value from byte array.
- function publicReadBytes4(
- bytes memory b,
- uint256 index
- )
- public
- pure
- returns (bytes4 result)
- {
- result = b.readBytes4(index);
- return result;
- }
-
- /// @dev Reads nested bytes from a specific position.
- /// @param b Byte array containing nested bytes.
- /// @param index Index of nested bytes.
- /// @return result Nested bytes.
- function publicReadBytesWithLength(
- bytes memory b,
- uint256 index
- )
- public
- pure
- returns (bytes memory result)
- {
- result = b.readBytesWithLength(index);
- return result;
- }
-
- /// @dev Inserts bytes at a specific position in a byte array.
- /// @param b Byte array to insert <input> into.
- /// @param index Index in byte array of <input>.
- /// @param input bytes to insert.
- /// @return b Updated input byte array
- function publicWriteBytesWithLength(
- bytes memory b,
- uint256 index,
- bytes memory input
- )
- public
- pure
- returns (bytes memory)
- {
- b.writeBytesWithLength(index, input);
- return b;
- }
-
- /// @dev Copies a block of memory from one location to another.
- /// @param mem Memory contents we want to apply memCopy to
- /// @param dest Destination offset into <mem>.
- /// @param source Source offset into <mem>.
- /// @param length Length of bytes to copy from <source> to <dest>
- /// @return mem Memory contents after calling memCopy.
- function testMemcpy(
- bytes mem,
- uint256 dest,
- uint256 source,
- uint256 length
- )
- public // not external, we need input in memory
- pure
- returns (bytes)
- {
- // Sanity check. Overflows are not checked.
- require(source + length <= mem.length);
- require(dest + length <= mem.length);
-
- // Get pointer to memory contents
- uint256 offset = mem.contentAddress();
-
- // Execute memCopy adjusted for memory array location
- LibBytes.memCopy(offset + dest, offset + source, length);
-
- // Return modified memory contents
- return mem;
- }
-}
diff --git a/packages/contracts/contracts/test/TestLibs/TestLibs.sol b/packages/contracts/contracts/test/TestLibs/TestLibs.sol
deleted file mode 100644
index a10f981fc..000000000
--- a/packages/contracts/contracts/test/TestLibs/TestLibs.sol
+++ /dev/null
@@ -1,152 +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.24;
-pragma experimental ABIEncoderV2;
-
-import "../../protocol/Exchange/libs/LibMath.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-import "../../protocol/Exchange/libs/LibFillResults.sol";
-import "../../protocol/Exchange/libs/LibAbiEncoder.sol";
-
-
-contract TestLibs is
- LibMath,
- LibOrder,
- LibFillResults,
- LibAbiEncoder
-{
- function publicAbiEncodeFillOrder(
- Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- public
- pure
- returns (bytes memory fillOrderCalldata)
- {
- fillOrderCalldata = abiEncodeFillOrder(
- order,
- takerAssetFillAmount,
- signature
- );
- return fillOrderCalldata;
- }
-
- function publicGetPartialAmountFloor(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (uint256 partialAmount)
- {
- partialAmount = getPartialAmountFloor(
- numerator,
- denominator,
- target
- );
- return partialAmount;
- }
-
- function publicGetPartialAmountCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (uint256 partialAmount)
- {
- partialAmount = getPartialAmountCeil(
- numerator,
- denominator,
- target
- );
- return partialAmount;
- }
-
- function publicIsRoundingErrorFloor(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (bool isError)
- {
- isError = isRoundingErrorFloor(
- numerator,
- denominator,
- target
- );
- return isError;
- }
-
- function publicIsRoundingErrorCeil(
- uint256 numerator,
- uint256 denominator,
- uint256 target
- )
- public
- pure
- returns (bool isError)
- {
- isError = isRoundingErrorCeil(
- numerator,
- denominator,
- target
- );
- return isError;
- }
-
- function publicGetOrderHash(Order memory order)
- public
- view
- returns (bytes32 orderHash)
- {
- orderHash = getOrderHash(order);
- return orderHash;
- }
-
- function getOrderSchemaHash()
- public
- pure
- returns (bytes32)
- {
- return EIP712_ORDER_SCHEMA_HASH;
- }
-
- function getDomainSeparatorSchemaHash()
- public
- pure
- returns (bytes32)
- {
- return EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH;
- }
-
- function publicAddFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)
- public
- pure
- returns (FillResults memory)
- {
- addFillResults(totalFillResults, singleFillResults);
- return totalFillResults;
- }
-}
diff --git a/packages/contracts/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol b/packages/contracts/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
deleted file mode 100644
index 41aab01c8..000000000
--- a/packages/contracts/contracts/test/TestStaticCallReceiver/TestStaticCallReceiver.sol
+++ /dev/null
@@ -1,81 +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.24;
-
-import "../../tokens/ERC20Token/IERC20Token.sol";
-
-
-// solhint-disable no-unused-vars
-contract TestStaticCallReceiver {
-
- uint256 internal state = 1;
-
- /// @dev Updates state and returns true. Intended to be used with `Validator` signature type.
- /// @param hash Message hash that is signed.
- /// @param signerAddress Address that should have signed the given hash.
- /// @param signature Proof of signing.
- /// @return Validity of order signature.
- function isValidSignature(
- bytes32 hash,
- address signerAddress,
- bytes signature
- )
- external
- returns (bool isValid)
- {
- updateState();
- return true;
- }
-
- /// @dev Updates state and returns true. Intended to be used with `Wallet` signature type.
- /// @param hash Message hash that is signed.
- /// @param signature Proof of signing.
- /// @return Validity of order signature.
- function isValidSignature(
- bytes32 hash,
- bytes signature
- )
- external
- returns (bool isValid)
- {
- updateState();
- return true;
- }
-
- /// @dev Approves an ERC20 token to spend tokens from this address.
- /// @param token Address of ERC20 token.
- /// @param spender Address that will spend tokens.
- /// @param value Amount of tokens spender is approved to spend.
- function approveERC20(
- address token,
- address spender,
- uint256 value
- )
- external
- {
- IERC20Token(token).approve(spender, value);
- }
-
- /// @dev Increments state variable.
- function updateState()
- internal
- {
- state++;
- }
-}
diff --git a/packages/contracts/contracts/tokens/ERC20Token/ERC20Token.sol b/packages/contracts/contracts/tokens/ERC20Token/ERC20Token.sol
deleted file mode 100644
index 725d304df..000000000
--- a/packages/contracts/contracts/tokens/ERC20Token/ERC20Token.sol
+++ /dev/null
@@ -1,148 +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.24;
-
-import "./IERC20Token.sol";
-
-
-contract ERC20Token is
- IERC20Token
-{
- mapping (address => uint256) internal balances;
- mapping (address => mapping (address => uint256)) internal allowed;
-
- uint256 internal _totalSupply;
-
- /// @dev send `value` token to `to` from `msg.sender`
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- /// @return True if transfer was successful
- function transfer(address _to, uint256 _value)
- external
- returns (bool)
- {
- require(
- balances[msg.sender] >= _value,
- "ERC20_INSUFFICIENT_BALANCE"
- );
- require(
- balances[_to] + _value >= balances[_to],
- "UINT256_OVERFLOW"
- );
-
- balances[msg.sender] -= _value;
- balances[_to] += _value;
-
- emit Transfer(
- msg.sender,
- _to,
- _value
- );
-
- return true;
- }
-
- /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`
- /// @param _from The address of the sender
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- /// @return True if transfer was successful
- function transferFrom(
- address _from,
- address _to,
- uint256 _value
- )
- external
- returns (bool)
- {
- require(
- balances[_from] >= _value,
- "ERC20_INSUFFICIENT_BALANCE"
- );
- require(
- allowed[_from][msg.sender] >= _value,
- "ERC20_INSUFFICIENT_ALLOWANCE"
- );
- require(
- balances[_to] + _value >= balances[_to],
- "UINT256_OVERFLOW"
- );
-
- balances[_to] += _value;
- balances[_from] -= _value;
- allowed[_from][msg.sender] -= _value;
-
- emit Transfer(
- _from,
- _to,
- _value
- );
-
- return true;
- }
-
- /// @dev `msg.sender` approves `_spender` to spend `_value` tokens
- /// @param _spender The address of the account able to transfer the tokens
- /// @param _value The amount of wei to be approved for transfer
- /// @return Always true if the call has enough gas to complete execution
- function approve(address _spender, uint256 _value)
- external
- returns (bool)
- {
- allowed[msg.sender][_spender] = _value;
- emit Approval(
- msg.sender,
- _spender,
- _value
- );
- return true;
- }
-
- /// @dev Query total supply of token
- /// @return Total supply of token
- function totalSupply()
- external
- view
- returns (uint256)
- {
- return _totalSupply;
- }
-
- /// @dev Query the balance of owner
- /// @param _owner The address from which the balance will be retrieved
- /// @return Balance of owner
- function balanceOf(address _owner)
- external
- view
- returns (uint256)
- {
- return balances[_owner];
- }
-
- /// @param _owner The address of the account owning tokens
- /// @param _spender The address of the account able to transfer the tokens
- /// @return Amount of remaining tokens allowed to spent
- function allowance(address _owner, address _spender)
- external
- view
- returns (uint256)
- {
- return allowed[_owner][_spender];
- }
-}
diff --git a/packages/contracts/contracts/tokens/ERC20Token/IERC20Token.sol b/packages/contracts/contracts/tokens/ERC20Token/IERC20Token.sol
deleted file mode 100644
index 258d47393..000000000
--- a/packages/contracts/contracts/tokens/ERC20Token/IERC20Token.sol
+++ /dev/null
@@ -1,87 +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.24;
-
-
-contract IERC20Token {
-
- // solhint-disable no-simple-event-func-name
- event Transfer(
- address indexed _from,
- address indexed _to,
- uint256 _value
- );
-
- event Approval(
- address indexed _owner,
- address indexed _spender,
- uint256 _value
- );
-
- /// @dev send `value` token to `to` from `msg.sender`
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- /// @return True if transfer was successful
- function transfer(address _to, uint256 _value)
- external
- returns (bool);
-
- /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`
- /// @param _from The address of the sender
- /// @param _to The address of the recipient
- /// @param _value The amount of token to be transferred
- /// @return True if transfer was successful
- function transferFrom(
- address _from,
- address _to,
- uint256 _value
- )
- external
- returns (bool);
-
- /// @dev `msg.sender` approves `_spender` to spend `_value` tokens
- /// @param _spender The address of the account able to transfer the tokens
- /// @param _value The amount of wei to be approved for transfer
- /// @return Always true if the call has enough gas to complete execution
- function approve(address _spender, uint256 _value)
- external
- returns (bool);
-
- /// @dev Query total supply of token
- /// @return Total supply of token
- function totalSupply()
- external
- view
- returns (uint256);
-
- /// @param _owner The address from which the balance will be retrieved
- /// @return Balance of owner
- function balanceOf(address _owner)
- external
- view
- returns (uint256);
-
- /// @param _owner The address of the account owning tokens
- /// @param _spender The address of the account able to transfer the tokens
- /// @return Amount of remaining tokens allowed to spent
- function allowance(address _owner, address _spender)
- external
- view
- returns (uint256);
-}
diff --git a/packages/contracts/contracts/tokens/ERC20Token/MintableERC20Token.sol b/packages/contracts/contracts/tokens/ERC20Token/MintableERC20Token.sol
deleted file mode 100644
index 9dc924422..000000000
--- a/packages/contracts/contracts/tokens/ERC20Token/MintableERC20Token.sol
+++ /dev/null
@@ -1,60 +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.24;
-
-import "../../utils/SafeMath/SafeMath.sol";
-import "./UnlimitedAllowanceERC20Token.sol";
-
-
-contract MintableERC20Token is
- SafeMath,
- UnlimitedAllowanceERC20Token
-{
- /// @dev Mints new tokens
- /// @param _to Address of the beneficiary that will own the minted token
- /// @param _value Amount of tokens to mint
- function _mint(address _to, uint256 _value)
- internal
- {
- balances[_to] = safeAdd(_value, balances[_to]);
- _totalSupply = safeAdd(_totalSupply, _value);
-
- emit Transfer(
- address(0),
- _to,
- _value
- );
- }
-
- /// @dev Mints new tokens
- /// @param _owner Owner of tokens that will be burned
- /// @param _value Amount of tokens to burn
- function _burn(address _owner, uint256 _value)
- internal
- {
- balances[_owner] = safeSub(balances[_owner], _value);
- _totalSupply = safeSub(_totalSupply, _value);
-
- emit Transfer(
- _owner,
- address(0),
- _value
- );
- }
-}
diff --git a/packages/contracts/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol b/packages/contracts/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
deleted file mode 100644
index 2e5bd4348..000000000
--- a/packages/contracts/contracts/tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol
+++ /dev/null
@@ -1,70 +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.24;
-
-import "../ERC20Token/ERC20Token.sol";
-
-
-contract UnlimitedAllowanceERC20Token is
- ERC20Token
-{
- uint256 constant internal MAX_UINT = 2**256 - 1;
-
- /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717
- /// @param _from Address to transfer from.
- /// @param _to Address to transfer to.
- /// @param _value Amount to transfer.
- /// @return Success of transfer.
- function transferFrom(
- address _from,
- address _to,
- uint256 _value
- )
- external
- returns (bool)
- {
- uint256 allowance = allowed[_from][msg.sender];
- require(
- balances[_from] >= _value,
- "ERC20_INSUFFICIENT_BALANCE"
- );
- require(
- allowance >= _value,
- "ERC20_INSUFFICIENT_ALLOWANCE"
- );
- require(
- balances[_to] + _value >= balances[_to],
- "UINT256_OVERFLOW"
- );
-
- balances[_to] += _value;
- balances[_from] -= _value;
- if (allowance < MAX_UINT) {
- allowed[_from][msg.sender] -= _value;
- }
-
- emit Transfer(
- _from,
- _to,
- _value
- );
-
- return true;
- }
-}
diff --git a/packages/contracts/contracts/tokens/ERC721Token/ERC721Token.sol b/packages/contracts/contracts/tokens/ERC721Token/ERC721Token.sol
deleted file mode 100644
index 530f080c0..000000000
--- a/packages/contracts/contracts/tokens/ERC721Token/ERC721Token.sol
+++ /dev/null
@@ -1,277 +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.24;
-
-import "./IERC721Token.sol";
-import "./IERC721Receiver.sol";
-import "../../utils/SafeMath/SafeMath.sol";
-
-
-contract ERC721Token is
- IERC721Token,
- SafeMath
-{
- // Function selector for ERC721Receiver.onERC721Received
- // 0x150b7a02
- bytes4 constant internal ERC721_RECEIVED = bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"));
-
- // Mapping of tokenId => owner
- mapping (uint256 => address) internal owners;
-
- // Mapping of tokenId => approved address
- mapping (uint256 => address) internal approvals;
-
- // Mapping of owner => number of tokens owned
- mapping (address => uint256) internal balances;
-
- // Mapping of owner => operator => approved
- mapping (address => mapping (address => bool)) internal operatorApprovals;
-
- /// @notice Transfers the ownership of an NFT from one address to another address
- /// @dev Throws unless `msg.sender` is the current owner, an authorized
- /// operator, or the approved address for this NFT. Throws if `_from` is
- /// not the current owner. Throws if `_to` is the zero address. Throws if
- /// `_tokenId` is not a valid NFT. When transfer is complete, this function
- /// checks if `_to` is a smart contract (code size > 0). If so, it calls
- /// `onERC721Received` on `_to` and throws if the return value is not
- /// `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
- /// @param _from The current owner of the NFT
- /// @param _to The new owner
- /// @param _tokenId The NFT to transfer
- /// @param _data Additional data with no specified format, sent in call to `_to`
- function safeTransferFrom(
- address _from,
- address _to,
- uint256 _tokenId,
- bytes _data
- )
- external
- {
- transferFrom(
- _from,
- _to,
- _tokenId
- );
-
- uint256 receiverCodeSize;
- assembly {
- receiverCodeSize := extcodesize(_to)
- }
- if (receiverCodeSize > 0) {
- bytes4 selector = IERC721Receiver(_to).onERC721Received(
- msg.sender,
- _from,
- _tokenId,
- _data
- );
- require(
- selector == ERC721_RECEIVED,
- "ERC721_INVALID_SELECTOR"
- );
- }
- }
-
- /// @notice Transfers the ownership of an NFT from one address to another address
- /// @dev This works identically to the other function with an extra data parameter,
- /// except this function just sets data to "".
- /// @param _from The current owner of the NFT
- /// @param _to The new owner
- /// @param _tokenId The NFT to transfer
- function safeTransferFrom(
- address _from,
- address _to,
- uint256 _tokenId
- )
- external
- {
- transferFrom(
- _from,
- _to,
- _tokenId
- );
-
- uint256 receiverCodeSize;
- assembly {
- receiverCodeSize := extcodesize(_to)
- }
- if (receiverCodeSize > 0) {
- bytes4 selector = IERC721Receiver(_to).onERC721Received(
- msg.sender,
- _from,
- _tokenId,
- ""
- );
- require(
- selector == ERC721_RECEIVED,
- "ERC721_INVALID_SELECTOR"
- );
- }
- }
-
- /// @notice Change or reaffirm the approved address for an NFT
- /// @dev The zero address indicates there is no approved address.
- /// Throws unless `msg.sender` is the current NFT owner, or an authorized
- /// operator of the current owner.
- /// @param _approved The new approved NFT controller
- /// @param _tokenId The NFT to approve
- function approve(address _approved, uint256 _tokenId)
- external
- {
- address owner = ownerOf(_tokenId);
- require(
- msg.sender == owner || isApprovedForAll(owner, msg.sender),
- "ERC721_INVALID_SENDER"
- );
-
- approvals[_tokenId] = _approved;
- emit Approval(
- owner,
- _approved,
- _tokenId
- );
- }
-
- /// @notice Enable or disable approval for a third party ("operator") to manage
- /// all of `msg.sender`'s assets
- /// @dev Emits the ApprovalForAll event. The contract MUST allow
- /// multiple operators per owner.
- /// @param _operator Address to add to the set of authorized operators
- /// @param _approved True if the operator is approved, false to revoke approval
- function setApprovalForAll(address _operator, bool _approved)
- external
- {
- operatorApprovals[msg.sender][_operator] = _approved;
- emit ApprovalForAll(
- msg.sender,
- _operator,
- _approved
- );
- }
-
- /// @notice Count all NFTs assigned to an owner
- /// @dev NFTs assigned to the zero address are considered invalid, and this
- /// function throws for queries about the zero address.
- /// @param _owner An address for whom to query the balance
- /// @return The number of NFTs owned by `_owner`, possibly zero
- function balanceOf(address _owner)
- external
- view
- returns (uint256)
- {
- require(
- _owner != address(0),
- "ERC721_ZERO_OWNER"
- );
- return balances[_owner];
- }
-
- /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
- /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
- /// THEY MAY BE PERMANENTLY LOST
- /// @dev Throws unless `msg.sender` is the current owner, an authorized
- /// operator, or the approved address for this NFT. Throws if `_from` is
- /// not the current owner. Throws if `_to` is the zero address. Throws if
- /// `_tokenId` is not a valid NFT.
- /// @param _from The current owner of the NFT
- /// @param _to The new owner
- /// @param _tokenId The NFT to transfer
- function transferFrom(
- address _from,
- address _to,
- uint256 _tokenId
- )
- public
- {
- require(
- _to != address(0),
- "ERC721_ZERO_TO_ADDRESS"
- );
-
- address owner = ownerOf(_tokenId);
- require(
- _from == owner,
- "ERC721_OWNER_MISMATCH"
- );
-
- address spender = msg.sender;
- address approvedAddress = getApproved(_tokenId);
- require(
- spender == owner ||
- isApprovedForAll(owner, spender) ||
- approvedAddress == spender,
- "ERC721_INVALID_SPENDER"
- );
-
- if (approvedAddress != address(0)) {
- approvals[_tokenId] = address(0);
- }
-
- owners[_tokenId] = _to;
- balances[_from] = safeSub(balances[_from], 1);
- balances[_to] = safeAdd(balances[_to], 1);
-
- emit Transfer(
- _from,
- _to,
- _tokenId
- );
- }
-
- /// @notice Find the owner of an NFT
- /// @dev NFTs assigned to zero address are considered invalid, and queries
- /// about them do throw.
- /// @param _tokenId The identifier for an NFT
- /// @return The address of the owner of the NFT
- function ownerOf(uint256 _tokenId)
- public
- view
- returns (address)
- {
- address owner = owners[_tokenId];
- require(
- owner != address(0),
- "ERC721_ZERO_OWNER"
- );
- return owner;
- }
-
- /// @notice Get the approved address for a single NFT
- /// @dev Throws if `_tokenId` is not a valid NFT.
- /// @param _tokenId The NFT to find the approved address for
- /// @return The approved address for this NFT, or the zero address if there is none
- function getApproved(uint256 _tokenId)
- public
- view
- returns (address)
- {
- return approvals[_tokenId];
- }
-
- /// @notice Query if an address is an authorized operator for another address
- /// @param _owner The address that owns the NFTs
- /// @param _operator The address that acts on behalf of the owner
- /// @return True if `_operator` is an approved operator for `_owner`, false otherwise
- function isApprovedForAll(address _owner, address _operator)
- public
- view
- returns (bool)
- {
- return operatorApprovals[_owner][_operator];
- }
-}
diff --git a/packages/contracts/contracts/tokens/ERC721Token/IERC721Receiver.sol b/packages/contracts/contracts/tokens/ERC721Token/IERC721Receiver.sol
deleted file mode 100644
index 8e0e32ab2..000000000
--- a/packages/contracts/contracts/tokens/ERC721Token/IERC721Receiver.sol
+++ /dev/null
@@ -1,44 +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.24;
-
-
-contract IERC721Receiver {
-
- /// @notice Handle the receipt of an NFT
- /// @dev The ERC721 smart contract calls this function on the recipient
- /// after a `transfer`. This function MAY throw to revert and reject the
- /// transfer. Return of other than the magic value MUST result in the
- /// transaction being reverted.
- /// Note: the contract address is always the message sender.
- /// @param _operator The address which called `safeTransferFrom` function
- /// @param _from The address which previously owned the token
- /// @param _tokenId The NFT identifier which is being transferred
- /// @param _data Additional data with no specified format
- /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
- /// unless throwing
- function onERC721Received(
- address _operator,
- address _from,
- uint256 _tokenId,
- bytes _data
- )
- external
- returns (bytes4);
-}
diff --git a/packages/contracts/contracts/tokens/ERC721Token/IERC721Token.sol b/packages/contracts/contracts/tokens/ERC721Token/IERC721Token.sol
deleted file mode 100644
index ac992c80d..000000000
--- a/packages/contracts/contracts/tokens/ERC721Token/IERC721Token.sol
+++ /dev/null
@@ -1,158 +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.24;
-
-
-contract IERC721Token {
-
- /// @dev This emits when ownership of any NFT changes by any mechanism.
- /// This event emits when NFTs are created (`from` == 0) and destroyed
- /// (`to` == 0). Exception: during contract creation, any number of NFTs
- /// may be created and assigned without emitting Transfer. At the time of
- /// any transfer, the approved address for that NFT (if any) is reset to none.
- event Transfer(
- address indexed _from,
- address indexed _to,
- uint256 indexed _tokenId
- );
-
- /// @dev This emits when the approved address for an NFT is changed or
- /// reaffirmed. The zero address indicates there is no approved address.
- /// When a Transfer event emits, this also indicates that the approved
- /// address for that NFT (if any) is reset to none.
- event Approval(
- address indexed _owner,
- address indexed _approved,
- uint256 indexed _tokenId
- );
-
- /// @dev This emits when an operator is enabled or disabled for an owner.
- /// The operator can manage all NFTs of the owner.
- event ApprovalForAll(
- address indexed _owner,
- address indexed _operator,
- bool _approved
- );
-
- /// @notice Transfers the ownership of an NFT from one address to another address
- /// @dev Throws unless `msg.sender` is the current owner, an authorized
- /// perator, or the approved address for this NFT. Throws if `_from` is
- /// not the current owner. Throws if `_to` is the zero address. Throws if
- /// `_tokenId` is not a valid NFT. When transfer is complete, this function
- /// checks if `_to` is a smart contract (code size > 0). If so, it calls
- /// `onERC721Received` on `_to` and throws if the return value is not
- /// `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
- /// @param _from The current owner of the NFT
- /// @param _to The new owner
- /// @param _tokenId The NFT to transfer
- /// @param _data Additional data with no specified format, sent in call to `_to`
- function safeTransferFrom(
- address _from,
- address _to,
- uint256 _tokenId,
- bytes _data
- )
- external;
-
- /// @notice Transfers the ownership of an NFT from one address to another address
- /// @dev This works identically to the other function with an extra data parameter,
- /// except this function just sets data to "".
- /// @param _from The current owner of the NFT
- /// @param _to The new owner
- /// @param _tokenId The NFT to transfer
- function safeTransferFrom(
- address _from,
- address _to,
- uint256 _tokenId
- )
- external;
-
- /// @notice Change or reaffirm the approved address for an NFT
- /// @dev The zero address indicates there is no approved address.
- /// Throws unless `msg.sender` is the current NFT owner, or an authorized
- /// operator of the current owner.
- /// @param _approved The new approved NFT controller
- /// @param _tokenId The NFT to approve
- function approve(address _approved, uint256 _tokenId)
- external;
-
- /// @notice Enable or disable approval for a third party ("operator") to manage
- /// all of `msg.sender`'s assets
- /// @dev Emits the ApprovalForAll event. The contract MUST allow
- /// multiple operators per owner.
- /// @param _operator Address to add to the set of authorized operators
- /// @param _approved True if the operator is approved, false to revoke approval
- function setApprovalForAll(address _operator, bool _approved)
- external;
-
- /// @notice Count all NFTs assigned to an owner
- /// @dev NFTs assigned to the zero address are considered invalid, and this
- /// function throws for queries about the zero address.
- /// @param _owner An address for whom to query the balance
- /// @return The number of NFTs owned by `_owner`, possibly zero
- function balanceOf(address _owner)
- external
- view
- returns (uint256);
-
- /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
- /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
- /// THEY MAY BE PERMANENTLY LOST
- /// @dev Throws unless `msg.sender` is the current owner, an authorized
- /// operator, or the approved address for this NFT. Throws if `_from` is
- /// not the current owner. Throws if `_to` is the zero address. Throws if
- /// `_tokenId` is not a valid NFT.
- /// @param _from The current owner of the NFT
- /// @param _to The new owner
- /// @param _tokenId The NFT to transfer
- function transferFrom(
- address _from,
- address _to,
- uint256 _tokenId
- )
- public;
-
- /// @notice Find the owner of an NFT
- /// @dev NFTs assigned to zero address are considered invalid, and queries
- /// about them do throw.
- /// @param _tokenId The identifier for an NFT
- /// @return The address of the owner of the NFT
- function ownerOf(uint256 _tokenId)
- public
- view
- returns (address);
-
- /// @notice Get the approved address for a single NFT
- /// @dev Throws if `_tokenId` is not a valid NFT.
- /// @param _tokenId The NFT to find the approved address for
- /// @return The approved address for this NFT, or the zero address if there is none
- function getApproved(uint256 _tokenId)
- public
- view
- returns (address);
-
- /// @notice Query if an address is an authorized operator for another address
- /// @param _owner The address that owns the NFTs
- /// @param _operator The address that acts on behalf of the owner
- /// @return True if `_operator` is an approved operator for `_owner`, false otherwise
- function isApprovedForAll(address _owner, address _operator)
- public
- view
- returns (bool);
-}
diff --git a/packages/contracts/contracts/tokens/ERC721Token/MintableERC721Token.sol b/packages/contracts/contracts/tokens/ERC721Token/MintableERC721Token.sol
deleted file mode 100644
index bc5cd2cc2..000000000
--- a/packages/contracts/contracts/tokens/ERC721Token/MintableERC721Token.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.24;
-
-import "./ERC721Token.sol";
-
-
-contract MintableERC721Token is
- ERC721Token
-{
- /// @dev Function to mint a new token
- /// Reverts if the given token ID already exists
- /// @param _to Address of the beneficiary that will own the minted token
- /// @param _tokenId ID of the token to be minted by the msg.sender
- function _mint(address _to, uint256 _tokenId)
- internal
- {
- require(
- _to != address(0),
- "ERC721_ZERO_TO_ADDRESS"
- );
-
- address owner = owners[_tokenId];
- require(
- owner == address(0),
- "ERC721_OWNER_ALREADY_EXISTS"
- );
-
- owners[_tokenId] = _to;
- balances[_to] = safeAdd(balances[_to], 1);
-
- emit Transfer(
- address(0),
- _to,
- _tokenId
- );
- }
-
- /// @dev Function to burn a token
- /// Reverts if the given token ID doesn't exist
- /// @param _owner Owner of token with given token ID
- /// @param _tokenId ID of the token to be burned by the msg.sender
- function _burn(address _owner, uint256 _tokenId)
- internal
- {
- require(
- _owner != address(0),
- "ERC721_ZERO_OWNER_ADDRESS"
- );
-
- address owner = owners[_tokenId];
- require(
- owner == _owner,
- "ERC721_OWNER_MISMATCH"
- );
-
- owners[_tokenId] = address(0);
- balances[_owner] = safeSub(balances[_owner], 1);
-
- emit Transfer(
- _owner,
- address(0),
- _tokenId
- );
- }
-}
diff --git a/packages/contracts/contracts/tokens/EtherToken/IEtherToken.sol b/packages/contracts/contracts/tokens/EtherToken/IEtherToken.sol
deleted file mode 100644
index 9e2e68766..000000000
--- a/packages/contracts/contracts/tokens/EtherToken/IEtherToken.sol
+++ /dev/null
@@ -1,33 +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.24;
-
-import "../ERC20Token/IERC20Token.sol";
-
-
-contract IEtherToken is
- IERC20Token
-{
- function deposit()
- public
- payable;
-
- function withdraw(uint256 amount)
- public;
-}
diff --git a/packages/contracts/contracts/utils/LibBytes/LibBytes.sol b/packages/contracts/contracts/utils/LibBytes/LibBytes.sol
deleted file mode 100644
index 369f588ad..000000000
--- a/packages/contracts/contracts/utils/LibBytes/LibBytes.sol
+++ /dev/null
@@ -1,567 +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.24;
-
-
-library LibBytes {
-
- using LibBytes for bytes;
-
- /// @dev Gets the memory address for a byte array.
- /// @param input Byte array to lookup.
- /// @return memoryAddress Memory address of byte array. This
- /// points to the header of the byte array which contains
- /// the length.
- function rawAddress(bytes memory input)
- internal
- pure
- returns (uint256 memoryAddress)
- {
- assembly {
- memoryAddress := input
- }
- return memoryAddress;
- }
-
- /// @dev Gets the memory address for the contents of a byte array.
- /// @param input Byte array to lookup.
- /// @return memoryAddress Memory address of the contents of the byte array.
- function contentAddress(bytes memory input)
- internal
- pure
- returns (uint256 memoryAddress)
- {
- assembly {
- memoryAddress := add(input, 32)
- }
- return memoryAddress;
- }
-
- /// @dev Copies `length` bytes from memory location `source` to `dest`.
- /// @param dest memory address to copy bytes to.
- /// @param source memory address to copy bytes from.
- /// @param length number of bytes to copy.
- function memCopy(
- uint256 dest,
- uint256 source,
- uint256 length
- )
- internal
- pure
- {
- if (length < 32) {
- // Handle a partial word by reading destination and masking
- // off the bits we are interested in.
- // This correctly handles overlap, zero lengths and source == dest
- assembly {
- let mask := sub(exp(256, sub(32, length)), 1)
- let s := and(mload(source), not(mask))
- let d := and(mload(dest), mask)
- mstore(dest, or(s, d))
- }
- } else {
- // Skip the O(length) loop when source == dest.
- if (source == dest) {
- return;
- }
-
- // For large copies we copy whole words at a time. The final
- // word is aligned to the end of the range (instead of after the
- // previous) to handle partial words. So a copy will look like this:
- //
- // ####
- // ####
- // ####
- // ####
- //
- // We handle overlap in the source and destination range by
- // changing the copying direction. This prevents us from
- // overwriting parts of source that we still need to copy.
- //
- // This correctly handles source == dest
- //
- if (source > dest) {
- assembly {
- // We subtract 32 from `sEnd` and `dEnd` because it
- // is easier to compare with in the loop, and these
- // are also the addresses we need for copying the
- // last bytes.
- length := sub(length, 32)
- let sEnd := add(source, length)
- let dEnd := add(dest, length)
-
- // Remember the last 32 bytes of source
- // This needs to be done here and not after the loop
- // because we may have overwritten the last bytes in
- // source already due to overlap.
- let last := mload(sEnd)
-
- // Copy whole words front to back
- // Note: the first check is always true,
- // this could have been a do-while loop.
- // solhint-disable-next-line no-empty-blocks
- for {} lt(source, sEnd) {} {
- mstore(dest, mload(source))
- source := add(source, 32)
- dest := add(dest, 32)
- }
-
- // Write the last 32 bytes
- mstore(dEnd, last)
- }
- } else {
- assembly {
- // We subtract 32 from `sEnd` and `dEnd` because those
- // are the starting points when copying a word at the end.
- length := sub(length, 32)
- let sEnd := add(source, length)
- let dEnd := add(dest, length)
-
- // Remember the first 32 bytes of source
- // This needs to be done here and not after the loop
- // because we may have overwritten the first bytes in
- // source already due to overlap.
- let first := mload(source)
-
- // Copy whole words back to front
- // We use a signed comparisson here to allow dEnd to become
- // negative (happens when source and dest < 32). Valid
- // addresses in local memory will never be larger than
- // 2**255, so they can be safely re-interpreted as signed.
- // Note: the first check is always true,
- // this could have been a do-while loop.
- // solhint-disable-next-line no-empty-blocks
- for {} slt(dest, dEnd) {} {
- mstore(dEnd, mload(sEnd))
- sEnd := sub(sEnd, 32)
- dEnd := sub(dEnd, 32)
- }
-
- // Write the first 32 bytes
- mstore(dest, first)
- }
- }
- }
- }
-
- /// @dev Returns a slices from a byte array.
- /// @param b The byte array to take a slice from.
- /// @param from The starting index for the slice (inclusive).
- /// @param to The final index for the slice (exclusive).
- /// @return result The slice containing bytes at indices [from, to)
- function slice(
- bytes memory b,
- uint256 from,
- uint256 to
- )
- internal
- pure
- returns (bytes memory result)
- {
- require(
- from <= to,
- "FROM_LESS_THAN_TO_REQUIRED"
- );
- require(
- to < b.length,
- "TO_LESS_THAN_LENGTH_REQUIRED"
- );
-
- // Create a new bytes structure and copy contents
- result = new bytes(to - from);
- memCopy(
- result.contentAddress(),
- b.contentAddress() + from,
- result.length
- );
- return result;
- }
-
- /// @dev Returns a slice from a byte array without preserving the input.
- /// @param b The byte array to take a slice from. Will be destroyed in the process.
- /// @param from The starting index for the slice (inclusive).
- /// @param to The final index for the slice (exclusive).
- /// @return result The slice containing bytes at indices [from, to)
- /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.
- function sliceDestructive(
- bytes memory b,
- uint256 from,
- uint256 to
- )
- internal
- pure
- returns (bytes memory result)
- {
- require(
- from <= to,
- "FROM_LESS_THAN_TO_REQUIRED"
- );
- require(
- to < b.length,
- "TO_LESS_THAN_LENGTH_REQUIRED"
- );
-
- // Create a new bytes structure around [from, to) in-place.
- assembly {
- result := add(b, from)
- mstore(result, sub(to, from))
- }
- return result;
- }
-
- /// @dev Pops the last byte off of a byte array by modifying its length.
- /// @param b Byte array that will be modified.
- /// @return The byte that was popped off.
- function popLastByte(bytes memory b)
- internal
- pure
- returns (bytes1 result)
- {
- require(
- b.length > 0,
- "GREATER_THAN_ZERO_LENGTH_REQUIRED"
- );
-
- // Store last byte.
- result = b[b.length - 1];
-
- assembly {
- // Decrement length of byte array.
- let newLen := sub(mload(b), 1)
- mstore(b, newLen)
- }
- return result;
- }
-
- /// @dev Pops the last 20 bytes off of a byte array by modifying its length.
- /// @param b Byte array that will be modified.
- /// @return The 20 byte address that was popped off.
- function popLast20Bytes(bytes memory b)
- internal
- pure
- returns (address result)
- {
- require(
- b.length >= 20,
- "GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED"
- );
-
- // Store last 20 bytes.
- result = readAddress(b, b.length - 20);
-
- assembly {
- // Subtract 20 from byte array length.
- let newLen := sub(mload(b), 20)
- mstore(b, newLen)
- }
- return result;
- }
-
- /// @dev Tests equality of two byte arrays.
- /// @param lhs First byte array to compare.
- /// @param rhs Second byte array to compare.
- /// @return True if arrays are the same. False otherwise.
- function equals(
- bytes memory lhs,
- bytes memory rhs
- )
- internal
- pure
- returns (bool equal)
- {
- // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.
- // We early exit on unequal lengths, but keccak would also correctly
- // handle this.
- return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);
- }
-
- /// @dev Reads an address from a position in a byte array.
- /// @param b Byte array containing an address.
- /// @param index Index in byte array of address.
- /// @return address from byte array.
- function readAddress(
- bytes memory b,
- uint256 index
- )
- internal
- pure
- returns (address result)
- {
- require(
- b.length >= index + 20, // 20 is length of address
- "GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED"
- );
-
- // Add offset to index:
- // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)
- // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)
- index += 20;
-
- // Read address from array memory
- assembly {
- // 1. Add index to address of bytes array
- // 2. Load 32-byte word from memory
- // 3. Apply 20-byte mask to obtain address
- result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)
- }
- return result;
- }
-
- /// @dev Writes an address into a specific position in a byte array.
- /// @param b Byte array to insert address into.
- /// @param index Index in byte array of address.
- /// @param input Address to put into byte array.
- function writeAddress(
- bytes memory b,
- uint256 index,
- address input
- )
- internal
- pure
- {
- require(
- b.length >= index + 20, // 20 is length of address
- "GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED"
- );
-
- // Add offset to index:
- // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)
- // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)
- index += 20;
-
- // Store address into array memory
- assembly {
- // The address occupies 20 bytes and mstore stores 32 bytes.
- // First fetch the 32-byte word where we'll be storing the address, then
- // apply a mask so we have only the bytes in the word that the address will not occupy.
- // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.
-
- // 1. Add index to address of bytes array
- // 2. Load 32-byte word from memory
- // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address
- let neighbors := and(
- mload(add(b, index)),
- 0xffffffffffffffffffffffff0000000000000000000000000000000000000000
- )
-
- // Make sure input address is clean.
- // (Solidity does not guarantee this)
- input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)
-
- // Store the neighbors and address into memory
- mstore(add(b, index), xor(input, neighbors))
- }
- }
-
- /// @dev Reads a bytes32 value from a position in a byte array.
- /// @param b Byte array containing a bytes32 value.
- /// @param index Index in byte array of bytes32 value.
- /// @return bytes32 value from byte array.
- function readBytes32(
- bytes memory b,
- uint256 index
- )
- internal
- pure
- returns (bytes32 result)
- {
- require(
- b.length >= index + 32,
- "GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED"
- );
-
- // Arrays are prefixed by a 256 bit length parameter
- index += 32;
-
- // Read the bytes32 from array memory
- assembly {
- result := mload(add(b, index))
- }
- return result;
- }
-
- /// @dev Writes a bytes32 into a specific position in a byte array.
- /// @param b Byte array to insert <input> into.
- /// @param index Index in byte array of <input>.
- /// @param input bytes32 to put into byte array.
- function writeBytes32(
- bytes memory b,
- uint256 index,
- bytes32 input
- )
- internal
- pure
- {
- require(
- b.length >= index + 32,
- "GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED"
- );
-
- // Arrays are prefixed by a 256 bit length parameter
- index += 32;
-
- // Read the bytes32 from array memory
- assembly {
- mstore(add(b, index), input)
- }
- }
-
- /// @dev Reads a uint256 value from a position in a byte array.
- /// @param b Byte array containing a uint256 value.
- /// @param index Index in byte array of uint256 value.
- /// @return uint256 value from byte array.
- function readUint256(
- bytes memory b,
- uint256 index
- )
- internal
- pure
- returns (uint256 result)
- {
- result = uint256(readBytes32(b, index));
- return result;
- }
-
- /// @dev Writes a uint256 into a specific position in a byte array.
- /// @param b Byte array to insert <input> into.
- /// @param index Index in byte array of <input>.
- /// @param input uint256 to put into byte array.
- function writeUint256(
- bytes memory b,
- uint256 index,
- uint256 input
- )
- internal
- pure
- {
- writeBytes32(b, index, bytes32(input));
- }
-
- /// @dev Reads an unpadded bytes4 value from a position in a byte array.
- /// @param b Byte array containing a bytes4 value.
- /// @param index Index in byte array of bytes4 value.
- /// @return bytes4 value from byte array.
- function readBytes4(
- bytes memory b,
- uint256 index
- )
- internal
- pure
- returns (bytes4 result)
- {
- require(
- b.length >= index + 4,
- "GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED"
- );
-
- // Arrays are prefixed by a 32 byte length field
- index += 32;
-
- // Read the bytes4 from array memory
- assembly {
- result := mload(add(b, index))
- // Solidity does not require us to clean the trailing bytes.
- // We do it anyway
- result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)
- }
- return result;
- }
-
- /// @dev Reads nested bytes from a specific position.
- /// @dev NOTE: the returned value overlaps with the input value.
- /// Both should be treated as immutable.
- /// @param b Byte array containing nested bytes.
- /// @param index Index of nested bytes.
- /// @return result Nested bytes.
- function readBytesWithLength(
- bytes memory b,
- uint256 index
- )
- internal
- pure
- returns (bytes memory result)
- {
- // Read length of nested bytes
- uint256 nestedBytesLength = readUint256(b, index);
- index += 32;
-
- // Assert length of <b> is valid, given
- // length of nested bytes
- require(
- b.length >= index + nestedBytesLength,
- "GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED"
- );
-
- // Return a pointer to the byte array as it exists inside `b`
- assembly {
- result := add(b, index)
- }
- return result;
- }
-
- /// @dev Inserts bytes at a specific position in a byte array.
- /// @param b Byte array to insert <input> into.
- /// @param index Index in byte array of <input>.
- /// @param input bytes to insert.
- function writeBytesWithLength(
- bytes memory b,
- uint256 index,
- bytes memory input
- )
- internal
- pure
- {
- // Assert length of <b> is valid, given
- // length of input
- require(
- b.length >= index + 32 + input.length, // 32 bytes to store length
- "GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED"
- );
-
- // Copy <input> into <b>
- memCopy(
- b.contentAddress() + index,
- input.rawAddress(), // includes length of <input>
- input.length + 32 // +32 bytes to store <input> length
- );
- }
-
- /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.
- /// @param dest Byte array that will be overwritten with source bytes.
- /// @param source Byte array to copy onto dest bytes.
- function deepCopyBytes(
- bytes memory dest,
- bytes memory source
- )
- internal
- pure
- {
- uint256 sourceLen = source.length;
- // Dest length must be >= source length, or some bytes would not be copied.
- require(
- dest.length >= sourceLen,
- "GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED"
- );
- memCopy(
- dest.contentAddress(),
- source.contentAddress(),
- sourceLen
- );
- }
-}
diff --git a/packages/contracts/contracts/utils/Ownable/IOwnable.sol b/packages/contracts/contracts/utils/Ownable/IOwnable.sol
deleted file mode 100644
index 5deb13497..000000000
--- a/packages/contracts/contracts/utils/Ownable/IOwnable.sol
+++ /dev/null
@@ -1,8 +0,0 @@
-pragma solidity 0.4.24;
-
-
-contract IOwnable {
-
- function transferOwnership(address newOwner)
- public;
-}
diff --git a/packages/contracts/contracts/utils/Ownable/Ownable.sol b/packages/contracts/contracts/utils/Ownable/Ownable.sol
deleted file mode 100644
index 0c830be68..000000000
--- a/packages/contracts/contracts/utils/Ownable/Ownable.sol
+++ /dev/null
@@ -1,33 +0,0 @@
-pragma solidity 0.4.24;
-
-import "./IOwnable.sol";
-
-
-contract Ownable is
- IOwnable
-{
- address public owner;
-
- constructor ()
- public
- {
- owner = msg.sender;
- }
-
- modifier onlyOwner() {
- require(
- msg.sender == owner,
- "ONLY_CONTRACT_OWNER"
- );
- _;
- }
-
- function transferOwnership(address newOwner)
- public
- onlyOwner
- {
- if (newOwner != address(0)) {
- owner = newOwner;
- }
- }
-}
diff --git a/packages/contracts/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol b/packages/contracts/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol
deleted file mode 100644
index 9f98a7a16..000000000
--- a/packages/contracts/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol
+++ /dev/null
@@ -1,45 +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.24;
-
-
-contract ReentrancyGuard {
-
- // Locked state of mutex
- bool private locked = false;
-
- /// @dev Functions with this modifer cannot be reentered. The mutex will be locked
- /// before function execution and unlocked after.
- modifier nonReentrant() {
- // Ensure mutex is unlocked
- require(
- !locked,
- "REENTRANCY_ILLEGAL"
- );
-
- // Lock mutex before function call
- locked = true;
-
- // Perform function call
- _;
-
- // Unlock mutex after function call
- locked = false;
- }
-}
diff --git a/packages/contracts/contracts/utils/SafeMath/SafeMath.sol b/packages/contracts/contracts/utils/SafeMath/SafeMath.sol
deleted file mode 100644
index 2855edb9d..000000000
--- a/packages/contracts/contracts/utils/SafeMath/SafeMath.sol
+++ /dev/null
@@ -1,87 +0,0 @@
-pragma solidity 0.4.24;
-
-
-contract SafeMath {
-
- function safeMul(uint256 a, uint256 b)
- internal
- pure
- returns (uint256)
- {
- if (a == 0) {
- return 0;
- }
- uint256 c = a * b;
- require(
- c / a == b,
- "UINT256_OVERFLOW"
- );
- return c;
- }
-
- function safeDiv(uint256 a, uint256 b)
- internal
- pure
- returns (uint256)
- {
- uint256 c = a / b;
- return c;
- }
-
- function safeSub(uint256 a, uint256 b)
- internal
- pure
- returns (uint256)
- {
- require(
- b <= a,
- "UINT256_UNDERFLOW"
- );
- return a - b;
- }
-
- function safeAdd(uint256 a, uint256 b)
- internal
- pure
- returns (uint256)
- {
- uint256 c = a + b;
- require(
- c >= a,
- "UINT256_OVERFLOW"
- );
- return c;
- }
-
- function max64(uint64 a, uint64 b)
- internal
- pure
- returns (uint256)
- {
- return a >= b ? a : b;
- }
-
- function min64(uint64 a, uint64 b)
- internal
- pure
- returns (uint256)
- {
- return a < b ? a : b;
- }
-
- function max256(uint256 a, uint256 b)
- internal
- pure
- returns (uint256)
- {
- return a >= b ? a : b;
- }
-
- function min256(uint256 a, uint256 b)
- internal
- pure
- returns (uint256)
- {
- return a < b ? a : b;
- }
-}
diff --git a/packages/contracts/generated-artifacts/AssetProxyOwner.json b/packages/contracts/generated-artifacts/AssetProxyOwner.json
new file mode 100644
index 000000000..e0fa8cc70
--- /dev/null
+++ b/packages/contracts/generated-artifacts/AssetProxyOwner.json
@@ -0,0 +1,748 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "AssetProxyOwner",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "owners",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "removeOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "revokeConfirmation",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "isOwner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "confirmations",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "executeRemoveAuthorizedAddressAtIndex",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "secondsTimeLocked",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "pending",
+ "type": "bool"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "name": "getTransactionCount",
+ "outputs": [
+ {
+ "name": "count",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "assetProxyContract",
+ "type": "address"
+ },
+ {
+ "name": "isRegistered",
+ "type": "bool"
+ }
+ ],
+ "name": "registerAssetProxy",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "addOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "isConfirmed",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_secondsTimeLocked",
+ "type": "uint256"
+ }
+ ],
+ "name": "changeTimeLock",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "isAssetProxyRegistered",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getConfirmationCount",
+ "outputs": [
+ {
+ "name": "count",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "transactions",
+ "outputs": [
+ {
+ "name": "destination",
+ "type": "address"
+ },
+ {
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getOwners",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "from",
+ "type": "uint256"
+ },
+ {
+ "name": "to",
+ "type": "uint256"
+ },
+ {
+ "name": "pending",
+ "type": "bool"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "name": "getTransactionIds",
+ "outputs": [
+ {
+ "name": "_transactionIds",
+ "type": "uint256[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getConfirmations",
+ "outputs": [
+ {
+ "name": "_confirmations",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "transactionCount",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_required",
+ "type": "uint256"
+ }
+ ],
+ "name": "changeRequirement",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "confirmTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "destination",
+ "type": "address"
+ },
+ {
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "name": "submitTransaction",
+ "outputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "confirmationTimes",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "MAX_OWNER_COUNT",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "required",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "replaceOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "executeTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_owners",
+ "type": "address[]"
+ },
+ {
+ "name": "_assetProxyContracts",
+ "type": "address[]"
+ },
+ {
+ "name": "_required",
+ "type": "uint256"
+ },
+ {
+ "name": "_secondsTimeLocked",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "fallback"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "assetProxyContract",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "isRegistered",
+ "type": "bool"
+ }
+ ],
+ "name": "AssetProxyRegistration",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "confirmationTime",
+ "type": "uint256"
+ }
+ ],
+ "name": "ConfirmationTimeSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "secondsTimeLocked",
+ "type": "uint256"
+ }
+ ],
+ "name": "TimeLockChange",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Confirmation",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Revocation",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Submission",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Execution",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "ExecutionFailure",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Deposit",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnerAddition",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnerRemoval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "required",
+ "type": "uint256"
+ }
+ ],
+ "name": "RequirementChange",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040523480156200001157600080fd5b50604051620024633803806200246383398101604090815281516020830151918301516060840151918401805190949390930192909190600090819086908590859083908390869082603282118015906200006c5750818111155b80156200007857508015155b80156200008457508115155b15156200009057600080fd5b600092505b84518310156200016857600260008685815181101515620000b257fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff161580156200010857508483815181101515620000f057fe5b90602001906020020151600160a060020a0316600014155b15156200011457600080fd5b60016002600087868151811015156200012957fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff19169115159190911790556001929092019162000095565b84516200017d9060039060208801906200026c565b50505060049190915550506006555060009250505b845182101562000260578482815181101515620001ab57fe5b602090810290910101519050600160a060020a03811615156200022f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e56414c49445f41535345545f50524f585900000000000000000000000000604482015290519081900360640190fd5b600160a060020a0381166000908152600860205260409020805460ff19166001908117909155919091019062000192565b50505050505062000300565b828054828255906000526020600020908101928215620002c4579160200282015b82811115620002c45782518254600160a060020a031916600160a060020a039091161782556020909201916001909101906200028d565b50620002d2929150620002d6565b5090565b620002fd91905b80821115620002d2578054600160a060020a0319168155600101620002dd565b90565b61215380620003106000396000f30060806040526004361061015e5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c2781146101a0578063173825d9146101e157806320ea8d861461020f5780632f54bf6e146102275780633411c81c146102695780633589b35c1461029a57806337bd78a0146102b257806354741525146102d95780635a1a66af146102f85780637065cb481461032b578063784547a7146103595780637ad28c511461037157806383250f79146103895780638b51d13f146103b75780639ace38c2146103cf578063a0e67e2b146104a4578063a8abe69a14610509578063b5dc40c31461052e578063b77bf60014610546578063ba51a6df1461055b578063c01a8c8414610573578063c64274741461058b578063d38f2d8214610601578063d74f8edd14610619578063dc8452cd1461062e578063e20056e614610643578063ee22610b14610677575b600034111561019e5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b3480156101ac57600080fd5b506101b860043561068f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101ed57600080fd5b5061019e73ffffffffffffffffffffffffffffffffffffffff600435166106c4565b34801561021b57600080fd5b5061019e60043561091b565b34801561023357600080fd5b5061025573ffffffffffffffffffffffffffffffffffffffff600435166109f3565b604080519115158252519081900360200190f35b34801561027557600080fd5b5061025560043573ffffffffffffffffffffffffffffffffffffffff60243516610a08565b3480156102a657600080fd5b5061019e600435610a28565b3480156102be57600080fd5b506102c7610eda565b60408051918252519081900360200190f35b3480156102e557600080fd5b506102c760043515156024351515610ee0565b34801561030457600080fd5b5061019e73ffffffffffffffffffffffffffffffffffffffff600435166024351515610f4c565b34801561033757600080fd5b5061019e73ffffffffffffffffffffffffffffffffffffffff6004351661100b565b34801561036557600080fd5b50610255600435611180565b34801561037d57600080fd5b5061019e600435611211565b34801561039557600080fd5b5061025573ffffffffffffffffffffffffffffffffffffffff60043516611258565b3480156103c357600080fd5b506102c760043561126d565b3480156103db57600080fd5b506103e76004356112e9565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561046657818101518382015260200161044e565b50505050905090810190601f1680156104935780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156104b057600080fd5b506104b96113d2565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156104f55781810151838201526020016104dd565b505050509050019250505060405180910390f35b34801561051557600080fd5b506104b960043560243560443515156064351515611442565b34801561053a57600080fd5b506104b960043561157b565b34801561055257600080fd5b506102c7611728565b34801561056757600080fd5b5061019e60043561172e565b34801561057f57600080fd5b5061019e6004356117ad565b34801561059757600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526102c794823573ffffffffffffffffffffffffffffffffffffffff169460248035953695946064949201919081908401838280828437509497506119219650505050505050565b34801561060d57600080fd5b506102c7600435611940565b34801561062557600080fd5b506102c7611952565b34801561063a57600080fd5b506102c7611957565b34801561064f57600080fd5b5061019e73ffffffffffffffffffffffffffffffffffffffff6004358116906024351661195d565b34801561068357600080fd5b5061019e600435611b6d565b600380548290811061069d57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60003330146106d257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054829060ff16151561070857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905591505b6003547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0182101561088b578273ffffffffffffffffffffffffffffffffffffffff166003838154811015156107a857fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561088057600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061080057fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff909216918490811061083357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061088b565b600190910190610756565b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906108bc9082612066565b5060035460045411156108d5576003546108d59061172e565b60405173ffffffffffffffffffffffffffffffffffffffff8416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff16151561093957600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561096557600080fd5b600084815260208190526040902060030154849060ff161561098657600080fd5b600085815260016020908152604080832033808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b600081815260208190526040812060030154829060ff1615610a4957600080fd5b82610a5381611180565b1515610ac057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604482015290519081900360640190fd5b600084815260208181526040808320805473ffffffffffffffffffffffffffffffffffffffff16845260089092529091205485919060ff161515610b6557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f554e524547495354455245445f41535345545f50524f58590000000000000000604482015290519081900360640190fd5b604080517f72656d6f7665417574686f72697a6564416464726573734174496e646578286181527f6464726573732c75696e74323536290000000000000000000000000000000000602080830191909152825191829003602f01822060028086018054601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018416150201909116929092049182018490048402850184019095528084527fffffffff0000000000000000000000000000000000000000000000000000000090911693610ca193600093909290830182828015610c8e5780601f10610c6357610100808354040283529160200191610c8e565b820191906000526020600020905b815481529060010190602001808311610c7157829003601f168201915b5050505050611dfd90919063ffffffff16565b7fffffffff000000000000000000000000000000000000000000000000000000001614610d2f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f494e56414c49445f46554e4354494f4e5f53454c4543544f5200000000000000604482015290519081900360640190fd5b600086815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff97831615610100029790970190911692909204948501879004870282018701909752838152939a50610e479573ffffffffffffffffffffffffffffffffffffffff90921694909391908390830182828015610e3d5780601f10610e1257610100808354040283529160200191610e3d565b820191906000526020600020905b815481529060010190602001808311610e2057829003601f168201915b5050505050611ec5565b15610e7c5760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2610ed2565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003850180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b505050505050565b60065481565b6000805b600554811015610f4557838015610f0d575060008181526020819052604090206003015460ff16155b80610f315750828015610f31575060008181526020819052604090206003015460ff165b15610f3d576001820191505b600101610ee4565b5092915050565b333014610f5857600080fd5b8173ffffffffffffffffffffffffffffffffffffffff81161515610f7b57600080fd5b73ffffffffffffffffffffffffffffffffffffffff831660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915582519384529083015280517fdaef8ff7dc66c5e34eb9c338aab679d9f427f89868d9228494455a4d982eb2b09281900390910190a1505050565b33301461101757600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054819060ff161561104c57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff8116151561106f57600080fd5b6003805490506001016004546032821115801561108c5750818111155b801561109757508015155b80156110a257508115155b15156110ad57600080fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b60035481101561120a57600084815260016020526040812060038054919291849081106111ae57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff16156111ef576001820191505b600454821415611202576001925061120a565b600101611185565b5050919050565b33301461121d57600080fd5b60068190556040805182815290517fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b43779181900360200190a150565b60086020526000908152604090205460ff1681565b6000805b6003548110156112e3576000838152600160205260408120600380549192918490811061129a57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff16156112db576001820191505b600101611271565b50919050565b60006020818152918152604090819020805460018083015460028085018054875161010095821615959095027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f810188900488028401880190965285835273ffffffffffffffffffffffffffffffffffffffff909316959094919291908301828280156113bf5780601f10611394576101008083540402835291602001916113bf565b820191906000526020600020905b8154815290600101906020018083116113a257829003601f168201915b5050506003909301549192505060ff1684565b6060600380548060200260200160405190810160405280929190818152602001828054801561143757602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161140c575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015611474578160200160208202803883390190505b50925060009150600090505b6005548110156114fb578580156114a9575060008181526020819052604090206003015460ff16155b806114cd57508480156114cd575060008181526020819052604090206003015460ff165b156114f3578083838151811015156114e157fe5b60209081029091010152600191909101905b600101611480565b878703604051908082528060200260200182016040528015611527578160200160208202803883390190505b5093508790505b8681101561157057828181518110151561154457fe5b906020019060200201518489830381518110151561155e57fe5b6020908102909101015260010161152e565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156115b0578160200160208202803883390190505b50925060009150600090505b60035481101561169457600085815260016020526040812060038054919291849081106115e557fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff161561168c57600380548290811061162d57fe5b600091825260209091200154835173ffffffffffffffffffffffffffffffffffffffff9091169084908490811061166057fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600191909101905b6001016115bc565b816040519080825280602002602001820160405280156116be578160200160208202803883390190505b509350600090505b818110156117205782818151811015156116dc57fe5b9060200190602002015184828151811015156116f457fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302909101909101526001016116c6565b505050919050565b60055481565b33301461173a57600080fd5b600354816032821180159061174f5750818111155b801561175a57508015155b801561176557508115155b151561177057600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff1615156117cb57600080fd5b600082815260208190526040902054829073ffffffffffffffffffffffffffffffffffffffff1615156117fd57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff161561182857600080fd5b8461183281611180565b1561189e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f54585f46554c4c595f434f4e4649524d45440000000000000000000000000000604482015290519081900360640190fd5b600086815260016020818152604080842033808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909317909255905188927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a361191286611180565b15610ed257610ed28642611ee8565b600061192e848484611f33565b9050611939816117ad565b9392505050565b60076020526000908152604090205481565b603281565b60045481565b600033301461196b57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff1615156119a157600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff16156119d657600080fd5b600092505b600354831015611a9b578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611a0b57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611a905783600384815481101515611a4357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a9b565b6001909201916119db565b73ffffffffffffffffffffffffffffffffffffffff80861660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a260405173ffffffffffffffffffffffffffffffffffffffff8516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b600081815260208190526040812060030154829060ff1615611b8e57600080fd5b82611b9881611180565b1515611c0557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604482015290519081900360640190fd5b600654600085815260076020526040902054859101421015611c8857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f54494d455f4c4f434b5f494e434f4d504c455445000000000000000000000000604482015290519081900360640190fd5b600085815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff97831615610100029790970190911692909204948501879004870282018701909752838152939950611d6b9573ffffffffffffffffffffffffffffffffffffffff90921694909391908390830182828015610e3d5780601f10610e1257610100808354040283529160200191610e3d565b15611da05760405185907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2611df6565b60405185907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b5050505050565b600081600401835110151515611e9a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160448201527f5549524544000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b6000828152600760209081526040918290208390558151838152915184927f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d92908290030190a25050565b60008373ffffffffffffffffffffffffffffffffffffffff81161515611f5857600080fd5b6005546040805160808101825273ffffffffffffffffffffffffffffffffffffffff8881168252602080830189815283850189815260006060860181905287815280845295909520845181547fffffffffffffffffffffffff00000000000000000000000000000000000000001694169390931783555160018301559251805194965091939092611ff092600285019291019061208f565b5060609190910151600390910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b81548183558181111561208a5760008381526020902061208a91810190830161210d565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106120d057805160ff19168380011785556120fd565b828001600101855582156120fd579182015b828111156120fd5782518255916020019190600101906120e2565b5061210992915061210d565b5090565b61143f91905b8082111561210957600081556001016121135600a165627a7a723058202fd87f8e00980d0949ca9979720e573ee554ca541aec8bfc234265edec45f8d10029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x2463 CODESIZE SUB DUP1 PUSH3 0x2463 DUP4 CODECOPY DUP2 ADD PUSH1 0x40 SWAP1 DUP2 MSTORE DUP2 MLOAD PUSH1 0x20 DUP4 ADD MLOAD SWAP2 DUP4 ADD MLOAD PUSH1 0x60 DUP5 ADD MLOAD SWAP2 DUP5 ADD DUP1 MLOAD SWAP1 SWAP5 SWAP4 SWAP1 SWAP4 ADD SWAP3 SWAP1 SWAP2 SWAP1 PUSH1 0x0 SWAP1 DUP2 SWAP1 DUP7 SWAP1 DUP6 SWAP1 DUP6 SWAP1 DUP4 SWAP1 DUP4 SWAP1 DUP7 SWAP1 DUP3 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH3 0x6C JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH3 0x78 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH3 0x84 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH3 0x90 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST DUP5 MLOAD DUP4 LT ISZERO PUSH3 0x168 JUMPI PUSH1 0x2 PUSH1 0x0 DUP7 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0xB2 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP3 MSTORE DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x40 ADD PUSH1 0x0 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO DUP1 ISZERO PUSH3 0x108 JUMPI POP DUP5 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0xF0 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 EQ ISZERO JUMPDEST ISZERO ISZERO PUSH3 0x114 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x2 PUSH1 0x0 DUP8 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x129 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP3 MSTORE DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x40 ADD PUSH1 0x0 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x1 SWAP3 SWAP1 SWAP3 ADD SWAP2 PUSH3 0x95 JUMP JUMPDEST DUP5 MLOAD PUSH3 0x17D SWAP1 PUSH1 0x3 SWAP1 PUSH1 0x20 DUP9 ADD SWAP1 PUSH3 0x26C JUMP JUMPDEST POP POP POP PUSH1 0x4 SWAP2 SWAP1 SWAP2 SSTORE POP POP PUSH1 0x6 SSTORE POP PUSH1 0x0 SWAP3 POP POP JUMPDEST DUP5 MLOAD DUP3 LT ISZERO PUSH3 0x260 JUMPI DUP5 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x1AB JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD SWAP1 POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP2 AND ISZERO ISZERO PUSH3 0x22F JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F41535345545F50524F585900000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH3 0x192 JUMP JUMPDEST POP POP POP POP POP POP PUSH3 0x300 JUMP JUMPDEST DUP3 DUP1 SLOAD DUP3 DUP3 SSTORE SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 DUP2 ADD SWAP3 DUP3 ISZERO PUSH3 0x2C4 JUMPI SWAP2 PUSH1 0x20 MUL DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0x2C4 JUMPI DUP3 MLOAD DUP3 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP2 AND OR DUP3 SSTORE PUSH1 0x20 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH3 0x28D JUMP JUMPDEST POP PUSH3 0x2D2 SWAP3 SWAP2 POP PUSH3 0x2D6 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x2FD SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x2D2 JUMPI DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x2DD JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x2153 DUP1 PUSH3 0x310 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x15E JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x25E7C27 DUP2 EQ PUSH2 0x1A0 JUMPI DUP1 PUSH4 0x173825D9 EQ PUSH2 0x1E1 JUMPI DUP1 PUSH4 0x20EA8D86 EQ PUSH2 0x20F JUMPI DUP1 PUSH4 0x2F54BF6E EQ PUSH2 0x227 JUMPI DUP1 PUSH4 0x3411C81C EQ PUSH2 0x269 JUMPI DUP1 PUSH4 0x3589B35C EQ PUSH2 0x29A JUMPI DUP1 PUSH4 0x37BD78A0 EQ PUSH2 0x2B2 JUMPI DUP1 PUSH4 0x54741525 EQ PUSH2 0x2D9 JUMPI DUP1 PUSH4 0x5A1A66AF EQ PUSH2 0x2F8 JUMPI DUP1 PUSH4 0x7065CB48 EQ PUSH2 0x32B JUMPI DUP1 PUSH4 0x784547A7 EQ PUSH2 0x359 JUMPI DUP1 PUSH4 0x7AD28C51 EQ PUSH2 0x371 JUMPI DUP1 PUSH4 0x83250F79 EQ PUSH2 0x389 JUMPI DUP1 PUSH4 0x8B51D13F EQ PUSH2 0x3B7 JUMPI DUP1 PUSH4 0x9ACE38C2 EQ PUSH2 0x3CF JUMPI DUP1 PUSH4 0xA0E67E2B EQ PUSH2 0x4A4 JUMPI DUP1 PUSH4 0xA8ABE69A EQ PUSH2 0x509 JUMPI DUP1 PUSH4 0xB5DC40C3 EQ PUSH2 0x52E JUMPI DUP1 PUSH4 0xB77BF600 EQ PUSH2 0x546 JUMPI DUP1 PUSH4 0xBA51A6DF EQ PUSH2 0x55B JUMPI DUP1 PUSH4 0xC01A8C84 EQ PUSH2 0x573 JUMPI DUP1 PUSH4 0xC6427474 EQ PUSH2 0x58B JUMPI DUP1 PUSH4 0xD38F2D82 EQ PUSH2 0x601 JUMPI DUP1 PUSH4 0xD74F8EDD EQ PUSH2 0x619 JUMPI DUP1 PUSH4 0xDC8452CD EQ PUSH2 0x62E JUMPI DUP1 PUSH4 0xE20056E6 EQ PUSH2 0x643 JUMPI DUP1 PUSH4 0xEE22610B EQ PUSH2 0x677 JUMPI JUMPDEST PUSH1 0x0 CALLVALUE GT ISZERO PUSH2 0x19E JUMPI PUSH1 0x40 DUP1 MLOAD CALLVALUE DUP2 MSTORE SWAP1 MLOAD CALLER SWAP2 PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C SWAP2 SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG2 JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH1 0x4 CALLDATALOAD PUSH2 0x68F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1ED JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x6C4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x21B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0x91B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x233 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x255 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x9F3 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x275 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x255 PUSH1 0x4 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x24 CALLDATALOAD AND PUSH2 0xA08 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0xA28 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH2 0xEDA JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH1 0x4 CALLDATALOAD ISZERO ISZERO PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xEE0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x304 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xF4C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x337 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x100B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x365 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x255 PUSH1 0x4 CALLDATALOAD PUSH2 0x1180 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x37D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0x1211 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x395 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x255 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x1258 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH1 0x4 CALLDATALOAD PUSH2 0x126D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3DB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3E7 PUSH1 0x4 CALLDATALOAD PUSH2 0x12E9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x466 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x44E JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x493 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP6 POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4B0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x4B9 PUSH2 0x13D2 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x4F5 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x4DD JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x515 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x4B9 PUSH1 0x4 CALLDATALOAD PUSH1 0x24 CALLDATALOAD PUSH1 0x44 CALLDATALOAD ISZERO ISZERO PUSH1 0x64 CALLDATALOAD ISZERO ISZERO PUSH2 0x1442 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x53A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x4B9 PUSH1 0x4 CALLDATALOAD PUSH2 0x157B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x552 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH2 0x1728 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x567 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0x172E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x57F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0x17AD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x597 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x2C7 SWAP5 DUP3 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x1921 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x60D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH1 0x4 CALLDATALOAD PUSH2 0x1940 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x625 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH2 0x1952 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x63A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH2 0x1957 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x64F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x195D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x683 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0x1B6D JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x69D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x6D2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x708 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP2 POP JUMPDEST PUSH1 0x3 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP3 LT ISZERO PUSH2 0x88B JUMPI DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x7A8 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x880 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x800 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x3 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x833 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x88B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x756 JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x8BC SWAP1 DUP3 PUSH2 0x2066 JUMP JUMPDEST POP PUSH1 0x3 SLOAD PUSH1 0x4 SLOAD GT ISZERO PUSH2 0x8D5 JUMPI PUSH1 0x3 SLOAD PUSH2 0x8D5 SWAP1 PUSH2 0x172E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x939 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP4 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x965 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD DUP5 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x986 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE MLOAD DUP8 SWAP3 PUSH32 0xF6A317157440607F36269043EB55F1287A5A19BA2216AFEAB88CD46CBCFB88E9 SWAP2 LOG3 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 ADD SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xA49 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 PUSH2 0xA53 DUP2 PUSH2 0x1180 JUMP JUMPDEST ISZERO ISZERO PUSH2 0xAC0 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F4E4F545F46554C4C595F434F4E4649524D454400000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 MSTORE PUSH1 0x8 SWAP1 SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP6 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0xB65 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x18 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x554E524547495354455245445F41535345545F50524F58590000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x72656D6F7665417574686F72697A6564416464726573734174496E6465782861 DUP2 MSTORE PUSH32 0x6464726573732C75696E74323536290000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP3 MLOAD SWAP2 DUP3 SWAP1 SUB PUSH1 0x2F ADD DUP3 KECCAK256 PUSH1 0x2 DUP1 DUP7 ADD DUP1 SLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP5 AND ISZERO MUL ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP2 DUP3 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP1 DUP5 MSTORE PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP2 AND SWAP4 PUSH2 0xCA1 SWAP4 PUSH1 0x0 SWAP4 SWAP1 SWAP3 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xC8E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xC63 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xC8E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xC71 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x1DFD SWAP1 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND EQ PUSH2 0xD2F JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F46554E4354494F4E5F53454C4543544F5200000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP11 POP PUSH2 0xE47 SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xE3D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xE12 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xE3D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xE20 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x1EC5 JUMP JUMPDEST ISZERO PUSH2 0xE7C JUMPI PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0xED2 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP6 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0xF45 JUMPI DUP4 DUP1 ISZERO PUSH2 0xF0D JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0xF31 JUMPI POP DUP3 DUP1 ISZERO PUSH2 0xF31 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0xF3D JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0xEE4 JUMP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0xF58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0xF7B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP7 ISZERO ISZERO SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP3 MLOAD SWAP4 DUP5 MSTORE SWAP1 DUP4 ADD MSTORE DUP1 MLOAD PUSH32 0xDAEF8FF7DC66C5E34EB9C338AAB679D9F427F89868D9228494455A4D982EB2B0 SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x1017 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x104C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x106F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x1 ADD PUSH1 0x4 SLOAD PUSH1 0x32 DUP3 GT ISZERO DUP1 ISZERO PUSH2 0x108C JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1097 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x10A2 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x10AD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE PUSH1 0x3 DUP1 SLOAD SWAP2 DUP3 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0xC2575A0E9E593C00F959F8C92F12DB2869C3395A3B0502D05E2516446F71F85B ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP2 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x120A JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x11AE JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x11EF JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x4 SLOAD DUP3 EQ ISZERO PUSH2 0x1202 JUMPI PUSH1 0x1 SWAP3 POP PUSH2 0x120A JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0x1185 JUMP JUMPDEST POP POP SWAP2 SWAP1 POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x121D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x6 DUP2 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xD1C9101A34FEFF75CCCEF14A28785A0279CB0B49C1F321F21F5F422E746B4377 SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP JUMP JUMPDEST PUSH1 0x8 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x12E3 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x129A JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x12DB JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0x1271 JUMP JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP2 DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP1 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP8 MLOAD PUSH2 0x100 SWAP6 DUP3 AND ISZERO SWAP6 SWAP1 SWAP6 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD AND SWAP2 SWAP1 SWAP2 DIV PUSH1 0x1F DUP2 ADD DUP9 SWAP1 DIV DUP9 MUL DUP5 ADD DUP9 ADD SWAP1 SWAP7 MSTORE DUP6 DUP4 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND SWAP6 SWAP1 SWAP5 SWAP2 SWAP3 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x13BF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1394 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x13BF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x13A2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP PUSH1 0x3 SWAP1 SWAP4 ADD SLOAD SWAP2 SWAP3 POP POP PUSH1 0xFF AND DUP5 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0x1437 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x140C JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x5 SLOAD PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x1474 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0x14FB JUMPI DUP6 DUP1 ISZERO PUSH2 0x14A9 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0x14CD JUMPI POP DUP5 DUP1 ISZERO PUSH2 0x14CD JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0x14F3 JUMPI DUP1 DUP4 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x14E1 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0x1480 JUMP JUMPDEST DUP8 DUP8 SUB PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x1527 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP DUP8 SWAP1 POP JUMPDEST DUP7 DUP2 LT ISZERO PUSH2 0x1570 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1544 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP10 DUP4 SUB DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x155E JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x152E JUMP JUMPDEST POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x15B0 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x1694 JUMPI PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x15E5 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x168C JUMPI PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x162D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD DUP4 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP2 LT PUSH2 0x1660 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0x15BC JUMP JUMPDEST DUP2 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x16BE JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x1720 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x16DC JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x16F4 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 ADD PUSH2 0x16C6 JUMP JUMPDEST POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x5 SLOAD DUP2 JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x173A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 SLOAD DUP2 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH2 0x174F JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x175A JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1765 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x1770 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x4 DUP4 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP5 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xA3F1EE9126A074D9326C682F561767F710E927FAA811F7A99829D49DC421797A SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x17CB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO ISZERO PUSH2 0x17FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP5 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1828 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 PUSH2 0x1832 DUP2 PUSH2 0x1180 JUMP JUMPDEST ISZERO PUSH2 0x189E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F46554C4C595F434F4E4649524D45440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 CALLER DUP1 DUP7 MSTORE SWAP3 MSTORE DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SWAP4 OR SWAP1 SWAP3 SSTORE SWAP1 MLOAD DUP9 SWAP3 PUSH32 0x4A504A94899432A9846E1AA406DCEB1BCFD538BB839071D49D1E5E23F5BE30EF SWAP2 LOG3 PUSH2 0x1912 DUP7 PUSH2 0x1180 JUMP JUMPDEST ISZERO PUSH2 0xED2 JUMPI PUSH2 0xED2 DUP7 TIMESTAMP PUSH2 0x1EE8 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x192E DUP5 DUP5 DUP5 PUSH2 0x1F33 JUMP JUMPDEST SWAP1 POP PUSH2 0x1939 DUP2 PUSH2 0x17AD JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x32 DUP2 JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x196B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x19A1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x19D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST PUSH1 0x3 SLOAD DUP4 LT ISZERO PUSH2 0x1A9B JUMPI DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1A0B JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x1A90 JUMPI DUP4 PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1A43 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x1A9B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x19DB JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 SWAP1 DUP2 AND SWAP1 SWAP2 SSTORE SWAP4 DUP9 AND DUP3 MSTORE DUP1 DUP3 KECCAK256 DUP1 SLOAD SWAP1 SWAP5 AND PUSH1 0x1 OR SWAP1 SWAP4 SSTORE SWAP2 MLOAD SWAP1 SWAP2 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP2 LOG2 PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP1 PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 ADD SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1B8E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 PUSH2 0x1B98 DUP2 PUSH2 0x1180 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x1C05 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F4E4F545F46554C4C595F434F4E4649524D454400000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x6 SLOAD PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP6 SWAP2 ADD TIMESTAMP LT ISZERO PUSH2 0x1C88 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x14 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54494D455F4C4F434B5F494E434F4D504C455445000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP10 POP PUSH2 0x1D6B SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xE3D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xE12 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xE3D JUMP JUMPDEST ISZERO PUSH2 0x1DA0 JUMPI PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0x1DF6 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP5 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x4 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1E9A JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x25 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F345F4C454E4754485F524551 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5549524544000000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 MLOAD PUSH1 0x20 DUP5 ADD PUSH1 0x0 DUP3 DUP8 DUP4 DUP11 DUP13 PUSH2 0x8796 GAS SUB CALL SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP4 SWAP1 SSTORE DUP2 MLOAD DUP4 DUP2 MSTORE SWAP2 MLOAD DUP5 SWAP3 PUSH32 0xB237AFE65F1514FD7EA3F923EA4FE792BDD07000A912B6CD1602A8E7F573C8D SWAP3 SWAP1 DUP3 SWAP1 SUB ADD SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x1F58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x80 DUP2 ADD DUP3 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 DUP2 AND DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD DUP10 DUP2 MSTORE DUP4 DUP6 ADD DUP10 DUP2 MSTORE PUSH1 0x0 PUSH1 0x60 DUP7 ADD DUP2 SWAP1 MSTORE DUP8 DUP2 MSTORE DUP1 DUP5 MSTORE SWAP6 SWAP1 SWAP6 KECCAK256 DUP5 MLOAD DUP2 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 SSTORE MLOAD PUSH1 0x1 DUP4 ADD SSTORE SWAP3 MLOAD DUP1 MLOAD SWAP5 SWAP7 POP SWAP2 SWAP4 SWAP1 SWAP3 PUSH2 0x1FF0 SWAP3 PUSH1 0x2 DUP6 ADD SWAP3 SWAP2 ADD SWAP1 PUSH2 0x208F JUMP JUMPDEST POP PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD MLOAD PUSH1 0x3 SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x5 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE PUSH1 0x40 MLOAD DUP3 SWAP1 PUSH32 0xC0BA8FE4B176C1714197D43B9CC6BCF797A4A7461C5FE8D0EF6E184AE7601E51 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0x208A JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0x208A SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0x210D JUMP JUMPDEST POP POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x20D0 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x20FD JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x20FD JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x20FD JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x20E2 JUMP JUMPDEST POP PUSH2 0x2109 SWAP3 SWAP2 POP PUSH2 0x210D JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x143F SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x2109 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x2113 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0x2f 0xd8 PUSH32 0x8E00980D0949CA9979720E573EE554CA541AEC8BFC234265EDEC45F8D1002900 ",
+ "sourceMap": "707:3438:25:-;;;2298:571;8:9:-1;5:2;;;30:1;27;20:12;5:2;2298:571:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2934:14:16;;2298:571:25;;;;;;;;;;2570:9;;;;2298:571;;;;;;;;;;2570:9;;2298:571;839:2:16;2273:29;;;;;:68;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;2987:1;2980:8;;2975:151;2992:7;:14;2990:1;:16;2975:151;;;3036:7;:19;3044:7;3052:1;3044:10;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3036:19:16;;;;;;;;;;;-1:-1:-1;3036:19:16;;;;3035:20;:39;;;;;3059:7;3067:1;3059:10;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3059:15:16;3073:1;3059:15;;3035:39;3027:48;;;;;;;;3111:4;3089:7;:19;3097:7;3105:1;3097:10;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3089:19:16;;;;;;;;;;;-1:-1:-1;3089:19:16;:26;;-1:-1:-1;;3089:26:16;;;;;;;;;;-1:-1:-1;3008:3:16;;;;;2975:151;;;3135:16;;;;:6;;:16;;;;;:::i;:::-;-1:-1:-1;;;3161:8:16;:20;;;;-1:-1:-1;;2245:17:17;:38;-1:-1:-1;;;;;2565:298:25;2589:20;:27;2585:1;:31;2565:298;;;2658:20;2679:1;2658:23;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2720:24:25;;;;2695:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2811:34:25;;;;;;:22;:34;;;;;:41;;-1:-1:-1;;2811:41:25;2848:4;2811:41;;;;;;2618:3;;;;;2565:298;;;2298:571;;;;;;707:3438;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;707:3438:25;-1:-1:-1;;;;;707:3438:25;;;;;;;;;;;-1:-1:-1;707:3438:25;;;;;;;-1:-1:-1;707:3438:25;;;-1:-1:-1;707:3438:25;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;;;;;;707:3438:25;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526004361061015e5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c2781146101a0578063173825d9146101e157806320ea8d861461020f5780632f54bf6e146102275780633411c81c146102695780633589b35c1461029a57806337bd78a0146102b257806354741525146102d95780635a1a66af146102f85780637065cb481461032b578063784547a7146103595780637ad28c511461037157806383250f79146103895780638b51d13f146103b75780639ace38c2146103cf578063a0e67e2b146104a4578063a8abe69a14610509578063b5dc40c31461052e578063b77bf60014610546578063ba51a6df1461055b578063c01a8c8414610573578063c64274741461058b578063d38f2d8214610601578063d74f8edd14610619578063dc8452cd1461062e578063e20056e614610643578063ee22610b14610677575b600034111561019e5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b3480156101ac57600080fd5b506101b860043561068f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101ed57600080fd5b5061019e73ffffffffffffffffffffffffffffffffffffffff600435166106c4565b34801561021b57600080fd5b5061019e60043561091b565b34801561023357600080fd5b5061025573ffffffffffffffffffffffffffffffffffffffff600435166109f3565b604080519115158252519081900360200190f35b34801561027557600080fd5b5061025560043573ffffffffffffffffffffffffffffffffffffffff60243516610a08565b3480156102a657600080fd5b5061019e600435610a28565b3480156102be57600080fd5b506102c7610eda565b60408051918252519081900360200190f35b3480156102e557600080fd5b506102c760043515156024351515610ee0565b34801561030457600080fd5b5061019e73ffffffffffffffffffffffffffffffffffffffff600435166024351515610f4c565b34801561033757600080fd5b5061019e73ffffffffffffffffffffffffffffffffffffffff6004351661100b565b34801561036557600080fd5b50610255600435611180565b34801561037d57600080fd5b5061019e600435611211565b34801561039557600080fd5b5061025573ffffffffffffffffffffffffffffffffffffffff60043516611258565b3480156103c357600080fd5b506102c760043561126d565b3480156103db57600080fd5b506103e76004356112e9565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561046657818101518382015260200161044e565b50505050905090810190601f1680156104935780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156104b057600080fd5b506104b96113d2565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156104f55781810151838201526020016104dd565b505050509050019250505060405180910390f35b34801561051557600080fd5b506104b960043560243560443515156064351515611442565b34801561053a57600080fd5b506104b960043561157b565b34801561055257600080fd5b506102c7611728565b34801561056757600080fd5b5061019e60043561172e565b34801561057f57600080fd5b5061019e6004356117ad565b34801561059757600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526102c794823573ffffffffffffffffffffffffffffffffffffffff169460248035953695946064949201919081908401838280828437509497506119219650505050505050565b34801561060d57600080fd5b506102c7600435611940565b34801561062557600080fd5b506102c7611952565b34801561063a57600080fd5b506102c7611957565b34801561064f57600080fd5b5061019e73ffffffffffffffffffffffffffffffffffffffff6004358116906024351661195d565b34801561068357600080fd5b5061019e600435611b6d565b600380548290811061069d57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60003330146106d257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054829060ff16151561070857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905591505b6003547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0182101561088b578273ffffffffffffffffffffffffffffffffffffffff166003838154811015156107a857fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561088057600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061080057fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff909216918490811061083357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061088b565b600190910190610756565b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906108bc9082612066565b5060035460045411156108d5576003546108d59061172e565b60405173ffffffffffffffffffffffffffffffffffffffff8416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff16151561093957600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561096557600080fd5b600084815260208190526040902060030154849060ff161561098657600080fd5b600085815260016020908152604080832033808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b600081815260208190526040812060030154829060ff1615610a4957600080fd5b82610a5381611180565b1515610ac057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604482015290519081900360640190fd5b600084815260208181526040808320805473ffffffffffffffffffffffffffffffffffffffff16845260089092529091205485919060ff161515610b6557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f554e524547495354455245445f41535345545f50524f58590000000000000000604482015290519081900360640190fd5b604080517f72656d6f7665417574686f72697a6564416464726573734174496e646578286181527f6464726573732c75696e74323536290000000000000000000000000000000000602080830191909152825191829003602f01822060028086018054601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018416150201909116929092049182018490048402850184019095528084527fffffffff0000000000000000000000000000000000000000000000000000000090911693610ca193600093909290830182828015610c8e5780601f10610c6357610100808354040283529160200191610c8e565b820191906000526020600020905b815481529060010190602001808311610c7157829003601f168201915b5050505050611dfd90919063ffffffff16565b7fffffffff000000000000000000000000000000000000000000000000000000001614610d2f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f494e56414c49445f46554e4354494f4e5f53454c4543544f5200000000000000604482015290519081900360640190fd5b600086815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff97831615610100029790970190911692909204948501879004870282018701909752838152939a50610e479573ffffffffffffffffffffffffffffffffffffffff90921694909391908390830182828015610e3d5780601f10610e1257610100808354040283529160200191610e3d565b820191906000526020600020905b815481529060010190602001808311610e2057829003601f168201915b5050505050611ec5565b15610e7c5760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2610ed2565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003850180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b505050505050565b60065481565b6000805b600554811015610f4557838015610f0d575060008181526020819052604090206003015460ff16155b80610f315750828015610f31575060008181526020819052604090206003015460ff165b15610f3d576001820191505b600101610ee4565b5092915050565b333014610f5857600080fd5b8173ffffffffffffffffffffffffffffffffffffffff81161515610f7b57600080fd5b73ffffffffffffffffffffffffffffffffffffffff831660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915582519384529083015280517fdaef8ff7dc66c5e34eb9c338aab679d9f427f89868d9228494455a4d982eb2b09281900390910190a1505050565b33301461101757600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054819060ff161561104c57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff8116151561106f57600080fd5b6003805490506001016004546032821115801561108c5750818111155b801561109757508015155b80156110a257508115155b15156110ad57600080fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b60035481101561120a57600084815260016020526040812060038054919291849081106111ae57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff16156111ef576001820191505b600454821415611202576001925061120a565b600101611185565b5050919050565b33301461121d57600080fd5b60068190556040805182815290517fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b43779181900360200190a150565b60086020526000908152604090205460ff1681565b6000805b6003548110156112e3576000838152600160205260408120600380549192918490811061129a57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff16156112db576001820191505b600101611271565b50919050565b60006020818152918152604090819020805460018083015460028085018054875161010095821615959095027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f810188900488028401880190965285835273ffffffffffffffffffffffffffffffffffffffff909316959094919291908301828280156113bf5780601f10611394576101008083540402835291602001916113bf565b820191906000526020600020905b8154815290600101906020018083116113a257829003601f168201915b5050506003909301549192505060ff1684565b6060600380548060200260200160405190810160405280929190818152602001828054801561143757602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161140c575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015611474578160200160208202803883390190505b50925060009150600090505b6005548110156114fb578580156114a9575060008181526020819052604090206003015460ff16155b806114cd57508480156114cd575060008181526020819052604090206003015460ff165b156114f3578083838151811015156114e157fe5b60209081029091010152600191909101905b600101611480565b878703604051908082528060200260200182016040528015611527578160200160208202803883390190505b5093508790505b8681101561157057828181518110151561154457fe5b906020019060200201518489830381518110151561155e57fe5b6020908102909101015260010161152e565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156115b0578160200160208202803883390190505b50925060009150600090505b60035481101561169457600085815260016020526040812060038054919291849081106115e557fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff161561168c57600380548290811061162d57fe5b600091825260209091200154835173ffffffffffffffffffffffffffffffffffffffff9091169084908490811061166057fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600191909101905b6001016115bc565b816040519080825280602002602001820160405280156116be578160200160208202803883390190505b509350600090505b818110156117205782818151811015156116dc57fe5b9060200190602002015184828151811015156116f457fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302909101909101526001016116c6565b505050919050565b60055481565b33301461173a57600080fd5b600354816032821180159061174f5750818111155b801561175a57508015155b801561176557508115155b151561177057600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff1615156117cb57600080fd5b600082815260208190526040902054829073ffffffffffffffffffffffffffffffffffffffff1615156117fd57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff161561182857600080fd5b8461183281611180565b1561189e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f54585f46554c4c595f434f4e4649524d45440000000000000000000000000000604482015290519081900360640190fd5b600086815260016020818152604080842033808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909317909255905188927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a361191286611180565b15610ed257610ed28642611ee8565b600061192e848484611f33565b9050611939816117ad565b9392505050565b60076020526000908152604090205481565b603281565b60045481565b600033301461196b57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff1615156119a157600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff16156119d657600080fd5b600092505b600354831015611a9b578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611a0b57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611a905783600384815481101515611a4357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611a9b565b6001909201916119db565b73ffffffffffffffffffffffffffffffffffffffff80861660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a260405173ffffffffffffffffffffffffffffffffffffffff8516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b600081815260208190526040812060030154829060ff1615611b8e57600080fd5b82611b9881611180565b1515611c0557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604482015290519081900360640190fd5b600654600085815260076020526040902054859101421015611c8857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f54494d455f4c4f434b5f494e434f4d504c455445000000000000000000000000604482015290519081900360640190fd5b600085815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff97831615610100029790970190911692909204948501879004870282018701909752838152939950611d6b9573ffffffffffffffffffffffffffffffffffffffff90921694909391908390830182828015610e3d5780601f10610e1257610100808354040283529160200191610e3d565b15611da05760405185907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2611df6565b60405185907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b5050505050565b600081600401835110151515611e9a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160448201527f5549524544000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b6000828152600760209081526040918290208390558151838152915184927f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d92908290030190a25050565b60008373ffffffffffffffffffffffffffffffffffffffff81161515611f5857600080fd5b6005546040805160808101825273ffffffffffffffffffffffffffffffffffffffff8881168252602080830189815283850189815260006060860181905287815280845295909520845181547fffffffffffffffffffffffff00000000000000000000000000000000000000001694169390931783555160018301559251805194965091939092611ff092600285019291019061208f565b5060609190910151600390910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b81548183558181111561208a5760008381526020902061208a91810190830161210d565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106120d057805160ff19168380011785556120fd565b828001600101855582156120fd579182015b828111156120fd5782518255916020019190600101906120e2565b5061210992915061210d565b5090565b61143f91905b8082111561210957600081556001016121135600a165627a7a723058202fd87f8e00980d0949ca9979720e573ee554ca541aec8bfc234265edec45f8d10029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x15E JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x25E7C27 DUP2 EQ PUSH2 0x1A0 JUMPI DUP1 PUSH4 0x173825D9 EQ PUSH2 0x1E1 JUMPI DUP1 PUSH4 0x20EA8D86 EQ PUSH2 0x20F JUMPI DUP1 PUSH4 0x2F54BF6E EQ PUSH2 0x227 JUMPI DUP1 PUSH4 0x3411C81C EQ PUSH2 0x269 JUMPI DUP1 PUSH4 0x3589B35C EQ PUSH2 0x29A JUMPI DUP1 PUSH4 0x37BD78A0 EQ PUSH2 0x2B2 JUMPI DUP1 PUSH4 0x54741525 EQ PUSH2 0x2D9 JUMPI DUP1 PUSH4 0x5A1A66AF EQ PUSH2 0x2F8 JUMPI DUP1 PUSH4 0x7065CB48 EQ PUSH2 0x32B JUMPI DUP1 PUSH4 0x784547A7 EQ PUSH2 0x359 JUMPI DUP1 PUSH4 0x7AD28C51 EQ PUSH2 0x371 JUMPI DUP1 PUSH4 0x83250F79 EQ PUSH2 0x389 JUMPI DUP1 PUSH4 0x8B51D13F EQ PUSH2 0x3B7 JUMPI DUP1 PUSH4 0x9ACE38C2 EQ PUSH2 0x3CF JUMPI DUP1 PUSH4 0xA0E67E2B EQ PUSH2 0x4A4 JUMPI DUP1 PUSH4 0xA8ABE69A EQ PUSH2 0x509 JUMPI DUP1 PUSH4 0xB5DC40C3 EQ PUSH2 0x52E JUMPI DUP1 PUSH4 0xB77BF600 EQ PUSH2 0x546 JUMPI DUP1 PUSH4 0xBA51A6DF EQ PUSH2 0x55B JUMPI DUP1 PUSH4 0xC01A8C84 EQ PUSH2 0x573 JUMPI DUP1 PUSH4 0xC6427474 EQ PUSH2 0x58B JUMPI DUP1 PUSH4 0xD38F2D82 EQ PUSH2 0x601 JUMPI DUP1 PUSH4 0xD74F8EDD EQ PUSH2 0x619 JUMPI DUP1 PUSH4 0xDC8452CD EQ PUSH2 0x62E JUMPI DUP1 PUSH4 0xE20056E6 EQ PUSH2 0x643 JUMPI DUP1 PUSH4 0xEE22610B EQ PUSH2 0x677 JUMPI JUMPDEST PUSH1 0x0 CALLVALUE GT ISZERO PUSH2 0x19E JUMPI PUSH1 0x40 DUP1 MLOAD CALLVALUE DUP2 MSTORE SWAP1 MLOAD CALLER SWAP2 PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C SWAP2 SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG2 JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH1 0x4 CALLDATALOAD PUSH2 0x68F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1ED JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x6C4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x21B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0x91B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x233 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x255 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x9F3 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x275 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x255 PUSH1 0x4 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x24 CALLDATALOAD AND PUSH2 0xA08 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0xA28 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH2 0xEDA JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH1 0x4 CALLDATALOAD ISZERO ISZERO PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xEE0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x304 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xF4C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x337 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x100B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x365 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x255 PUSH1 0x4 CALLDATALOAD PUSH2 0x1180 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x37D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0x1211 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x395 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x255 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x1258 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH1 0x4 CALLDATALOAD PUSH2 0x126D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3DB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3E7 PUSH1 0x4 CALLDATALOAD PUSH2 0x12E9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x466 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x44E JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x493 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP6 POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4B0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x4B9 PUSH2 0x13D2 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x4F5 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x4DD JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x515 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x4B9 PUSH1 0x4 CALLDATALOAD PUSH1 0x24 CALLDATALOAD PUSH1 0x44 CALLDATALOAD ISZERO ISZERO PUSH1 0x64 CALLDATALOAD ISZERO ISZERO PUSH2 0x1442 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x53A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x4B9 PUSH1 0x4 CALLDATALOAD PUSH2 0x157B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x552 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH2 0x1728 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x567 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0x172E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x57F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0x17AD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x597 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x2C7 SWAP5 DUP3 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x1921 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x60D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH1 0x4 CALLDATALOAD PUSH2 0x1940 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x625 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH2 0x1952 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x63A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C7 PUSH2 0x1957 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x64F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x195D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x683 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19E PUSH1 0x4 CALLDATALOAD PUSH2 0x1B6D JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x69D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x6D2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x708 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP2 POP JUMPDEST PUSH1 0x3 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP3 LT ISZERO PUSH2 0x88B JUMPI DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x7A8 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x880 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x800 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x3 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x833 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x88B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x756 JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x8BC SWAP1 DUP3 PUSH2 0x2066 JUMP JUMPDEST POP PUSH1 0x3 SLOAD PUSH1 0x4 SLOAD GT ISZERO PUSH2 0x8D5 JUMPI PUSH1 0x3 SLOAD PUSH2 0x8D5 SWAP1 PUSH2 0x172E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x939 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP4 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x965 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD DUP5 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x986 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE MLOAD DUP8 SWAP3 PUSH32 0xF6A317157440607F36269043EB55F1287A5A19BA2216AFEAB88CD46CBCFB88E9 SWAP2 LOG3 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 ADD SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xA49 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 PUSH2 0xA53 DUP2 PUSH2 0x1180 JUMP JUMPDEST ISZERO ISZERO PUSH2 0xAC0 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F4E4F545F46554C4C595F434F4E4649524D454400000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 MSTORE PUSH1 0x8 SWAP1 SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP6 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0xB65 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x18 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x554E524547495354455245445F41535345545F50524F58590000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x72656D6F7665417574686F72697A6564416464726573734174496E6465782861 DUP2 MSTORE PUSH32 0x6464726573732C75696E74323536290000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP3 MLOAD SWAP2 DUP3 SWAP1 SUB PUSH1 0x2F ADD DUP3 KECCAK256 PUSH1 0x2 DUP1 DUP7 ADD DUP1 SLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP5 AND ISZERO MUL ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP2 DUP3 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP1 DUP5 MSTORE PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP2 AND SWAP4 PUSH2 0xCA1 SWAP4 PUSH1 0x0 SWAP4 SWAP1 SWAP3 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xC8E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xC63 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xC8E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xC71 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x1DFD SWAP1 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND EQ PUSH2 0xD2F JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F46554E4354494F4E5F53454C4543544F5200000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP11 POP PUSH2 0xE47 SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xE3D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xE12 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xE3D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xE20 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x1EC5 JUMP JUMPDEST ISZERO PUSH2 0xE7C JUMPI PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0xED2 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP6 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0xF45 JUMPI DUP4 DUP1 ISZERO PUSH2 0xF0D JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0xF31 JUMPI POP DUP3 DUP1 ISZERO PUSH2 0xF31 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0xF3D JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0xEE4 JUMP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0xF58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0xF7B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP7 ISZERO ISZERO SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP3 MLOAD SWAP4 DUP5 MSTORE SWAP1 DUP4 ADD MSTORE DUP1 MLOAD PUSH32 0xDAEF8FF7DC66C5E34EB9C338AAB679D9F427F89868D9228494455A4D982EB2B0 SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x1017 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x104C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x106F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x1 ADD PUSH1 0x4 SLOAD PUSH1 0x32 DUP3 GT ISZERO DUP1 ISZERO PUSH2 0x108C JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1097 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x10A2 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x10AD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE PUSH1 0x3 DUP1 SLOAD SWAP2 DUP3 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0xC2575A0E9E593C00F959F8C92F12DB2869C3395A3B0502D05E2516446F71F85B ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP2 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x120A JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x11AE JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x11EF JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x4 SLOAD DUP3 EQ ISZERO PUSH2 0x1202 JUMPI PUSH1 0x1 SWAP3 POP PUSH2 0x120A JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0x1185 JUMP JUMPDEST POP POP SWAP2 SWAP1 POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x121D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x6 DUP2 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xD1C9101A34FEFF75CCCEF14A28785A0279CB0B49C1F321F21F5F422E746B4377 SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP JUMP JUMPDEST PUSH1 0x8 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x12E3 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x129A JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x12DB JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0x1271 JUMP JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP2 DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP1 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP8 MLOAD PUSH2 0x100 SWAP6 DUP3 AND ISZERO SWAP6 SWAP1 SWAP6 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD AND SWAP2 SWAP1 SWAP2 DIV PUSH1 0x1F DUP2 ADD DUP9 SWAP1 DIV DUP9 MUL DUP5 ADD DUP9 ADD SWAP1 SWAP7 MSTORE DUP6 DUP4 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND SWAP6 SWAP1 SWAP5 SWAP2 SWAP3 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x13BF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1394 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x13BF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x13A2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP PUSH1 0x3 SWAP1 SWAP4 ADD SLOAD SWAP2 SWAP3 POP POP PUSH1 0xFF AND DUP5 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0x1437 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x140C JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x5 SLOAD PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x1474 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0x14FB JUMPI DUP6 DUP1 ISZERO PUSH2 0x14A9 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0x14CD JUMPI POP DUP5 DUP1 ISZERO PUSH2 0x14CD JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0x14F3 JUMPI DUP1 DUP4 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x14E1 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0x1480 JUMP JUMPDEST DUP8 DUP8 SUB PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x1527 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP DUP8 SWAP1 POP JUMPDEST DUP7 DUP2 LT ISZERO PUSH2 0x1570 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1544 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP10 DUP4 SUB DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x155E JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x152E JUMP JUMPDEST POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x15B0 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x1694 JUMPI PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x15E5 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x168C JUMPI PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x162D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD DUP4 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP2 LT PUSH2 0x1660 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0x15BC JUMP JUMPDEST DUP2 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x16BE JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x1720 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x16DC JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x16F4 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 ADD PUSH2 0x16C6 JUMP JUMPDEST POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x5 SLOAD DUP2 JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x173A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 SLOAD DUP2 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH2 0x174F JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x175A JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1765 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x1770 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x4 DUP4 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP5 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xA3F1EE9126A074D9326C682F561767F710E927FAA811F7A99829D49DC421797A SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x17CB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO ISZERO PUSH2 0x17FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP5 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1828 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 PUSH2 0x1832 DUP2 PUSH2 0x1180 JUMP JUMPDEST ISZERO PUSH2 0x189E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F46554C4C595F434F4E4649524D45440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 CALLER DUP1 DUP7 MSTORE SWAP3 MSTORE DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SWAP4 OR SWAP1 SWAP3 SSTORE SWAP1 MLOAD DUP9 SWAP3 PUSH32 0x4A504A94899432A9846E1AA406DCEB1BCFD538BB839071D49D1E5E23F5BE30EF SWAP2 LOG3 PUSH2 0x1912 DUP7 PUSH2 0x1180 JUMP JUMPDEST ISZERO PUSH2 0xED2 JUMPI PUSH2 0xED2 DUP7 TIMESTAMP PUSH2 0x1EE8 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x192E DUP5 DUP5 DUP5 PUSH2 0x1F33 JUMP JUMPDEST SWAP1 POP PUSH2 0x1939 DUP2 PUSH2 0x17AD JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x32 DUP2 JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x196B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x19A1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x19D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST PUSH1 0x3 SLOAD DUP4 LT ISZERO PUSH2 0x1A9B JUMPI DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1A0B JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x1A90 JUMPI DUP4 PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1A43 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x1A9B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x19DB JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 SWAP1 DUP2 AND SWAP1 SWAP2 SSTORE SWAP4 DUP9 AND DUP3 MSTORE DUP1 DUP3 KECCAK256 DUP1 SLOAD SWAP1 SWAP5 AND PUSH1 0x1 OR SWAP1 SWAP4 SSTORE SWAP2 MLOAD SWAP1 SWAP2 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP2 LOG2 PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP1 PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 ADD SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1B8E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 PUSH2 0x1B98 DUP2 PUSH2 0x1180 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x1C05 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F4E4F545F46554C4C595F434F4E4649524D454400000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x6 SLOAD PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP6 SWAP2 ADD TIMESTAMP LT ISZERO PUSH2 0x1C88 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x14 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54494D455F4C4F434B5F494E434F4D504C455445000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP10 POP PUSH2 0x1D6B SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xE3D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xE12 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xE3D JUMP JUMPDEST ISZERO PUSH2 0x1DA0 JUMPI PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0x1DF6 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP5 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x4 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1E9A JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x25 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F345F4C454E4754485F524551 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5549524544000000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 MLOAD PUSH1 0x20 DUP5 ADD PUSH1 0x0 DUP3 DUP8 DUP4 DUP11 DUP13 PUSH2 0x8796 GAS SUB CALL SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP4 SWAP1 SSTORE DUP2 MLOAD DUP4 DUP2 MSTORE SWAP2 MLOAD DUP5 SWAP3 PUSH32 0xB237AFE65F1514FD7EA3F923EA4FE792BDD07000A912B6CD1602A8E7F573C8D SWAP3 SWAP1 DUP3 SWAP1 SUB ADD SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x1F58 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x80 DUP2 ADD DUP3 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 DUP2 AND DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD DUP10 DUP2 MSTORE DUP4 DUP6 ADD DUP10 DUP2 MSTORE PUSH1 0x0 PUSH1 0x60 DUP7 ADD DUP2 SWAP1 MSTORE DUP8 DUP2 MSTORE DUP1 DUP5 MSTORE SWAP6 SWAP1 SWAP6 KECCAK256 DUP5 MLOAD DUP2 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 SSTORE MLOAD PUSH1 0x1 DUP4 ADD SSTORE SWAP3 MLOAD DUP1 MLOAD SWAP5 SWAP7 POP SWAP2 SWAP4 SWAP1 SWAP3 PUSH2 0x1FF0 SWAP3 PUSH1 0x2 DUP6 ADD SWAP3 SWAP2 ADD SWAP1 PUSH2 0x208F JUMP JUMPDEST POP PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD MLOAD PUSH1 0x3 SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x5 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE PUSH1 0x40 MLOAD DUP3 SWAP1 PUSH32 0xC0BA8FE4B176C1714197D43B9CC6BCF797A4A7461C5FE8D0EF6E184AE7601E51 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0x208A JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0x208A SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0x210D JUMP JUMPDEST POP POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x20D0 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x20FD JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x20FD JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x20FD JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x20E2 JUMP JUMPDEST POP PUSH2 0x2109 SWAP3 SWAP2 POP PUSH2 0x210D JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x143F SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x2109 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x2113 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0x2f 0xd8 PUSH32 0x8E00980D0949CA9979720E573EE554CA541AEC8BFC234265EDEC45F8D1002900 ",
+ "sourceMap": "707:3438:25:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2540:1:16;2528:9;:13;2524:61;;;2555:30;;;2575:9;2555:30;;;;2563:10;;2555:30;;;;;;;;;;2524:61;707:3438:25;1050:23:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1050:23:16;;;;;;;;;;;;;;;;;;;;;;;;3715:460;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3715:460:16;;;;;;;6281:291;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6281:291:16;;;;;1004:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1004:40:16;;;;;;;;;;;;;;;;;;;;;;;;;934:64;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;934:64:16;;;;;;;;;3583:560:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3583:560:25;;;;;1057:32:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1057:32:17;;;;;;;;;;;;;;;;;;;;10535:319:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;10535:319:16;;;;;;;;;;;3153:294:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3153:294:25;;;;;;;;;;;3315:277:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3315:277:16;;;;;;;8703:337;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8703:337:16;;;;;2494:194:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2494:194:17;;;;;1055:55:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1055:55:25;;;;;;;10021:252:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;10021:252:16;;;;;879:49;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;879:49:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;879:49:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10938:115;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10938:115:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;10938:115:16;;;;;;;;;;;;;;;;;12156:676;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;12156:676:16;;;;;;;;;;;;;;;11232:575;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;11232:575:16;;;;;1105:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1105:28:16;;;;4997:207;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4997:207:16;;;;;2794:467:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2794:467:17;;;;;5463:244:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5463:244:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5463:244:16;;-1:-1:-1;5463:244:16;;-1:-1:-1;;;;;;;5463:244:16;1096:53:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1096:53:17;;;;;800:41:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;800:41:16;;;;1079:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1079:20:16;;;;4377:449;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4377:449:16;;;;;;;;;;;;3375:516:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3375:516:17;;;;;1050:23:16;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1050:23:16;:::o;3715:460::-;3863:6;1337:10;1359:4;1337:27;1329:36;;;;;;1543:14;;;;;;;:7;:14;;;;;;3805:5;;1543:14;;1535:23;;;;;;;;3826:14;;;3843:5;3826:14;;;:7;:14;;;;;:22;;;;;;3843:5;-1:-1:-1;3858:170:16;3875:6;:13;:17;;3873:19;;3858:170;;;3928:5;3915:18;;:6;3922:1;3915:9;;;;;;;;;;;;;;;;;;;;;;:18;3911:117;;;3965:6;3972:13;;:17;;;;3965:25;;;;;;;;;;;;;;;;3953:6;:9;;3965:25;;;;;3960:1;;3953:9;;;;;;;;;;;;;;:37;;;;;;;;;;;;;;;;;;4008:5;;3911:117;3894:3;;;;;3858:170;;;4037:6;:18;;;;;;;;;:::i;:::-;-1:-1:-1;4080:6:16;:13;4069:8;;:24;4065:74;;;4125:6;:13;4107:32;;:17;:32::i;:::-;4149:19;;;;;;;;;;;1375:1;3715:460;;:::o;6281:291::-;6364:10;1543:14;;;;:7;:14;;;;;;;;1535:23;;;;;;;;1788:28;;;;:13;:28;;;;;;;;6409:10;1788:35;;;;;;;;;6394:13;;6409:10;1788:35;;1780:44;;;;;;;;2044:12;:27;;;;;;;;;;:36;;;6441:13;;2044:36;;2043:37;2035:46;;;;;;6513:5;6470:28;;;:13;:28;;;;;;;;6499:10;6470:40;;;;;;;;:48;;;;;;6528:37;6484:13;;6528:37;;;1834:1;1568;;6281:291;;:::o;1004:40::-;;;;;;;;;;;;;;;:::o;934:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;3583:560:25:-;3816:23;2044:27:16;;;;;;;;;;:36;;;3688:13:25;;2044:36:16;;2043:37;2035:46;;;;;;3726:13:25;1410:26:17;1422:13;1410:11;:26::i;:::-;1389:95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1492:23:25;1518:27;;;;;;;;;;;1599:15;;;;1576:39;;:22;:39;;;;;;;3787:13;;1518:27;1576:39;;1555:110;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1195:60;;;;;;;;;;;;;;;;;;;;;;;;;1696:8;;;;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:69;;;;;:22;;-1:-1:-1;;1195:60:25;;1696:19;;;:8;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:22;;;;:::i;:::-;:69;;;1675:141;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3842:12;:27;;;;;;;;;;;;3879:12;;;:19;;;;3894:4;3879:19;;;;;;3926:15;;3943:9;;;;3954:8;;;;:15;;3912:68;;;3954:15;;;;;3879:19;3954:15;;;;;;;;;;;;3912:68;;;;;;;;;;;;;;;;;;3842:27;;-1:-1:-1;3912:68:25;;3926:15;;;;;3943:9;;3912:68;3954:8;:15;;3912:68;;3954:8;:15;3912:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:13;:68::i;:::-;3908:229;;;4001:24;;4011:13;;4001:24;;;;;3908:229;;;4061:31;;4078:13;;4061:31;;;;;4106:12;;;:20;;;;;;3908:229;1494:1:17;;2091::16;3583:560:25;;;:::o;1057:32:17:-;;;;:::o;10535:319:16:-;10642:10;;10668:179;10685:16;;10683:1;:18;10668:179;;;10727:7;:36;;;;-1:-1:-1;10739:12:16;:15;;;;;;;;;;:24;;;;;10738:25;10727:36;:92;;;;10783:8;:36;;;;-1:-1:-1;10795:12:16;:15;;;;;;;;;;:24;;;;;10783:36;10720:127;;;10846:1;10837:10;;;;10720:127;10703:3;;10668:179;;;10535:319;;;;;:::o;3153:294:25:-;1337:10:16;1359:4;1337:27;1329:36;;;;;;3278:18:25;2158:13:16;;;;;2150:22;;;;;;3312:42:25;;;;;;;:22;:42;;;;;;;;;:57;;;;;;;;;;;;;3384:56;;;;;;;;;;;;;;;;;;;;;1375:1:16;3153:294:25;;:::o;3315:277:16:-;1337:10;1359:4;1337:27;1329:36;;;;;;1450:14;;;;;;;:7;:14;;;;;;3408:5;;1450:14;;1449:15;1441:24;;;;;;3431:5;2158:13;;;;;2150:22;;;;;;3463:6;:13;;;;3479:1;3463:17;3482:8;;839:2;2273:10;:29;;:68;;;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;3506:14;;;;;;;:7;:14;;;;;;:21;;;;3523:4;3506:21;;;;;;3537:6;27:10:-1;;23:18;;;45:23;;3537:18:16;;;;;;;;;;;;3565:20;;;3506:14;3565:20;2182:1;;1475;1375;3315:277;:::o;8703:337::-;8793:4;;;8837:197;8854:6;:13;8852:15;;8837:197;;;8892:28;;;;:13;:28;;;;;8921:6;:9;;8892:28;;;8928:1;;8921:9;;;;;;;;;;;;;;;;;;;;8892:39;;;;;;;;;;;;;;;8888:71;;;8958:1;8949:10;;;;8888:71;8986:8;;8977:5;:17;8973:50;;;9019:4;9012:11;;;;8973:50;8869:3;;8837:197;;;8703:337;;;;;:::o;2494:194:17:-;1337:10:16;1359:4;1337:27;1329:36;;;;;;2594:17:17;:38;;;2647:34;;;;;;;;;;;;;;;;;2494:194;:::o;1055:55:25:-;;;;;;;;;;;;;;;:::o;10021:252:16:-;10120:10;;10146:120;10163:6;:13;10161:15;;10146:120;;;10199:28;;;;:13;:28;;;;;10228:6;:9;;10199:28;;;10235:1;;10228:9;;;;;;;;;;;;;;;;;;;;10199:39;;;;;;;;;;;;;;;10195:71;;;10265:1;10256:10;;;;10195:71;10178:3;;10146:120;;;10021:252;;;;:::o;879:49::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;879:49:16;;;;;;;-1:-1:-1;;879:49:16;;;:::o;10938:115::-;11008:9;11040:6;11033:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10938:115;;:::o;12156:676::-;12281:22;12319:32;12392:10;12416:6;12365:16;;12354:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;12354:28:16;;12319:63;;12405:1;12392:14;;12439:1;12437:3;;12432:250;12444:16;;12442:1;:18;12432:250;;;12486:7;:36;;;;-1:-1:-1;12498:12:16;:15;;;;;;;;;;:24;;;;;12497:25;12486:36;:92;;;;12542:8;:36;;;;-1:-1:-1;12554:12:16;:15;;;;;;;;;;:24;;;;;12542:36;12479:203;;;12638:1;12610:18;12629:5;12610:25;;;;;;;;;;;;;;;;;;:29;12666:1;12657:10;;;;;12479:203;12462:3;;12432:250;;;12725:4;12720:2;:9;12709:21;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;12709:21:16;;12691:39;;12747:4;12745:6;;12740:85;12755:2;12753:1;:4;12740:85;;;12804:18;12823:1;12804:21;;;;;;;;;;;;;;;;;;12776:15;12796:4;12792:1;:8;12776:25;;;;;;;;;;;;;;;;;;:49;12759:3;;12740:85;;;12156:676;;;;;;;;;:::o;11232:575::-;11327:24;11367:34;11442:10;11466:6;11418;:13;;;;11404:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;11404:28:16;;11367:65;;11455:1;11442:14;;11489:1;11487:3;;11482:186;11494:6;:13;11492:15;;11482:186;;;11530:28;;;;:13;:28;;;;;11559:6;:9;;11530:28;;;11566:1;;11559:9;;;;;;;;;;;;;;;;;;;;11530:39;;;;;;;;;;;;;;;11526:142;;;11616:6;:9;;11623:1;;11616:9;;;;;;;;;;;;;;;;11589:24;;11616:9;;;;;11589:17;;11607:5;;11589:24;;;;;;:36;;;;:24;;;;;;;;;;:36;11652:1;11643:10;;;;;11526:142;11509:3;;11482:186;;;11708:5;11694:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;11694:20:16;;11677:37;;11731:1;11729:3;;11724:76;11736:5;11734:1;:7;11724:76;;;11780:17;11798:1;11780:20;;;;;;;;;;;;;;;;;;11760:14;11775:1;11760:17;;;;;;;;;;:40;;;;:17;;;;;;;;;;:40;11743:3;;11724:76;;;11232:575;;;;;;:::o;1105:28::-;;;;:::o;4997:207::-;1337:10;1359:4;1337:27;1329:36;;;;;;5099:6;:13;5114:9;839:2;2273:29;;;;;:68;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;5139:8;:20;;;5169:28;;;;;;;;;;;;;;;;;1375:1;;4997:207;:::o;2794:467:17:-;2880:10;1543:14:16;;;;:7;:14;;;;;;;;1535:23;;;;;;;;1647:12;:27;;;;;;;;;;:39;2918:13:17;;1647:39:16;;:44;;1639:53;;;;;;1924:28;;;;:13;:28;;;;;;;;2969:10:17;1924:35:16;;;;;;;;;2954:13:17;;2969:10;1924:35:16;;1923:36;1915:45;;;;;;3007:13:17;1238:26;1250:13;1238:11;:26::i;:::-;1237:27;1216:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3036:28;;;;3079:4;3036:28;;;;;;;;3065:10;3036:40;;;;;;;;:47;;;;;;;;;;3098:39;;3050:13;;3098:39;;;3151:26;3163:13;3151:11;:26::i;:::-;3147:108;;;3193:51;3213:13;3228:15;3193:19;:51::i;5463:244:16:-;5567:18;5617:40;5632:11;5645:5;5652:4;5617:14;:40::i;:::-;5601:56;;5667:33;5686:13;5667:18;:33::i;:::-;5463:244;;;;;:::o;1096:53:17:-;;;;;;;;;;;;;:::o;800:41:16:-;839:2;800:41;:::o;1079:20::-;;;;:::o;4377:449::-;4548:6;1337:10;1359:4;1337:27;1329:36;;;;;;1543:14;;;;;;;:7;:14;;;;;;4486:5;;1543:14;;1535:23;;;;;;;;1450:14;;;;;;;:7;:14;;;;;;4519:8;;1450:14;;1449:15;1441:24;;;;;;4555:1;4548:8;;4543:149;4560:6;:13;4558:15;;4543:149;;;4609:5;4596:18;;:6;4603:1;4596:9;;;;;;;;;;;;;;;;;;;;;;:18;4592:100;;;4646:8;4634:6;4641:1;4634:9;;;;;;;;;;;;;;;;;;:20;;;;;;;;;;;;;;;;;;4672:5;;4592:100;4575:3;;;;;4543:149;;;4701:14;;;;4718:5;4701:14;;;:7;:14;;;;;;:22;;;;;;;;;4733:17;;;;;;;;:24;;;;;4701:22;4733:24;;;;4767:19;;4701:14;;4767:19;;;4796:23;;;;;;;;;;;1568:1;1375;4377:449;;;:::o;3375:516:17:-;3564:23;2044:27:16;;;;;;;;;;:36;;;3461:13:17;;2044:36:16;;2043:37;2035:46;;;;;;3499:13:17;1410:26;1422:13;1410:11;:26::i;:::-;1389:95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1638:17;;1603:32;;;;:17;:32;;;;;;3535:13;;1603:52;1584:15;:71;;1563:138;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3590:12;:27;;;;;;;;;;;;3627:12;;;:19;;;;3642:4;3627:19;;;;;;3674:15;;3691:9;;;;3702:8;;;;:15;;3660:68;;;3702:15;;;;;3627:19;3702:15;;;;;;;;;;;;3660:68;;;;;;;;;;;;;;;;;;3590:27;;-1:-1:-1;3660:68:17;;3674:15;;;;;3691:9;;3660:68;3702:8;:15;;3660:68;;3702:8;:15;3660:68;;;;;;;;;;;;;;;;;;;;;;;;3656:229;;;3749:24;;3759:13;;3749:24;;;;;3656:229;;;3809:31;;3826:13;;3809:31;;;;;3854:12;;;:20;;;;;;3656:229;1494:1;2091::16;3375:516:17;;;:::o;15593:687:80:-;15713:13;15775:5;15783:1;15775:9;15763:1;:8;:21;;15742:105;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;16021:13:80;15924:2;16021:13;16015:20;16174:66;16162:79;;15593:687::o;7449:1103:16:-;7552:4;7568:11;7627:4;7621:11;7760:2;7754:4;7750:13;8425:1;8406;8298:10;8279:1;8256:5;8227:11;7882:5;7877:3;7873:15;7851:662;7841:672;7449:1103;-1:-1:-1;;;;;;;;7449:1103:16:o;3959:234:17:-;4068:32;;;;:17;:32;;;;;;;;;:51;;;4134:52;;;;;;;4086:13;;4134:52;;;;;;;;;3959:234;;:::o;9373:451:16:-;9505:18;9475:11;2158:13;;;;;2150:22;;;;;;9555:16;;9611:140;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9611:140:16;;;;;;9581:27;;;;;;;;;;:170;;;;;;;;;;;;;;;-1:-1:-1;9581:170:16;;;;;;;9555:16;;-1:-1:-1;9611:140:16;;9581:27;;:170;;;;;;;;;;:::i;:::-;-1:-1:-1;9581:170:16;;;;;;;;;;;;;;;;;;;;;;;9761:16;:21;;-1:-1:-1;9761:21:16;;;9792:25;;9803:13;;9792:25;;-1:-1:-1;;9792:25:16;9373:451;;;;;;:::o;707:3438:25:-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;707:3438:25;;;-1:-1:-1;707:3438:25;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;"
+ }
+ }
+ },
+ "sources": {
+ "protocol/AssetProxyOwner/AssetProxyOwner.sol": {
+ "id": 25
+ },
+ "multisig/MultiSigWalletWithTimeLock.sol": {
+ "id": 17
+ },
+ "multisig/MultiSigWallet.sol": {
+ "id": 16
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ }
+ },
+ "sourceCodes": {
+ "protocol/AssetProxyOwner/AssetProxyOwner.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../multisig/MultiSigWalletWithTimeLock.sol\";\nimport \"../../utils/LibBytes/LibBytes.sol\";\n\n\ncontract AssetProxyOwner is\n MultiSigWalletWithTimeLock\n{\n using LibBytes for bytes;\n\n event AssetProxyRegistration(address assetProxyContract, bool isRegistered);\n\n // Mapping of AssetProxy contract address =>\n // if this contract is allowed to call the AssetProxy's `removeAuthorizedAddressAtIndex` method without a time lock.\n mapping (address => bool) public isAssetProxyRegistered;\n\n bytes4 constant internal REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR = bytes4(keccak256(\"removeAuthorizedAddressAtIndex(address,uint256)\"));\n\n /// @dev Function will revert if the transaction does not call `removeAuthorizedAddressAtIndex`\n /// on an approved AssetProxy contract.\n modifier validRemoveAuthorizedAddressAtIndexTx(uint256 transactionId) {\n Transaction storage txn = transactions[transactionId];\n require(\n isAssetProxyRegistered[txn.destination],\n \"UNREGISTERED_ASSET_PROXY\"\n );\n require(\n txn.data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR,\n \"INVALID_FUNCTION_SELECTOR\"\n );\n _;\n }\n\n /// @dev Contract constructor sets initial owners, required number of confirmations,\n /// time lock, and list of AssetProxy addresses.\n /// @param _owners List of initial owners.\n /// @param _assetProxyContracts Array of AssetProxy contract addresses.\n /// @param _required Number of required confirmations.\n /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.\n constructor (\n address[] memory _owners,\n address[] memory _assetProxyContracts,\n uint256 _required,\n uint256 _secondsTimeLocked\n )\n public\n MultiSigWalletWithTimeLock(_owners, _required, _secondsTimeLocked)\n {\n for (uint256 i = 0; i < _assetProxyContracts.length; i++) {\n address assetProxy = _assetProxyContracts[i];\n require(\n assetProxy != address(0),\n \"INVALID_ASSET_PROXY\"\n );\n isAssetProxyRegistered[assetProxy] = true;\n }\n }\n\n /// @dev Registers or deregisters an AssetProxy to be able to execute\n /// `removeAuthorizedAddressAtIndex` without a timelock.\n /// @param assetProxyContract Address of AssetProxy contract.\n /// @param isRegistered Status of approval for AssetProxy contract.\n function registerAssetProxy(address assetProxyContract, bool isRegistered)\n public\n onlyWallet\n notNull(assetProxyContract)\n {\n isAssetProxyRegistered[assetProxyContract] = isRegistered;\n emit AssetProxyRegistration(assetProxyContract, isRegistered);\n }\n\n /// @dev Allows execution of `removeAuthorizedAddressAtIndex` without time lock.\n /// @param transactionId Transaction ID.\n function executeRemoveAuthorizedAddressAtIndex(uint256 transactionId)\n public\n notExecuted(transactionId)\n fullyConfirmed(transactionId)\n validRemoveAuthorizedAddressAtIndexTx(transactionId)\n {\n Transaction storage txn = transactions[transactionId];\n txn.executed = true;\n if (external_call(txn.destination, txn.value, txn.data.length, txn.data)) {\n emit Execution(transactionId);\n } else {\n emit ExecutionFailure(transactionId);\n txn.executed = false;\n }\n }\n}\n",
+ "multisig/MultiSigWalletWithTimeLock.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./MultiSigWallet.sol\";\n\n\n/// @title Multisignature wallet with time lock- Allows multiple parties to execute a transaction after a time lock has passed.\n/// @author Amir Bandeali - <amir@0xProject.com>\n// solhint-disable not-rely-on-time\ncontract MultiSigWalletWithTimeLock is\n MultiSigWallet\n{\n event ConfirmationTimeSet(uint256 indexed transactionId, uint256 confirmationTime);\n event TimeLockChange(uint256 secondsTimeLocked);\n\n uint256 public secondsTimeLocked;\n\n mapping (uint256 => uint256) public confirmationTimes;\n\n modifier notFullyConfirmed(uint256 transactionId) {\n require(\n !isConfirmed(transactionId),\n \"TX_FULLY_CONFIRMED\"\n );\n _;\n }\n\n modifier fullyConfirmed(uint256 transactionId) {\n require(\n isConfirmed(transactionId),\n \"TX_NOT_FULLY_CONFIRMED\"\n );\n _;\n }\n\n modifier pastTimeLock(uint256 transactionId) {\n require(\n block.timestamp >= confirmationTimes[transactionId] + secondsTimeLocked,\n \"TIME_LOCK_INCOMPLETE\"\n );\n _;\n }\n\n /// @dev Contract constructor sets initial owners, required number of confirmations, and time lock.\n /// @param _owners List of initial owners.\n /// @param _required Number of required confirmations.\n /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.\n constructor (\n address[] _owners,\n uint256 _required,\n uint256 _secondsTimeLocked\n )\n public\n MultiSigWallet(_owners, _required)\n {\n secondsTimeLocked = _secondsTimeLocked;\n }\n\n /// @dev Changes the duration of the time lock for transactions.\n /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.\n function changeTimeLock(uint256 _secondsTimeLocked)\n public\n onlyWallet\n {\n secondsTimeLocked = _secondsTimeLocked;\n emit TimeLockChange(_secondsTimeLocked);\n }\n\n /// @dev Allows an owner to confirm a transaction.\n /// @param transactionId Transaction ID.\n function confirmTransaction(uint256 transactionId)\n public\n ownerExists(msg.sender)\n transactionExists(transactionId)\n notConfirmed(transactionId, msg.sender)\n notFullyConfirmed(transactionId)\n {\n confirmations[transactionId][msg.sender] = true;\n emit Confirmation(msg.sender, transactionId);\n if (isConfirmed(transactionId)) {\n setConfirmationTime(transactionId, block.timestamp);\n }\n }\n\n /// @dev Allows anyone to execute a confirmed transaction.\n /// @param transactionId Transaction ID.\n function executeTransaction(uint256 transactionId)\n public\n notExecuted(transactionId)\n fullyConfirmed(transactionId)\n pastTimeLock(transactionId)\n {\n Transaction storage txn = transactions[transactionId];\n txn.executed = true;\n if (external_call(txn.destination, txn.value, txn.data.length, txn.data)) {\n emit Execution(transactionId);\n } else {\n emit ExecutionFailure(transactionId);\n txn.executed = false;\n }\n }\n\n /// @dev Sets the time of when a submission first passed.\n function setConfirmationTime(uint256 transactionId, uint256 confirmationTime)\n internal\n {\n confirmationTimes[transactionId] = confirmationTime;\n emit ConfirmationTimeSet(transactionId, confirmationTime);\n }\n}\n",
+ "multisig/MultiSigWallet.sol": "// solhint-disable\npragma solidity ^0.4.15;\n\n\n/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.\n/// @author Stefan George - <stefan.george@consensys.net>\ncontract MultiSigWallet {\n\n /*\n * Events\n */\n event Confirmation(address indexed sender, uint indexed transactionId);\n event Revocation(address indexed sender, uint indexed transactionId);\n event Submission(uint indexed transactionId);\n event Execution(uint indexed transactionId);\n event ExecutionFailure(uint indexed transactionId);\n event Deposit(address indexed sender, uint value);\n event OwnerAddition(address indexed owner);\n event OwnerRemoval(address indexed owner);\n event RequirementChange(uint required);\n\n /*\n * Constants\n */\n uint constant public MAX_OWNER_COUNT = 50;\n\n /*\n * Storage\n */\n mapping (uint => Transaction) public transactions;\n mapping (uint => mapping (address => bool)) public confirmations;\n mapping (address => bool) public isOwner;\n address[] public owners;\n uint public required;\n uint public transactionCount;\n\n struct Transaction {\n address destination;\n uint value;\n bytes data;\n bool executed;\n }\n\n /*\n * Modifiers\n */\n modifier onlyWallet() {\n require(msg.sender == address(this));\n _;\n }\n\n modifier ownerDoesNotExist(address owner) {\n require(!isOwner[owner]);\n _;\n }\n\n modifier ownerExists(address owner) {\n require(isOwner[owner]);\n _;\n }\n\n modifier transactionExists(uint transactionId) {\n require(transactions[transactionId].destination != 0);\n _;\n }\n\n modifier confirmed(uint transactionId, address owner) {\n require(confirmations[transactionId][owner]);\n _;\n }\n\n modifier notConfirmed(uint transactionId, address owner) {\n require(!confirmations[transactionId][owner]);\n _;\n }\n\n modifier notExecuted(uint transactionId) {\n require(!transactions[transactionId].executed);\n _;\n }\n\n modifier notNull(address _address) {\n require(_address != 0);\n _;\n }\n\n modifier validRequirement(uint ownerCount, uint _required) {\n require(ownerCount <= MAX_OWNER_COUNT\n && _required <= ownerCount\n && _required != 0\n && ownerCount != 0);\n _;\n }\n\n /// @dev Fallback function allows to deposit ether.\n function()\n payable\n {\n if (msg.value > 0)\n Deposit(msg.sender, msg.value);\n }\n\n /*\n * Public functions\n */\n /// @dev Contract constructor sets initial owners and required number of confirmations.\n /// @param _owners List of initial owners.\n /// @param _required Number of required confirmations.\n function MultiSigWallet(address[] _owners, uint _required)\n public\n validRequirement(_owners.length, _required)\n {\n for (uint i=0; i<_owners.length; i++) {\n require(!isOwner[_owners[i]] && _owners[i] != 0);\n isOwner[_owners[i]] = true;\n }\n owners = _owners;\n required = _required;\n }\n\n /// @dev Allows to add a new owner. Transaction has to be sent by wallet.\n /// @param owner Address of new owner.\n function addOwner(address owner)\n public\n onlyWallet\n ownerDoesNotExist(owner)\n notNull(owner)\n validRequirement(owners.length + 1, required)\n {\n isOwner[owner] = true;\n owners.push(owner);\n OwnerAddition(owner);\n }\n\n /// @dev Allows to remove an owner. Transaction has to be sent by wallet.\n /// @param owner Address of owner.\n function removeOwner(address owner)\n public\n onlyWallet\n ownerExists(owner)\n {\n isOwner[owner] = false;\n for (uint i=0; i<owners.length - 1; i++)\n if (owners[i] == owner) {\n owners[i] = owners[owners.length - 1];\n break;\n }\n owners.length -= 1;\n if (required > owners.length)\n changeRequirement(owners.length);\n OwnerRemoval(owner);\n }\n\n /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.\n /// @param owner Address of owner to be replaced.\n /// @param newOwner Address of new owner.\n function replaceOwner(address owner, address newOwner)\n public\n onlyWallet\n ownerExists(owner)\n ownerDoesNotExist(newOwner)\n {\n for (uint i=0; i<owners.length; i++)\n if (owners[i] == owner) {\n owners[i] = newOwner;\n break;\n }\n isOwner[owner] = false;\n isOwner[newOwner] = true;\n OwnerRemoval(owner);\n OwnerAddition(newOwner);\n }\n\n /// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.\n /// @param _required Number of required confirmations.\n function changeRequirement(uint _required)\n public\n onlyWallet\n validRequirement(owners.length, _required)\n {\n required = _required;\n RequirementChange(_required);\n }\n\n /// @dev Allows an owner to submit and confirm a transaction.\n /// @param destination Transaction target address.\n /// @param value Transaction ether value.\n /// @param data Transaction data payload.\n /// @return Returns transaction ID.\n function submitTransaction(address destination, uint value, bytes data)\n public\n returns (uint transactionId)\n {\n transactionId = addTransaction(destination, value, data);\n confirmTransaction(transactionId);\n }\n\n /// @dev Allows an owner to confirm a transaction.\n /// @param transactionId Transaction ID.\n function confirmTransaction(uint transactionId)\n public\n ownerExists(msg.sender)\n transactionExists(transactionId)\n notConfirmed(transactionId, msg.sender)\n {\n confirmations[transactionId][msg.sender] = true;\n Confirmation(msg.sender, transactionId);\n executeTransaction(transactionId);\n }\n\n /// @dev Allows an owner to revoke a confirmation for a transaction.\n /// @param transactionId Transaction ID.\n function revokeConfirmation(uint transactionId)\n public\n ownerExists(msg.sender)\n confirmed(transactionId, msg.sender)\n notExecuted(transactionId)\n {\n confirmations[transactionId][msg.sender] = false;\n Revocation(msg.sender, transactionId);\n }\n\n /// @dev Allows anyone to execute a confirmed transaction.\n /// @param transactionId Transaction ID.\n function executeTransaction(uint transactionId)\n public\n ownerExists(msg.sender)\n confirmed(transactionId, msg.sender)\n notExecuted(transactionId)\n {\n if (isConfirmed(transactionId)) {\n Transaction storage txn = transactions[transactionId];\n txn.executed = true;\n if (external_call(txn.destination, txn.value, txn.data.length, txn.data))\n Execution(transactionId);\n else {\n ExecutionFailure(transactionId);\n txn.executed = false;\n }\n }\n }\n\n // call has been separated into its own function in order to take advantage\n // of the Solidity's code generator to produce a loop that copies tx.data into memory.\n function external_call(address destination, uint value, uint dataLength, bytes data) internal returns (bool) {\n bool result;\n assembly {\n let x := mload(0x40) // \"Allocate\" memory for output (0x40 is where \"free memory\" pointer is stored by convention)\n let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that\n result := call(\n sub(gas, 34710), // 34710 is the value that solidity is currently emitting\n // It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +\n // callNewAccountGas (25000, in case the destination address does not exist and needs creating)\n destination,\n value,\n d,\n dataLength, // Size of the input (in bytes) - this is what fixes the padding problem\n x,\n 0 // Output is ignored, therefore the output size is zero\n )\n }\n return result;\n }\n\n /// @dev Returns the confirmation status of a transaction.\n /// @param transactionId Transaction ID.\n /// @return Confirmation status.\n function isConfirmed(uint transactionId)\n public\n constant\n returns (bool)\n {\n uint count = 0;\n for (uint i=0; i<owners.length; i++) {\n if (confirmations[transactionId][owners[i]])\n count += 1;\n if (count == required)\n return true;\n }\n }\n\n /*\n * Internal functions\n */\n /// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.\n /// @param destination Transaction target address.\n /// @param value Transaction ether value.\n /// @param data Transaction data payload.\n /// @return Returns transaction ID.\n function addTransaction(address destination, uint value, bytes data)\n internal\n notNull(destination)\n returns (uint transactionId)\n {\n transactionId = transactionCount;\n transactions[transactionId] = Transaction({\n destination: destination,\n value: value,\n data: data,\n executed: false\n });\n transactionCount += 1;\n Submission(transactionId);\n }\n\n /*\n * Web3 call functions\n */\n /// @dev Returns number of confirmations of a transaction.\n /// @param transactionId Transaction ID.\n /// @return Number of confirmations.\n function getConfirmationCount(uint transactionId)\n public\n constant\n returns (uint count)\n {\n for (uint i=0; i<owners.length; i++)\n if (confirmations[transactionId][owners[i]])\n count += 1;\n }\n\n /// @dev Returns total number of transactions after filers are applied.\n /// @param pending Include pending transactions.\n /// @param executed Include executed transactions.\n /// @return Total number of transactions after filters are applied.\n function getTransactionCount(bool pending, bool executed)\n public\n constant\n returns (uint count)\n {\n for (uint i=0; i<transactionCount; i++)\n if ( pending && !transactions[i].executed\n || executed && transactions[i].executed)\n count += 1;\n }\n\n /// @dev Returns list of owners.\n /// @return List of owner addresses.\n function getOwners()\n public\n constant\n returns (address[])\n {\n return owners;\n }\n\n /// @dev Returns array with owner addresses, which confirmed transaction.\n /// @param transactionId Transaction ID.\n /// @return Returns array of owner addresses.\n function getConfirmations(uint transactionId)\n public\n constant\n returns (address[] _confirmations)\n {\n address[] memory confirmationsTemp = new address[](owners.length);\n uint count = 0;\n uint i;\n for (i=0; i<owners.length; i++)\n if (confirmations[transactionId][owners[i]]) {\n confirmationsTemp[count] = owners[i];\n count += 1;\n }\n _confirmations = new address[](count);\n for (i=0; i<count; i++)\n _confirmations[i] = confirmationsTemp[i];\n }\n\n /// @dev Returns list of transaction IDs in defined range.\n /// @param from Index start position of transaction array.\n /// @param to Index end position of transaction array.\n /// @param pending Include pending transactions.\n /// @param executed Include executed transactions.\n /// @return Returns array of transaction IDs.\n function getTransactionIds(uint from, uint to, bool pending, bool executed)\n public\n constant\n returns (uint[] _transactionIds)\n {\n uint[] memory transactionIdsTemp = new uint[](transactionCount);\n uint count = 0;\n uint i;\n for (i=0; i<transactionCount; i++)\n if ( pending && !transactions[i].executed\n || executed && transactions[i].executed)\n {\n transactionIdsTemp[count] = i;\n count += 1;\n }\n _transactionIds = new uint[](to - from);\n for (i=from; i<to; i++)\n _transactionIds[i - from] = transactionIdsTemp[i];\n }\n}",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0xc1a03719bb35a579c3db5156280faf7fea3944100a90a5b2abe1840a4bcfea20",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/DummyERC20Token.json b/packages/contracts/generated-artifacts/DummyERC20Token.json
new file mode 100644
index 000000000..2d60abd28
--- /dev/null
+++ b/packages/contracts/generated-artifacts/DummyERC20Token.json
@@ -0,0 +1,393 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "DummyERC20Token",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "mint",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_target",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "setBalance",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "MAX_MINT_AMOUNT",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_name",
+ "type": "string"
+ },
+ {
+ "name": "_symbol",
+ "type": "string"
+ },
+ {
+ "name": "_decimals",
+ "type": "uint256"
+ },
+ {
+ "name": "_totalSupply",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b5060405162000fa438038062000fa4833981016040908152815160208084015192840151606085015160008054600160a060020a031916331790559285018051909594909401939092916100699160049187019061009c565b50825161007d90600590602086019061009c565b5060069190915533600090815260016020526040902055506101379050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100dd57805160ff191683800117855561010a565b8280016001018555821561010a579182015b8281111561010a5782518255916020019190600101906100ef565b5061011692915061011a565b5090565b61013491905b808211156101165760008155600101610120565b90565b610e5d80620001476000396000f3006080604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd146101a357806323b872dd146101ca578063313ce5671461020157806370a08231146102165780638da5cb5b1461024457806395d89b4114610282578063a0712d6814610297578063a9059cbb146102b1578063dd62ed3e146102e2578063e30443bc14610316578063f2fde38b14610347578063fa9b701814610375575b600080fd5b3480156100e057600080fd5b506100e961038a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012357818101518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016a57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff60043516602435610436565b604080519115158252519081900360200190f35b3480156101af57600080fd5b506101b86104a9565b60408051918252519081900360200190f35b3480156101d657600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356104af565b34801561020d57600080fd5b506101b861076b565b34801561022257600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff60043516610771565b34801561025057600080fd5b50610259610799565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561028e57600080fd5b506100e96107b5565b3480156102a357600080fd5b506102af60043561082e565b005b3480156102bd57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff600435166024356108b4565b3480156102ee57600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff60043581169060243516610a43565b34801561032257600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff60043516602435610a7b565b34801561035357600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff60043516610b91565b34801561038157600080fd5b506101b8610c78565b6004805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b820191906000526020600020905b81548152906001019060200180831161041157829003601f168201915b505050505081565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035490565b73ffffffffffffffffffffffffffffffffffffffff83166000818152600260209081526040808320338452825280832054938352600190915281205490919083111561055c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b828110156105cb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f45524332305f494e53554646494349454e545f414c4c4f57414e434500000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020526040902054838101101561066157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff808516600090815260016020526040808220805487019055918716815220805484900390557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156106fb5773ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020805484900390555b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3506001949350505050565b60065481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b69021e19e0c9bab24000008111156108a757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f56414c55455f544f4f5f4c415247450000000000000000000000000000000000604482015290519081900360640190fd5b6108b13382610c86565b50565b3360009081526001602052604081205482111561093257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604090205482810110156109c857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b3360008181526001602090815260408083208054879003905573ffffffffffffffffffffffffffffffffffffffff871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205490565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610b0257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205480821015610b4e57610b46600354610b418385610d3f565b610d3f565b600355610b67565b610b63600354610b5e8484610d3f565b610db6565b6003555b5073ffffffffffffffffffffffffffffffffffffffff909116600090815260016020526040902055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c1757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116156108b1576000805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905550565b69021e19e0c9bab240000081565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902054610cb7908290610db6565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902055600354610cea9082610db6565b60035560408051828152905173ffffffffffffffffffffffffffffffffffffffff8416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082821115610db057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604482015290519081900360640190fd5b50900390565b600082820183811015610e2a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b93925050505600a165627a7a72305820624fcdc6cc736ae3dea2b69a3afb9d273d92392b7d30ca6c97a59b27d1034df80029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0xFA4 CODESIZE SUB DUP1 PUSH3 0xFA4 DUP4 CODECOPY DUP2 ADD PUSH1 0x40 SWAP1 DUP2 MSTORE DUP2 MLOAD PUSH1 0x20 DUP1 DUP5 ADD MLOAD SWAP3 DUP5 ADD MLOAD PUSH1 0x60 DUP6 ADD MLOAD PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE SWAP3 DUP6 ADD DUP1 MLOAD SWAP1 SWAP6 SWAP5 SWAP1 SWAP5 ADD SWAP4 SWAP1 SWAP3 SWAP2 PUSH2 0x69 SWAP2 PUSH1 0x4 SWAP2 DUP8 ADD SWAP1 PUSH2 0x9C JUMP JUMPDEST POP DUP3 MLOAD PUSH2 0x7D SWAP1 PUSH1 0x5 SWAP1 PUSH1 0x20 DUP7 ADD SWAP1 PUSH2 0x9C JUMP JUMPDEST POP PUSH1 0x6 SWAP2 SWAP1 SWAP2 SSTORE CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE POP PUSH2 0x137 SWAP1 POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xDD JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x10A JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x10A JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x10A JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xEF JUMP JUMPDEST POP PUSH2 0x116 SWAP3 SWAP2 POP PUSH2 0x11A JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x134 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x116 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x120 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0xE5D DUP1 PUSH3 0x147 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xCF JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xD4 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x15E JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x1A3 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1CA JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x201 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x216 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x244 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x282 JUMPI DUP1 PUSH4 0xA0712D68 EQ PUSH2 0x297 JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x2B1 JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x2E2 JUMPI DUP1 PUSH4 0xE30443BC EQ PUSH2 0x316 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x347 JUMPI DUP1 PUSH4 0xFA9B7018 EQ PUSH2 0x375 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xE0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x38A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x123 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x10B JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x150 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x16A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x436 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x4A9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x4AF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x76B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x222 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x771 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x250 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x259 PUSH2 0x799 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x28E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x7B5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH1 0x4 CALLDATALOAD PUSH2 0x82E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x8B4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0xA43 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x322 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0xA7B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x353 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xB91 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x381 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0xC78 JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x411 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE DUP2 DUP5 KECCAK256 DUP7 SWAP1 SSTORE DUP2 MLOAD DUP7 DUP2 MSTORE SWAP2 MLOAD SWAP4 SWAP5 SWAP1 SWAP4 SWAP1 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE DUP3 MSTORE DUP1 DUP4 KECCAK256 SLOAD SWAP4 DUP4 MSTORE PUSH1 0x1 SWAP1 SWAP2 MSTORE DUP2 KECCAK256 SLOAD SWAP1 SWAP2 SWAP1 DUP4 GT ISZERO PUSH2 0x55C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x5CB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F414C4C4F57414E434500000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 DUP2 ADD LT ISZERO PUSH2 0x661 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE SWAP2 DUP8 AND DUP2 MSTORE KECCAK256 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 LT ISZERO PUSH2 0x6FB JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP6 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP PUSH1 0x1 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 GT ISZERO PUSH2 0x8A7 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x56414C55455F544F4F5F4C415247450000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x8B1 CALLER DUP3 PUSH2 0xC86 JUMP JUMPDEST POP JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x932 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x9C8 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP5 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xB02 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP1 DUP3 LT ISZERO PUSH2 0xB4E JUMPI PUSH2 0xB46 PUSH1 0x3 SLOAD PUSH2 0xB41 DUP4 DUP6 PUSH2 0xD3F JUMP JUMPDEST PUSH2 0xD3F JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH2 0xB67 JUMP JUMPDEST PUSH2 0xB63 PUSH1 0x3 SLOAD PUSH2 0xB5E DUP5 DUP5 PUSH2 0xD3F JUMP JUMPDEST PUSH2 0xDB6 JUMP JUMPDEST PUSH1 0x3 SSTORE JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xC17 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x8B1 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 SWAP1 SWAP2 AND OR SWAP1 SSTORE POP JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0xCB7 SWAP1 DUP3 SWAP1 PUSH2 0xDB6 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE PUSH1 0x3 SLOAD PUSH2 0xCEA SWAP1 DUP3 PUSH2 0xDB6 JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP2 PUSH1 0x0 SWAP2 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xDB0 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xE2A JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH3 0x4FCDC6 0xcc PUSH20 0x6AE3DEA2B69A3AFB9D273D92392B7D30CA6C97A5 SWAP12 0x27 0xd1 SUB 0x4d 0xf8 STOP 0x29 ",
+ "sourceMap": "706:1394:55:-;;;928:308;8:9:-1;5:2;;;30:1;27;20:12;5:2;928:308:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;162:5:82;:18;;-1:-1:-1;;;;;;162:18:82;170:10;162:18;;;928:308:55;;;1079:12;;928:308;;;;;;;;;;1079:12;;:4;;:12;;;;:::i;:::-;-1:-1:-1;1101:16:55;;;;:6;;:16;;;;;:::i;:::-;-1:-1:-1;1127:8:55;:20;;;;1203:10;1194:20;;;;:8;:20;;;;;:35;-1:-1:-1;706:1394:55;;-1:-1:-1;706:1394:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;706:1394:55;;;-1:-1:-1;706:1394:55;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd146101a357806323b872dd146101ca578063313ce5671461020157806370a08231146102165780638da5cb5b1461024457806395d89b4114610282578063a0712d6814610297578063a9059cbb146102b1578063dd62ed3e146102e2578063e30443bc14610316578063f2fde38b14610347578063fa9b701814610375575b600080fd5b3480156100e057600080fd5b506100e961038a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012357818101518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016a57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff60043516602435610436565b604080519115158252519081900360200190f35b3480156101af57600080fd5b506101b86104a9565b60408051918252519081900360200190f35b3480156101d657600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356104af565b34801561020d57600080fd5b506101b861076b565b34801561022257600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff60043516610771565b34801561025057600080fd5b50610259610799565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561028e57600080fd5b506100e96107b5565b3480156102a357600080fd5b506102af60043561082e565b005b3480156102bd57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff600435166024356108b4565b3480156102ee57600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff60043581169060243516610a43565b34801561032257600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff60043516602435610a7b565b34801561035357600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff60043516610b91565b34801561038157600080fd5b506101b8610c78565b6004805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b820191906000526020600020905b81548152906001019060200180831161041157829003601f168201915b505050505081565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035490565b73ffffffffffffffffffffffffffffffffffffffff83166000818152600260209081526040808320338452825280832054938352600190915281205490919083111561055c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b828110156105cb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f45524332305f494e53554646494349454e545f414c4c4f57414e434500000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020526040902054838101101561066157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff808516600090815260016020526040808220805487019055918716815220805484900390557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156106fb5773ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020805484900390555b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3506001949350505050565b60065481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b69021e19e0c9bab24000008111156108a757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f56414c55455f544f4f5f4c415247450000000000000000000000000000000000604482015290519081900360640190fd5b6108b13382610c86565b50565b3360009081526001602052604081205482111561093257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604090205482810110156109c857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b3360008181526001602090815260408083208054879003905573ffffffffffffffffffffffffffffffffffffffff871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205490565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610b0257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205480821015610b4e57610b46600354610b418385610d3f565b610d3f565b600355610b67565b610b63600354610b5e8484610d3f565b610db6565b6003555b5073ffffffffffffffffffffffffffffffffffffffff909116600090815260016020526040902055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c1757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116156108b1576000805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905550565b69021e19e0c9bab240000081565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902054610cb7908290610db6565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902055600354610cea9082610db6565b60035560408051828152905173ffffffffffffffffffffffffffffffffffffffff8416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082821115610db057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604482015290519081900360640190fd5b50900390565b600082820183811015610e2a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b93925050505600a165627a7a72305820624fcdc6cc736ae3dea2b69a3afb9d273d92392b7d30ca6c97a59b27d1034df80029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xCF JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xD4 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x15E JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x1A3 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1CA JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x201 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x216 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x244 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x282 JUMPI DUP1 PUSH4 0xA0712D68 EQ PUSH2 0x297 JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x2B1 JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x2E2 JUMPI DUP1 PUSH4 0xE30443BC EQ PUSH2 0x316 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x347 JUMPI DUP1 PUSH4 0xFA9B7018 EQ PUSH2 0x375 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xE0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x38A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x123 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x10B JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x150 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x16A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x436 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x4A9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x4AF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x76B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x222 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x771 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x250 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x259 PUSH2 0x799 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x28E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x7B5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH1 0x4 CALLDATALOAD PUSH2 0x82E JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x8B4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0xA43 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x322 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0xA7B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x353 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xB91 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x381 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0xC78 JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x411 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE DUP2 DUP5 KECCAK256 DUP7 SWAP1 SSTORE DUP2 MLOAD DUP7 DUP2 MSTORE SWAP2 MLOAD SWAP4 SWAP5 SWAP1 SWAP4 SWAP1 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE DUP3 MSTORE DUP1 DUP4 KECCAK256 SLOAD SWAP4 DUP4 MSTORE PUSH1 0x1 SWAP1 SWAP2 MSTORE DUP2 KECCAK256 SLOAD SWAP1 SWAP2 SWAP1 DUP4 GT ISZERO PUSH2 0x55C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x5CB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F414C4C4F57414E434500000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 DUP2 ADD LT ISZERO PUSH2 0x661 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE SWAP2 DUP8 AND DUP2 MSTORE KECCAK256 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 LT ISZERO PUSH2 0x6FB JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP6 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP PUSH1 0x1 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 GT ISZERO PUSH2 0x8A7 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x56414C55455F544F4F5F4C415247450000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x8B1 CALLER DUP3 PUSH2 0xC86 JUMP JUMPDEST POP JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x932 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x9C8 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP5 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xB02 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP1 DUP3 LT ISZERO PUSH2 0xB4E JUMPI PUSH2 0xB46 PUSH1 0x3 SLOAD PUSH2 0xB41 DUP4 DUP6 PUSH2 0xD3F JUMP JUMPDEST PUSH2 0xD3F JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH2 0xB67 JUMP JUMPDEST PUSH2 0xB63 PUSH1 0x3 SLOAD PUSH2 0xB5E DUP5 DUP5 PUSH2 0xD3F JUMP JUMPDEST PUSH2 0xDB6 JUMP JUMPDEST PUSH1 0x3 SSTORE JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xC17 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x8B1 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 SWAP1 SWAP2 AND OR SWAP1 SSTORE POP JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0xCB7 SWAP1 DUP3 SWAP1 PUSH2 0xDB6 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE PUSH1 0x3 SLOAD PUSH2 0xCEA SWAP1 DUP3 PUSH2 0xDB6 JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP2 PUSH1 0x0 SWAP2 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xDB0 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xE2A JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH3 0x4FCDC6 0xcc PUSH20 0x6AE3DEA2B69A3AFB9D273D92392B7D30CA6C97A5 SWAP12 0x27 0xd1 SUB 0x4d 0xf8 STOP 0x29 ",
+ "sourceMap": "706:1394:55:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;777:18;;8:9:-1;5:2;;;30:1;27;20:12;5:2;777:18:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;777:18:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2896:270:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2896:270:70;;;;;;;;;;;;;;;;;;;;;;;;;;;3251:119;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3251:119:70;;;;;;;;;;;;;;;;;;;;1091:804:73;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1091:804:73;;;;;;;;;;;;;;827:23:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;827:23:55;;;;3524:135:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3524:135:70;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;;;;;;;;;;;;;;;;;;;;801::55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;801:20:55;;;;1907:191;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1907:191:55;;;;;;;1055:514:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1055:514:70;;;;;;;;;3867:162;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3867:162:70;;;;;;;;;;;;1406:407:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1406:407:55;;;;;;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;856:65:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;856:65:55;;;;777:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2896:270:70:-;3009:10;2981:4;3001:19;;;:7;:19;;;;;;;;;:29;;;;;;;;;;;:38;;;3054:84;;;;;;;2981:4;;3001:29;;3009:10;;3054:84;;;;;;;;-1:-1:-1;3155:4:70;2896:270;;;;:::o;3251:119::-;3351:12;;3251:119;:::o;1091:804:73:-;1261:14;;;1221:4;1261:14;;;:7;:14;;;;;;;;1276:10;1261:26;;;;;;;;1318:15;;;:8;:15;;;;;;1221:4;;1261:26;1318:25;-1:-1:-1;1318:25:73;1297:98;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1426:19;;;;1405:94;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1556:13;;;;;;;:8;:13;;;;;;1530:22;;;:39;;1509:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1622:13;;;;;;;;:8;:13;;;;;;:23;;;;;;1655:15;;;;;;:25;;;;;;;745:10;1694:20;;1690:87;;;1730:14;;;;;;;:7;:14;;;;;;;;1745:10;1730:26;;;;;;;:36;;;;;;;1690:87;1833:3;1792:74;;1814:5;1792:74;;;1850:6;1792:74;;;;;;;;;;;;;;;;;;-1:-1:-1;1884:4:73;;1091:804;-1:-1:-1;;;;1091:804:73:o;827:23:55:-;;;;:::o;3524:135:70:-;3636:16;;3606:7;3636:16;;;:8;:16;;;;;;;3524:135::o;91:20:82:-;;;;;;:::o;801::55:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1907:191;898:23;1989:25;;;1968:87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2066:25;2072:10;2084:6;2066:5;:25::i;:::-;1907:191;:::o;1055:514:70:-;1186:10;1136:4;1177:20;;;:8;:20;;;;;;:30;-1:-1:-1;1177:30:70;1156:103;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1316:13;;;;;;;:8;:13;;;;;;1290:22;;;:39;;1269:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1391:10;1382:20;;;;:8;:20;;;;;;;;:30;;;;;;;:20;1422:13;;;;;;;;;:23;;;;;;1461:79;;;;;;;1422:13;;1391:10;1461:79;;;;;;;;;;;-1:-1:-1;1558:4:70;1055:514;;;;:::o;3867:162::-;3997:15;;;;3967:7;3997:15;;;:7;:15;;;;;;;;:25;;;;;;;;;;;;;3867:162::o;1406:407:55:-;1508:19;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1530:17:55;;;;;;;:8;:17;;;;;;1561:20;;;1557:214;;;1612:51;1620:12;;1634:28;1642:11;1655:6;1634:7;:28::i;:::-;1612:7;:51::i;:::-;1597:12;:66;1557:214;;;1709:51;1717:12;;1731:28;1739:6;1747:11;1731:7;:28::i;:::-;1709:7;:51::i;:::-;1694:12;:66;1557:214;-1:-1:-1;1780:17:55;;;;;;;;:8;:17;;;;;:26;1406:407::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;;;333:167;:::o;856:65:55:-;898:23;856:65;:::o;935:277:72:-;1042:13;;;;;;;:8;:13;;;;;;1026:30;;1034:6;;1026:7;:30::i;:::-;1010:13;;;;;;;:8;:13;;;;;:46;1089:12;;1081:29;;1103:6;1081:7;:29::i;:::-;1066:12;:44;1126:79;;;;;;;;;;;;1156:1;;1126:79;;;;;;;;;935:277;;:::o;502:208:84:-;588:7;632:6;;;;611:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;698:5:84;;;502:208::o;716:230::-;802:7;837:5;;;873:6;;;;852:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;938:1;716:230;-1:-1:-1;;;716:230:84:o"
+ }
+ }
+ },
+ "sources": {
+ "test/DummyERC20Token/DummyERC20Token.sol": {
+ "id": 55
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ },
+ "tokens/ERC20Token/MintableERC20Token.sol": {
+ "id": 72
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol": {
+ "id": 73
+ },
+ "tokens/ERC20Token/ERC20Token.sol": {
+ "id": 70
+ },
+ "tokens/ERC20Token/IERC20Token.sol": {
+ "id": 71
+ }
+ },
+ "sourceCodes": {
+ "test/DummyERC20Token/DummyERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/Ownable/Ownable.sol\";\nimport \"../../tokens/ERC20Token/MintableERC20Token.sol\";\n\n\ncontract DummyERC20Token is \n Ownable,\n MintableERC20Token\n{\n string public name;\n string public symbol;\n uint256 public decimals;\n uint256 public constant MAX_MINT_AMOUNT = 10000000000000000000000;\n\n constructor (\n string _name,\n string _symbol,\n uint256 _decimals,\n uint256 _totalSupply\n )\n public\n {\n name = _name;\n symbol = _symbol;\n decimals = _decimals;\n _totalSupply = _totalSupply;\n balances[msg.sender] = _totalSupply;\n }\n\n /// @dev Sets the balance of target address\n /// @param _target Address or which balance will be updated\n /// @param _value New balance of target address\n function setBalance(address _target, uint256 _value)\n external\n onlyOwner\n {\n uint256 currBalance = balances[_target];\n if (_value < currBalance) {\n _totalSupply = safeSub(_totalSupply, safeSub(currBalance, _value));\n } else {\n _totalSupply = safeAdd(_totalSupply, safeSub(_value, currBalance));\n }\n balances[_target] = _value;\n }\n\n /// @dev Mints new tokens for sender\n /// @param _value Amount of tokens to mint\n function mint(uint256 _value)\n external\n {\n require(\n _value <= MAX_MINT_AMOUNT,\n \"VALUE_TOO_LARGE\"\n );\n\n _mint(msg.sender, _value);\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n",
+ "tokens/ERC20Token/MintableERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/SafeMath/SafeMath.sol\";\nimport \"./UnlimitedAllowanceERC20Token.sol\";\n\n\ncontract MintableERC20Token is \n SafeMath,\n UnlimitedAllowanceERC20Token\n{\n /// @dev Mints new tokens\n /// @param _to Address of the beneficiary that will own the minted token\n /// @param _value Amount of tokens to mint\n function _mint(address _to, uint256 _value)\n internal\n {\n balances[_to] = safeAdd(_value, balances[_to]);\n _totalSupply = safeAdd(_totalSupply, _value);\n\n emit Transfer(\n address(0),\n _to,\n _value\n );\n }\n\n /// @dev Mints new tokens\n /// @param _owner Owner of tokens that will be burned\n /// @param _value Amount of tokens to burn\n function _burn(address _owner, uint256 _value)\n internal\n {\n balances[_owner] = safeSub(balances[_owner], _value);\n _totalSupply = safeSub(_totalSupply, _value);\n\n emit Transfer(\n _owner,\n address(0),\n _value\n );\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../ERC20Token/ERC20Token.sol\";\n\n\ncontract UnlimitedAllowanceERC20Token is\n ERC20Token\n{\n uint256 constant internal MAX_UINT = 2**256 - 1;\n\n /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717\n /// @param _from Address to transfer from.\n /// @param _to Address to transfer to.\n /// @param _value Amount to transfer.\n /// @return Success of transfer.\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n uint256 allowance = allowed[_from][msg.sender];\n require(\n balances[_from] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n allowance >= _value,\n \"ERC20_INSUFFICIENT_ALLOWANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[_to] += _value;\n balances[_from] -= _value;\n if (allowance < MAX_UINT) {\n allowed[_from][msg.sender] -= _value;\n }\n\n emit Transfer(\n _from,\n _to,\n _value\n );\n\n return true;\n }\n}\n",
+ "tokens/ERC20Token/ERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IERC20Token.sol\";\n\n\ncontract ERC20Token is\n IERC20Token\n{\n mapping (address => uint256) internal balances;\n mapping (address => mapping (address => uint256)) internal allowed;\n\n uint256 internal _totalSupply;\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool)\n {\n require(\n balances[msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[msg.sender] -= _value;\n balances[_to] += _value;\n\n emit Transfer(\n msg.sender,\n _to,\n _value\n );\n\n return true;\n }\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n require(\n balances[_from] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n allowed[_from][msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_ALLOWANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[_to] += _value;\n balances[_from] -= _value;\n allowed[_from][msg.sender] -= _value;\n \n emit Transfer(\n _from,\n _to,\n _value\n );\n \n return true;\n }\n\n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool)\n {\n allowed[msg.sender][_spender] = _value;\n emit Approval(\n msg.sender,\n _spender,\n _value\n );\n return true;\n }\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256)\n {\n return _totalSupply;\n }\n\n /// @dev Query the balance of owner\n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256)\n {\n return balances[_owner];\n }\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256)\n {\n return allowed[_owner][_spender];\n }\n}\n",
+ "tokens/ERC20Token/IERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC20Token {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool);\n \n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n \n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256);\n}\n"
+ },
+ "sourceTreeHashHex": "0xbd0ac9751d7681f909fd16b969568f4dfcee9893e0b084aa1b198b6bb38f8f48",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/DummyERC721Receiver.json b/packages/contracts/generated-artifacts/DummyERC721Receiver.json
new file mode 100644
index 000000000..bd42a0718
--- /dev/null
+++ b/packages/contracts/generated-artifacts/DummyERC721Receiver.json
@@ -0,0 +1,115 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "DummyERC721Receiver",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_operator",
+ "type": "address"
+ },
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ },
+ {
+ "name": "_data",
+ "type": "bytes"
+ }
+ ],
+ "name": "onERC721Received",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "operator",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenId",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "name": "TokenReceived",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b50610210806100206000396000f3006080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663150b7a028114610045575b600080fd5b34801561005157600080fd5b5061008b73ffffffffffffffffffffffffffffffffffffffff600480358216916024803590911691604435916064359081019101356100c0565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b60007f5343d39c46825e39cfee854256354ed1b3837af99997a3242ae29e831889773c8686868686604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001828103825284848281815260200192508082843760405192018290039850909650505050505050a150604080517f6f6e455243373231526563656976656428616464726573732c6164647265737381527f2c75696e743235362c62797465732900000000000000000000000000000000006020820152905190819003602f019020959450505050505600a165627a7a7230582034be73c3f0608cf7d4479c1cac8c85b33f8aadb3b69213e38f72b730304921180029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x210 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x40 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x150B7A02 DUP2 EQ PUSH2 0x45 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x51 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x8B PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 DUP1 CALLDATALOAD DUP3 AND SWAP2 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 SWAP2 AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 PUSH1 0x64 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0xC0 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH32 0x5343D39C46825E39CFEE854256354ED1B3837AF99997A3242AE29E831889773C DUP7 DUP7 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD DUP1 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP5 DUP3 DUP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP9 POP SWAP1 SWAP7 POP POP POP POP POP POP POP LOG1 POP PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C61646472657373 DUP2 MSTORE PUSH32 0x2C75696E743235362C6279746573290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 SWAP6 SWAP5 POP POP POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLVALUE 0xbe PUSH20 0xC3F0608CF7D4479C1CAC8C85B33F8AADB3B69213 0xe3 DUP16 PUSH19 0xB7303049211800290000000000000000000000 ",
+ "sourceMap": "662:1505:58:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;662:1505:58;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663150b7a028114610045575b600080fd5b34801561005157600080fd5b5061008b73ffffffffffffffffffffffffffffffffffffffff600480358216916024803590911691604435916064359081019101356100c0565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b60007f5343d39c46825e39cfee854256354ed1b3837af99997a3242ae29e831889773c8686868686604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001828103825284848281815260200192508082843760405192018290039850909650505050505050a150604080517f6f6e455243373231526563656976656428616464726573732c6164647265737381527f2c75696e743235362c62797465732900000000000000000000000000000000006020820152905190819003602f019020959450505050505600a165627a7a7230582034be73c3f0608cf7d4479c1cac8c85b33f8aadb3b69213e38f72b730304921180029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x40 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x150B7A02 DUP2 EQ PUSH2 0x45 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x51 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x8B PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 DUP1 CALLDATALOAD DUP3 AND SWAP2 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 SWAP2 AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 PUSH1 0x64 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0xC0 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH32 0x5343D39C46825E39CFEE854256354ED1B3837AF99997A3242AE29E831889773C DUP7 DUP7 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD DUP1 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP5 DUP3 DUP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP9 POP SWAP1 SWAP7 POP POP POP POP POP POP POP LOG1 POP PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C61646472657373 DUP2 MSTORE PUSH32 0x2C75696E743235362C6279746573290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 SWAP6 SWAP5 POP POP POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLVALUE 0xbe PUSH20 0xC3F0608CF7D4479C1CAC8C85B33F8AADB3B69213 0xe3 DUP16 PUSH19 0xB7303049211800290000000000000000000000 ",
+ "sourceMap": "662:1505:58:-;;;;;;;;;;;;;;;;;;;;;;;1830:335;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1830:335:58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1993:6;2020:106;2047:9;2070:5;2089:8;2111:5;;2020:106;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2020:106:58;;-1:-1:-1;;;;;;;2020:106:58;-1:-1:-1;849:60:58;;;;;;;;;;;;;;;;;;;;;1830:335;;;;;;;:::o"
+ }
+ }
+ },
+ "sources": {
+ "test/DummyERC721Receiver/DummyERC721Receiver.sol": {
+ "id": 58
+ },
+ "tokens/ERC721Token/IERC721Receiver.sol": {
+ "id": 75
+ }
+ },
+ "sourceCodes": {
+ "test/DummyERC721Receiver/DummyERC721Receiver.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../tokens/ERC721Token/IERC721Receiver.sol\";\n\n\ncontract DummyERC721Receiver is\n IERC721Receiver\n{\n // Function selector for ERC721Receiver.onERC721Received\n // 0x150b7a02\n bytes4 constant internal ERC721_RECEIVED = bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"));\n\n event TokenReceived(\n address operator,\n address from,\n uint256 tokenId,\n bytes data\n );\n\n /// @notice Handle the receipt of an NFT\n /// @dev The ERC721 smart contract calls this function on the recipient\n /// after a `transfer`. This function MAY throw to revert and reject the\n /// transfer. Return of other than the magic value MUST result in the\n /// transaction being reverted.\n /// Note: the contract address is always the message sender.\n /// @param _operator The address which called `safeTransferFrom` function\n /// @param _from The address which previously owned the token\n /// @param _tokenId The NFT identifier which is being transferred\n /// @param _data Additional data with no specified format\n /// @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n /// unless throwing\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes _data\n )\n external\n returns (bytes4)\n {\n emit TokenReceived(\n _operator,\n _from,\n _tokenId,\n _data\n );\n return ERC721_RECEIVED;\n }\n}\n",
+ "tokens/ERC721Token/IERC721Receiver.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC721Receiver {\n\n /// @notice Handle the receipt of an NFT\n /// @dev The ERC721 smart contract calls this function on the recipient\n /// after a `transfer`. This function MAY throw to revert and reject the\n /// transfer. Return of other than the magic value MUST result in the\n /// transaction being reverted.\n /// Note: the contract address is always the message sender.\n /// @param _operator The address which called `safeTransferFrom` function\n /// @param _from The address which previously owned the token\n /// @param _tokenId The NFT identifier which is being transferred\n /// @param _data Additional data with no specified format\n /// @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n /// unless throwing\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes _data\n )\n external\n returns (bytes4);\n}\n"
+ },
+ "sourceTreeHashHex": "0x4dcb73517923ca678184230e5944257743681091865d5300c0fb9b389f0dbfdb",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/DummyERC721Token.json b/packages/contracts/generated-artifacts/DummyERC721Token.json
new file mode 100644
index 000000000..72fa41f7f
--- /dev/null
+++ b/packages/contracts/generated-artifacts/DummyERC721Token.json
@@ -0,0 +1,440 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "DummyERC721Token",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getApproved",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_approved",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "mint",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "safeTransferFrom",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "ownerOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "burn",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_operator",
+ "type": "address"
+ },
+ {
+ "name": "_approved",
+ "type": "bool"
+ }
+ ],
+ "name": "setApprovalForAll",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ },
+ {
+ "name": "_data",
+ "type": "bytes"
+ }
+ ],
+ "name": "safeTransferFrom",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_operator",
+ "type": "address"
+ }
+ ],
+ "name": "isApprovedForAll",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_name",
+ "type": "string"
+ },
+ {
+ "name": "_symbol",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_approved",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_operator",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_approved",
+ "type": "bool"
+ }
+ ],
+ "name": "ApprovalForAll",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040523480156200001157600080fd5b506040516200175e3803806200175e83398101604052805160208083015160008054600160a060020a031916331790559183018051909392909201916200005f91600591908501906200007e565b508051620000759060069060208401906200007e565b50505062000123565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000c157805160ff1916838001178555620000f1565b82800160010185558215620000f1579182015b82811115620000f1578251825591602001919060010190620000d4565b50620000ff92915062000103565b5090565b6200012091905b80821115620000ff57600081556001016200010a565b90565b61162b80620001336000396000f3006080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063081812fc14610169578063095ea7b3146101aa57806323b872dd146101dd57806340c10f191461021457806342842e0e146102455780636352211e1461027c57806370a08231146102945780638da5cb5b146102d457806395d89b41146102e95780639dc29fac146102fe578063a22cb4651461032f578063b88d4fde14610362578063e985e9c5146103a8578063f2fde38b146103f0575b600080fd5b3480156100eb57600080fd5b506100f461041e565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b506101816004356104ca565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101b657600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff600435166024356104f2565b005b3480156101e957600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610616565b34801561022057600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60043516602435610977565b34801561025157600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610985565b34801561028857600080fd5b50610181600435610b50565b3480156102a057600080fd5b506102c273ffffffffffffffffffffffffffffffffffffffff60043516610be9565b60408051918252519081900360200190f35b3480156102e057600080fd5b50610181610c98565b3480156102f557600080fd5b506100f4610cb4565b34801561030a57600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60043516602435610d2d565b34801561033b57600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff600435166024351515610dbd565b34801561036e57600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60048035821691602480359091169160443591606435908101910135610e56565b3480156103b457600080fd5b506103dc73ffffffffffffffffffffffffffffffffffffffff6004358116906024351661103a565b604080519115158252519081900360200190f35b3480156103fc57600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60043516611075565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156104c25780601f10610497576101008083540402835291602001916104c2565b820191906000526020600020905b8154815290600101906020018083116104a557829003601f168201915b505050505081565b60009081526002602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60006104fd82610b50565b90503373ffffffffffffffffffffffffffffffffffffffff821614806105285750610528813361103a565b151561059557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f494e56414c49445f53454e4445520000000000000000000000604482015290519081900360640190fd5b60008281526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000808073ffffffffffffffffffffffffffffffffffffffff8516151561069e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f5a45524f5f544f5f4144445245535300000000000000000000604482015290519081900360640190fd5b6106a784610b50565b925073ffffffffffffffffffffffffffffffffffffffff8681169084161461073057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f4f574e45525f4d49534d415443480000000000000000000000604482015290519081900360640190fd5b33915061073c846104ca565b90508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148061077d575061077d838361103a565b806107b357508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b151561082057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f494e56414c49445f5350454e44455200000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561087157600084815260026020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b600084815260016020818152604080842080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8b8116919091179091558a1684526003909152909120546108db9161115b565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526003602052604080822093909355908716815220546109189060016111d2565b73ffffffffffffffffffffffffffffffffffffffff808716600081815260036020526040808220949094559251879391928a16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050505050565b610981828261124d565b5050565b600080610993858585610616565b833b91506000821115610b4957604080517f150b7a0200000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8781166024830152604482018690526080606483015260006084830181905292519087169263150b7a029260c480820193602093909283900390910190829087803b158015610a3057600080fd5b505af1158015610a44573d6000803e3d6000fd5b505050506040513d6020811015610a5a57600080fd5b5051604080517f6f6e455243373231526563656976656428616464726573732c6164647265737381527f2c75696e743235362c62797465732900000000000000000000000000000000006020820152905190819003602f0190209091507fffffffff00000000000000000000000000000000000000000000000000000000808316911614610b4957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b5050505050565b60008181526001602052604081205473ffffffffffffffffffffffffffffffffffffffff16801515610be357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82161515610c6f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6006805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156104c25780601f10610497576101008083540402835291602001916104c2565b60005473ffffffffffffffffffffffffffffffffffffffff163314610db357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b6109818282611425565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b600080610e64878787610616565b853b91506000821115611031576040517f150b7a02000000000000000000000000000000000000000000000000000000008152336004820181815273ffffffffffffffffffffffffffffffffffffffff8a811660248501526044840189905260806064850190815260848501889052908a169363150b7a0293928c928b928b928b92909160a40184848082843782019150509650505050505050602060405180830381600087803b158015610f1857600080fd5b505af1158015610f2c573d6000803e3d6000fd5b505050506040513d6020811015610f4257600080fd5b5051604080517f6f6e455243373231526563656976656428616464726573732c6164647265737381527f2c75696e743235362c62797465732900000000000000000000000000000000006020820152905190819003602f0190209091507fffffffff0000000000000000000000000000000000000000000000000000000080831691161461103157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260046020908152604080832093909416825291909152205460ff1690565b60005473ffffffffffffffffffffffffffffffffffffffff1633146110fb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561115857600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b6000828211156111cc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604482015290519081900360640190fd5b50900390565b60008282018381101561124657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff831615156112d357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f5a45524f5f544f5f4144445245535300000000000000000000604482015290519081900360640190fd5b5060008181526001602052604090205473ffffffffffffffffffffffffffffffffffffffff16801561136657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4552433732315f4f574e45525f414c52454144595f4558495354530000000000604482015290519081900360640190fd5b600082815260016020818152604080842080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff891690811790915584526003909152909120546113cc916111d2565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408082209390935591518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4505050565b600073ffffffffffffffffffffffffffffffffffffffff831615156114ab57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732315f5a45524f5f4f574e45525f4144445245535300000000000000604482015290519081900360640190fd5b5060008181526001602052604090205473ffffffffffffffffffffffffffffffffffffffff908116908316811461154357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f4f574e45525f4d49534d415443480000000000000000000000604482015290519081900360640190fd5b600082815260016020818152604080842080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff871684526003909152909120546115a59161115b565b73ffffffffffffffffffffffffffffffffffffffff8416600081815260036020526040808220939093559151849291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050505600a165627a7a723058209c21f9a8e080af638c9787eb02480df145aa57e589337e13ac7233be19e958bd0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x175E CODESIZE SUB DUP1 PUSH3 0x175E DUP4 CODECOPY DUP2 ADD PUSH1 0x40 MSTORE DUP1 MLOAD PUSH1 0x20 DUP1 DUP4 ADD MLOAD PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE SWAP2 DUP4 ADD DUP1 MLOAD SWAP1 SWAP4 SWAP3 SWAP1 SWAP3 ADD SWAP2 PUSH3 0x5F SWAP2 PUSH1 0x5 SWAP2 SWAP1 DUP6 ADD SWAP1 PUSH3 0x7E JUMP JUMPDEST POP DUP1 MLOAD PUSH3 0x75 SWAP1 PUSH1 0x6 SWAP1 PUSH1 0x20 DUP5 ADD SWAP1 PUSH3 0x7E JUMP JUMPDEST POP POP POP PUSH3 0x123 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH3 0xC1 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH3 0xF1 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH3 0xF1 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0xF1 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH3 0xD4 JUMP JUMPDEST POP PUSH3 0xFF SWAP3 SWAP2 POP PUSH3 0x103 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x120 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0xFF JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x10A JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x162B DUP1 PUSH3 0x133 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xDA JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xDF JUMPI DUP1 PUSH4 0x81812FC EQ PUSH2 0x169 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x1AA JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1DD JUMPI DUP1 PUSH4 0x40C10F19 EQ PUSH2 0x214 JUMPI DUP1 PUSH4 0x42842E0E EQ PUSH2 0x245 JUMPI DUP1 PUSH4 0x6352211E EQ PUSH2 0x27C JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x294 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x2D4 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x2E9 JUMPI DUP1 PUSH4 0x9DC29FAC EQ PUSH2 0x2FE JUMPI DUP1 PUSH4 0xA22CB465 EQ PUSH2 0x32F JUMPI DUP1 PUSH4 0xB88D4FDE EQ PUSH2 0x362 JUMPI DUP1 PUSH4 0xE985E9C5 EQ PUSH2 0x3A8 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x3F0 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xF4 PUSH2 0x41E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x12E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x116 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x15B JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x175 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x181 PUSH1 0x4 CALLDATALOAD PUSH2 0x4CA JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1B6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x4F2 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1E9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x616 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x220 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x977 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x251 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x985 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x288 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x181 PUSH1 0x4 CALLDATALOAD PUSH2 0xB50 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xBE9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2E0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x181 PUSH2 0xC98 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xF4 PUSH2 0xCB4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x30A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0xD2D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x33B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xDBD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x36E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 DUP1 CALLDATALOAD DUP3 AND SWAP2 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 SWAP2 AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 PUSH1 0x64 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0xE56 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3B4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3DC PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x103A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3FC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x1075 JUMP JUMPDEST PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x4C2 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x497 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x4C2 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x4A5 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x4FD DUP3 PUSH2 0xB50 JUMP JUMPDEST SWAP1 POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND EQ DUP1 PUSH2 0x528 JUMPI POP PUSH2 0x528 DUP2 CALLER PUSH2 0x103A JUMP JUMPDEST ISZERO ISZERO PUSH2 0x595 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454E4445520000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 DUP2 AND SWAP2 DUP3 OR SWAP1 SWAP3 SSTORE SWAP2 MLOAD DUP6 SWAP4 SWAP2 DUP6 AND SWAP2 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP2 LOG4 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND ISZERO ISZERO PUSH2 0x69E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F544F5F4144445245535300000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x6A7 DUP5 PUSH2 0xB50 JUMP JUMPDEST SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 DUP2 AND SWAP1 DUP5 AND EQ PUSH2 0x730 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F4F574E45525F4D49534D415443480000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER SWAP2 POP PUSH2 0x73C DUP5 PUSH2 0x4CA JUMP JUMPDEST SWAP1 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ DUP1 PUSH2 0x77D JUMPI POP PUSH2 0x77D DUP4 DUP4 PUSH2 0x103A JUMP JUMPDEST DUP1 PUSH2 0x7B3 JUMPI POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ JUMPDEST ISZERO ISZERO PUSH2 0x820 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F5350454E44455200000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x871 JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP12 DUP2 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SWAP2 SSTORE DUP11 AND DUP5 MSTORE PUSH1 0x3 SWAP1 SWAP2 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD PUSH2 0x8DB SWAP2 PUSH2 0x115B JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP9 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP4 SWAP1 SWAP4 SSTORE SWAP1 DUP8 AND DUP2 MSTORE KECCAK256 SLOAD PUSH2 0x918 SWAP1 PUSH1 0x1 PUSH2 0x11D2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP8 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP5 SWAP1 SWAP5 SSTORE SWAP3 MLOAD DUP8 SWAP4 SWAP2 SWAP3 DUP11 AND SWAP2 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP2 LOG4 POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0x981 DUP3 DUP3 PUSH2 0x124D JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x993 DUP6 DUP6 DUP6 PUSH2 0x616 JUMP JUMPDEST DUP4 EXTCODESIZE SWAP2 POP PUSH1 0x0 DUP3 GT ISZERO PUSH2 0xB49 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x150B7A0200000000000000000000000000000000000000000000000000000000 DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 DUP2 AND PUSH1 0x24 DUP4 ADD MSTORE PUSH1 0x44 DUP3 ADD DUP7 SWAP1 MSTORE PUSH1 0x80 PUSH1 0x64 DUP4 ADD MSTORE PUSH1 0x0 PUSH1 0x84 DUP4 ADD DUP2 SWAP1 MSTORE SWAP3 MLOAD SWAP1 DUP8 AND SWAP3 PUSH4 0x150B7A02 SWAP3 PUSH1 0xC4 DUP1 DUP3 ADD SWAP4 PUSH1 0x20 SWAP4 SWAP1 SWAP3 DUP4 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 DUP3 SWAP1 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xA30 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xA44 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xA5A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C61646472657373 DUP2 MSTORE PUSH32 0x2C75696E743235362C6279746573290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0xB49 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x17 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454C4543544F52000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO ISZERO PUSH2 0xBE3 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F4F574E4552000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND ISZERO ISZERO PUSH2 0xC6F JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F4F574E4552000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x6 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x4C2 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x497 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x4C2 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xDB3 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x981 DUP3 DUP3 PUSH2 0x1425 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP7 ISZERO ISZERO SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 MLOAD SWAP1 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0x17307EAB39AB6107E8899845AD3D59BD9653F200F220920489CA2B5937696C31 SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xE64 DUP8 DUP8 DUP8 PUSH2 0x616 JUMP JUMPDEST DUP6 EXTCODESIZE SWAP2 POP PUSH1 0x0 DUP3 GT ISZERO PUSH2 0x1031 JUMPI PUSH1 0x40 MLOAD PUSH32 0x150B7A0200000000000000000000000000000000000000000000000000000000 DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD DUP2 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP11 DUP2 AND PUSH1 0x24 DUP6 ADD MSTORE PUSH1 0x44 DUP5 ADD DUP10 SWAP1 MSTORE PUSH1 0x80 PUSH1 0x64 DUP6 ADD SWAP1 DUP2 MSTORE PUSH1 0x84 DUP6 ADD DUP9 SWAP1 MSTORE SWAP1 DUP11 AND SWAP4 PUSH4 0x150B7A02 SWAP4 SWAP3 DUP13 SWAP3 DUP12 SWAP3 DUP12 SWAP3 DUP12 SWAP3 SWAP1 SWAP2 PUSH1 0xA4 ADD DUP5 DUP5 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP7 POP POP POP POP POP POP POP PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xF18 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xF2C JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xF42 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C61646472657373 DUP2 MSTORE PUSH32 0x2C75696E743235362C6279746573290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0x1031 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x17 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454C4543544F52000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x10FB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x1158 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0x11CC JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x1246 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND ISZERO ISZERO PUSH2 0x12D3 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F544F5F4144445245535300000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO PUSH2 0x1366 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1B PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F4F574E45525F414C52454144595F4558495354530000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP10 AND SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP5 MSTORE PUSH1 0x3 SWAP1 SWAP2 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD PUSH2 0x13CC SWAP2 PUSH2 0x11D2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP4 SWAP1 SWAP4 SSTORE SWAP2 MLOAD DUP5 SWAP3 SWAP1 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP1 DUP3 SWAP1 LOG4 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND ISZERO ISZERO PUSH2 0x14AB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F4F574E45525F4144445245535300000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 DUP2 AND SWAP1 DUP4 AND DUP2 EQ PUSH2 0x1543 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F4F574E45525F4D49534D415443480000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP5 MSTORE PUSH1 0x3 SWAP1 SWAP2 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD PUSH2 0x15A5 SWAP2 PUSH2 0x115B JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP4 SWAP1 SWAP4 SSTORE SWAP2 MLOAD DUP5 SWAP3 SWAP2 SWAP1 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP1 DUP4 SWAP1 LOG4 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 SWAP13 0x21 0xf9 0xa8 0xe0 DUP1 0xaf PUSH4 0x8C9787EB MUL 0x48 0xd CALL GASLIMIT 0xaa JUMPI 0xe5 DUP10 CALLER PUSH31 0x13AC7233BE19E958BD00290000000000000000000000000000000000000000 ",
+ "sourceMap": "743:1013:60:-;;;866:139;8:9:-1;5:2;;;30:1;27;20:12;5:2;866:139:60;;;;;;;;;;;;;;;;;;;;;162:5:82;:18;;-1:-1:-1;;;;;;162:18:82;170:10;162:18;;;866:139:60;;;960:12;;866:139;;;;;;;960:12;;:4;;:12;;;;;:::i;:::-;-1:-1:-1;982:16:60;;;;:6;;:16;;;;;:::i;:::-;;866:139;;743:1013;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;743:1013:60;;;-1:-1:-1;743:1013:60;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063081812fc14610169578063095ea7b3146101aa57806323b872dd146101dd57806340c10f191461021457806342842e0e146102455780636352211e1461027c57806370a08231146102945780638da5cb5b146102d457806395d89b41146102e95780639dc29fac146102fe578063a22cb4651461032f578063b88d4fde14610362578063e985e9c5146103a8578063f2fde38b146103f0575b600080fd5b3480156100eb57600080fd5b506100f461041e565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012e578181015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017557600080fd5b506101816004356104ca565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101b657600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff600435166024356104f2565b005b3480156101e957600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610616565b34801561022057600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60043516602435610977565b34801561025157600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610985565b34801561028857600080fd5b50610181600435610b50565b3480156102a057600080fd5b506102c273ffffffffffffffffffffffffffffffffffffffff60043516610be9565b60408051918252519081900360200190f35b3480156102e057600080fd5b50610181610c98565b3480156102f557600080fd5b506100f4610cb4565b34801561030a57600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60043516602435610d2d565b34801561033b57600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff600435166024351515610dbd565b34801561036e57600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60048035821691602480359091169160443591606435908101910135610e56565b3480156103b457600080fd5b506103dc73ffffffffffffffffffffffffffffffffffffffff6004358116906024351661103a565b604080519115158252519081900360200190f35b3480156103fc57600080fd5b506101db73ffffffffffffffffffffffffffffffffffffffff60043516611075565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156104c25780601f10610497576101008083540402835291602001916104c2565b820191906000526020600020905b8154815290600101906020018083116104a557829003601f168201915b505050505081565b60009081526002602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60006104fd82610b50565b90503373ffffffffffffffffffffffffffffffffffffffff821614806105285750610528813361103a565b151561059557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f494e56414c49445f53454e4445520000000000000000000000604482015290519081900360640190fd5b60008281526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000808073ffffffffffffffffffffffffffffffffffffffff8516151561069e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f5a45524f5f544f5f4144445245535300000000000000000000604482015290519081900360640190fd5b6106a784610b50565b925073ffffffffffffffffffffffffffffffffffffffff8681169084161461073057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f4f574e45525f4d49534d415443480000000000000000000000604482015290519081900360640190fd5b33915061073c846104ca565b90508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148061077d575061077d838361103a565b806107b357508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b151561082057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f494e56414c49445f5350454e44455200000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561087157600084815260026020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b600084815260016020818152604080842080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8b8116919091179091558a1684526003909152909120546108db9161115b565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526003602052604080822093909355908716815220546109189060016111d2565b73ffffffffffffffffffffffffffffffffffffffff808716600081815260036020526040808220949094559251879391928a16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050505050565b610981828261124d565b5050565b600080610993858585610616565b833b91506000821115610b4957604080517f150b7a0200000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8781166024830152604482018690526080606483015260006084830181905292519087169263150b7a029260c480820193602093909283900390910190829087803b158015610a3057600080fd5b505af1158015610a44573d6000803e3d6000fd5b505050506040513d6020811015610a5a57600080fd5b5051604080517f6f6e455243373231526563656976656428616464726573732c6164647265737381527f2c75696e743235362c62797465732900000000000000000000000000000000006020820152905190819003602f0190209091507fffffffff00000000000000000000000000000000000000000000000000000000808316911614610b4957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b5050505050565b60008181526001602052604081205473ffffffffffffffffffffffffffffffffffffffff16801515610be357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82161515610c6f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6006805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156104c25780601f10610497576101008083540402835291602001916104c2565b60005473ffffffffffffffffffffffffffffffffffffffff163314610db357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b6109818282611425565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b600080610e64878787610616565b853b91506000821115611031576040517f150b7a02000000000000000000000000000000000000000000000000000000008152336004820181815273ffffffffffffffffffffffffffffffffffffffff8a811660248501526044840189905260806064850190815260848501889052908a169363150b7a0293928c928b928b928b92909160a40184848082843782019150509650505050505050602060405180830381600087803b158015610f1857600080fd5b505af1158015610f2c573d6000803e3d6000fd5b505050506040513d6020811015610f4257600080fd5b5051604080517f6f6e455243373231526563656976656428616464726573732c6164647265737381527f2c75696e743235362c62797465732900000000000000000000000000000000006020820152905190819003602f0190209091507fffffffff0000000000000000000000000000000000000000000000000000000080831691161461103157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260046020908152604080832093909416825291909152205460ff1690565b60005473ffffffffffffffffffffffffffffffffffffffff1633146110fb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561115857600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b6000828211156111cc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604482015290519081900360640190fd5b50900390565b60008282018381101561124657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b9392505050565b600073ffffffffffffffffffffffffffffffffffffffff831615156112d357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f5a45524f5f544f5f4144445245535300000000000000000000604482015290519081900360640190fd5b5060008181526001602052604090205473ffffffffffffffffffffffffffffffffffffffff16801561136657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4552433732315f4f574e45525f414c52454144595f4558495354530000000000604482015290519081900360640190fd5b600082815260016020818152604080842080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff891690811790915584526003909152909120546113cc916111d2565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408082209390935591518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4505050565b600073ffffffffffffffffffffffffffffffffffffffff831615156114ab57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732315f5a45524f5f4f574e45525f4144445245535300000000000000604482015290519081900360640190fd5b5060008181526001602052604090205473ffffffffffffffffffffffffffffffffffffffff908116908316811461154357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f4f574e45525f4d49534d415443480000000000000000000000604482015290519081900360640190fd5b600082815260016020818152604080842080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff871684526003909152909120546115a59161115b565b73ffffffffffffffffffffffffffffffffffffffff8416600081815260036020526040808220939093559151849291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050505600a165627a7a723058209c21f9a8e080af638c9787eb02480df145aa57e589337e13ac7233be19e958bd0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xDA JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xDF JUMPI DUP1 PUSH4 0x81812FC EQ PUSH2 0x169 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x1AA JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1DD JUMPI DUP1 PUSH4 0x40C10F19 EQ PUSH2 0x214 JUMPI DUP1 PUSH4 0x42842E0E EQ PUSH2 0x245 JUMPI DUP1 PUSH4 0x6352211E EQ PUSH2 0x27C JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x294 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x2D4 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x2E9 JUMPI DUP1 PUSH4 0x9DC29FAC EQ PUSH2 0x2FE JUMPI DUP1 PUSH4 0xA22CB465 EQ PUSH2 0x32F JUMPI DUP1 PUSH4 0xB88D4FDE EQ PUSH2 0x362 JUMPI DUP1 PUSH4 0xE985E9C5 EQ PUSH2 0x3A8 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x3F0 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xF4 PUSH2 0x41E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x12E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x116 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x15B JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x175 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x181 PUSH1 0x4 CALLDATALOAD PUSH2 0x4CA JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1B6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x4F2 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1E9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x616 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x220 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x977 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x251 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x985 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x288 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x181 PUSH1 0x4 CALLDATALOAD PUSH2 0xB50 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2C2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xBE9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2E0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x181 PUSH2 0xC98 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xF4 PUSH2 0xCB4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x30A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0xD2D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x33B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xDBD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x36E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 DUP1 CALLDATALOAD DUP3 AND SWAP2 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 SWAP2 AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 PUSH1 0x64 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0xE56 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3B4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3DC PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x103A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3FC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x1075 JUMP JUMPDEST PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x4C2 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x497 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x4C2 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x4A5 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x4FD DUP3 PUSH2 0xB50 JUMP JUMPDEST SWAP1 POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND EQ DUP1 PUSH2 0x528 JUMPI POP PUSH2 0x528 DUP2 CALLER PUSH2 0x103A JUMP JUMPDEST ISZERO ISZERO PUSH2 0x595 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454E4445520000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 DUP2 AND SWAP2 DUP3 OR SWAP1 SWAP3 SSTORE SWAP2 MLOAD DUP6 SWAP4 SWAP2 DUP6 AND SWAP2 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP2 LOG4 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND ISZERO ISZERO PUSH2 0x69E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F544F5F4144445245535300000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x6A7 DUP5 PUSH2 0xB50 JUMP JUMPDEST SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 DUP2 AND SWAP1 DUP5 AND EQ PUSH2 0x730 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F4F574E45525F4D49534D415443480000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER SWAP2 POP PUSH2 0x73C DUP5 PUSH2 0x4CA JUMP JUMPDEST SWAP1 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ DUP1 PUSH2 0x77D JUMPI POP PUSH2 0x77D DUP4 DUP4 PUSH2 0x103A JUMP JUMPDEST DUP1 PUSH2 0x7B3 JUMPI POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ JUMPDEST ISZERO ISZERO PUSH2 0x820 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F5350454E44455200000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x871 JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP12 DUP2 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SWAP2 SSTORE DUP11 AND DUP5 MSTORE PUSH1 0x3 SWAP1 SWAP2 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD PUSH2 0x8DB SWAP2 PUSH2 0x115B JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP9 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP4 SWAP1 SWAP4 SSTORE SWAP1 DUP8 AND DUP2 MSTORE KECCAK256 SLOAD PUSH2 0x918 SWAP1 PUSH1 0x1 PUSH2 0x11D2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP8 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP5 SWAP1 SWAP5 SSTORE SWAP3 MLOAD DUP8 SWAP4 SWAP2 SWAP3 DUP11 AND SWAP2 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP2 LOG4 POP POP POP POP POP POP JUMP JUMPDEST PUSH2 0x981 DUP3 DUP3 PUSH2 0x124D JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x993 DUP6 DUP6 DUP6 PUSH2 0x616 JUMP JUMPDEST DUP4 EXTCODESIZE SWAP2 POP PUSH1 0x0 DUP3 GT ISZERO PUSH2 0xB49 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x150B7A0200000000000000000000000000000000000000000000000000000000 DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 DUP2 AND PUSH1 0x24 DUP4 ADD MSTORE PUSH1 0x44 DUP3 ADD DUP7 SWAP1 MSTORE PUSH1 0x80 PUSH1 0x64 DUP4 ADD MSTORE PUSH1 0x0 PUSH1 0x84 DUP4 ADD DUP2 SWAP1 MSTORE SWAP3 MLOAD SWAP1 DUP8 AND SWAP3 PUSH4 0x150B7A02 SWAP3 PUSH1 0xC4 DUP1 DUP3 ADD SWAP4 PUSH1 0x20 SWAP4 SWAP1 SWAP3 DUP4 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 DUP3 SWAP1 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xA30 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xA44 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xA5A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C61646472657373 DUP2 MSTORE PUSH32 0x2C75696E743235362C6279746573290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0xB49 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x17 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454C4543544F52000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO ISZERO PUSH2 0xBE3 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F4F574E4552000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND ISZERO ISZERO PUSH2 0xC6F JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F4F574E4552000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x6 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x4C2 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x497 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x4C2 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xDB3 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x981 DUP3 DUP3 PUSH2 0x1425 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP7 ISZERO ISZERO SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 MLOAD SWAP1 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0x17307EAB39AB6107E8899845AD3D59BD9653F200F220920489CA2B5937696C31 SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xE64 DUP8 DUP8 DUP8 PUSH2 0x616 JUMP JUMPDEST DUP6 EXTCODESIZE SWAP2 POP PUSH1 0x0 DUP3 GT ISZERO PUSH2 0x1031 JUMPI PUSH1 0x40 MLOAD PUSH32 0x150B7A0200000000000000000000000000000000000000000000000000000000 DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD DUP2 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP11 DUP2 AND PUSH1 0x24 DUP6 ADD MSTORE PUSH1 0x44 DUP5 ADD DUP10 SWAP1 MSTORE PUSH1 0x80 PUSH1 0x64 DUP6 ADD SWAP1 DUP2 MSTORE PUSH1 0x84 DUP6 ADD DUP9 SWAP1 MSTORE SWAP1 DUP11 AND SWAP4 PUSH4 0x150B7A02 SWAP4 SWAP3 DUP13 SWAP3 DUP12 SWAP3 DUP12 SWAP3 DUP12 SWAP3 SWAP1 SWAP2 PUSH1 0xA4 ADD DUP5 DUP5 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP7 POP POP POP POP POP POP POP PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xF18 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xF2C JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xF42 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C61646472657373 DUP2 MSTORE PUSH32 0x2C75696E743235362C6279746573290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0x1031 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x17 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454C4543544F52000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x10FB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x1158 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0x11CC JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x1246 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND ISZERO ISZERO PUSH2 0x12D3 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F544F5F4144445245535300000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO PUSH2 0x1366 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1B PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F4F574E45525F414C52454144595F4558495354530000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP10 AND SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP5 MSTORE PUSH1 0x3 SWAP1 SWAP2 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD PUSH2 0x13CC SWAP2 PUSH2 0x11D2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP4 SWAP1 SWAP4 SSTORE SWAP2 MLOAD DUP5 SWAP3 SWAP1 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP1 DUP3 SWAP1 LOG4 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND ISZERO ISZERO PUSH2 0x14AB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F4F574E45525F4144445245535300000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 DUP2 AND SWAP1 DUP4 AND DUP2 EQ PUSH2 0x1543 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F4F574E45525F4D49534D415443480000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP5 MSTORE PUSH1 0x3 SWAP1 SWAP2 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD PUSH2 0x15A5 SWAP2 PUSH2 0x115B JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP4 SWAP1 SWAP4 SSTORE SWAP2 MLOAD DUP5 SWAP3 SWAP2 SWAP1 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP1 DUP4 SWAP1 LOG4 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 SWAP13 0x21 0xf9 0xa8 0xe0 DUP1 0xaf PUSH4 0x8C9787EB MUL 0x48 0xd CALL GASLIMIT 0xaa JUMPI 0xe5 DUP10 CALLER PUSH31 0x13AC7233BE19E958BD00290000000000000000000000000000000000000000 ",
+ "sourceMap": "743:1013:60:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;815:18;;8:9:-1;5:2;;;30:1;27;20:12;5:2;815:18:60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;815:18:60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8388:140:74;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8388:140:74;;;;;;;;;;;;;;;;;;;;;;;;4378:400;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4378:400:74;;;;;;;;;;;6624:974;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6624:974:74;;;;;;;;;;;;;;1263:103:60;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1263:103:60;;;;;;;;;3326:682:74;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3326:682:74;;;;;;;;;;;;;;7860:257;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7860:257:74;;;;;5783:229;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5783:229:74;;;;;;;;;;;;;;;;;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;839::60;;8:9:-1;5:2;;;30:1;27;20:12;5:2;839:20:60;;;;1627:127;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1627:127:60;;;;;;;;;5184:261:74;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5184:261:74;;;;;;;;;;;2257:706;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2257:706:74;;;;;;;;;;;;;;;;;;;;;;;;;;;;8829:176;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8829:176:74;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;815:18:60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;8388:140:74:-;8472:7;8502:19;;;:9;:19;;;;;;;;;8388:140::o;4378:400::-;4463:13;4479:17;4487:8;4479:7;:17::i;:::-;4463:33;-1:-1:-1;4527:10:74;:19;;;;;:58;;;4550:35;4567:5;4574:10;4550:16;:35::i;:::-;4506:126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4643:19;;;;:9;:19;;;;;;:31;;;;;;;;;;;;;;4689:82;;4643:19;;4689:82;;;;;;;4378:400;;;:::o;6624:974::-;6848:13;;;6772:17;;;;;6751:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6864:17;6872:8;6864:7;:17::i;:::-;6848:33;-1:-1:-1;6912:14:74;;;;;;;;6891:82;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7002:10;6984:28;;7048:21;7060:8;7048:11;:21::i;:::-;7022:47;;7111:5;7100:16;;:7;:16;;;:64;;;;7132:32;7149:5;7156:7;7132:16;:32::i;:::-;7100:106;;;;7199:7;7180:26;;:15;:26;;;7100:106;7079:175;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7269:29;;;;7265:92;;7344:1;7314:19;;;:9;:19;;;;;:32;;;;;;7265:92;7367:16;;;;:6;:16;;;;;;;;:22;;;;;;;;;;;;;;;7425:15;;;;:8;:15;;;;;;;7417:27;;:7;:27::i;:::-;7399:15;;;;;;;;:8;:15;;;;;;:45;;;;7478:13;;;;;;;7470:25;;7493:1;7470:7;:25::i;:::-;7454:13;;;;;;;;:8;:13;;;;;;:41;;;;7515:76;;7573:8;;7454:13;;7515:76;;;;;;6624:974;;;;;;:::o;1263:103:60:-;1339:20;1345:3;1350:8;1339:5;:20::i;:::-;1263:103;;:::o;3326:682:74:-;3550:24;3702:15;3459:80;3485:5;3504:3;3521:8;3459:12;:80::i;:::-;3639:3;3627:16;3607:36;;3685:1;3666:16;:20;3662:340;;;3720:148;;;;;;3775:10;3720:148;;;;:37;:148;;;;;;;;;;;;;;;;;;-1:-1:-1;3720:148:74;;;;;;;;:37;;;;;;:148;;;;;;;;;;;;;;;;;;:37;:148;;;5:2:-1;;;;30:1;27;20:12;5:2;3720:148:74;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3720:148:74;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;3720:148:74;902:60;;;;;;;3720:148;902:60;;;;;;;;;;;;;3720:148;;-1:-1:-1;3907:27:74;;;;;;;3882:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3326:682;;;;;:::o;7860:257::-;7940:7;7979:16;;;:6;:16;;;;;;;;8026:19;;;8005:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8105:5;7860:257;-1:-1:-1;;7860:257:74:o;5783:229::-;5865:7;5909:20;;;;;5888:84;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5989:16:74;;;;;;:8;:16;;;;;;;5783:229::o;91:20:82:-;;;;;;:::o;839::60:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1627:127;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1724:23:60;1730:6;1738:8;1724:5;:23::i;5184:261:74:-;5295:10;5277:29;;;;:17;:29;;;;;;;;;:40;;;;;;;;;;;;:52;;;;;;;;;;;;;5344:94;;;;;;;5277:40;;5295:10;5344:94;;;;;;;;;;;5184:261;;:::o;2257:706::-;2502:24;2654:15;2411:80;2437:5;2456:3;2473:8;2411:12;:80::i;:::-;2591:3;2579:16;2559:36;;2637:1;2618:16;:20;2614:343;;;2672:151;;;;;2727:10;2672:151;;;;;;:37;:151;;;;;;;;;;;;;;;;;;;;;;;;;;:37;;;;;;2727:10;2755:5;;2778:8;;2804:5;;;;2672:151;;;;2804:5;;;;2672:151;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2672:151:74;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2672:151:74;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2672:151:74;902:60;;;;;;;2672:151;902:60;;;;;;;;;;;;;2672:151;;-1:-1:-1;2862:27:74;;;;;;;2837:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2257:706;;;;;;;:::o;8829:176::-;8962:25;;;;8935:4;8962:25;;;:17;:25;;;;;;;;:36;;;;;;;;;;;;;;;8829:176::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;425:69;333:167;:::o;502:208:84:-;588:7;632:6;;;;611:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;698:5:84;;;502:208::o;716:230::-;802:7;837:5;;;873:6;;;;852:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;938:1;716:230;-1:-1:-1;;;716:230:84:o;941:497:77:-;1115:13;1039:17;;;;;1018:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1131:16:77;;;;:6;:16;;;;;;;;1178:19;;1157:93;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1261:16;;;;:6;:16;;;;;;;;:22;;;;;;;;;;;;;1317:13;;:8;:13;;;;;;;1309:25;;:7;:25::i;:::-;1293:13;;;;;;;:8;:13;;;;;;:41;;;;1350:81;;1413:8;;1293:13;1350:81;;1293:13;;1350:81;941:497;;;:::o;1667:512::-;1850:13;1768:20;;;;;1747:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1866:16:77;;;;:6;:16;;;;;;;;;;;1913:15;;;;1892:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2013:1;1986:16;;;:6;:16;;;;;;;;:29;;;;;;;2052:16;;;;:8;:16;;;;;;;2044:28;;:7;:28::i;:::-;2025:16;;;;;;;:8;:16;;;;;;:47;;;;2088:84;;2154:8;;2025:16;;2088:84;;2025:16;;2088:84;1667:512;;;:::o"
+ }
+ }
+ },
+ "sources": {
+ "test/DummyERC721Token/DummyERC721Token.sol": {
+ "id": 60
+ },
+ "tokens/ERC721Token/MintableERC721Token.sol": {
+ "id": 77
+ },
+ "tokens/ERC721Token/ERC721Token.sol": {
+ "id": 74
+ },
+ "tokens/ERC721Token/IERC721Token.sol": {
+ "id": 76
+ },
+ "tokens/ERC721Token/IERC721Receiver.sol": {
+ "id": 75
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ }
+ },
+ "sourceCodes": {
+ "test/DummyERC721Token/DummyERC721Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../tokens/ERC721Token/MintableERC721Token.sol\";\nimport \"../../utils/Ownable/Ownable.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract DummyERC721Token is\n Ownable,\n MintableERC721Token\n{\n string public name;\n string public symbol;\n\n constructor (\n string _name,\n string _symbol\n )\n public\n {\n name = _name;\n symbol = _symbol;\n }\n\n /// @dev Function to mint a new token\n /// Reverts if the given token ID already exists\n /// @param _to Address of the beneficiary that will own the minted token\n /// @param _tokenId ID of the token to be minted by the msg.sender \n function mint(address _to, uint256 _tokenId)\n external\n {\n _mint(_to, _tokenId);\n }\n\n /// @dev Function to burn a token\n /// Reverts if the given token ID doesn't exist or not called by contract owner\n /// @param _owner Owner of token with given token ID\n /// @param _tokenId ID of the token to be burned by the msg.sender\n function burn(address _owner, uint256 _tokenId)\n external\n onlyOwner\n {\n _burn(_owner, _tokenId);\n }\n}\n",
+ "tokens/ERC721Token/MintableERC721Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./ERC721Token.sol\";\n\n\ncontract MintableERC721Token is\n ERC721Token\n{\n /// @dev Function to mint a new token\n /// Reverts if the given token ID already exists\n /// @param _to Address of the beneficiary that will own the minted token\n /// @param _tokenId ID of the token to be minted by the msg.sender \n function _mint(address _to, uint256 _tokenId)\n internal\n {\n require(\n _to != address(0),\n \"ERC721_ZERO_TO_ADDRESS\"\n );\n\n address owner = owners[_tokenId];\n require(\n owner == address(0),\n \"ERC721_OWNER_ALREADY_EXISTS\"\n );\n\n owners[_tokenId] = _to;\n balances[_to] = safeAdd(balances[_to], 1);\n\n emit Transfer(\n address(0),\n _to,\n _tokenId\n );\n }\n\n /// @dev Function to burn a token\n /// Reverts if the given token ID doesn't exist\n /// @param _owner Owner of token with given token ID\n /// @param _tokenId ID of the token to be burned by the msg.sender\n function _burn(address _owner, uint256 _tokenId)\n internal\n {\n require(\n _owner != address(0),\n \"ERC721_ZERO_OWNER_ADDRESS\"\n );\n\n address owner = owners[_tokenId];\n require(\n owner == _owner,\n \"ERC721_OWNER_MISMATCH\"\n );\n\n owners[_tokenId] = address(0);\n balances[_owner] = safeSub(balances[_owner], 1);\n\n emit Transfer(\n _owner,\n address(0),\n _tokenId\n );\n }\n}\n",
+ "tokens/ERC721Token/ERC721Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IERC721Token.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract ERC721Token is\n IERC721Token,\n SafeMath\n{\n // Function selector for ERC721Receiver.onERC721Received\n // 0x150b7a02\n bytes4 constant internal ERC721_RECEIVED = bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"));\n\n // Mapping of tokenId => owner\n mapping (uint256 => address) internal owners;\n\n // Mapping of tokenId => approved address\n mapping (uint256 => address) internal approvals;\n\n // Mapping of owner => number of tokens owned\n mapping (address => uint256) internal balances;\n\n // Mapping of owner => operator => approved\n mapping (address => mapping (address => bool)) internal operatorApprovals;\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT. When transfer is complete, this function\n /// checks if `_to` is a smart contract (code size > 0). If so, it calls\n /// `onERC721Received` on `_to` and throws if the return value is not\n /// `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n /// @param _data Additional data with no specified format, sent in call to `_to`\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes _data\n )\n external\n {\n transferFrom(\n _from,\n _to,\n _tokenId\n );\n\n uint256 receiverCodeSize;\n assembly {\n receiverCodeSize := extcodesize(_to)\n }\n if (receiverCodeSize > 0) {\n bytes4 selector = IERC721Receiver(_to).onERC721Received(\n msg.sender,\n _from,\n _tokenId,\n _data\n );\n require(\n selector == ERC721_RECEIVED,\n \"ERC721_INVALID_SELECTOR\"\n );\n }\n }\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev This works identically to the other function with an extra data parameter,\n /// except this function just sets data to \"\".\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n external\n {\n transferFrom(\n _from,\n _to,\n _tokenId\n );\n\n uint256 receiverCodeSize;\n assembly {\n receiverCodeSize := extcodesize(_to)\n }\n if (receiverCodeSize > 0) {\n bytes4 selector = IERC721Receiver(_to).onERC721Received(\n msg.sender,\n _from,\n _tokenId,\n \"\"\n );\n require(\n selector == ERC721_RECEIVED,\n \"ERC721_INVALID_SELECTOR\"\n );\n }\n }\n\n /// @notice Change or reaffirm the approved address for an NFT\n /// @dev The zero address indicates there is no approved address.\n /// Throws unless `msg.sender` is the current NFT owner, or an authorized\n /// operator of the current owner.\n /// @param _approved The new approved NFT controller\n /// @param _tokenId The NFT to approve\n function approve(address _approved, uint256 _tokenId)\n external\n {\n address owner = ownerOf(_tokenId);\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721_INVALID_SENDER\"\n );\n\n approvals[_tokenId] = _approved;\n emit Approval(\n owner,\n _approved,\n _tokenId\n );\n }\n\n /// @notice Enable or disable approval for a third party (\"operator\") to manage\n /// all of `msg.sender`'s assets\n /// @dev Emits the ApprovalForAll event. The contract MUST allow\n /// multiple operators per owner.\n /// @param _operator Address to add to the set of authorized operators\n /// @param _approved True if the operator is approved, false to revoke approval\n function setApprovalForAll(address _operator, bool _approved)\n external\n {\n operatorApprovals[msg.sender][_operator] = _approved;\n emit ApprovalForAll(\n msg.sender,\n _operator,\n _approved\n );\n }\n \n /// @notice Count all NFTs assigned to an owner\n /// @dev NFTs assigned to the zero address are considered invalid, and this\n /// function throws for queries about the zero address.\n /// @param _owner An address for whom to query the balance\n /// @return The number of NFTs owned by `_owner`, possibly zero\n function balanceOf(address _owner)\n external\n view\n returns (uint256)\n {\n require(\n _owner != address(0),\n \"ERC721_ZERO_OWNER\"\n );\n return balances[_owner];\n }\n\n /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n /// THEY MAY BE PERMANENTLY LOST\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function transferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n public\n {\n require(\n _to != address(0),\n \"ERC721_ZERO_TO_ADDRESS\"\n );\n\n address owner = ownerOf(_tokenId);\n require(\n _from == owner,\n \"ERC721_OWNER_MISMATCH\"\n );\n\n address spender = msg.sender;\n address approvedAddress = getApproved(_tokenId);\n require(\n spender == owner ||\n isApprovedForAll(owner, spender) ||\n approvedAddress == spender,\n \"ERC721_INVALID_SPENDER\"\n );\n\n if (approvedAddress != address(0)) {\n approvals[_tokenId] = address(0);\n }\n\n owners[_tokenId] = _to;\n balances[_from] = safeSub(balances[_from], 1);\n balances[_to] = safeAdd(balances[_to], 1);\n \n emit Transfer(\n _from,\n _to,\n _tokenId\n );\n }\n\n /// @notice Find the owner of an NFT\n /// @dev NFTs assigned to zero address are considered invalid, and queries\n /// about them do throw.\n /// @param _tokenId The identifier for an NFT\n /// @return The address of the owner of the NFT\n function ownerOf(uint256 _tokenId)\n public\n view\n returns (address)\n {\n address owner = owners[_tokenId];\n require(\n owner != address(0),\n \"ERC721_ZERO_OWNER\"\n );\n return owner;\n }\n\n /// @notice Get the approved address for a single NFT\n /// @dev Throws if `_tokenId` is not a valid NFT.\n /// @param _tokenId The NFT to find the approved address for\n /// @return The approved address for this NFT, or the zero address if there is none\n function getApproved(uint256 _tokenId)\n public\n view\n returns (address)\n {\n return approvals[_tokenId];\n }\n\n /// @notice Query if an address is an authorized operator for another address\n /// @param _owner The address that owns the NFTs\n /// @param _operator The address that acts on behalf of the owner\n /// @return True if `_operator` is an approved operator for `_owner`, false otherwise\n function isApprovedForAll(address _owner, address _operator)\n public\n view\n returns (bool)\n {\n return operatorApprovals[_owner][_operator];\n }\n}\n",
+ "tokens/ERC721Token/IERC721Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC721Token {\n\n /// @dev This emits when ownership of any NFT changes by any mechanism.\n /// This event emits when NFTs are created (`from` == 0) and destroyed\n /// (`to` == 0). Exception: during contract creation, any number of NFTs\n /// may be created and assigned without emitting Transfer. At the time of\n /// any transfer, the approved address for that NFT (if any) is reset to none.\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 indexed _tokenId\n );\n\n /// @dev This emits when the approved address for an NFT is changed or\n /// reaffirmed. The zero address indicates there is no approved address.\n /// When a Transfer event emits, this also indicates that the approved\n /// address for that NFT (if any) is reset to none.\n event Approval(\n address indexed _owner,\n address indexed _approved,\n uint256 indexed _tokenId\n );\n\n /// @dev This emits when an operator is enabled or disabled for an owner.\n /// The operator can manage all NFTs of the owner.\n event ApprovalForAll(\n address indexed _owner,\n address indexed _operator,\n bool _approved\n );\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// perator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT. When transfer is complete, this function\n /// checks if `_to` is a smart contract (code size > 0). If so, it calls\n /// `onERC721Received` on `_to` and throws if the return value is not\n /// `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n /// @param _data Additional data with no specified format, sent in call to `_to`\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes _data\n )\n external;\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev This works identically to the other function with an extra data parameter,\n /// except this function just sets data to \"\".\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n external;\n\n /// @notice Change or reaffirm the approved address for an NFT\n /// @dev The zero address indicates there is no approved address.\n /// Throws unless `msg.sender` is the current NFT owner, or an authorized\n /// operator of the current owner.\n /// @param _approved The new approved NFT controller\n /// @param _tokenId The NFT to approve\n function approve(address _approved, uint256 _tokenId)\n external;\n\n /// @notice Enable or disable approval for a third party (\"operator\") to manage\n /// all of `msg.sender`'s assets\n /// @dev Emits the ApprovalForAll event. The contract MUST allow\n /// multiple operators per owner.\n /// @param _operator Address to add to the set of authorized operators\n /// @param _approved True if the operator is approved, false to revoke approval\n function setApprovalForAll(address _operator, bool _approved)\n external;\n\n /// @notice Count all NFTs assigned to an owner\n /// @dev NFTs assigned to the zero address are considered invalid, and this\n /// function throws for queries about the zero address.\n /// @param _owner An address for whom to query the balance\n /// @return The number of NFTs owned by `_owner`, possibly zero\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n /// THEY MAY BE PERMANENTLY LOST\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function transferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n public;\n\n /// @notice Find the owner of an NFT\n /// @dev NFTs assigned to zero address are considered invalid, and queries\n /// about them do throw.\n /// @param _tokenId The identifier for an NFT\n /// @return The address of the owner of the NFT\n function ownerOf(uint256 _tokenId)\n public\n view\n returns (address);\n\n /// @notice Get the approved address for a single NFT\n /// @dev Throws if `_tokenId` is not a valid NFT.\n /// @param _tokenId The NFT to find the approved address for\n /// @return The approved address for this NFT, or the zero address if there is none\n function getApproved(uint256 _tokenId) \n public\n view\n returns (address);\n \n /// @notice Query if an address is an authorized operator for another address\n /// @param _owner The address that owns the NFTs\n /// @param _operator The address that acts on behalf of the owner\n /// @return True if `_operator` is an approved operator for `_owner`, false otherwise\n function isApprovedForAll(address _owner, address _operator)\n public\n view\n returns (bool);\n}\n",
+ "tokens/ERC721Token/IERC721Receiver.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC721Receiver {\n\n /// @notice Handle the receipt of an NFT\n /// @dev The ERC721 smart contract calls this function on the recipient\n /// after a `transfer`. This function MAY throw to revert and reject the\n /// transfer. Return of other than the magic value MUST result in the\n /// transaction being reverted.\n /// Note: the contract address is always the message sender.\n /// @param _operator The address which called `safeTransferFrom` function\n /// @param _from The address which previously owned the token\n /// @param _tokenId The NFT identifier which is being transferred\n /// @param _data Additional data with no specified format\n /// @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n /// unless throwing\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes _data\n )\n external\n returns (bytes4);\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n"
+ },
+ "sourceTreeHashHex": "0x7c03657f568331e5dbdd3212ed6be6074760e096f601ee84ad8c0fa46acd293f",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/DummyMultipleReturnERC20Token.json b/packages/contracts/generated-artifacts/DummyMultipleReturnERC20Token.json
new file mode 100644
index 000000000..de60fb930
--- /dev/null
+++ b/packages/contracts/generated-artifacts/DummyMultipleReturnERC20Token.json
@@ -0,0 +1,397 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "DummyMultipleReturnERC20Token",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "mint",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_target",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "setBalance",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "MAX_MINT_AMOUNT",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_name",
+ "type": "string"
+ },
+ {
+ "name": "_symbol",
+ "type": "string"
+ },
+ {
+ "name": "_decimals",
+ "type": "uint256"
+ },
+ {
+ "name": "_totalSupply",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b50604051610d68380380610d68833981016040908152815160208084015192840151606085015160008054600160a060020a03191633179055928501805190959490940193909291859185918591859161006f916004918701906100a6565b5082516100839060059060208601906100a6565b506006919091553360009081526001602052604090205550610141945050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100e757805160ff1916838001178555610114565b82800160010185558215610114579182015b828111156101145782518255916020019190600101906100f9565b50610120929150610124565b5090565b61013e91905b80821115610120576000815560010161012a565b90565b610c18806101506000396000f3006080604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd146101a357806323b872dd146101ca578063313ce5671461020157806370a08231146102165780638da5cb5b1461024457806395d89b4114610282578063a0712d6814610297578063a9059cbb146102b1578063dd62ed3e146102e2578063e30443bc14610316578063f2fde38b14610347578063fa9b701814610375575b600080fd5b3480156100e057600080fd5b506100e961038a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012357818101518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016a57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff60043516602435610436565b604080519115158252519081900360200190f35b3480156101af57600080fd5b506101b86104a9565b60408051918252519081900360200190f35b3480156101d657600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356104af565b34801561020d57600080fd5b506101b8610526565b34801561022257600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff6004351661052c565b34801561025057600080fd5b50610259610554565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561028e57600080fd5b506100e9610570565b3480156102a357600080fd5b506102af6004356105e9565b005b3480156102bd57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff6004351660243561066f565b3480156102ee57600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff600435811690602435166107fe565b34801561032257600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff60043516602435610836565b34801561035357600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff6004351661094c565b34801561038157600080fd5b506101b8610a33565b6004805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b820191906000526020600020905b81548152906001019060200180831161041157829003601f168201915b505050505081565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035490565b60008273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001600052600160205260406000f35b60065481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b69021e19e0c9bab240000081111561066257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f56414c55455f544f4f5f4c415247450000000000000000000000000000000000604482015290519081900360640190fd5b61066c3382610a41565b50565b336000908152600160205260408120548211156106ed57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054828101101561078357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b3360008181526001602090815260408083208054879003905573ffffffffffffffffffffffffffffffffffffffff871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205490565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146108bd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205480821015610909576109016003546108fc8385610afa565b610afa565b600355610922565b61091e6003546109198484610afa565b610b71565b6003555b5073ffffffffffffffffffffffffffffffffffffffff909116600090815260016020526040902055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561066c576000805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905550565b69021e19e0c9bab240000081565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902054610a72908290610b71565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902055600354610aa59082610b71565b60035560408051828152905173ffffffffffffffffffffffffffffffffffffffff8416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082821115610b6b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604482015290519081900360640190fd5b50900390565b600082820183811015610be557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b93925050505600a165627a7a723058204b9a360b71fa72973a0cb91d0b0eff3f0706340b808e79147c079c446632b7e10029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0xD68 CODESIZE SUB DUP1 PUSH2 0xD68 DUP4 CODECOPY DUP2 ADD PUSH1 0x40 SWAP1 DUP2 MSTORE DUP2 MLOAD PUSH1 0x20 DUP1 DUP5 ADD MLOAD SWAP3 DUP5 ADD MLOAD PUSH1 0x60 DUP6 ADD MLOAD PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE SWAP3 DUP6 ADD DUP1 MLOAD SWAP1 SWAP6 SWAP5 SWAP1 SWAP5 ADD SWAP4 SWAP1 SWAP3 SWAP2 DUP6 SWAP2 DUP6 SWAP2 DUP6 SWAP2 DUP6 SWAP2 PUSH2 0x6F SWAP2 PUSH1 0x4 SWAP2 DUP8 ADD SWAP1 PUSH2 0xA6 JUMP JUMPDEST POP DUP3 MLOAD PUSH2 0x83 SWAP1 PUSH1 0x5 SWAP1 PUSH1 0x20 DUP7 ADD SWAP1 PUSH2 0xA6 JUMP JUMPDEST POP PUSH1 0x6 SWAP2 SWAP1 SWAP2 SSTORE CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE POP PUSH2 0x141 SWAP5 POP POP POP POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xE7 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x114 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x114 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x114 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xF9 JUMP JUMPDEST POP PUSH2 0x120 SWAP3 SWAP2 POP PUSH2 0x124 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x13E SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x120 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x12A JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0xC18 DUP1 PUSH2 0x150 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xCF JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xD4 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x15E JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x1A3 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1CA JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x201 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x216 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x244 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x282 JUMPI DUP1 PUSH4 0xA0712D68 EQ PUSH2 0x297 JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x2B1 JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x2E2 JUMPI DUP1 PUSH4 0xE30443BC EQ PUSH2 0x316 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x347 JUMPI DUP1 PUSH4 0xFA9B7018 EQ PUSH2 0x375 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xE0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x38A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x123 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x10B JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x150 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x16A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x436 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x4A9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x4AF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x526 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x222 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x52C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x250 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x259 PUSH2 0x554 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x28E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x570 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH1 0x4 CALLDATALOAD PUSH2 0x5E9 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x66F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x7FE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x322 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x836 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x353 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x94C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x381 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0xA33 JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x411 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE DUP2 DUP5 KECCAK256 DUP7 SWAP1 SSTORE DUP2 MLOAD DUP7 DUP2 MSTORE SWAP2 MLOAD SWAP4 SWAP5 SWAP1 SWAP4 SWAP1 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP5 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 PUSH1 0x1 PUSH1 0x0 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 PUSH1 0x0 RETURN JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 GT ISZERO PUSH2 0x662 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x56414C55455F544F4F5F4C415247450000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x66C CALLER DUP3 PUSH2 0xA41 JUMP JUMPDEST POP JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x6ED JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x783 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP5 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x8BD JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP1 DUP3 LT ISZERO PUSH2 0x909 JUMPI PUSH2 0x901 PUSH1 0x3 SLOAD PUSH2 0x8FC DUP4 DUP6 PUSH2 0xAFA JUMP JUMPDEST PUSH2 0xAFA JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH2 0x922 JUMP JUMPDEST PUSH2 0x91E PUSH1 0x3 SLOAD PUSH2 0x919 DUP5 DUP5 PUSH2 0xAFA JUMP JUMPDEST PUSH2 0xB71 JUMP JUMPDEST PUSH1 0x3 SSTORE JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x9D2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x66C JUMPI PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 SWAP1 SWAP2 AND OR SWAP1 SSTORE POP JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0xA72 SWAP1 DUP3 SWAP1 PUSH2 0xB71 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE PUSH1 0x3 SLOAD PUSH2 0xAA5 SWAP1 DUP3 PUSH2 0xB71 JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP2 PUSH1 0x0 SWAP2 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xB6B JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xBE5 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0x4b SWAP11 CALLDATASIZE SIGNEXTEND PUSH18 0xFA72973A0CB91D0B0EFF3F0706340B808E79 EQ PUSH29 0x79C446632B7E100290000000000000000000000000000000000000000 ",
+ "sourceMap": "674:1072:56:-;;;742:266;8:9:-1;5:2;;;30:1;27;20:12;5:2;742:266:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;162:5:82;:18;;-1:-1:-1;;;;;;162:18:82;170:10;162:18;;;742:266:56;;;1079:12:55;;742:266:56;;;;;;;;;;;;;;;;;;1079:12:55;;:4;;:12;;;;:::i;:::-;-1:-1:-1;1101:16:55;;;;:6;;:16;;;;;:::i;:::-;-1:-1:-1;1127:8:55;:20;;;;1203:10;1194:20;;;;:8;:20;;;;;:35;-1:-1:-1;674:1072:56;;-1:-1:-1;;;;;674:1072:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;674:1072:56;;;-1:-1:-1;674:1072:56;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd146101a357806323b872dd146101ca578063313ce5671461020157806370a08231146102165780638da5cb5b1461024457806395d89b4114610282578063a0712d6814610297578063a9059cbb146102b1578063dd62ed3e146102e2578063e30443bc14610316578063f2fde38b14610347578063fa9b701814610375575b600080fd5b3480156100e057600080fd5b506100e961038a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012357818101518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016a57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff60043516602435610436565b604080519115158252519081900360200190f35b3480156101af57600080fd5b506101b86104a9565b60408051918252519081900360200190f35b3480156101d657600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356104af565b34801561020d57600080fd5b506101b8610526565b34801561022257600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff6004351661052c565b34801561025057600080fd5b50610259610554565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561028e57600080fd5b506100e9610570565b3480156102a357600080fd5b506102af6004356105e9565b005b3480156102bd57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff6004351660243561066f565b3480156102ee57600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff600435811690602435166107fe565b34801561032257600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff60043516602435610836565b34801561035357600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff6004351661094c565b34801561038157600080fd5b506101b8610a33565b6004805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b820191906000526020600020905b81548152906001019060200180831161041157829003601f168201915b505050505081565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035490565b60008273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001600052600160205260406000f35b60065481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b69021e19e0c9bab240000081111561066257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f56414c55455f544f4f5f4c415247450000000000000000000000000000000000604482015290519081900360640190fd5b61066c3382610a41565b50565b336000908152600160205260408120548211156106ed57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054828101101561078357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b3360008181526001602090815260408083208054879003905573ffffffffffffffffffffffffffffffffffffffff871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205490565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146108bd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205480821015610909576109016003546108fc8385610afa565b610afa565b600355610922565b61091e6003546109198484610afa565b610b71565b6003555b5073ffffffffffffffffffffffffffffffffffffffff909116600090815260016020526040902055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561066c576000805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905550565b69021e19e0c9bab240000081565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902054610a72908290610b71565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902055600354610aa59082610b71565b60035560408051828152905173ffffffffffffffffffffffffffffffffffffffff8416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082821115610b6b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604482015290519081900360640190fd5b50900390565b600082820183811015610be557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b93925050505600a165627a7a723058204b9a360b71fa72973a0cb91d0b0eff3f0706340b808e79147c079c446632b7e10029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xCF JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xD4 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x15E JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x1A3 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1CA JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x201 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x216 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x244 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x282 JUMPI DUP1 PUSH4 0xA0712D68 EQ PUSH2 0x297 JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x2B1 JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x2E2 JUMPI DUP1 PUSH4 0xE30443BC EQ PUSH2 0x316 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x347 JUMPI DUP1 PUSH4 0xFA9B7018 EQ PUSH2 0x375 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xE0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x38A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x123 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x10B JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x150 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x16A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x436 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x4A9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x4AF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x526 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x222 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x52C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x250 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x259 PUSH2 0x554 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x28E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x570 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH1 0x4 CALLDATALOAD PUSH2 0x5E9 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x66F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x7FE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x322 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x836 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x353 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x94C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x381 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0xA33 JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x411 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE DUP2 DUP5 KECCAK256 DUP7 SWAP1 SSTORE DUP2 MLOAD DUP7 DUP2 MSTORE SWAP2 MLOAD SWAP4 SWAP5 SWAP1 SWAP4 SWAP1 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP5 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 PUSH1 0x1 PUSH1 0x0 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 PUSH1 0x0 RETURN JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 GT ISZERO PUSH2 0x662 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x56414C55455F544F4F5F4C415247450000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x66C CALLER DUP3 PUSH2 0xA41 JUMP JUMPDEST POP JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x6ED JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x783 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP5 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x8BD JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP1 DUP3 LT ISZERO PUSH2 0x909 JUMPI PUSH2 0x901 PUSH1 0x3 SLOAD PUSH2 0x8FC DUP4 DUP6 PUSH2 0xAFA JUMP JUMPDEST PUSH2 0xAFA JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH2 0x922 JUMP JUMPDEST PUSH2 0x91E PUSH1 0x3 SLOAD PUSH2 0x919 DUP5 DUP5 PUSH2 0xAFA JUMP JUMPDEST PUSH2 0xB71 JUMP JUMPDEST PUSH1 0x3 SSTORE JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x9D2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x66C JUMPI PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 SWAP1 SWAP2 AND OR SWAP1 SSTORE POP JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0xA72 SWAP1 DUP3 SWAP1 PUSH2 0xB71 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE PUSH1 0x3 SLOAD PUSH2 0xAA5 SWAP1 DUP3 PUSH2 0xB71 JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP2 PUSH1 0x0 SWAP2 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xB6B JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xBE5 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0x4b SWAP11 CALLDATASIZE SIGNEXTEND PUSH18 0xFA72973A0CB91D0B0EFF3F0706340B808E79 EQ PUSH29 0x79C446632B7E100290000000000000000000000000000000000000000 ",
+ "sourceMap": "674:1072:56:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;777:18:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;777:18:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;777:18:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2896:270:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2896:270:70;;;;;;;;;;;;;;;;;;;;;;;;;;;3251:119;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3251:119:70;;;;;;;;;;;;;;;;;;;;1263:481:56;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1263:481:56;;;;;;;;;;;;;;827:23:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;827:23:55;;;;3524:135:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3524:135:70;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;;;;;;;;;;;;;;;;;;;;801::55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;801:20:55;;;;1907:191;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1907:191:55;;;;;;;1055:514:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1055:514:70;;;;;;;;;3867:162;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3867:162:70;;;;;;;;;;;;1406:407:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1406:407:55;;;;;;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;856:65:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;856:65:55;;;;777:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2896:270:70:-;3009:10;2981:4;3001:19;;;:7;:19;;;;;;;;;:29;;;;;;;;;;;:38;;;3054:84;;;;;;;2981:4;;3001:29;;3009:10;;3054:84;;;;;;;;-1:-1:-1;3155:4:70;2896:270;;;;:::o;3251:119::-;3351:12;;3251:119;:::o;1263:481:56:-;1393:4;1459:3;1418:74;;1440:5;1418:74;;;1476:6;1418:74;;;;;;;;;;;;;;;;;;1674:1;1671;1664:12;1700:1;1696:2;1689:13;1725:2;1722:1;1715:13;827:23:55;;;;:::o;3524:135:70:-;3636:16;;3606:7;3636:16;;;:8;:16;;;;;;;3524:135::o;91:20:82:-;;;;;;:::o;801::55:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1907:191;898:23;1989:25;;;1968:87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2066:25;2072:10;2084:6;2066:5;:25::i;:::-;1907:191;:::o;1055:514:70:-;1186:10;1136:4;1177:20;;;:8;:20;;;;;;:30;-1:-1:-1;1177:30:70;1156:103;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1316:13;;;;;;;:8;:13;;;;;;1290:22;;;:39;;1269:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1391:10;1382:20;;;;:8;:20;;;;;;;;:30;;;;;;;:20;1422:13;;;;;;;;;:23;;;;;;1461:79;;;;;;;1422:13;;1391:10;1461:79;;;;;;;;;;;-1:-1:-1;1558:4:70;1055:514;;;;:::o;3867:162::-;3997:15;;;;3967:7;3997:15;;;:7;:15;;;;;;;;:25;;;;;;;;;;;;;3867:162::o;1406:407:55:-;1508:19;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1530:17:55;;;;;;;:8;:17;;;;;;1561:20;;;1557:214;;;1612:51;1620:12;;1634:28;1642:11;1655:6;1634:7;:28::i;:::-;1612:7;:51::i;:::-;1597:12;:66;1557:214;;;1709:51;1717:12;;1731:28;1739:6;1747:11;1731:7;:28::i;:::-;1709:7;:51::i;:::-;1694:12;:66;1557:214;-1:-1:-1;1780:17:55;;;;;;;;:8;:17;;;;;:26;1406:407::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;;;333:167;:::o;856:65:55:-;898:23;856:65;:::o;935:277:72:-;1042:13;;;;;;;:8;:13;;;;;;1026:30;;1034:6;;1026:7;:30::i;:::-;1010:13;;;;;;;:8;:13;;;;;:46;1089:12;;1081:29;;1103:6;1081:7;:29::i;:::-;1066:12;:44;1126:79;;;;;;;;;;;;1156:1;;1126:79;;;;;;;;;935:277;;:::o;502:208:84:-;588:7;632:6;;;;611:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;698:5:84;;;502:208::o;716:230::-;802:7;837:5;;;873:6;;;;852:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;938:1;716:230;-1:-1:-1;;;716:230:84:o"
+ }
+ }
+ },
+ "sources": {
+ "test/DummyERC20Token/DummyMultipleReturnERC20Token.sol": {
+ "id": 56
+ },
+ "test/DummyERC20Token/DummyERC20Token.sol": {
+ "id": 55
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ },
+ "tokens/ERC20Token/MintableERC20Token.sol": {
+ "id": 72
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol": {
+ "id": 73
+ },
+ "tokens/ERC20Token/ERC20Token.sol": {
+ "id": 70
+ },
+ "tokens/ERC20Token/IERC20Token.sol": {
+ "id": 71
+ }
+ },
+ "sourceCodes": {
+ "test/DummyERC20Token/DummyMultipleReturnERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./DummyERC20Token.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract DummyMultipleReturnERC20Token is\n DummyERC20Token\n{\n constructor (\n string _name,\n string _symbol,\n uint256 _decimals,\n uint256 _totalSupply\n )\n public\n DummyERC20Token(\n _name,\n _symbol,\n _decimals,\n _totalSupply\n )\n {}\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n emit Transfer(\n _from,\n _to,\n _value\n );\n\n // HACK: This contract will not compile if we remove `returns (bool)`, so we manually return 64 bytes (equiavalent to true, true)\n assembly {\n mstore(0, 1)\n mstore(32, 1)\n return(0, 64)\n }\n }\n}\n\n",
+ "test/DummyERC20Token/DummyERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/Ownable/Ownable.sol\";\nimport \"../../tokens/ERC20Token/MintableERC20Token.sol\";\n\n\ncontract DummyERC20Token is \n Ownable,\n MintableERC20Token\n{\n string public name;\n string public symbol;\n uint256 public decimals;\n uint256 public constant MAX_MINT_AMOUNT = 10000000000000000000000;\n\n constructor (\n string _name,\n string _symbol,\n uint256 _decimals,\n uint256 _totalSupply\n )\n public\n {\n name = _name;\n symbol = _symbol;\n decimals = _decimals;\n _totalSupply = _totalSupply;\n balances[msg.sender] = _totalSupply;\n }\n\n /// @dev Sets the balance of target address\n /// @param _target Address or which balance will be updated\n /// @param _value New balance of target address\n function setBalance(address _target, uint256 _value)\n external\n onlyOwner\n {\n uint256 currBalance = balances[_target];\n if (_value < currBalance) {\n _totalSupply = safeSub(_totalSupply, safeSub(currBalance, _value));\n } else {\n _totalSupply = safeAdd(_totalSupply, safeSub(_value, currBalance));\n }\n balances[_target] = _value;\n }\n\n /// @dev Mints new tokens for sender\n /// @param _value Amount of tokens to mint\n function mint(uint256 _value)\n external\n {\n require(\n _value <= MAX_MINT_AMOUNT,\n \"VALUE_TOO_LARGE\"\n );\n\n _mint(msg.sender, _value);\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n",
+ "tokens/ERC20Token/MintableERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/SafeMath/SafeMath.sol\";\nimport \"./UnlimitedAllowanceERC20Token.sol\";\n\n\ncontract MintableERC20Token is \n SafeMath,\n UnlimitedAllowanceERC20Token\n{\n /// @dev Mints new tokens\n /// @param _to Address of the beneficiary that will own the minted token\n /// @param _value Amount of tokens to mint\n function _mint(address _to, uint256 _value)\n internal\n {\n balances[_to] = safeAdd(_value, balances[_to]);\n _totalSupply = safeAdd(_totalSupply, _value);\n\n emit Transfer(\n address(0),\n _to,\n _value\n );\n }\n\n /// @dev Mints new tokens\n /// @param _owner Owner of tokens that will be burned\n /// @param _value Amount of tokens to burn\n function _burn(address _owner, uint256 _value)\n internal\n {\n balances[_owner] = safeSub(balances[_owner], _value);\n _totalSupply = safeSub(_totalSupply, _value);\n\n emit Transfer(\n _owner,\n address(0),\n _value\n );\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../ERC20Token/ERC20Token.sol\";\n\n\ncontract UnlimitedAllowanceERC20Token is\n ERC20Token\n{\n uint256 constant internal MAX_UINT = 2**256 - 1;\n\n /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717\n /// @param _from Address to transfer from.\n /// @param _to Address to transfer to.\n /// @param _value Amount to transfer.\n /// @return Success of transfer.\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n uint256 allowance = allowed[_from][msg.sender];\n require(\n balances[_from] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n allowance >= _value,\n \"ERC20_INSUFFICIENT_ALLOWANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[_to] += _value;\n balances[_from] -= _value;\n if (allowance < MAX_UINT) {\n allowed[_from][msg.sender] -= _value;\n }\n\n emit Transfer(\n _from,\n _to,\n _value\n );\n\n return true;\n }\n}\n",
+ "tokens/ERC20Token/ERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IERC20Token.sol\";\n\n\ncontract ERC20Token is\n IERC20Token\n{\n mapping (address => uint256) internal balances;\n mapping (address => mapping (address => uint256)) internal allowed;\n\n uint256 internal _totalSupply;\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool)\n {\n require(\n balances[msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[msg.sender] -= _value;\n balances[_to] += _value;\n\n emit Transfer(\n msg.sender,\n _to,\n _value\n );\n\n return true;\n }\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n require(\n balances[_from] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n allowed[_from][msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_ALLOWANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[_to] += _value;\n balances[_from] -= _value;\n allowed[_from][msg.sender] -= _value;\n \n emit Transfer(\n _from,\n _to,\n _value\n );\n \n return true;\n }\n\n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool)\n {\n allowed[msg.sender][_spender] = _value;\n emit Approval(\n msg.sender,\n _spender,\n _value\n );\n return true;\n }\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256)\n {\n return _totalSupply;\n }\n\n /// @dev Query the balance of owner\n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256)\n {\n return balances[_owner];\n }\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256)\n {\n return allowed[_owner][_spender];\n }\n}\n",
+ "tokens/ERC20Token/IERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC20Token {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool);\n \n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n \n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256);\n}\n"
+ },
+ "sourceTreeHashHex": "0x9edf2fcc010282c8ff33a61271a61abfcbe0f88113427cb448b301fcb88337be",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/DummyNoReturnERC20Token.json b/packages/contracts/generated-artifacts/DummyNoReturnERC20Token.json
new file mode 100644
index 000000000..2e7dbef5f
--- /dev/null
+++ b/packages/contracts/generated-artifacts/DummyNoReturnERC20Token.json
@@ -0,0 +1,397 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "DummyNoReturnERC20Token",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "mint",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_target",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "setBalance",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "MAX_MINT_AMOUNT",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_name",
+ "type": "string"
+ },
+ {
+ "name": "_symbol",
+ "type": "string"
+ },
+ {
+ "name": "_decimals",
+ "type": "uint256"
+ },
+ {
+ "name": "_totalSupply",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b50604051610f40380380610f40833981016040908152815160208084015192840151606085015160008054600160a060020a03191633179055928501805190959490940193909291859185918591859161006f916004918701906100a6565b5082516100839060059060208601906100a6565b506006919091553360009081526001602052604090205550610141945050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100e757805160ff1916838001178555610114565b82800160010185558215610114579182015b828111156101145782518255916020019190600101906100f9565b50610120929150610124565b5090565b61013e91905b80821115610120576000815560010161012a565b90565b610df0806101506000396000f3006080604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd146101a357806323b872dd146101ca578063313ce5671461020157806370a08231146102165780638da5cb5b1461024457806395d89b4114610282578063a0712d6814610297578063a9059cbb146102b1578063dd62ed3e146102e2578063e30443bc14610316578063f2fde38b14610347578063fa9b701814610375575b600080fd5b3480156100e057600080fd5b506100e961038a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012357818101518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016a57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff60043516602435610436565b604080519115158252519081900360200190f35b3480156101af57600080fd5b506101b86104a9565b60408051918252519081900360200190f35b3480156101d657600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356104af565b34801561020d57600080fd5b506101b8610705565b34801561022257600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff6004351661070b565b34801561025057600080fd5b50610259610733565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561028e57600080fd5b506100e961074f565b3480156102a357600080fd5b506102af6004356107c8565b005b3480156102bd57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff6004351660243561084e565b3480156102ee57600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff600435811690602435166109d6565b34801561032257600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff60043516602435610a0e565b34801561035357600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff60043516610b24565b34801561038157600080fd5b506101b8610c0b565b6004805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b820191906000526020600020905b81548152906001019060200180831161041157829003601f168201915b505050505081565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035490565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081205482111561054357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526002602090815260408083203384529091529020548211156105e257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f45524332305f494e53554646494349454e545f414c4c4f57414e434500000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054828101101561067857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff808416600081815260016020908152604080832080548801905593881680835284832080548890039055600282528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3005b60065481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b69021e19e0c9bab240000081111561084157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f56414c55455f544f4f5f4c415247450000000000000000000000000000000000604482015290519081900360640190fd5b61084b3382610c19565b50565b336000908152600160205260408120548211156108cc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054828101101561096257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b3360008181526001602090815260408083208054879003905573ffffffffffffffffffffffffffffffffffffffff871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3005b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205490565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610a9557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205480821015610ae157610ad9600354610ad48385610cd2565b610cd2565b600355610afa565b610af6600354610af18484610cd2565b610d49565b6003555b5073ffffffffffffffffffffffffffffffffffffffff909116600090815260016020526040902055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610baa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561084b576000805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905550565b69021e19e0c9bab240000081565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902054610c4a908290610d49565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902055600354610c7d9082610d49565b60035560408051828152905173ffffffffffffffffffffffffffffffffffffffff8416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082821115610d4357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604482015290519081900360640190fd5b50900390565b600082820183811015610dbd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b93925050505600a165627a7a7230582036ddba1687be35f8ca43ec39f5659faa6721f54975701873eedfb44ec7547f160029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0xF40 CODESIZE SUB DUP1 PUSH2 0xF40 DUP4 CODECOPY DUP2 ADD PUSH1 0x40 SWAP1 DUP2 MSTORE DUP2 MLOAD PUSH1 0x20 DUP1 DUP5 ADD MLOAD SWAP3 DUP5 ADD MLOAD PUSH1 0x60 DUP6 ADD MLOAD PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE SWAP3 DUP6 ADD DUP1 MLOAD SWAP1 SWAP6 SWAP5 SWAP1 SWAP5 ADD SWAP4 SWAP1 SWAP3 SWAP2 DUP6 SWAP2 DUP6 SWAP2 DUP6 SWAP2 DUP6 SWAP2 PUSH2 0x6F SWAP2 PUSH1 0x4 SWAP2 DUP8 ADD SWAP1 PUSH2 0xA6 JUMP JUMPDEST POP DUP3 MLOAD PUSH2 0x83 SWAP1 PUSH1 0x5 SWAP1 PUSH1 0x20 DUP7 ADD SWAP1 PUSH2 0xA6 JUMP JUMPDEST POP PUSH1 0x6 SWAP2 SWAP1 SWAP2 SSTORE CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE POP PUSH2 0x141 SWAP5 POP POP POP POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xE7 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x114 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x114 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x114 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xF9 JUMP JUMPDEST POP PUSH2 0x120 SWAP3 SWAP2 POP PUSH2 0x124 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x13E SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x120 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x12A JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0xDF0 DUP1 PUSH2 0x150 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xCF JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xD4 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x15E JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x1A3 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1CA JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x201 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x216 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x244 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x282 JUMPI DUP1 PUSH4 0xA0712D68 EQ PUSH2 0x297 JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x2B1 JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x2E2 JUMPI DUP1 PUSH4 0xE30443BC EQ PUSH2 0x316 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x347 JUMPI DUP1 PUSH4 0xFA9B7018 EQ PUSH2 0x375 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xE0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x38A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x123 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x10B JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x150 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x16A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x436 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x4A9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x4AF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x705 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x222 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x70B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x250 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x259 PUSH2 0x733 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x28E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x74F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH1 0x4 CALLDATALOAD PUSH2 0x7C8 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x84E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x9D6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x322 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0xA0E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x353 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xB24 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x381 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0xC0B JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x411 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE DUP2 DUP5 KECCAK256 DUP7 SWAP1 SSTORE DUP2 MLOAD DUP7 DUP2 MSTORE SWAP2 MLOAD SWAP4 SWAP5 SWAP1 SWAP4 SWAP1 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x543 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x5E2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F414C4C4F57414E434500000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x678 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP9 ADD SWAP1 SSTORE SWAP4 DUP9 AND DUP1 DUP4 MSTORE DUP5 DUP4 KECCAK256 DUP1 SLOAD DUP9 SWAP1 SUB SWAP1 SSTORE PUSH1 0x2 DUP3 MSTORE DUP5 DUP4 KECCAK256 CALLER DUP5 MSTORE DUP3 MSTORE SWAP2 DUP5 SWAP1 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE DUP4 MLOAD DUP7 DUP2 MSTORE SWAP4 MLOAD SWAP3 SWAP4 SWAP2 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 STOP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 GT ISZERO PUSH2 0x841 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x56414C55455F544F4F5F4C415247450000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x84B CALLER DUP3 PUSH2 0xC19 JUMP JUMPDEST POP JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x8CC JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x962 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP5 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 STOP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xA95 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP1 DUP3 LT ISZERO PUSH2 0xAE1 JUMPI PUSH2 0xAD9 PUSH1 0x3 SLOAD PUSH2 0xAD4 DUP4 DUP6 PUSH2 0xCD2 JUMP JUMPDEST PUSH2 0xCD2 JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH2 0xAFA JUMP JUMPDEST PUSH2 0xAF6 PUSH1 0x3 SLOAD PUSH2 0xAF1 DUP5 DUP5 PUSH2 0xCD2 JUMP JUMPDEST PUSH2 0xD49 JUMP JUMPDEST PUSH1 0x3 SSTORE JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xBAA JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x84B JUMPI PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 SWAP1 SWAP2 AND OR SWAP1 SSTORE POP JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0xC4A SWAP1 DUP3 SWAP1 PUSH2 0xD49 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE PUSH1 0x3 SLOAD PUSH2 0xC7D SWAP1 DUP3 PUSH2 0xD49 JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP2 PUSH1 0x0 SWAP2 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xD43 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xDBD JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLDATASIZE 0xdd 0xba AND DUP8 0xbe CALLDATALOAD 0xf8 0xca NUMBER 0xec CODECOPY 0xf5 PUSH6 0x9FAA6721F549 PUSH22 0x701873EEDFB44EC7547F160029000000000000000000 ",
+ "sourceMap": "674:2274:57:-;;;736:266;8:9:-1;5:2;;;30:1;27;20:12;5:2;736:266:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;162:5:82;:18;;-1:-1:-1;;;;;;162:18:82;170:10;162:18;;;736:266:57;;;1079:12:55;;736:266:57;;;;;;;;;;;;;;;;;;1079:12:55;;:4;;:12;;;;:::i;:::-;-1:-1:-1;1101:16:55;;;;:6;;:16;;;;;:::i;:::-;-1:-1:-1;1127:8:55;:20;;;;1203:10;1194:20;;;;:8;:20;;;;;:35;-1:-1:-1;674:2274:57;;-1:-1:-1;;;;;674:2274:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;674:2274:57;;;-1:-1:-1;674:2274:57;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd146101a357806323b872dd146101ca578063313ce5671461020157806370a08231146102165780638da5cb5b1461024457806395d89b4114610282578063a0712d6814610297578063a9059cbb146102b1578063dd62ed3e146102e2578063e30443bc14610316578063f2fde38b14610347578063fa9b701814610375575b600080fd5b3480156100e057600080fd5b506100e961038a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012357818101518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016a57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff60043516602435610436565b604080519115158252519081900360200190f35b3480156101af57600080fd5b506101b86104a9565b60408051918252519081900360200190f35b3480156101d657600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356104af565b34801561020d57600080fd5b506101b8610705565b34801561022257600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff6004351661070b565b34801561025057600080fd5b50610259610733565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561028e57600080fd5b506100e961074f565b3480156102a357600080fd5b506102af6004356107c8565b005b3480156102bd57600080fd5b5061018f73ffffffffffffffffffffffffffffffffffffffff6004351660243561084e565b3480156102ee57600080fd5b506101b873ffffffffffffffffffffffffffffffffffffffff600435811690602435166109d6565b34801561032257600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff60043516602435610a0e565b34801561035357600080fd5b506102af73ffffffffffffffffffffffffffffffffffffffff60043516610b24565b34801561038157600080fd5b506101b8610c0b565b6004805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b820191906000526020600020905b81548152906001019060200180831161041157829003601f168201915b505050505081565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035490565b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604081205482111561054357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526002602090815260408083203384529091529020548211156105e257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f45524332305f494e53554646494349454e545f414c4c4f57414e434500000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054828101101561067857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff808416600081815260016020908152604080832080548801905593881680835284832080548890039055600282528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a3005b60065481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561042e5780601f106104035761010080835404028352916020019161042e565b69021e19e0c9bab240000081111561084157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f56414c55455f544f4f5f4c415247450000000000000000000000000000000000604482015290519081900360640190fd5b61084b3382610c19565b50565b336000908152600160205260408120548211156108cc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902054828101101561096257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b3360008181526001602090815260408083208054879003905573ffffffffffffffffffffffffffffffffffffffff871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3005b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205490565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610a9557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205480821015610ae157610ad9600354610ad48385610cd2565b610cd2565b600355610afa565b610af6600354610af18484610cd2565b610d49565b6003555b5073ffffffffffffffffffffffffffffffffffffffff909116600090815260016020526040902055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610baa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561084b576000805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905550565b69021e19e0c9bab240000081565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902054610c4a908290610d49565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902055600354610c7d9082610d49565b60035560408051828152905173ffffffffffffffffffffffffffffffffffffffff8416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082821115610d4357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604482015290519081900360640190fd5b50900390565b600082820183811015610dbd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b93925050505600a165627a7a7230582036ddba1687be35f8ca43ec39f5659faa6721f54975701873eedfb44ec7547f160029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xCF JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xD4 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x15E JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x1A3 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1CA JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x201 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x216 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x244 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x282 JUMPI DUP1 PUSH4 0xA0712D68 EQ PUSH2 0x297 JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x2B1 JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x2E2 JUMPI DUP1 PUSH4 0xE30443BC EQ PUSH2 0x316 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x347 JUMPI DUP1 PUSH4 0xFA9B7018 EQ PUSH2 0x375 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xE0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x38A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x123 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x10B JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x150 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x16A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x436 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x4A9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x4AF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x20D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0x705 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x222 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x70B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x250 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x259 PUSH2 0x733 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x28E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x74F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH1 0x4 CALLDATALOAD PUSH2 0x7C8 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x18F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x84E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x9D6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x322 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0xA0E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x353 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2AF PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xB24 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x381 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B8 PUSH2 0xC0B JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x411 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE DUP2 DUP5 KECCAK256 DUP7 SWAP1 SSTORE DUP2 MLOAD DUP7 DUP2 MSTORE SWAP2 MLOAD SWAP4 SWAP5 SWAP1 SWAP4 SWAP1 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x543 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x5E2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F414C4C4F57414E434500000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x678 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP9 ADD SWAP1 SSTORE SWAP4 DUP9 AND DUP1 DUP4 MSTORE DUP5 DUP4 KECCAK256 DUP1 SLOAD DUP9 SWAP1 SUB SWAP1 SSTORE PUSH1 0x2 DUP3 MSTORE DUP5 DUP4 KECCAK256 CALLER DUP5 MSTORE DUP3 MSTORE SWAP2 DUP5 SWAP1 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE DUP4 MLOAD DUP7 DUP2 MSTORE SWAP4 MLOAD SWAP3 SWAP4 SWAP2 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 STOP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x42E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x403 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x42E JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 GT ISZERO PUSH2 0x841 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x56414C55455F544F4F5F4C415247450000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x84B CALLER DUP3 PUSH2 0xC19 JUMP JUMPDEST POP JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x8CC JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x962 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP5 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 STOP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xA95 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP1 DUP3 LT ISZERO PUSH2 0xAE1 JUMPI PUSH2 0xAD9 PUSH1 0x3 SLOAD PUSH2 0xAD4 DUP4 DUP6 PUSH2 0xCD2 JUMP JUMPDEST PUSH2 0xCD2 JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH2 0xAFA JUMP JUMPDEST PUSH2 0xAF6 PUSH1 0x3 SLOAD PUSH2 0xAF1 DUP5 DUP5 PUSH2 0xCD2 JUMP JUMPDEST PUSH2 0xD49 JUMP JUMPDEST PUSH1 0x3 SSTORE JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xBAA JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x84B JUMPI PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 SWAP1 SWAP2 AND OR SWAP1 SSTORE POP JUMP JUMPDEST PUSH10 0x21E19E0C9BAB2400000 DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH2 0xC4A SWAP1 DUP3 SWAP1 PUSH2 0xD49 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SSTORE PUSH1 0x3 SLOAD PUSH2 0xC7D SWAP1 DUP3 PUSH2 0xD49 JUMP JUMPDEST PUSH1 0x3 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP2 PUSH1 0x0 SWAP2 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xD43 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xDBD JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 CALLDATASIZE 0xdd 0xba AND DUP8 0xbe CALLDATALOAD 0xf8 0xca NUMBER 0xec CODECOPY 0xf5 PUSH6 0x9FAA6721F549 PUSH22 0x701873EEDFB44EC7547F160029000000000000000000 ",
+ "sourceMap": "674:2274:57:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;777:18:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;777:18:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;777:18:55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2896:270:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2896:270:70;;;;;;;;;;;;;;;;;;;;;;;;;;;3251:119;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3251:119:70;;;;;;;;;;;;;;;;;;;;2085:861:57;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2085:861:57;;;;;;;;;;;;;;827:23:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;827:23:55;;;;3524:135:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3524:135:70;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;;;;;;;;;;;;;;;;;;;;801::55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;801:20:55;;;;1907:191;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1907:191:55;;;;;;;1174:656:57;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1174:656:57;;;;;;;;;3867:162:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3867:162:70;;;;;;;;;;;;1406:407:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1406:407:55;;;;;;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;856:65:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;856:65:55;;;;777:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2896:270:70:-;3009:10;2981:4;3001:19;;;:7;:19;;;;;;;;;:29;;;;;;;;;;;:38;;;3054:84;;;;;;;2981:4;;3001:29;;3009:10;;3054:84;;;;;;;;-1:-1:-1;3155:4:70;2896:270;;;;:::o;3251:119::-;3351:12;;3251:119;:::o;2085:861:57:-;2256:15;;;2215:4;2256:15;;;:8;:15;;;;;;:25;-1:-1:-1;2256:25:57;2235:98;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2364:14;;;;;;;:7;:14;;;;;;;;2379:10;2364:26;;;;;;;;:36;-1:-1:-1;2364:36:57;2343:111;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2511:13;;;;;;;:8;:13;;;;;;2485:22;;;:39;;2464:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2577:13;;;;;;;;:8;:13;;;;;;;;:23;;;;;;2610:15;;;;;;;;;:25;;;;;;;2645:7;:14;;;;;2660:10;2645:26;;;;;;;;:36;;;;;;;2701:74;;;;;;;2577:13;;2610:15;;2701:74;;;;;;;;;;2918:12;827:23:55;;;;:::o;3524:135:70:-;3636:16;;3606:7;3636:16;;;:8;:16;;;;;;;3524:135::o;91:20:82:-;;;;;;:::o;801::55:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1907:191;898:23;1989:25;;;1968:87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2066:25;2072:10;2084:6;2066:5;:25::i;:::-;1907:191;:::o;1174:656:57:-;1305:10;1255:4;1296:20;;;:8;:20;;;;;;:30;-1:-1:-1;1296:30:57;1275:103;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1435:13;;;;;;;:8;:13;;;;;;1409:22;;;:39;;1388:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1510:10;1501:20;;;;:8;:20;;;;;;;;:30;;;;;;;:20;1541:13;;;;;;;;;:23;;;;;;1580:79;;;;;;;1541:13;;1510:10;1580:79;;;;;;;;;;;1802:12;3867:162:70;3997:15;;;;3967:7;3997:15;;;:7;:15;;;;;;;;:25;;;;;;;;;;;;;3867:162::o;1406:407:55:-;1508:19;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1530:17:55;;;;;;;:8;:17;;;;;;1561:20;;;1557:214;;;1612:51;1620:12;;1634:28;1642:11;1655:6;1634:7;:28::i;:::-;1612:7;:51::i;:::-;1597:12;:66;1557:214;;;1709:51;1717:12;;1731:28;1739:6;1747:11;1731:7;:28::i;:::-;1709:7;:51::i;:::-;1694:12;:66;1557:214;-1:-1:-1;1780:17:55;;;;;;;;:8;:17;;;;;:26;1406:407::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;;;333:167;:::o;856:65:55:-;898:23;856:65;:::o;935:277:72:-;1042:13;;;;;;;:8;:13;;;;;;1026:30;;1034:6;;1026:7;:30::i;:::-;1010:13;;;;;;;:8;:13;;;;;:46;1089:12;;1081:29;;1103:6;1081:7;:29::i;:::-;1066:12;:44;1126:79;;;;;;;;;;;;1156:1;;1126:79;;;;;;;;;935:277;;:::o;502:208:84:-;588:7;632:6;;;;611:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;698:5:84;;;502:208::o;716:230::-;802:7;837:5;;;873:6;;;;852:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;938:1;716:230;-1:-1:-1;;;716:230:84:o"
+ }
+ }
+ },
+ "sources": {
+ "test/DummyERC20Token/DummyNoReturnERC20Token.sol": {
+ "id": 57
+ },
+ "test/DummyERC20Token/DummyERC20Token.sol": {
+ "id": 55
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ },
+ "tokens/ERC20Token/MintableERC20Token.sol": {
+ "id": 72
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol": {
+ "id": 73
+ },
+ "tokens/ERC20Token/ERC20Token.sol": {
+ "id": 70
+ },
+ "tokens/ERC20Token/IERC20Token.sol": {
+ "id": 71
+ }
+ },
+ "sourceCodes": {
+ "test/DummyERC20Token/DummyNoReturnERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./DummyERC20Token.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract DummyNoReturnERC20Token is\n DummyERC20Token\n{\n constructor (\n string _name,\n string _symbol,\n uint256 _decimals,\n uint256 _totalSupply\n )\n public\n DummyERC20Token(\n _name,\n _symbol,\n _decimals,\n _totalSupply\n )\n {}\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n function transfer(address _to, uint256 _value)\n external\n returns (bool)\n {\n require(\n balances[msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[msg.sender] -= _value;\n balances[_to] += _value;\n\n emit Transfer(\n msg.sender,\n _to,\n _value\n );\n\n // HACK: This contract will not compile if we remove `returns (bool)`, so we manually return no data\n assembly {\n return(0, 0)\n }\n }\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n require(\n balances[_from] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n allowed[_from][msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_ALLOWANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[_to] += _value;\n balances[_from] -= _value;\n allowed[_from][msg.sender] -= _value;\n \n emit Transfer(\n _from,\n _to,\n _value\n );\n\n // HACK: This contract will not compile if we remove `returns (bool)`, so we manually return no data\n assembly {\n return(0, 0)\n }\n }\n}\n\n",
+ "test/DummyERC20Token/DummyERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/Ownable/Ownable.sol\";\nimport \"../../tokens/ERC20Token/MintableERC20Token.sol\";\n\n\ncontract DummyERC20Token is \n Ownable,\n MintableERC20Token\n{\n string public name;\n string public symbol;\n uint256 public decimals;\n uint256 public constant MAX_MINT_AMOUNT = 10000000000000000000000;\n\n constructor (\n string _name,\n string _symbol,\n uint256 _decimals,\n uint256 _totalSupply\n )\n public\n {\n name = _name;\n symbol = _symbol;\n decimals = _decimals;\n _totalSupply = _totalSupply;\n balances[msg.sender] = _totalSupply;\n }\n\n /// @dev Sets the balance of target address\n /// @param _target Address or which balance will be updated\n /// @param _value New balance of target address\n function setBalance(address _target, uint256 _value)\n external\n onlyOwner\n {\n uint256 currBalance = balances[_target];\n if (_value < currBalance) {\n _totalSupply = safeSub(_totalSupply, safeSub(currBalance, _value));\n } else {\n _totalSupply = safeAdd(_totalSupply, safeSub(_value, currBalance));\n }\n balances[_target] = _value;\n }\n\n /// @dev Mints new tokens for sender\n /// @param _value Amount of tokens to mint\n function mint(uint256 _value)\n external\n {\n require(\n _value <= MAX_MINT_AMOUNT,\n \"VALUE_TOO_LARGE\"\n );\n\n _mint(msg.sender, _value);\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n",
+ "tokens/ERC20Token/MintableERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/SafeMath/SafeMath.sol\";\nimport \"./UnlimitedAllowanceERC20Token.sol\";\n\n\ncontract MintableERC20Token is \n SafeMath,\n UnlimitedAllowanceERC20Token\n{\n /// @dev Mints new tokens\n /// @param _to Address of the beneficiary that will own the minted token\n /// @param _value Amount of tokens to mint\n function _mint(address _to, uint256 _value)\n internal\n {\n balances[_to] = safeAdd(_value, balances[_to]);\n _totalSupply = safeAdd(_totalSupply, _value);\n\n emit Transfer(\n address(0),\n _to,\n _value\n );\n }\n\n /// @dev Mints new tokens\n /// @param _owner Owner of tokens that will be burned\n /// @param _value Amount of tokens to burn\n function _burn(address _owner, uint256 _value)\n internal\n {\n balances[_owner] = safeSub(balances[_owner], _value);\n _totalSupply = safeSub(_totalSupply, _value);\n\n emit Transfer(\n _owner,\n address(0),\n _value\n );\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "tokens/ERC20Token/UnlimitedAllowanceERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../ERC20Token/ERC20Token.sol\";\n\n\ncontract UnlimitedAllowanceERC20Token is\n ERC20Token\n{\n uint256 constant internal MAX_UINT = 2**256 - 1;\n\n /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717\n /// @param _from Address to transfer from.\n /// @param _to Address to transfer to.\n /// @param _value Amount to transfer.\n /// @return Success of transfer.\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n uint256 allowance = allowed[_from][msg.sender];\n require(\n balances[_from] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n allowance >= _value,\n \"ERC20_INSUFFICIENT_ALLOWANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[_to] += _value;\n balances[_from] -= _value;\n if (allowance < MAX_UINT) {\n allowed[_from][msg.sender] -= _value;\n }\n\n emit Transfer(\n _from,\n _to,\n _value\n );\n\n return true;\n }\n}\n",
+ "tokens/ERC20Token/ERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IERC20Token.sol\";\n\n\ncontract ERC20Token is\n IERC20Token\n{\n mapping (address => uint256) internal balances;\n mapping (address => mapping (address => uint256)) internal allowed;\n\n uint256 internal _totalSupply;\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool)\n {\n require(\n balances[msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[msg.sender] -= _value;\n balances[_to] += _value;\n\n emit Transfer(\n msg.sender,\n _to,\n _value\n );\n\n return true;\n }\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n require(\n balances[_from] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n allowed[_from][msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_ALLOWANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[_to] += _value;\n balances[_from] -= _value;\n allowed[_from][msg.sender] -= _value;\n \n emit Transfer(\n _from,\n _to,\n _value\n );\n \n return true;\n }\n\n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool)\n {\n allowed[msg.sender][_spender] = _value;\n emit Approval(\n msg.sender,\n _spender,\n _value\n );\n return true;\n }\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256)\n {\n return _totalSupply;\n }\n\n /// @dev Query the balance of owner\n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256)\n {\n return balances[_owner];\n }\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256)\n {\n return allowed[_owner][_spender];\n }\n}\n",
+ "tokens/ERC20Token/IERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC20Token {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool);\n \n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n \n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256);\n}\n"
+ },
+ "sourceTreeHashHex": "0x552299c00640ccbf6122867908f7e8c862d21ec4e34e5abaff193fce16240d6a",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/ERC20Proxy.json b/packages/contracts/generated-artifacts/ERC20Proxy.json
new file mode 100644
index 000000000..beabe2944
--- /dev/null
+++ b/packages/contracts/generated-artifacts/ERC20Proxy.json
@@ -0,0 +1,252 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "ERC20Proxy",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "addAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "authorities",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "removeAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "removeAuthorizedAddressAtIndex",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getProxyId",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "authorized",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getAuthorizedAddresses",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "fallback"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "AuthorizedAddressAdded",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "AuthorizedAddressRemoved",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405260008054600160a060020a03191633179055610f4a806100256000396000f3006080604052600436106100985763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166342f1181e8114610248578063494503d41461027857806370712939146102b95780638da5cb5b146102e75780639ad26744146102fc578063ae25532e1461032d578063b918161114610377578063d39de6e9146103b9578063f2fde38b1461041e575b3480156100a457600080fd5b507fffffffff00000000000000000000000000000000000000000000000000000000600035167fa85e59e40000000000000000000000000000000000000000000000000000000081141561024357604080513381526001602082015290812054151561017b577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1553454e4445525f4e4f545f415554484f52495a454400000000000000604052600060605260646000fd5b602860043501357f23b872dd0000000000000000000000000000000000000000000000000000000060005260606024600437602060006064600080855af1600080511160203d14163d15178116905080156101d257005b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f5452414e534645525f4641494c454400000000000000000000000000604052600060605260646000fd5b600080fd5b34801561025457600080fd5b5061027673ffffffffffffffffffffffffffffffffffffffff6004351661044c565b005b34801561028457600080fd5b50610290600435610638565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156102c557600080fd5b5061027673ffffffffffffffffffffffffffffffffffffffff6004351661066d565b3480156102f357600080fd5b50610290610966565b34801561030857600080fd5b5061027673ffffffffffffffffffffffffffffffffffffffff60043516602435610982565b34801561033957600080fd5b50610342610d37565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b34801561038357600080fd5b506103a573ffffffffffffffffffffffffffffffffffffffff60043516610d6d565b604080519115158252519081900360200190f35b3480156103c557600080fd5b506103ce610d82565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561040a5781810151838201526020016103f2565b505050509050019250505060405180910390f35b34801561042a57600080fd5b5061027673ffffffffffffffffffffffffffffffffffffffff60043516610df1565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff161561056757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b600280548290811061064657fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16151561078a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b60025481101561091f578173ffffffffffffffffffffffffffffffffffffffff1660028281548110151561080757fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561091757600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061085f57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061089257fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906109119082610ed7565b5061091f565b6001016107d7565b604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a0857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff161515610a9e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b6002548110610b0e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff16600282815481101515610b3457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610bc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610c3d57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610c7057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610cef9082610ed7565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190205b90565b60016020526000908152604090205460ff1681565b60606002805480602002602001604051908101604052809291908181526020018280548015610de757602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dbc575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610e7757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615610ed457600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b815481835581811115610efb57600083815260209020610efb918101908301610f00565b505050565b610d6a91905b80821115610f1a5760008155600101610f06565b50905600a165627a7a7230582042e8d12cee1d65ac011b69c29aad797fd7a173caa7693fe91761bbbaa39c950e0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE PUSH2 0xF4A DUP1 PUSH2 0x25 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x98 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x42F1181E DUP2 EQ PUSH2 0x248 JUMPI DUP1 PUSH4 0x494503D4 EQ PUSH2 0x278 JUMPI DUP1 PUSH4 0x70712939 EQ PUSH2 0x2B9 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x2E7 JUMPI DUP1 PUSH4 0x9AD26744 EQ PUSH2 0x2FC JUMPI DUP1 PUSH4 0xAE25532E EQ PUSH2 0x32D JUMPI DUP1 PUSH4 0xB9181611 EQ PUSH2 0x377 JUMPI DUP1 PUSH4 0xD39DE6E9 EQ PUSH2 0x3B9 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x41E JUMPI JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xA4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD AND PUSH32 0xA85E59E400000000000000000000000000000000000000000000000000000000 DUP2 EQ ISZERO PUSH2 0x243 JUMPI PUSH1 0x40 DUP1 MLOAD CALLER DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 DUP2 KECCAK256 SLOAD ISZERO ISZERO PUSH2 0x17B JUMPI PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0x1553454E4445525F4E4F545F415554484F52495A454400000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x28 PUSH1 0x4 CALLDATALOAD ADD CALLDATALOAD PUSH32 0x23B872DD00000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x60 PUSH1 0x24 PUSH1 0x4 CALLDATACOPY PUSH1 0x20 PUSH1 0x0 PUSH1 0x64 PUSH1 0x0 DUP1 DUP6 GAS CALL PUSH1 0x0 DUP1 MLOAD GT PUSH1 0x20 RETURNDATASIZE EQ AND RETURNDATASIZE ISZERO OR DUP2 AND SWAP1 POP DUP1 ISZERO PUSH2 0x1D2 JUMPI STOP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xF5452414E534645525F4641494C454400000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x254 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x276 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x44C JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x284 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x290 PUSH1 0x4 CALLDATALOAD PUSH2 0x638 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x276 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x66D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x290 PUSH2 0x966 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x308 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x276 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x982 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x339 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x342 PUSH2 0xD37 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x383 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3A5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xD6D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3CE PUSH2 0xD82 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x40A JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x3F2 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x42A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x276 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xDF1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x4D2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x567 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F414C52454144595F415554484F52495A454400000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP4 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD SWAP3 DUP4 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0x405787FA12A823E0F2B7631CC41B3BA8828B3321CA811111FA75CD3AA3BB5ACE SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD CALLER SWAP3 SWAP2 PUSH32 0x3147867C59D17E8FA9D522465651D44AAE0A9E38F902F3475B97E58072F0ED4C SWAP2 LOG3 POP JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x646 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x6F4 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x78A JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST PUSH1 0x2 SLOAD DUP2 LT ISZERO PUSH2 0x91F JUMPI DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x807 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x917 JUMPI PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x85F JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0x892 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x911 SWAP1 DUP3 PUSH2 0xED7 JUMP JUMPDEST POP PUSH2 0x91F JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0x7D7 JUMP JUMPDEST PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xA08 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0xA9E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x2 SLOAD DUP2 LT PUSH2 0xB0E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E4445585F4F55545F4F465F424F554E445300000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0xB34 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xBC2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1B PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x415554484F52495A45445F414444524553535F4D49534D415443480000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0xC3D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0xC70 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0xCEF SWAP1 DUP3 PUSH2 0xED7 JUMP JUMPDEST POP PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD SWAP1 KECCAK256 JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x2 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0xDE7 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xDBC JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xE77 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0xED4 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0xEFB JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0xEFB SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0xF00 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH2 0xD6A SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0xF1A JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0xF06 JUMP JUMPDEST POP SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 TIMESTAMP 0xe8 0xd1 0x2c 0xee SAR PUSH6 0xAC011B69C29A 0xad PUSH26 0x7FD7A173CAA7693FE91761BBBAA39C950E002900000000000000 ",
+ "sourceMap": "641:8586:18:-;;;162:5:82;:18;;-1:-1:-1;;;;;;162:18:82;170:10;162:18;;;641:8586:18;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100985763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166342f1181e8114610248578063494503d41461027857806370712939146102b95780638da5cb5b146102e75780639ad26744146102fc578063ae25532e1461032d578063b918161114610377578063d39de6e9146103b9578063f2fde38b1461041e575b3480156100a457600080fd5b507fffffffff00000000000000000000000000000000000000000000000000000000600035167fa85e59e40000000000000000000000000000000000000000000000000000000081141561024357604080513381526001602082015290812054151561017b577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1553454e4445525f4e4f545f415554484f52495a454400000000000000604052600060605260646000fd5b602860043501357f23b872dd0000000000000000000000000000000000000000000000000000000060005260606024600437602060006064600080855af1600080511160203d14163d15178116905080156101d257005b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f5452414e534645525f4641494c454400000000000000000000000000604052600060605260646000fd5b600080fd5b34801561025457600080fd5b5061027673ffffffffffffffffffffffffffffffffffffffff6004351661044c565b005b34801561028457600080fd5b50610290600435610638565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156102c557600080fd5b5061027673ffffffffffffffffffffffffffffffffffffffff6004351661066d565b3480156102f357600080fd5b50610290610966565b34801561030857600080fd5b5061027673ffffffffffffffffffffffffffffffffffffffff60043516602435610982565b34801561033957600080fd5b50610342610d37565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b34801561038357600080fd5b506103a573ffffffffffffffffffffffffffffffffffffffff60043516610d6d565b604080519115158252519081900360200190f35b3480156103c557600080fd5b506103ce610d82565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561040a5781810151838201526020016103f2565b505050509050019250505060405180910390f35b34801561042a57600080fd5b5061027673ffffffffffffffffffffffffffffffffffffffff60043516610df1565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff161561056757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b600280548290811061064657fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146106f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16151561078a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b60025481101561091f578173ffffffffffffffffffffffffffffffffffffffff1660028281548110151561080757fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561091757600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061085f57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061089257fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906109119082610ed7565b5061091f565b6001016107d7565b604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a0857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff161515610a9e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b6002548110610b0e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff16600282815481101515610b3457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610bc257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610c3d57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610c7057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610cef9082610ed7565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190205b90565b60016020526000908152604090205460ff1681565b60606002805480602002602001604051908101604052809291908181526020018280548015610de757602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dbc575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610e7757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615610ed457600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b815481835581811115610efb57600083815260209020610efb918101908301610f00565b505050565b610d6a91905b80821115610f1a5760008155600101610f06565b50905600a165627a7a7230582042e8d12cee1d65ac011b69c29aad797fd7a173caa7693fe91761bbbaa39c950e0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x98 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x42F1181E DUP2 EQ PUSH2 0x248 JUMPI DUP1 PUSH4 0x494503D4 EQ PUSH2 0x278 JUMPI DUP1 PUSH4 0x70712939 EQ PUSH2 0x2B9 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x2E7 JUMPI DUP1 PUSH4 0x9AD26744 EQ PUSH2 0x2FC JUMPI DUP1 PUSH4 0xAE25532E EQ PUSH2 0x32D JUMPI DUP1 PUSH4 0xB9181611 EQ PUSH2 0x377 JUMPI DUP1 PUSH4 0xD39DE6E9 EQ PUSH2 0x3B9 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x41E JUMPI JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xA4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD AND PUSH32 0xA85E59E400000000000000000000000000000000000000000000000000000000 DUP2 EQ ISZERO PUSH2 0x243 JUMPI PUSH1 0x40 DUP1 MLOAD CALLER DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 DUP2 KECCAK256 SLOAD ISZERO ISZERO PUSH2 0x17B JUMPI PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0x1553454E4445525F4E4F545F415554484F52495A454400000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x28 PUSH1 0x4 CALLDATALOAD ADD CALLDATALOAD PUSH32 0x23B872DD00000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x60 PUSH1 0x24 PUSH1 0x4 CALLDATACOPY PUSH1 0x20 PUSH1 0x0 PUSH1 0x64 PUSH1 0x0 DUP1 DUP6 GAS CALL PUSH1 0x0 DUP1 MLOAD GT PUSH1 0x20 RETURNDATASIZE EQ AND RETURNDATASIZE ISZERO OR DUP2 AND SWAP1 POP DUP1 ISZERO PUSH2 0x1D2 JUMPI STOP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xF5452414E534645525F4641494C454400000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x254 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x276 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x44C JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x284 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x290 PUSH1 0x4 CALLDATALOAD PUSH2 0x638 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x276 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x66D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x290 PUSH2 0x966 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x308 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x276 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x982 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x339 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x342 PUSH2 0xD37 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x383 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3A5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xD6D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3CE PUSH2 0xD82 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x40A JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x3F2 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x42A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x276 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xDF1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x4D2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x567 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F414C52454144595F415554484F52495A454400000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP4 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD SWAP3 DUP4 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0x405787FA12A823E0F2B7631CC41B3BA8828B3321CA811111FA75CD3AA3BB5ACE SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD CALLER SWAP3 SWAP2 PUSH32 0x3147867C59D17E8FA9D522465651D44AAE0A9E38F902F3475B97E58072F0ED4C SWAP2 LOG3 POP JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x646 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x6F4 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x78A JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST PUSH1 0x2 SLOAD DUP2 LT ISZERO PUSH2 0x91F JUMPI DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x807 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x917 JUMPI PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x85F JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0x892 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x911 SWAP1 DUP3 PUSH2 0xED7 JUMP JUMPDEST POP PUSH2 0x91F JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0x7D7 JUMP JUMPDEST PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xA08 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0xA9E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x2 SLOAD DUP2 LT PUSH2 0xB0E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E4445585F4F55545F4F465F424F554E445300000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0xB34 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xBC2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1B PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x415554484F52495A45445F414444524553535F4D49534D415443480000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0xC3D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0xC70 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0xCEF SWAP1 DUP3 PUSH2 0xED7 JUMP JUMPDEST POP PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD SWAP1 KECCAK256 JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x2 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0xDE7 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xDBC JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xE77 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0xED4 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0xEFB JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0xEFB SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0xF00 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH2 0xD6A SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0xF1A JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0xF06 JUMP JUMPDEST POP SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 TIMESTAMP 0xe8 0xd1 0x2c 0xee SAR PUSH6 0xAC011B69C29A 0xad PUSH26 0x7FD7A173CAA7693FE91761BBBAA39C950E002900000000000000 ",
+ "sourceMap": "641:8586:18:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;641:8586:18;1031:66;1027:1;1014:15;1010:88;1493:66;1483:8;1480:80;1477:2;;;1789;1783:9;;1827:6;1809:70;;1919:15;1914:2;1903:14;;1896:39;2030:20;;;2024:27;2017:35;2014:2;;;2153:66;2150:1;2143:77;2252:66;2248:2;2241:78;2351:66;2347:2;2340:78;2450:1;2446:2;2439:13;2483:3;2480:1;2473:14;2014:2;6445;6441:1;6428:15;6424:24;6411:38;6741:66;6738:1;6731:77;7046:2;7042;7039:1;7026:23;7551:2;7488:1;7433:3;7368:1;7310;7240:5;7185:3;7159:459;8361:1;8357;8351:8;8348:15;8319:2;8303:14;8300:22;8271:114;8234:14;8227:22;8203:200;8194:7;8190:214;8179:225;;8424:7;8421:2;;;8454:12;8421:2;8586:66;8583:1;8576:77;8681:66;8677:2;8670:78;8776:66;8772:2;8765:78;8871:1;8867:2;8860:13;8900:3;8897:1;8890:14;1477:2;8996:1;8993;8986:12;1145:320:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1145:320:20;;;;;;;;;1030:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1030:28:20;;;;;;;;;;;;;;;;;;;;;;;;1579:547;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1579:547:20;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;2299:643:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2299:643:20;;;;;;;;;9112:113:18;;8:9:-1;5:2;;;30:1;27;20:12;5:2;9112:113:18;;;;;;;;;;;;;;;;;;;;;;;981:43:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;981:43:20;;;;;;;;;;;;;;;;;;;;;;;;;3039:138;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3039:138:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;3039:138:20;;;;;;;;;;;;;;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;1145:320:20;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1262:18:20;;;;;;;:10;:18;;;;;;;;1261:19;1240:91;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1342:18;;;;;;;1363:4;1342:18;;;;;;;;:25;;;;;;;;1377:11;27:10:-1;;23:18;;;45:23;;1377:24:20;;;;;;;;;;;;;;1416:42;1447:10;;1342:18;1416:42;;;1145:320;:::o;1030:28::-;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1030:28:20;:::o;1579:547::-;1814:9;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1698:18:20;;;;;;;:10;:18;;;;;;;;1677:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1781:18:20;;;;;;;:10;:18;;;;;1774:25;;;;;;1809:252;1833:11;:18;1829:22;;1809:252;;;1894:6;1876:24;;:11;1888:1;1876:14;;;;;;;;;;;;;;;;;;;;;;:24;1872:179;;;1937:11;1949:18;;:22;;;;1937:35;;;;;;;;;;;;;;;;1920:11;:14;;1937:35;;;;;1932:1;;1920:14;;;;;;;;;;;;;;;:52;;;;;;;;;;;;;;;1990:11;:23;;;;;;;;;:::i;:::-;;2031:5;;1872:179;1853:3;;1809:252;;;2075:44;;2108:10;;2075:44;;;;;;;;;1579:547;;:::o;91:20:82:-;;;;;;:::o;2299:643:20:-;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2462:18:20;;;;;;;:10;:18;;;;;;;;2441:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2566:11;:18;2558:26;;2537:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2682:6;2660:28;;:11;2672:5;2660:18;;;;;;;;;;;;;;;;;;;;;;:28;2639:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2759:18;;;;;;;:10;:18;;;;;2752:25;;;;;;2808:11;2820:18;;:22;;;;2808:35;;;;;;;;;;;;;;;;2787:11;:18;;2808:35;;;;;2799:5;;2787:18;;;;;;;;;;;;;;;:56;;;;;;;;;;;;;;;2853:11;:23;;;;;;;;;:::i;:::-;-1:-1:-1;2891:44:20;;2924:10;;2891:44;;;;;;;;;2299:643;;:::o;9112:113:18:-;760:32;;;;;;;;;;;;;;;;9112:113;;:::o;981:43:20:-;;;;;;;;;;;;;;;:::o;3039:138::-;3120:9;3159:11;3152:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3039:138;:::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;425:69;333:167;:::o;641:8586:18:-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;"
+ }
+ }
+ },
+ "sources": {
+ "protocol/AssetProxy/ERC20Proxy.sol": {
+ "id": 18
+ },
+ "protocol/AssetProxy/MixinAuthorizable.sol": {
+ "id": 20
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ },
+ "protocol/AssetProxy/mixins/MAuthorizable.sol": {
+ "id": 24
+ },
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": {
+ "id": 23
+ }
+ },
+ "sourceCodes": {
+ "protocol/AssetProxy/ERC20Proxy.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./MixinAuthorizable.sol\";\n\n\ncontract ERC20Proxy is\n MixinAuthorizable\n{\n // Id of this proxy.\n bytes4 constant internal PROXY_ID = bytes4(keccak256(\"ERC20Token(address)\"));\n \n // solhint-disable-next-line payable-fallback\n function () \n external\n {\n assembly {\n // The first 4 bytes of calldata holds the function selector\n let selector := and(calldataload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000)\n\n // `transferFrom` will be called with the following parameters:\n // assetData Encoded byte array.\n // from Address to transfer asset from.\n // to Address to transfer asset to.\n // amount Amount of asset to transfer.\n // bytes4(keccak256(\"transferFrom(bytes,address,address,uint256)\")) = 0xa85e59e4\n if eq(selector, 0xa85e59e400000000000000000000000000000000000000000000000000000000) {\n\n // To lookup a value in a mapping, we load from the storage location keccak256(k, p),\n // where k is the key left padded to 32 bytes and p is the storage slot\n let start := mload(64)\n mstore(start, and(caller, 0xffffffffffffffffffffffffffffffffffffffff))\n mstore(add(start, 32), authorized_slot)\n\n // Revert if authorized[msg.sender] == false\n if iszero(sload(keccak256(start, 64))) {\n // Revert with `Error(\"SENDER_NOT_AUTHORIZED\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000001553454e4445525f4e4f545f415554484f52495a454400000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n\n // `transferFrom`.\n // The function is marked `external`, so no abi decodeding is done for\n // us. Instead, we expect the `calldata` memory to contain the\n // following:\n //\n // | Area | Offset | Length | Contents |\n // |----------|--------|---------|-------------------------------------|\n // | Header | 0 | 4 | function selector |\n // | Params | | 4 * 32 | function parameters: |\n // | | 4 | | 1. offset to assetData (*) |\n // | | 36 | | 2. from |\n // | | 68 | | 3. to |\n // | | 100 | | 4. amount |\n // | Data | | | assetData: |\n // | | 132 | 32 | assetData Length |\n // | | 164 | ** | assetData Contents |\n //\n // (*): offset is computed from start of function parameters, so offset\n // by an additional 4 bytes in the calldata.\n //\n // (**): see table below to compute length of assetData Contents\n //\n // WARNING: The ABIv2 specification allows additional padding between\n // the Params and Data section. This will result in a larger\n // offset to assetData.\n\n // Asset data itself is encoded as follows:\n //\n // | Area | Offset | Length | Contents |\n // |----------|--------|---------|-------------------------------------|\n // | Header | 0 | 4 | function selector |\n // | Params | | 1 * 32 | function parameters: |\n // | | 4 | 12 + 20 | 1. token address |\n\n // We construct calldata for the `token.transferFrom` ABI.\n // The layout of this calldata is in the table below.\n //\n // | Area | Offset | Length | Contents |\n // |----------|--------|---------|-------------------------------------|\n // | Header | 0 | 4 | function selector |\n // | Params | | 3 * 32 | function parameters: |\n // | | 4 | | 1. from |\n // | | 36 | | 2. to |\n // | | 68 | | 3. amount |\n\n /////// Read token address from calldata ///////\n // * The token address is stored in `assetData`.\n //\n // * The \"offset to assetData\" is stored at offset 4 in the calldata (table 1).\n // [assetDataOffsetFromParams = calldataload(4)]\n //\n // * Notes that the \"offset to assetData\" is relative to the \"Params\" area of calldata;\n // add 4 bytes to account for the length of the \"Header\" area (table 1).\n // [assetDataOffsetFromHeader = assetDataOffsetFromParams + 4]\n //\n // * The \"token address\" is offset 32+4=36 bytes into \"assetData\" (tables 1 & 2).\n // [tokenOffset = assetDataOffsetFromHeader + 36 = calldataload(4) + 4 + 36]\n let token := calldataload(add(calldataload(4), 40))\n \n /////// Setup Header Area ///////\n // This area holds the 4-byte `transferFrom` selector.\n // Any trailing data in transferFromSelector will be\n // overwritten in the next `mstore` call.\n mstore(0, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\n \n /////// Setup Params Area ///////\n // We copy the fields `from`, `to` and `amount` in bulk\n // from our own calldata to the new calldata.\n calldatacopy(4, 36, 96)\n\n /////// Call `token.transferFrom` using the calldata ///////\n let success := call(\n gas, // forward all gas\n token, // call address of token contract\n 0, // don't send any ETH\n 0, // pointer to start of input\n 100, // length of input\n 0, // write output over input\n 32 // output size should be 32 bytes\n )\n\n /////// Check return data. ///////\n // If there is no return data, we assume the token incorrectly\n // does not return a bool. In this case we expect it to revert\n // on failure, which was handled above.\n // If the token does return data, we require that it is a single\n // nonzero 32 bytes value.\n // So the transfer succeeded if the call succeeded and either\n // returned nothing, or returned a non-zero 32 byte value. \n success := and(success, or(\n iszero(returndatasize),\n and(\n eq(returndatasize, 32),\n gt(mload(0), 0)\n )\n ))\n if success {\n return(0, 0)\n }\n \n // Revert with `Error(\"TRANSFER_FAILED\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000000f5452414e534645525f4641494c454400000000000000000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n\n // Revert if undefined function is called\n revert(0, 0)\n }\n }\n\n /// @dev Gets the proxy id associated with the proxy address.\n /// @return Proxy id.\n function getProxyId()\n external\n pure\n returns (bytes4)\n {\n return PROXY_ID;\n }\n}\n",
+ "protocol/AssetProxy/MixinAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/Ownable/Ownable.sol\";\nimport \"./mixins/MAuthorizable.sol\";\n\n\ncontract MixinAuthorizable is\n Ownable,\n MAuthorizable\n{\n /// @dev Only authorized addresses can invoke functions with this modifier.\n modifier onlyAuthorized {\n require(\n authorized[msg.sender],\n \"SENDER_NOT_AUTHORIZED\"\n );\n _;\n }\n\n mapping (address => bool) public authorized;\n address[] public authorities;\n\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external\n onlyOwner\n {\n require(\n !authorized[target],\n \"TARGET_ALREADY_AUTHORIZED\"\n );\n\n authorized[target] = true;\n authorities.push(target);\n emit AuthorizedAddressAdded(target, msg.sender);\n }\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external\n onlyOwner\n {\n require(\n authorized[target],\n \"TARGET_NOT_AUTHORIZED\"\n );\n\n delete authorized[target];\n for (uint256 i = 0; i < authorities.length; i++) {\n if (authorities[i] == target) {\n authorities[i] = authorities[authorities.length - 1];\n authorities.length -= 1;\n break;\n }\n }\n emit AuthorizedAddressRemoved(target, msg.sender);\n }\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external\n onlyOwner\n {\n require(\n authorized[target],\n \"TARGET_NOT_AUTHORIZED\"\n );\n require(\n index < authorities.length,\n \"INDEX_OUT_OF_BOUNDS\"\n );\n require(\n authorities[index] == target,\n \"AUTHORIZED_ADDRESS_MISMATCH\"\n );\n\n delete authorized[target];\n authorities[index] = authorities[authorities.length - 1];\n authorities.length -= 1;\n emit AuthorizedAddressRemoved(target, msg.sender);\n }\n\n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory)\n {\n return authorities;\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n",
+ "protocol/AssetProxy/mixins/MAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../interfaces/IAuthorizable.sol\";\n\n\ncontract MAuthorizable is\n IAuthorizable\n{\n // Event logged when a new address is authorized.\n event AuthorizedAddressAdded(\n address indexed target,\n address indexed caller\n );\n\n // Event logged when a currently authorized address is unauthorized.\n event AuthorizedAddressRemoved(\n address indexed target,\n address indexed caller\n );\n\n /// @dev Only authorized addresses can invoke functions with this modifier.\n modifier onlyAuthorized { revert(); _; }\n}\n",
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/Ownable/IOwnable.sol\";\n\n\ncontract IAuthorizable is\n IOwnable\n{\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n \n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory);\n}\n"
+ },
+ "sourceTreeHashHex": "0x61b379850639517b46c6d60f6c12c18bf568c6d475f90938b2653446bd018009",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/ERC20Token.json b/packages/contracts/generated-artifacts/ERC20Token.json
new file mode 100644
index 000000000..2f060f478
--- /dev/null
+++ b/packages/contracts/generated-artifacts/ERC20Token.json
@@ -0,0 +1,230 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "ERC20Token",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b506106a0806100206000396000f3006080604052600436106100775763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461007c57806318160ddd146100c157806323b872dd146100e857806370a082311461011f578063a9059cbb1461014d578063dd62ed3e1461017e575b600080fd5b34801561008857600080fd5b506100ad73ffffffffffffffffffffffffffffffffffffffff600435166024356101b2565b604080519115158252519081900360200190f35b3480156100cd57600080fd5b506100d6610225565b60408051918252519081900360200190f35b3480156100f457600080fd5b506100ad73ffffffffffffffffffffffffffffffffffffffff6004358116906024351660443561022b565b34801561012b57600080fd5b506100d673ffffffffffffffffffffffffffffffffffffffff60043516610487565b34801561015957600080fd5b506100ad73ffffffffffffffffffffffffffffffffffffffff600435166024356104af565b34801561018a57600080fd5b506100d673ffffffffffffffffffffffffffffffffffffffff6004358116906024351661063c565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025490565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120548211156102bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020908152604080832033845290915290205482111561035e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f45524332305f494e53554646494349454e545f414c4c4f57414e434500000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205482810110156103f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff80841660008181526020818152604080832080548801905593881680835284832080548890039055600182528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060019392505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b3360009081526020819052604081205482111561052d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205482810110156105c357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b336000818152602081815260408083208054879003905573ffffffffffffffffffffffffffffffffffffffff871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff9182166000908152600160209081526040808320939094168252919091522054905600a165627a7a7230582091d5f3099f6c9b96592d237b4ebe70f32ea73e9d586c449c4e770439ccce29ba0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x6A0 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x77 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x95EA7B3 DUP2 EQ PUSH2 0x7C JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0xC1 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0xE8 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x11F JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x14D JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x17E JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x88 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x1B2 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xCD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD6 PUSH2 0x225 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xF4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x22B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x12B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x487 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x159 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x4AF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x18A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x63C JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE DUP2 DUP5 KECCAK256 DUP7 SWAP1 SSTORE DUP2 MLOAD DUP7 DUP2 MSTORE SWAP2 MLOAD SWAP4 SWAP5 SWAP1 SWAP4 SWAP1 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x2 SLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x2BF JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x35E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F414C4C4F57414E434500000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x3F4 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP9 ADD SWAP1 SSTORE SWAP4 DUP9 AND DUP1 DUP4 MSTORE DUP5 DUP4 KECCAK256 DUP1 SLOAD DUP9 SWAP1 SUB SWAP1 SSTORE PUSH1 0x1 DUP3 MSTORE DUP5 DUP4 KECCAK256 CALLER DUP5 MSTORE DUP3 MSTORE SWAP2 DUP5 SWAP1 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE DUP4 MLOAD DUP7 DUP2 MSTORE SWAP4 MLOAD SWAP3 SWAP4 SWAP2 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x52D JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x5C3 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP5 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 SWAP2 0xd5 RETURN MULMOD SWAP16 PUSH13 0x9B96592D237B4EBE70F32EA73E SWAP14 PC PUSH13 0x449C4E770439CCCE29BA002900 ",
+ "sourceMap": "635:3396:70:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;635:3396:70;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100775763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461007c57806318160ddd146100c157806323b872dd146100e857806370a082311461011f578063a9059cbb1461014d578063dd62ed3e1461017e575b600080fd5b34801561008857600080fd5b506100ad73ffffffffffffffffffffffffffffffffffffffff600435166024356101b2565b604080519115158252519081900360200190f35b3480156100cd57600080fd5b506100d6610225565b60408051918252519081900360200190f35b3480156100f457600080fd5b506100ad73ffffffffffffffffffffffffffffffffffffffff6004358116906024351660443561022b565b34801561012b57600080fd5b506100d673ffffffffffffffffffffffffffffffffffffffff60043516610487565b34801561015957600080fd5b506100ad73ffffffffffffffffffffffffffffffffffffffff600435166024356104af565b34801561018a57600080fd5b506100d673ffffffffffffffffffffffffffffffffffffffff6004358116906024351661063c565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025490565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120548211156102bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020908152604080832033845290915290205482111561035e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f45524332305f494e53554646494349454e545f414c4c4f57414e434500000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205482810110156103f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff80841660008181526020818152604080832080548801905593881680835284832080548890039055600182528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060019392505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b3360009081526020819052604081205482111561052d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205482810110156105c357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b336000818152602081815260408083208054879003905573ffffffffffffffffffffffffffffffffffffffff871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff9182166000908152600160209081526040808320939094168252919091522054905600a165627a7a7230582091d5f3099f6c9b96592d237b4ebe70f32ea73e9d586c449c4e770439ccce29ba0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x77 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x95EA7B3 DUP2 EQ PUSH2 0x7C JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0xC1 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0xE8 JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x11F JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x14D JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x17E JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x88 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x1B2 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xCD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD6 PUSH2 0x225 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xF4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x22B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x12B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x487 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x159 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x4AF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x18A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x63C JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE DUP2 DUP5 KECCAK256 DUP7 SWAP1 SSTORE DUP2 MLOAD DUP7 DUP2 MSTORE SWAP2 MLOAD SWAP4 SWAP5 SWAP1 SWAP4 SWAP1 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x2 SLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x2BF JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x35E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F414C4C4F57414E434500000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x3F4 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP9 ADD SWAP1 SSTORE SWAP4 DUP9 AND DUP1 DUP4 MSTORE DUP5 DUP4 KECCAK256 DUP1 SLOAD DUP9 SWAP1 SUB SWAP1 SSTORE PUSH1 0x1 DUP3 MSTORE DUP5 DUP4 KECCAK256 CALLER DUP5 MSTORE DUP3 MSTORE SWAP2 DUP5 SWAP1 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE DUP4 MLOAD DUP7 DUP2 MSTORE SWAP4 MLOAD SWAP3 SWAP4 SWAP2 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x52D JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x5C3 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP8 SWAP1 SUB SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP5 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 SWAP2 0xd5 RETURN MULMOD SWAP16 PUSH13 0x9B96592D237B4EBE70F32EA73E SWAP14 PC PUSH13 0x449C4E770439CCCE29BA002900 ",
+ "sourceMap": "635:3396:70:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2896:270;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2896:270:70;;;;;;;;;;;;;;;;;;;;;;;;;;;3251:119;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3251:119:70;;;;;;;;;;;;;;;;;;;;1872:723;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1872:723:70;;;;;;;;;;;;;;3524:135;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3524:135:70;;;;;;;1055:514;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1055:514:70;;;;;;;;;3867:162;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3867:162:70;;;;;;;;;;;;2896:270;3009:10;2981:4;3001:19;;;:7;:19;;;;;;;;;:29;;;;;;;;;;;:38;;;3054:84;;;;;;;2981:4;;3001:29;;3009:10;;3054:84;;;;;;;;-1:-1:-1;3155:4:70;2896:270;;;;:::o;3251:119::-;3351:12;;3251:119;:::o;1872:723::-;2043:15;;;2002:4;2043:15;;;;;;;;;;;:25;-1:-1:-1;2043:25:70;2022:98;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2151:14;;;;;;;:7;:14;;;;;;;;2166:10;2151:26;;;;;;;;:36;-1:-1:-1;2151:36:70;2130:111;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2298:13;;;:8;:13;;;;;;;;;;;2272:22;;;:39;;2251:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2364:13;;;;:8;:13;;;;;;;;;;;:23;;;;;;2397:15;;;;;;;;;:25;;;;;;;-1:-1:-1;2432:14:70;;;;;2447:10;2432:26;;;;;;;;:36;;;;;;;2488:74;;;;;;;2364:13;;2397:15;;2488:74;;;;;;;;;;-1:-1:-1;2584:4:70;1872:723;;;;;:::o;3524:135::-;3636:16;;3606:7;3636:16;;;;;;;;;;;;3524:135::o;1055:514::-;1186:10;1136:4;1177:20;;;;;;;;;;;:30;-1:-1:-1;1177:30:70;1156:103;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1316:13;;;:8;:13;;;;;;;;;;;1290:22;;;:39;;1269:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1391:10;1382:8;:20;;;;;;;;;;;:30;;;;;;;:20;1422:13;;;;;;;;;:23;;;;;;1461:79;;;;;;;1422:13;;1391:10;1461:79;;;;;;;;;;;-1:-1:-1;1558:4:70;1055:514;;;;:::o;3867:162::-;3997:15;;;;3967:7;3997:15;;;:7;:15;;;;;;;;:25;;;;;;;;;;;;;3867:162::o"
+ }
+ }
+ },
+ "sources": {
+ "tokens/ERC20Token/ERC20Token.sol": {
+ "id": 70
+ },
+ "tokens/ERC20Token/IERC20Token.sol": {
+ "id": 71
+ }
+ },
+ "sourceCodes": {
+ "tokens/ERC20Token/ERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IERC20Token.sol\";\n\n\ncontract ERC20Token is\n IERC20Token\n{\n mapping (address => uint256) internal balances;\n mapping (address => mapping (address => uint256)) internal allowed;\n\n uint256 internal _totalSupply;\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool)\n {\n require(\n balances[msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[msg.sender] -= _value;\n balances[_to] += _value;\n\n emit Transfer(\n msg.sender,\n _to,\n _value\n );\n\n return true;\n }\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n require(\n balances[_from] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n allowed[_from][msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_ALLOWANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[_to] += _value;\n balances[_from] -= _value;\n allowed[_from][msg.sender] -= _value;\n \n emit Transfer(\n _from,\n _to,\n _value\n );\n \n return true;\n }\n\n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool)\n {\n allowed[msg.sender][_spender] = _value;\n emit Approval(\n msg.sender,\n _spender,\n _value\n );\n return true;\n }\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256)\n {\n return _totalSupply;\n }\n\n /// @dev Query the balance of owner\n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256)\n {\n return balances[_owner];\n }\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256)\n {\n return allowed[_owner][_spender];\n }\n}\n",
+ "tokens/ERC20Token/IERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC20Token {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool);\n \n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n \n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256);\n}\n"
+ },
+ "sourceTreeHashHex": "0xee0dcd8415ba0737890f13994332b71d7fbed7c79041929a551c334c497db064",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/ERC721Proxy.json b/packages/contracts/generated-artifacts/ERC721Proxy.json
new file mode 100644
index 000000000..ace5a8cc8
--- /dev/null
+++ b/packages/contracts/generated-artifacts/ERC721Proxy.json
@@ -0,0 +1,252 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "ERC721Proxy",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "addAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "authorities",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "removeAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "removeAuthorizedAddressAtIndex",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getProxyId",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "authorized",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getAuthorizedAddresses",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "fallback"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "AuthorizedAddressAdded",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "AuthorizedAddressRemoved",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405260008054600160a060020a03191633179055610fbe806100256000396000f3006080604052600436106100985763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166342f1181e81146102bc578063494503d4146102ec578063707129391461032d5780638da5cb5b1461035b5780639ad2674414610370578063ae25532e146103a1578063b9181611146103eb578063d39de6e91461042d578063f2fde38b14610492575b3480156100a457600080fd5b507fffffffff00000000000000000000000000000000000000000000000000000000600035167fa85e59e4000000000000000000000000000000000000000000000000000000008114156102b757604080513381526001602082015290812054151561017b577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1553454e4445525f4e4f545f415554484f52495a454400000000000000604052600060605260646000fd5b600160643503156101f7577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0e494e56414c49445f414d4f554e540000000000000000000000000000604052600060605260646000fd5b7f23b872dd000000000000000000000000000000000000000000000000000000006000526040602460043760043560206048820160443760288101356000806064600080855af1801561024657005b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f5452414e534645525f4641494c454400000000000000000000000000604052600060605260646000fd5b600080fd5b3480156102c857600080fd5b506102ea73ffffffffffffffffffffffffffffffffffffffff600435166104c0565b005b3480156102f857600080fd5b506103046004356106ac565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561033957600080fd5b506102ea73ffffffffffffffffffffffffffffffffffffffff600435166106e1565b34801561036757600080fd5b506103046109da565b34801561037c57600080fd5b506102ea73ffffffffffffffffffffffffffffffffffffffff600435166024356109f6565b3480156103ad57600080fd5b506103b6610dab565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b3480156103f757600080fd5b5061041973ffffffffffffffffffffffffffffffffffffffff60043516610de1565b604080519115158252519081900360200190f35b34801561043957600080fd5b50610442610df6565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561047e578181015183820152602001610466565b505050509050019250505060405180910390f35b34801561049e57600080fd5b506102ea73ffffffffffffffffffffffffffffffffffffffff60043516610e65565b60005473ffffffffffffffffffffffffffffffffffffffff16331461054657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff16156105db57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b60028054829081106106ba57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6000805473ffffffffffffffffffffffffffffffffffffffff16331461076857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff1615156107fe57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b600254811015610993578173ffffffffffffffffffffffffffffffffffffffff1660028281548110151561087b57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561098b57600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81019081106108d357fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061090657fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906109859082610f4b565b50610993565b60010161084b565b604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a7c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff161515610b1257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b6002548110610b8257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff16600282815481101515610ba857fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610c3657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610cb157fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610ce457fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610d639082610f4b565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190205b90565b60016020526000908152604090205460ff1681565b60606002805480602002602001604051908101604052809291908181526020018280548015610e5b57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610e30575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610eeb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615610f4857600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b815481835581811115610f6f57600083815260209020610f6f918101908301610f74565b505050565b610dde91905b80821115610f8e5760008155600101610f7a565b50905600a165627a7a72305820ac672b5450c1bc3c342fdf375acf89bf638b635eb0703954514ed9b02a15672e0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE PUSH2 0xFBE DUP1 PUSH2 0x25 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x98 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x42F1181E DUP2 EQ PUSH2 0x2BC JUMPI DUP1 PUSH4 0x494503D4 EQ PUSH2 0x2EC JUMPI DUP1 PUSH4 0x70712939 EQ PUSH2 0x32D JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x35B JUMPI DUP1 PUSH4 0x9AD26744 EQ PUSH2 0x370 JUMPI DUP1 PUSH4 0xAE25532E EQ PUSH2 0x3A1 JUMPI DUP1 PUSH4 0xB9181611 EQ PUSH2 0x3EB JUMPI DUP1 PUSH4 0xD39DE6E9 EQ PUSH2 0x42D JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x492 JUMPI JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xA4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD AND PUSH32 0xA85E59E400000000000000000000000000000000000000000000000000000000 DUP2 EQ ISZERO PUSH2 0x2B7 JUMPI PUSH1 0x40 DUP1 MLOAD CALLER DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 DUP2 KECCAK256 SLOAD ISZERO ISZERO PUSH2 0x17B JUMPI PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0x1553454E4445525F4E4F545F415554484F52495A454400000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x64 CALLDATALOAD SUB ISZERO PUSH2 0x1F7 JUMPI PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xE494E56414C49445F414D4F554E540000000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST PUSH32 0x23B872DD00000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x24 PUSH1 0x4 CALLDATACOPY PUSH1 0x4 CALLDATALOAD PUSH1 0x20 PUSH1 0x48 DUP3 ADD PUSH1 0x44 CALLDATACOPY PUSH1 0x28 DUP2 ADD CALLDATALOAD PUSH1 0x0 DUP1 PUSH1 0x64 PUSH1 0x0 DUP1 DUP6 GAS CALL DUP1 ISZERO PUSH2 0x246 JUMPI STOP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xF5452414E534645525F4641494C454400000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2C8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2EA PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x4C0 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x304 PUSH1 0x4 CALLDATALOAD PUSH2 0x6AC JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x339 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2EA PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x6E1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x367 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x304 PUSH2 0x9DA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x37C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2EA PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x9F6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3AD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3B6 PUSH2 0xDAB JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3F7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x419 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xDE1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x439 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x442 PUSH2 0xDF6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x47E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x466 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x49E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2EA PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xE65 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x546 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x5DB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F414C52454144595F415554484F52495A454400000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP4 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD SWAP3 DUP4 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0x405787FA12A823E0F2B7631CC41B3BA8828B3321CA811111FA75CD3AA3BB5ACE SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD CALLER SWAP3 SWAP2 PUSH32 0x3147867C59D17E8FA9D522465651D44AAE0A9E38F902F3475B97E58072F0ED4C SWAP2 LOG3 POP JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x6BA JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x768 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x7FE JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST PUSH1 0x2 SLOAD DUP2 LT ISZERO PUSH2 0x993 JUMPI DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x87B JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x98B JUMPI PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x8D3 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0x906 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x985 SWAP1 DUP3 PUSH2 0xF4B JUMP JUMPDEST POP PUSH2 0x993 JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0x84B JUMP JUMPDEST PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xA7C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0xB12 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x2 SLOAD DUP2 LT PUSH2 0xB82 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E4445585F4F55545F4F465F424F554E445300000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0xBA8 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xC36 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1B PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x415554484F52495A45445F414444524553535F4D49534D415443480000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0xCB1 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0xCE4 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0xD63 SWAP1 DUP3 PUSH2 0xF4B JUMP JUMPDEST POP PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x455243373231546F6B656E28616464726573732C75696E743235362900000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x1C ADD SWAP1 KECCAK256 JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x2 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0xE5B JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xE30 JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xEEB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0xF48 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0xF6F JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0xF6F SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0xF74 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH2 0xDDE SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0xF8E JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0xF7A JUMP JUMPDEST POP SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xac PUSH8 0x2B5450C1BC3C342F 0xdf CALLDATACOPY GAS 0xcf DUP10 0xbf PUSH4 0x8B635EB0 PUSH17 0x3954514ED9B02A15672E00290000000000 ",
+ "sourceMap": "641:7861:19:-;;;162:5:82;:18;;-1:-1:-1;;;;;;162:18:82;170:10;162:18;;;641:7861:19;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100985763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166342f1181e81146102bc578063494503d4146102ec578063707129391461032d5780638da5cb5b1461035b5780639ad2674414610370578063ae25532e146103a1578063b9181611146103eb578063d39de6e91461042d578063f2fde38b14610492575b3480156100a457600080fd5b507fffffffff00000000000000000000000000000000000000000000000000000000600035167fa85e59e4000000000000000000000000000000000000000000000000000000008114156102b757604080513381526001602082015290812054151561017b577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1553454e4445525f4e4f545f415554484f52495a454400000000000000604052600060605260646000fd5b600160643503156101f7577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0e494e56414c49445f414d4f554e540000000000000000000000000000604052600060605260646000fd5b7f23b872dd000000000000000000000000000000000000000000000000000000006000526040602460043760043560206048820160443760288101356000806064600080855af1801561024657005b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f5452414e534645525f4641494c454400000000000000000000000000604052600060605260646000fd5b600080fd5b3480156102c857600080fd5b506102ea73ffffffffffffffffffffffffffffffffffffffff600435166104c0565b005b3480156102f857600080fd5b506103046004356106ac565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561033957600080fd5b506102ea73ffffffffffffffffffffffffffffffffffffffff600435166106e1565b34801561036757600080fd5b506103046109da565b34801561037c57600080fd5b506102ea73ffffffffffffffffffffffffffffffffffffffff600435166024356109f6565b3480156103ad57600080fd5b506103b6610dab565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b3480156103f757600080fd5b5061041973ffffffffffffffffffffffffffffffffffffffff60043516610de1565b604080519115158252519081900360200190f35b34801561043957600080fd5b50610442610df6565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561047e578181015183820152602001610466565b505050509050019250505060405180910390f35b34801561049e57600080fd5b506102ea73ffffffffffffffffffffffffffffffffffffffff60043516610e65565b60005473ffffffffffffffffffffffffffffffffffffffff16331461054657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff16156105db57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b60028054829081106106ba57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6000805473ffffffffffffffffffffffffffffffffffffffff16331461076857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff1615156107fe57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b600254811015610993578173ffffffffffffffffffffffffffffffffffffffff1660028281548110151561087b57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561098b57600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81019081106108d357fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061090657fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906109859082610f4b565b50610993565b60010161084b565b604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a7c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff161515610b1257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b6002548110610b8257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff16600282815481101515610ba857fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610c3657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610cb157fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610ce457fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610d639082610f4b565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190205b90565b60016020526000908152604090205460ff1681565b60606002805480602002602001604051908101604052809291908181526020018280548015610e5b57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610e30575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610eeb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615610f4857600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b815481835581811115610f6f57600083815260209020610f6f918101908301610f74565b505050565b610dde91905b80821115610f8e5760008155600101610f7a565b50905600a165627a7a72305820ac672b5450c1bc3c342fdf375acf89bf638b635eb0703954514ed9b02a15672e0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x98 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x42F1181E DUP2 EQ PUSH2 0x2BC JUMPI DUP1 PUSH4 0x494503D4 EQ PUSH2 0x2EC JUMPI DUP1 PUSH4 0x70712939 EQ PUSH2 0x32D JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x35B JUMPI DUP1 PUSH4 0x9AD26744 EQ PUSH2 0x370 JUMPI DUP1 PUSH4 0xAE25532E EQ PUSH2 0x3A1 JUMPI DUP1 PUSH4 0xB9181611 EQ PUSH2 0x3EB JUMPI DUP1 PUSH4 0xD39DE6E9 EQ PUSH2 0x42D JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x492 JUMPI JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xA4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD AND PUSH32 0xA85E59E400000000000000000000000000000000000000000000000000000000 DUP2 EQ ISZERO PUSH2 0x2B7 JUMPI PUSH1 0x40 DUP1 MLOAD CALLER DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 DUP2 KECCAK256 SLOAD ISZERO ISZERO PUSH2 0x17B JUMPI PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0x1553454E4445525F4E4F545F415554484F52495A454400000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x64 CALLDATALOAD SUB ISZERO PUSH2 0x1F7 JUMPI PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xE494E56414C49445F414D4F554E540000000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST PUSH32 0x23B872DD00000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH1 0x40 PUSH1 0x24 PUSH1 0x4 CALLDATACOPY PUSH1 0x4 CALLDATALOAD PUSH1 0x20 PUSH1 0x48 DUP3 ADD PUSH1 0x44 CALLDATACOPY PUSH1 0x28 DUP2 ADD CALLDATALOAD PUSH1 0x0 DUP1 PUSH1 0x64 PUSH1 0x0 DUP1 DUP6 GAS CALL DUP1 ISZERO PUSH2 0x246 JUMPI STOP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xF5452414E534645525F4641494C454400000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2C8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2EA PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x4C0 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x304 PUSH1 0x4 CALLDATALOAD PUSH2 0x6AC JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x339 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2EA PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x6E1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x367 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x304 PUSH2 0x9DA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x37C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2EA PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x9F6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3AD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3B6 PUSH2 0xDAB JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3F7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x419 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xDE1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x439 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x442 PUSH2 0xDF6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x47E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x466 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x49E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2EA PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xE65 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x546 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x5DB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F414C52454144595F415554484F52495A454400000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP4 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD SWAP3 DUP4 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0x405787FA12A823E0F2B7631CC41B3BA8828B3321CA811111FA75CD3AA3BB5ACE SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD CALLER SWAP3 SWAP2 PUSH32 0x3147867C59D17E8FA9D522465651D44AAE0A9E38F902F3475B97E58072F0ED4C SWAP2 LOG3 POP JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x6BA JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x768 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x7FE JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST PUSH1 0x2 SLOAD DUP2 LT ISZERO PUSH2 0x993 JUMPI DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x87B JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x98B JUMPI PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x8D3 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0x906 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x985 SWAP1 DUP3 PUSH2 0xF4B JUMP JUMPDEST POP PUSH2 0x993 JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0x84B JUMP JUMPDEST PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xA7C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0xB12 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x2 SLOAD DUP2 LT PUSH2 0xB82 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E4445585F4F55545F4F465F424F554E445300000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0xBA8 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0xC36 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1B PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x415554484F52495A45445F414444524553535F4D49534D415443480000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0xCB1 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0xCE4 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0xD63 SWAP1 DUP3 PUSH2 0xF4B JUMP JUMPDEST POP PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x455243373231546F6B656E28616464726573732C75696E743235362900000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x1C ADD SWAP1 KECCAK256 JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x2 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0xE5B JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xE30 JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xEEB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0xF48 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0xF6F JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0xF6F SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0xF74 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH2 0xDDE SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0xF8E JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0xF7A JUMP JUMPDEST POP SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xac PUSH8 0x2B5450C1BC3C342F 0xdf CALLDATACOPY GAS 0xcf DUP10 0xbf PUSH4 0x8B635EB0 PUSH17 0x3954514ED9B02A15672E00290000000000 ",
+ "sourceMap": "641:7861:19:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;641:7861:19;1037:66;1033:1;1020:15;1016:88;1499:66;1489:8;1486:80;1483:2;;;1795;1789:9;;1833:6;1815:70;;1925:15;1920:2;1909:14;;1902:39;2036:20;;;2030:27;2023:35;2020:2;;;2159:66;2156:1;2149:77;2258:66;2254:2;2247:78;2357:66;2353:2;2346:78;2456:1;2452:2;2445:13;2489:3;2486:1;2479:14;2020:2;5829:1;5823:3;5810:17;5806:25;5803:2;;;5925:66;5922:1;5915:77;6024:66;6020:2;6013:78;6123:66;6119:2;6112:78;6222:1;6218:2;6211:13;6255:3;6252:1;6245:14;5803:2;6553:66;6550:1;6543:77;6848:2;6844;6841:1;6828:23;6988:1;6975:15;7050:2;7045;7028:15;7024:24;7020:2;7007:46;7195:2;7178:15;7174:24;7161:38;7620:1;7560;7505:3;7440:1;7382;7312:5;7257:3;7231:448;7699:7;7696:2;;;7729:12;7696:2;7861:66;7858:1;7851:77;7956:66;7952:2;7945:78;8051:66;8047:2;8040:78;8146:1;8142:2;8135:13;8175:3;8172:1;8165:14;1483:2;8271:1;8268;8261:12;1145:320:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1145:320:20;;;;;;;;;1030:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1030:28:20;;;;;;;;;;;;;;;;;;;;;;;;1579:547;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1579:547:20;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;2299:643:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2299:643:20;;;;;;;;;8387:113:19;;8:9:-1;5:2;;;30:1;27;20:12;5:2;8387:113:19;;;;;;;;;;;;;;;;;;;;;;;981:43:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;981:43:20;;;;;;;;;;;;;;;;;;;;;;;;;3039:138;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3039:138:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;3039:138:20;;;;;;;;;;;;;;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;1145:320:20;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1262:18:20;;;;;;;:10;:18;;;;;;;;1261:19;1240:91;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1342:18;;;;;;;1363:4;1342:18;;;;;;;;:25;;;;;;;;1377:11;27:10:-1;;23:18;;;45:23;;1377:24:20;;;;;;;;;;;;;;1416:42;1447:10;;1342:18;1416:42;;;1145:320;:::o;1030:28::-;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1030:28:20;:::o;1579:547::-;1814:9;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1698:18:20;;;;;;;:10;:18;;;;;;;;1677:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1781:18:20;;;;;;;:10;:18;;;;;1774:25;;;;;;1809:252;1833:11;:18;1829:22;;1809:252;;;1894:6;1876:24;;:11;1888:1;1876:14;;;;;;;;;;;;;;;;;;;;;;:24;1872:179;;;1937:11;1949:18;;:22;;;;1937:35;;;;;;;;;;;;;;;;1920:11;:14;;1937:35;;;;;1932:1;;1920:14;;;;;;;;;;;;;;;:52;;;;;;;;;;;;;;;1990:11;:23;;;;;;;;;:::i;:::-;;2031:5;;1872:179;1853:3;;1809:252;;;2075:44;;2108:10;;2075:44;;;;;;;;;1579:547;;:::o;91:20:82:-;;;;;;:::o;2299:643:20:-;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2462:18:20;;;;;;;:10;:18;;;;;;;;2441:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2566:11;:18;2558:26;;2537:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2682:6;2660:28;;:11;2672:5;2660:18;;;;;;;;;;;;;;;;;;;;;;:28;2639:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2759:18;;;;;;;:10;:18;;;;;2752:25;;;;;;2808:11;2820:18;;:22;;;;2808:35;;;;;;;;;;;;;;;;2787:11;:18;;2808:35;;;;;2799:5;;2787:18;;;;;;;;;;;;;;;:56;;;;;;;;;;;;;;;2853:11;:23;;;;;;;;;:::i;:::-;-1:-1:-1;2891:44:20;;2924:10;;2891:44;;;;;;;;;2299:643;;:::o;8387:113:19:-;761:41;;;;;;;;;;;;;;;;8387:113;;:::o;981:43:20:-;;;;;;;;;;;;;;;:::o;3039:138::-;3120:9;3159:11;3152:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3039:138;:::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;425:69;333:167;:::o;641:7861:19:-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;"
+ }
+ }
+ },
+ "sources": {
+ "protocol/AssetProxy/ERC721Proxy.sol": {
+ "id": 19
+ },
+ "protocol/AssetProxy/MixinAuthorizable.sol": {
+ "id": 20
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ },
+ "protocol/AssetProxy/mixins/MAuthorizable.sol": {
+ "id": 24
+ },
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": {
+ "id": 23
+ }
+ },
+ "sourceCodes": {
+ "protocol/AssetProxy/ERC721Proxy.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./MixinAuthorizable.sol\";\n\n\ncontract ERC721Proxy is\n MixinAuthorizable\n{\n // Id of this proxy.\n bytes4 constant internal PROXY_ID = bytes4(keccak256(\"ERC721Token(address,uint256)\"));\n\n // solhint-disable-next-line payable-fallback\n function () \n external\n {\n assembly {\n // The first 4 bytes of calldata holds the function selector\n let selector := and(calldataload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000)\n\n // `transferFrom` will be called with the following parameters:\n // assetData Encoded byte array.\n // from Address to transfer asset from.\n // to Address to transfer asset to.\n // amount Amount of asset to transfer.\n // bytes4(keccak256(\"transferFrom(bytes,address,address,uint256)\")) = 0xa85e59e4\n if eq(selector, 0xa85e59e400000000000000000000000000000000000000000000000000000000) {\n\n // To lookup a value in a mapping, we load from the storage location keccak256(k, p),\n // where k is the key left padded to 32 bytes and p is the storage slot\n let start := mload(64)\n mstore(start, and(caller, 0xffffffffffffffffffffffffffffffffffffffff))\n mstore(add(start, 32), authorized_slot)\n\n // Revert if authorized[msg.sender] == false\n if iszero(sload(keccak256(start, 64))) {\n // Revert with `Error(\"SENDER_NOT_AUTHORIZED\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000001553454e4445525f4e4f545f415554484f52495a454400000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n\n // `transferFrom`.\n // The function is marked `external`, so no abi decodeding is done for\n // us. Instead, we expect the `calldata` memory to contain the\n // following:\n //\n // | Area | Offset | Length | Contents |\n // |----------|--------|---------|-------------------------------------|\n // | Header | 0 | 4 | function selector |\n // | Params | | 4 * 32 | function parameters: |\n // | | 4 | | 1. offset to assetData (*) |\n // | | 36 | | 2. from |\n // | | 68 | | 3. to |\n // | | 100 | | 4. amount |\n // | Data | | | assetData: |\n // | | 132 | 32 | assetData Length |\n // | | 164 | ** | assetData Contents |\n //\n // (*): offset is computed from start of function parameters, so offset\n // by an additional 4 bytes in the calldata.\n //\n // (**): see table below to compute length of assetData Contents\n //\n // WARNING: The ABIv2 specification allows additional padding between\n // the Params and Data section. This will result in a larger\n // offset to assetData.\n\n // Asset data itself is encoded as follows:\n //\n // | Area | Offset | Length | Contents |\n // |----------|--------|---------|-------------------------------------|\n // | Header | 0 | 4 | function selector |\n // | Params | | 2 * 32 | function parameters: |\n // | | 4 | 12 + 20 | 1. token address |\n // | | 36 | | 2. tokenId |\n \n // We construct calldata for the `token.transferFrom` ABI.\n // The layout of this calldata is in the table below.\n // \n // | Area | Offset | Length | Contents |\n // |----------|--------|---------|-------------------------------------|\n // | Header | 0 | 4 | function selector |\n // | Params | | 3 * 32 | function parameters: |\n // | | 4 | | 1. from |\n // | | 36 | | 2. to |\n // | | 68 | | 3. tokenId |\n\n // There exists only 1 of each token.\n // require(amount == 1, \"INVALID_AMOUNT\")\n if sub(calldataload(100), 1) {\n // Revert with `Error(\"INVALID_AMOUNT\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000000e494e56414c49445f414d4f554e540000000000000000000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n\n /////// Setup Header Area ///////\n // This area holds the 4-byte `transferFrom` selector.\n // Any trailing data in transferFromSelector will be\n // overwritten in the next `mstore` call.\n mstore(0, 0x23b872dd00000000000000000000000000000000000000000000000000000000)\n \n /////// Setup Params Area ///////\n // We copy the fields `from` and `to` in bulk\n // from our own calldata to the new calldata.\n calldatacopy(4, 36, 64)\n\n // Copy `tokenId` field from our own calldata to the new calldata.\n let assetDataOffset := calldataload(4)\n calldatacopy(68, add(assetDataOffset, 72), 32)\n\n /////// Call `token.transferFrom` using the calldata ///////\n let token := calldataload(add(assetDataOffset, 40))\n let success := call(\n gas, // forward all gas\n token, // call address of token contract\n 0, // don't send any ETH\n 0, // pointer to start of input\n 100, // length of input\n 0, // write output to null\n 0 // output size is 0 bytes\n )\n if success {\n return(0, 0)\n }\n \n // Revert with `Error(\"TRANSFER_FAILED\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000000f5452414e534645525f4641494c454400000000000000000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n\n // Revert if undefined function is called\n revert(0, 0)\n }\n }\n\n /// @dev Gets the proxy id associated with the proxy address.\n /// @return Proxy id.\n function getProxyId()\n external\n pure\n returns (bytes4)\n {\n return PROXY_ID;\n }\n}\n",
+ "protocol/AssetProxy/MixinAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/Ownable/Ownable.sol\";\nimport \"./mixins/MAuthorizable.sol\";\n\n\ncontract MixinAuthorizable is\n Ownable,\n MAuthorizable\n{\n /// @dev Only authorized addresses can invoke functions with this modifier.\n modifier onlyAuthorized {\n require(\n authorized[msg.sender],\n \"SENDER_NOT_AUTHORIZED\"\n );\n _;\n }\n\n mapping (address => bool) public authorized;\n address[] public authorities;\n\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external\n onlyOwner\n {\n require(\n !authorized[target],\n \"TARGET_ALREADY_AUTHORIZED\"\n );\n\n authorized[target] = true;\n authorities.push(target);\n emit AuthorizedAddressAdded(target, msg.sender);\n }\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external\n onlyOwner\n {\n require(\n authorized[target],\n \"TARGET_NOT_AUTHORIZED\"\n );\n\n delete authorized[target];\n for (uint256 i = 0; i < authorities.length; i++) {\n if (authorities[i] == target) {\n authorities[i] = authorities[authorities.length - 1];\n authorities.length -= 1;\n break;\n }\n }\n emit AuthorizedAddressRemoved(target, msg.sender);\n }\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external\n onlyOwner\n {\n require(\n authorized[target],\n \"TARGET_NOT_AUTHORIZED\"\n );\n require(\n index < authorities.length,\n \"INDEX_OUT_OF_BOUNDS\"\n );\n require(\n authorities[index] == target,\n \"AUTHORIZED_ADDRESS_MISMATCH\"\n );\n\n delete authorized[target];\n authorities[index] = authorities[authorities.length - 1];\n authorities.length -= 1;\n emit AuthorizedAddressRemoved(target, msg.sender);\n }\n\n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory)\n {\n return authorities;\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n",
+ "protocol/AssetProxy/mixins/MAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../interfaces/IAuthorizable.sol\";\n\n\ncontract MAuthorizable is\n IAuthorizable\n{\n // Event logged when a new address is authorized.\n event AuthorizedAddressAdded(\n address indexed target,\n address indexed caller\n );\n\n // Event logged when a currently authorized address is unauthorized.\n event AuthorizedAddressRemoved(\n address indexed target,\n address indexed caller\n );\n\n /// @dev Only authorized addresses can invoke functions with this modifier.\n modifier onlyAuthorized { revert(); _; }\n}\n",
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/Ownable/IOwnable.sol\";\n\n\ncontract IAuthorizable is\n IOwnable\n{\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n \n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory);\n}\n"
+ },
+ "sourceTreeHashHex": "0x93eec0587c0db8b68951a9c0c348c14e22831361b7fe38bb2d29a09ad670e10d",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/ERC721Token.json b/packages/contracts/generated-artifacts/ERC721Token.json
new file mode 100644
index 000000000..682063332
--- /dev/null
+++ b/packages/contracts/generated-artifacts/ERC721Token.json
@@ -0,0 +1,317 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "ERC721Token",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getApproved",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_approved",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "safeTransferFrom",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "ownerOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_operator",
+ "type": "address"
+ },
+ {
+ "name": "_approved",
+ "type": "bool"
+ }
+ ],
+ "name": "setApprovalForAll",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ },
+ {
+ "name": "_data",
+ "type": "bytes"
+ }
+ ],
+ "name": "safeTransferFrom",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_operator",
+ "type": "address"
+ }
+ ],
+ "name": "isApprovedForAll",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_approved",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_operator",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_approved",
+ "type": "bool"
+ }
+ ],
+ "name": "ApprovalForAll",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b50610e2d806100206000396000f3006080604052600436106100985763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663081812fc811461009d578063095ea7b3146100de57806323b872dd1461011157806342842e0e146101485780636352211e1461017f57806370a0823114610197578063a22cb465146101d7578063b88d4fde1461020a578063e985e9c514610250575b600080fd5b3480156100a957600080fd5b506100b5600435610298565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100ea57600080fd5b5061010f73ffffffffffffffffffffffffffffffffffffffff600435166024356102c0565b005b34801561011d57600080fd5b5061010f73ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356103e4565b34801561015457600080fd5b5061010f73ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610744565b34801561018b57600080fd5b506100b560043561090f565b3480156101a357600080fd5b506101c573ffffffffffffffffffffffffffffffffffffffff600435166109a8565b60408051918252519081900360200190f35b3480156101e357600080fd5b5061010f73ffffffffffffffffffffffffffffffffffffffff600435166024351515610a57565b34801561021657600080fd5b5061010f73ffffffffffffffffffffffffffffffffffffffff60048035821691602480359091169160443591606435908101910135610af0565b34801561025c57600080fd5b5061028473ffffffffffffffffffffffffffffffffffffffff60043581169060243516610cd4565b604080519115158252519081900360200190f35b60009081526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60006102cb8261090f565b90503373ffffffffffffffffffffffffffffffffffffffff821614806102f657506102f68133610cd4565b151561036357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f494e56414c49445f53454e4445520000000000000000000000604482015290519081900360640190fd5b60008281526001602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000808073ffffffffffffffffffffffffffffffffffffffff8516151561046c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f5a45524f5f544f5f4144445245535300000000000000000000604482015290519081900360640190fd5b6104758461090f565b925073ffffffffffffffffffffffffffffffffffffffff868116908416146104fe57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f4f574e45525f4d49534d415443480000000000000000000000604482015290519081900360640190fd5b33915061050a84610298565b90508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148061054b575061054b8383610cd4565b8061058157508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b15156105ee57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f494e56414c49445f5350454e44455200000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561063f57600084815260016020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b60008481526020818152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8a8116919091179091558916835260029091529020546106a8906001610d0f565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526002602052604080822093909355908716815220546106e5906001610d86565b73ffffffffffffffffffffffffffffffffffffffff808716600081815260026020526040808220949094559251879391928a16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050505050565b6000806107528585856103e4565b833b9150600082111561090857604080517f150b7a0200000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8781166024830152604482018690526080606483015260006084830181905292519087169263150b7a029260c480820193602093909283900390910190829087803b1580156107ef57600080fd5b505af1158015610803573d6000803e3d6000fd5b505050506040513d602081101561081957600080fd5b5051604080517f6f6e455243373231526563656976656428616464726573732c6164647265737381527f2c75696e743235362c62797465732900000000000000000000000000000000006020820152905190819003602f0190209091507fffffffff0000000000000000000000000000000000000000000000000000000080831691161461090857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b5050505050565b60008181526020819052604081205473ffffffffffffffffffffffffffffffffffffffff168015156109a257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82161515610a2e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b600080610afe8787876103e4565b853b91506000821115610ccb576040517f150b7a02000000000000000000000000000000000000000000000000000000008152336004820181815273ffffffffffffffffffffffffffffffffffffffff8a811660248501526044840189905260806064850190815260848501889052908a169363150b7a0293928c928b928b928b92909160a40184848082843782019150509650505050505050602060405180830381600087803b158015610bb257600080fd5b505af1158015610bc6573d6000803e3d6000fd5b505050506040513d6020811015610bdc57600080fd5b5051604080517f6f6e455243373231526563656976656428616464726573732c6164647265737381527f2c75696e743235362c62797465732900000000000000000000000000000000006020820152905190819003602f0190209091507fffffffff00000000000000000000000000000000000000000000000000000000808316911614610ccb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260036020908152604080832093909416825291909152205460ff1690565b600082821115610d8057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604482015290519081900360640190fd5b50900390565b600082820183811015610dfa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b93925050505600a165627a7a723058206304e16583c3f16f25f8a56ce47c21c8a869eea79adeebf1e12952bc0706904a0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE2D DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x98 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x81812FC DUP2 EQ PUSH2 0x9D JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0xDE JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x111 JUMPI DUP1 PUSH4 0x42842E0E EQ PUSH2 0x148 JUMPI DUP1 PUSH4 0x6352211E EQ PUSH2 0x17F JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x197 JUMPI DUP1 PUSH4 0xA22CB465 EQ PUSH2 0x1D7 JUMPI DUP1 PUSH4 0xB88D4FDE EQ PUSH2 0x20A JUMPI DUP1 PUSH4 0xE985E9C5 EQ PUSH2 0x250 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xA9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB5 PUSH1 0x4 CALLDATALOAD PUSH2 0x298 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x2C0 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x11D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x3E4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x154 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x744 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x18B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB5 PUSH1 0x4 CALLDATALOAD PUSH2 0x90F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1A3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1C5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x9A8 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1E3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xA57 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x216 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 DUP1 CALLDATALOAD DUP3 AND SWAP2 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 SWAP2 AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 PUSH1 0x64 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0xAF0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x25C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x284 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0xCD4 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2CB DUP3 PUSH2 0x90F JUMP JUMPDEST SWAP1 POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND EQ DUP1 PUSH2 0x2F6 JUMPI POP PUSH2 0x2F6 DUP2 CALLER PUSH2 0xCD4 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x363 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454E4445520000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 DUP2 AND SWAP2 DUP3 OR SWAP1 SWAP3 SSTORE SWAP2 MLOAD DUP6 SWAP4 SWAP2 DUP6 AND SWAP2 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP2 LOG4 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND ISZERO ISZERO PUSH2 0x46C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F544F5F4144445245535300000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x475 DUP5 PUSH2 0x90F JUMP JUMPDEST SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 DUP2 AND SWAP1 DUP5 AND EQ PUSH2 0x4FE JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F4F574E45525F4D49534D415443480000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER SWAP2 POP PUSH2 0x50A DUP5 PUSH2 0x298 JUMP JUMPDEST SWAP1 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ DUP1 PUSH2 0x54B JUMPI POP PUSH2 0x54B DUP4 DUP4 PUSH2 0xCD4 JUMP JUMPDEST DUP1 PUSH2 0x581 JUMPI POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ JUMPDEST ISZERO ISZERO PUSH2 0x5EE JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F5350454E44455200000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x63F JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP11 DUP2 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SWAP2 SSTORE DUP10 AND DUP4 MSTORE PUSH1 0x2 SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH2 0x6A8 SWAP1 PUSH1 0x1 PUSH2 0xD0F JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP9 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP4 SWAP1 SWAP4 SSTORE SWAP1 DUP8 AND DUP2 MSTORE KECCAK256 SLOAD PUSH2 0x6E5 SWAP1 PUSH1 0x1 PUSH2 0xD86 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP8 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP5 SWAP1 SWAP5 SSTORE SWAP3 MLOAD DUP8 SWAP4 SWAP2 SWAP3 DUP11 AND SWAP2 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP2 LOG4 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x752 DUP6 DUP6 DUP6 PUSH2 0x3E4 JUMP JUMPDEST DUP4 EXTCODESIZE SWAP2 POP PUSH1 0x0 DUP3 GT ISZERO PUSH2 0x908 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x150B7A0200000000000000000000000000000000000000000000000000000000 DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 DUP2 AND PUSH1 0x24 DUP4 ADD MSTORE PUSH1 0x44 DUP3 ADD DUP7 SWAP1 MSTORE PUSH1 0x80 PUSH1 0x64 DUP4 ADD MSTORE PUSH1 0x0 PUSH1 0x84 DUP4 ADD DUP2 SWAP1 MSTORE SWAP3 MLOAD SWAP1 DUP8 AND SWAP3 PUSH4 0x150B7A02 SWAP3 PUSH1 0xC4 DUP1 DUP3 ADD SWAP4 PUSH1 0x20 SWAP4 SWAP1 SWAP3 DUP4 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 DUP3 SWAP1 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x7EF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x803 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x819 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C61646472657373 DUP2 MSTORE PUSH32 0x2C75696E743235362C6279746573290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0x908 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x17 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454C4543544F52000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO ISZERO PUSH2 0x9A2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F4F574E4552000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND ISZERO ISZERO PUSH2 0xA2E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F4F574E4552000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP7 ISZERO ISZERO SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 MLOAD SWAP1 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0x17307EAB39AB6107E8899845AD3D59BD9653F200F220920489CA2B5937696C31 SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xAFE DUP8 DUP8 DUP8 PUSH2 0x3E4 JUMP JUMPDEST DUP6 EXTCODESIZE SWAP2 POP PUSH1 0x0 DUP3 GT ISZERO PUSH2 0xCCB JUMPI PUSH1 0x40 MLOAD PUSH32 0x150B7A0200000000000000000000000000000000000000000000000000000000 DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD DUP2 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP11 DUP2 AND PUSH1 0x24 DUP6 ADD MSTORE PUSH1 0x44 DUP5 ADD DUP10 SWAP1 MSTORE PUSH1 0x80 PUSH1 0x64 DUP6 ADD SWAP1 DUP2 MSTORE PUSH1 0x84 DUP6 ADD DUP9 SWAP1 MSTORE SWAP1 DUP11 AND SWAP4 PUSH4 0x150B7A02 SWAP4 SWAP3 DUP13 SWAP3 DUP12 SWAP3 DUP12 SWAP3 DUP12 SWAP3 SWAP1 SWAP2 PUSH1 0xA4 ADD DUP5 DUP5 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP7 POP POP POP POP POP POP POP PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xBB2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xBC6 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xBDC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C61646472657373 DUP2 MSTORE PUSH32 0x2C75696E743235362C6279746573290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0xCCB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x17 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454C4543544F52000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xD80 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xDFA JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH4 0x4E16583 0xc3 CALL PUSH16 0x25F8A56CE47C21C8A869EEA79ADEEBF1 0xe1 0x29 MSTORE 0xbc SMOD MOD SWAP1 0x4a STOP 0x29 ",
+ "sourceMap": "712:8295:74:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;712:8295:74;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100985763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663081812fc811461009d578063095ea7b3146100de57806323b872dd1461011157806342842e0e146101485780636352211e1461017f57806370a0823114610197578063a22cb465146101d7578063b88d4fde1461020a578063e985e9c514610250575b600080fd5b3480156100a957600080fd5b506100b5600435610298565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100ea57600080fd5b5061010f73ffffffffffffffffffffffffffffffffffffffff600435166024356102c0565b005b34801561011d57600080fd5b5061010f73ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356103e4565b34801561015457600080fd5b5061010f73ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610744565b34801561018b57600080fd5b506100b560043561090f565b3480156101a357600080fd5b506101c573ffffffffffffffffffffffffffffffffffffffff600435166109a8565b60408051918252519081900360200190f35b3480156101e357600080fd5b5061010f73ffffffffffffffffffffffffffffffffffffffff600435166024351515610a57565b34801561021657600080fd5b5061010f73ffffffffffffffffffffffffffffffffffffffff60048035821691602480359091169160443591606435908101910135610af0565b34801561025c57600080fd5b5061028473ffffffffffffffffffffffffffffffffffffffff60043581169060243516610cd4565b604080519115158252519081900360200190f35b60009081526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60006102cb8261090f565b90503373ffffffffffffffffffffffffffffffffffffffff821614806102f657506102f68133610cd4565b151561036357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f494e56414c49445f53454e4445520000000000000000000000604482015290519081900360640190fd5b60008281526001602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000808073ffffffffffffffffffffffffffffffffffffffff8516151561046c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f5a45524f5f544f5f4144445245535300000000000000000000604482015290519081900360640190fd5b6104758461090f565b925073ffffffffffffffffffffffffffffffffffffffff868116908416146104fe57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f4f574e45525f4d49534d415443480000000000000000000000604482015290519081900360640190fd5b33915061050a84610298565b90508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148061054b575061054b8383610cd4565b8061058157508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b15156105ee57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f494e56414c49445f5350454e44455200000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561063f57600084815260016020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b60008481526020818152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8a8116919091179091558916835260029091529020546106a8906001610d0f565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526002602052604080822093909355908716815220546106e5906001610d86565b73ffffffffffffffffffffffffffffffffffffffff808716600081815260026020526040808220949094559251879391928a16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050505050565b6000806107528585856103e4565b833b9150600082111561090857604080517f150b7a0200000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8781166024830152604482018690526080606483015260006084830181905292519087169263150b7a029260c480820193602093909283900390910190829087803b1580156107ef57600080fd5b505af1158015610803573d6000803e3d6000fd5b505050506040513d602081101561081957600080fd5b5051604080517f6f6e455243373231526563656976656428616464726573732c6164647265737381527f2c75696e743235362c62797465732900000000000000000000000000000000006020820152905190819003602f0190209091507fffffffff0000000000000000000000000000000000000000000000000000000080831691161461090857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b5050505050565b60008181526020819052604081205473ffffffffffffffffffffffffffffffffffffffff168015156109a257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82161515610a2e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b600080610afe8787876103e4565b853b91506000821115610ccb576040517f150b7a02000000000000000000000000000000000000000000000000000000008152336004820181815273ffffffffffffffffffffffffffffffffffffffff8a811660248501526044840189905260806064850190815260848501889052908a169363150b7a0293928c928b928b928b92909160a40184848082843782019150509650505050505050602060405180830381600087803b158015610bb257600080fd5b505af1158015610bc6573d6000803e3d6000fd5b505050506040513d6020811015610bdc57600080fd5b5051604080517f6f6e455243373231526563656976656428616464726573732c6164647265737381527f2c75696e743235362c62797465732900000000000000000000000000000000006020820152905190819003602f0190209091507fffffffff00000000000000000000000000000000000000000000000000000000808316911614610ccb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b50505050505050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260036020908152604080832093909416825291909152205460ff1690565b600082821115610d8057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f55494e543235365f554e444552464c4f57000000000000000000000000000000604482015290519081900360640190fd5b50900390565b600082820183811015610dfa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b93925050505600a165627a7a723058206304e16583c3f16f25f8a56ce47c21c8a869eea79adeebf1e12952bc0706904a0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x98 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x81812FC DUP2 EQ PUSH2 0x9D JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0xDE JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x111 JUMPI DUP1 PUSH4 0x42842E0E EQ PUSH2 0x148 JUMPI DUP1 PUSH4 0x6352211E EQ PUSH2 0x17F JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x197 JUMPI DUP1 PUSH4 0xA22CB465 EQ PUSH2 0x1D7 JUMPI DUP1 PUSH4 0xB88D4FDE EQ PUSH2 0x20A JUMPI DUP1 PUSH4 0xE985E9C5 EQ PUSH2 0x250 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xA9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB5 PUSH1 0x4 CALLDATALOAD PUSH2 0x298 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x2C0 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x11D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x3E4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x154 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x744 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x18B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB5 PUSH1 0x4 CALLDATALOAD PUSH2 0x90F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1A3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1C5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x9A8 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1E3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xA57 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x216 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10F PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 DUP1 CALLDATALOAD DUP3 AND SWAP2 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 SWAP2 AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 PUSH1 0x64 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0xAF0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x25C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x284 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0xCD4 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2CB DUP3 PUSH2 0x90F JUMP JUMPDEST SWAP1 POP CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND EQ DUP1 PUSH2 0x2F6 JUMPI POP PUSH2 0x2F6 DUP2 CALLER PUSH2 0xCD4 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x363 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454E4445520000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 DUP2 AND SWAP2 DUP3 OR SWAP1 SWAP3 SSTORE SWAP2 MLOAD DUP6 SWAP4 SWAP2 DUP6 AND SWAP2 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP2 LOG4 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND ISZERO ISZERO PUSH2 0x46C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F544F5F4144445245535300000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x475 DUP5 PUSH2 0x90F JUMP JUMPDEST SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 DUP2 AND SWAP1 DUP5 AND EQ PUSH2 0x4FE JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F4F574E45525F4D49534D415443480000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST CALLER SWAP2 POP PUSH2 0x50A DUP5 PUSH2 0x298 JUMP JUMPDEST SWAP1 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ DUP1 PUSH2 0x54B JUMPI POP PUSH2 0x54B DUP4 DUP4 PUSH2 0xCD4 JUMP JUMPDEST DUP1 PUSH2 0x581 JUMPI POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ JUMPDEST ISZERO ISZERO PUSH2 0x5EE JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F5350454E44455200000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x63F JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP11 DUP2 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SWAP2 SSTORE DUP10 AND DUP4 MSTORE PUSH1 0x2 SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH2 0x6A8 SWAP1 PUSH1 0x1 PUSH2 0xD0F JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP9 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP4 SWAP1 SWAP4 SSTORE SWAP1 DUP8 AND DUP2 MSTORE KECCAK256 SLOAD PUSH2 0x6E5 SWAP1 PUSH1 0x1 PUSH2 0xD86 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP8 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 SWAP5 SWAP1 SWAP5 SSTORE SWAP3 MLOAD DUP8 SWAP4 SWAP2 SWAP3 DUP11 AND SWAP2 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP2 LOG4 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x752 DUP6 DUP6 DUP6 PUSH2 0x3E4 JUMP JUMPDEST DUP4 EXTCODESIZE SWAP2 POP PUSH1 0x0 DUP3 GT ISZERO PUSH2 0x908 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x150B7A0200000000000000000000000000000000000000000000000000000000 DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 DUP2 AND PUSH1 0x24 DUP4 ADD MSTORE PUSH1 0x44 DUP3 ADD DUP7 SWAP1 MSTORE PUSH1 0x80 PUSH1 0x64 DUP4 ADD MSTORE PUSH1 0x0 PUSH1 0x84 DUP4 ADD DUP2 SWAP1 MSTORE SWAP3 MLOAD SWAP1 DUP8 AND SWAP3 PUSH4 0x150B7A02 SWAP3 PUSH1 0xC4 DUP1 DUP3 ADD SWAP4 PUSH1 0x20 SWAP4 SWAP1 SWAP3 DUP4 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 DUP3 SWAP1 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x7EF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x803 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x819 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C61646472657373 DUP2 MSTORE PUSH32 0x2C75696E743235362C6279746573290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0x908 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x17 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454C4543544F52000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO ISZERO PUSH2 0x9A2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F4F574E4552000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND ISZERO ISZERO PUSH2 0xA2E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F5A45524F5F4F574E4552000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE SWAP3 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP7 ISZERO ISZERO SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 MLOAD SWAP1 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP4 SWAP3 PUSH32 0x17307EAB39AB6107E8899845AD3D59BD9653F200F220920489CA2B5937696C31 SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xAFE DUP8 DUP8 DUP8 PUSH2 0x3E4 JUMP JUMPDEST DUP6 EXTCODESIZE SWAP2 POP PUSH1 0x0 DUP3 GT ISZERO PUSH2 0xCCB JUMPI PUSH1 0x40 MLOAD PUSH32 0x150B7A0200000000000000000000000000000000000000000000000000000000 DUP2 MSTORE CALLER PUSH1 0x4 DUP3 ADD DUP2 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP11 DUP2 AND PUSH1 0x24 DUP6 ADD MSTORE PUSH1 0x44 DUP5 ADD DUP10 SWAP1 MSTORE PUSH1 0x80 PUSH1 0x64 DUP6 ADD SWAP1 DUP2 MSTORE PUSH1 0x84 DUP6 ADD DUP9 SWAP1 MSTORE SWAP1 DUP11 AND SWAP4 PUSH4 0x150B7A02 SWAP4 SWAP3 DUP13 SWAP3 DUP12 SWAP3 DUP12 SWAP3 DUP12 SWAP3 SWAP1 SWAP2 PUSH1 0xA4 ADD DUP5 DUP5 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP7 POP POP POP POP POP POP POP PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xBB2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xBC6 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xBDC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C61646472657373 DUP2 MSTORE PUSH32 0x2C75696E743235362C6279746573290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0xCCB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x17 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4552433732315F494E56414C49445F53454C4543544F52000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xD80 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xDFA JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH4 0x4E16583 0xc3 CALL PUSH16 0x25F8A56CE47C21C8A869EEA79ADEEBF1 0xe1 0x29 MSTORE 0xbc SMOD MOD SWAP1 0x4a STOP 0x29 ",
+ "sourceMap": "712:8295:74:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8388:140;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8388:140:74;;;;;;;;;;;;;;;;;;;;;;;;4378:400;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4378:400:74;;;;;;;;;;;6624:974;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6624:974:74;;;;;;;;;;;;;;3326:682;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3326:682:74;;;;;;;;;;;;;;7860:257;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7860:257:74;;;;;5783:229;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5783:229:74;;;;;;;;;;;;;;;;;;;;;;;5184:261;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5184:261:74;;;;;;;;;;;2257:706;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2257:706:74;;;;;;;;;;;;;;;;;;;;;;;;;;;;8829:176;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8829:176:74;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8388:140;8472:7;8502:19;;;:9;:19;;;;;;;;;8388:140::o;4378:400::-;4463:13;4479:17;4487:8;4479:7;:17::i;:::-;4463:33;-1:-1:-1;4527:10:74;:19;;;;;:58;;;4550:35;4567:5;4574:10;4550:16;:35::i;:::-;4506:126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4643:19;;;;:9;:19;;;;;;:31;;;;;;;;;;;;;;4689:82;;4643:19;;4689:82;;;;;;;4378:400;;;:::o;6624:974::-;6848:13;;;6772:17;;;;;6751:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6864:17;6872:8;6864:7;:17::i;:::-;6848:33;-1:-1:-1;6912:14:74;;;;;;;;6891:82;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7002:10;6984:28;;7048:21;7060:8;7048:11;:21::i;:::-;7022:47;;7111:5;7100:16;;:7;:16;;;:64;;;;7132:32;7149:5;7156:7;7132:16;:32::i;:::-;7100:106;;;;7199:7;7180:26;;:15;:26;;;7100:106;7079:175;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7269:29;;;;7265:92;;7344:1;7314:19;;;:9;:19;;;;;:32;;;;;;7265:92;7367:6;:16;;;;;;;;;;;:22;;;;;;;;;;;;;;;7425:15;;;;:8;:15;;;;;;7417:27;;-1:-1:-1;7417:7:74;:27::i;:::-;7399:15;;;;;;;;:8;:15;;;;;;:45;;;;7478:13;;;;;;;7470:25;;7493:1;7470:7;:25::i;:::-;7454:13;;;;;;;;:8;:13;;;;;;:41;;;;7515:76;;7573:8;;7454:13;;7515:76;;;;;;6624:974;;;;;;:::o;3326:682::-;3550:24;3702:15;3459:80;3485:5;3504:3;3521:8;3459:12;:80::i;:::-;3639:3;3627:16;3607:36;;3685:1;3666:16;:20;3662:340;;;3720:148;;;;;;3775:10;3720:148;;;;:37;:148;;;;;;;;;;;;;;;;;;-1:-1:-1;3720:148:74;;;;;;;;:37;;;;;;:148;;;;;;;;;;;;;;;;;;:37;:148;;;5:2:-1;;;;30:1;27;20:12;5:2;3720:148:74;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3720:148:74;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;3720:148:74;902:60;;;;;;;3720:148;902:60;;;;;;;;;;;;;3720:148;;-1:-1:-1;3907:27:74;;;;;;;3882:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3326:682;;;;;:::o;7860:257::-;7940:7;7979:16;;;;;;;;;;;;;8026:19;;;8005:83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8105:5;7860:257;-1:-1:-1;;7860:257:74:o;5783:229::-;5865:7;5909:20;;;;;5888:84;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5989:16:74;;;;;;:8;:16;;;;;;;5783:229::o;5184:261::-;5295:10;5277:29;;;;:17;:29;;;;;;;;;:40;;;;;;;;;;;;:52;;;;;;;;;;;;;5344:94;;;;;;;5277:40;;5295:10;5344:94;;;;;;;;;;;5184:261;;:::o;2257:706::-;2502:24;2654:15;2411:80;2437:5;2456:3;2473:8;2411:12;:80::i;:::-;2591:3;2579:16;2559:36;;2637:1;2618:16;:20;2614:343;;;2672:151;;;;;2727:10;2672:151;;;;;;:37;:151;;;;;;;;;;;;;;;;;;;;;;;;;;:37;;;;;;2727:10;2755:5;;2778:8;;2804:5;;;;2672:151;;;;2804:5;;;;2672:151;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2672:151:74;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2672:151:74;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2672:151:74;902:60;;;;;;;2672:151;902:60;;;;;;;;;;;;;2672:151;;-1:-1:-1;2862:27:74;;;;;;;2837:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2257:706;;;;;;;:::o;8829:176::-;8962:25;;;;8935:4;8962:25;;;:17;:25;;;;;;;;:36;;;;;;;;;;;;;;;8829:176::o;502:208:84:-;588:7;632:6;;;;611:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;698:5:84;;;502:208::o;716:230::-;802:7;837:5;;;873:6;;;;852:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;938:1;716:230;-1:-1:-1;;;716:230:84:o"
+ }
+ }
+ },
+ "sources": {
+ "tokens/ERC721Token/ERC721Token.sol": {
+ "id": 74
+ },
+ "tokens/ERC721Token/IERC721Token.sol": {
+ "id": 76
+ },
+ "tokens/ERC721Token/IERC721Receiver.sol": {
+ "id": 75
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ }
+ },
+ "sourceCodes": {
+ "tokens/ERC721Token/ERC721Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IERC721Token.sol\";\nimport \"./IERC721Receiver.sol\";\nimport \"../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract ERC721Token is\n IERC721Token,\n SafeMath\n{\n // Function selector for ERC721Receiver.onERC721Received\n // 0x150b7a02\n bytes4 constant internal ERC721_RECEIVED = bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"));\n\n // Mapping of tokenId => owner\n mapping (uint256 => address) internal owners;\n\n // Mapping of tokenId => approved address\n mapping (uint256 => address) internal approvals;\n\n // Mapping of owner => number of tokens owned\n mapping (address => uint256) internal balances;\n\n // Mapping of owner => operator => approved\n mapping (address => mapping (address => bool)) internal operatorApprovals;\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT. When transfer is complete, this function\n /// checks if `_to` is a smart contract (code size > 0). If so, it calls\n /// `onERC721Received` on `_to` and throws if the return value is not\n /// `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n /// @param _data Additional data with no specified format, sent in call to `_to`\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes _data\n )\n external\n {\n transferFrom(\n _from,\n _to,\n _tokenId\n );\n\n uint256 receiverCodeSize;\n assembly {\n receiverCodeSize := extcodesize(_to)\n }\n if (receiverCodeSize > 0) {\n bytes4 selector = IERC721Receiver(_to).onERC721Received(\n msg.sender,\n _from,\n _tokenId,\n _data\n );\n require(\n selector == ERC721_RECEIVED,\n \"ERC721_INVALID_SELECTOR\"\n );\n }\n }\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev This works identically to the other function with an extra data parameter,\n /// except this function just sets data to \"\".\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n external\n {\n transferFrom(\n _from,\n _to,\n _tokenId\n );\n\n uint256 receiverCodeSize;\n assembly {\n receiverCodeSize := extcodesize(_to)\n }\n if (receiverCodeSize > 0) {\n bytes4 selector = IERC721Receiver(_to).onERC721Received(\n msg.sender,\n _from,\n _tokenId,\n \"\"\n );\n require(\n selector == ERC721_RECEIVED,\n \"ERC721_INVALID_SELECTOR\"\n );\n }\n }\n\n /// @notice Change or reaffirm the approved address for an NFT\n /// @dev The zero address indicates there is no approved address.\n /// Throws unless `msg.sender` is the current NFT owner, or an authorized\n /// operator of the current owner.\n /// @param _approved The new approved NFT controller\n /// @param _tokenId The NFT to approve\n function approve(address _approved, uint256 _tokenId)\n external\n {\n address owner = ownerOf(_tokenId);\n require(\n msg.sender == owner || isApprovedForAll(owner, msg.sender),\n \"ERC721_INVALID_SENDER\"\n );\n\n approvals[_tokenId] = _approved;\n emit Approval(\n owner,\n _approved,\n _tokenId\n );\n }\n\n /// @notice Enable or disable approval for a third party (\"operator\") to manage\n /// all of `msg.sender`'s assets\n /// @dev Emits the ApprovalForAll event. The contract MUST allow\n /// multiple operators per owner.\n /// @param _operator Address to add to the set of authorized operators\n /// @param _approved True if the operator is approved, false to revoke approval\n function setApprovalForAll(address _operator, bool _approved)\n external\n {\n operatorApprovals[msg.sender][_operator] = _approved;\n emit ApprovalForAll(\n msg.sender,\n _operator,\n _approved\n );\n }\n \n /// @notice Count all NFTs assigned to an owner\n /// @dev NFTs assigned to the zero address are considered invalid, and this\n /// function throws for queries about the zero address.\n /// @param _owner An address for whom to query the balance\n /// @return The number of NFTs owned by `_owner`, possibly zero\n function balanceOf(address _owner)\n external\n view\n returns (uint256)\n {\n require(\n _owner != address(0),\n \"ERC721_ZERO_OWNER\"\n );\n return balances[_owner];\n }\n\n /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n /// THEY MAY BE PERMANENTLY LOST\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function transferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n public\n {\n require(\n _to != address(0),\n \"ERC721_ZERO_TO_ADDRESS\"\n );\n\n address owner = ownerOf(_tokenId);\n require(\n _from == owner,\n \"ERC721_OWNER_MISMATCH\"\n );\n\n address spender = msg.sender;\n address approvedAddress = getApproved(_tokenId);\n require(\n spender == owner ||\n isApprovedForAll(owner, spender) ||\n approvedAddress == spender,\n \"ERC721_INVALID_SPENDER\"\n );\n\n if (approvedAddress != address(0)) {\n approvals[_tokenId] = address(0);\n }\n\n owners[_tokenId] = _to;\n balances[_from] = safeSub(balances[_from], 1);\n balances[_to] = safeAdd(balances[_to], 1);\n \n emit Transfer(\n _from,\n _to,\n _tokenId\n );\n }\n\n /// @notice Find the owner of an NFT\n /// @dev NFTs assigned to zero address are considered invalid, and queries\n /// about them do throw.\n /// @param _tokenId The identifier for an NFT\n /// @return The address of the owner of the NFT\n function ownerOf(uint256 _tokenId)\n public\n view\n returns (address)\n {\n address owner = owners[_tokenId];\n require(\n owner != address(0),\n \"ERC721_ZERO_OWNER\"\n );\n return owner;\n }\n\n /// @notice Get the approved address for a single NFT\n /// @dev Throws if `_tokenId` is not a valid NFT.\n /// @param _tokenId The NFT to find the approved address for\n /// @return The approved address for this NFT, or the zero address if there is none\n function getApproved(uint256 _tokenId)\n public\n view\n returns (address)\n {\n return approvals[_tokenId];\n }\n\n /// @notice Query if an address is an authorized operator for another address\n /// @param _owner The address that owns the NFTs\n /// @param _operator The address that acts on behalf of the owner\n /// @return True if `_operator` is an approved operator for `_owner`, false otherwise\n function isApprovedForAll(address _owner, address _operator)\n public\n view\n returns (bool)\n {\n return operatorApprovals[_owner][_operator];\n }\n}\n",
+ "tokens/ERC721Token/IERC721Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC721Token {\n\n /// @dev This emits when ownership of any NFT changes by any mechanism.\n /// This event emits when NFTs are created (`from` == 0) and destroyed\n /// (`to` == 0). Exception: during contract creation, any number of NFTs\n /// may be created and assigned without emitting Transfer. At the time of\n /// any transfer, the approved address for that NFT (if any) is reset to none.\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 indexed _tokenId\n );\n\n /// @dev This emits when the approved address for an NFT is changed or\n /// reaffirmed. The zero address indicates there is no approved address.\n /// When a Transfer event emits, this also indicates that the approved\n /// address for that NFT (if any) is reset to none.\n event Approval(\n address indexed _owner,\n address indexed _approved,\n uint256 indexed _tokenId\n );\n\n /// @dev This emits when an operator is enabled or disabled for an owner.\n /// The operator can manage all NFTs of the owner.\n event ApprovalForAll(\n address indexed _owner,\n address indexed _operator,\n bool _approved\n );\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// perator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT. When transfer is complete, this function\n /// checks if `_to` is a smart contract (code size > 0). If so, it calls\n /// `onERC721Received` on `_to` and throws if the return value is not\n /// `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n /// @param _data Additional data with no specified format, sent in call to `_to`\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes _data\n )\n external;\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev This works identically to the other function with an extra data parameter,\n /// except this function just sets data to \"\".\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n external;\n\n /// @notice Change or reaffirm the approved address for an NFT\n /// @dev The zero address indicates there is no approved address.\n /// Throws unless `msg.sender` is the current NFT owner, or an authorized\n /// operator of the current owner.\n /// @param _approved The new approved NFT controller\n /// @param _tokenId The NFT to approve\n function approve(address _approved, uint256 _tokenId)\n external;\n\n /// @notice Enable or disable approval for a third party (\"operator\") to manage\n /// all of `msg.sender`'s assets\n /// @dev Emits the ApprovalForAll event. The contract MUST allow\n /// multiple operators per owner.\n /// @param _operator Address to add to the set of authorized operators\n /// @param _approved True if the operator is approved, false to revoke approval\n function setApprovalForAll(address _operator, bool _approved)\n external;\n\n /// @notice Count all NFTs assigned to an owner\n /// @dev NFTs assigned to the zero address are considered invalid, and this\n /// function throws for queries about the zero address.\n /// @param _owner An address for whom to query the balance\n /// @return The number of NFTs owned by `_owner`, possibly zero\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n /// THEY MAY BE PERMANENTLY LOST\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function transferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n public;\n\n /// @notice Find the owner of an NFT\n /// @dev NFTs assigned to zero address are considered invalid, and queries\n /// about them do throw.\n /// @param _tokenId The identifier for an NFT\n /// @return The address of the owner of the NFT\n function ownerOf(uint256 _tokenId)\n public\n view\n returns (address);\n\n /// @notice Get the approved address for a single NFT\n /// @dev Throws if `_tokenId` is not a valid NFT.\n /// @param _tokenId The NFT to find the approved address for\n /// @return The approved address for this NFT, or the zero address if there is none\n function getApproved(uint256 _tokenId) \n public\n view\n returns (address);\n \n /// @notice Query if an address is an authorized operator for another address\n /// @param _owner The address that owns the NFTs\n /// @param _operator The address that acts on behalf of the owner\n /// @return True if `_operator` is an approved operator for `_owner`, false otherwise\n function isApprovedForAll(address _owner, address _operator)\n public\n view\n returns (bool);\n}\n",
+ "tokens/ERC721Token/IERC721Receiver.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC721Receiver {\n\n /// @notice Handle the receipt of an NFT\n /// @dev The ERC721 smart contract calls this function on the recipient\n /// after a `transfer`. This function MAY throw to revert and reject the\n /// transfer. Return of other than the magic value MUST result in the\n /// transaction being reverted.\n /// Note: the contract address is always the message sender.\n /// @param _operator The address which called `safeTransferFrom` function\n /// @param _from The address which previously owned the token\n /// @param _tokenId The NFT identifier which is being transferred\n /// @param _data Additional data with no specified format\n /// @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n /// unless throwing\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes _data\n )\n external\n returns (bytes4);\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0xf4217ae1c8ee6ad15913d86a30747907f26acfb4a1970ea3c8a30d45ce9171d0",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/Exchange.json b/packages/contracts/generated-artifacts/Exchange.json
new file mode 100644
index 000000000..b828eb62c
--- /dev/null
+++ b/packages/contracts/generated-artifacts/Exchange.json
@@ -0,0 +1,2154 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "Exchange",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "filled",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAssetFillAmounts",
+ "type": "uint256[]"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "batchFillOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "cancelled",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "preSign",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "leftOrder",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "rightOrder",
+ "type": "tuple"
+ },
+ {
+ "name": "leftSignature",
+ "type": "bytes"
+ },
+ {
+ "name": "rightSignature",
+ "type": "bytes"
+ }
+ ],
+ "name": "matchOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "left",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "right",
+ "type": "tuple"
+ },
+ {
+ "name": "leftMakerAssetSpreadAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "matchedFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "fillOrderNoThrow",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "fillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "name": "assetProxies",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "batchCancelOrders",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAssetFillAmounts",
+ "type": "uint256[]"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "batchFillOrKillOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "targetOrderEpoch",
+ "type": "uint256"
+ }
+ ],
+ "name": "cancelOrdersUpTo",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAssetFillAmounts",
+ "type": "uint256[]"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "batchFillOrdersNoThrow",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "assetProxyId",
+ "type": "bytes4"
+ }
+ ],
+ "name": "getAssetProxy",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "transactions",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "fillOrKillOrder",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "fillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "validatorAddress",
+ "type": "address"
+ },
+ {
+ "name": "approval",
+ "type": "bool"
+ }
+ ],
+ "name": "setSignatureValidatorApproval",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "allowedValidators",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "marketSellOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "getOrdersInfo",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "orderStatus",
+ "type": "uint8"
+ },
+ {
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "orderTakerAssetFilledAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "preSigned",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "makerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "marketBuyOrdersNoThrow",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "fillOrder",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "fillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "executeTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "assetProxy",
+ "type": "address"
+ }
+ ],
+ "name": "registerAssetProxy",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ }
+ ],
+ "name": "getOrderInfo",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "orderStatus",
+ "type": "uint8"
+ },
+ {
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "orderTakerAssetFilledAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "orderInfo",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ }
+ ],
+ "name": "cancelOrder",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "orderEpoch",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "ZRX_ASSET_DATA",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "marketSellOrdersNoThrow",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "EIP712_DOMAIN_HASH",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "makerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "marketBuyOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "currentContextAddress",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "VERSION",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_zrxAssetData",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "validatorAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "approved",
+ "type": "bool"
+ }
+ ],
+ "name": "SignatureValidatorApproval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "takerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "indexed": true,
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "indexed": false,
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "Fill",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "indexed": false,
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "Cancel",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "orderEpoch",
+ "type": "uint256"
+ }
+ ],
+ "name": "CancelUpTo",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "id",
+ "type": "bytes4"
+ },
+ {
+ "indexed": false,
+ "name": "assetProxy",
+ "type": "address"
+ }
+ ],
+ "name": "AssetProxyRegistered",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526000805460ff191690553480156200001b57600080fd5b5060405162005ec038038062005ec083398101806040526200004191908101906200044d565b80518190620000589060019060208401906200034c565b5050604080517f454950373132446f6d61696e28000000000000000000000000000000000000006020808301919091527f737472696e67206e616d652c0000000000000000000000000000000000000000602d8301527f737472696e672076657273696f6e2c000000000000000000000000000000000060398301527f6164647265737320766572696679696e67436f6e74726163740000000000000060488301527f2900000000000000000000000000000000000000000000000000000000000000606183015282516042818403018152606290920192839052815191929182918401908083835b60208310620001625780518252601f19909201916020918201910162000141565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208285018552600b8084527f30782050726f746f636f6c000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b60208310620001ec5780518252601f199092019160209182019101620001cb565b51815160209384036101000a600019018019909216911617905260408051929094018290038220828501855260018084527f3200000000000000000000000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b60208310620002765780518252601f19909201916020918201910162000255565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208282019890985281840196909652606081019690965250306080808701919091528151808703909101815260a09095019081905284519093849350850191508083835b60208310620003015780518252601f199092019160209182019101620002e0565b5181516000196020949094036101000a939093019283169219169190911790526040519201829003909120600255505060038054600160a060020a03191633179055506200050f9050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200038f57805160ff1916838001178555620003bf565b82800160010185558215620003bf579182015b82811115620003bf578251825591602001919060010190620003a2565b50620003cd929150620003d1565b5090565b620003ee91905b80821115620003cd5760008155600101620003d8565b90565b6000601f820183136200040357600080fd5b81516200041a6200041482620004b4565b6200048d565b915080825260208301602083018583830111156200043757600080fd5b62000444838284620004dc565b50505092915050565b6000602082840312156200046057600080fd5b81516001604060020a038111156200047757600080fd5b6200048584828501620003f1565b949350505050565b6040518181016001604060020a0381118282101715620004ac57600080fd5b604052919050565b60006001604060020a03821115620004cb57600080fd5b506020601f91909101601f19160190565b60005b83811015620004f9578181015183820152602001620004df565b8381111562000509576000848401525b50505050565b6159a1806200051f6000396000f3006080604052600436106101b65763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663288cdc9181146101bb578063297bb70b146101f15780632ac126221461021e5780633683ef8e1461024b5780633c28d8611461026d5780633e228bae1461029a5780633fd3c997146102ba5780634ac14782146102e75780634d0ae546146103075780634f9559b11461032757806350dde190146103475780636070410814610367578063642f2eaf1461039457806364a3bc15146103b457806377fcce68146103d45780637b8e3514146103f45780637e1d9808146104145780637e9d74dc1461043457806382c174d0146104615780638da5cb5b146104815780639363470214610496578063a3e20380146104b6578063b4be83d5146104d6578063bfc8bfce146104f6578063c585bb9314610516578063c75e0a8114610536578063d46b02c314610563578063d9bfa73e14610583578063db123b1a146105a3578063dd1c7d18146105c5578063e306f779146105e5578063e5fa431b146105fa578063eea086ba1461061a578063f2fde38b1461062f578063ffa1ad741461064f575b600080fd5b3480156101c757600080fd5b506101db6101d63660046148ee565b610664565b6040516101e89190615513565b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004614811565b610676565b6040516101e891906157ed565b34801561022a57600080fd5b5061023e6102393660046148ee565b6107a1565b6040516101e89190615505565b34801561025757600080fd5b5061026b61026636600461492b565b6107b6565b005b34801561027957600080fd5b5061028d610288366004614a5f565b6108a3565b6040516101e891906157fb565b3480156102a657600080fd5b506102116102b5366004614b1f565b610a3a565b3480156102c657600080fd5b506102da6102d53660046149ee565b610a90565b6040516101e891906155cf565b3480156102f357600080fd5b5061026b6103023660046147dc565b610ab8565b34801561031357600080fd5b50610211610322366004614811565b610b85565b34801561033357600080fd5b5061026b6103423660046148ee565b610c75565b34801561035357600080fd5b50610211610362366004614811565b610e2a565b34801561037357600080fd5b506103876103823660046149ee565b610ebe565b6040516101e89190615425565b3480156103a057600080fd5b5061023e6103af3660046148ee565b610f0c565b3480156103c057600080fd5b506102116103cf366004614b1f565b610f21565b3480156103e057600080fd5b5061026b6103ef3660046147ac565b610fcc565b34801561040057600080fd5b5061023e61040f366004614772565b611106565b34801561042057600080fd5b5061021161042f3660046148a5565b611126565b34801561044057600080fd5b5061045461044f3660046147dc565b61128a565b6040516101e891906154f4565b34801561046d57600080fd5b5061023e61047c36600461490c565b61131f565b34801561048d57600080fd5b5061038761133f565b3480156104a257600080fd5b5061023e6104b1366004614993565b61135b565b3480156104c257600080fd5b506102116104d13660046148a5565b6118de565b3480156104e257600080fd5b506102116104f1366004614b1f565b6119f1565b34801561050257600080fd5b5061026b610511366004614b68565b611a6c565b34801561052257600080fd5b5061026b610531366004614754565b611d05565b34801561054257600080fd5b50610556610551366004614a2a565b611f30565b6040516101e8919061580a565b34801561056f57600080fd5b5061026b61057e366004614a2a565b61202a565b34801561058f57600080fd5b506101db61059e366004614772565b6120c6565b3480156105af57600080fd5b506105b86120e3565b6040516101e891906155be565b3480156105d157600080fd5b506102116105e03660046148a5565b61218e565b3480156105f157600080fd5b506101db612263565b34801561060657600080fd5b506102116106153660046148a5565b612269565b34801561062657600080fd5b506103876123db565b34801561063b57600080fd5b5061026b61064a366004614754565b6123f7565b34801561065b57600080fd5b506105b86124a8565b60046020526000908152604090205481565b61067e614386565b600080610689614386565b60005460ff16156106cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461076f57610758878381518110151561071957fe5b90602001906020020151878481518110151561073157fe5b90602001906020020151878581518110151561074957fe5b906020019060200201516124df565b9050610764848261257d565b600190910190610701565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509392505050565b60056020526000908152604090205460ff1681565b73ffffffffffffffffffffffffffffffffffffffff831633146108465761080e848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375061135b945050505050565b1515610846576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061569d565b5050600091825260076020908152604080842073ffffffffffffffffffffffffffffffffffffffff9093168452919052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b6108ab6143af565b6108b36143de565b6108bb6143de565b6000805460ff16156108f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561016080890151610140808a01919091528901519088015261094588611f30565b925061095087611f30565b915061095a6125df565b905061096888848389612611565b61097487838388612611565b61097e88886127a9565b610992888885604001518560400151612809565b8051602081015190519195506109ad918a9186918190612990565b6020808501519081015190516109c99189918591908190612990565b6109e28882856020015186604001518860000151612aa9565b6109fb8782846020015185604001518860200151612aa9565b610a0788888387612b55565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550949350505050565b610a42614386565b6060610a4f858585612d2d565b9050608081825160208401305af48015610a8657815183526020820151602084015260408201516040840152606082015160608401525b505b509392505050565b600b6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60008054819060ff1615610af8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558151905b808214610b5857610b508382815181101515610b4157fe5b90602001906020020151612eff565b600101610b29565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b610b8d614386565b600080610b98614386565b60005460ff1615610bd5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461076f57610c5e8783815181101515610c1f57fe5b906020019060200201518784815181101515610c3757fe5b906020019060200201518785815181101515610c4f57fe5b90602001906020020151612f2a565b9050610c6a848261257d565b600190910190610c07565b6000805481908190819060ff1615610cb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610cec6125df565b935073ffffffffffffffffffffffffffffffffffffffff84163314610d115733610d14565b60005b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600660209081526040808320938516835292905220549093506001860192509050808211610d8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061572d565b73ffffffffffffffffffffffffffffffffffffffff80851660008181526006602090815260408083209488168084529490915290819020859055517f82af639571738f4ebd4268fb0363d8957ebe1bbb9e78dba5ebd69eed39b154f090610df3908690615513565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055505050565b610e32614386565b600080610e3d614386565b86519250600091505b818314610eb457610e9d8783815181101515610e5e57fe5b906020019060200201518784815181101515610e7657fe5b906020019060200201518785815181101515610e8e57fe5b90602001906020020151610a3a565b9050610ea9848261257d565b600190910190610e46565b5050509392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600b602052604090205473ffffffffffffffffffffffffffffffffffffffff165b919050565b60096020526000908152604090205460ff1681565b610f29614386565b60005460ff1615610f66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610f9c848484612f2a565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055949350505050565b6000805460ff161561100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561103d6125df565b73ffffffffffffffffffffffffffffffffffffffff8181166000818152600860209081526040808320948916808452949091529081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168715151790555192935090917fa8656e308026eeabce8f0bc18048433252318ab80ac79da0b3d3d8697dfba891906110d1908690615505565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b600860209081526000928352604080842090915290825290205460ff1681565b61112e614386565b6060600080600061113d614386565b60005460ff161561117a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117815589518a919081106111b257fe5b906020019060200201516101600151945088519350600092505b828414611255578489848151811015156111e257fe5b906020019060200201516101600181905250611202888760200151612f7d565b915061122e898481518110151561121557fe5b9060200190602002015183898681518110151561074957fe5b905061123a868261257d565b6020860151881161124a57611255565b6001909201916111cc565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509195945050505050565b606060006060600084519250826040519080825280602002602001820160405280156112d057816020015b6112bd6143de565b8152602001906001900390816112b55790505b509150600090505b808314610a88576112ff85828151811015156112f057fe5b90602001906020020151611f30565b828281518110151561130d57fe5b602090810290910101526001016112d8565b600760209081526000928352604080842090915290825290205460ff1681565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600080600080600089511115156113a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061571d565b6113ad89612fc4565b7f010000000000000000000000000000000000000000000000000000000000000090049650600760ff88161061140f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061563d565b8660ff16600781111561141e57fe5b9550600086600781111561142e57fe5b1415611466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061570d565b600186600781111561147457fe5b14156114bc578851156114b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157dd565b600097506118d0565b60028660078111156114ca57fe5b141561160557885160411461150b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155dd565b88600081518110151561151a57fe5b01602001517f010000000000000000000000000000000000000000000000000000000000000090819004810204945061155a89600163ffffffff61308816565b935061156d89602163ffffffff61308816565b925060018b86868660405160008152602001604052604051611592949392919061556e565b60206040516020810390808403906000865af11580156115b6573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff8c811690821614995092506118d09050565b600386600781111561161357fe5b14156117b9578851604114611654576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155dd565b88600081518110151561166357fe5b01602001517f01000000000000000000000000000000000000000000000000000000000000009081900481020494506116a389600163ffffffff61308816565b93506116b689602163ffffffff61308816565b925060018b60405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b6020831061175757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161171a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822060008352910192839052611592945092508991899150889061556e565b60048660078111156117c757fe5b14156117df576117d88b8b8b6130d3565b97506118d0565b60058660078111156117ed57fe5b1415611850576117fc89613228565b73ffffffffffffffffffffffffffffffffffffffff808c1660009081526008602090815260408083209385168352929052205490915060ff16151561184457600097506118d0565b6117d8818c8c8c6132a1565b600686600781111561185e57fe5b141561189e5760008b815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290205460ff1697506118d0565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061563d565b505050505050509392505050565b6118e6614386565b60606000806000806118f6614386565b89600081518110151561190557fe5b906020019060200201516101400151955089519450600093505b8385146119e457858a8581518110151561193557fe5b6020908102909101015161014001528651611951908a90612f7d565b92506119948a8581518110151561196457fe5b9060200190602002015160a001518b8681518110151561198057fe5b9060200190602002015160800151856133fd565b91506119c08a858151811015156119a757fe5b90602001906020020151838a87815181101515610e8e57fe5b90506119cc878261257d565b865189116119d9576119e4565b60019093019261191f565b5050505050509392505050565b6119f9614386565b60005460ff1615611a36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610f9c8484846124df565b600a5460009073ffffffffffffffffffffffffffffffffffffffff1615611abf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b611b02611afd888888888080601f01602080910402602001604051908101604052809392919081815260200183838082843750613453945050505050565b613694565b60008181526009602052604090205490915060ff1615611b4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061568d565b73ffffffffffffffffffffffffffffffffffffffff86163314611c1f57611ba6818785858080601f0160208091040260200160405190810160405280939291908181526020018383808284375061135b945050505050565b1515611bde576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157cd565b600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555b6000818152600960205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555130908690869080838380828437820191505092505050600060405180830381855af49150501515611cb6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156bd565b73ffffffffffffffffffffffffffffffffffffffff86163314611cfc57600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b50505050505050565b6003546000908190819073ffffffffffffffffffffffffffffffffffffffff163314611d5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061577d565b8392508273ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611dc457600080fd5b505af1158015611dd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611dfc9190810190614a0c565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600b602052604090205490925073ffffffffffffffffffffffffffffffffffffffff1690508015611e81576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061561d565b7fffffffff0000000000000000000000000000000000000000000000000000000082166000908152600b60205260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c0319490611f2290849087906155a3565b60405180910390a150505050565b611f386143de565b611f41826136d1565b6020808301829052600091825260049052604090819020549082015260808201511515611f755760015b60ff168152610f07565b60a08201511515611f87576002611f6b565b60a0820151604082015110611f9d576005611f6b565b6101008201514210611fb0576004611f6b565b60208082015160009081526005909152604090205460ff1615611fd4576006611f6b565b610120820151825173ffffffffffffffffffffffffffffffffffffffff90811660009081526006602090815260408083206060880151909416835292905220541115612021576006611f6b565b60038152919050565b60005460ff1615612067576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561209b81612eff565b50600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600660209081526000928352604080842090915290825290205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156121865780601f1061215b57610100808354040283529160200191612186565b820191906000526020600020905b81548152906001019060200180831161216957829003601f168201915b505050505081565b612196614386565b606060008060006121a5614386565b8860008151811015156121b457fe5b906020019060200201516101600151945088519350600092505b828414612257578489848151811015156121e457fe5b906020019060200201516101600181905250612204888760200151612f7d565b9150612230898481518110151561221757fe5b90602001906020020151838986815181101515610e8e57fe5b905061223c868261257d565b6020860151881161224c57612257565b6001909201916121ce565b50505050509392505050565b60025481565b612271614386565b6060600080600080612281614386565b60005460ff16156122be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558a518b919081106122f657fe5b906020019060200201516101400151955089519450600093505b8385146123a557858a8581518110151561232657fe5b6020908102909101015161014001528651612342908a90612f7d565b92506123558a8581518110151561196457fe5b91506123818a8581518110151561236857fe5b90602001906020020151838a8781518110151561074957fe5b905061238d878261257d565b8651891161239a576123a5565b600190930192612310565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550929695505050505050565b600a5473ffffffffffffffffffffffffffffffffffffffff1681565b60035473ffffffffffffffffffffffffffffffffffffffff163314612448576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061577d565b73ffffffffffffffffffffffffffffffffffffffff8116156124a557600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60408051808201909152600b81527f322e302e312d616c706861000000000000000000000000000000000000000000602082015281565b6124e7614386565b6124ef6143de565b60008060006124fd88611f30565b93506125076125df565b925061251588858589612611565b6125278860a001518560400151612f7d565b915061253387836136df565b9050612546888589848960000151612990565b61255088826136f5565b945061256788848660200151876040015189612aa9565b612572888487613756565b505050509392505050565b8151815161258b9190613864565b8252602080830151908201516125a19190613864565b6020830152604080830151908201516125ba9190613864565b6040830152606080830151908201516125d39190613864565b60609092019190915250565b600a5460009073ffffffffffffffffffffffffffffffffffffffff16818115612608578161260a565b335b9392505050565b825160ff1660031461264f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061579d565b606084015173ffffffffffffffffffffffffffffffffffffffff16156126c257606084015173ffffffffffffffffffffffffffffffffffffffff1633146126c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157ad565b602084015173ffffffffffffffffffffffffffffffffffffffff161561274d578173ffffffffffffffffffffffffffffffffffffffff16846020015173ffffffffffffffffffffffffffffffffffffffff1614151561274d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155ed565b604083015115156127a35761276b836020015185600001518361135b565b15156127a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061565d565b50505050565b6127bb8260a001518260a001516138ae565b6127cd836080015183608001516138ae565b1015612805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157bd565b5050565b6128116143af565b6000806000806128258960a0015188612f7d565b935061283a89608001518a60a0015186613909565b925061284a8860a0015187612f7d565b915061285f88608001518960a0015184613909565b90508084106128a25760208086018051839052805182018490525151865182015260808a015160a08b015187519092015161289a9290613909565b8551526128df565b845183905284516020908101859052855181015190860180519190915260a089015160808a01519151516128d69290613986565b60208087015101525b84515160208087015101516128f49190612f7d565b604086015284515160808a015160c08b0151612911929190613909565b85516040015284516020015160a08a015160e08b0151612932929190613909565b855160600152602085015151608089015160c08a0151612953929190613909565b8560200151604001818152505061297b8560200151602001518960a001518a60e00151613909565b60208601516060015250505050949350505050565b8215156129c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156dd565b82821115612a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156cd565b8460a00151612a16856040015184613864565b1115612a4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155fd565b612a5c8560800151836138ae565b612a6a828760a001516138ae565b1115612aa2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061575d565b5050505050565b612ab7828260200151613864565b600084815260046020908152604091829020929092558681015187518451938501518584015160608701516101408c01516101608d015196518b9873ffffffffffffffffffffffffffffffffffffffff9788169897909616967f0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c37112996612b46968f96339692959194909390615433565b60405180910390a45050505050565b60018054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008789161502019095169490940493840181900481028201810190925282815260609390929091830182828015612bfe5780601f10612bd357610100808354040283529160200191612bfe565b820191906000526020600020905b815481529060010190602001808311612be157829003601f168201915b50505050509050612c2685610140015186600001518660000151856020015160200151613a23565b61014084015184518651845160200151612c4293929190613a23565b612c5b8561014001518660000151858560400151613a23565b612c778186600001518760400151856000015160400151613a23565b612c938185600001518660400151856020015160400151613a23565b836040015173ffffffffffffffffffffffffffffffffffffffff16856040015173ffffffffffffffffffffffffffffffffffffffff161415612cfd57612cf881848760400151612cf3866000015160600151876020015160600151613864565b613a23565b612aa2565b612d1581848760400151856000015160600151613a23565b612aa281848660400151856020015160600151613a23565b604080517fb4be83d5000000000000000000000000000000000000000000000000000000006020808301919091526060602483018181528751608485019081528884015160a48601529488015160c48501529087015160e4840152608087015161010484015260a087015161012484015260c087015161014484015260e08701516101648401526101008701516101848401526101208701516101a4840152610140870180516101c485019081526101608901516101e4860152610180905251805161020485018190529394919384936044870192849261022489019291820191601f82010460005b81811015612e34578351855260209485019490930192600101612e16565b50505050818103610160808401919091528a0151805180835260209283019291820191601f82010460005b81811015612e7d578351855260209485019490930192600101612e5f565b50505089845250848103602093840190815288518083529093918201918981019190601f82010460005b81811015612ec5578351855260209485019490930192600101612ea7565b5050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08883030188525060405250505050509392505050565b612f076143de565b612f1082611f30565b9050612f1c8282613bed565b612805828260200151613d04565b612f32614386565b612f3d8484846124df565b6020810151909150831461260a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061574d565b600082821115612fb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061560d565b508082035b92915050565b6000808251111515613002576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156fd565b815182907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061303257fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909252507f0100000000000000000000000000000000000000000000000000000000000000908190040290565b6000816020018351101515156130ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061562d565b50016020015190565b6040516000906060907f1626ba7e000000000000000000000000000000000000000000000000000000009061310e908790869060240161554e565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093178352815191935090829081885afa8080156131ab576001811461321c57612572565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0c57414c4c45545f4552524f5200000000000000000000000000000000604052600060605260646000fd5b50505195945050505050565b60006014825110151515613268576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061578d565b613276826014845103613dab565b82517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec019092525090565b6040516000906060907f9363470200000000000000000000000000000000000000000000000000000000906132de90879087908790602401615521565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931783528151919350908290818a5afa80801561337b57600181146133ec576133f1565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f56414c494441544f525f4552524f5200000000000000000000000000604052600060605260646000fd5b825194505b50505050949350505050565b6000808311613438576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b61344b61344585846138ae565b84613e0c565b949350505050565b604080517f5a65726f45785472616e73616374696f6e2800000000000000000000000000006020808301919091527f75696e743235362073616c742c0000000000000000000000000000000000000060328301527f61646472657373207369676e6572416464726573732c00000000000000000000603f8301527f627974657320646174610000000000000000000000000000000000000000000060558301527f2900000000000000000000000000000000000000000000000000000000000000605f830152825180830384018152606090920192839052815160009384938493909282918401908083835b6020831061357c57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161353f565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260405191909301819003812089519097508995509093508392850191508083835b6020831061361257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016135d5565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822097825281019a909a525073ffffffffffffffffffffffffffffffffffffffff97909716968801969096525050606085015250506080909120919050565b600280546040517f190100000000000000000000000000000000000000000000000000000000000081529182015260228101919091526042902090565b6000612fbe611afd83613e23565b60008183106136ee578161260a565b5090919050565b6136fd614386565b6020810182905260a08301516080840151613719918491613909565b808252608084015160c0850151613731929190613909565b604082015260a083015160e084015161374b918491613909565b606082015292915050565b60018054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156137ff5780601f106137d4576101008083540402835291602001916137ff565b820191906000526020600020905b8154815290600101906020018083116137e257829003601f168201915b5050505050905061381f8461014001518560000151858560000151613a23565b6138388461016001518486600001518560200151613a23565b61385081856000015186604001518560400151613a23565b6127a3818486604001518560600151613a23565b6000828201838110156138a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567d565b8091505b5092915050565b6000808315156138c157600091506138a7565b508282028284828115156138d157fe5b04146138a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567d565b6000808311613944576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b61394f84848461427c565b15613438576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156ad565b60008083116139c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b6139cc848484614301565b15613a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156ad565b61344b613445613a1386856138ae565b613a1e866001612f7d565b613864565b600080600083118015613a6257508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15613be5578551600310613aa2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061573d565b50506020848101517fffffffff00000000000000000000000000000000000000000000000000000000166000818152600b90925260409091205473ffffffffffffffffffffffffffffffffffffffff16801515613b2b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156ed565b604051660fffffffffffe0603f885101168060840182017fa85e59e40000000000000000000000000000000000000000000000000000000083526080600484015273ffffffffffffffffffffffffffffffffffffffff8816602484015273ffffffffffffffffffffffffffffffffffffffff87166044840152856064840152608483015b81811015613bc757895181526020998a019901613baf565b61020084858403866000895af1801515613bdf573d85fd5b50505050505b505050505050565b805160009060ff16600314613c2e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061579d565b606083015173ffffffffffffffffffffffffffffffffffffffff1615613ca157606083015173ffffffffffffffffffffffffffffffffffffffff163314613ca1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157ad565b613ca96125df565b835190915073ffffffffffffffffffffffffffffffffffffffff808316911614613cff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061566d565b505050565b6000818152600560205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558281015183516101408501516101608601519351859473ffffffffffffffffffffffffffffffffffffffff9485169493909316927fdc47b3613d9fe400085f6dbdc99453462279057e6207385042827ed6b1a62cf792613d9f923392906154b7565b60405180910390a45050565b600081601401835110151515613ded576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061578d565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000808284811515613e1a57fe5b04949350505050565b604080517f4f726465722800000000000000000000000000000000000000000000000000006020808301919091527f61646472657373206d616b6572416464726573732c000000000000000000000060268301527f616464726573732074616b6572416464726573732c0000000000000000000000603b8301527f6164647265737320666565526563697069656e74416464726573732c0000000060508301527f616464726573732073656e646572416464726573732c00000000000000000000606c8301527f75696e74323536206d616b65724173736574416d6f756e742c0000000000000060828301527f75696e743235362074616b65724173736574416d6f756e742c00000000000000609b8301527f75696e74323536206d616b65724665652c00000000000000000000000000000060b48301527f75696e743235362074616b65724665652c00000000000000000000000000000060c58301527f75696e743235362065787069726174696f6e54696d655365636f6e64732c000060d68301527f75696e743235362073616c742c0000000000000000000000000000000000000060f48301527f6279746573206d616b65724173736574446174612c00000000000000000000006101018301527f62797465732074616b65724173736574446174610000000000000000000000006101168301527f290000000000000000000000000000000000000000000000000000000000000061012a830152825161010b81840301815261012b90920192839052815160009384938493849391929182918401908083835b602083106140ab57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161406e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101408b0151805191995095509093508392850191508083835b6020831061414657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101614109565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101608b0151805191985095509093508392850191508083835b602083106141e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016141a4565b5181516020939093036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909116921691909117905260405192018290039091207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0890180516101408b018051610160909c0180519a84529881529288526101a0822091529890525050509190525090919050565b6000808084116142b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b8215806142c3575084155b156142d15760009150610a88565b838015156142db57fe5b85840990506142ea85846138ae565b6142f66103e8836138ae565b101595945050505050565b60008080841161433d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b821580614348575084155b156143565760009150610a88565b8380151561436057fe5b8584099050836143708583612f7d565b81151561437957fe5b0690506142ea85846138ae565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b610120604051908101604052806143c4614386565b81526020016143d1614386565b8152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b600061260a82356158b0565b6000601f8201831361441b57600080fd5b813561442e6144298261583f565b615818565b81815260209384019390925082018360005b8381101561446c578135860161445688826145bc565b8452506020928301929190910190600101614440565b5050505092915050565b6000601f8201831361448757600080fd5b81356144956144298261583f565b81815260209384019390925082018360005b8381101561446c57813586016144bd888261460b565b84525060209283019291909101906001016144a7565b6000601f820183136144e457600080fd5b81356144f26144298261583f565b9150818183526020840193506020810190508385602084028201111561451757600080fd5b60005b8381101561446c578161452d888261454f565b845250602092830192919091019060010161451a565b600061260a82356158c9565b600061260a82356158ce565b600061260a82356158d1565b600061260a82516158d1565b600080601f8301841361458557600080fd5b50813567ffffffffffffffff81111561459d57600080fd5b6020830191508360018202830111156145b557600080fd5b9250929050565b6000601f820183136145cd57600080fd5b81356145db61442982615860565b915080825260208301602083018583830111156145f757600080fd5b614602838284615907565b50505092915050565b6000610180828403121561461e57600080fd5b614629610180615818565b9050600061463784846143fe565b8252506020614648848483016143fe565b602083015250604061465c848285016143fe565b6040830152506060614670848285016143fe565b60608301525060806146848482850161454f565b60808301525060a06146988482850161454f565b60a08301525060c06146ac8482850161454f565b60c08301525060e06146c08482850161454f565b60e0830152506101006146d58482850161454f565b610100830152506101206146eb8482850161454f565b6101208301525061014082013567ffffffffffffffff81111561470d57600080fd5b614719848285016145bc565b6101408301525061016082013567ffffffffffffffff81111561473b57600080fd5b614747848285016145bc565b6101608301525092915050565b60006020828403121561476657600080fd5b600061344b84846143fe565b6000806040838503121561478557600080fd5b600061479185856143fe565b92505060206147a2858286016143fe565b9150509250929050565b600080604083850312156147bf57600080fd5b60006147cb85856143fe565b92505060206147a285828601614543565b6000602082840312156147ee57600080fd5b813567ffffffffffffffff81111561480557600080fd5b61344b84828501614476565b60008060006060848603121561482657600080fd5b833567ffffffffffffffff81111561483d57600080fd5b61484986828701614476565b935050602084013567ffffffffffffffff81111561486657600080fd5b614872868287016144d3565b925050604084013567ffffffffffffffff81111561488f57600080fd5b61489b8682870161440a565b9150509250925092565b6000806000606084860312156148ba57600080fd5b833567ffffffffffffffff8111156148d157600080fd5b6148dd86828701614476565b93505060206148728682870161454f565b60006020828403121561490057600080fd5b600061344b848461454f565b6000806040838503121561491f57600080fd5b6000614791858561454f565b6000806000806060858703121561494157600080fd5b600061494d878761454f565b945050602061495e878288016143fe565b935050604085013567ffffffffffffffff81111561497b57600080fd5b61498787828801614573565b95989497509550505050565b6000806000606084860312156149a857600080fd5b60006149b4868661454f565b93505060206149c5868287016143fe565b925050604084013567ffffffffffffffff8111156149e257600080fd5b61489b868287016145bc565b600060208284031215614a0057600080fd5b600061344b848461455b565b600060208284031215614a1e57600080fd5b600061344b8484614567565b600060208284031215614a3c57600080fd5b813567ffffffffffffffff811115614a5357600080fd5b61344b8482850161460b565b60008060008060808587031215614a7557600080fd5b843567ffffffffffffffff811115614a8c57600080fd5b614a988782880161460b565b945050602085013567ffffffffffffffff811115614ab557600080fd5b614ac18782880161460b565b935050604085013567ffffffffffffffff811115614ade57600080fd5b614aea878288016145bc565b925050606085013567ffffffffffffffff811115614b0757600080fd5b614b13878288016145bc565b91505092959194509250565b600080600060608486031215614b3457600080fd5b833567ffffffffffffffff811115614b4b57600080fd5b614b578682870161460b565b93505060206149c58682870161454f565b60008060008060008060808789031215614b8157600080fd5b6000614b8d898961454f565b9650506020614b9e89828a016143fe565b955050604087013567ffffffffffffffff811115614bbb57600080fd5b614bc789828a01614573565b9450945050606087013567ffffffffffffffff811115614be657600080fd5b614bf289828a01614573565b92509250509295509295509295565b614c0a816158b0565b82525050565b6000614c1b826158ac565b808452602084019350614c2d836158a6565b60005b82811015614c5d57614c438683516153e5565b614c4c826158a6565b606096909601959150600101614c30565b5093949350505050565b614c0a816158c9565b614c0a816158ce565b614c0a816158d1565b6000614c8d826158ac565b808452614ca1816020860160208601615913565b614caa8161593f565b9093016020019392505050565b614c0a816158fc565b601281527f4c454e4754485f36355f52455155495245440000000000000000000000000000602082015260400190565b600d81527f494e56414c49445f54414b455200000000000000000000000000000000000000602082015260400190565b600e81527f4f524445525f4f56455246494c4c000000000000000000000000000000000000602082015260400190565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f414c52454144595f455849535453000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601581527f5349474e41545552455f554e535550504f525445440000000000000000000000602082015260400190565b601081527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000602082015260400190565b601781527f494e56414c49445f4f524445525f5349474e4154555245000000000000000000602082015260400190565b600d81527f494e56414c49445f4d414b455200000000000000000000000000000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b600f81527f494e56414c49445f54585f484153480000000000000000000000000000000000602082015260400190565b601181527f494e56414c49445f5349474e4154555245000000000000000000000000000000602082015260400190565b600e81527f524f554e44494e475f4552524f52000000000000000000000000000000000000602082015260400190565b601081527f4641494c45445f455845435554494f4e00000000000000000000000000000000602082015260400190565b600d81527f54414b45525f4f56455250415900000000000000000000000000000000000000602082015260400190565b601481527f494e56414c49445f54414b45525f414d4f554e54000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f444f45535f4e4f545f4558495354000000000000602082015260400190565b602181527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560208201527f4400000000000000000000000000000000000000000000000000000000000000604082015260600190565b601181527f5349474e41545552455f494c4c4547414c000000000000000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f305f52455155495245440000602082015260400190565b601781527f494e56414c49445f4e45575f4f524445525f45504f4348000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f335f52455155495245440000602082015260400190565b601481527f434f4d504c4554455f46494c4c5f4641494c4544000000000000000000000000602082015260400190565b601281527f494e56414c49445f46494c4c5f50524943450000000000000000000000000000602082015260400190565b601281527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000602082015260400190565b601381527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601081527f4f524445525f554e46494c4c41424c4500000000000000000000000000000000602082015260400190565b600e81527f494e56414c49445f53454e444552000000000000000000000000000000000000602082015260400190565b601881527f4e454741544956455f5350524541445f52455155495245440000000000000000602082015260400190565b601481527f494e56414c49445f54585f5349474e4154555245000000000000000000000000602082015260400190565b601181527f4c454e4754485f305f5245515549524544000000000000000000000000000000602082015260400190565b805160808301906153738482614c70565b5060208201516153866020850182614c70565b5060408201516153996040850182614c70565b5060608201516127a36060850182614c70565b80516101208301906153be8482615362565b5060208201516153d16080850182615362565b5060408201516127a3610100850182614c70565b805160608301906153f6848261541c565b5060208201516154096020850182614c70565b5060408201516127a36040850182614c70565b614c0a816158f6565b60208101612fbe8284614c01565b6101008101615442828b614c01565b61544f602083018a614c01565b61545c6040830189614c70565b6154696060830188614c70565b6154766080830187614c70565b61548360a0830186614c70565b81810360c08301526154958185614c82565b905081810360e08301526154a98184614c82565b9a9950505050505050505050565b606081016154c58286614c01565b81810360208301526154d78185614c82565b905081810360408301526154eb8184614c82565b95945050505050565b6020808252810161260a8184614c10565b60208101612fbe8284614c67565b60208101612fbe8284614c70565b6060810161552f8286614c70565b61553c6020830185614c01565b81810360408301526154eb8184614c82565b6040810161555c8285614c70565b818103602083015261344b8184614c82565b6080810161557c8287614c70565b615589602083018661541c565b6155966040830185614c70565b6154eb6060830184614c70565b604081016155b18285614c79565b61260a6020830184614c01565b6020808252810161260a8184614c82565b60208101612fbe8284614cb7565b60208082528101612fbe81614cc0565b60208082528101612fbe81614cf0565b60208082528101612fbe81614d20565b60208082528101612fbe81614d50565b60208082528101612fbe81614d80565b60208082528101612fbe81614db0565b60208082528101612fbe81614e06565b60208082528101612fbe81614e36565b60208082528101612fbe81614e66565b60208082528101612fbe81614e96565b60208082528101612fbe81614ec6565b60208082528101612fbe81614ef6565b60208082528101612fbe81614f26565b60208082528101612fbe81614f56565b60208082528101612fbe81614f86565b60208082528101612fbe81614fb6565b60208082528101612fbe81614fe6565b60208082528101612fbe81615016565b60208082528101612fbe81615046565b60208082528101612fbe8161509c565b60208082528101612fbe816150cc565b60208082528101612fbe816150fc565b60208082528101612fbe8161512c565b60208082528101612fbe8161515c565b60208082528101612fbe8161518c565b60208082528101612fbe816151bc565b60208082528101612fbe816151ec565b60208082528101612fbe8161521c565b60208082528101612fbe81615272565b60208082528101612fbe816152a2565b60208082528101612fbe816152d2565b60208082528101612fbe81615302565b60208082528101612fbe81615332565b60808101612fbe8284615362565b6101208101612fbe82846153ac565b60608101612fbe82846153e5565b60405181810167ffffffffffffffff8111828210171561583757600080fd5b604052919050565b600067ffffffffffffffff82111561585657600080fd5b5060209081020190565b600067ffffffffffffffff82111561587757600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b6000612fbe826158b0565b82818337506000910152565b60005b8381101561592e578181015183820152602001615916565b838111156127a35750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820fdae8e8e60f04e880ecbbd37d833d342061e8b2cb23fd5fe7ff93742cbe9fe9f6c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF NOT AND SWAP1 SSTORE CALLVALUE DUP1 ISZERO PUSH3 0x1B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x5EC0 CODESIZE SUB DUP1 PUSH3 0x5EC0 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH3 0x41 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH3 0x44D JUMP JUMPDEST DUP1 MLOAD DUP2 SWAP1 PUSH3 0x58 SWAP1 PUSH1 0x1 SWAP1 PUSH1 0x20 DUP5 ADD SWAP1 PUSH3 0x34C JUMP JUMPDEST POP POP PUSH1 0x40 DUP1 MLOAD PUSH32 0x454950373132446F6D61696E2800000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x737472696E67206E616D652C0000000000000000000000000000000000000000 PUSH1 0x2D DUP4 ADD MSTORE PUSH32 0x737472696E672076657273696F6E2C0000000000000000000000000000000000 PUSH1 0x39 DUP4 ADD MSTORE PUSH32 0x6164647265737320766572696679696E67436F6E747261637400000000000000 PUSH1 0x48 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0x61 DUP4 ADD MSTORE DUP3 MLOAD PUSH1 0x42 DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH1 0x62 SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD SWAP2 SWAP3 SWAP2 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH3 0x162 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH3 0x141 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP6 ADD DUP6 MSTORE PUSH1 0xB DUP1 DUP5 MSTORE PUSH32 0x30782050726F746F636F6C000000000000000000000000000000000000000000 SWAP3 DUP5 ADD SWAP3 DUP4 MSTORE SWAP5 MLOAD SWAP1 SWAP7 POP SWAP2 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH3 0x1EC JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH3 0x1CB JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP6 ADD DUP6 MSTORE PUSH1 0x1 DUP1 DUP5 MSTORE PUSH32 0x3200000000000000000000000000000000000000000000000000000000000000 SWAP3 DUP5 ADD SWAP3 DUP4 MSTORE SWAP5 MLOAD SWAP1 SWAP7 POP SWAP2 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH3 0x276 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH3 0x255 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP3 ADD SWAP9 SWAP1 SWAP9 MSTORE DUP2 DUP5 ADD SWAP7 SWAP1 SWAP7 MSTORE PUSH1 0x60 DUP2 ADD SWAP7 SWAP1 SWAP7 MSTORE POP ADDRESS PUSH1 0x80 DUP1 DUP8 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP2 MLOAD DUP1 DUP8 SUB SWAP1 SWAP2 ADD DUP2 MSTORE PUSH1 0xA0 SWAP1 SWAP6 ADD SWAP1 DUP2 SWAP1 MSTORE DUP5 MLOAD SWAP1 SWAP4 DUP5 SWAP4 POP DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH3 0x301 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH3 0x2E0 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x0 NOT PUSH1 0x20 SWAP5 SWAP1 SWAP5 SUB PUSH2 0x100 EXP SWAP4 SWAP1 SWAP4 ADD SWAP3 DUP4 AND SWAP3 NOT AND SWAP2 SWAP1 SWAP2 OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP1 SWAP2 KECCAK256 PUSH1 0x2 SSTORE POP POP PUSH1 0x3 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE POP PUSH3 0x50F SWAP1 POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH3 0x38F JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH3 0x3BF JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH3 0x3BF JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0x3BF JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH3 0x3A2 JUMP JUMPDEST POP PUSH3 0x3CD SWAP3 SWAP2 POP PUSH3 0x3D1 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x3EE SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x3CD JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x3D8 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH3 0x403 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH3 0x41A PUSH3 0x414 DUP3 PUSH3 0x4B4 JUMP JUMPDEST PUSH3 0x48D JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH3 0x437 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x444 DUP4 DUP3 DUP5 PUSH3 0x4DC JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH3 0x460 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH3 0x477 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x485 DUP5 DUP3 DUP6 ADD PUSH3 0x3F1 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH3 0x4AC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP3 GT ISZERO PUSH3 0x4CB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH3 0x4F9 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH3 0x4DF JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH3 0x509 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH2 0x59A1 DUP1 PUSH3 0x51F PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x1B6 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x288CDC91 DUP2 EQ PUSH2 0x1BB JUMPI DUP1 PUSH4 0x297BB70B EQ PUSH2 0x1F1 JUMPI DUP1 PUSH4 0x2AC12622 EQ PUSH2 0x21E JUMPI DUP1 PUSH4 0x3683EF8E EQ PUSH2 0x24B JUMPI DUP1 PUSH4 0x3C28D861 EQ PUSH2 0x26D JUMPI DUP1 PUSH4 0x3E228BAE EQ PUSH2 0x29A JUMPI DUP1 PUSH4 0x3FD3C997 EQ PUSH2 0x2BA JUMPI DUP1 PUSH4 0x4AC14782 EQ PUSH2 0x2E7 JUMPI DUP1 PUSH4 0x4D0AE546 EQ PUSH2 0x307 JUMPI DUP1 PUSH4 0x4F9559B1 EQ PUSH2 0x327 JUMPI DUP1 PUSH4 0x50DDE190 EQ PUSH2 0x347 JUMPI DUP1 PUSH4 0x60704108 EQ PUSH2 0x367 JUMPI DUP1 PUSH4 0x642F2EAF EQ PUSH2 0x394 JUMPI DUP1 PUSH4 0x64A3BC15 EQ PUSH2 0x3B4 JUMPI DUP1 PUSH4 0x77FCCE68 EQ PUSH2 0x3D4 JUMPI DUP1 PUSH4 0x7B8E3514 EQ PUSH2 0x3F4 JUMPI DUP1 PUSH4 0x7E1D9808 EQ PUSH2 0x414 JUMPI DUP1 PUSH4 0x7E9D74DC EQ PUSH2 0x434 JUMPI DUP1 PUSH4 0x82C174D0 EQ PUSH2 0x461 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x481 JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0x496 JUMPI DUP1 PUSH4 0xA3E20380 EQ PUSH2 0x4B6 JUMPI DUP1 PUSH4 0xB4BE83D5 EQ PUSH2 0x4D6 JUMPI DUP1 PUSH4 0xBFC8BFCE EQ PUSH2 0x4F6 JUMPI DUP1 PUSH4 0xC585BB93 EQ PUSH2 0x516 JUMPI DUP1 PUSH4 0xC75E0A81 EQ PUSH2 0x536 JUMPI DUP1 PUSH4 0xD46B02C3 EQ PUSH2 0x563 JUMPI DUP1 PUSH4 0xD9BFA73E EQ PUSH2 0x583 JUMPI DUP1 PUSH4 0xDB123B1A EQ PUSH2 0x5A3 JUMPI DUP1 PUSH4 0xDD1C7D18 EQ PUSH2 0x5C5 JUMPI DUP1 PUSH4 0xE306F779 EQ PUSH2 0x5E5 JUMPI DUP1 PUSH4 0xE5FA431B EQ PUSH2 0x5FA JUMPI DUP1 PUSH4 0xEEA086BA EQ PUSH2 0x61A JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x62F JUMPI DUP1 PUSH4 0xFFA1AD74 EQ PUSH2 0x64F JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1C7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH2 0x1D6 CALLDATASIZE PUSH1 0x4 PUSH2 0x48EE JUMP JUMPDEST PUSH2 0x664 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x5513 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x20C CALLDATASIZE PUSH1 0x4 PUSH2 0x4811 JUMP JUMPDEST PUSH2 0x676 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x57ED JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x22A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x239 CALLDATASIZE PUSH1 0x4 PUSH2 0x48EE JUMP JUMPDEST PUSH2 0x7A1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x5505 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x257 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x266 CALLDATASIZE PUSH1 0x4 PUSH2 0x492B JUMP JUMPDEST PUSH2 0x7B6 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x279 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28D PUSH2 0x288 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A5F JUMP JUMPDEST PUSH2 0x8A3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x57FB JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x2B5 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B1F JUMP JUMPDEST PUSH2 0xA3A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2C6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DA PUSH2 0x2D5 CALLDATASIZE PUSH1 0x4 PUSH2 0x49EE JUMP JUMPDEST PUSH2 0xA90 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x55CF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x302 CALLDATASIZE PUSH1 0x4 PUSH2 0x47DC JUMP JUMPDEST PUSH2 0xAB8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x313 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x322 CALLDATASIZE PUSH1 0x4 PUSH2 0x4811 JUMP JUMPDEST PUSH2 0xB85 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x333 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x342 CALLDATASIZE PUSH1 0x4 PUSH2 0x48EE JUMP JUMPDEST PUSH2 0xC75 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x353 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x362 CALLDATASIZE PUSH1 0x4 PUSH2 0x4811 JUMP JUMPDEST PUSH2 0xE2A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x373 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x387 PUSH2 0x382 CALLDATASIZE PUSH1 0x4 PUSH2 0x49EE JUMP JUMPDEST PUSH2 0xEBE JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x5425 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x3AF CALLDATASIZE PUSH1 0x4 PUSH2 0x48EE JUMP JUMPDEST PUSH2 0xF0C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3C0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x3CF CALLDATASIZE PUSH1 0x4 PUSH2 0x4B1F JUMP JUMPDEST PUSH2 0xF21 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3E0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x3EF CALLDATASIZE PUSH1 0x4 PUSH2 0x47AC JUMP JUMPDEST PUSH2 0xFCC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x400 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x40F CALLDATASIZE PUSH1 0x4 PUSH2 0x4772 JUMP JUMPDEST PUSH2 0x1106 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x420 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x42F CALLDATASIZE PUSH1 0x4 PUSH2 0x48A5 JUMP JUMPDEST PUSH2 0x1126 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x440 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x454 PUSH2 0x44F CALLDATASIZE PUSH1 0x4 PUSH2 0x47DC JUMP JUMPDEST PUSH2 0x128A JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x54F4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x46D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x47C CALLDATASIZE PUSH1 0x4 PUSH2 0x490C JUMP JUMPDEST PUSH2 0x131F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x48D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x387 PUSH2 0x133F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4A2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x4B1 CALLDATASIZE PUSH1 0x4 PUSH2 0x4993 JUMP JUMPDEST PUSH2 0x135B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4C2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x4D1 CALLDATASIZE PUSH1 0x4 PUSH2 0x48A5 JUMP JUMPDEST PUSH2 0x18DE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4E2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x4F1 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B1F JUMP JUMPDEST PUSH2 0x19F1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x502 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x511 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B68 JUMP JUMPDEST PUSH2 0x1A6C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x522 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x531 CALLDATASIZE PUSH1 0x4 PUSH2 0x4754 JUMP JUMPDEST PUSH2 0x1D05 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x542 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x556 PUSH2 0x551 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A2A JUMP JUMPDEST PUSH2 0x1F30 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x580A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x56F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x57E CALLDATASIZE PUSH1 0x4 PUSH2 0x4A2A JUMP JUMPDEST PUSH2 0x202A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x58F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH2 0x59E CALLDATASIZE PUSH1 0x4 PUSH2 0x4772 JUMP JUMPDEST PUSH2 0x20C6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x5B8 PUSH2 0x20E3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x55BE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5D1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x5E0 CALLDATASIZE PUSH1 0x4 PUSH2 0x48A5 JUMP JUMPDEST PUSH2 0x218E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5F1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH2 0x2263 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x606 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x615 CALLDATASIZE PUSH1 0x4 PUSH2 0x48A5 JUMP JUMPDEST PUSH2 0x2269 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x626 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x387 PUSH2 0x23DB JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x63B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x64A CALLDATASIZE PUSH1 0x4 PUSH2 0x4754 JUMP JUMPDEST PUSH2 0x23F7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x65B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x5B8 PUSH2 0x24A8 JUMP JUMPDEST PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH2 0x67E PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x689 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x6CF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP8 MLOAD SWAP4 POP SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0x76F JUMPI PUSH2 0x758 DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x719 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x731 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x749 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x24DF JUMP JUMPDEST SWAP1 POP PUSH2 0x764 DUP5 DUP3 PUSH2 0x257D JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x701 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND CALLER EQ PUSH2 0x846 JUMPI PUSH2 0x80E DUP5 DUP5 DUP5 DUP5 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x135B SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0x846 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x569D JUMP JUMPDEST POP POP PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND DUP5 MSTORE SWAP2 SWAP1 MSTORE SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE JUMP JUMPDEST PUSH2 0x8AB PUSH2 0x43AF JUMP JUMPDEST PUSH2 0x8B3 PUSH2 0x43DE JUMP JUMPDEST PUSH2 0x8BB PUSH2 0x43DE JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x8F9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x160 DUP1 DUP10 ADD MLOAD PUSH2 0x140 DUP1 DUP11 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP10 ADD MLOAD SWAP1 DUP9 ADD MSTORE PUSH2 0x945 DUP9 PUSH2 0x1F30 JUMP JUMPDEST SWAP3 POP PUSH2 0x950 DUP8 PUSH2 0x1F30 JUMP JUMPDEST SWAP2 POP PUSH2 0x95A PUSH2 0x25DF JUMP JUMPDEST SWAP1 POP PUSH2 0x968 DUP9 DUP5 DUP4 DUP10 PUSH2 0x2611 JUMP JUMPDEST PUSH2 0x974 DUP8 DUP4 DUP4 DUP9 PUSH2 0x2611 JUMP JUMPDEST PUSH2 0x97E DUP9 DUP9 PUSH2 0x27A9 JUMP JUMPDEST PUSH2 0x992 DUP9 DUP9 DUP6 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x2809 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP2 ADD MLOAD SWAP1 MLOAD SWAP2 SWAP6 POP PUSH2 0x9AD SWAP2 DUP11 SWAP2 DUP7 SWAP2 DUP2 SWAP1 PUSH2 0x2990 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP6 ADD MLOAD SWAP1 DUP2 ADD MLOAD SWAP1 MLOAD PUSH2 0x9C9 SWAP2 DUP10 SWAP2 DUP6 SWAP2 SWAP1 DUP2 SWAP1 PUSH2 0x2990 JUMP JUMPDEST PUSH2 0x9E2 DUP9 DUP3 DUP6 PUSH1 0x20 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP9 PUSH1 0x0 ADD MLOAD PUSH2 0x2AA9 JUMP JUMPDEST PUSH2 0x9FB DUP8 DUP3 DUP5 PUSH1 0x20 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD DUP9 PUSH1 0x20 ADD MLOAD PUSH2 0x2AA9 JUMP JUMPDEST PUSH2 0xA07 DUP9 DUP9 DUP4 DUP8 PUSH2 0x2B55 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0xA42 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xA4F DUP6 DUP6 DUP6 PUSH2 0x2D2D JUMP JUMPDEST SWAP1 POP PUSH1 0x80 DUP2 DUP3 MLOAD PUSH1 0x20 DUP5 ADD ADDRESS GAS DELEGATECALL DUP1 ISZERO PUSH2 0xA86 JUMPI DUP2 MLOAD DUP4 MSTORE PUSH1 0x20 DUP3 ADD MLOAD PUSH1 0x20 DUP5 ADD MSTORE PUSH1 0x40 DUP3 ADD MLOAD PUSH1 0x40 DUP5 ADD MSTORE PUSH1 0x60 DUP3 ADD MLOAD PUSH1 0x60 DUP5 ADD MSTORE JUMPDEST POP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xAF8 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP2 MLOAD SWAP1 JUMPDEST DUP1 DUP3 EQ PUSH2 0xB58 JUMPI PUSH2 0xB50 DUP4 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xB41 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x2EFF JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0xB29 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP JUMP JUMPDEST PUSH2 0xB8D PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xB98 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xBD5 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP8 MLOAD SWAP4 POP SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0x76F JUMPI PUSH2 0xC5E DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC1F JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC37 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC4F JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x2F2A JUMP JUMPDEST SWAP1 POP PUSH2 0xC6A DUP5 DUP3 PUSH2 0x257D JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0xC07 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD DUP2 SWAP1 DUP2 SWAP1 DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xCB9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0xCEC PUSH2 0x25DF JUMP JUMPDEST SWAP4 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND CALLER EQ PUSH2 0xD11 JUMPI CALLER PUSH2 0xD14 JUMP JUMPDEST PUSH1 0x0 JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD SWAP1 SWAP4 POP PUSH1 0x1 DUP7 ADD SWAP3 POP SWAP1 POP DUP1 DUP3 GT PUSH2 0xD8B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x572D JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 DUP9 AND DUP1 DUP5 MSTORE SWAP5 SWAP1 SWAP2 MSTORE SWAP1 DUP2 SWAP1 KECCAK256 DUP6 SWAP1 SSTORE MLOAD PUSH32 0x82AF639571738F4EBD4268FB0363D8957EBE1BBB9E78DBA5EBD69EED39B154F0 SWAP1 PUSH2 0xDF3 SWAP1 DUP7 SWAP1 PUSH2 0x5513 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP POP POP JUMP JUMPDEST PUSH2 0xE32 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xE3D PUSH2 0x4386 JUMP JUMPDEST DUP7 MLOAD SWAP3 POP PUSH1 0x0 SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0xEB4 JUMPI PUSH2 0xE9D DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE5E JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE76 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE8E JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0xA3A JUMP JUMPDEST SWAP1 POP PUSH2 0xEA9 DUP5 DUP3 PUSH2 0x257D JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0xE46 JUMP JUMPDEST POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH2 0xF29 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xF66 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0xF9C DUP5 DUP5 DUP5 PUSH2 0x2F2A JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x100A JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x103D PUSH2 0x25DF JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 DUP10 AND DUP1 DUP5 MSTORE SWAP5 SWAP1 SWAP2 MSTORE SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP8 ISZERO ISZERO OR SWAP1 SSTORE MLOAD SWAP3 SWAP4 POP SWAP1 SWAP2 PUSH32 0xA8656E308026EEABCE8F0BC18048433252318AB80AC79DA0B3D3D8697DFBA891 SWAP1 PUSH2 0x10D1 SWAP1 DUP7 SWAP1 PUSH2 0x5505 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH2 0x112E PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x113D PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x117A JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP10 MLOAD DUP11 SWAP2 SWAP1 DUP2 LT PUSH2 0x11B2 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD MLOAD SWAP5 POP DUP9 MLOAD SWAP4 POP PUSH1 0x0 SWAP3 POP JUMPDEST DUP3 DUP5 EQ PUSH2 0x1255 JUMPI DUP5 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x11E2 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD DUP2 SWAP1 MSTORE POP PUSH2 0x1202 DUP9 DUP8 PUSH1 0x20 ADD MLOAD PUSH2 0x2F7D JUMP JUMPDEST SWAP2 POP PUSH2 0x122E DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1215 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP10 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x749 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x123A DUP7 DUP3 PUSH2 0x257D JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD DUP9 GT PUSH2 0x124A JUMPI PUSH2 0x1255 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x11CC JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP2 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH1 0x60 PUSH1 0x0 DUP5 MLOAD SWAP3 POP DUP3 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x12D0 JUMPI DUP2 PUSH1 0x20 ADD JUMPDEST PUSH2 0x12BD PUSH2 0x43DE JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 SWAP1 SUB SWAP1 DUP2 PUSH2 0x12B5 JUMPI SWAP1 POP JUMPDEST POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP1 DUP4 EQ PUSH2 0xA88 JUMPI PUSH2 0x12FF DUP6 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x12F0 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x1F30 JUMP JUMPDEST DUP3 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x130D JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x12D8 JUMP JUMPDEST PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP10 MLOAD GT ISZERO ISZERO PUSH2 0x13A4 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x571D JUMP JUMPDEST PUSH2 0x13AD DUP10 PUSH2 0x2FC4 JUMP JUMPDEST PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DIV SWAP7 POP PUSH1 0x7 PUSH1 0xFF DUP9 AND LT PUSH2 0x140F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x563D JUMP JUMPDEST DUP7 PUSH1 0xFF AND PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x141E JUMPI INVALID JUMPDEST SWAP6 POP PUSH1 0x0 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x142E JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1466 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x570D JUMP JUMPDEST PUSH1 0x1 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1474 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x14BC JUMPI DUP9 MLOAD ISZERO PUSH2 0x14B3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x57DD JUMP JUMPDEST PUSH1 0x0 SWAP8 POP PUSH2 0x18D0 JUMP JUMPDEST PUSH1 0x2 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x14CA JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1605 JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0x150B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x55DD JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x151A JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0x155A DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x3088 AND JUMP JUMPDEST SWAP4 POP PUSH2 0x156D DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x3088 AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD PUSH2 0x1592 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x556E JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 PUSH1 0x0 DUP7 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x15B6 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP13 DUP2 AND SWAP1 DUP3 AND EQ SWAP10 POP SWAP3 POP PUSH2 0x18D0 SWAP1 POP JUMP JUMPDEST PUSH1 0x3 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1613 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x17B9 JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0x1654 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x55DD JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1663 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0x16A3 DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x3088 AND JUMP JUMPDEST SWAP4 POP PUSH2 0x16B6 DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x3088 AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 PUSH1 0x40 MLOAD PUSH1 0x20 ADD DUP1 DUP1 PUSH32 0x19457468657265756D205369676E6564204D6573736167653A0A333200000000 DUP2 MSTORE POP PUSH1 0x1C ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x1757 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x171A JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 PUSH1 0x0 DUP4 MSTORE SWAP2 ADD SWAP3 DUP4 SWAP1 MSTORE PUSH2 0x1592 SWAP5 POP SWAP3 POP DUP10 SWAP2 DUP10 SWAP2 POP DUP9 SWAP1 PUSH2 0x556E JUMP JUMPDEST PUSH1 0x4 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x17C7 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x17DF JUMPI PUSH2 0x17D8 DUP12 DUP12 DUP12 PUSH2 0x30D3 JUMP JUMPDEST SWAP8 POP PUSH2 0x18D0 JUMP JUMPDEST PUSH1 0x5 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x17ED JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1850 JUMPI PUSH2 0x17FC DUP10 PUSH2 0x3228 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP13 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1844 JUMPI PUSH1 0x0 SWAP8 POP PUSH2 0x18D0 JUMP JUMPDEST PUSH2 0x17D8 DUP2 DUP13 DUP13 DUP13 PUSH2 0x32A1 JUMP JUMPDEST PUSH1 0x6 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x185E JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x189E JUMPI PUSH1 0x0 DUP12 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP15 AND DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND SWAP8 POP PUSH2 0x18D0 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x563D JUMP JUMPDEST POP POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x18E6 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x18F6 PUSH2 0x4386 JUMP JUMPDEST DUP10 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1905 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x140 ADD MLOAD SWAP6 POP DUP10 MLOAD SWAP5 POP PUSH1 0x0 SWAP4 POP JUMPDEST DUP4 DUP6 EQ PUSH2 0x19E4 JUMPI DUP6 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1935 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP7 MLOAD PUSH2 0x1951 SWAP1 DUP11 SWAP1 PUSH2 0x2F7D JUMP JUMPDEST SWAP3 POP PUSH2 0x1994 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1964 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0xA0 ADD MLOAD DUP12 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1980 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x80 ADD MLOAD DUP6 PUSH2 0x33FD JUMP JUMPDEST SWAP2 POP PUSH2 0x19C0 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x19A7 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP11 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE8E JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x19CC DUP8 DUP3 PUSH2 0x257D JUMP JUMPDEST DUP7 MLOAD DUP10 GT PUSH2 0x19D9 JUMPI PUSH2 0x19E4 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP4 ADD SWAP3 PUSH2 0x191F JUMP JUMPDEST POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x19F9 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x1A36 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0xF9C DUP5 DUP5 DUP5 PUSH2 0x24DF JUMP JUMPDEST PUSH1 0xA SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x1ABF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH2 0x1B02 PUSH2 0x1AFD DUP9 DUP9 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x3453 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x3694 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO PUSH2 0x1B4E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x568D JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x1C1F JUMPI PUSH2 0x1BA6 DUP2 DUP8 DUP6 DUP6 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x135B SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0x1BDE JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x57CD JUMP JUMPDEST PUSH1 0xA DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND OR SWAP1 SSTORE JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE MLOAD ADDRESS SWAP1 DUP7 SWAP1 DUP7 SWAP1 DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 GAS DELEGATECALL SWAP2 POP POP ISZERO ISZERO PUSH2 0x1CB6 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56BD JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x1CFC JUMPI PUSH1 0xA DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x0 SWAP1 DUP2 SWAP1 DUP2 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x1D5D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x577D JUMP JUMPDEST DUP4 SWAP3 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xAE25532E PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1DC4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1DD8 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x1DFC SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x4A0C JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP1 ISZERO PUSH2 0x1E81 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x561D JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND OR SWAP1 SSTORE MLOAD PUSH32 0xD2C6B762299C609BDB96520B58A49BFB80186934D4F71A86A367571A15C03194 SWAP1 PUSH2 0x1F22 SWAP1 DUP5 SWAP1 DUP8 SWAP1 PUSH2 0x55A3 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 POP POP POP POP JUMP JUMPDEST PUSH2 0x1F38 PUSH2 0x43DE JUMP JUMPDEST PUSH2 0x1F41 DUP3 PUSH2 0x36D1 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP4 ADD DUP3 SWAP1 MSTORE PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x4 SWAP1 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 SLOAD SWAP1 DUP3 ADD MSTORE PUSH1 0x80 DUP3 ADD MLOAD ISZERO ISZERO PUSH2 0x1F75 JUMPI PUSH1 0x1 JUMPDEST PUSH1 0xFF AND DUP2 MSTORE PUSH2 0xF07 JUMP JUMPDEST PUSH1 0xA0 DUP3 ADD MLOAD ISZERO ISZERO PUSH2 0x1F87 JUMPI PUSH1 0x2 PUSH2 0x1F6B JUMP JUMPDEST PUSH1 0xA0 DUP3 ADD MLOAD PUSH1 0x40 DUP3 ADD MLOAD LT PUSH2 0x1F9D JUMPI PUSH1 0x5 PUSH2 0x1F6B JUMP JUMPDEST PUSH2 0x100 DUP3 ADD MLOAD TIMESTAMP LT PUSH2 0x1FB0 JUMPI PUSH1 0x4 PUSH2 0x1F6B JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 ADD MLOAD PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 SWAP1 SWAP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x1FD4 JUMPI PUSH1 0x6 PUSH2 0x1F6B JUMP JUMPDEST PUSH2 0x120 DUP3 ADD MLOAD DUP3 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH1 0x60 DUP9 ADD MLOAD SWAP1 SWAP5 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD GT ISZERO PUSH2 0x2021 JUMPI PUSH1 0x6 PUSH2 0x1F6B JUMP JUMPDEST PUSH1 0x3 DUP2 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x2067 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x209B DUP2 PUSH2 0x2EFF JUMP JUMPDEST POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 DUP5 DUP7 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x2186 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x215B JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2186 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2169 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST PUSH2 0x2196 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x21A5 PUSH2 0x4386 JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x21B4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD MLOAD SWAP5 POP DUP9 MLOAD SWAP4 POP PUSH1 0x0 SWAP3 POP JUMPDEST DUP3 DUP5 EQ PUSH2 0x2257 JUMPI DUP5 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x21E4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD DUP2 SWAP1 MSTORE POP PUSH2 0x2204 DUP9 DUP8 PUSH1 0x20 ADD MLOAD PUSH2 0x2F7D JUMP JUMPDEST SWAP2 POP PUSH2 0x2230 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2217 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP10 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE8E JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x223C DUP7 DUP3 PUSH2 0x257D JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD DUP9 GT PUSH2 0x224C JUMPI PUSH2 0x2257 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x21CE JUMP JUMPDEST POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x2 SLOAD DUP2 JUMP JUMPDEST PUSH2 0x2271 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x2281 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x22BE JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP11 MLOAD DUP12 SWAP2 SWAP1 DUP2 LT PUSH2 0x22F6 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x140 ADD MLOAD SWAP6 POP DUP10 MLOAD SWAP5 POP PUSH1 0x0 SWAP4 POP JUMPDEST DUP4 DUP6 EQ PUSH2 0x23A5 JUMPI DUP6 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2326 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP7 MLOAD PUSH2 0x2342 SWAP1 DUP11 SWAP1 PUSH2 0x2F7D JUMP JUMPDEST SWAP3 POP PUSH2 0x2355 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1964 JUMPI INVALID JUMPDEST SWAP2 POP PUSH2 0x2381 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2368 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP11 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x749 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x238D DUP8 DUP3 PUSH2 0x257D JUMP JUMPDEST DUP7 MLOAD DUP10 GT PUSH2 0x239A JUMPI PUSH2 0x23A5 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP4 ADD SWAP3 PUSH2 0x2310 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP3 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0xA SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x2448 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x577D JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x24A5 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0xB DUP2 MSTORE PUSH32 0x322E302E312D616C706861000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH2 0x24E7 PUSH2 0x4386 JUMP JUMPDEST PUSH2 0x24EF PUSH2 0x43DE JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x24FD DUP9 PUSH2 0x1F30 JUMP JUMPDEST SWAP4 POP PUSH2 0x2507 PUSH2 0x25DF JUMP JUMPDEST SWAP3 POP PUSH2 0x2515 DUP9 DUP6 DUP6 DUP10 PUSH2 0x2611 JUMP JUMPDEST PUSH2 0x2527 DUP9 PUSH1 0xA0 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x2F7D JUMP JUMPDEST SWAP2 POP PUSH2 0x2533 DUP8 DUP4 PUSH2 0x36DF JUMP JUMPDEST SWAP1 POP PUSH2 0x2546 DUP9 DUP6 DUP10 DUP5 DUP10 PUSH1 0x0 ADD MLOAD PUSH2 0x2990 JUMP JUMPDEST PUSH2 0x2550 DUP9 DUP3 PUSH2 0x36F5 JUMP JUMPDEST SWAP5 POP PUSH2 0x2567 DUP9 DUP5 DUP7 PUSH1 0x20 ADD MLOAD DUP8 PUSH1 0x40 ADD MLOAD DUP10 PUSH2 0x2AA9 JUMP JUMPDEST PUSH2 0x2572 DUP9 DUP5 DUP8 PUSH2 0x3756 JUMP JUMPDEST POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP2 MLOAD DUP2 MLOAD PUSH2 0x258B SWAP2 SWAP1 PUSH2 0x3864 JUMP JUMPDEST DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x25A1 SWAP2 SWAP1 PUSH2 0x3864 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE PUSH1 0x40 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x25BA SWAP2 SWAP1 PUSH2 0x3864 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE PUSH1 0x60 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x25D3 SWAP2 SWAP1 PUSH2 0x3864 JUMP JUMPDEST PUSH1 0x60 SWAP1 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP JUMP JUMPDEST PUSH1 0xA SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 DUP2 ISZERO PUSH2 0x2608 JUMPI DUP2 PUSH2 0x260A JUMP JUMPDEST CALLER JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP3 MLOAD PUSH1 0xFF AND PUSH1 0x3 EQ PUSH2 0x264F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x579D JUMP JUMPDEST PUSH1 0x60 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x26C2 JUMPI PUSH1 0x60 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x26C2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x57AD JUMP JUMPDEST PUSH1 0x20 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x274D JUMPI DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH1 0x20 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO ISZERO PUSH2 0x274D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x55ED JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MLOAD ISZERO ISZERO PUSH2 0x27A3 JUMPI PUSH2 0x276B DUP4 PUSH1 0x20 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD DUP4 PUSH2 0x135B JUMP JUMPDEST ISZERO ISZERO PUSH2 0x27A3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x565D JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH2 0x27BB DUP3 PUSH1 0xA0 ADD MLOAD DUP3 PUSH1 0xA0 ADD MLOAD PUSH2 0x38AE JUMP JUMPDEST PUSH2 0x27CD DUP4 PUSH1 0x80 ADD MLOAD DUP4 PUSH1 0x80 ADD MLOAD PUSH2 0x38AE JUMP JUMPDEST LT ISZERO PUSH2 0x2805 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x57BD JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH2 0x2811 PUSH2 0x43AF JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x2825 DUP10 PUSH1 0xA0 ADD MLOAD DUP9 PUSH2 0x2F7D JUMP JUMPDEST SWAP4 POP PUSH2 0x283A DUP10 PUSH1 0x80 ADD MLOAD DUP11 PUSH1 0xA0 ADD MLOAD DUP7 PUSH2 0x3909 JUMP JUMPDEST SWAP3 POP PUSH2 0x284A DUP9 PUSH1 0xA0 ADD MLOAD DUP8 PUSH2 0x2F7D JUMP JUMPDEST SWAP2 POP PUSH2 0x285F DUP9 PUSH1 0x80 ADD MLOAD DUP10 PUSH1 0xA0 ADD MLOAD DUP5 PUSH2 0x3909 JUMP JUMPDEST SWAP1 POP DUP1 DUP5 LT PUSH2 0x28A2 JUMPI PUSH1 0x20 DUP1 DUP7 ADD DUP1 MLOAD DUP4 SWAP1 MSTORE DUP1 MLOAD DUP3 ADD DUP5 SWAP1 MSTORE MLOAD MLOAD DUP7 MLOAD DUP3 ADD MSTORE PUSH1 0x80 DUP11 ADD MLOAD PUSH1 0xA0 DUP12 ADD MLOAD DUP8 MLOAD SWAP1 SWAP3 ADD MLOAD PUSH2 0x289A SWAP3 SWAP1 PUSH2 0x3909 JUMP JUMPDEST DUP6 MLOAD MSTORE PUSH2 0x28DF JUMP JUMPDEST DUP5 MLOAD DUP4 SWAP1 MSTORE DUP5 MLOAD PUSH1 0x20 SWAP1 DUP2 ADD DUP6 SWAP1 MSTORE DUP6 MLOAD DUP2 ADD MLOAD SWAP1 DUP7 ADD DUP1 MLOAD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0xA0 DUP10 ADD MLOAD PUSH1 0x80 DUP11 ADD MLOAD SWAP2 MLOAD MLOAD PUSH2 0x28D6 SWAP3 SWAP1 PUSH2 0x3986 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP8 ADD MLOAD ADD MSTORE JUMPDEST DUP5 MLOAD MLOAD PUSH1 0x20 DUP1 DUP8 ADD MLOAD ADD MLOAD PUSH2 0x28F4 SWAP2 SWAP1 PUSH2 0x2F7D JUMP JUMPDEST PUSH1 0x40 DUP7 ADD MSTORE DUP5 MLOAD MLOAD PUSH1 0x80 DUP11 ADD MLOAD PUSH1 0xC0 DUP12 ADD MLOAD PUSH2 0x2911 SWAP3 SWAP2 SWAP1 PUSH2 0x3909 JUMP JUMPDEST DUP6 MLOAD PUSH1 0x40 ADD MSTORE DUP5 MLOAD PUSH1 0x20 ADD MLOAD PUSH1 0xA0 DUP11 ADD MLOAD PUSH1 0xE0 DUP12 ADD MLOAD PUSH2 0x2932 SWAP3 SWAP2 SWAP1 PUSH2 0x3909 JUMP JUMPDEST DUP6 MLOAD PUSH1 0x60 ADD MSTORE PUSH1 0x20 DUP6 ADD MLOAD MLOAD PUSH1 0x80 DUP10 ADD MLOAD PUSH1 0xC0 DUP11 ADD MLOAD PUSH2 0x2953 SWAP3 SWAP2 SWAP1 PUSH2 0x3909 JUMP JUMPDEST DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x40 ADD DUP2 DUP2 MSTORE POP POP PUSH2 0x297B DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x20 ADD MLOAD DUP10 PUSH1 0xA0 ADD MLOAD DUP11 PUSH1 0xE0 ADD MLOAD PUSH2 0x3909 JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD PUSH1 0x60 ADD MSTORE POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP3 ISZERO ISZERO PUSH2 0x29C9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56DD JUMP JUMPDEST DUP3 DUP3 GT ISZERO PUSH2 0x2A03 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56CD JUMP JUMPDEST DUP5 PUSH1 0xA0 ADD MLOAD PUSH2 0x2A16 DUP6 PUSH1 0x40 ADD MLOAD DUP5 PUSH2 0x3864 JUMP JUMPDEST GT ISZERO PUSH2 0x2A4E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x55FD JUMP JUMPDEST PUSH2 0x2A5C DUP6 PUSH1 0x80 ADD MLOAD DUP4 PUSH2 0x38AE JUMP JUMPDEST PUSH2 0x2A6A DUP3 DUP8 PUSH1 0xA0 ADD MLOAD PUSH2 0x38AE JUMP JUMPDEST GT ISZERO PUSH2 0x2AA2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x575D JUMP JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH2 0x2AB7 DUP3 DUP3 PUSH1 0x20 ADD MLOAD PUSH2 0x3864 JUMP JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 SWAP3 SWAP1 SWAP3 SSTORE DUP7 DUP2 ADD MLOAD DUP8 MLOAD DUP5 MLOAD SWAP4 DUP6 ADD MLOAD DUP6 DUP5 ADD MLOAD PUSH1 0x60 DUP8 ADD MLOAD PUSH2 0x140 DUP13 ADD MLOAD PUSH2 0x160 DUP14 ADD MLOAD SWAP7 MLOAD DUP12 SWAP9 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP9 AND SWAP9 SWAP8 SWAP1 SWAP7 AND SWAP7 PUSH32 0xBCC4C97732E47D9946F229EDB95F5B6323F601300E4690DE719993F3C371129 SWAP7 PUSH2 0x2B46 SWAP7 DUP16 SWAP7 CALLER SWAP7 SWAP3 SWAP6 SWAP2 SWAP5 SWAP1 SWAP4 SWAP1 PUSH2 0x5433 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x2BFE JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x2BD3 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2BFE JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2BE1 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x2C26 DUP6 PUSH2 0x140 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x20 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x140 DUP5 ADD MLOAD DUP5 MLOAD DUP7 MLOAD DUP5 MLOAD PUSH1 0x20 ADD MLOAD PUSH2 0x2C42 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x2C5B DUP6 PUSH2 0x140 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP6 DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x2C77 DUP2 DUP7 PUSH1 0x0 ADD MLOAD DUP8 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD PUSH1 0x40 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x2C93 DUP2 DUP6 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x40 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST DUP4 PUSH1 0x40 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH1 0x40 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x2CFD JUMPI PUSH2 0x2CF8 DUP2 DUP5 DUP8 PUSH1 0x40 ADD MLOAD PUSH2 0x2CF3 DUP7 PUSH1 0x0 ADD MLOAD PUSH1 0x60 ADD MLOAD DUP8 PUSH1 0x20 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3864 JUMP JUMPDEST PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x2AA2 JUMP JUMPDEST PUSH2 0x2D15 DUP2 DUP5 DUP8 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x2AA2 DUP2 DUP5 DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x60 PUSH1 0x24 DUP4 ADD DUP2 DUP2 MSTORE DUP8 MLOAD PUSH1 0x84 DUP6 ADD SWAP1 DUP2 MSTORE DUP9 DUP5 ADD MLOAD PUSH1 0xA4 DUP7 ADD MSTORE SWAP5 DUP9 ADD MLOAD PUSH1 0xC4 DUP6 ADD MSTORE SWAP1 DUP8 ADD MLOAD PUSH1 0xE4 DUP5 ADD MSTORE PUSH1 0x80 DUP8 ADD MLOAD PUSH2 0x104 DUP5 ADD MSTORE PUSH1 0xA0 DUP8 ADD MLOAD PUSH2 0x124 DUP5 ADD MSTORE PUSH1 0xC0 DUP8 ADD MLOAD PUSH2 0x144 DUP5 ADD MSTORE PUSH1 0xE0 DUP8 ADD MLOAD PUSH2 0x164 DUP5 ADD MSTORE PUSH2 0x100 DUP8 ADD MLOAD PUSH2 0x184 DUP5 ADD MSTORE PUSH2 0x120 DUP8 ADD MLOAD PUSH2 0x1A4 DUP5 ADD MSTORE PUSH2 0x140 DUP8 ADD DUP1 MLOAD PUSH2 0x1C4 DUP6 ADD SWAP1 DUP2 MSTORE PUSH2 0x160 DUP10 ADD MLOAD PUSH2 0x1E4 DUP7 ADD MSTORE PUSH2 0x180 SWAP1 MSTORE MLOAD DUP1 MLOAD PUSH2 0x204 DUP6 ADD DUP2 SWAP1 MSTORE SWAP4 SWAP5 SWAP2 SWAP4 DUP5 SWAP4 PUSH1 0x44 DUP8 ADD SWAP3 DUP5 SWAP3 PUSH2 0x224 DUP10 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x2E34 JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x2E16 JUMP JUMPDEST POP POP POP POP DUP2 DUP2 SUB PUSH2 0x160 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP11 ADD MLOAD DUP1 MLOAD DUP1 DUP4 MSTORE PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x2E7D JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x2E5F JUMP JUMPDEST POP POP POP DUP10 DUP5 MSTORE POP DUP5 DUP2 SUB PUSH1 0x20 SWAP4 DUP5 ADD SWAP1 DUP2 MSTORE DUP9 MLOAD DUP1 DUP4 MSTORE SWAP1 SWAP4 SWAP2 DUP3 ADD SWAP2 DUP10 DUP2 ADD SWAP2 SWAP1 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x2EC5 JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x2EA7 JUMP JUMPDEST POP POP POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP9 DUP4 SUB ADD DUP9 MSTORE POP PUSH1 0x40 MSTORE POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x2F07 PUSH2 0x43DE JUMP JUMPDEST PUSH2 0x2F10 DUP3 PUSH2 0x1F30 JUMP JUMPDEST SWAP1 POP PUSH2 0x2F1C DUP3 DUP3 PUSH2 0x3BED JUMP JUMPDEST PUSH2 0x2805 DUP3 DUP3 PUSH1 0x20 ADD MLOAD PUSH2 0x3D04 JUMP JUMPDEST PUSH2 0x2F32 PUSH2 0x4386 JUMP JUMPDEST PUSH2 0x2F3D DUP5 DUP5 DUP5 PUSH2 0x24DF JUMP JUMPDEST PUSH1 0x20 DUP2 ADD MLOAD SWAP1 SWAP2 POP DUP4 EQ PUSH2 0x260A JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x574D JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0x2FB9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x560D JUMP JUMPDEST POP DUP1 DUP3 SUB JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 MLOAD GT ISZERO ISZERO PUSH2 0x3002 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56FD JUMP JUMPDEST DUP2 MLOAD DUP3 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x3032 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP3 MSTORE POP PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV MUL SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x30CA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x562D JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x0 SWAP1 PUSH1 0x60 SWAP1 PUSH32 0x1626BA7E00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x310E SWAP1 DUP8 SWAP1 DUP7 SWAP1 PUSH1 0x24 ADD PUSH2 0x554E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 MSTORE DUP2 MLOAD SWAP2 SWAP4 POP SWAP1 DUP3 SWAP1 DUP2 DUP9 GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x31AB JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x321C JUMPI PUSH2 0x2572 JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xC57414C4C45545F4552524F5200000000000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST POP POP MLOAD SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x14 DUP3 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x3268 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x578D JUMP JUMPDEST PUSH2 0x3276 DUP3 PUSH1 0x14 DUP5 MLOAD SUB PUSH2 0x3DAB JUMP JUMPDEST DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC ADD SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x0 SWAP1 PUSH1 0x60 SWAP1 PUSH32 0x9363470200000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x32DE SWAP1 DUP8 SWAP1 DUP8 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x5521 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 MSTORE DUP2 MLOAD SWAP2 SWAP4 POP SWAP1 DUP3 SWAP1 DUP2 DUP11 GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x337B JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x33EC JUMPI PUSH2 0x33F1 JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xF56414C494441544F525F4552524F5200000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD SWAP5 POP JUMPDEST POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x3438 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x564D JUMP JUMPDEST PUSH2 0x344B PUSH2 0x3445 DUP6 DUP5 PUSH2 0x38AE JUMP JUMPDEST DUP5 PUSH2 0x3E0C JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x5A65726F45785472616E73616374696F6E280000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0x32 DUP4 ADD MSTORE PUSH32 0x61646472657373207369676E6572416464726573732C00000000000000000000 PUSH1 0x3F DUP4 ADD MSTORE PUSH32 0x6279746573206461746100000000000000000000000000000000000000000000 PUSH1 0x55 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0x5F DUP4 ADD MSTORE DUP3 MLOAD DUP1 DUP4 SUB DUP5 ADD DUP2 MSTORE PUSH1 0x60 SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP1 SWAP3 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x357C JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x353F JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP10 MLOAD SWAP1 SWAP8 POP DUP10 SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x3612 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x35D5 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 SWAP8 DUP3 MSTORE DUP2 ADD SWAP11 SWAP1 SWAP11 MSTORE POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 SWAP1 SWAP8 AND SWAP7 DUP9 ADD SWAP7 SWAP1 SWAP7 MSTORE POP POP PUSH1 0x60 DUP6 ADD MSTORE POP POP PUSH1 0x80 SWAP1 SWAP2 KECCAK256 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH32 0x1901000000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP2 DUP3 ADD MSTORE PUSH1 0x22 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2FBE PUSH2 0x1AFD DUP4 PUSH2 0x3E23 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP4 LT PUSH2 0x36EE JUMPI DUP2 PUSH2 0x260A JUMP JUMPDEST POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x36FD PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0xA0 DUP4 ADD MLOAD PUSH1 0x80 DUP5 ADD MLOAD PUSH2 0x3719 SWAP2 DUP5 SWAP2 PUSH2 0x3909 JUMP JUMPDEST DUP1 DUP3 MSTORE PUSH1 0x80 DUP5 ADD MLOAD PUSH1 0xC0 DUP6 ADD MLOAD PUSH2 0x3731 SWAP3 SWAP2 SWAP1 PUSH2 0x3909 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0xA0 DUP4 ADD MLOAD PUSH1 0xE0 DUP5 ADD MLOAD PUSH2 0x374B SWAP2 DUP5 SWAP2 PUSH2 0x3909 JUMP JUMPDEST PUSH1 0x60 DUP3 ADD MSTORE SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x37FF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x37D4 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x37FF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x37E2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x381F DUP5 PUSH2 0x140 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD DUP6 DUP6 PUSH1 0x0 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x3838 DUP5 PUSH2 0x160 ADD MLOAD DUP5 DUP7 PUSH1 0x0 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x3850 DUP2 DUP6 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x27A3 DUP2 DUP5 DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x60 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x38A3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x567D JUMP JUMPDEST DUP1 SWAP2 POP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 ISZERO ISZERO PUSH2 0x38C1 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x38A7 JUMP JUMPDEST POP DUP3 DUP3 MUL DUP3 DUP5 DUP3 DUP2 ISZERO ISZERO PUSH2 0x38D1 JUMPI INVALID JUMPDEST DIV EQ PUSH2 0x38A3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x567D JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x3944 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x564D JUMP JUMPDEST PUSH2 0x394F DUP5 DUP5 DUP5 PUSH2 0x427C JUMP JUMPDEST ISZERO PUSH2 0x3438 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56AD JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x39C1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x564D JUMP JUMPDEST PUSH2 0x39CC DUP5 DUP5 DUP5 PUSH2 0x4301 JUMP JUMPDEST ISZERO PUSH2 0x3A03 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56AD JUMP JUMPDEST PUSH2 0x344B PUSH2 0x3445 PUSH2 0x3A13 DUP7 DUP6 PUSH2 0x38AE JUMP JUMPDEST PUSH2 0x3A1E DUP7 PUSH1 0x1 PUSH2 0x2F7D JUMP JUMPDEST PUSH2 0x3864 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP4 GT DUP1 ISZERO PUSH2 0x3A62 JUMPI POP DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO JUMPDEST ISZERO PUSH2 0x3BE5 JUMPI DUP6 MLOAD PUSH1 0x3 LT PUSH2 0x3AA2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x573D JUMP JUMPDEST POP POP PUSH1 0x20 DUP5 DUP2 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0xB SWAP1 SWAP3 MSTORE PUSH1 0x40 SWAP1 SWAP2 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO ISZERO PUSH2 0x3B2B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56ED JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH7 0xFFFFFFFFFFFE0 PUSH1 0x3F DUP9 MLOAD ADD AND DUP1 PUSH1 0x84 ADD DUP3 ADD PUSH32 0xA85E59E400000000000000000000000000000000000000000000000000000000 DUP4 MSTORE PUSH1 0x80 PUSH1 0x4 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND PUSH1 0x24 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND PUSH1 0x44 DUP5 ADD MSTORE DUP6 PUSH1 0x64 DUP5 ADD MSTORE PUSH1 0x84 DUP4 ADD JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x3BC7 JUMPI DUP10 MLOAD DUP2 MSTORE PUSH1 0x20 SWAP10 DUP11 ADD SWAP10 ADD PUSH2 0x3BAF JUMP JUMPDEST PUSH2 0x200 DUP5 DUP6 DUP5 SUB DUP7 PUSH1 0x0 DUP10 GAS CALL DUP1 ISZERO ISZERO PUSH2 0x3BDF JUMPI RETURNDATASIZE DUP6 REVERT JUMPDEST POP POP POP POP POP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH1 0xFF AND PUSH1 0x3 EQ PUSH2 0x3C2E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x579D JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x3CA1 JUMPI PUSH1 0x60 DUP4 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x3CA1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x57AD JUMP JUMPDEST PUSH2 0x3CA9 PUSH2 0x25DF JUMP JUMPDEST DUP4 MLOAD SWAP1 SWAP2 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0x3CFF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x566D JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE DUP3 DUP2 ADD MLOAD DUP4 MLOAD PUSH2 0x140 DUP6 ADD MLOAD PUSH2 0x160 DUP7 ADD MLOAD SWAP4 MLOAD DUP6 SWAP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP5 DUP6 AND SWAP5 SWAP4 SWAP1 SWAP4 AND SWAP3 PUSH32 0xDC47B3613D9FE400085F6DBDC99453462279057E6207385042827ED6B1A62CF7 SWAP3 PUSH2 0x3D9F SWAP3 CALLER SWAP3 SWAP1 PUSH2 0x54B7 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x3DED JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x578D JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 DUP5 DUP2 ISZERO ISZERO PUSH2 0x3E1A JUMPI INVALID JUMPDEST DIV SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4F72646572280000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x61646472657373206D616B6572416464726573732C0000000000000000000000 PUSH1 0x26 DUP4 ADD MSTORE PUSH32 0x616464726573732074616B6572416464726573732C0000000000000000000000 PUSH1 0x3B DUP4 ADD MSTORE PUSH32 0x6164647265737320666565526563697069656E74416464726573732C00000000 PUSH1 0x50 DUP4 ADD MSTORE PUSH32 0x616464726573732073656E646572416464726573732C00000000000000000000 PUSH1 0x6C DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724173736574416D6F756E742C00000000000000 PUSH1 0x82 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724173736574416D6F756E742C00000000000000 PUSH1 0x9B DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724665652C000000000000000000000000000000 PUSH1 0xB4 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724665652C000000000000000000000000000000 PUSH1 0xC5 DUP4 ADD MSTORE PUSH32 0x75696E743235362065787069726174696F6E54696D655365636F6E64732C0000 PUSH1 0xD6 DUP4 ADD MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0xF4 DUP4 ADD MSTORE PUSH32 0x6279746573206D616B65724173736574446174612C0000000000000000000000 PUSH2 0x101 DUP4 ADD MSTORE PUSH32 0x62797465732074616B6572417373657444617461000000000000000000000000 PUSH2 0x116 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH2 0x12A DUP4 ADD MSTORE DUP3 MLOAD PUSH2 0x10B DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH2 0x12B SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP2 SWAP3 SWAP2 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x40AB JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x406E JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x140 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP10 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x4146 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x4109 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x160 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP9 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x41E1 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x41A4 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 SWAP1 SWAP4 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP2 AND SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP1 SWAP2 KECCAK256 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP10 ADD DUP1 MLOAD PUSH2 0x140 DUP12 ADD DUP1 MLOAD PUSH2 0x160 SWAP1 SWAP13 ADD DUP1 MLOAD SWAP11 DUP5 MSTORE SWAP9 DUP2 MSTORE SWAP3 DUP9 MSTORE PUSH2 0x1A0 DUP3 KECCAK256 SWAP2 MSTORE SWAP9 SWAP1 MSTORE POP POP POP SWAP2 SWAP1 MSTORE POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x42B8 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x564D JUMP JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x42C3 JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x42D1 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0xA88 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x42DB JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP PUSH2 0x42EA DUP6 DUP5 PUSH2 0x38AE JUMP JUMPDEST PUSH2 0x42F6 PUSH2 0x3E8 DUP4 PUSH2 0x38AE JUMP JUMPDEST LT ISZERO SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x433D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x564D JUMP JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x4348 JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x4356 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0xA88 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x4360 JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP DUP4 PUSH2 0x4370 DUP6 DUP4 PUSH2 0x2F7D JUMP JUMPDEST DUP2 ISZERO ISZERO PUSH2 0x4379 JUMPI INVALID JUMPDEST MOD SWAP1 POP PUSH2 0x42EA DUP6 DUP5 PUSH2 0x38AE JUMP JUMPDEST PUSH1 0x80 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH2 0x120 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH2 0x43C4 PUSH2 0x4386 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x43D1 PUSH2 0x4386 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x60 DUP2 ADD DUP3 MSTORE PUSH1 0x0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP2 SWAP1 MSTORE SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x260A DUP3 CALLDATALOAD PUSH2 0x58B0 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x441B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x442E PUSH2 0x4429 DUP3 PUSH2 0x583F JUMP JUMPDEST PUSH2 0x5818 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x446C JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x4456 DUP9 DUP3 PUSH2 0x45BC JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x4440 JUMP JUMPDEST POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x4487 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x4495 PUSH2 0x4429 DUP3 PUSH2 0x583F JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x446C JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x44BD DUP9 DUP3 PUSH2 0x460B JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x44A7 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x44E4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x44F2 PUSH2 0x4429 DUP3 PUSH2 0x583F JUMP JUMPDEST SWAP2 POP DUP2 DUP2 DUP4 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP2 ADD SWAP1 POP DUP4 DUP6 PUSH1 0x20 DUP5 MUL DUP3 ADD GT ISZERO PUSH2 0x4517 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x446C JUMPI DUP2 PUSH2 0x452D DUP9 DUP3 PUSH2 0x454F JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x451A JUMP JUMPDEST PUSH1 0x0 PUSH2 0x260A DUP3 CALLDATALOAD PUSH2 0x58C9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x260A DUP3 CALLDATALOAD PUSH2 0x58CE JUMP JUMPDEST PUSH1 0x0 PUSH2 0x260A DUP3 CALLDATALOAD PUSH2 0x58D1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x260A DUP3 MLOAD PUSH2 0x58D1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1F DUP4 ADD DUP5 SGT PUSH2 0x4585 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x459D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x1 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x45B5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x45CD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x45DB PUSH2 0x4429 DUP3 PUSH2 0x5860 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x45F7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4602 DUP4 DUP3 DUP5 PUSH2 0x5907 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x461E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4629 PUSH2 0x180 PUSH2 0x5818 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x4637 DUP5 DUP5 PUSH2 0x43FE JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x4648 DUP5 DUP5 DUP4 ADD PUSH2 0x43FE JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x465C DUP5 DUP3 DUP6 ADD PUSH2 0x43FE JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x4670 DUP5 DUP3 DUP6 ADD PUSH2 0x43FE JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x4684 DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x4698 DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x46AC DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x46C0 DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x46D5 DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x46EB DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x470D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4719 DUP5 DUP3 DUP6 ADD PUSH2 0x45BC JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x473B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4747 DUP5 DUP3 DUP6 ADD PUSH2 0x45BC JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4766 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x344B DUP5 DUP5 PUSH2 0x43FE JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4785 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4791 DUP6 DUP6 PUSH2 0x43FE JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x47A2 DUP6 DUP3 DUP7 ADD PUSH2 0x43FE JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x47BF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x47CB DUP6 DUP6 PUSH2 0x43FE JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x47A2 DUP6 DUP3 DUP7 ADD PUSH2 0x4543 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x47EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4805 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x344B DUP5 DUP3 DUP6 ADD PUSH2 0x4476 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4826 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x483D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4849 DUP7 DUP3 DUP8 ADD PUSH2 0x4476 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4866 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4872 DUP7 DUP3 DUP8 ADD PUSH2 0x44D3 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x488F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x489B DUP7 DUP3 DUP8 ADD PUSH2 0x440A JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x48BA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x48D1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x48DD DUP7 DUP3 DUP8 ADD PUSH2 0x4476 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x4872 DUP7 DUP3 DUP8 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4900 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x344B DUP5 DUP5 PUSH2 0x454F JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x491F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4791 DUP6 DUP6 PUSH2 0x454F JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x60 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x4941 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x494D DUP8 DUP8 PUSH2 0x454F JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x495E DUP8 DUP3 DUP9 ADD PUSH2 0x43FE JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x497B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4987 DUP8 DUP3 DUP9 ADD PUSH2 0x4573 JUMP JUMPDEST SWAP6 SWAP9 SWAP5 SWAP8 POP SWAP6 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x49A8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x49B4 DUP7 DUP7 PUSH2 0x454F JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x49C5 DUP7 DUP3 DUP8 ADD PUSH2 0x43FE JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x49E2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x489B DUP7 DUP3 DUP8 ADD PUSH2 0x45BC JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4A00 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x344B DUP5 DUP5 PUSH2 0x455B JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4A1E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x344B DUP5 DUP5 PUSH2 0x4567 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4A3C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4A53 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x344B DUP5 DUP3 DUP6 ADD PUSH2 0x460B JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x4A75 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4A8C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4A98 DUP8 DUP3 DUP9 ADD PUSH2 0x460B JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4AB5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4AC1 DUP8 DUP3 DUP9 ADD PUSH2 0x460B JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4ADE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4AEA DUP8 DUP3 DUP9 ADD PUSH2 0x45BC JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B07 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B13 DUP8 DUP3 DUP9 ADD PUSH2 0x45BC JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4B34 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B57 DUP7 DUP3 DUP8 ADD PUSH2 0x460B JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x49C5 DUP7 DUP3 DUP8 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP8 DUP10 SUB SLT ISZERO PUSH2 0x4B81 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4B8D DUP10 DUP10 PUSH2 0x454F JUMP JUMPDEST SWAP7 POP POP PUSH1 0x20 PUSH2 0x4B9E DUP10 DUP3 DUP11 ADD PUSH2 0x43FE JUMP JUMPDEST SWAP6 POP POP PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4BBB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4BC7 DUP10 DUP3 DUP11 ADD PUSH2 0x4573 JUMP JUMPDEST SWAP5 POP SWAP5 POP POP PUSH1 0x60 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4BE6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4BF2 DUP10 DUP3 DUP11 ADD PUSH2 0x4573 JUMP JUMPDEST SWAP3 POP SWAP3 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 POP SWAP3 SWAP6 JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58B0 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x4C1B DUP3 PUSH2 0x58AC JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x4C2D DUP4 PUSH2 0x58A6 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x4C5D JUMPI PUSH2 0x4C43 DUP7 DUP4 MLOAD PUSH2 0x53E5 JUMP JUMPDEST PUSH2 0x4C4C DUP3 PUSH2 0x58A6 JUMP JUMPDEST PUSH1 0x60 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x4C30 JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58C9 JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58CE JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58D1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x4C8D DUP3 PUSH2 0x58AC JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x4CA1 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x5913 JUMP JUMPDEST PUSH2 0x4CAA DUP2 PUSH2 0x593F JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58FC JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x4C454E4754485F36355F52455155495245440000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x494E56414C49445F54414B455200000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x4F524445525F4F56455246494C4C000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x41535345545F50524F58595F414C52454144595F455849535453000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x15 DUP2 MSTORE PUSH32 0x5349474E41545552455F554E535550504F525445440000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4449564953494F4E5F42595F5A45524F00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x494E56414C49445F4F524445525F5349474E4154555245000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x494E56414C49445F4D414B455200000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xF DUP2 MSTORE PUSH32 0x494E56414C49445F54585F484153480000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x494E56414C49445F5349474E4154555245000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x524F554E44494E475F4552524F52000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4641494C45445F455845435554494F4E00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x54414B45525F4F56455250415900000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x494E56414C49445F54414B45525F414D4F554E54000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x41535345545F50524F58595F444F45535F4E4F545F4558495354000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x21 DUP2 MSTORE PUSH32 0x475245415445525F5448414E5F5A45524F5F4C454E4754485F52455155495245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x4400000000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x5349474E41545552455F494C4C4547414C000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1E DUP2 MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F305F52455155495245440000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x494E56414C49445F4E45575F4F524445525F45504F4348000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1E DUP2 MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F335F52455155495245440000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x434F4D504C4554455F46494C4C5F4641494C4544000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x494E56414C49445F46494C4C5F50524943450000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x5245454E5452414E43595F494C4C4547414C0000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x13 DUP2 MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4F524445525F554E46494C4C41424C4500000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x494E56414C49445F53454E444552000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x18 DUP2 MSTORE PUSH32 0x4E454741544956455F5350524541445F52455155495245440000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x494E56414C49445F54585F5349474E4154555245000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x4C454E4754485F305F5245515549524544000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x80 DUP4 ADD SWAP1 PUSH2 0x5373 DUP5 DUP3 PUSH2 0x4C70 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x5386 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x5399 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x27A3 PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST DUP1 MLOAD PUSH2 0x120 DUP4 ADD SWAP1 PUSH2 0x53BE DUP5 DUP3 PUSH2 0x5362 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x53D1 PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0x5362 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x27A3 PUSH2 0x100 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x60 DUP4 ADD SWAP1 PUSH2 0x53F6 DUP5 DUP3 PUSH2 0x541C JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x5409 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x27A3 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58F6 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x4C01 JUMP JUMPDEST PUSH2 0x100 DUP2 ADD PUSH2 0x5442 DUP3 DUP12 PUSH2 0x4C01 JUMP JUMPDEST PUSH2 0x544F PUSH1 0x20 DUP4 ADD DUP11 PUSH2 0x4C01 JUMP JUMPDEST PUSH2 0x545C PUSH1 0x40 DUP4 ADD DUP10 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x5469 PUSH1 0x60 DUP4 ADD DUP9 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x5476 PUSH1 0x80 DUP4 ADD DUP8 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x5483 PUSH1 0xA0 DUP4 ADD DUP7 PUSH2 0x4C70 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0xC0 DUP4 ADD MSTORE PUSH2 0x5495 DUP2 DUP6 PUSH2 0x4C82 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0xE0 DUP4 ADD MSTORE PUSH2 0x54A9 DUP2 DUP5 PUSH2 0x4C82 JUMP JUMPDEST SWAP11 SWAP10 POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x54C5 DUP3 DUP7 PUSH2 0x4C01 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x54D7 DUP2 DUP6 PUSH2 0x4C82 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x54EB DUP2 DUP5 PUSH2 0x4C82 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x260A DUP2 DUP5 PUSH2 0x4C10 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x4C67 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x4C70 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x552F DUP3 DUP7 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x553C PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x4C01 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x54EB DUP2 DUP5 PUSH2 0x4C82 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x555C DUP3 DUP6 PUSH2 0x4C70 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x344B DUP2 DUP5 PUSH2 0x4C82 JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x557C DUP3 DUP8 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x5589 PUSH1 0x20 DUP4 ADD DUP7 PUSH2 0x541C JUMP JUMPDEST PUSH2 0x5596 PUSH1 0x40 DUP4 ADD DUP6 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x54EB PUSH1 0x60 DUP4 ADD DUP5 PUSH2 0x4C70 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x55B1 DUP3 DUP6 PUSH2 0x4C79 JUMP JUMPDEST PUSH2 0x260A PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x4C01 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x260A DUP2 DUP5 PUSH2 0x4C82 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x4CB7 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4CC0 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4CF0 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4D20 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4D50 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4D80 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4DB0 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4E06 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4E36 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4E66 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4E96 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4EC6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4EF6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4F26 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4F56 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4F86 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4FB6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4FE6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x5016 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x5046 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x509C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x50CC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x50FC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x512C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x515C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x518C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x51BC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x51EC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x521C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x5272 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x52A2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x52D2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x5302 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x5332 JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x5362 JUMP JUMPDEST PUSH2 0x120 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x53AC JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x53E5 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x5837 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x5856 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 SWAP1 DUP2 MUL ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x5877 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2FBE DUP3 PUSH2 0x58B0 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x592E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x5916 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x27A3 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 REVERT 0xae DUP15 DUP15 PUSH1 0xF0 0x4e DUP9 0xe 0xcb 0xbd CALLDATACOPY 0xd8 CALLER 0xd3 TIMESTAMP MOD 0x1e DUP12 0x2c 0xb2 0x3f 0xd5 INVALID PUSH32 0xF93742CBE9FE9F6C6578706572696D656E74616CF50037000000000000000000 ",
+ "sourceMap": "931:615:26:-;;;689:5:83;667:27;;-1:-1:-1;;667:27:83;;;1228:316:26;5:2:-1;;;;30:1;27;20:12;5:2;1228:316:26;;;;;;;;;;;;;;;;;;;;;;;;1919:29:43;;1305:13:26;;1919:29:43;;:14;;:29;;;;;:::i;:::-;-1:-1:-1;;1045:148:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;1045:148:44;;;;;;;;1035:159;;1045:148;;;;;1035:159;;;;1045:148;1035:159;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1035:159:44;;;;;;;;;;;;1511:18;;;;;;;;;;;;;;;;1495:36;;1035:159;;-1:-1:-1;1035:159:44;;-1:-1:-1;1495:36:44;;;;-1:-1:-1;1511:18:44;1495:36;1511:18;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1495:36:44;;;;;;;;;;;;1561:21;;;;;274:1:-1;1561:21:44;;;;;;;;;;1545:39;;1495:36;;-1:-1:-1;1495:36:44;;-1:-1:-1;1545:39:44;;;;-1:-1:-1;274:1;1545:39:44;1561:21;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1545:39:44;;;;;;;;;;;;1416:214;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1614:4:44;1416:214;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;1416:214:44;;;;;;;;1406:225;;1416:214;;;;-1:-1:-1;1406:225:44;;;-1:-1:-1;1406:225:44;1416:214;1406:225;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;-1:-1;;263:2;259:12;;;;254:3;250:22;246:30;;;;340:21;;;311:9;;295:26;377:20;;;;365:33;;1406:225:44;;;;;;;;;;1385:18;:246;-1:-1:-1;;162:5:82;:18;;-1:-1:-1;;;;;;162:18:82;170:10;162:18;;;-1:-1:-1;931:615:26;;-1:-1:-1;931:615:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;931:615:26;;;-1:-1:-1;931:615:26;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;6:442:-1:-;;111:4;99:17;;95:27;-1:-1;85:2;;136:1;133;126:12;85:2;166:6;160:13;188:64;203:48;244:6;203:48;;;188:64;;;179:73;;272:6;265:5;258:21;308:4;300:6;296:17;341:4;334:5;330:16;376:3;367:6;362:3;358:16;355:25;352:2;;;393:1;390;383:12;352:2;403:39;435:6;430:3;425;403:39;;;78:370;;;;;;;;456:360;;580:2;568:9;559:7;555:23;551:32;548:2;;;596:1;593;586:12;548:2;631:24;;-1:-1;;;;;664:30;;661:2;;;707:1;704;697:12;661:2;727:73;792:7;783:6;772:9;768:22;727:73;;;717:83;542:274;-1:-1;;;;542:274;823:256;885:2;879:9;911:17;;;-1:-1;;;;;971:34;;1007:22;;;968:62;965:2;;;1043:1;1040;1033:12;965:2;1059;1052:22;863:216;;-1:-1;863:216;1086:258;;-1:-1;;;;;1221:6;1218:30;1215:2;;;1261:1;1258;1251:12;1215:2;-1:-1;1334:4;1305;1282:17;;;;-1:-1;;1278:33;1324:15;;1152:192;1352:268;1417:1;1424:101;1438:6;1435:1;1432:13;1424:101;;;1505:11;;;1499:18;1486:11;;;1479:39;1460:2;1453:10;1424:101;;;1540:6;1537:1;1534:13;1531:2;;;1605:1;1596:6;1591:3;1587:16;1580:27;1531:2;1401:219;;;;;;931:615:26;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106101b65763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663288cdc9181146101bb578063297bb70b146101f15780632ac126221461021e5780633683ef8e1461024b5780633c28d8611461026d5780633e228bae1461029a5780633fd3c997146102ba5780634ac14782146102e75780634d0ae546146103075780634f9559b11461032757806350dde190146103475780636070410814610367578063642f2eaf1461039457806364a3bc15146103b457806377fcce68146103d45780637b8e3514146103f45780637e1d9808146104145780637e9d74dc1461043457806382c174d0146104615780638da5cb5b146104815780639363470214610496578063a3e20380146104b6578063b4be83d5146104d6578063bfc8bfce146104f6578063c585bb9314610516578063c75e0a8114610536578063d46b02c314610563578063d9bfa73e14610583578063db123b1a146105a3578063dd1c7d18146105c5578063e306f779146105e5578063e5fa431b146105fa578063eea086ba1461061a578063f2fde38b1461062f578063ffa1ad741461064f575b600080fd5b3480156101c757600080fd5b506101db6101d63660046148ee565b610664565b6040516101e89190615513565b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004614811565b610676565b6040516101e891906157ed565b34801561022a57600080fd5b5061023e6102393660046148ee565b6107a1565b6040516101e89190615505565b34801561025757600080fd5b5061026b61026636600461492b565b6107b6565b005b34801561027957600080fd5b5061028d610288366004614a5f565b6108a3565b6040516101e891906157fb565b3480156102a657600080fd5b506102116102b5366004614b1f565b610a3a565b3480156102c657600080fd5b506102da6102d53660046149ee565b610a90565b6040516101e891906155cf565b3480156102f357600080fd5b5061026b6103023660046147dc565b610ab8565b34801561031357600080fd5b50610211610322366004614811565b610b85565b34801561033357600080fd5b5061026b6103423660046148ee565b610c75565b34801561035357600080fd5b50610211610362366004614811565b610e2a565b34801561037357600080fd5b506103876103823660046149ee565b610ebe565b6040516101e89190615425565b3480156103a057600080fd5b5061023e6103af3660046148ee565b610f0c565b3480156103c057600080fd5b506102116103cf366004614b1f565b610f21565b3480156103e057600080fd5b5061026b6103ef3660046147ac565b610fcc565b34801561040057600080fd5b5061023e61040f366004614772565b611106565b34801561042057600080fd5b5061021161042f3660046148a5565b611126565b34801561044057600080fd5b5061045461044f3660046147dc565b61128a565b6040516101e891906154f4565b34801561046d57600080fd5b5061023e61047c36600461490c565b61131f565b34801561048d57600080fd5b5061038761133f565b3480156104a257600080fd5b5061023e6104b1366004614993565b61135b565b3480156104c257600080fd5b506102116104d13660046148a5565b6118de565b3480156104e257600080fd5b506102116104f1366004614b1f565b6119f1565b34801561050257600080fd5b5061026b610511366004614b68565b611a6c565b34801561052257600080fd5b5061026b610531366004614754565b611d05565b34801561054257600080fd5b50610556610551366004614a2a565b611f30565b6040516101e8919061580a565b34801561056f57600080fd5b5061026b61057e366004614a2a565b61202a565b34801561058f57600080fd5b506101db61059e366004614772565b6120c6565b3480156105af57600080fd5b506105b86120e3565b6040516101e891906155be565b3480156105d157600080fd5b506102116105e03660046148a5565b61218e565b3480156105f157600080fd5b506101db612263565b34801561060657600080fd5b506102116106153660046148a5565b612269565b34801561062657600080fd5b506103876123db565b34801561063b57600080fd5b5061026b61064a366004614754565b6123f7565b34801561065b57600080fd5b506105b86124a8565b60046020526000908152604090205481565b61067e614386565b600080610689614386565b60005460ff16156106cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461076f57610758878381518110151561071957fe5b90602001906020020151878481518110151561073157fe5b90602001906020020151878581518110151561074957fe5b906020019060200201516124df565b9050610764848261257d565b600190910190610701565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509392505050565b60056020526000908152604090205460ff1681565b73ffffffffffffffffffffffffffffffffffffffff831633146108465761080e848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375061135b945050505050565b1515610846576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061569d565b5050600091825260076020908152604080842073ffffffffffffffffffffffffffffffffffffffff9093168452919052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b6108ab6143af565b6108b36143de565b6108bb6143de565b6000805460ff16156108f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561016080890151610140808a01919091528901519088015261094588611f30565b925061095087611f30565b915061095a6125df565b905061096888848389612611565b61097487838388612611565b61097e88886127a9565b610992888885604001518560400151612809565b8051602081015190519195506109ad918a9186918190612990565b6020808501519081015190516109c99189918591908190612990565b6109e28882856020015186604001518860000151612aa9565b6109fb8782846020015185604001518860200151612aa9565b610a0788888387612b55565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550949350505050565b610a42614386565b6060610a4f858585612d2d565b9050608081825160208401305af48015610a8657815183526020820151602084015260408201516040840152606082015160608401525b505b509392505050565b600b6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60008054819060ff1615610af8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558151905b808214610b5857610b508382815181101515610b4157fe5b90602001906020020151612eff565b600101610b29565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b610b8d614386565b600080610b98614386565b60005460ff1615610bd5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461076f57610c5e8783815181101515610c1f57fe5b906020019060200201518784815181101515610c3757fe5b906020019060200201518785815181101515610c4f57fe5b90602001906020020151612f2a565b9050610c6a848261257d565b600190910190610c07565b6000805481908190819060ff1615610cb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610cec6125df565b935073ffffffffffffffffffffffffffffffffffffffff84163314610d115733610d14565b60005b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600660209081526040808320938516835292905220549093506001860192509050808211610d8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061572d565b73ffffffffffffffffffffffffffffffffffffffff80851660008181526006602090815260408083209488168084529490915290819020859055517f82af639571738f4ebd4268fb0363d8957ebe1bbb9e78dba5ebd69eed39b154f090610df3908690615513565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055505050565b610e32614386565b600080610e3d614386565b86519250600091505b818314610eb457610e9d8783815181101515610e5e57fe5b906020019060200201518784815181101515610e7657fe5b906020019060200201518785815181101515610e8e57fe5b90602001906020020151610a3a565b9050610ea9848261257d565b600190910190610e46565b5050509392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600b602052604090205473ffffffffffffffffffffffffffffffffffffffff165b919050565b60096020526000908152604090205460ff1681565b610f29614386565b60005460ff1615610f66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610f9c848484612f2a565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055949350505050565b6000805460ff161561100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561103d6125df565b73ffffffffffffffffffffffffffffffffffffffff8181166000818152600860209081526040808320948916808452949091529081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168715151790555192935090917fa8656e308026eeabce8f0bc18048433252318ab80ac79da0b3d3d8697dfba891906110d1908690615505565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b600860209081526000928352604080842090915290825290205460ff1681565b61112e614386565b6060600080600061113d614386565b60005460ff161561117a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117815589518a919081106111b257fe5b906020019060200201516101600151945088519350600092505b828414611255578489848151811015156111e257fe5b906020019060200201516101600181905250611202888760200151612f7d565b915061122e898481518110151561121557fe5b9060200190602002015183898681518110151561074957fe5b905061123a868261257d565b6020860151881161124a57611255565b6001909201916111cc565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509195945050505050565b606060006060600084519250826040519080825280602002602001820160405280156112d057816020015b6112bd6143de565b8152602001906001900390816112b55790505b509150600090505b808314610a88576112ff85828151811015156112f057fe5b90602001906020020151611f30565b828281518110151561130d57fe5b602090810290910101526001016112d8565b600760209081526000928352604080842090915290825290205460ff1681565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b600080600080600080600080600089511115156113a4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061571d565b6113ad89612fc4565b7f010000000000000000000000000000000000000000000000000000000000000090049650600760ff88161061140f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061563d565b8660ff16600781111561141e57fe5b9550600086600781111561142e57fe5b1415611466576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061570d565b600186600781111561147457fe5b14156114bc578851156114b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157dd565b600097506118d0565b60028660078111156114ca57fe5b141561160557885160411461150b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155dd565b88600081518110151561151a57fe5b01602001517f010000000000000000000000000000000000000000000000000000000000000090819004810204945061155a89600163ffffffff61308816565b935061156d89602163ffffffff61308816565b925060018b86868660405160008152602001604052604051611592949392919061556e565b60206040516020810390808403906000865af11580156115b6573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff8c811690821614995092506118d09050565b600386600781111561161357fe5b14156117b9578851604114611654576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155dd565b88600081518110151561166357fe5b01602001517f01000000000000000000000000000000000000000000000000000000000000009081900481020494506116a389600163ffffffff61308816565b93506116b689602163ffffffff61308816565b925060018b60405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b6020831061175757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161171a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822060008352910192839052611592945092508991899150889061556e565b60048660078111156117c757fe5b14156117df576117d88b8b8b6130d3565b97506118d0565b60058660078111156117ed57fe5b1415611850576117fc89613228565b73ffffffffffffffffffffffffffffffffffffffff808c1660009081526008602090815260408083209385168352929052205490915060ff16151561184457600097506118d0565b6117d8818c8c8c6132a1565b600686600781111561185e57fe5b141561189e5760008b815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290205460ff1697506118d0565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061563d565b505050505050509392505050565b6118e6614386565b60606000806000806118f6614386565b89600081518110151561190557fe5b906020019060200201516101400151955089519450600093505b8385146119e457858a8581518110151561193557fe5b6020908102909101015161014001528651611951908a90612f7d565b92506119948a8581518110151561196457fe5b9060200190602002015160a001518b8681518110151561198057fe5b9060200190602002015160800151856133fd565b91506119c08a858151811015156119a757fe5b90602001906020020151838a87815181101515610e8e57fe5b90506119cc878261257d565b865189116119d9576119e4565b60019093019261191f565b5050505050509392505050565b6119f9614386565b60005460ff1615611a36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610f9c8484846124df565b600a5460009073ffffffffffffffffffffffffffffffffffffffff1615611abf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b611b02611afd888888888080601f01602080910402602001604051908101604052809392919081815260200183838082843750613453945050505050565b613694565b60008181526009602052604090205490915060ff1615611b4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061568d565b73ffffffffffffffffffffffffffffffffffffffff86163314611c1f57611ba6818785858080601f0160208091040260200160405190810160405280939291908181526020018383808284375061135b945050505050565b1515611bde576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157cd565b600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555b6000818152600960205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555130908690869080838380828437820191505092505050600060405180830381855af49150501515611cb6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156bd565b73ffffffffffffffffffffffffffffffffffffffff86163314611cfc57600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b50505050505050565b6003546000908190819073ffffffffffffffffffffffffffffffffffffffff163314611d5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061577d565b8392508273ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611dc457600080fd5b505af1158015611dd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611dfc9190810190614a0c565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600b602052604090205490925073ffffffffffffffffffffffffffffffffffffffff1690508015611e81576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061561d565b7fffffffff0000000000000000000000000000000000000000000000000000000082166000908152600b60205260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c0319490611f2290849087906155a3565b60405180910390a150505050565b611f386143de565b611f41826136d1565b6020808301829052600091825260049052604090819020549082015260808201511515611f755760015b60ff168152610f07565b60a08201511515611f87576002611f6b565b60a0820151604082015110611f9d576005611f6b565b6101008201514210611fb0576004611f6b565b60208082015160009081526005909152604090205460ff1615611fd4576006611f6b565b610120820151825173ffffffffffffffffffffffffffffffffffffffff90811660009081526006602090815260408083206060880151909416835292905220541115612021576006611f6b565b60038152919050565b60005460ff1615612067576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561209b81612eff565b50600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600660209081526000928352604080842090915290825290205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156121865780601f1061215b57610100808354040283529160200191612186565b820191906000526020600020905b81548152906001019060200180831161216957829003601f168201915b505050505081565b612196614386565b606060008060006121a5614386565b8860008151811015156121b457fe5b906020019060200201516101600151945088519350600092505b828414612257578489848151811015156121e457fe5b906020019060200201516101600181905250612204888760200151612f7d565b9150612230898481518110151561221757fe5b90602001906020020151838986815181101515610e8e57fe5b905061223c868261257d565b6020860151881161224c57612257565b6001909201916121ce565b50505050509392505050565b60025481565b612271614386565b6060600080600080612281614386565b60005460ff16156122be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061576d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558a518b919081106122f657fe5b906020019060200201516101400151955089519450600093505b8385146123a557858a8581518110151561232657fe5b6020908102909101015161014001528651612342908a90612f7d565b92506123558a8581518110151561196457fe5b91506123818a8581518110151561236857fe5b90602001906020020151838a8781518110151561074957fe5b905061238d878261257d565b8651891161239a576123a5565b600190930192612310565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550929695505050505050565b600a5473ffffffffffffffffffffffffffffffffffffffff1681565b60035473ffffffffffffffffffffffffffffffffffffffff163314612448576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061577d565b73ffffffffffffffffffffffffffffffffffffffff8116156124a557600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60408051808201909152600b81527f322e302e312d616c706861000000000000000000000000000000000000000000602082015281565b6124e7614386565b6124ef6143de565b60008060006124fd88611f30565b93506125076125df565b925061251588858589612611565b6125278860a001518560400151612f7d565b915061253387836136df565b9050612546888589848960000151612990565b61255088826136f5565b945061256788848660200151876040015189612aa9565b612572888487613756565b505050509392505050565b8151815161258b9190613864565b8252602080830151908201516125a19190613864565b6020830152604080830151908201516125ba9190613864565b6040830152606080830151908201516125d39190613864565b60609092019190915250565b600a5460009073ffffffffffffffffffffffffffffffffffffffff16818115612608578161260a565b335b9392505050565b825160ff1660031461264f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061579d565b606084015173ffffffffffffffffffffffffffffffffffffffff16156126c257606084015173ffffffffffffffffffffffffffffffffffffffff1633146126c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157ad565b602084015173ffffffffffffffffffffffffffffffffffffffff161561274d578173ffffffffffffffffffffffffffffffffffffffff16846020015173ffffffffffffffffffffffffffffffffffffffff1614151561274d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155ed565b604083015115156127a35761276b836020015185600001518361135b565b15156127a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061565d565b50505050565b6127bb8260a001518260a001516138ae565b6127cd836080015183608001516138ae565b1015612805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157bd565b5050565b6128116143af565b6000806000806128258960a0015188612f7d565b935061283a89608001518a60a0015186613909565b925061284a8860a0015187612f7d565b915061285f88608001518960a0015184613909565b90508084106128a25760208086018051839052805182018490525151865182015260808a015160a08b015187519092015161289a9290613909565b8551526128df565b845183905284516020908101859052855181015190860180519190915260a089015160808a01519151516128d69290613986565b60208087015101525b84515160208087015101516128f49190612f7d565b604086015284515160808a015160c08b0151612911929190613909565b85516040015284516020015160a08a015160e08b0151612932929190613909565b855160600152602085015151608089015160c08a0151612953929190613909565b8560200151604001818152505061297b8560200151602001518960a001518a60e00151613909565b60208601516060015250505050949350505050565b8215156129c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156dd565b82821115612a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156cd565b8460a00151612a16856040015184613864565b1115612a4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906155fd565b612a5c8560800151836138ae565b612a6a828760a001516138ae565b1115612aa2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061575d565b5050505050565b612ab7828260200151613864565b600084815260046020908152604091829020929092558681015187518451938501518584015160608701516101408c01516101608d015196518b9873ffffffffffffffffffffffffffffffffffffffff9788169897909616967f0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c37112996612b46968f96339692959194909390615433565b60405180910390a45050505050565b60018054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008789161502019095169490940493840181900481028201810190925282815260609390929091830182828015612bfe5780601f10612bd357610100808354040283529160200191612bfe565b820191906000526020600020905b815481529060010190602001808311612be157829003601f168201915b50505050509050612c2685610140015186600001518660000151856020015160200151613a23565b61014084015184518651845160200151612c4293929190613a23565b612c5b8561014001518660000151858560400151613a23565b612c778186600001518760400151856000015160400151613a23565b612c938185600001518660400151856020015160400151613a23565b836040015173ffffffffffffffffffffffffffffffffffffffff16856040015173ffffffffffffffffffffffffffffffffffffffff161415612cfd57612cf881848760400151612cf3866000015160600151876020015160600151613864565b613a23565b612aa2565b612d1581848760400151856000015160600151613a23565b612aa281848660400151856020015160600151613a23565b604080517fb4be83d5000000000000000000000000000000000000000000000000000000006020808301919091526060602483018181528751608485019081528884015160a48601529488015160c48501529087015160e4840152608087015161010484015260a087015161012484015260c087015161014484015260e08701516101648401526101008701516101848401526101208701516101a4840152610140870180516101c485019081526101608901516101e4860152610180905251805161020485018190529394919384936044870192849261022489019291820191601f82010460005b81811015612e34578351855260209485019490930192600101612e16565b50505050818103610160808401919091528a0151805180835260209283019291820191601f82010460005b81811015612e7d578351855260209485019490930192600101612e5f565b50505089845250848103602093840190815288518083529093918201918981019190601f82010460005b81811015612ec5578351855260209485019490930192600101612ea7565b5050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08883030188525060405250505050509392505050565b612f076143de565b612f1082611f30565b9050612f1c8282613bed565b612805828260200151613d04565b612f32614386565b612f3d8484846124df565b6020810151909150831461260a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061574d565b600082821115612fb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061560d565b508082035b92915050565b6000808251111515613002576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156fd565b815182907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061303257fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909252507f0100000000000000000000000000000000000000000000000000000000000000908190040290565b6000816020018351101515156130ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061562d565b50016020015190565b6040516000906060907f1626ba7e000000000000000000000000000000000000000000000000000000009061310e908790869060240161554e565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093178352815191935090829081885afa8080156131ab576001811461321c57612572565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0c57414c4c45545f4552524f5200000000000000000000000000000000604052600060605260646000fd5b50505195945050505050565b60006014825110151515613268576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061578d565b613276826014845103613dab565b82517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec019092525090565b6040516000906060907f9363470200000000000000000000000000000000000000000000000000000000906132de90879087908790602401615521565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931783528151919350908290818a5afa80801561337b57600181146133ec576133f1565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f56414c494441544f525f4552524f5200000000000000000000000000604052600060605260646000fd5b825194505b50505050949350505050565b6000808311613438576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b61344b61344585846138ae565b84613e0c565b949350505050565b604080517f5a65726f45785472616e73616374696f6e2800000000000000000000000000006020808301919091527f75696e743235362073616c742c0000000000000000000000000000000000000060328301527f61646472657373207369676e6572416464726573732c00000000000000000000603f8301527f627974657320646174610000000000000000000000000000000000000000000060558301527f2900000000000000000000000000000000000000000000000000000000000000605f830152825180830384018152606090920192839052815160009384938493909282918401908083835b6020831061357c57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161353f565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260405191909301819003812089519097508995509093508392850191508083835b6020831061361257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016135d5565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822097825281019a909a525073ffffffffffffffffffffffffffffffffffffffff97909716968801969096525050606085015250506080909120919050565b600280546040517f190100000000000000000000000000000000000000000000000000000000000081529182015260228101919091526042902090565b6000612fbe611afd83613e23565b60008183106136ee578161260a565b5090919050565b6136fd614386565b6020810182905260a08301516080840151613719918491613909565b808252608084015160c0850151613731929190613909565b604082015260a083015160e084015161374b918491613909565b606082015292915050565b60018054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156137ff5780601f106137d4576101008083540402835291602001916137ff565b820191906000526020600020905b8154815290600101906020018083116137e257829003601f168201915b5050505050905061381f8461014001518560000151858560000151613a23565b6138388461016001518486600001518560200151613a23565b61385081856000015186604001518560400151613a23565b6127a3818486604001518560600151613a23565b6000828201838110156138a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567d565b8091505b5092915050565b6000808315156138c157600091506138a7565b508282028284828115156138d157fe5b04146138a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061567d565b6000808311613944576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b61394f84848461427c565b15613438576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156ad565b60008083116139c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b6139cc848484614301565b15613a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156ad565b61344b613445613a1386856138ae565b613a1e866001612f7d565b613864565b600080600083118015613a6257508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15613be5578551600310613aa2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061573d565b50506020848101517fffffffff00000000000000000000000000000000000000000000000000000000166000818152600b90925260409091205473ffffffffffffffffffffffffffffffffffffffff16801515613b2b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906156ed565b604051660fffffffffffe0603f885101168060840182017fa85e59e40000000000000000000000000000000000000000000000000000000083526080600484015273ffffffffffffffffffffffffffffffffffffffff8816602484015273ffffffffffffffffffffffffffffffffffffffff87166044840152856064840152608483015b81811015613bc757895181526020998a019901613baf565b61020084858403866000895af1801515613bdf573d85fd5b50505050505b505050505050565b805160009060ff16600314613c2e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061579d565b606083015173ffffffffffffffffffffffffffffffffffffffff1615613ca157606083015173ffffffffffffffffffffffffffffffffffffffff163314613ca1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c6906157ad565b613ca96125df565b835190915073ffffffffffffffffffffffffffffffffffffffff808316911614613cff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061566d565b505050565b6000818152600560205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558281015183516101408501516101608601519351859473ffffffffffffffffffffffffffffffffffffffff9485169493909316927fdc47b3613d9fe400085f6dbdc99453462279057e6207385042827ed6b1a62cf792613d9f923392906154b7565b60405180910390a45050565b600081601401835110151515613ded576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061578d565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000808284811515613e1a57fe5b04949350505050565b604080517f4f726465722800000000000000000000000000000000000000000000000000006020808301919091527f61646472657373206d616b6572416464726573732c000000000000000000000060268301527f616464726573732074616b6572416464726573732c0000000000000000000000603b8301527f6164647265737320666565526563697069656e74416464726573732c0000000060508301527f616464726573732073656e646572416464726573732c00000000000000000000606c8301527f75696e74323536206d616b65724173736574416d6f756e742c0000000000000060828301527f75696e743235362074616b65724173736574416d6f756e742c00000000000000609b8301527f75696e74323536206d616b65724665652c00000000000000000000000000000060b48301527f75696e743235362074616b65724665652c00000000000000000000000000000060c58301527f75696e743235362065787069726174696f6e54696d655365636f6e64732c000060d68301527f75696e743235362073616c742c0000000000000000000000000000000000000060f48301527f6279746573206d616b65724173736574446174612c00000000000000000000006101018301527f62797465732074616b65724173736574446174610000000000000000000000006101168301527f290000000000000000000000000000000000000000000000000000000000000061012a830152825161010b81840301815261012b90920192839052815160009384938493849391929182918401908083835b602083106140ab57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161406e565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101408b0151805191995095509093508392850191508083835b6020831061414657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101614109565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101608b0151805191985095509093508392850191508083835b602083106141e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016141a4565b5181516020939093036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909116921691909117905260405192018290039091207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0890180516101408b018051610160909c0180519a84529881529288526101a0822091529890525050509190525090919050565b6000808084116142b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b8215806142c3575084155b156142d15760009150610a88565b838015156142db57fe5b85840990506142ea85846138ae565b6142f66103e8836138ae565b101595945050505050565b60008080841161433d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c69061564d565b821580614348575084155b156143565760009150610a88565b8380151561436057fe5b8584099050836143708583612f7d565b81151561437957fe5b0690506142ea85846138ae565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b610120604051908101604052806143c4614386565b81526020016143d1614386565b8152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b600061260a82356158b0565b6000601f8201831361441b57600080fd5b813561442e6144298261583f565b615818565b81815260209384019390925082018360005b8381101561446c578135860161445688826145bc565b8452506020928301929190910190600101614440565b5050505092915050565b6000601f8201831361448757600080fd5b81356144956144298261583f565b81815260209384019390925082018360005b8381101561446c57813586016144bd888261460b565b84525060209283019291909101906001016144a7565b6000601f820183136144e457600080fd5b81356144f26144298261583f565b9150818183526020840193506020810190508385602084028201111561451757600080fd5b60005b8381101561446c578161452d888261454f565b845250602092830192919091019060010161451a565b600061260a82356158c9565b600061260a82356158ce565b600061260a82356158d1565b600061260a82516158d1565b600080601f8301841361458557600080fd5b50813567ffffffffffffffff81111561459d57600080fd5b6020830191508360018202830111156145b557600080fd5b9250929050565b6000601f820183136145cd57600080fd5b81356145db61442982615860565b915080825260208301602083018583830111156145f757600080fd5b614602838284615907565b50505092915050565b6000610180828403121561461e57600080fd5b614629610180615818565b9050600061463784846143fe565b8252506020614648848483016143fe565b602083015250604061465c848285016143fe565b6040830152506060614670848285016143fe565b60608301525060806146848482850161454f565b60808301525060a06146988482850161454f565b60a08301525060c06146ac8482850161454f565b60c08301525060e06146c08482850161454f565b60e0830152506101006146d58482850161454f565b610100830152506101206146eb8482850161454f565b6101208301525061014082013567ffffffffffffffff81111561470d57600080fd5b614719848285016145bc565b6101408301525061016082013567ffffffffffffffff81111561473b57600080fd5b614747848285016145bc565b6101608301525092915050565b60006020828403121561476657600080fd5b600061344b84846143fe565b6000806040838503121561478557600080fd5b600061479185856143fe565b92505060206147a2858286016143fe565b9150509250929050565b600080604083850312156147bf57600080fd5b60006147cb85856143fe565b92505060206147a285828601614543565b6000602082840312156147ee57600080fd5b813567ffffffffffffffff81111561480557600080fd5b61344b84828501614476565b60008060006060848603121561482657600080fd5b833567ffffffffffffffff81111561483d57600080fd5b61484986828701614476565b935050602084013567ffffffffffffffff81111561486657600080fd5b614872868287016144d3565b925050604084013567ffffffffffffffff81111561488f57600080fd5b61489b8682870161440a565b9150509250925092565b6000806000606084860312156148ba57600080fd5b833567ffffffffffffffff8111156148d157600080fd5b6148dd86828701614476565b93505060206148728682870161454f565b60006020828403121561490057600080fd5b600061344b848461454f565b6000806040838503121561491f57600080fd5b6000614791858561454f565b6000806000806060858703121561494157600080fd5b600061494d878761454f565b945050602061495e878288016143fe565b935050604085013567ffffffffffffffff81111561497b57600080fd5b61498787828801614573565b95989497509550505050565b6000806000606084860312156149a857600080fd5b60006149b4868661454f565b93505060206149c5868287016143fe565b925050604084013567ffffffffffffffff8111156149e257600080fd5b61489b868287016145bc565b600060208284031215614a0057600080fd5b600061344b848461455b565b600060208284031215614a1e57600080fd5b600061344b8484614567565b600060208284031215614a3c57600080fd5b813567ffffffffffffffff811115614a5357600080fd5b61344b8482850161460b565b60008060008060808587031215614a7557600080fd5b843567ffffffffffffffff811115614a8c57600080fd5b614a988782880161460b565b945050602085013567ffffffffffffffff811115614ab557600080fd5b614ac18782880161460b565b935050604085013567ffffffffffffffff811115614ade57600080fd5b614aea878288016145bc565b925050606085013567ffffffffffffffff811115614b0757600080fd5b614b13878288016145bc565b91505092959194509250565b600080600060608486031215614b3457600080fd5b833567ffffffffffffffff811115614b4b57600080fd5b614b578682870161460b565b93505060206149c58682870161454f565b60008060008060008060808789031215614b8157600080fd5b6000614b8d898961454f565b9650506020614b9e89828a016143fe565b955050604087013567ffffffffffffffff811115614bbb57600080fd5b614bc789828a01614573565b9450945050606087013567ffffffffffffffff811115614be657600080fd5b614bf289828a01614573565b92509250509295509295509295565b614c0a816158b0565b82525050565b6000614c1b826158ac565b808452602084019350614c2d836158a6565b60005b82811015614c5d57614c438683516153e5565b614c4c826158a6565b606096909601959150600101614c30565b5093949350505050565b614c0a816158c9565b614c0a816158ce565b614c0a816158d1565b6000614c8d826158ac565b808452614ca1816020860160208601615913565b614caa8161593f565b9093016020019392505050565b614c0a816158fc565b601281527f4c454e4754485f36355f52455155495245440000000000000000000000000000602082015260400190565b600d81527f494e56414c49445f54414b455200000000000000000000000000000000000000602082015260400190565b600e81527f4f524445525f4f56455246494c4c000000000000000000000000000000000000602082015260400190565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f414c52454144595f455849535453000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601581527f5349474e41545552455f554e535550504f525445440000000000000000000000602082015260400190565b601081527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000602082015260400190565b601781527f494e56414c49445f4f524445525f5349474e4154555245000000000000000000602082015260400190565b600d81527f494e56414c49445f4d414b455200000000000000000000000000000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b600f81527f494e56414c49445f54585f484153480000000000000000000000000000000000602082015260400190565b601181527f494e56414c49445f5349474e4154555245000000000000000000000000000000602082015260400190565b600e81527f524f554e44494e475f4552524f52000000000000000000000000000000000000602082015260400190565b601081527f4641494c45445f455845435554494f4e00000000000000000000000000000000602082015260400190565b600d81527f54414b45525f4f56455250415900000000000000000000000000000000000000602082015260400190565b601481527f494e56414c49445f54414b45525f414d4f554e54000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f444f45535f4e4f545f4558495354000000000000602082015260400190565b602181527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560208201527f4400000000000000000000000000000000000000000000000000000000000000604082015260600190565b601181527f5349474e41545552455f494c4c4547414c000000000000000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f305f52455155495245440000602082015260400190565b601781527f494e56414c49445f4e45575f4f524445525f45504f4348000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f335f52455155495245440000602082015260400190565b601481527f434f4d504c4554455f46494c4c5f4641494c4544000000000000000000000000602082015260400190565b601281527f494e56414c49445f46494c4c5f50524943450000000000000000000000000000602082015260400190565b601281527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000602082015260400190565b601381527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601081527f4f524445525f554e46494c4c41424c4500000000000000000000000000000000602082015260400190565b600e81527f494e56414c49445f53454e444552000000000000000000000000000000000000602082015260400190565b601881527f4e454741544956455f5350524541445f52455155495245440000000000000000602082015260400190565b601481527f494e56414c49445f54585f5349474e4154555245000000000000000000000000602082015260400190565b601181527f4c454e4754485f305f5245515549524544000000000000000000000000000000602082015260400190565b805160808301906153738482614c70565b5060208201516153866020850182614c70565b5060408201516153996040850182614c70565b5060608201516127a36060850182614c70565b80516101208301906153be8482615362565b5060208201516153d16080850182615362565b5060408201516127a3610100850182614c70565b805160608301906153f6848261541c565b5060208201516154096020850182614c70565b5060408201516127a36040850182614c70565b614c0a816158f6565b60208101612fbe8284614c01565b6101008101615442828b614c01565b61544f602083018a614c01565b61545c6040830189614c70565b6154696060830188614c70565b6154766080830187614c70565b61548360a0830186614c70565b81810360c08301526154958185614c82565b905081810360e08301526154a98184614c82565b9a9950505050505050505050565b606081016154c58286614c01565b81810360208301526154d78185614c82565b905081810360408301526154eb8184614c82565b95945050505050565b6020808252810161260a8184614c10565b60208101612fbe8284614c67565b60208101612fbe8284614c70565b6060810161552f8286614c70565b61553c6020830185614c01565b81810360408301526154eb8184614c82565b6040810161555c8285614c70565b818103602083015261344b8184614c82565b6080810161557c8287614c70565b615589602083018661541c565b6155966040830185614c70565b6154eb6060830184614c70565b604081016155b18285614c79565b61260a6020830184614c01565b6020808252810161260a8184614c82565b60208101612fbe8284614cb7565b60208082528101612fbe81614cc0565b60208082528101612fbe81614cf0565b60208082528101612fbe81614d20565b60208082528101612fbe81614d50565b60208082528101612fbe81614d80565b60208082528101612fbe81614db0565b60208082528101612fbe81614e06565b60208082528101612fbe81614e36565b60208082528101612fbe81614e66565b60208082528101612fbe81614e96565b60208082528101612fbe81614ec6565b60208082528101612fbe81614ef6565b60208082528101612fbe81614f26565b60208082528101612fbe81614f56565b60208082528101612fbe81614f86565b60208082528101612fbe81614fb6565b60208082528101612fbe81614fe6565b60208082528101612fbe81615016565b60208082528101612fbe81615046565b60208082528101612fbe8161509c565b60208082528101612fbe816150cc565b60208082528101612fbe816150fc565b60208082528101612fbe8161512c565b60208082528101612fbe8161515c565b60208082528101612fbe8161518c565b60208082528101612fbe816151bc565b60208082528101612fbe816151ec565b60208082528101612fbe8161521c565b60208082528101612fbe81615272565b60208082528101612fbe816152a2565b60208082528101612fbe816152d2565b60208082528101612fbe81615302565b60208082528101612fbe81615332565b60808101612fbe8284615362565b6101208101612fbe82846153ac565b60608101612fbe82846153e5565b60405181810167ffffffffffffffff8111828210171561583757600080fd5b604052919050565b600067ffffffffffffffff82111561585657600080fd5b5060209081020190565b600067ffffffffffffffff82111561587757600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b6000612fbe826158b0565b82818337506000910152565b60005b8381101561592e578181015183820152602001615916565b838111156127a35750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820fdae8e8e60f04e880ecbbd37d833d342061e8b2cb23fd5fe7ff93742cbe9fe9f6c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x1B6 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x288CDC91 DUP2 EQ PUSH2 0x1BB JUMPI DUP1 PUSH4 0x297BB70B EQ PUSH2 0x1F1 JUMPI DUP1 PUSH4 0x2AC12622 EQ PUSH2 0x21E JUMPI DUP1 PUSH4 0x3683EF8E EQ PUSH2 0x24B JUMPI DUP1 PUSH4 0x3C28D861 EQ PUSH2 0x26D JUMPI DUP1 PUSH4 0x3E228BAE EQ PUSH2 0x29A JUMPI DUP1 PUSH4 0x3FD3C997 EQ PUSH2 0x2BA JUMPI DUP1 PUSH4 0x4AC14782 EQ PUSH2 0x2E7 JUMPI DUP1 PUSH4 0x4D0AE546 EQ PUSH2 0x307 JUMPI DUP1 PUSH4 0x4F9559B1 EQ PUSH2 0x327 JUMPI DUP1 PUSH4 0x50DDE190 EQ PUSH2 0x347 JUMPI DUP1 PUSH4 0x60704108 EQ PUSH2 0x367 JUMPI DUP1 PUSH4 0x642F2EAF EQ PUSH2 0x394 JUMPI DUP1 PUSH4 0x64A3BC15 EQ PUSH2 0x3B4 JUMPI DUP1 PUSH4 0x77FCCE68 EQ PUSH2 0x3D4 JUMPI DUP1 PUSH4 0x7B8E3514 EQ PUSH2 0x3F4 JUMPI DUP1 PUSH4 0x7E1D9808 EQ PUSH2 0x414 JUMPI DUP1 PUSH4 0x7E9D74DC EQ PUSH2 0x434 JUMPI DUP1 PUSH4 0x82C174D0 EQ PUSH2 0x461 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x481 JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0x496 JUMPI DUP1 PUSH4 0xA3E20380 EQ PUSH2 0x4B6 JUMPI DUP1 PUSH4 0xB4BE83D5 EQ PUSH2 0x4D6 JUMPI DUP1 PUSH4 0xBFC8BFCE EQ PUSH2 0x4F6 JUMPI DUP1 PUSH4 0xC585BB93 EQ PUSH2 0x516 JUMPI DUP1 PUSH4 0xC75E0A81 EQ PUSH2 0x536 JUMPI DUP1 PUSH4 0xD46B02C3 EQ PUSH2 0x563 JUMPI DUP1 PUSH4 0xD9BFA73E EQ PUSH2 0x583 JUMPI DUP1 PUSH4 0xDB123B1A EQ PUSH2 0x5A3 JUMPI DUP1 PUSH4 0xDD1C7D18 EQ PUSH2 0x5C5 JUMPI DUP1 PUSH4 0xE306F779 EQ PUSH2 0x5E5 JUMPI DUP1 PUSH4 0xE5FA431B EQ PUSH2 0x5FA JUMPI DUP1 PUSH4 0xEEA086BA EQ PUSH2 0x61A JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x62F JUMPI DUP1 PUSH4 0xFFA1AD74 EQ PUSH2 0x64F JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1C7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH2 0x1D6 CALLDATASIZE PUSH1 0x4 PUSH2 0x48EE JUMP JUMPDEST PUSH2 0x664 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x5513 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x20C CALLDATASIZE PUSH1 0x4 PUSH2 0x4811 JUMP JUMPDEST PUSH2 0x676 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x57ED JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x22A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x239 CALLDATASIZE PUSH1 0x4 PUSH2 0x48EE JUMP JUMPDEST PUSH2 0x7A1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x5505 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x257 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x266 CALLDATASIZE PUSH1 0x4 PUSH2 0x492B JUMP JUMPDEST PUSH2 0x7B6 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x279 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28D PUSH2 0x288 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A5F JUMP JUMPDEST PUSH2 0x8A3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x57FB JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x2B5 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B1F JUMP JUMPDEST PUSH2 0xA3A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2C6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DA PUSH2 0x2D5 CALLDATASIZE PUSH1 0x4 PUSH2 0x49EE JUMP JUMPDEST PUSH2 0xA90 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x55CF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x302 CALLDATASIZE PUSH1 0x4 PUSH2 0x47DC JUMP JUMPDEST PUSH2 0xAB8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x313 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x322 CALLDATASIZE PUSH1 0x4 PUSH2 0x4811 JUMP JUMPDEST PUSH2 0xB85 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x333 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x342 CALLDATASIZE PUSH1 0x4 PUSH2 0x48EE JUMP JUMPDEST PUSH2 0xC75 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x353 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x362 CALLDATASIZE PUSH1 0x4 PUSH2 0x4811 JUMP JUMPDEST PUSH2 0xE2A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x373 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x387 PUSH2 0x382 CALLDATASIZE PUSH1 0x4 PUSH2 0x49EE JUMP JUMPDEST PUSH2 0xEBE JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x5425 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x3AF CALLDATASIZE PUSH1 0x4 PUSH2 0x48EE JUMP JUMPDEST PUSH2 0xF0C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3C0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x3CF CALLDATASIZE PUSH1 0x4 PUSH2 0x4B1F JUMP JUMPDEST PUSH2 0xF21 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3E0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x3EF CALLDATASIZE PUSH1 0x4 PUSH2 0x47AC JUMP JUMPDEST PUSH2 0xFCC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x400 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x40F CALLDATASIZE PUSH1 0x4 PUSH2 0x4772 JUMP JUMPDEST PUSH2 0x1106 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x420 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x42F CALLDATASIZE PUSH1 0x4 PUSH2 0x48A5 JUMP JUMPDEST PUSH2 0x1126 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x440 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x454 PUSH2 0x44F CALLDATASIZE PUSH1 0x4 PUSH2 0x47DC JUMP JUMPDEST PUSH2 0x128A JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x54F4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x46D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x47C CALLDATASIZE PUSH1 0x4 PUSH2 0x490C JUMP JUMPDEST PUSH2 0x131F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x48D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x387 PUSH2 0x133F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4A2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x4B1 CALLDATASIZE PUSH1 0x4 PUSH2 0x4993 JUMP JUMPDEST PUSH2 0x135B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4C2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x4D1 CALLDATASIZE PUSH1 0x4 PUSH2 0x48A5 JUMP JUMPDEST PUSH2 0x18DE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4E2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x4F1 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B1F JUMP JUMPDEST PUSH2 0x19F1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x502 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x511 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B68 JUMP JUMPDEST PUSH2 0x1A6C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x522 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x531 CALLDATASIZE PUSH1 0x4 PUSH2 0x4754 JUMP JUMPDEST PUSH2 0x1D05 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x542 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x556 PUSH2 0x551 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A2A JUMP JUMPDEST PUSH2 0x1F30 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x580A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x56F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x57E CALLDATASIZE PUSH1 0x4 PUSH2 0x4A2A JUMP JUMPDEST PUSH2 0x202A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x58F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH2 0x59E CALLDATASIZE PUSH1 0x4 PUSH2 0x4772 JUMP JUMPDEST PUSH2 0x20C6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x5B8 PUSH2 0x20E3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x1E8 SWAP2 SWAP1 PUSH2 0x55BE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5D1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x5E0 CALLDATASIZE PUSH1 0x4 PUSH2 0x48A5 JUMP JUMPDEST PUSH2 0x218E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5F1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1DB PUSH2 0x2263 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x606 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x211 PUSH2 0x615 CALLDATASIZE PUSH1 0x4 PUSH2 0x48A5 JUMP JUMPDEST PUSH2 0x2269 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x626 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x387 PUSH2 0x23DB JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x63B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH2 0x64A CALLDATASIZE PUSH1 0x4 PUSH2 0x4754 JUMP JUMPDEST PUSH2 0x23F7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x65B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x5B8 PUSH2 0x24A8 JUMP JUMPDEST PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH2 0x67E PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x689 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x6CF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP8 MLOAD SWAP4 POP SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0x76F JUMPI PUSH2 0x758 DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x719 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x731 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x749 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x24DF JUMP JUMPDEST SWAP1 POP PUSH2 0x764 DUP5 DUP3 PUSH2 0x257D JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x701 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND CALLER EQ PUSH2 0x846 JUMPI PUSH2 0x80E DUP5 DUP5 DUP5 DUP5 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x135B SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0x846 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x569D JUMP JUMPDEST POP POP PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND DUP5 MSTORE SWAP2 SWAP1 MSTORE SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE JUMP JUMPDEST PUSH2 0x8AB PUSH2 0x43AF JUMP JUMPDEST PUSH2 0x8B3 PUSH2 0x43DE JUMP JUMPDEST PUSH2 0x8BB PUSH2 0x43DE JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x8F9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x160 DUP1 DUP10 ADD MLOAD PUSH2 0x140 DUP1 DUP11 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP10 ADD MLOAD SWAP1 DUP9 ADD MSTORE PUSH2 0x945 DUP9 PUSH2 0x1F30 JUMP JUMPDEST SWAP3 POP PUSH2 0x950 DUP8 PUSH2 0x1F30 JUMP JUMPDEST SWAP2 POP PUSH2 0x95A PUSH2 0x25DF JUMP JUMPDEST SWAP1 POP PUSH2 0x968 DUP9 DUP5 DUP4 DUP10 PUSH2 0x2611 JUMP JUMPDEST PUSH2 0x974 DUP8 DUP4 DUP4 DUP9 PUSH2 0x2611 JUMP JUMPDEST PUSH2 0x97E DUP9 DUP9 PUSH2 0x27A9 JUMP JUMPDEST PUSH2 0x992 DUP9 DUP9 DUP6 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x2809 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP2 ADD MLOAD SWAP1 MLOAD SWAP2 SWAP6 POP PUSH2 0x9AD SWAP2 DUP11 SWAP2 DUP7 SWAP2 DUP2 SWAP1 PUSH2 0x2990 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP6 ADD MLOAD SWAP1 DUP2 ADD MLOAD SWAP1 MLOAD PUSH2 0x9C9 SWAP2 DUP10 SWAP2 DUP6 SWAP2 SWAP1 DUP2 SWAP1 PUSH2 0x2990 JUMP JUMPDEST PUSH2 0x9E2 DUP9 DUP3 DUP6 PUSH1 0x20 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP9 PUSH1 0x0 ADD MLOAD PUSH2 0x2AA9 JUMP JUMPDEST PUSH2 0x9FB DUP8 DUP3 DUP5 PUSH1 0x20 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD DUP9 PUSH1 0x20 ADD MLOAD PUSH2 0x2AA9 JUMP JUMPDEST PUSH2 0xA07 DUP9 DUP9 DUP4 DUP8 PUSH2 0x2B55 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0xA42 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xA4F DUP6 DUP6 DUP6 PUSH2 0x2D2D JUMP JUMPDEST SWAP1 POP PUSH1 0x80 DUP2 DUP3 MLOAD PUSH1 0x20 DUP5 ADD ADDRESS GAS DELEGATECALL DUP1 ISZERO PUSH2 0xA86 JUMPI DUP2 MLOAD DUP4 MSTORE PUSH1 0x20 DUP3 ADD MLOAD PUSH1 0x20 DUP5 ADD MSTORE PUSH1 0x40 DUP3 ADD MLOAD PUSH1 0x40 DUP5 ADD MSTORE PUSH1 0x60 DUP3 ADD MLOAD PUSH1 0x60 DUP5 ADD MSTORE JUMPDEST POP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xAF8 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP2 MLOAD SWAP1 JUMPDEST DUP1 DUP3 EQ PUSH2 0xB58 JUMPI PUSH2 0xB50 DUP4 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xB41 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x2EFF JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0xB29 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP JUMP JUMPDEST PUSH2 0xB8D PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xB98 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xBD5 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP8 MLOAD SWAP4 POP SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0x76F JUMPI PUSH2 0xC5E DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC1F JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC37 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC4F JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x2F2A JUMP JUMPDEST SWAP1 POP PUSH2 0xC6A DUP5 DUP3 PUSH2 0x257D JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0xC07 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD DUP2 SWAP1 DUP2 SWAP1 DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xCB9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0xCEC PUSH2 0x25DF JUMP JUMPDEST SWAP4 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND CALLER EQ PUSH2 0xD11 JUMPI CALLER PUSH2 0xD14 JUMP JUMPDEST PUSH1 0x0 JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD SWAP1 SWAP4 POP PUSH1 0x1 DUP7 ADD SWAP3 POP SWAP1 POP DUP1 DUP3 GT PUSH2 0xD8B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x572D JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 DUP9 AND DUP1 DUP5 MSTORE SWAP5 SWAP1 SWAP2 MSTORE SWAP1 DUP2 SWAP1 KECCAK256 DUP6 SWAP1 SSTORE MLOAD PUSH32 0x82AF639571738F4EBD4268FB0363D8957EBE1BBB9E78DBA5EBD69EED39B154F0 SWAP1 PUSH2 0xDF3 SWAP1 DUP7 SWAP1 PUSH2 0x5513 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP POP POP JUMP JUMPDEST PUSH2 0xE32 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xE3D PUSH2 0x4386 JUMP JUMPDEST DUP7 MLOAD SWAP3 POP PUSH1 0x0 SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0xEB4 JUMPI PUSH2 0xE9D DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE5E JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE76 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE8E JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0xA3A JUMP JUMPDEST SWAP1 POP PUSH2 0xEA9 DUP5 DUP3 PUSH2 0x257D JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0xE46 JUMP JUMPDEST POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH2 0xF29 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xF66 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0xF9C DUP5 DUP5 DUP5 PUSH2 0x2F2A JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x100A JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x103D PUSH2 0x25DF JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 DUP10 AND DUP1 DUP5 MSTORE SWAP5 SWAP1 SWAP2 MSTORE SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP8 ISZERO ISZERO OR SWAP1 SSTORE MLOAD SWAP3 SWAP4 POP SWAP1 SWAP2 PUSH32 0xA8656E308026EEABCE8F0BC18048433252318AB80AC79DA0B3D3D8697DFBA891 SWAP1 PUSH2 0x10D1 SWAP1 DUP7 SWAP1 PUSH2 0x5505 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH2 0x112E PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x113D PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x117A JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP10 MLOAD DUP11 SWAP2 SWAP1 DUP2 LT PUSH2 0x11B2 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD MLOAD SWAP5 POP DUP9 MLOAD SWAP4 POP PUSH1 0x0 SWAP3 POP JUMPDEST DUP3 DUP5 EQ PUSH2 0x1255 JUMPI DUP5 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x11E2 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD DUP2 SWAP1 MSTORE POP PUSH2 0x1202 DUP9 DUP8 PUSH1 0x20 ADD MLOAD PUSH2 0x2F7D JUMP JUMPDEST SWAP2 POP PUSH2 0x122E DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1215 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP10 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x749 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x123A DUP7 DUP3 PUSH2 0x257D JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD DUP9 GT PUSH2 0x124A JUMPI PUSH2 0x1255 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x11CC JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP2 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH1 0x60 PUSH1 0x0 DUP5 MLOAD SWAP3 POP DUP3 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x12D0 JUMPI DUP2 PUSH1 0x20 ADD JUMPDEST PUSH2 0x12BD PUSH2 0x43DE JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 SWAP1 SUB SWAP1 DUP2 PUSH2 0x12B5 JUMPI SWAP1 POP JUMPDEST POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP1 DUP4 EQ PUSH2 0xA88 JUMPI PUSH2 0x12FF DUP6 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x12F0 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x1F30 JUMP JUMPDEST DUP3 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x130D JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x12D8 JUMP JUMPDEST PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP10 MLOAD GT ISZERO ISZERO PUSH2 0x13A4 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x571D JUMP JUMPDEST PUSH2 0x13AD DUP10 PUSH2 0x2FC4 JUMP JUMPDEST PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DIV SWAP7 POP PUSH1 0x7 PUSH1 0xFF DUP9 AND LT PUSH2 0x140F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x563D JUMP JUMPDEST DUP7 PUSH1 0xFF AND PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x141E JUMPI INVALID JUMPDEST SWAP6 POP PUSH1 0x0 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x142E JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1466 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x570D JUMP JUMPDEST PUSH1 0x1 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1474 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x14BC JUMPI DUP9 MLOAD ISZERO PUSH2 0x14B3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x57DD JUMP JUMPDEST PUSH1 0x0 SWAP8 POP PUSH2 0x18D0 JUMP JUMPDEST PUSH1 0x2 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x14CA JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1605 JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0x150B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x55DD JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x151A JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0x155A DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x3088 AND JUMP JUMPDEST SWAP4 POP PUSH2 0x156D DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x3088 AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD PUSH2 0x1592 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x556E JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 PUSH1 0x0 DUP7 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x15B6 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP13 DUP2 AND SWAP1 DUP3 AND EQ SWAP10 POP SWAP3 POP PUSH2 0x18D0 SWAP1 POP JUMP JUMPDEST PUSH1 0x3 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1613 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x17B9 JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0x1654 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x55DD JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1663 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0x16A3 DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x3088 AND JUMP JUMPDEST SWAP4 POP PUSH2 0x16B6 DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x3088 AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 PUSH1 0x40 MLOAD PUSH1 0x20 ADD DUP1 DUP1 PUSH32 0x19457468657265756D205369676E6564204D6573736167653A0A333200000000 DUP2 MSTORE POP PUSH1 0x1C ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x1757 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x171A JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 PUSH1 0x0 DUP4 MSTORE SWAP2 ADD SWAP3 DUP4 SWAP1 MSTORE PUSH2 0x1592 SWAP5 POP SWAP3 POP DUP10 SWAP2 DUP10 SWAP2 POP DUP9 SWAP1 PUSH2 0x556E JUMP JUMPDEST PUSH1 0x4 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x17C7 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x17DF JUMPI PUSH2 0x17D8 DUP12 DUP12 DUP12 PUSH2 0x30D3 JUMP JUMPDEST SWAP8 POP PUSH2 0x18D0 JUMP JUMPDEST PUSH1 0x5 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x17ED JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1850 JUMPI PUSH2 0x17FC DUP10 PUSH2 0x3228 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP13 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1844 JUMPI PUSH1 0x0 SWAP8 POP PUSH2 0x18D0 JUMP JUMPDEST PUSH2 0x17D8 DUP2 DUP13 DUP13 DUP13 PUSH2 0x32A1 JUMP JUMPDEST PUSH1 0x6 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x185E JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x189E JUMPI PUSH1 0x0 DUP12 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP15 AND DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND SWAP8 POP PUSH2 0x18D0 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x563D JUMP JUMPDEST POP POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x18E6 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x18F6 PUSH2 0x4386 JUMP JUMPDEST DUP10 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1905 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x140 ADD MLOAD SWAP6 POP DUP10 MLOAD SWAP5 POP PUSH1 0x0 SWAP4 POP JUMPDEST DUP4 DUP6 EQ PUSH2 0x19E4 JUMPI DUP6 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1935 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP7 MLOAD PUSH2 0x1951 SWAP1 DUP11 SWAP1 PUSH2 0x2F7D JUMP JUMPDEST SWAP3 POP PUSH2 0x1994 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1964 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0xA0 ADD MLOAD DUP12 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1980 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x80 ADD MLOAD DUP6 PUSH2 0x33FD JUMP JUMPDEST SWAP2 POP PUSH2 0x19C0 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x19A7 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP11 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE8E JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x19CC DUP8 DUP3 PUSH2 0x257D JUMP JUMPDEST DUP7 MLOAD DUP10 GT PUSH2 0x19D9 JUMPI PUSH2 0x19E4 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP4 ADD SWAP3 PUSH2 0x191F JUMP JUMPDEST POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x19F9 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x1A36 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0xF9C DUP5 DUP5 DUP5 PUSH2 0x24DF JUMP JUMPDEST PUSH1 0xA SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x1ABF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH2 0x1B02 PUSH2 0x1AFD DUP9 DUP9 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x3453 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x3694 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO PUSH2 0x1B4E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x568D JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x1C1F JUMPI PUSH2 0x1BA6 DUP2 DUP8 DUP6 DUP6 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x135B SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0x1BDE JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x57CD JUMP JUMPDEST PUSH1 0xA DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND OR SWAP1 SSTORE JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE MLOAD ADDRESS SWAP1 DUP7 SWAP1 DUP7 SWAP1 DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 GAS DELEGATECALL SWAP2 POP POP ISZERO ISZERO PUSH2 0x1CB6 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56BD JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x1CFC JUMPI PUSH1 0xA DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x0 SWAP1 DUP2 SWAP1 DUP2 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x1D5D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x577D JUMP JUMPDEST DUP4 SWAP3 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xAE25532E PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1DC4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1DD8 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x1DFC SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x4A0C JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP1 ISZERO PUSH2 0x1E81 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x561D JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND OR SWAP1 SSTORE MLOAD PUSH32 0xD2C6B762299C609BDB96520B58A49BFB80186934D4F71A86A367571A15C03194 SWAP1 PUSH2 0x1F22 SWAP1 DUP5 SWAP1 DUP8 SWAP1 PUSH2 0x55A3 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 POP POP POP POP JUMP JUMPDEST PUSH2 0x1F38 PUSH2 0x43DE JUMP JUMPDEST PUSH2 0x1F41 DUP3 PUSH2 0x36D1 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP4 ADD DUP3 SWAP1 MSTORE PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x4 SWAP1 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 SLOAD SWAP1 DUP3 ADD MSTORE PUSH1 0x80 DUP3 ADD MLOAD ISZERO ISZERO PUSH2 0x1F75 JUMPI PUSH1 0x1 JUMPDEST PUSH1 0xFF AND DUP2 MSTORE PUSH2 0xF07 JUMP JUMPDEST PUSH1 0xA0 DUP3 ADD MLOAD ISZERO ISZERO PUSH2 0x1F87 JUMPI PUSH1 0x2 PUSH2 0x1F6B JUMP JUMPDEST PUSH1 0xA0 DUP3 ADD MLOAD PUSH1 0x40 DUP3 ADD MLOAD LT PUSH2 0x1F9D JUMPI PUSH1 0x5 PUSH2 0x1F6B JUMP JUMPDEST PUSH2 0x100 DUP3 ADD MLOAD TIMESTAMP LT PUSH2 0x1FB0 JUMPI PUSH1 0x4 PUSH2 0x1F6B JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 ADD MLOAD PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 SWAP1 SWAP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x1FD4 JUMPI PUSH1 0x6 PUSH2 0x1F6B JUMP JUMPDEST PUSH2 0x120 DUP3 ADD MLOAD DUP3 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH1 0x60 DUP9 ADD MLOAD SWAP1 SWAP5 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD GT ISZERO PUSH2 0x2021 JUMPI PUSH1 0x6 PUSH2 0x1F6B JUMP JUMPDEST PUSH1 0x3 DUP2 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x2067 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x209B DUP2 PUSH2 0x2EFF JUMP JUMPDEST POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 DUP5 DUP7 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x2186 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x215B JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2186 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2169 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST PUSH2 0x2196 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x21A5 PUSH2 0x4386 JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x21B4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD MLOAD SWAP5 POP DUP9 MLOAD SWAP4 POP PUSH1 0x0 SWAP3 POP JUMPDEST DUP3 DUP5 EQ PUSH2 0x2257 JUMPI DUP5 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x21E4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD DUP2 SWAP1 MSTORE POP PUSH2 0x2204 DUP9 DUP8 PUSH1 0x20 ADD MLOAD PUSH2 0x2F7D JUMP JUMPDEST SWAP2 POP PUSH2 0x2230 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2217 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP10 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE8E JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x223C DUP7 DUP3 PUSH2 0x257D JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD DUP9 GT PUSH2 0x224C JUMPI PUSH2 0x2257 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x21CE JUMP JUMPDEST POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x2 SLOAD DUP2 JUMP JUMPDEST PUSH2 0x2271 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x2281 PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x22BE JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x576D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP11 MLOAD DUP12 SWAP2 SWAP1 DUP2 LT PUSH2 0x22F6 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x140 ADD MLOAD SWAP6 POP DUP10 MLOAD SWAP5 POP PUSH1 0x0 SWAP4 POP JUMPDEST DUP4 DUP6 EQ PUSH2 0x23A5 JUMPI DUP6 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2326 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP7 MLOAD PUSH2 0x2342 SWAP1 DUP11 SWAP1 PUSH2 0x2F7D JUMP JUMPDEST SWAP3 POP PUSH2 0x2355 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1964 JUMPI INVALID JUMPDEST SWAP2 POP PUSH2 0x2381 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2368 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP11 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x749 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x238D DUP8 DUP3 PUSH2 0x257D JUMP JUMPDEST DUP7 MLOAD DUP10 GT PUSH2 0x239A JUMPI PUSH2 0x23A5 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP4 ADD SWAP3 PUSH2 0x2310 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP3 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0xA SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x2448 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x577D JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x24A5 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0xB DUP2 MSTORE PUSH32 0x322E302E312D616C706861000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH2 0x24E7 PUSH2 0x4386 JUMP JUMPDEST PUSH2 0x24EF PUSH2 0x43DE JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x24FD DUP9 PUSH2 0x1F30 JUMP JUMPDEST SWAP4 POP PUSH2 0x2507 PUSH2 0x25DF JUMP JUMPDEST SWAP3 POP PUSH2 0x2515 DUP9 DUP6 DUP6 DUP10 PUSH2 0x2611 JUMP JUMPDEST PUSH2 0x2527 DUP9 PUSH1 0xA0 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x2F7D JUMP JUMPDEST SWAP2 POP PUSH2 0x2533 DUP8 DUP4 PUSH2 0x36DF JUMP JUMPDEST SWAP1 POP PUSH2 0x2546 DUP9 DUP6 DUP10 DUP5 DUP10 PUSH1 0x0 ADD MLOAD PUSH2 0x2990 JUMP JUMPDEST PUSH2 0x2550 DUP9 DUP3 PUSH2 0x36F5 JUMP JUMPDEST SWAP5 POP PUSH2 0x2567 DUP9 DUP5 DUP7 PUSH1 0x20 ADD MLOAD DUP8 PUSH1 0x40 ADD MLOAD DUP10 PUSH2 0x2AA9 JUMP JUMPDEST PUSH2 0x2572 DUP9 DUP5 DUP8 PUSH2 0x3756 JUMP JUMPDEST POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP2 MLOAD DUP2 MLOAD PUSH2 0x258B SWAP2 SWAP1 PUSH2 0x3864 JUMP JUMPDEST DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x25A1 SWAP2 SWAP1 PUSH2 0x3864 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE PUSH1 0x40 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x25BA SWAP2 SWAP1 PUSH2 0x3864 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE PUSH1 0x60 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x25D3 SWAP2 SWAP1 PUSH2 0x3864 JUMP JUMPDEST PUSH1 0x60 SWAP1 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP JUMP JUMPDEST PUSH1 0xA SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 DUP2 ISZERO PUSH2 0x2608 JUMPI DUP2 PUSH2 0x260A JUMP JUMPDEST CALLER JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP3 MLOAD PUSH1 0xFF AND PUSH1 0x3 EQ PUSH2 0x264F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x579D JUMP JUMPDEST PUSH1 0x60 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x26C2 JUMPI PUSH1 0x60 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x26C2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x57AD JUMP JUMPDEST PUSH1 0x20 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x274D JUMPI DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH1 0x20 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO ISZERO PUSH2 0x274D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x55ED JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MLOAD ISZERO ISZERO PUSH2 0x27A3 JUMPI PUSH2 0x276B DUP4 PUSH1 0x20 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD DUP4 PUSH2 0x135B JUMP JUMPDEST ISZERO ISZERO PUSH2 0x27A3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x565D JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH2 0x27BB DUP3 PUSH1 0xA0 ADD MLOAD DUP3 PUSH1 0xA0 ADD MLOAD PUSH2 0x38AE JUMP JUMPDEST PUSH2 0x27CD DUP4 PUSH1 0x80 ADD MLOAD DUP4 PUSH1 0x80 ADD MLOAD PUSH2 0x38AE JUMP JUMPDEST LT ISZERO PUSH2 0x2805 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x57BD JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH2 0x2811 PUSH2 0x43AF JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x2825 DUP10 PUSH1 0xA0 ADD MLOAD DUP9 PUSH2 0x2F7D JUMP JUMPDEST SWAP4 POP PUSH2 0x283A DUP10 PUSH1 0x80 ADD MLOAD DUP11 PUSH1 0xA0 ADD MLOAD DUP7 PUSH2 0x3909 JUMP JUMPDEST SWAP3 POP PUSH2 0x284A DUP9 PUSH1 0xA0 ADD MLOAD DUP8 PUSH2 0x2F7D JUMP JUMPDEST SWAP2 POP PUSH2 0x285F DUP9 PUSH1 0x80 ADD MLOAD DUP10 PUSH1 0xA0 ADD MLOAD DUP5 PUSH2 0x3909 JUMP JUMPDEST SWAP1 POP DUP1 DUP5 LT PUSH2 0x28A2 JUMPI PUSH1 0x20 DUP1 DUP7 ADD DUP1 MLOAD DUP4 SWAP1 MSTORE DUP1 MLOAD DUP3 ADD DUP5 SWAP1 MSTORE MLOAD MLOAD DUP7 MLOAD DUP3 ADD MSTORE PUSH1 0x80 DUP11 ADD MLOAD PUSH1 0xA0 DUP12 ADD MLOAD DUP8 MLOAD SWAP1 SWAP3 ADD MLOAD PUSH2 0x289A SWAP3 SWAP1 PUSH2 0x3909 JUMP JUMPDEST DUP6 MLOAD MSTORE PUSH2 0x28DF JUMP JUMPDEST DUP5 MLOAD DUP4 SWAP1 MSTORE DUP5 MLOAD PUSH1 0x20 SWAP1 DUP2 ADD DUP6 SWAP1 MSTORE DUP6 MLOAD DUP2 ADD MLOAD SWAP1 DUP7 ADD DUP1 MLOAD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0xA0 DUP10 ADD MLOAD PUSH1 0x80 DUP11 ADD MLOAD SWAP2 MLOAD MLOAD PUSH2 0x28D6 SWAP3 SWAP1 PUSH2 0x3986 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP8 ADD MLOAD ADD MSTORE JUMPDEST DUP5 MLOAD MLOAD PUSH1 0x20 DUP1 DUP8 ADD MLOAD ADD MLOAD PUSH2 0x28F4 SWAP2 SWAP1 PUSH2 0x2F7D JUMP JUMPDEST PUSH1 0x40 DUP7 ADD MSTORE DUP5 MLOAD MLOAD PUSH1 0x80 DUP11 ADD MLOAD PUSH1 0xC0 DUP12 ADD MLOAD PUSH2 0x2911 SWAP3 SWAP2 SWAP1 PUSH2 0x3909 JUMP JUMPDEST DUP6 MLOAD PUSH1 0x40 ADD MSTORE DUP5 MLOAD PUSH1 0x20 ADD MLOAD PUSH1 0xA0 DUP11 ADD MLOAD PUSH1 0xE0 DUP12 ADD MLOAD PUSH2 0x2932 SWAP3 SWAP2 SWAP1 PUSH2 0x3909 JUMP JUMPDEST DUP6 MLOAD PUSH1 0x60 ADD MSTORE PUSH1 0x20 DUP6 ADD MLOAD MLOAD PUSH1 0x80 DUP10 ADD MLOAD PUSH1 0xC0 DUP11 ADD MLOAD PUSH2 0x2953 SWAP3 SWAP2 SWAP1 PUSH2 0x3909 JUMP JUMPDEST DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x40 ADD DUP2 DUP2 MSTORE POP POP PUSH2 0x297B DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x20 ADD MLOAD DUP10 PUSH1 0xA0 ADD MLOAD DUP11 PUSH1 0xE0 ADD MLOAD PUSH2 0x3909 JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD PUSH1 0x60 ADD MSTORE POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP3 ISZERO ISZERO PUSH2 0x29C9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56DD JUMP JUMPDEST DUP3 DUP3 GT ISZERO PUSH2 0x2A03 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56CD JUMP JUMPDEST DUP5 PUSH1 0xA0 ADD MLOAD PUSH2 0x2A16 DUP6 PUSH1 0x40 ADD MLOAD DUP5 PUSH2 0x3864 JUMP JUMPDEST GT ISZERO PUSH2 0x2A4E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x55FD JUMP JUMPDEST PUSH2 0x2A5C DUP6 PUSH1 0x80 ADD MLOAD DUP4 PUSH2 0x38AE JUMP JUMPDEST PUSH2 0x2A6A DUP3 DUP8 PUSH1 0xA0 ADD MLOAD PUSH2 0x38AE JUMP JUMPDEST GT ISZERO PUSH2 0x2AA2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x575D JUMP JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH2 0x2AB7 DUP3 DUP3 PUSH1 0x20 ADD MLOAD PUSH2 0x3864 JUMP JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 SWAP3 SWAP1 SWAP3 SSTORE DUP7 DUP2 ADD MLOAD DUP8 MLOAD DUP5 MLOAD SWAP4 DUP6 ADD MLOAD DUP6 DUP5 ADD MLOAD PUSH1 0x60 DUP8 ADD MLOAD PUSH2 0x140 DUP13 ADD MLOAD PUSH2 0x160 DUP14 ADD MLOAD SWAP7 MLOAD DUP12 SWAP9 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP9 AND SWAP9 SWAP8 SWAP1 SWAP7 AND SWAP7 PUSH32 0xBCC4C97732E47D9946F229EDB95F5B6323F601300E4690DE719993F3C371129 SWAP7 PUSH2 0x2B46 SWAP7 DUP16 SWAP7 CALLER SWAP7 SWAP3 SWAP6 SWAP2 SWAP5 SWAP1 SWAP4 SWAP1 PUSH2 0x5433 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x2BFE JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x2BD3 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2BFE JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2BE1 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x2C26 DUP6 PUSH2 0x140 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x20 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x140 DUP5 ADD MLOAD DUP5 MLOAD DUP7 MLOAD DUP5 MLOAD PUSH1 0x20 ADD MLOAD PUSH2 0x2C42 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x2C5B DUP6 PUSH2 0x140 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP6 DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x2C77 DUP2 DUP7 PUSH1 0x0 ADD MLOAD DUP8 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD PUSH1 0x40 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x2C93 DUP2 DUP6 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x40 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST DUP4 PUSH1 0x40 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH1 0x40 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x2CFD JUMPI PUSH2 0x2CF8 DUP2 DUP5 DUP8 PUSH1 0x40 ADD MLOAD PUSH2 0x2CF3 DUP7 PUSH1 0x0 ADD MLOAD PUSH1 0x60 ADD MLOAD DUP8 PUSH1 0x20 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3864 JUMP JUMPDEST PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x2AA2 JUMP JUMPDEST PUSH2 0x2D15 DUP2 DUP5 DUP8 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x2AA2 DUP2 DUP5 DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x60 PUSH1 0x24 DUP4 ADD DUP2 DUP2 MSTORE DUP8 MLOAD PUSH1 0x84 DUP6 ADD SWAP1 DUP2 MSTORE DUP9 DUP5 ADD MLOAD PUSH1 0xA4 DUP7 ADD MSTORE SWAP5 DUP9 ADD MLOAD PUSH1 0xC4 DUP6 ADD MSTORE SWAP1 DUP8 ADD MLOAD PUSH1 0xE4 DUP5 ADD MSTORE PUSH1 0x80 DUP8 ADD MLOAD PUSH2 0x104 DUP5 ADD MSTORE PUSH1 0xA0 DUP8 ADD MLOAD PUSH2 0x124 DUP5 ADD MSTORE PUSH1 0xC0 DUP8 ADD MLOAD PUSH2 0x144 DUP5 ADD MSTORE PUSH1 0xE0 DUP8 ADD MLOAD PUSH2 0x164 DUP5 ADD MSTORE PUSH2 0x100 DUP8 ADD MLOAD PUSH2 0x184 DUP5 ADD MSTORE PUSH2 0x120 DUP8 ADD MLOAD PUSH2 0x1A4 DUP5 ADD MSTORE PUSH2 0x140 DUP8 ADD DUP1 MLOAD PUSH2 0x1C4 DUP6 ADD SWAP1 DUP2 MSTORE PUSH2 0x160 DUP10 ADD MLOAD PUSH2 0x1E4 DUP7 ADD MSTORE PUSH2 0x180 SWAP1 MSTORE MLOAD DUP1 MLOAD PUSH2 0x204 DUP6 ADD DUP2 SWAP1 MSTORE SWAP4 SWAP5 SWAP2 SWAP4 DUP5 SWAP4 PUSH1 0x44 DUP8 ADD SWAP3 DUP5 SWAP3 PUSH2 0x224 DUP10 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x2E34 JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x2E16 JUMP JUMPDEST POP POP POP POP DUP2 DUP2 SUB PUSH2 0x160 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP11 ADD MLOAD DUP1 MLOAD DUP1 DUP4 MSTORE PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x2E7D JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x2E5F JUMP JUMPDEST POP POP POP DUP10 DUP5 MSTORE POP DUP5 DUP2 SUB PUSH1 0x20 SWAP4 DUP5 ADD SWAP1 DUP2 MSTORE DUP9 MLOAD DUP1 DUP4 MSTORE SWAP1 SWAP4 SWAP2 DUP3 ADD SWAP2 DUP10 DUP2 ADD SWAP2 SWAP1 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x2EC5 JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x2EA7 JUMP JUMPDEST POP POP POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP9 DUP4 SUB ADD DUP9 MSTORE POP PUSH1 0x40 MSTORE POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x2F07 PUSH2 0x43DE JUMP JUMPDEST PUSH2 0x2F10 DUP3 PUSH2 0x1F30 JUMP JUMPDEST SWAP1 POP PUSH2 0x2F1C DUP3 DUP3 PUSH2 0x3BED JUMP JUMPDEST PUSH2 0x2805 DUP3 DUP3 PUSH1 0x20 ADD MLOAD PUSH2 0x3D04 JUMP JUMPDEST PUSH2 0x2F32 PUSH2 0x4386 JUMP JUMPDEST PUSH2 0x2F3D DUP5 DUP5 DUP5 PUSH2 0x24DF JUMP JUMPDEST PUSH1 0x20 DUP2 ADD MLOAD SWAP1 SWAP2 POP DUP4 EQ PUSH2 0x260A JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x574D JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0x2FB9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x560D JUMP JUMPDEST POP DUP1 DUP3 SUB JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 MLOAD GT ISZERO ISZERO PUSH2 0x3002 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56FD JUMP JUMPDEST DUP2 MLOAD DUP3 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x3032 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP3 MSTORE POP PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV MUL SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x30CA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x562D JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x0 SWAP1 PUSH1 0x60 SWAP1 PUSH32 0x1626BA7E00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x310E SWAP1 DUP8 SWAP1 DUP7 SWAP1 PUSH1 0x24 ADD PUSH2 0x554E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 MSTORE DUP2 MLOAD SWAP2 SWAP4 POP SWAP1 DUP3 SWAP1 DUP2 DUP9 GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x31AB JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x321C JUMPI PUSH2 0x2572 JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xC57414C4C45545F4552524F5200000000000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST POP POP MLOAD SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x14 DUP3 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x3268 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x578D JUMP JUMPDEST PUSH2 0x3276 DUP3 PUSH1 0x14 DUP5 MLOAD SUB PUSH2 0x3DAB JUMP JUMPDEST DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC ADD SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x0 SWAP1 PUSH1 0x60 SWAP1 PUSH32 0x9363470200000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x32DE SWAP1 DUP8 SWAP1 DUP8 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x5521 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 MSTORE DUP2 MLOAD SWAP2 SWAP4 POP SWAP1 DUP3 SWAP1 DUP2 DUP11 GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x337B JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x33EC JUMPI PUSH2 0x33F1 JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xF56414C494441544F525F4552524F5200000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD SWAP5 POP JUMPDEST POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x3438 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x564D JUMP JUMPDEST PUSH2 0x344B PUSH2 0x3445 DUP6 DUP5 PUSH2 0x38AE JUMP JUMPDEST DUP5 PUSH2 0x3E0C JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x5A65726F45785472616E73616374696F6E280000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0x32 DUP4 ADD MSTORE PUSH32 0x61646472657373207369676E6572416464726573732C00000000000000000000 PUSH1 0x3F DUP4 ADD MSTORE PUSH32 0x6279746573206461746100000000000000000000000000000000000000000000 PUSH1 0x55 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0x5F DUP4 ADD MSTORE DUP3 MLOAD DUP1 DUP4 SUB DUP5 ADD DUP2 MSTORE PUSH1 0x60 SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP1 SWAP3 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x357C JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x353F JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP10 MLOAD SWAP1 SWAP8 POP DUP10 SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x3612 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x35D5 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 SWAP8 DUP3 MSTORE DUP2 ADD SWAP11 SWAP1 SWAP11 MSTORE POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 SWAP1 SWAP8 AND SWAP7 DUP9 ADD SWAP7 SWAP1 SWAP7 MSTORE POP POP PUSH1 0x60 DUP6 ADD MSTORE POP POP PUSH1 0x80 SWAP1 SWAP2 KECCAK256 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH32 0x1901000000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP2 DUP3 ADD MSTORE PUSH1 0x22 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2FBE PUSH2 0x1AFD DUP4 PUSH2 0x3E23 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP4 LT PUSH2 0x36EE JUMPI DUP2 PUSH2 0x260A JUMP JUMPDEST POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH2 0x36FD PUSH2 0x4386 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0xA0 DUP4 ADD MLOAD PUSH1 0x80 DUP5 ADD MLOAD PUSH2 0x3719 SWAP2 DUP5 SWAP2 PUSH2 0x3909 JUMP JUMPDEST DUP1 DUP3 MSTORE PUSH1 0x80 DUP5 ADD MLOAD PUSH1 0xC0 DUP6 ADD MLOAD PUSH2 0x3731 SWAP3 SWAP2 SWAP1 PUSH2 0x3909 JUMP JUMPDEST PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0xA0 DUP4 ADD MLOAD PUSH1 0xE0 DUP5 ADD MLOAD PUSH2 0x374B SWAP2 DUP5 SWAP2 PUSH2 0x3909 JUMP JUMPDEST PUSH1 0x60 DUP3 ADD MSTORE SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x37FF JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x37D4 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x37FF JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x37E2 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x381F DUP5 PUSH2 0x140 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD DUP6 DUP6 PUSH1 0x0 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x3838 DUP5 PUSH2 0x160 ADD MLOAD DUP5 DUP7 PUSH1 0x0 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x3850 DUP2 DUP6 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH2 0x27A3 DUP2 DUP5 DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x60 ADD MLOAD PUSH2 0x3A23 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x38A3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x567D JUMP JUMPDEST DUP1 SWAP2 POP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 ISZERO ISZERO PUSH2 0x38C1 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x38A7 JUMP JUMPDEST POP DUP3 DUP3 MUL DUP3 DUP5 DUP3 DUP2 ISZERO ISZERO PUSH2 0x38D1 JUMPI INVALID JUMPDEST DIV EQ PUSH2 0x38A3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x567D JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x3944 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x564D JUMP JUMPDEST PUSH2 0x394F DUP5 DUP5 DUP5 PUSH2 0x427C JUMP JUMPDEST ISZERO PUSH2 0x3438 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56AD JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x39C1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x564D JUMP JUMPDEST PUSH2 0x39CC DUP5 DUP5 DUP5 PUSH2 0x4301 JUMP JUMPDEST ISZERO PUSH2 0x3A03 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56AD JUMP JUMPDEST PUSH2 0x344B PUSH2 0x3445 PUSH2 0x3A13 DUP7 DUP6 PUSH2 0x38AE JUMP JUMPDEST PUSH2 0x3A1E DUP7 PUSH1 0x1 PUSH2 0x2F7D JUMP JUMPDEST PUSH2 0x3864 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP4 GT DUP1 ISZERO PUSH2 0x3A62 JUMPI POP DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO JUMPDEST ISZERO PUSH2 0x3BE5 JUMPI DUP6 MLOAD PUSH1 0x3 LT PUSH2 0x3AA2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x573D JUMP JUMPDEST POP POP PUSH1 0x20 DUP5 DUP2 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0xB SWAP1 SWAP3 MSTORE PUSH1 0x40 SWAP1 SWAP2 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO ISZERO PUSH2 0x3B2B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x56ED JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH7 0xFFFFFFFFFFFE0 PUSH1 0x3F DUP9 MLOAD ADD AND DUP1 PUSH1 0x84 ADD DUP3 ADD PUSH32 0xA85E59E400000000000000000000000000000000000000000000000000000000 DUP4 MSTORE PUSH1 0x80 PUSH1 0x4 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND PUSH1 0x24 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND PUSH1 0x44 DUP5 ADD MSTORE DUP6 PUSH1 0x64 DUP5 ADD MSTORE PUSH1 0x84 DUP4 ADD JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x3BC7 JUMPI DUP10 MLOAD DUP2 MSTORE PUSH1 0x20 SWAP10 DUP11 ADD SWAP10 ADD PUSH2 0x3BAF JUMP JUMPDEST PUSH2 0x200 DUP5 DUP6 DUP5 SUB DUP7 PUSH1 0x0 DUP10 GAS CALL DUP1 ISZERO ISZERO PUSH2 0x3BDF JUMPI RETURNDATASIZE DUP6 REVERT JUMPDEST POP POP POP POP POP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH1 0xFF AND PUSH1 0x3 EQ PUSH2 0x3C2E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x579D JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x3CA1 JUMPI PUSH1 0x60 DUP4 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x3CA1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x57AD JUMP JUMPDEST PUSH2 0x3CA9 PUSH2 0x25DF JUMP JUMPDEST DUP4 MLOAD SWAP1 SWAP2 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0x3CFF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x566D JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE DUP3 DUP2 ADD MLOAD DUP4 MLOAD PUSH2 0x140 DUP6 ADD MLOAD PUSH2 0x160 DUP7 ADD MLOAD SWAP4 MLOAD DUP6 SWAP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP5 DUP6 AND SWAP5 SWAP4 SWAP1 SWAP4 AND SWAP3 PUSH32 0xDC47B3613D9FE400085F6DBDC99453462279057E6207385042827ED6B1A62CF7 SWAP3 PUSH2 0x3D9F SWAP3 CALLER SWAP3 SWAP1 PUSH2 0x54B7 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x3DED JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x578D JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 DUP5 DUP2 ISZERO ISZERO PUSH2 0x3E1A JUMPI INVALID JUMPDEST DIV SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4F72646572280000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x61646472657373206D616B6572416464726573732C0000000000000000000000 PUSH1 0x26 DUP4 ADD MSTORE PUSH32 0x616464726573732074616B6572416464726573732C0000000000000000000000 PUSH1 0x3B DUP4 ADD MSTORE PUSH32 0x6164647265737320666565526563697069656E74416464726573732C00000000 PUSH1 0x50 DUP4 ADD MSTORE PUSH32 0x616464726573732073656E646572416464726573732C00000000000000000000 PUSH1 0x6C DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724173736574416D6F756E742C00000000000000 PUSH1 0x82 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724173736574416D6F756E742C00000000000000 PUSH1 0x9B DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724665652C000000000000000000000000000000 PUSH1 0xB4 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724665652C000000000000000000000000000000 PUSH1 0xC5 DUP4 ADD MSTORE PUSH32 0x75696E743235362065787069726174696F6E54696D655365636F6E64732C0000 PUSH1 0xD6 DUP4 ADD MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0xF4 DUP4 ADD MSTORE PUSH32 0x6279746573206D616B65724173736574446174612C0000000000000000000000 PUSH2 0x101 DUP4 ADD MSTORE PUSH32 0x62797465732074616B6572417373657444617461000000000000000000000000 PUSH2 0x116 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH2 0x12A DUP4 ADD MSTORE DUP3 MLOAD PUSH2 0x10B DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH2 0x12B SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP2 SWAP3 SWAP2 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x40AB JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x406E JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x140 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP10 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x4146 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x4109 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x160 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP9 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x41E1 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x41A4 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 SWAP1 SWAP4 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP2 AND SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP1 SWAP2 KECCAK256 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP10 ADD DUP1 MLOAD PUSH2 0x140 DUP12 ADD DUP1 MLOAD PUSH2 0x160 SWAP1 SWAP13 ADD DUP1 MLOAD SWAP11 DUP5 MSTORE SWAP9 DUP2 MSTORE SWAP3 DUP9 MSTORE PUSH2 0x1A0 DUP3 KECCAK256 SWAP2 MSTORE SWAP9 SWAP1 MSTORE POP POP POP SWAP2 SWAP1 MSTORE POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x42B8 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x564D JUMP JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x42C3 JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x42D1 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0xA88 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x42DB JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP PUSH2 0x42EA DUP6 DUP5 PUSH2 0x38AE JUMP JUMPDEST PUSH2 0x42F6 PUSH2 0x3E8 DUP4 PUSH2 0x38AE JUMP JUMPDEST LT ISZERO SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x433D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x6C6 SWAP1 PUSH2 0x564D JUMP JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x4348 JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x4356 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0xA88 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x4360 JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP DUP4 PUSH2 0x4370 DUP6 DUP4 PUSH2 0x2F7D JUMP JUMPDEST DUP2 ISZERO ISZERO PUSH2 0x4379 JUMPI INVALID JUMPDEST MOD SWAP1 POP PUSH2 0x42EA DUP6 DUP5 PUSH2 0x38AE JUMP JUMPDEST PUSH1 0x80 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH2 0x120 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH2 0x43C4 PUSH2 0x4386 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x43D1 PUSH2 0x4386 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x60 DUP2 ADD DUP3 MSTORE PUSH1 0x0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP2 SWAP1 MSTORE SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x260A DUP3 CALLDATALOAD PUSH2 0x58B0 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x441B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x442E PUSH2 0x4429 DUP3 PUSH2 0x583F JUMP JUMPDEST PUSH2 0x5818 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x446C JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x4456 DUP9 DUP3 PUSH2 0x45BC JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x4440 JUMP JUMPDEST POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x4487 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x4495 PUSH2 0x4429 DUP3 PUSH2 0x583F JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x446C JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x44BD DUP9 DUP3 PUSH2 0x460B JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x44A7 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x44E4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x44F2 PUSH2 0x4429 DUP3 PUSH2 0x583F JUMP JUMPDEST SWAP2 POP DUP2 DUP2 DUP4 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP2 ADD SWAP1 POP DUP4 DUP6 PUSH1 0x20 DUP5 MUL DUP3 ADD GT ISZERO PUSH2 0x4517 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x446C JUMPI DUP2 PUSH2 0x452D DUP9 DUP3 PUSH2 0x454F JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x451A JUMP JUMPDEST PUSH1 0x0 PUSH2 0x260A DUP3 CALLDATALOAD PUSH2 0x58C9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x260A DUP3 CALLDATALOAD PUSH2 0x58CE JUMP JUMPDEST PUSH1 0x0 PUSH2 0x260A DUP3 CALLDATALOAD PUSH2 0x58D1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x260A DUP3 MLOAD PUSH2 0x58D1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1F DUP4 ADD DUP5 SGT PUSH2 0x4585 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x459D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x1 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x45B5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x45CD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x45DB PUSH2 0x4429 DUP3 PUSH2 0x5860 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x45F7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4602 DUP4 DUP3 DUP5 PUSH2 0x5907 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x461E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4629 PUSH2 0x180 PUSH2 0x5818 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x4637 DUP5 DUP5 PUSH2 0x43FE JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x4648 DUP5 DUP5 DUP4 ADD PUSH2 0x43FE JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x465C DUP5 DUP3 DUP6 ADD PUSH2 0x43FE JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x4670 DUP5 DUP3 DUP6 ADD PUSH2 0x43FE JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x4684 DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x4698 DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x46AC DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x46C0 DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x46D5 DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x46EB DUP5 DUP3 DUP6 ADD PUSH2 0x454F JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x470D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4719 DUP5 DUP3 DUP6 ADD PUSH2 0x45BC JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x473B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4747 DUP5 DUP3 DUP6 ADD PUSH2 0x45BC JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4766 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x344B DUP5 DUP5 PUSH2 0x43FE JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4785 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4791 DUP6 DUP6 PUSH2 0x43FE JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x47A2 DUP6 DUP3 DUP7 ADD PUSH2 0x43FE JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x47BF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x47CB DUP6 DUP6 PUSH2 0x43FE JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x47A2 DUP6 DUP3 DUP7 ADD PUSH2 0x4543 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x47EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4805 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x344B DUP5 DUP3 DUP6 ADD PUSH2 0x4476 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4826 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x483D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4849 DUP7 DUP3 DUP8 ADD PUSH2 0x4476 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4866 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4872 DUP7 DUP3 DUP8 ADD PUSH2 0x44D3 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x488F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x489B DUP7 DUP3 DUP8 ADD PUSH2 0x440A JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x48BA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x48D1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x48DD DUP7 DUP3 DUP8 ADD PUSH2 0x4476 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x4872 DUP7 DUP3 DUP8 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4900 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x344B DUP5 DUP5 PUSH2 0x454F JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x491F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4791 DUP6 DUP6 PUSH2 0x454F JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x60 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x4941 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x494D DUP8 DUP8 PUSH2 0x454F JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x495E DUP8 DUP3 DUP9 ADD PUSH2 0x43FE JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x497B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4987 DUP8 DUP3 DUP9 ADD PUSH2 0x4573 JUMP JUMPDEST SWAP6 SWAP9 SWAP5 SWAP8 POP SWAP6 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x49A8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x49B4 DUP7 DUP7 PUSH2 0x454F JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x49C5 DUP7 DUP3 DUP8 ADD PUSH2 0x43FE JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x49E2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x489B DUP7 DUP3 DUP8 ADD PUSH2 0x45BC JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4A00 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x344B DUP5 DUP5 PUSH2 0x455B JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4A1E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x344B DUP5 DUP5 PUSH2 0x4567 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4A3C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4A53 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x344B DUP5 DUP3 DUP6 ADD PUSH2 0x460B JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x4A75 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4A8C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4A98 DUP8 DUP3 DUP9 ADD PUSH2 0x460B JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4AB5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4AC1 DUP8 DUP3 DUP9 ADD PUSH2 0x460B JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4ADE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4AEA DUP8 DUP3 DUP9 ADD PUSH2 0x45BC JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B07 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B13 DUP8 DUP3 DUP9 ADD PUSH2 0x45BC JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4B34 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B4B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B57 DUP7 DUP3 DUP8 ADD PUSH2 0x460B JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x49C5 DUP7 DUP3 DUP8 ADD PUSH2 0x454F JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP8 DUP10 SUB SLT ISZERO PUSH2 0x4B81 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4B8D DUP10 DUP10 PUSH2 0x454F JUMP JUMPDEST SWAP7 POP POP PUSH1 0x20 PUSH2 0x4B9E DUP10 DUP3 DUP11 ADD PUSH2 0x43FE JUMP JUMPDEST SWAP6 POP POP PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4BBB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4BC7 DUP10 DUP3 DUP11 ADD PUSH2 0x4573 JUMP JUMPDEST SWAP5 POP SWAP5 POP POP PUSH1 0x60 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4BE6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4BF2 DUP10 DUP3 DUP11 ADD PUSH2 0x4573 JUMP JUMPDEST SWAP3 POP SWAP3 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 POP SWAP3 SWAP6 JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58B0 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x4C1B DUP3 PUSH2 0x58AC JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x4C2D DUP4 PUSH2 0x58A6 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x4C5D JUMPI PUSH2 0x4C43 DUP7 DUP4 MLOAD PUSH2 0x53E5 JUMP JUMPDEST PUSH2 0x4C4C DUP3 PUSH2 0x58A6 JUMP JUMPDEST PUSH1 0x60 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x4C30 JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58C9 JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58CE JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58D1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x4C8D DUP3 PUSH2 0x58AC JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x4CA1 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x5913 JUMP JUMPDEST PUSH2 0x4CAA DUP2 PUSH2 0x593F JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58FC JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x4C454E4754485F36355F52455155495245440000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x494E56414C49445F54414B455200000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x4F524445525F4F56455246494C4C000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x41535345545F50524F58595F414C52454144595F455849535453000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x15 DUP2 MSTORE PUSH32 0x5349474E41545552455F554E535550504F525445440000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4449564953494F4E5F42595F5A45524F00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x494E56414C49445F4F524445525F5349474E4154555245000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x494E56414C49445F4D414B455200000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xF DUP2 MSTORE PUSH32 0x494E56414C49445F54585F484153480000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x494E56414C49445F5349474E4154555245000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x524F554E44494E475F4552524F52000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4641494C45445F455845435554494F4E00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x54414B45525F4F56455250415900000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x494E56414C49445F54414B45525F414D4F554E54000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x41535345545F50524F58595F444F45535F4E4F545F4558495354000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x21 DUP2 MSTORE PUSH32 0x475245415445525F5448414E5F5A45524F5F4C454E4754485F52455155495245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x4400000000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x5349474E41545552455F494C4C4547414C000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1E DUP2 MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F305F52455155495245440000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x494E56414C49445F4E45575F4F524445525F45504F4348000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1E DUP2 MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F335F52455155495245440000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x434F4D504C4554455F46494C4C5F4641494C4544000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x494E56414C49445F46494C4C5F50524943450000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x5245454E5452414E43595F494C4C4547414C0000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x13 DUP2 MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4F524445525F554E46494C4C41424C4500000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x494E56414C49445F53454E444552000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x18 DUP2 MSTORE PUSH32 0x4E454741544956455F5350524541445F52455155495245440000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x494E56414C49445F54585F5349474E4154555245000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x4C454E4754485F305F5245515549524544000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x80 DUP4 ADD SWAP1 PUSH2 0x5373 DUP5 DUP3 PUSH2 0x4C70 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x5386 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x5399 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x27A3 PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST DUP1 MLOAD PUSH2 0x120 DUP4 ADD SWAP1 PUSH2 0x53BE DUP5 DUP3 PUSH2 0x5362 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x53D1 PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0x5362 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x27A3 PUSH2 0x100 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x60 DUP4 ADD SWAP1 PUSH2 0x53F6 DUP5 DUP3 PUSH2 0x541C JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x5409 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x27A3 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x4C0A DUP2 PUSH2 0x58F6 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x4C01 JUMP JUMPDEST PUSH2 0x100 DUP2 ADD PUSH2 0x5442 DUP3 DUP12 PUSH2 0x4C01 JUMP JUMPDEST PUSH2 0x544F PUSH1 0x20 DUP4 ADD DUP11 PUSH2 0x4C01 JUMP JUMPDEST PUSH2 0x545C PUSH1 0x40 DUP4 ADD DUP10 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x5469 PUSH1 0x60 DUP4 ADD DUP9 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x5476 PUSH1 0x80 DUP4 ADD DUP8 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x5483 PUSH1 0xA0 DUP4 ADD DUP7 PUSH2 0x4C70 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0xC0 DUP4 ADD MSTORE PUSH2 0x5495 DUP2 DUP6 PUSH2 0x4C82 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0xE0 DUP4 ADD MSTORE PUSH2 0x54A9 DUP2 DUP5 PUSH2 0x4C82 JUMP JUMPDEST SWAP11 SWAP10 POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x54C5 DUP3 DUP7 PUSH2 0x4C01 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x54D7 DUP2 DUP6 PUSH2 0x4C82 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x54EB DUP2 DUP5 PUSH2 0x4C82 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x260A DUP2 DUP5 PUSH2 0x4C10 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x4C67 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x4C70 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x552F DUP3 DUP7 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x553C PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x4C01 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x54EB DUP2 DUP5 PUSH2 0x4C82 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x555C DUP3 DUP6 PUSH2 0x4C70 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x344B DUP2 DUP5 PUSH2 0x4C82 JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x557C DUP3 DUP8 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x5589 PUSH1 0x20 DUP4 ADD DUP7 PUSH2 0x541C JUMP JUMPDEST PUSH2 0x5596 PUSH1 0x40 DUP4 ADD DUP6 PUSH2 0x4C70 JUMP JUMPDEST PUSH2 0x54EB PUSH1 0x60 DUP4 ADD DUP5 PUSH2 0x4C70 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x55B1 DUP3 DUP6 PUSH2 0x4C79 JUMP JUMPDEST PUSH2 0x260A PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x4C01 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x260A DUP2 DUP5 PUSH2 0x4C82 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x4CB7 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4CC0 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4CF0 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4D20 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4D50 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4D80 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4DB0 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4E06 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4E36 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4E66 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4E96 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4EC6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4EF6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4F26 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4F56 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4F86 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4FB6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x4FE6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x5016 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x5046 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x509C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x50CC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x50FC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x512C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x515C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x518C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x51BC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x51EC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x521C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x5272 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x52A2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x52D2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x5302 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x2FBE DUP2 PUSH2 0x5332 JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x5362 JUMP JUMPDEST PUSH2 0x120 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x53AC JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x2FBE DUP3 DUP5 PUSH2 0x53E5 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x5837 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x5856 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 SWAP1 DUP2 MUL ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x5877 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2FBE DUP3 PUSH2 0x58B0 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x592E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x5916 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x27A3 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 REVERT 0xae DUP15 DUP15 PUSH1 0xF0 0x4e DUP9 0xe 0xcb 0xbd CALLDATACOPY 0xd8 CALLER 0xd3 TIMESTAMP MOD 0x1e DUP12 0x2c 0xb2 0x3f 0xd5 INVALID PUSH32 0xF93742CBE9FE9F6C6578706572696D656E74616CF50037000000000000000000 ",
+ "sourceMap": "931:615:26:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1277:42:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1277:42:28;;;;;;;;;;;;;;;;;;;;;;;;;4133:647:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4133:647:32;;;;;;;;;;;;;;;;;1367:42:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1367:42:28;;;;;;;;;;;;;;;;;1572:445:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1572:445:30;;;;;;;;;;;1870:2891:29;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1870:2891:29;;;;;;;;;;;;;;;;;2139:1515:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2139:1515:32;;;;;;;;;897:51:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;897:51:27;;;;;;;;;;;;;;;;;15747:260:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;15747:260:32;;;;;;;;;5260:659;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5260:659:32;;;;;;;;;2018:1079:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2018:1079:28;;;;;;;;;6478:632:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6478:632:32;;;;;;;;;2013:154:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2013:154:27;;;;;;;;;;;;;;;;;967:45:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;967:45:31;;;;;;;;;1357:395:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1357:395:32;;;;;;;;;2254:412:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2254:412:30;;;;;;;;;1166:71;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1166:71:30;;;;;;;;;7498:1507:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7498:1507:32;;;;;;;;;16201:419;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;16201:419:32;;;;;;;;;;;;;;;;;1046:63:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1046:63:30;;;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;3038:4848:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3038:4848:30;;;;;;;;;13713:1899:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;13713:1899:32;;;;;;;;;3414:374:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3414:374:28;;;;;;;;;1426:1456:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1426:1456:31;;;;;;;;;1157:666:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1157:666:27;;;;;;;;;4417:2261:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4417:2261:28;;;;;;;;;;;;;;;;;4019:124;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4019:124:28;;;;;;;;;1627:67;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1627:67:28;;;;;;;;;1779:27:43;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1779:27:43;;;;;;;;;;;;9462:1488:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;9462:1488:32;;;;;;;;;1301:33:44;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1301:33:44;;;;11338:1914:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;11338:1914:32;;;;;;;;;1064:36:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1064:36:31;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;;;1112:46:26;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1112:46:26;;;;1277:42:28;;;;;;;;;;;;;:::o;4133:647:32:-;4340:35;;:::i;:::-;4391:20;4442:9;4495:36;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;4414::32;;;-1:-1:-1;1043:6:83;-1:-1:-1;4437:304:32;4457:17;;;4437:304;;4534:131;4569:6;4576:1;4569:9;;;;;;;;;;;;;;;;;;4596:21;4618:1;4596:24;;;;;;;;;;;;;;;;;;4638:10;4649:1;4638:13;;;;;;;;;;;;;;;;;;4534:17;:131::i;:::-;4495:170;;4679:51;4694:16;4712:17;4679:14;:51::i;:::-;4476:3;;;;;4437:304;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;4133:647:32;;-1:-1:-1;;;4133:647:32:o;1367:42:28:-;;;;;;;;;;;;;;;:::o;1572:445:30:-;1708:27;;;1725:10;1708:27;1704:260;;1776:126;1814:4;1840:13;1875:9;;1776:126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1776:16:30;;-1:-1:-1;;;;;1776:126:30:i;:::-;1751:202;;;;;;;;;;;;;;;;-1:-1:-1;;1973:15:30;;;;:9;:15;;;;;;;;:30;;;;;;;;;;;:37;;;;2006:4;1973:37;;;1572:445::o;1870:2891:29:-;2106:59;;:::i;:::-;2571:39;;:::i;:::-;2646:40;;:::i;:::-;2755:20;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;2435:24:29;;;;;2407:25;;;;:52;;;;2497:24;;;2469:25;;;:52;2613:23;2435:9;2613:12;:23::i;:::-;2571:65;;2689:24;2702:10;2689:12;:24::i;:::-;2646:67;;2778:26;:24;:26::i;:::-;2755:49;;2875:132;2908:9;2931:13;2958:12;2984:13;2875:19;:132::i;:::-;3017:135;3050:10;3074:14;3102:12;3128:14;3017:19;:135::i;:::-;3162:39;3179:9;3190:10;3162:16;:39::i;:::-;3278:195;3319:9;3342:10;3366:13;:41;;;3421:14;:42;;;3278:27;:195::i;:::-;3597:23;;:46;;;;3717;;3257:216;;-1:-1:-1;3518:255:29;;3547:9;;3570:13;;3597:46;;3518:15;:255::i;:::-;3864:24;;;;;:47;;;;3986;;3783:260;;3812:10;;3836:14;;3864:47;;;3783:15;:260::i;:::-;4095:205;4126:9;4149:12;4175:13;:23;;;4212:13;:41;;;4267:18;:23;;;4095:17;:205::i;:::-;4310:209;4341:10;4365:12;4391:14;:24;;;4429:14;:42;;;4485:18;:24;;;4310:17;:209::i;:::-;4584:134;4617:9;4640:10;4664:12;4690:18;4584:19;:134::i;:::-;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;1870:2891:29;;-1:-1:-1;;;;1870:2891:29:o;2139:1515:32:-;2310:30;;:::i;:::-;2403;2436:104;2468:5;2487:20;2521:9;2436:18;:104::i;:::-;2403:137;;3116:3;3037:17;2972;2966:24;2870:2;2851:17;2847:26;2762:7;2691:3;2661:532;3209:7;3206:2;;;3261:17;3255:24;3242:11;3235:45;3355:2;3336:17;3332:26;3326:33;3321:2;3308:11;3304:20;3297:63;3435:2;3416:17;3412:26;3406:33;3401:2;3388:11;3384:20;3377:63;3515:2;3496:17;3492:26;3486:33;3481:2;3468:11;3464:20;3457:63;3206:2;-1:-1:-1;2139:1515:32;;;;;;;:::o;897:51:27:-;;;;;;;;;;;;;;;:::o;15747:260:32:-;15856:20;939:6:83;;15856:20:32;;939:6:83;;938:7;917:72;;;;;;;;;;;;;;-1:-1:-1;;1043:6:83;:13;;;;1052:4;1043:13;;;15879::32;;;15902:99;15922:17;;;15902:99;;15960:30;15980:6;15987:1;15980:9;;;;;;;;;;;;;;;;;;15960:19;:30::i;:::-;15941:3;;15902:99;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;15747:260:32:o;5260:659::-;5473:35;;:::i;:::-;5524:20;5575:9;5628:36;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;5547::32;;;-1:-1:-1;1043:6:83;-1:-1:-1;5570:310:32;5590:17;;;5570:310;;5667:137;5708:6;5715:1;5708:9;;;;;;;;;;;;;;;;;;5735:21;5757:1;5735:24;;;;;;;;;;;;;;;;;;5777:10;5788:1;5777:13;;;;;;;;;;;;;;;;;;5667:23;:137::i;:::-;5628:176;;5818:51;5833:16;5851:17;5818:14;:51::i;:::-;5609:3;;;;;5570:310;;2018:1079:28;2122:20;939:6:83;;2122:20:28;;;;;;939:6:83;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;2145:26:28;:24;:26::i;:::-;2122:49;-1:-1:-1;2453:26:28;;;2469:10;2453:26;:52;;2495:10;2453:52;;;2490:1;2453:52;2673:24;;;;;;;;:10;:24;;;;;;;;:39;;;;;;;;;;2429:76;;-1:-1:-1;2636:1:28;2617:20;;;-1:-1:-1;2673:39:28;-1:-1:-1;2801:29:28;;;2780:100;;;;;;;;;;;;;;2920:24;;;;;;;;:10;:24;;;;;;;;:39;;;;;;;;;;;;;;:55;;;2990:100;;;;;2962:13;;2990:100;;;;;;;;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;;;2018:1079:28:o;6478:632:32:-;6671:35;;:::i;:::-;6722:20;6773:9;6826:36;;:::i;:::-;6745:6;:13;6722:36;;6785:1;6773:13;;6768:303;6788:17;;;6768:303;;6865:130;6899:6;6906:1;6899:9;;;;;;;;;;;;;;;;;;6926:21;6948:1;6926:24;;;;;;;;;;;;;;;;;;6968:10;6979:1;6968:13;;;;;;;;;;;;;;;;;;6865:16;:130::i;:::-;6826:169;;7009:51;7024:16;7042:17;7009:14;:51::i;:::-;6807:3;;;;;6768:303;;;6478:632;;;;;;;;:::o;2013:154:27:-;2134:26;;;2104:7;2134:26;;;:12;:26;;;;;;;;2013:154;;;;:::o;967:45:31:-;;;;;;;;;;;;;;;:::o;1357:395:32:-;1548:30;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;1608:109:32;1645:5;1664:20;1698:9;1608:23;:109::i;:::-;1165:5:83;1156:14;;;;;;1594:123:32;1357:395;-1:-1:-1;;;;1357:395:32:o;2254:412:30:-;2408:21;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;2432:26:30;:24;:26::i;:::-;2468:32;;;;;;;;:17;:32;;;;;;;;:50;;;;;;;;;;;;;;:61;;;;;;;;;;2544:115;2468:32;;-1:-1:-1;2468:50:30;;2544:115;;;;2468:61;;2544:115;;;;;;;;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;2254:412:30:o;1166:71::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;7498:1507:32:-;7696:35;;:::i;:::-;7747:27;7816:20;7867:9;8253:37;8444:36;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;7777:9:32;;:6;;1043::83;7777:9:32;;;;;;;;;;;;;;:24;;;7747:54;;7839:6;:13;7816:36;;7879:1;7867:13;;7862:1104;7882:17;;;7862:1104;;8156:14;8129:6;8136:1;8129:9;;;;;;;;;;;;;;;;;;:24;;:41;;;;8293:70;8301:20;8323:16;:39;;;8293:7;:70::i;:::-;8253:110;;8483:136;8518:6;8525:1;8518:9;;;;;;;;;;;;;;;;;;8545:29;8592:10;8603:1;8592:13;;;;;;;;;8483:136;8444:175;;8704:51;8719:16;8737:17;8704:14;:51::i;:::-;8853:39;;;;:63;-1:-1:-1;8849:107:32;;8936:5;;8849:107;7901:3;;;;;7862:1104;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;7498:1507:32;;;-1:-1:-1;;;;;7498:1507:32:o;16201:419::-;16301:20;16344;16390:38;16484:9;16367:6;:13;16344:36;;16456:12;16431:38;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;16390:79;;16496:1;16484:13;;16479:108;16499:17;;;16479:108;;16553:23;16566:6;16573:1;16566:9;;;;;;;;;;;;;;;;;;16553:12;:23::i;:::-;16537:10;16548:1;16537:13;;;;;;;;;;;;;;;;;;:39;16518:3;;16479:108;;1046:63:30;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;91:20:82:-;;;;;;:::o;3038:4848:30:-;3200:12;3390:22;3631:27;3752:7;3769:9;3788;3807:17;6871:24;3268:1;3249:9;:16;:20;3228:97;;;;;;;;;;;;;;;;3421:23;:9;:21;:23::i;:::-;3415:30;;;;-1:-1:-1;3543:29:30;3518:55;;;;3497:123;;;;;;;;;;;;;;3675:16;3661:31;;;;;;;;;;3631:61;-1:-1:-1;4174:21:30;4157:13;:38;;;;;;;;;4153:3383;;;4211:27;;;;;;;;;;;4153:3383;4520:21;4503:13;:38;;;;;;;;;4499:3037;;;4582:16;;:21;4557:97;;;;;;;;;;;;;;4678:5;;-1:-1:-1;4697:14:30;;4499:3037;4784:20;4767:13;:37;;;;;;;;;4763:2773;;;4845:16;;4865:2;4845:22;4820:99;;;;;;;;;;;;;;4943:9;4953:1;4943:12;;;;;;;;;;;;;;;;;;;;;4937:19;;-1:-1:-1;4974:24:30;:9;4996:1;4974:24;:21;:24;:::i;:::-;4970:28;-1:-1:-1;5016:25:30;:9;5038:2;5016:25;:21;:25;:::i;:::-;5012:29;;5067:102;5094:4;5116:1;5135;5154;5067:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;5067:102:30;;;;;5193:26;;;;;;;;;-1:-1:-1;5067:102:30;-1:-1:-1;5233:14:30;;-1:-1:-1;5233:14:30;4763:2773;5324:21;5307:13;:38;;;;;;;;;5303:2233;;;5386:16;;5406:2;5386:22;5361:99;;;;;;;;;;;;;;5484:9;5494:1;5484:12;;;;;;;;;;;;;;;;;;;;;5478:19;;-1:-1:-1;5515:24:30;:9;5537:1;5515:24;:21;:24;:::i;:::-;5511:28;-1:-1:-1;5557:25:30;:9;5579:2;5557:25;:21;:25;:::i;:::-;5553:29;;5608:225;5739:4;5645:116;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;5645:116:30;;;5635:127;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;5635:127:30;;;;;;;;;;;;-1:-1:-1;5608:225:30;;;;;;;;;;-1:-1:-1;5635:127:30;-1:-1:-1;5780:1:30;;5799;;-1:-1:-1;5818:1:30;;5608:225;;5303:2233;6081:20;6064:13;:37;;;;;;;;;6060:1476;;;6127:116;6167:4;6189:13;6220:9;6127:22;:116::i;:::-;6117:126;-1:-1:-1;6257:14:30;;6060:1476;6770:23;6753:13;:40;;;;;;;;;6749:787;;;6898:26;:9;:24;:26::i;:::-;7009:32;;;;;;;;:17;:32;;;;;;;;:50;;;;;;;;;;6871:53;;-1:-1:-1;7009:50:30;;7008:51;7004:102;;;7086:5;7079:12;;;;7004:102;7129:153;7172:16;7206:4;7228:13;7259:9;7129:25;:153::i;6749:787::-;7418:23;7401:13;:40;;;;;;;;;7397:139;;;7467:15;;;;:9;:15;;;;;;;;:30;;;;;;;;;;;;;;-1:-1:-1;7511:14:30;;7397:139;7848:31;;;;;;;;;;;3038:4848;;;;;;;;;;;;;:::o;13713:1899:32:-;13896:35;;:::i;:::-;13947:27;14012:20;14063:9;14453:37;14759;15050:36;;:::i;:::-;13977:6;13984:1;13977:9;;;;;;;;;;;;;;;;;;:24;;;13947:54;;14035:6;:13;14012:36;;14075:1;14063:13;;14058:1515;14078:17;;;14058:1515;;14357:14;14330:6;14337:1;14330:9;;;;;;;;;;;;;;;;;;;:24;;:41;14523:39;;14493:70;;14501:20;;14493:7;:70::i;:::-;14453:110;;14799:170;14838:6;14845:1;14838:9;;;;;;;;;;;;;;;;;;:26;;;14882:6;14889:1;14882:9;;;;;;;;;;;;;;;;;;:26;;;14926:29;14799:21;:170::i;:::-;14759:210;;15089:135;15123:6;15130:1;15123:9;;;;;;;;;;;;;;;;;;15150:29;15197:10;15208:1;15197:13;;;;;;;;;15089:135;15050:174;;15309:51;15324:16;15342:17;15309:14;:51::i;:::-;15460:39;;:63;-1:-1:-1;15456:107:32;;15543:5;;15456:107;14097:3;;;;;14058:1515;;;13713:1899;;;;;;;;;;;:::o;3414:374:28:-;3590:30;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;3650:103:28;3681:5;3700:20;3734:9;3650:17;:103::i;1426:1456:31:-;1640:21;;1730:23;;1640:35;:21;:35;1619:100;;;;;;;;;;;;;;1756:113;1774:94;1809:4;1827:13;1854:4;;1774:94;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1774:21:31;;-1:-1:-1;;;;;1774:94:31:i;:::-;1756:17;:113::i;:::-;1956:29;;;;:12;:29;;;;;;1730:139;;-1:-1:-1;1956:29:31;;1955:30;1934:92;;;;;;;;;;;;;;2112:27;;;2129:10;2112:27;2108:410;;2214:137;2252:15;2289:13;2324:9;;2214:137;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2214:16:31;;-1:-1:-1;;;;;2214:137:31:i;:::-;2189:216;;;;;;;;;;;;;;;;2470:21;:37;;;;;;;;;;2108:410;2559:29;;;;:12;:29;;;;;;;:36;;;;2591:4;2559:36;;;2626:32;2634:4;;2653;;;;2626:32;2653:4;;;;2626:32;;;;;;;;;;;;;;;;;;;;;;;;2605:95;;;;;;;;;;;;;;;;2788:27;;;2805:10;2788:27;2784:92;;2831:21;:34;;;;;;2784:92;1426:1456;;;;;;;:::o;1157:666:27:-;259:5:82;;1254:30:27;;;;;;259:5:82;;245:10;:19;224:85;;;;;;;;;;;;;;1299:10:27;1254:56;;1405:18;:29;;;:31;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1405:31:27;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1405:31:27;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;1405:31:27;;;;;;;;;1474:26;;;;;;;:12;:26;;;;;;1383:53;;-1:-1:-1;1474:26:27;;;-1:-1:-1;1531:31:27;;1510:104;;;;;;;;;;;;;;1674:26;;;;;;;:12;:26;;;;;;;:47;;;;;;;;;;1736:80;;;;;1674:26;;1796:10;;1736:80;;;;;;;;;;1157:666;;;;:::o;4417:2261:28:-;4504:26;;:::i;:::-;4602:19;4615:5;4602:12;:19::i;:::-;4580;;;;:41;;;;4703:27;;;:6;:27;;;;;;;;4663:37;;;:67;5032:22;;;;:27;5028:157;;;5105:38;5099:45;5075:69;;;;5158:16;;5028:157;5498:22;;;;:27;5494:157;;;5571:38;5565:45;;5494:157;5745:22;;;;5704:37;;;;:63;5700:179;;5813:24;5807:31;;5700:179;6003:27;;;;5984:15;:46;5980:157;;6076:19;6070:26;;5980:157;6206:19;;;;;6196:30;;;;:9;:30;;;;;;;;;6192:143;;;6272:21;6266:28;;6192:143;6402:10;;;;6359:18;;6348:30;;;;;;;;:10;:30;;;;;;;;6379:19;;;;6348:51;;;;;;;;;;:64;6344:177;;;6458:21;6452:28;;6344:177;6624:20;6594:51;;;4417:2261;-1:-1:-1;4417:2261:28:o;4019:124::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;4110:26:28;4130:5;4110:19;:26::i;:::-;-1:-1:-1;1165:5:83;1156:14;;;;;;4019:124:28:o;1627:67::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;1779:27:43:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;9462:1488:32:-;9646:35;;:::i;:::-;9697:27;9762:20;9813:9;10199:37;10390:36;;:::i;:::-;9727:6;9734:1;9727:9;;;;;;;;;;;;;;;;;;:24;;;9697:54;;9785:6;:13;9762:36;;9825:1;9813:13;;9808:1103;9828:17;;;9808:1103;;10102:14;10075:6;10082:1;10075:9;;;;;;;;;;;;;;;;;;:24;;:41;;;;10239:70;10247:20;10269:16;:39;;;10239:7;:70::i;:::-;10199:110;;10429:135;10463:6;10470:1;10463:9;;;;;;;;;;;;;;;;;;10490:29;10537:10;10548:1;10537:13;;;;;;;;;10429:135;10390:174;;10649:51;10664:16;10682:17;10649:14;:51::i;:::-;10798:39;;;;:63;-1:-1:-1;10794:107:32;;10881:5;;10794:107;9847:3;;;;;9808:1103;;;9462:1488;;;;;;;;;;:::o;1301:33:44:-;;;;:::o;11338:1914:32:-;11535:35;;:::i;:::-;11586:27;11651:20;11702:9;12092:37;12398;12689:36;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;11616:9:32;;:6;;1043::83;11616:9:32;;;;;;;;;;;;;;:24;;;11586:54;;11674:6;:13;11651:36;;11714:1;11702:13;;11697:1516;11717:17;;;11697:1516;;11996:14;11969:6;11976:1;11969:9;;;;;;;;;;;;;;;;;;;:24;;:41;12162:39;;12132:70;;12140:20;;12132:7;:70::i;:::-;12092:110;;12438:170;12477:6;12484:1;12477:9;;;;;;;;;12438:170;12398:210;;12728:136;12763:6;12770:1;12763:9;;;;;;;;;;;;;;;;;;12790:29;12837:10;12848:1;12837:13;;;;;;;;;12728:136;12689:175;;12949:51;12964:16;12982:17;12949:14;:51::i;:::-;13100:39;;:63;-1:-1:-1;13096:107:32;;13183:5;;13096:107;11736:3;;;;;11697:1516;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;11338:1914:32;;;-1:-1:-1;;;;;;11338:1914:32:o;1064:36:31:-;;;;;;:::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;425:69;333:167;:::o;1112:46:26:-;;;;;;;;;;;;;;;;;;;:::o;6995:1583:28:-;7160:30;;:::i;:::-;7234:26;;:::i;:::-;7324:20;7629:33;7745:30;7263:19;7276:5;7263:12;:19::i;:::-;7234:48;;7347:26;:24;:26::i;:::-;7324:49;;7446:120;7479:5;7498:9;7521:12;7547:9;7446:19;:120::i;:::-;7665:70;7673:5;:22;;;7697:9;:37;;;7665:7;:70::i;:::-;7629:106;;7778:55;7785:20;7807:25;7778:6;:55::i;:::-;7745:88;;7872:185;7901:5;7920:9;7943:20;7977:22;8013:11;:34;;;7872:15;:185::i;:::-;8127:51;8148:5;8155:22;8127:20;:51::i;:::-;8113:65;;8231:181;8262:5;8281:12;8307:9;:19;;;8340:9;:37;;;8391:11;8231:17;:181::i;:::-;8451:91;8476:5;8495:12;8521:11;8451;:91::i;:::-;6995:1583;;;;;;;;;:::o;1771:648:46:-;1964:39;;2005:40;;1956:90;;1964:39;1956:7;:90::i;:::-;1914:132;;2106:39;;;;;2147:40;;;;2098:90;;2106:39;2098:7;:90::i;:::-;2056:39;;;:132;2238:29;;;;;2269:30;;;;2230:70;;2238:29;2230:7;:70::i;:::-;2198:29;;;:102;2350:29;;;;;2381:30;;;;2342:70;;2350:29;2342:7;:70::i;:::-;2310:29;;;;:102;;;;-1:-1:-1;1771:648:46:o;4841:307:31:-;4980:21;;4924:7;;4980:21;;4924:7;5036:36;;:74;;5088:22;5036:74;;;5075:10;5036:74;5011:99;4841:307;-1:-1:-1;;;4841:307:31:o;11221:1268:28:-;11513:21;;:52;;11544:20;11513:52;11492:115;;;;;;;;;;;;;;11687:19;;;;:33;;;11683:170;;11761:19;;;;:33;;11784:10;11761:33;11736:106;;;;;;;;;;;;;;11931:18;;;;:32;;;11927:169;;12026:12;12004:34;;:5;:18;;;:34;;;11979:106;;;;;;;;;;;;;;;;12186:37;;;;:42;12182:301;;;12269:146;12307:9;:19;;;12348:5;:18;;;12388:9;12269:16;:146::i;:::-;12244:228;;;;;;;;;;;;;;;;11221:1268;;;;:::o;4931:1075:29:-;5885:64;5893:9;:26;;;5921:10;:27;;;5885:7;:64::i;:::-;5805;5813:9;:26;;;5841:10;:27;;;5805:7;:64::i;:::-;:144;;5784:215;;;;;;;;;;;;;;4931:1075;;:::o;6742:4784::-;7014:59;;:::i;:::-;7185:37;7303;7511:38;7632;7225:68;7233:9;:26;;;7261:31;7225:7;:68::i;:::-;7185:108;;7343:158;7382:9;:26;;;7422:9;:26;;;7462:29;7343:25;:158::i;:::-;7303:198;;7552:70;7560:10;:27;;;7589:32;7552:7;:70::i;:::-;7511:111;;7673:161;7712:10;:27;;;7753:10;:27;;;7794:30;7673:25;:161::i;:::-;7632:202;-1:-1:-1;8592:63:29;;;8588:1672;;8722:24;;;;;;:80;;;8816:24;;:47;;:80;;;8959:24;:47;8910:23;;:46;;:96;9299:26;;;;9343;;;;9387:23;;:46;;;;9256:191;;9343:26;9256:25;:191::i;:::-;9207:23;;:240;8588:1672;;;9528:23;;:78;;;9620:23;;:46;;;;:78;;;9762:23;;:46;;;9712:24;;;;;:96;;;;10098:27;;;;10143;;;;10188:24;;:47;10056:193;;10143:27;10056:24;:193::i;:::-;10006:24;;;;;:47;:243;8588:1672;10382:23;;:46;10442:24;;;;;:47;;10361:138;;10382:46;10361:7;:138::i;:::-;10313:45;;;:186;10627:23;;:46;10687:26;;;;10727:18;;;;10588:167;;10627:46;10687:26;10588:25;:167::i;:::-;10549:23;;:36;;:206;10843:23;;:46;;;10903:26;;;;10943:18;;;;10804:167;;10843:46;10903:26;10804:25;:167::i;:::-;10765:23;;:36;;:206;11101:24;;;;:47;11162:27;;;;11203:19;;;;11062:170;;11101:47;11162:27;11062:25;:170::i;:::-;11022:18;:24;;;:37;;:210;;;;;11282:170;11321:18;:24;;;:47;;;11382:10;:27;;;11423:10;:19;;;11282:25;:170::i;:::-;11242:24;;;;:37;;:210;6742:4784;;;;;;;;;;:::o;12927:2440:28:-;13322:25;;;13301:92;;;;;;;;;;;;;;13621:46;;;;13600:106;;;;;;;;;;;;;;13988:5;:22;;;13914:70;13922:9;:37;;;13961:22;13914:7;:70::i;:::-;:96;;13893:157;;;;;;;;;;;;;;15261:55;15269:5;:22;;;15293;15261:7;:55::i;:::-;15177;15185:22;15209:5;:22;;;15177:7;:55::i;:::-;:139;;15156:204;;;;;;;;;;;;;;12927:2440;;;;;:::o;9384:792::-;9662:72;9670:27;9699:11;:34;;;9662:7;:72::i;:::-;9642:17;;;;:6;:17;;;;;;;;;:92;;;;9821:25;;;;9789:18;;9910:34;;9958;;;;10006:24;;;;10044;;;;10105:20;;;;10139;;;;9771:398;;9642:17;;9771:398;;;;;;;;;;;;;;9860:12;;9886:10;;9910:34;;9958;;10006:24;;10139:20;9771:398;;;;;;;;;;9384:792;;;;;:::o;11972:2233:29:-;12247:14;12219:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:25;;:42;;12247:14;;12219:42;;12247:14;12219:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12305:202;12339:9;:24;;;12377:9;:22;;;12413:10;:23;;;12450:18;:24;;;:47;;;12305:20;:202::i;:::-;12551:25;;;;12590:23;;12627:22;;12663:23;;:46;;;12517:202;;12551:25;12590:23;12627:22;12517:20;:202::i;:::-;12729:189;12763:9;:24;;;12801:9;:22;;;12837:12;12863:18;:45;;;12729:20;:189::i;:::-;12951:185;12985:12;13011:9;:22;;;13047:9;:29;;;13090:18;:23;;;:36;;;12951:20;:185::i;:::-;13146:188;13180:12;13206:10;:23;;;13243:10;:30;;;13287:18;:24;;;:37;;;13146:20;:188::i;:::-;13404:10;:30;;;13371:63;;:9;:29;;;:63;;;13367:832;;;13450:301;13488:12;13518;13548:9;:29;;;13595:142;13624:18;:23;;;:36;;;13682:18;:24;;;:37;;;13595:7;:142::i;:::-;13450:20;:301::i;:::-;13367:832;;;13782:195;13820:12;13850;13880:9;:29;;;13927:18;:23;;;:36;;;13782:20;:195::i;:::-;13991:197;14029:12;14059;14089:10;:30;;;14137:18;:24;;;:37;;;13991:20;:197::i;1011:10099:42:-;5031:4;5025:11;;5321:66;5314:4;5291:28;;;5284:104;;;;1199:30;5445:4;5422:28;;6444:59;;;6770:19;;5736:26;;;6750:40;;;6883:23;;;6877:30;6853:22;;;6846:62;6979:23;;;6973:30;6949:22;;;6942:62;7082:23;;;7076:30;7052:22;;;7045:62;7197:4;7179:23;;7173:30;7149:22;;;7142:62;7297:4;7279:23;;7273:30;7249:22;;;7242:62;7397:4;7379:23;;7373:30;7349:22;;;7342:62;7495:4;7477:23;;7471:30;7447:22;;;7440:62;7594:5;7576:24;;7570:31;7545:23;;;7538:64;7699:5;7681:24;;7675:31;7650:23;;;7643:64;7787:5;7769:24;;7763:31;;7738:23;;;7731:64;;;7895:5;7877:24;;7871:31;7846:23;;;7839:64;7979:5;8106:74;;8268:24;8340:19;;7962:23;;;8544:34;;;5025:11;;5422:28;;;;6536:27;;;;5736:26;;8606:22;;;;8388:23;;;;8464:4;8445:24;;8441:35;6190:1;8698:237;8721:13;8718:1;8715:20;8698:237;;;8791:19;;8771:40;;8860:4;8843:22;;;;8898:23;;;;8749:1;8742:9;8698:237;;;-1:-1:-1;;;;9045:31:42;;;9029:13;9010:33;;;9003:74;;;;9171:17;;9165:24;9237:19;;9441:34;;;9037:4;9503:22;;;;9285:23;;;;9361:4;9342:24;;9338:35;9610:1;9596:237;9619:13;9616:1;9613:20;9596:237;;;9689:19;;9669:40;;9758:4;9741:22;;;;9796:23;;;;9647:1;9640:9;9596:237;;;-1:-1:-1;;;9902:46:42;;;-1:-1:-1;10133:33:42;;;10003:4;9981:27;;;10108:59;;;10281:19;;10472:34;;;9981:27;;10534:22;;;;10329:23;;;;10281:19;10405:4;10386:24;;10382:35;-1:-1:-1;10613:237:42;10636:13;10633:1;10630:20;10613:237;;;10706:19;;10686:40;;10775:4;10758:22;;;;10813:23;;;;10664:1;10657:9;10613:237;;;-1:-1:-1;;;10928:46:42;;;;;10902:73;;-1:-1:-1;11041:4:42;11034:25;-1:-1:-1;;;;;1011:10099:42;;;;;:::o;8809:332:28:-;8927:26;;:::i;:::-;8956:19;8969:5;8956:12;:19::i;:::-;8927:48;;9014:35;9032:5;9039:9;9014:17;:35::i;:::-;9086:48;9107:5;9114:9;:19;;;9086:20;:48::i;16922:513:32:-;17102:30;;:::i;:::-;17162:103;17193:5;17212:20;17246:9;17162:17;:103::i;:::-;17296:34;;;;17148:117;;-1:-1:-1;17296:58:32;;17275:125;;;;;;;;;;;;;502:208:84;588:7;632:6;;;;611:70;;;;;;;;;;;;;;-1:-1:-1;698:5:84;;;502:208;;;;;:::o;8313:448:80:-;8397:13;8458:1;8447;:8;:12;8426:92;;;;;;;;;;;;;;;;8568:8;;8566:1;;8568:12;;;;8566:15;;;;;;;;;;8680:8;;8676:16;;8705:17;;;-1:-1:-1;8566:15:80;;;;;;;8313:448::o;13290:490::-;13411:14;13474:5;13482:2;13474:10;13462:1;:8;:22;;13441:107;;;;;;;;;;;;;;;;-1:-1:-1;13727:13:80;13629:2;13727:13;13721:20;;13290:490::o;8292:1482:30:-;8507:135;;8455:12;;8483:21;;8543:48;;8507:135;;8605:4;;8623:9;;8507:135;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;8507:135:30;;;49:4:-1;25:18;;;61:17;;8507:135:30;182:15:-1;8507:135:30;;;;179:29:-1;;;;160:49;;8943:15:30;;8507:135;;-1:-1:-1;49:4;25:18;;;8816:13:30;8763:3;8735:380;9136:7;9156:422;;;;9596:1;9591:143;;;;9129:605;;9156:422;9246:66;9243:1;9236:77;9341:66;9337:2;9330:78;9436:66;9432:2;9425:78;9531:1;9527:2;9520:13;9560:3;9557:1;9550:14;9591:143;-1:-1:-1;;9706:14:30;;8292:1482;-1:-1:-1;;;;;8292:1482:30:o;8956:482:80:-;9043:14;9106:2;9094:1;:8;:14;;9073:99;;;;;;;;;;;;;;;;9224:29;9236:1;9250:2;9239:1;:8;:13;9224:11;:29::i;:::-;9356:8;;9352:17;;9382;;;-1:-1:-1;9215:38:80;8956:482::o;10213:1561:30:-;10465:165;;10413:12;;10441:21;;10501:51;;10465:165;;10566:4;;10512:13;;10611:9;;10465:165;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;10465:165:30;;;49:4:-1;25:18;;;61:17;;10465:165:30;182:15:-1;10465:165:30;;;;179:29:-1;;;;160:49;;10937:15:30;;10465:165;;-1:-1:-1;49:4;25:18;;;10805:16:30;10751:3;10723:389;11133:7;11153:425;;;;11596:1;11591:143;;;;11126:608;;11153:425;11246:66;11243:1;11236:77;11341:66;11337:2;11330:78;11436:66;11432:2;11425:78;11531:1;11527:2;11520:13;11560:3;11557:1;11550:14;11591:143;11712:7;11706:14;11695:25;;11126:608;-1:-1:-1;;;10213:1561:30;;;;;;;:::o;3123:425:47:-;3287:21;3345:15;;;3324:78;;;;;;;;;;;;;;3429:82;3450:26;3458:9;3469:6;3450:7;:26::i;:::-;3490:11;3429:7;:82::i;:::-;3413:98;3123:425;-1:-1:-1;;;;3123:425:47:o;3175:1222:31:-;827:146:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;6:49;;827:146:53;;;;;;;;817:157;;3339:14:31;;;;;;827:146:53;;;;817:157;;;;827:146;817:157;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;817:157:53;;;;;;;;;;;3456:15:31;;817:157:53;;-1:-1:-1;3456:15:31;;-1:-1:-1;817:157:53;;-1:-1:-1;817:157:53;;3456:15:31;;;-1:-1:-1;3456:15:31;817:157:53;3456:15:31;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;3456:15:31;;;;;;;;;;;;3834:26;;;3960:15;;3953:29;;;;-1:-1:-1;4105:42:31;4086:62;;;;4069:15;;;4062:87;;;;-1:-1:-1;;4199:2:31;4187:15;;4180:33;-1:-1:-1;;4354:3:31;4336:22;;;;3175:1222;-1:-1:-1;3175:1222:31:o;1834:924:44:-;1985:18;;;2297:2;2291:9;2329:66;2314:82;;2434:14;;;2427:40;2564:2;2552:15;;2545:35;;;;2716:2;2698:21;;;1834:924::o;4211:202:48:-;4300:17;4345:35;4363:16;4373:5;4363:9;:16::i;1371:135:84:-;1456:7;1490:1;1486;:5;:13;;1498:1;1486:13;;;-1:-1:-1;1494:1:84;;1479:20;-1:-1:-1;1371:135:84:o;16651:887:28:-;16802:30;;:::i;:::-;16897:34;;;:59;;;17078:22;;;;17114;;;;17003:143;;16934:22;;17003:25;:143::i;:::-;16966:180;;;17270:22;;;;17306:14;;;;17183:147;;16966:180;17270:22;17183:25;:147::i;:::-;17156:24;;;:174;17442:22;;;;17478:14;;;;17367:135;;17406:22;;17367:25;:135::i;:::-;17340:24;;;:162;16651:887;;;;:::o;17848:932::-;18055:14;18027:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:25;;:42;;18055:14;;18027:42;;18055:14;18027:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18079:170;18113:5;:20;;;18147:5;:18;;;18179:12;18205:11;:34;;;18079:20;:170::i;:::-;18259;18293:5;:20;;;18327:12;18353:5;:18;;;18385:11;:34;;;18259:20;:170::i;:::-;18439:165;18473:12;18499:5;:18;;;18531:5;:25;;;18570:11;:24;;;18439:20;:165::i;:::-;18614:159;18648:12;18674;18700:5;:25;;;18739:11;:24;;;18614:20;:159::i;716:230:84:-;802:7;837:5;;;873:6;;;;852:69;;;;;;;;;;;;;;938:1;931:8;;716:230;;;;;;:::o;51:288::-;137:7;;164:6;;160:45;;;193:1;186:8;;;;160:45;-1:-1:-1;226:5:84;;;230:1;226;:5;262;;;;;;;;:10;241:73;;;;;;;;;;;;;1012:624:47;1180:21;1238:15;;;1217:78;;;;;;;;;;;;;;1328:114;1366:9;1393:11;1422:6;1328:20;:114::i;:::-;1327:115;1306:176;;;;;;;;;;;;;1959:889;2126:21;2184:15;;;2163:78;;;;;;;;;;;;;;2274:113;2311:9;2338:11;2367:6;2274:19;:113::i;:::-;2273:114;2252:175;;;;;;;;;;;;;;2649:162;2670:106;2695:26;2703:9;2714:6;2695:7;:26::i;:::-;2739:23;2747:11;2760:1;2739:7;:23::i;:::-;2670:7;:106::i;2482:5147:27:-;3031:19;3290:18;2718:1;2709:6;:10;:24;;;;;2731:2;2723:10;;:4;:10;;;;2709:24;2705:4918;;;2822:16;;2841:1;-1:-1:-1;2797:109:27;;;;;;;;;;;;;;-1:-1:-1;;3153:2:27;3138:18;;;3111:46;3179:66;3107:156;3311:26;;;;:12;:26;;;;;;;;;;3422:24;;;3397:109;;;;;;;;;;;;;;4923:2;4917:9;5239:15;5234:2;5222:9;5216:16;5212:25;5208:47;5392:14;5387:3;5383:24;5374:7;5370:38;5676:66;5667:7;5660:83;6160:3;6156:1;6147:7;6143:15;6136:28;6216:42;6210:4;6206:53;6201:2;6192:7;6188:16;6181:79;6310:42;6306:2;6302:51;6297:2;6288:7;6284:16;6277:77;6397:6;6391:3;6382:7;6378:17;6371:33;6563:3;6554:7;6550:17;6645:206;6665:5;6655:8;6652:19;6645:206;;;6714:16;;6697:34;;6778:2;6815:18;;;;6764:17;6645:206;;;7417:3;7346:7;7292;7285:5;7281:19;7208:7;7142:1;7067:10;7004:3;6978:512;7517:7;7510:15;7507:2;;;7564:16;7555:7;7548:33;7507:2;4724:2889;;;;;;2482:5147;;;;;;:::o;15564:816:28:-;15828:21;;16220:20;;15828:52;;15859:20;15828:52;15807:115;;;;;;;;;;;;;;15996:19;;;;:33;;;15992:170;;16070:19;;;;:33;;16093:10;16070:33;16045:106;;;;;;;;;;;;;;16243:26;:24;:26::i;:::-;16300:18;;16220:49;;-1:-1:-1;16300:34:28;;;;;;;16279:94;;;;;;;;;;;;;;15564:816;;;:::o;10478:422::-;10626:20;;;;:9;:20;;;;;;;:27;;;;10649:4;10626:27;;;10743:25;;;;10711:18;;10829:20;;;;10863;;;;10691:202;;10636:9;;10691:202;;;;;;;;;;;;;;10782:10;;10863:20;10691:202;;;;;;;;;;10478:422;;:::o;10268:886:80:-;10389:14;10452:5;10460:2;10452:10;10440:1;:8;:22;;10419:135;;;;;;;;;;;;;;;;-1:-1:-1;11056:13:80;10801:2;11056:13;11050:20;11072:42;11046:69;;10268:886::o;345:151:84:-;431:7;454:9;470:1;466;:5;;;;;;;;;345:151;-1:-1:-1;;;;345:151:84:o;4553:1678:48:-;777:457;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;777:457:48;;;;;;;;767:468;;4639:14;;;;;;;;777:457;;;;;767:468;;;;777:457;767:468;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;767:468:48;;;;;;;;;;;4763:20;;;;4753:31;;767:468;;-1:-1:-1;4763:20:48;-1:-1:-1;767:468:48;;-1:-1:-1;767:468:48;;4753:31;;;-1:-1:-1;4753:31:48;767:468;4753:31;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;4753:31:48;;;;;;;;;;;4833:20;;;;4823:31;;4753;;-1:-1:-1;4833:20:48;-1:-1:-1;4753:31:48;;-1:-1:-1;4753:31:48;;4823;;;-1:-1:-1;4823:31:48;4753;4823;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;;;;365:33;;4823:31:48;;;;;;;;;;5620:14;;;5763:11;;5670:3;5659:15;;5800:11;;5710:3;5699:15;;;5837:11;;5903:24;;;5940:32;;;5985;;;6056:3;6040:20;;6109:19;;6141;;;-1:-1:-1;;;6173:19:48;;;-1:-1:-1;6040:20:48;;4553:1678;-1:-1:-1;4553:1678:48:o;4779:1869:47:-;4942:12;;4991:15;;;4970:78;;;;;;;;;;;;;;5868:11;;;:29;;-1:-1:-1;5883:14:47;;5868:29;5864:72;;;5920:5;5913:12;;;;5864:72;6522:11;6459:84;;;;;;;6499:9;6479:6;6459:84;6439:104;;6591:26;6599:9;6610:6;6591:7;:26::i;:::-;6563:24;6571:4;6577:9;6563:7;:24::i;:::-;:54;;;4779:1869;-1:-1:-1;;;;;4779:1869:47:o;6909:918::-;7071:12;;7120:15;;;7099:78;;;;;;;;;;;;;;7250:11;;;:29;;-1:-1:-1;7265:14:47;;7250:29;7246:257;;;7487:5;7480:12;;;;7246:257;7634:11;7571:84;;;;;;;7611:9;7591:6;7571:84;7551:104;;7711:11;7677:31;7685:11;7698:9;7677:7;:31::i;:::-;:45;;;;;;;;7665:57;;7770:26;7778:9;7789:6;7770:7;:26::i;931:615:26:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;-1:-1:-1;931:615:26;;;;;;;;;;;;;;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;146:693;;261:4;249:17;;245:27;-1:-1;235:2;;286:1;283;276:12;235:2;323:6;310:20;345:85;360:69;422:6;360:69;;;345:85;;;458:21;;;502:4;490:17;;;;336:94;;-1:-1;515:14;;490:17;610:1;595:238;620:6;617:1;614:13;595:238;;;703:3;690:17;682:6;678:30;727:42;765:3;753:10;727:42;;;715:55;;-1:-1;793:4;784:14;;;;812;;;;;642:1;635:9;595:238;;;599:14;228:611;;;;;;;;879:735;;1008:4;996:17;;992:27;-1:-1;982:2;;1033:1;1030;1023:12;982:2;1070:6;1057:20;1092:99;1107:83;1183:6;1107:83;;1092:99;1219:21;;;1263:4;1251:17;;;;1083:108;;-1:-1;1276:14;;1251:17;1371:1;1356:252;1381:6;1378:1;1375:13;1356:252;;;1464:3;1451:17;1443:6;1439:30;1488:56;1540:3;1528:10;1488:56;;;1476:69;;-1:-1;1568:4;1559:14;;;;1587;;;;;1403:1;1396:9;1356:252;;1640:707;;1750:4;1738:17;;1734:27;-1:-1;1724:2;;1775:1;1772;1765:12;1724:2;1812:6;1799:20;1834:80;1849:64;1906:6;1849:64;;1834:80;1825:89;;1931:5;1956:6;1949:5;1942:21;1986:4;1978:6;1974:17;1964:27;;2008:4;2003:3;1999:14;1992:21;;2061:6;2108:3;2100:4;2092:6;2088:17;2083:3;2079:27;2076:36;2073:2;;;2125:1;2122;2115:12;2073:2;2150:1;2135:206;2160:6;2157:1;2154:13;2135:206;;;2218:3;2240:37;2273:3;2261:10;2240:37;;;2228:50;;-1:-1;2301:4;2292:14;;;;2320;;;;;2182:1;2175:9;2135:206;;2355:112;;2419:43;2454:6;2441:20;2419:43;;2474:118;;2541:46;2579:6;2566:20;2541:46;;2599:116;;2665:45;2702:6;2689:20;2665:45;;2722:120;;2799:38;2829:6;2823:13;2799:38;;2863:335;;;2970:4;2958:17;;2954:27;-1:-1;2944:2;;2995:1;2992;2985:12;2944:2;-1:-1;3015:20;;3055:18;3044:30;;3041:2;;;3087:1;3084;3077:12;3041:2;3121:4;3113:6;3109:17;3097:29;;3171:3;3164;3156:6;3152:16;3142:8;3138:31;3135:40;3132:2;;;3188:1;3185;3178:12;3132:2;2937:261;;;;;;3207:432;;3297:4;3285:17;;3281:27;-1:-1;3271:2;;3322:1;3319;3312:12;3271:2;3359:6;3346:20;3381:60;3396:44;3433:6;3396:44;;3381:60;3372:69;;3461:6;3454:5;3447:21;3497:4;3489:6;3485:17;3530:4;3523:5;3519:16;3565:3;3556:6;3551:3;3547:16;3544:25;3541:2;;;3582:1;3579;3572:12;3541:2;3592:41;3626:6;3621:3;3616;3592:41;;;3264:375;;;;;;;;4124:2205;;4232:5;4220:9;4215:3;4211:19;4207:31;4204:2;;;4251:1;4248;4241:12;4204:2;4269:21;4284:5;4269:21;;;4260:30;-1:-1;4348:1;4379:49;4424:3;4404:9;4379:49;;;4355:74;;-1:-1;4498:2;4531:49;4576:3;4552:22;;;4531:49;;;4524:4;4517:5;4513:16;4506:75;4450:142;4657:2;4690:49;4735:3;4726:6;4715:9;4711:22;4690:49;;;4683:4;4676:5;4672:16;4665:75;4602:149;4810:2;4843:49;4888:3;4879:6;4868:9;4864:22;4843:49;;;4836:4;4829:5;4825:16;4818:75;4761:143;4966:3;5000:49;5045:3;5036:6;5025:9;5021:22;5000:49;;;4993:4;4986:5;4982:16;4975:75;4914:147;5123:3;5157:49;5202:3;5193:6;5182:9;5178:22;5157:49;;;5150:4;5143:5;5139:16;5132:75;5071:147;5272:3;5306:49;5351:3;5342:6;5331:9;5327:22;5306:49;;;5299:4;5292:5;5288:16;5281:75;5228:139;5421:3;5455:49;5500:3;5491:6;5480:9;5476:22;5455:49;;;5448:4;5441:5;5437:16;5430:75;5377:139;5583:3;5618:49;5663:3;5654:6;5643:9;5639:22;5618:49;;;5610:5;5603;5599:17;5592:76;5526:153;5729:3;5764:49;5809:3;5800:6;5789:9;5785:22;5764:49;;;5756:5;5749;5745:17;5738:76;5689:136;5913:3;5902:9;5898:19;5885:33;5938:18;5930:6;5927:30;5924:2;;;5970:1;5967;5960:12;5924:2;6006:54;6056:3;6047:6;6036:9;6032:22;6006:54;;;5998:5;5991;5987:17;5980:81;5835:237;6160:3;6149:9;6145:19;6132:33;6185:18;6177:6;6174:30;6171:2;;;6217:1;6214;6207:12;6171:2;6253:54;6303:3;6294:6;6283:9;6279:22;6253:54;;;6245:5;6238;6234:17;6227:81;6082:237;4198:2131;;;;;8705:241;;8809:2;8797:9;8788:7;8784:23;8780:32;8777:2;;;8825:1;8822;8815:12;8777:2;8860:1;8877:53;8922:7;8902:9;8877:53;;8953:366;;;9074:2;9062:9;9053:7;9049:23;9045:32;9042:2;;;9090:1;9087;9080:12;9042:2;9125:1;9142:53;9187:7;9167:9;9142:53;;;9132:63;;9104:97;9232:2;9250:53;9295:7;9286:6;9275:9;9271:22;9250:53;;;9240:63;;9211:98;9036:283;;;;;;9326:360;;;9444:2;9432:9;9423:7;9419:23;9415:32;9412:2;;;9460:1;9457;9450:12;9412:2;9495:1;9512:53;9557:7;9537:9;9512:53;;;9502:63;;9474:97;9602:2;9620:50;9662:7;9653:6;9642:9;9638:22;9620:50;;9693:415;;9841:2;9829:9;9820:7;9816:23;9812:32;9809:2;;;9857:1;9854;9847:12;9809:2;9892:31;;9943:18;9932:30;;9929:2;;;9975:1;9972;9965:12;9929:2;9995:97;10084:7;10075:6;10064:9;10060:22;9995:97;;10115:947;;;;10352:2;10340:9;10331:7;10327:23;10323:32;10320:2;;;10368:1;10365;10358:12;10320:2;10403:31;;10454:18;10443:30;;10440:2;;;10486:1;10483;10476:12;10440:2;10506:97;10595:7;10586:6;10575:9;10571:22;10506:97;;;10496:107;;10382:227;10668:2;10657:9;10653:18;10640:32;10692:18;10684:6;10681:30;10678:2;;;10724:1;10721;10714:12;10678:2;10744:78;10814:7;10805:6;10794:9;10790:22;10744:78;;;10734:88;;10619:209;10887:2;10876:9;10872:18;10859:32;10911:18;10903:6;10900:30;10897:2;;;10943:1;10940;10933:12;10897:2;10963:83;11038:7;11029:6;11018:9;11014:22;10963:83;;;10953:93;;10838:214;10314:748;;;;;;11069:811;;;;11281:2;11269:9;11260:7;11256:23;11252:32;11249:2;;;11297:1;11294;11287:12;11249:2;11332:31;;11383:18;11372:30;;11369:2;;;11415:1;11412;11405:12;11369:2;11435:97;11524:7;11515:6;11504:9;11500:22;11435:97;;;11425:107;;11311:227;11569:2;11587:53;11632:7;11623:6;11612:9;11608:22;11587:53;;11887:241;;11991:2;11979:9;11970:7;11966:23;11962:32;11959:2;;;12007:1;12004;11997:12;11959:2;12042:1;12059:53;12104:7;12084:9;12059:53;;12135:366;;;12256:2;12244:9;12235:7;12231:23;12227:32;12224:2;;;12272:1;12269;12262:12;12224:2;12307:1;12324:53;12369:7;12349:9;12324:53;;12508:615;;;;;12665:2;12653:9;12644:7;12640:23;12636:32;12633:2;;;12681:1;12678;12671:12;12633:2;12716:1;12733:53;12778:7;12758:9;12733:53;;;12723:63;;12695:97;12823:2;12841:53;12886:7;12877:6;12866:9;12862:22;12841:53;;;12831:63;;12802:98;12959:2;12948:9;12944:18;12931:32;12983:18;12975:6;12972:30;12969:2;;;13015:1;13012;13005:12;12969:2;13043:64;13099:7;13090:6;13079:9;13075:22;13043:64;;;12627:496;;;;-1:-1;13025:82;-1:-1;;;;12627:496;13130:595;;;;13277:2;13265:9;13256:7;13252:23;13248:32;13245:2;;;13293:1;13290;13283:12;13245:2;13328:1;13345:53;13390:7;13370:9;13345:53;;;13335:63;;13307:97;13435:2;13453:53;13498:7;13489:6;13478:9;13474:22;13453:53;;;13443:63;;13414:98;13571:2;13560:9;13556:18;13543:32;13595:18;13587:6;13584:30;13581:2;;;13627:1;13624;13617:12;13581:2;13647:62;13701:7;13692:6;13681:9;13677:22;13647:62;;13732:239;;13835:2;13823:9;13814:7;13810:23;13806:32;13803:2;;;13851:1;13848;13841:12;13803:2;13886:1;13903:52;13947:7;13927:9;13903:52;;13978:261;;14092:2;14080:9;14071:7;14067:23;14063:32;14060:2;;;14108:1;14105;14098:12;14060:2;14143:1;14160:63;14215:7;14195:9;14160:63;;14246:373;;14373:2;14361:9;14352:7;14348:23;14344:32;14341:2;;;14389:1;14386;14379:12;14341:2;14424:31;;14475:18;14464:30;;14461:2;;;14507:1;14504;14497:12;14461:2;14527:76;14595:7;14586:6;14575:9;14571:22;14527:76;;14626:1089;;;;;14845:3;14833:9;14824:7;14820:23;14816:33;14813:2;;;14862:1;14859;14852:12;14813:2;14897:31;;14948:18;14937:30;;14934:2;;;14980:1;14977;14970:12;14934:2;15000:76;15068:7;15059:6;15048:9;15044:22;15000:76;;;14990:86;;14876:206;15141:2;15130:9;15126:18;15113:32;15165:18;15157:6;15154:30;15151:2;;;15197:1;15194;15187:12;15151:2;15217:76;15285:7;15276:6;15265:9;15261:22;15217:76;;;15207:86;;15092:207;15358:2;15347:9;15343:18;15330:32;15382:18;15374:6;15371:30;15368:2;;;15414:1;15411;15404:12;15368:2;15434:62;15488:7;15479:6;15468:9;15464:22;15434:62;;;15424:72;;15309:193;15561:2;15550:9;15546:18;15533:32;15585:18;15577:6;15574:30;15571:2;;;15617:1;15614;15607:12;15571:2;15637:62;15691:7;15682:6;15671:9;15667:22;15637:62;;;15627:72;;15512:193;14807:908;;;;;;;;15722:727;;;;15892:2;15880:9;15871:7;15867:23;15863:32;15860:2;;;15908:1;15905;15898:12;15860:2;15943:31;;15994:18;15983:30;;15980:2;;;16026:1;16023;16016:12;15980:2;16046:76;16114:7;16105:6;16094:9;16090:22;16046:76;;;16036:86;;15922:206;16159:2;16177:53;16222:7;16213:6;16202:9;16198:22;16177:53;;16704:865;;;;;;;16897:3;16885:9;16876:7;16872:23;16868:33;16865:2;;;16914:1;16911;16904:12;16865:2;16949:1;16966:53;17011:7;16991:9;16966:53;;;16956:63;;16928:97;17056:2;17074:53;17119:7;17110:6;17099:9;17095:22;17074:53;;;17064:63;;17035:98;17192:2;17181:9;17177:18;17164:32;17216:18;17208:6;17205:30;17202:2;;;17248:1;17245;17238:12;17202:2;17276:64;17332:7;17323:6;17312:9;17308:22;17276:64;;;17258:82;;;;17143:203;17405:2;17394:9;17390:18;17377:32;17429:18;17421:6;17418:30;17415:2;;;17461:1;17458;17451:12;17415:2;17489:64;17545:7;17536:6;17525:9;17521:22;17489:64;;;17471:82;;;;17356:203;16859:710;;;;;;;;;17576:110;17649:31;17674:5;17649:31;;;17644:3;17637:44;17631:55;;;17760:755;;17941:77;18012:5;17941:77;;;18036:6;18031:3;18024:19;18060:4;18055:3;18051:14;18044:21;;18105:79;18178:5;18105:79;;;18205:1;18190:303;18215:6;18212:1;18209:13;18190:303;;;18255:103;18354:3;18345:6;18339:13;18255:103;;;18375:83;18451:6;18375:83;;;18481:4;18472:14;;;;;18365:93;-1:-1;18237:1;18230:9;18190:303;;;-1:-1;18506:3;;17920:595;-1:-1;;;;17920:595;18523:101;18590:28;18612:5;18590:28;;18631:110;18704:31;18729:5;18704:31;;18748:107;18819:30;18843:5;18819:30;;18862:297;;18962:38;18994:5;18962:38;;;19017:6;19012:3;19005:19;19029:63;19085:6;19078:4;19073:3;19069:14;19062:4;19055:5;19051:16;19029:63;;;19124:29;19146:6;19124:29;;;19104:50;;;19117:4;19104:50;;18942:217;-1:-1;;;18942:217;19462:156;19555:57;19606:5;19555:57;;19925:296;20080:2;20068:15;;20117:66;20112:2;20103:12;;20096:88;20212:2;20203:12;;20061:160;20230:296;20385:2;20373:15;;20422:66;20417:2;20408:12;;20401:88;20517:2;20508:12;;20366:160;20535:296;20690:2;20678:15;;20727:66;20722:2;20713:12;;20706:88;20822:2;20813:12;;20671:160;20840:296;20995:2;20983:15;;21032:66;21027:2;21018:12;;21011:88;21127:2;21118:12;;20976:160;21145:296;21300:2;21288:15;;21337:66;21332:2;21323:12;;21316:88;21432:2;21423:12;;21281:160;21450:397;21605:2;21593:15;;21642:66;21637:2;21628:12;;21621:88;21743:66;21738:2;21729:12;;21722:88;21838:2;21829:12;;21586:261;21856:296;22011:2;21999:15;;22048:66;22043:2;22034:12;;22027:88;22143:2;22134:12;;21992:160;22161:296;22316:2;22304:15;;22353:66;22348:2;22339:12;;22332:88;22448:2;22439:12;;22297:160;22466:296;22621:2;22609:15;;22658:66;22653:2;22644:12;;22637:88;22753:2;22744:12;;22602:160;22771:296;22926:2;22914:15;;22963:66;22958:2;22949:12;;22942:88;23058:2;23049:12;;22907:160;23076:296;23231:2;23219:15;;23268:66;23263:2;23254:12;;23247:88;23363:2;23354:12;;23212:160;23381:296;23536:2;23524:15;;23573:66;23568:2;23559:12;;23552:88;23668:2;23659:12;;23517:160;23686:296;23841:2;23829:15;;23878:66;23873:2;23864:12;;23857:88;23973:2;23964:12;;23822:160;23991:296;24146:2;24134:15;;24183:66;24178:2;24169:12;;24162:88;24278:2;24269:12;;24127:160;24296:296;24451:2;24439:15;;24488:66;24483:2;24474:12;;24467:88;24583:2;24574:12;;24432:160;24601:296;24756:2;24744:15;;24793:66;24788:2;24779:12;;24772:88;24888:2;24879:12;;24737:160;24906:296;25061:2;25049:15;;25098:66;25093:2;25084:12;;25077:88;25193:2;25184:12;;25042:160;25211:296;25366:2;25354:15;;25403:66;25398:2;25389:12;;25382:88;25498:2;25489:12;;25347:160;25516:397;25671:2;25659:15;;25708:66;25703:2;25694:12;;25687:88;25809:66;25804:2;25795:12;;25788:88;25904:2;25895:12;;25652:261;25922:296;26077:2;26065:15;;26114:66;26109:2;26100:12;;26093:88;26209:2;26200:12;;26058:160;26227:296;26382:2;26370:15;;26419:66;26414:2;26405:12;;26398:88;26514:2;26505:12;;26363:160;26532:296;26687:2;26675:15;;26724:66;26719:2;26710:12;;26703:88;26819:2;26810:12;;26668:160;26837:296;26992:2;26980:15;;27029:66;27024:2;27015:12;;27008:88;27124:2;27115:12;;26973:160;27142:296;27297:2;27285:15;;27334:66;27329:2;27320:12;;27313:88;27429:2;27420:12;;27278:160;27447:296;27602:2;27590:15;;27639:66;27634:2;27625:12;;27618:88;27734:2;27725:12;;27583:160;27752:296;27907:2;27895:15;;27944:66;27939:2;27930:12;;27923:88;28039:2;28030:12;;27888:160;28057:296;28212:2;28200:15;;28249:66;28244:2;28235:12;;28228:88;28344:2;28335:12;;28193:160;28362:397;28517:2;28505:15;;28554:66;28549:2;28540:12;;28533:88;28655:66;28650:2;28641:12;;28634:88;28750:2;28741:12;;28498:261;28768:296;28923:2;28911:15;;28960:66;28955:2;28946:12;;28939:88;29055:2;29046:12;;28904:160;29073:296;29228:2;29216:15;;29265:66;29260:2;29251:12;;29244:88;29360:2;29351:12;;29209:160;29378:296;29533:2;29521:15;;29570:66;29565:2;29556:12;;29549:88;29665:2;29656:12;;29514:160;29683:296;29838:2;29826:15;;29875:66;29870:2;29861:12;;29854:88;29970:2;29961:12;;29819:160;29988:296;30143:2;30131:15;;30180:66;30175:2;30166:12;;30159:88;30275:2;30266:12;;30124:160;30369:890;30599:22;;30512:4;30503:14;;;30633:61;30507:3;30599:22;30633:61;;;30532:174;30800:4;30793:5;30789:16;30783:23;30818:62;30874:4;30869:3;30865:14;30852:11;30818:62;;;30716:176;30976:4;30969:5;30965:16;30959:23;30994:62;31050:4;31045:3;31041:14;31028:11;30994:62;;;30902:166;31152:4;31145:5;31141:16;31135:23;31170:62;31226:4;31221:3;31217:14;31204:11;31170:62;;32327:821;32554:22;;32484:5;32475:15;;;32588:117;32479:3;32554:22;32588:117;;;32505:212;32794:4;32787:5;32783:16;32777:23;32812:118;32924:4;32919:3;32915:14;32902:11;32812:118;;;32727:215;33040:4;33033:5;33029:16;33023:23;33058:63;33114:5;33109:3;33105:15;33092:11;33058:63;;33216:695;33429:22;;33353:4;33344:14;;;33463:57;33348:3;33429:22;33463:57;;;33373:159;33613:4;33606:5;33602:16;33596:23;33631:62;33687:4;33682:3;33678:14;33665:11;33631:62;;;33542:163;33804:4;33797:5;33793:16;33787:23;33822:62;33878:4;33873:3;33869:14;33856:11;33822:62;;34794:104;34863:29;34886:5;34863:29;;34905:193;35013:2;34998:18;;35027:61;35002:9;35061:6;35027:61;;35105:1057;35437:3;35422:19;;35452:61;35426:9;35486:6;35452:61;;;35524:62;35582:2;35571:9;35567:18;35558:6;35524:62;;;35597;35655:2;35644:9;35640:18;35631:6;35597:62;;;35670;35728:2;35717:9;35713:18;35704:6;35670:62;;;35743:63;35801:3;35790:9;35786:19;35777:6;35743:63;;;35817;35875:3;35864:9;35860:19;35851:6;35817:63;;;35929:9;35923:4;35919:20;35913:3;35902:9;35898:19;35891:49;35954:62;36011:4;36002:6;35954:62;;;35946:70;;36065:9;36059:4;36055:20;36049:3;36038:9;36034:19;36027:49;36090:62;36147:4;36138:6;36090:62;;;36082:70;35408:754;-1:-1;;;;;;;;;;35408:754;36169:547;36361:2;36346:18;;36375:61;36350:9;36409:6;36375:61;;;36484:9;36478:4;36474:20;36469:2;36458:9;36454:18;36447:48;36509:62;36566:4;36557:6;36509:62;;;36501:70;;36619:9;36613:4;36609:20;36604:2;36593:9;36589:18;36582:48;36644:62;36701:4;36692:6;36644:62;;;36636:70;36332:384;-1:-1;;;;;36332:384;36723:433;36927:2;36941:47;;;36912:18;;37002:144;36912:18;37132:6;37002:144;;37163:181;37265:2;37250:18;;37279:55;37254:9;37307:6;37279:55;;37351:193;37459:2;37444:18;;37473:61;37448:9;37507:6;37473:61;;37551:479;37733:2;37718:18;;37747:61;37722:9;37781:6;37747:61;;;37819:62;37877:2;37866:9;37862:18;37853:6;37819:62;;;37929:9;37923:4;37919:20;37914:2;37903:9;37899:18;37892:48;37954:66;38015:4;38006:6;37954:66;;38037:378;38191:2;38176:18;;38205:61;38180:9;38239:6;38205:61;;;38314:9;38308:4;38304:20;38299:2;38288:9;38284:18;38277:48;38339:66;38400:4;38391:6;38339:66;;38422:489;38610:3;38595:19;;38625:61;38599:9;38659:6;38625:61;;;38697:58;38751:2;38740:9;38736:18;38727:6;38697:58;;;38766:62;38824:2;38813:9;38809:18;38800:6;38766:62;;;38839;38897:2;38886:9;38882:18;38873:6;38839:62;;38918:290;39052:2;39037:18;;39066:59;39041:9;39098:6;39066:59;;;39136:62;39194:2;39183:9;39179:18;39170:6;39136:62;;39215:269;39337:2;39351:47;;;39322:18;;39412:62;39322:18;39460:6;39412:62;;39491:233;39619:2;39604:18;;39633:81;39608:9;39687:6;39633:81;;40011:387;40192:2;40206:47;;;40177:18;;40267:121;40177:18;40267:121;;40405:387;40586:2;40600:47;;;40571:18;;40661:121;40571:18;40661:121;;40799:387;40980:2;40994:47;;;40965:18;;41055:121;40965:18;41055:121;;41193:387;41374:2;41388:47;;;41359:18;;41449:121;41359:18;41449:121;;41587:387;41768:2;41782:47;;;41753:18;;41843:121;41753:18;41843:121;;41981:387;42162:2;42176:47;;;42147:18;;42237:121;42147:18;42237:121;;42375:387;42556:2;42570:47;;;42541:18;;42631:121;42541:18;42631:121;;42769:387;42950:2;42964:47;;;42935:18;;43025:121;42935:18;43025:121;;43163:387;43344:2;43358:47;;;43329:18;;43419:121;43329:18;43419:121;;43557:387;43738:2;43752:47;;;43723:18;;43813:121;43723:18;43813:121;;43951:387;44132:2;44146:47;;;44117:18;;44207:121;44117:18;44207:121;;44345:387;44526:2;44540:47;;;44511:18;;44601:121;44511:18;44601:121;;44739:387;44920:2;44934:47;;;44905:18;;44995:121;44905:18;44995:121;;45133:387;45314:2;45328:47;;;45299:18;;45389:121;45299:18;45389:121;;45527:387;45708:2;45722:47;;;45693:18;;45783:121;45693:18;45783:121;;45921:387;46102:2;46116:47;;;46087:18;;46177:121;46087:18;46177:121;;46315:387;46496:2;46510:47;;;46481:18;;46571:121;46481:18;46571:121;;46709:387;46890:2;46904:47;;;46875:18;;46965:121;46875:18;46965:121;;47103:387;47284:2;47298:47;;;47269:18;;47359:121;47269:18;47359:121;;47497:387;47678:2;47692:47;;;47663:18;;47753:121;47663:18;47753:121;;47891:387;48072:2;48086:47;;;48057:18;;48147:121;48057:18;48147:121;;48285:387;48466:2;48480:47;;;48451:18;;48541:121;48451:18;48541:121;;48679:387;48860:2;48874:47;;;48845:18;;48935:121;48845:18;48935:121;;49073:387;49254:2;49268:47;;;49239:18;;49329:121;49239:18;49329:121;;49467:387;49648:2;49662:47;;;49633:18;;49723:121;49633:18;49723:121;;49861:387;50042:2;50056:47;;;50027:18;;50117:121;50027:18;50117:121;;50255:387;50436:2;50450:47;;;50421:18;;50511:121;50421:18;50511:121;;50649:387;50830:2;50844:47;;;50815:18;;50905:121;50815:18;50905:121;;51043:387;51224:2;51238:47;;;51209:18;;51299:121;51209:18;51299:121;;51437:387;51618:2;51632:47;;;51603:18;;51693:121;51603:18;51693:121;;51831:387;52012:2;52026:47;;;51997:18;;52087:121;51997:18;52087:121;;52225:387;52406:2;52420:47;;;52391:18;;52481:121;52391:18;52481:121;;52619:387;52800:2;52814:47;;;52785:18;;52875:121;52785:18;52875:121;;53013:314;53181:3;53166:19;;53196:121;53170:9;53290:6;53196:121;;53334:342;53516:3;53501:19;;53531:135;53505:9;53639:6;53531:135;;53683:301;53845:2;53830:18;;53859:115;53834:9;53947:6;53859:115;;54191:256;54253:2;54247:9;54279:17;;;54354:18;54339:34;;54375:22;;;54336:62;54333:2;;;54411:1;54408;54401:12;54333:2;54427;54420:22;54231:216;;-1:-1;54231:216;54454:263;;54618:18;54610:6;54607:30;54604:2;;;54650:1;54647;54640:12;54604:2;-1:-1;54679:4;54667:17;;;54697:15;;54541:176;55273:254;;55412:18;55404:6;55401:30;55398:2;;;55444:1;55441;55434:12;55398:2;-1:-1;55517:4;55488;55465:17;;;;55484:9;55461:33;55507:15;;55335:192;55801:144;55933:4;55921:17;;55902:43;55954:130;56067:12;;56051:33;56532:128;56612:42;56601:54;;56584:76;56667:92;56740:13;56733:21;;56716:43;56766:79;56835:5;56818:27;56852:151;56931:66;56920:78;;56903:100;57096:88;57174:4;57163:16;;57146:38;57755:135;;57854:31;57879:5;57854:31;;57898:145;57979:6;57974:3;57969;57956:30;-1:-1;58035:1;58017:16;;58010:27;57949:94;58052:268;58117:1;58124:101;58138:6;58135:1;58132:13;58124:101;;;58205:11;;;58199:18;58186:11;;;58179:39;58160:2;58153:10;58124:101;;;58240:6;58237:1;58234:13;58231:2;;;-1:-1;;58305:1;58287:16;;58280:27;58101:219;58328:97;58416:2;58396:14;58412:7;58392:28;;58376:49"
+ }
+ }
+ },
+ "sources": {
+ "protocol/Exchange/Exchange.sol": {
+ "id": 26
+ },
+ "protocol/Exchange/libs/LibConstants.sol": {
+ "id": 43
+ },
+ "protocol/Exchange/MixinExchangeCore.sol": {
+ "id": 28
+ },
+ "utils/ReentrancyGuard/ReentrancyGuard.sol": {
+ "id": 83
+ },
+ "protocol/Exchange/libs/LibFillResults.sol": {
+ "id": 46
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "protocol/Exchange/libs/LibOrder.sol": {
+ "id": 48
+ },
+ "protocol/Exchange/libs/LibEIP712.sol": {
+ "id": 44
+ },
+ "protocol/Exchange/libs/LibMath.sol": {
+ "id": 47
+ },
+ "protocol/Exchange/mixins/MExchangeCore.sol": {
+ "id": 50
+ },
+ "protocol/Exchange/interfaces/IExchangeCore.sol": {
+ "id": 35
+ },
+ "protocol/Exchange/mixins/MSignatureValidator.sol": {
+ "id": 52
+ },
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": {
+ "id": 37
+ },
+ "protocol/Exchange/mixins/MTransactions.sol": {
+ "id": 53
+ },
+ "protocol/Exchange/interfaces/ITransactions.sol": {
+ "id": 38
+ },
+ "protocol/Exchange/mixins/MAssetProxyDispatcher.sol": {
+ "id": 49
+ },
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": {
+ "id": 33
+ },
+ "protocol/Exchange/MixinSignatureValidator.sol": {
+ "id": 30
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ },
+ "protocol/Exchange/interfaces/IWallet.sol": {
+ "id": 40
+ },
+ "protocol/Exchange/interfaces/IValidator.sol": {
+ "id": 39
+ },
+ "protocol/Exchange/MixinWrapperFunctions.sol": {
+ "id": 32
+ },
+ "protocol/Exchange/libs/LibAbiEncoder.sol": {
+ "id": 42
+ },
+ "protocol/Exchange/mixins/MWrapperFunctions.sol": {
+ "id": 54
+ },
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": {
+ "id": 41
+ },
+ "protocol/Exchange/MixinAssetProxyDispatcher.sol": {
+ "id": 27
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ },
+ "protocol/AssetProxy/interfaces/IAssetProxy.sol": {
+ "id": 22
+ },
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": {
+ "id": 23
+ },
+ "protocol/Exchange/MixinTransactions.sol": {
+ "id": 31
+ },
+ "protocol/Exchange/libs/LibExchangeErrors.sol": {
+ "id": 45
+ },
+ "protocol/Exchange/MixinMatchOrders.sol": {
+ "id": 29
+ },
+ "protocol/Exchange/mixins/MMatchOrders.sol": {
+ "id": 51
+ },
+ "protocol/Exchange/interfaces/IMatchOrders.sol": {
+ "id": 36
+ }
+ },
+ "sourceCodes": {
+ "protocol/Exchange/Exchange.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./libs/LibConstants.sol\";\nimport \"./MixinExchangeCore.sol\";\nimport \"./MixinSignatureValidator.sol\";\nimport \"./MixinWrapperFunctions.sol\";\nimport \"./MixinAssetProxyDispatcher.sol\";\nimport \"./MixinTransactions.sol\";\nimport \"./MixinMatchOrders.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract Exchange is\n MixinExchangeCore,\n MixinMatchOrders,\n MixinSignatureValidator,\n MixinTransactions,\n MixinAssetProxyDispatcher,\n MixinWrapperFunctions\n{\n string constant public VERSION = \"2.0.1-alpha\";\n\n // Mixins are instantiated in the order they are inherited\n constructor (bytes memory _zrxAssetData)\n public\n LibConstants(_zrxAssetData) // @TODO: Remove when we deploy.\n MixinExchangeCore()\n MixinMatchOrders()\n MixinSignatureValidator()\n MixinTransactions()\n MixinAssetProxyDispatcher()\n MixinWrapperFunctions()\n {}\n}\n",
+ "protocol/Exchange/libs/LibConstants.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\n// solhint-disable max-line-length\ncontract LibConstants {\n \n // Asset data for ZRX token. Used for fee transfers.\n // @TODO: Hardcode constant when we deploy. Currently \n // not constant to make testing easier.\n\n // The proxyId for ZRX_ASSET_DATA is bytes4(keccak256(\"ERC20Token(address)\")) = 0xf47261b0\n \n // Kovan ZRX address is 0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570.\n // The ABI encoded proxyId and address is 0xf47261b00000000000000000000000006ff6c0ff1d68b964901f986d4c9fa3ac68346570\n // bytes constant public ZRX_ASSET_DATA = \"\\xf4\\x72\\x61\\xb0\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x6f\\xf6\\xc0\\xff\\x1d\\x68\\xb9\\x64\\x90\\x1f\\x98\\x6d\\x4c\\x9f\\xa3\\xac\\x68\\x34\\x65\\x70\";\n \n // Mainnet ZRX address is 0xe41d2489571d322189246dafa5ebde1f4699f498.\n // The ABI encoded proxyId and address is 0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498\n // bytes constant public ZRX_ASSET_DATA = \"\\xf4\\x72\\x61\\xb0\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xe4\\x1d\\x24\\x89\\x57\\x1d\\x32\\x21\\x89\\x24\\x6d\\xaf\\xa5\\xeb\\xde\\x1f\\x46\\x99\\xf4\\x98\";\n \n // solhint-disable-next-line var-name-mixedcase\n bytes public ZRX_ASSET_DATA;\n\n // @TODO: Remove when we deploy.\n constructor (bytes memory zrxAssetData)\n public\n {\n ZRX_ASSET_DATA = zrxAssetData;\n }\n}\n// solhint-enable max-line-length\n",
+ "protocol/Exchange/MixinExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../utils/ReentrancyGuard/ReentrancyGuard.sol\";\nimport \"./libs/LibConstants.sol\";\nimport \"./libs/LibFillResults.sol\";\nimport \"./libs/LibOrder.sol\";\nimport \"./libs/LibMath.sol\";\nimport \"./mixins/MExchangeCore.sol\";\nimport \"./mixins/MSignatureValidator.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./mixins/MAssetProxyDispatcher.sol\";\n\n\ncontract MixinExchangeCore is\n ReentrancyGuard,\n LibConstants,\n LibMath,\n LibOrder,\n LibFillResults,\n MAssetProxyDispatcher,\n MExchangeCore,\n MSignatureValidator,\n MTransactions\n{\n // Mapping of orderHash => amount of takerAsset already bought by maker\n mapping (bytes32 => uint256) public filled;\n\n // Mapping of orderHash => cancelled\n mapping (bytes32 => bool) public cancelled;\n\n // Mapping of makerAddress => senderAddress => lowest salt an order can have in order to be fillable\n // Orders with specified senderAddress and with a salt less than their epoch are considered cancelled\n mapping (address => mapping (address => uint256)) public orderEpoch;\n\n /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch\n /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).\n /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.\n function cancelOrdersUpTo(uint256 targetOrderEpoch)\n external\n nonReentrant\n {\n address makerAddress = getCurrentContextAddress();\n // If this function is called via `executeTransaction`, we only update the orderEpoch for the makerAddress/msg.sender combination.\n // This allows external filter contracts to add rules to how orders are cancelled via this function.\n address senderAddress = makerAddress == msg.sender ? address(0) : msg.sender;\n\n // orderEpoch is initialized to 0, so to cancelUpTo we need salt + 1\n uint256 newOrderEpoch = targetOrderEpoch + 1; \n uint256 oldOrderEpoch = orderEpoch[makerAddress][senderAddress];\n\n // Ensure orderEpoch is monotonically increasing\n require(\n newOrderEpoch > oldOrderEpoch, \n \"INVALID_NEW_ORDER_EPOCH\"\n );\n\n // Update orderEpoch\n orderEpoch[makerAddress][senderAddress] = newOrderEpoch;\n emit CancelUpTo(\n makerAddress,\n senderAddress,\n newOrderEpoch\n );\n }\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrder(\n Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n nonReentrant\n returns (FillResults memory fillResults)\n {\n fillResults = fillOrderInternal(\n order,\n takerAssetFillAmount,\n signature\n );\n return fillResults;\n }\n\n /// @dev After calling, the order can not be filled anymore.\n /// Throws if order is invalid or sender does not have permission to cancel.\n /// @param order Order to cancel. Order must be OrderStatus.FILLABLE.\n function cancelOrder(Order memory order)\n public\n nonReentrant\n {\n cancelOrderInternal(order);\n }\n\n /// @dev Gets information about an order: status, hash, and amount filled.\n /// @param order Order to gather information on.\n /// @return OrderInfo Information about the order and its state.\n /// See LibOrder.OrderInfo for a complete description.\n function getOrderInfo(Order memory order)\n public\n view\n returns (OrderInfo memory orderInfo)\n {\n // Compute the order hash\n orderInfo.orderHash = getOrderHash(order);\n\n // Fetch filled amount\n orderInfo.orderTakerAssetFilledAmount = filled[orderInfo.orderHash];\n\n // If order.makerAssetAmount is zero, we also reject the order.\n // While the Exchange contract handles them correctly, they create\n // edge cases in the supporting infrastructure because they have\n // an 'infinite' price when computed by a simple division.\n if (order.makerAssetAmount == 0) {\n orderInfo.orderStatus = uint8(OrderStatus.INVALID_MAKER_ASSET_AMOUNT);\n return orderInfo;\n }\n\n // If order.takerAssetAmount is zero, then the order will always\n // be considered filled because 0 == takerAssetAmount == orderTakerAssetFilledAmount\n // Instead of distinguishing between unfilled and filled zero taker\n // amount orders, we choose not to support them.\n if (order.takerAssetAmount == 0) {\n orderInfo.orderStatus = uint8(OrderStatus.INVALID_TAKER_ASSET_AMOUNT);\n return orderInfo;\n }\n\n // Validate order availability\n if (orderInfo.orderTakerAssetFilledAmount >= order.takerAssetAmount) {\n orderInfo.orderStatus = uint8(OrderStatus.FULLY_FILLED);\n return orderInfo;\n }\n\n // Validate order expiration\n // solhint-disable-next-line not-rely-on-time\n if (block.timestamp >= order.expirationTimeSeconds) {\n orderInfo.orderStatus = uint8(OrderStatus.EXPIRED);\n return orderInfo;\n }\n\n // Check if order has been cancelled\n if (cancelled[orderInfo.orderHash]) {\n orderInfo.orderStatus = uint8(OrderStatus.CANCELLED);\n return orderInfo;\n }\n if (orderEpoch[order.makerAddress][order.senderAddress] > order.salt) {\n orderInfo.orderStatus = uint8(OrderStatus.CANCELLED);\n return orderInfo;\n }\n\n // All other statuses are ruled out: order is Fillable\n orderInfo.orderStatus = uint8(OrderStatus.FILLABLE);\n return orderInfo;\n }\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderInternal(\n Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n returns (FillResults memory fillResults)\n {\n // Fetch order info\n OrderInfo memory orderInfo = getOrderInfo(order);\n\n // Fetch taker address\n address takerAddress = getCurrentContextAddress();\n \n // Assert that the order is fillable by taker\n assertFillableOrder(\n order,\n orderInfo,\n takerAddress,\n signature\n );\n \n // Get amount of takerAsset to fill\n uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderInfo.orderTakerAssetFilledAmount);\n uint256 takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetAmount);\n\n // Validate context\n assertValidFill(\n order,\n orderInfo,\n takerAssetFillAmount,\n takerAssetFilledAmount,\n fillResults.makerAssetFilledAmount\n );\n\n // Compute proportional fill amounts\n fillResults = calculateFillResults(order, takerAssetFilledAmount);\n\n // Update exchange internal state\n updateFilledState(\n order,\n takerAddress,\n orderInfo.orderHash,\n orderInfo.orderTakerAssetFilledAmount,\n fillResults\n );\n \n // Settle order\n settleOrder(\n order,\n takerAddress,\n fillResults\n );\n\n return fillResults;\n }\n\n /// @dev After calling, the order can not be filled anymore.\n /// Throws if order is invalid or sender does not have permission to cancel.\n /// @param order Order to cancel. Order must be OrderStatus.FILLABLE.\n function cancelOrderInternal(Order memory order)\n internal\n {\n // Fetch current order status\n OrderInfo memory orderInfo = getOrderInfo(order);\n\n // Validate context\n assertValidCancel(order, orderInfo);\n\n // Perform cancel\n updateCancelledState(order, orderInfo.orderHash);\n }\n\n /// @dev Updates state with results of a fill order.\n /// @param order that was filled.\n /// @param takerAddress Address of taker who filled the order.\n /// @param orderTakerAssetFilledAmount Amount of order already filled.\n function updateFilledState(\n Order memory order,\n address takerAddress,\n bytes32 orderHash,\n uint256 orderTakerAssetFilledAmount,\n FillResults memory fillResults\n )\n internal\n {\n // Update state\n filled[orderHash] = safeAdd(orderTakerAssetFilledAmount, fillResults.takerAssetFilledAmount);\n\n // Log order\n emit Fill(\n order.makerAddress,\n order.feeRecipientAddress,\n takerAddress,\n msg.sender,\n fillResults.makerAssetFilledAmount,\n fillResults.takerAssetFilledAmount,\n fillResults.makerFeePaid,\n fillResults.takerFeePaid,\n orderHash,\n order.makerAssetData,\n order.takerAssetData\n );\n }\n\n /// @dev Updates state with results of cancelling an order.\n /// State is only updated if the order is currently fillable.\n /// Otherwise, updating state would have no effect.\n /// @param order that was cancelled.\n /// @param orderHash Hash of order that was cancelled.\n function updateCancelledState(\n Order memory order,\n bytes32 orderHash\n )\n internal\n {\n // Perform cancel\n cancelled[orderHash] = true;\n\n // Log cancel\n emit Cancel(\n order.makerAddress,\n order.feeRecipientAddress,\n msg.sender,\n orderHash,\n order.makerAssetData,\n order.takerAssetData\n );\n }\n \n /// @dev Validates context for fillOrder. Succeeds or throws.\n /// @param order to be filled.\n /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.\n /// @param takerAddress Address of order taker.\n /// @param signature Proof that the orders was created by its maker.\n function assertFillableOrder(\n Order memory order,\n OrderInfo memory orderInfo,\n address takerAddress,\n bytes memory signature\n )\n internal\n view\n {\n // An order can only be filled if its status is FILLABLE.\n require(\n orderInfo.orderStatus == uint8(OrderStatus.FILLABLE),\n \"ORDER_UNFILLABLE\"\n );\n \n // Validate sender is allowed to fill this order\n if (order.senderAddress != address(0)) {\n require(\n order.senderAddress == msg.sender,\n \"INVALID_SENDER\"\n );\n }\n \n // Validate taker is allowed to fill this order\n if (order.takerAddress != address(0)) {\n require(\n order.takerAddress == takerAddress,\n \"INVALID_TAKER\"\n );\n }\n \n // Validate Maker signature (check only if first time seen)\n if (orderInfo.orderTakerAssetFilledAmount == 0) {\n require(\n isValidSignature(\n orderInfo.orderHash,\n order.makerAddress,\n signature\n ),\n \"INVALID_ORDER_SIGNATURE\"\n );\n }\n }\n \n /// @dev Validates context for fillOrder. Succeeds or throws.\n /// @param order to be filled.\n /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.\n /// @param takerAssetFillAmount Desired amount of order to fill by taker.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @param makerAssetFilledAmount Amount of makerAsset that will be transfered.\n function assertValidFill(\n Order memory order,\n OrderInfo memory orderInfo,\n uint256 takerAssetFillAmount, // TODO: use FillResults\n uint256 takerAssetFilledAmount,\n uint256 makerAssetFilledAmount\n )\n internal\n view\n {\n // Revert if fill amount is invalid\n // TODO: reconsider necessity for v2.1\n require(\n takerAssetFillAmount != 0,\n \"INVALID_TAKER_AMOUNT\"\n );\n \n // Make sure taker does not pay more than desired amount\n // NOTE: This assertion should never fail, it is here\n // as an extra defence against potential bugs.\n require(\n takerAssetFilledAmount <= takerAssetFillAmount,\n \"TAKER_OVERPAY\"\n );\n \n // Make sure order is not overfilled\n // NOTE: This assertion should never fail, it is here\n // as an extra defence against potential bugs.\n require(\n safeAdd(orderInfo.orderTakerAssetFilledAmount, takerAssetFilledAmount) <= order.takerAssetAmount,\n \"ORDER_OVERFILL\"\n );\n \n // Make sure order is filled at acceptable price.\n // The order has an implied price from the makers perspective:\n // order price = order.makerAssetAmount / order.takerAssetAmount\n // i.e. the number of makerAsset maker is paying per takerAsset. The\n // maker is guaranteed to get this price or a better (lower) one. The\n // actual price maker is getting in this fill is:\n // fill price = makerAssetFilledAmount / takerAssetFilledAmount\n // We need `fill price <= order price` for the fill to be fair to maker.\n // This amounts to:\n // makerAssetFilledAmount order.makerAssetAmount\n // ------------------------ <= -----------------------\n // takerAssetFilledAmount order.takerAssetAmount\n // or, equivalently:\n // makerAssetFilledAmount * order.takerAssetAmount <=\n // order.makerAssetAmount * takerAssetFilledAmount\n // NOTE: This assertion should never fail, it is here\n // as an extra defence against potential bugs.\n require(\n safeMul(makerAssetFilledAmount, order.takerAssetAmount)\n <= \n safeMul(order.makerAssetAmount, takerAssetFilledAmount),\n \"INVALID_FILL_PRICE\"\n );\n }\n\n /// @dev Validates context for cancelOrder. Succeeds or throws.\n /// @param order to be cancelled.\n /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.\n function assertValidCancel(\n Order memory order,\n OrderInfo memory orderInfo\n )\n internal\n view\n {\n // Ensure order is valid\n // An order can only be cancelled if its status is FILLABLE.\n require(\n orderInfo.orderStatus == uint8(OrderStatus.FILLABLE),\n \"ORDER_UNFILLABLE\"\n );\n\n // Validate sender is allowed to cancel this order\n if (order.senderAddress != address(0)) {\n require(\n order.senderAddress == msg.sender,\n \"INVALID_SENDER\"\n );\n }\n\n // Validate transaction signed by maker\n address makerAddress = getCurrentContextAddress();\n require(\n order.makerAddress == makerAddress,\n \"INVALID_MAKER\"\n );\n }\n\n /// @dev Calculates amounts filled and fees paid by maker and taker.\n /// @param order to be filled.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @return fillResults Amounts filled and fees paid by maker and taker.\n function calculateFillResults(\n Order memory order,\n uint256 takerAssetFilledAmount\n )\n internal\n pure\n returns (FillResults memory fillResults)\n {\n // Compute proportional transfer amounts\n fillResults.takerAssetFilledAmount = takerAssetFilledAmount;\n fillResults.makerAssetFilledAmount = safeGetPartialAmountFloor(\n takerAssetFilledAmount,\n order.takerAssetAmount,\n order.makerAssetAmount\n );\n fillResults.makerFeePaid = safeGetPartialAmountFloor(\n fillResults.makerAssetFilledAmount,\n order.makerAssetAmount,\n order.makerFee\n );\n fillResults.takerFeePaid = safeGetPartialAmountFloor(\n takerAssetFilledAmount,\n order.takerAssetAmount,\n order.takerFee\n );\n\n return fillResults;\n }\n\n /// @dev Settles an order by transferring assets between counterparties.\n /// @param order Order struct containing order specifications.\n /// @param takerAddress Address selling takerAsset and buying makerAsset.\n /// @param fillResults Amounts to be filled and fees paid by maker and taker.\n function settleOrder(\n LibOrder.Order memory order,\n address takerAddress,\n LibFillResults.FillResults memory fillResults\n )\n private\n {\n bytes memory zrxAssetData = ZRX_ASSET_DATA;\n dispatchTransferFrom(\n order.makerAssetData,\n order.makerAddress,\n takerAddress,\n fillResults.makerAssetFilledAmount\n );\n dispatchTransferFrom(\n order.takerAssetData,\n takerAddress,\n order.makerAddress,\n fillResults.takerAssetFilledAmount\n );\n dispatchTransferFrom(\n zrxAssetData,\n order.makerAddress,\n order.feeRecipientAddress,\n fillResults.makerFeePaid\n );\n dispatchTransferFrom(\n zrxAssetData,\n takerAddress,\n order.feeRecipientAddress,\n fillResults.takerFeePaid\n );\n }\n}\n",
+ "utils/ReentrancyGuard/ReentrancyGuard.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ReentrancyGuard {\n\n // Locked state of mutex\n bool private locked = false;\n\n /// @dev Functions with this modifer cannot be reentered. The mutex will be locked\n /// before function execution and unlocked after.\n modifier nonReentrant() {\n // Ensure mutex is unlocked\n require(\n !locked,\n \"REENTRANCY_ILLEGAL\"\n );\n\n // Lock mutex before function call\n locked = true;\n\n // Perform function call\n _;\n\n // Unlock mutex after function call\n locked = false;\n }\n}\n",
+ "protocol/Exchange/libs/LibFillResults.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibFillResults is\n SafeMath\n{\n struct FillResults {\n uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.\n uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.\n uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).\n uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).\n }\n\n struct MatchedFillResults {\n FillResults left; // Amounts filled and fees paid of left order.\n FillResults right; // Amounts filled and fees paid of right order.\n uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker.\n }\n\n /// @dev Adds properties of both FillResults instances.\n /// Modifies the first FillResults instance specified.\n /// @param totalFillResults Fill results instance that will be added onto.\n /// @param singleFillResults Fill results instance that will be added to totalFillResults.\n function addFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)\n internal\n pure\n {\n totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);\n totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);\n totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);\n totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "protocol/Exchange/libs/LibOrder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./LibEIP712.sol\";\n\n\ncontract LibOrder is\n LibEIP712\n{\n // Hash for the EIP712 Order Schema\n bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"Order(\",\n \"address makerAddress,\",\n \"address takerAddress,\",\n \"address feeRecipientAddress,\",\n \"address senderAddress,\",\n \"uint256 makerAssetAmount,\",\n \"uint256 takerAssetAmount,\",\n \"uint256 makerFee,\",\n \"uint256 takerFee,\",\n \"uint256 expirationTimeSeconds,\",\n \"uint256 salt,\",\n \"bytes makerAssetData,\",\n \"bytes takerAssetData\",\n \")\"\n ));\n\n // A valid order remains fillable until it is expired, fully filled, or cancelled.\n // An order's state is unaffected by external factors, like account balances.\n enum OrderStatus {\n INVALID, // Default value\n INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount\n INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount\n FILLABLE, // Order is fillable\n EXPIRED, // Order has already expired\n FULLY_FILLED, // Order is fully filled\n CANCELLED // Order has been cancelled\n }\n\n // solhint-disable max-line-length\n struct Order {\n address makerAddress; // Address that created the order. \n address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. \n address feeRecipientAddress; // Address that will recieve fees when order is filled. \n address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.\n uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. \n uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. \n uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.\n uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.\n uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. \n uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. \n bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.\n bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.\n }\n // solhint-enable max-line-length\n\n struct OrderInfo {\n uint8 orderStatus; // Status that describes order's validity and fillability.\n bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash).\n uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled.\n }\n\n /// @dev Calculates Keccak-256 hash of the order.\n /// @param order The order structure.\n /// @return Keccak-256 EIP712 hash of the order.\n function getOrderHash(Order memory order)\n internal\n view\n returns (bytes32 orderHash)\n {\n orderHash = hashEIP712Message(hashOrder(order));\n return orderHash;\n }\n\n /// @dev Calculates EIP712 hash of the order.\n /// @param order The order structure.\n /// @return EIP712 hash of the order.\n function hashOrder(Order memory order)\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;\n bytes32 makerAssetDataHash = keccak256(order.makerAssetData);\n bytes32 takerAssetDataHash = keccak256(order.takerAssetData);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ORDER_SCHEMA_HASH,\n // bytes32(order.makerAddress),\n // bytes32(order.takerAddress),\n // bytes32(order.feeRecipientAddress),\n // bytes32(order.senderAddress),\n // order.makerAssetAmount,\n // order.takerAssetAmount,\n // order.makerFee,\n // order.takerFee,\n // order.expirationTimeSeconds,\n // order.salt,\n // keccak256(order.makerAssetData),\n // keccak256(order.takerAssetData)\n // ));\n\n assembly {\n // Calculate memory addresses that will be swapped out before hashing\n let pos1 := sub(order, 32)\n let pos2 := add(order, 320)\n let pos3 := add(order, 352)\n\n // Backup\n let temp1 := mload(pos1)\n let temp2 := mload(pos2)\n let temp3 := mload(pos3)\n \n // Hash in place\n mstore(pos1, schemaHash)\n mstore(pos2, makerAssetDataHash)\n mstore(pos3, takerAssetDataHash)\n result := keccak256(pos1, 416)\n \n // Restore\n mstore(pos1, temp1)\n mstore(pos2, temp2)\n mstore(pos3, temp3)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibEIP712.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract LibEIP712 {\n\n // EIP191 header for EIP712 prefix\n string constant internal EIP191_HEADER = \"\\x19\\x01\";\n\n // EIP712 Domain Name value\n string constant internal EIP712_DOMAIN_NAME = \"0x Protocol\";\n\n // EIP712 Domain Version value\n string constant internal EIP712_DOMAIN_VERSION = \"2\";\n\n // Hash of the EIP712 Domain Separator Schema\n bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"address verifyingContract\",\n \")\"\n ));\n\n // Hash of the EIP712 Domain Separator data\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public EIP712_DOMAIN_HASH;\n\n constructor ()\n public\n {\n EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(\n EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,\n keccak256(bytes(EIP712_DOMAIN_NAME)),\n keccak256(bytes(EIP712_DOMAIN_VERSION)),\n bytes32(address(this))\n ));\n }\n\n /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.\n /// @param hashStruct The EIP712 hash struct.\n /// @return EIP712 hash applied to this EIP712 Domain.\n function hashEIP712Message(bytes32 hashStruct)\n internal\n view\n returns (bytes32 result)\n {\n bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;\n\n // Assembly for more efficient computing:\n // keccak256(abi.encodePacked(\n // EIP191_HEADER,\n // EIP712_DOMAIN_HASH,\n // hashStruct \n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header\n mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash\n mstore(add(memPtr, 34), hashStruct) // Hash of struct\n\n // Compute hash\n result := keccak256(memPtr, 66)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibMath.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibMath is\n SafeMath\n{\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// Reverts if rounding error is >= 0.1%\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded down.\n function safeGetPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n require(\n !isRoundingErrorFloor(\n numerator,\n denominator,\n target\n ),\n \"ROUNDING_ERROR\"\n );\n \n partialAmount = safeDiv(\n safeMul(numerator, target),\n denominator\n );\n return partialAmount;\n }\n\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// Reverts if rounding error is >= 0.1%\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded up.\n function safeGetPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n require(\n !isRoundingErrorCeil(\n numerator,\n denominator,\n target\n ),\n \"ROUNDING_ERROR\"\n );\n \n // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):\n // ceil(a / b) = floor((a + b - 1) / b)\n // To implement `ceil(a / b)` using safeDiv.\n partialAmount = safeDiv(\n safeAdd(\n safeMul(numerator, target),\n safeSub(denominator, 1)\n ),\n denominator\n );\n return partialAmount;\n }\n\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded down.\n function getPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n partialAmount = safeDiv(\n safeMul(numerator, target),\n denominator\n );\n return partialAmount;\n }\n \n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded up.\n function getPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):\n // ceil(a / b) = floor((a + b - 1) / b)\n // To implement `ceil(a / b)` using safeDiv.\n partialAmount = safeDiv(\n safeAdd(\n safeMul(numerator, target),\n safeSub(denominator, 1)\n ),\n denominator\n );\n return partialAmount;\n }\n \n /// @dev Checks if rounding error >= 0.1% when rounding down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to multiply with numerator/denominator.\n /// @return Rounding error is present.\n function isRoundingErrorFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (bool isError)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n \n // The absolute rounding error is the difference between the rounded\n // value and the ideal value. The relative rounding error is the\n // absolute rounding error divided by the absolute value of the\n // ideal value. This is undefined when the ideal value is zero.\n //\n // The ideal value is `numerator * target / denominator`.\n // Let's call `numerator * target % denominator` the remainder.\n // The absolute error is `remainder / denominator`.\n //\n // When the ideal value is zero, we require the absolute error to\n // be zero. Fortunately, this is always the case. The ideal value is\n // zero iff `numerator == 0` and/or `target == 0`. In this case the\n // remainder and absolute error are also zero. \n if (target == 0 || numerator == 0) {\n return false;\n }\n \n // Otherwise, we want the relative rounding error to be strictly\n // less than 0.1%.\n // The relative error is `remainder / (numerator * target)`.\n // We want the relative error less than 1 / 1000:\n // remainder / (numerator * denominator) < 1 / 1000\n // or equivalently:\n // 1000 * remainder < numerator * target\n // so we have a rounding error iff:\n // 1000 * remainder >= numerator * target\n uint256 remainder = mulmod(\n target,\n numerator,\n denominator\n );\n isError = safeMul(1000, remainder) >= safeMul(numerator, target);\n return isError;\n }\n \n /// @dev Checks if rounding error >= 0.1% when rounding up.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to multiply with numerator/denominator.\n /// @return Rounding error is present.\n function isRoundingErrorCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (bool isError)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n \n // See the comments in `isRoundingError`.\n if (target == 0 || numerator == 0) {\n // When either is zero, the ideal value and rounded value are zero\n // and there is no rounding error. (Although the relative error\n // is undefined.)\n return false;\n }\n // Compute remainder as before\n uint256 remainder = mulmod(\n target,\n numerator,\n denominator\n );\n remainder = safeSub(denominator, remainder) % denominator;\n isError = safeMul(1000, remainder) >= safeMul(numerator, target);\n return isError;\n }\n}\n",
+ "protocol/Exchange/mixins/MExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\nimport \"../interfaces/IExchangeCore.sol\";\n\n\ncontract MExchangeCore is\n IExchangeCore\n{\n // Fill event is emitted whenever an order is filled.\n event Fill(\n address indexed makerAddress, // Address that created the order. \n address indexed feeRecipientAddress, // Address that received fees.\n address takerAddress, // Address that filled the order.\n address senderAddress, // Address that called the Exchange contract (msg.sender).\n uint256 makerAssetFilledAmount, // Amount of makerAsset sold by maker and bought by taker. \n uint256 takerAssetFilledAmount, // Amount of takerAsset sold by taker and bought by maker.\n uint256 makerFeePaid, // Amount of ZRX paid to feeRecipient by maker.\n uint256 takerFeePaid, // Amount of ZRX paid to feeRecipient by taker.\n bytes32 indexed orderHash, // EIP712 hash of order (see LibOrder.getOrderHash).\n bytes makerAssetData, // Encoded data specific to makerAsset. \n bytes takerAssetData // Encoded data specific to takerAsset.\n );\n\n // Cancel event is emitted whenever an individual order is cancelled.\n event Cancel(\n address indexed makerAddress, // Address that created the order. \n address indexed feeRecipientAddress, // Address that would have recieved fees if order was filled. \n address senderAddress, // Address that called the Exchange contract (msg.sender).\n bytes32 indexed orderHash, // EIP712 hash of order (see LibOrder.getOrderHash).\n bytes makerAssetData, // Encoded data specific to makerAsset. \n bytes takerAssetData // Encoded data specific to takerAsset.\n );\n\n // CancelUpTo event is emitted whenever `cancelOrdersUpTo` is executed succesfully.\n event CancelUpTo(\n address indexed makerAddress, // Orders cancelled must have been created by this address.\n address indexed senderAddress, // Orders cancelled must have a `senderAddress` equal to this address.\n uint256 orderEpoch // Orders with specified makerAddress and senderAddress with a salt less than this value are considered cancelled.\n );\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderInternal(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev After calling, the order can not be filled anymore.\n /// @param order Order struct containing order specifications.\n function cancelOrderInternal(LibOrder.Order memory order)\n internal;\n\n /// @dev Updates state with results of a fill order.\n /// @param order that was filled.\n /// @param takerAddress Address of taker who filled the order.\n /// @param orderTakerAssetFilledAmount Amount of order already filled.\n /// @return fillResults Amounts filled and fees paid by maker and taker.\n function updateFilledState(\n LibOrder.Order memory order,\n address takerAddress,\n bytes32 orderHash,\n uint256 orderTakerAssetFilledAmount,\n LibFillResults.FillResults memory fillResults\n )\n internal;\n\n /// @dev Updates state with results of cancelling an order.\n /// State is only updated if the order is currently fillable.\n /// Otherwise, updating state would have no effect.\n /// @param order that was cancelled.\n /// @param orderHash Hash of order that was cancelled.\n function updateCancelledState(\n LibOrder.Order memory order,\n bytes32 orderHash\n )\n internal;\n \n /// @dev Validates context for fillOrder. Succeeds or throws.\n /// @param order to be filled.\n /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.\n /// @param takerAddress Address of order taker.\n /// @param signature Proof that the orders was created by its maker.\n function assertFillableOrder(\n LibOrder.Order memory order,\n LibOrder.OrderInfo memory orderInfo,\n address takerAddress,\n bytes memory signature\n )\n internal\n view;\n \n /// @dev Validates context for fillOrder. Succeeds or throws.\n /// @param order to be filled.\n /// @param orderInfo Status, orderHash, and amount already filled of order.\n /// @param takerAssetFillAmount Desired amount of order to fill by taker.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @param makerAssetFilledAmount Amount of makerAsset that will be transfered.\n function assertValidFill(\n LibOrder.Order memory order,\n LibOrder.OrderInfo memory orderInfo,\n uint256 takerAssetFillAmount,\n uint256 takerAssetFilledAmount,\n uint256 makerAssetFilledAmount\n )\n internal\n view;\n\n /// @dev Validates context for cancelOrder. Succeeds or throws.\n /// @param order to be cancelled.\n /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.\n function assertValidCancel(\n LibOrder.Order memory order,\n LibOrder.OrderInfo memory orderInfo\n )\n internal\n view;\n\n /// @dev Calculates amounts filled and fees paid by maker and taker.\n /// @param order to be filled.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @return fillResults Amounts filled and fees paid by maker and taker.\n function calculateFillResults(\n LibOrder.Order memory order,\n uint256 takerAssetFilledAmount\n )\n internal\n pure\n returns (LibFillResults.FillResults memory fillResults);\n\n}\n",
+ "protocol/Exchange/interfaces/IExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IExchangeCore {\n\n /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch\n /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).\n /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.\n function cancelOrdersUpTo(uint256 targetOrderEpoch)\n external;\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev After calling, the order can not be filled anymore.\n /// @param order Order struct containing order specifications.\n function cancelOrder(LibOrder.Order memory order)\n public;\n\n /// @dev Gets information about an order: status, hash, and amount filled.\n /// @param order Order to gather information on.\n /// @return OrderInfo Information about the order and its state.\n /// See LibOrder.OrderInfo for a complete description.\n function getOrderInfo(LibOrder.Order memory order)\n public\n view\n returns (LibOrder.OrderInfo memory orderInfo);\n}\n",
+ "protocol/Exchange/mixins/MSignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../interfaces/ISignatureValidator.sol\";\n\n\ncontract MSignatureValidator is\n ISignatureValidator\n{\n event SignatureValidatorApproval(\n address indexed signerAddress, // Address that approves or disapproves a contract to verify signatures.\n address indexed validatorAddress, // Address of signature validator contract.\n bool approved // Approval or disapproval of validator contract.\n );\n\n // Allowed signature types.\n enum SignatureType {\n Illegal, // 0x00, default value\n Invalid, // 0x01\n EIP712, // 0x02\n EthSign, // 0x03\n Wallet, // 0x04\n Validator, // 0x05\n PreSigned, // 0x06\n NSignatureTypes // 0x07, number of signature types. Always leave at end.\n }\n\n /// @dev Verifies signature using logic defined by Wallet contract.\n /// @param hash Any 32 byte hash.\n /// @param walletAddress Address that should have signed the given hash\n /// and defines its own signature verification method.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidWalletSignature(\n bytes32 hash,\n address walletAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid);\n\n /// @dev Verifies signature using logic defined by Validator contract.\n /// @param validatorAddress Address of validator contract.\n /// @param hash Any 32 byte hash.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidValidatorSignature(\n address validatorAddress,\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ISignatureValidator {\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external;\n \n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external;\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address of signer.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/mixins/MTransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\nimport \"../interfaces/ITransactions.sol\";\n\n\ncontract MTransactions is\n ITransactions\n{\n // Hash for the EIP712 ZeroEx Transaction Schema\n bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"ZeroExTransaction(\",\n \"uint256 salt,\",\n \"address signerAddress,\",\n \"bytes data\",\n \")\"\n ));\n\n /// @dev Calculates EIP712 hash of the Transaction.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @return EIP712 hash of the Transaction.\n function hashZeroExTransaction(\n uint256 salt,\n address signerAddress,\n bytes memory data\n )\n internal\n pure\n returns (bytes32 result);\n\n /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).\n /// If calling a fill function, this address will represent the taker.\n /// If calling a cancel function, this address will represent the maker.\n /// @return Signer of 0x transaction if entry point is `executeTransaction`.\n /// `msg.sender` if entry point is any other function.\n function getCurrentContextAddress()\n internal\n view\n returns (address);\n}\n",
+ "protocol/Exchange/interfaces/ITransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\n\ncontract ITransactions {\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external;\n}\n",
+ "protocol/Exchange/mixins/MAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../interfaces/IAssetProxyDispatcher.sol\";\n\n\ncontract MAssetProxyDispatcher is\n IAssetProxyDispatcher\n{\n // Logs registration of new asset proxy\n event AssetProxyRegistered(\n bytes4 id, // Id of new registered AssetProxy.\n address assetProxy // Address of new registered AssetProxy.\n );\n\n /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.\n /// @param assetData Byte array encoded for the asset.\n /// @param from Address to transfer token from.\n /// @param to Address to transfer token to.\n /// @param amount Amount of token to transfer.\n function dispatchTransferFrom(\n bytes memory assetData,\n address from,\n address to,\n uint256 amount\n )\n internal;\n}\n",
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IAssetProxyDispatcher {\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external;\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address);\n}\n",
+ "protocol/Exchange/MixinSignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/LibBytes/LibBytes.sol\";\nimport \"../../utils/ReentrancyGuard/ReentrancyGuard.sol\";\nimport \"./mixins/MSignatureValidator.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./interfaces/IWallet.sol\";\nimport \"./interfaces/IValidator.sol\";\n\n\ncontract MixinSignatureValidator is\n ReentrancyGuard,\n MSignatureValidator,\n MTransactions\n{\n using LibBytes for bytes;\n \n // Mapping of hash => signer => signed\n mapping (bytes32 => mapping (address => bool)) public preSigned;\n\n // Mapping of signer => validator => approved\n mapping (address => mapping (address => bool)) public allowedValidators;\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n {\n if (signerAddress != msg.sender) {\n require(\n isValidSignature(\n hash,\n signerAddress,\n signature\n ),\n \"INVALID_SIGNATURE\"\n );\n }\n preSigned[hash][signerAddress] = true;\n }\n\n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external\n nonReentrant\n {\n address signerAddress = getCurrentContextAddress();\n allowedValidators[signerAddress][validatorAddress] = approval;\n emit SignatureValidatorApproval(\n signerAddress,\n validatorAddress,\n approval\n );\n }\n\n /// @dev Verifies that a hash has been signed by the given signer.\n /// @param hash Any 32 byte hash.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid)\n {\n require(\n signature.length > 0,\n \"LENGTH_GREATER_THAN_0_REQUIRED\"\n );\n\n // Pop last byte off of signature byte array.\n uint8 signatureTypeRaw = uint8(signature.popLastByte());\n\n // Ensure signature is supported\n require(\n signatureTypeRaw < uint8(SignatureType.NSignatureTypes),\n \"SIGNATURE_UNSUPPORTED\"\n );\n\n SignatureType signatureType = SignatureType(signatureTypeRaw);\n\n // Variables are not scoped in Solidity.\n uint8 v;\n bytes32 r;\n bytes32 s;\n address recovered;\n\n // Always illegal signature.\n // This is always an implicit option since a signer can create a\n // signature array with invalid type or length. We may as well make\n // it an explicit option. This aids testing and analysis. It is\n // also the initialization value for the enum type.\n if (signatureType == SignatureType.Illegal) {\n revert(\"SIGNATURE_ILLEGAL\");\n\n // Always invalid signature.\n // Like Illegal, this is always implicitly available and therefore\n // offered explicitly. It can be implicitly created by providing\n // a correctly formatted but incorrect signature.\n } else if (signatureType == SignatureType.Invalid) {\n require(\n signature.length == 0,\n \"LENGTH_0_REQUIRED\"\n );\n isValid = false;\n return isValid;\n\n // Signature using EIP712\n } else if (signatureType == SignatureType.EIP712) {\n require(\n signature.length == 65,\n \"LENGTH_65_REQUIRED\"\n );\n v = uint8(signature[0]);\n r = signature.readBytes32(1);\n s = signature.readBytes32(33);\n recovered = ecrecover(\n hash,\n v,\n r,\n s\n );\n isValid = signerAddress == recovered;\n return isValid;\n\n // Signed using web3.eth_sign\n } else if (signatureType == SignatureType.EthSign) {\n require(\n signature.length == 65,\n \"LENGTH_65_REQUIRED\"\n );\n v = uint8(signature[0]);\n r = signature.readBytes32(1);\n s = signature.readBytes32(33);\n recovered = ecrecover(\n keccak256(abi.encodePacked(\n \"\\x19Ethereum Signed Message:\\n32\",\n hash\n )),\n v,\n r,\n s\n );\n isValid = signerAddress == recovered;\n return isValid;\n\n // Signature verified by wallet contract.\n // If used with an order, the maker of the order is the wallet contract.\n } else if (signatureType == SignatureType.Wallet) {\n isValid = isValidWalletSignature(\n hash,\n signerAddress,\n signature\n );\n return isValid;\n\n // Signature verified by validator contract.\n // If used with an order, the maker of the order can still be an EOA.\n // A signature using this type should be encoded as:\n // | Offset | Length | Contents |\n // | 0x00 | x | Signature to validate |\n // | 0x00 + x | 20 | Address of validator contract |\n // | 0x14 + x | 1 | Signature type is always \"\\x06\" |\n } else if (signatureType == SignatureType.Validator) {\n // Pop last 20 bytes off of signature byte array.\n address validatorAddress = signature.popLast20Bytes();\n \n // Ensure signer has approved validator.\n if (!allowedValidators[signerAddress][validatorAddress]) {\n return false;\n }\n isValid = isValidValidatorSignature(\n validatorAddress,\n hash,\n signerAddress,\n signature\n );\n return isValid;\n\n // Signer signed hash previously using the preSign function.\n } else if (signatureType == SignatureType.PreSigned) {\n isValid = preSigned[hash][signerAddress];\n return isValid;\n }\n\n // Anything else is illegal (We do not return false because\n // the signature may actually be valid, just not in a format\n // that we currently support. In this case returning false\n // may lead the caller to incorrectly believe that the\n // signature was invalid.)\n revert(\"SIGNATURE_UNSUPPORTED\");\n }\n\n /// @dev Verifies signature using logic defined by Wallet contract.\n /// @param hash Any 32 byte hash.\n /// @param walletAddress Address that should have signed the given hash\n /// and defines its own signature verification method.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if signature is valid for given wallet..\n function isValidWalletSignature(\n bytes32 hash,\n address walletAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid)\n {\n bytes memory calldata = abi.encodeWithSelector(\n IWallet(walletAddress).isValidSignature.selector,\n hash,\n signature\n );\n assembly {\n let cdStart := add(calldata, 32)\n let success := staticcall(\n gas, // forward all gas\n walletAddress, // address of Wallet contract\n cdStart, // pointer to start of input\n mload(calldata), // length of input\n cdStart, // write output over input\n 32 // output size is 32 bytes\n )\n\n switch success\n case 0 {\n // Revert with `Error(\"WALLET_ERROR\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000000c57414c4c45545f4552524f5200000000000000000000000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n case 1 {\n // Signature is valid if call did not revert and returned true\n isValid := mload(cdStart)\n }\n }\n return isValid;\n }\n\n /// @dev Verifies signature using logic defined by Validator contract.\n /// @param validatorAddress Address of validator contract.\n /// @param hash Any 32 byte hash.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidValidatorSignature(\n address validatorAddress,\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid)\n {\n bytes memory calldata = abi.encodeWithSelector(\n IValidator(signerAddress).isValidSignature.selector,\n hash,\n signerAddress,\n signature\n );\n assembly {\n let cdStart := add(calldata, 32)\n let success := staticcall(\n gas, // forward all gas\n validatorAddress, // address of Validator contract\n cdStart, // pointer to start of input\n mload(calldata), // length of input\n cdStart, // write output over input\n 32 // output size is 32 bytes\n )\n\n switch success\n case 0 {\n // Revert with `Error(\"VALIDATOR_ERROR\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000000f56414c494441544f525f4552524f5200000000000000000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n case 1 {\n // Signature is valid if call did not revert and returned true\n isValid := mload(cdStart)\n }\n }\n return isValid;\n }\n}\n",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n",
+ "protocol/Exchange/interfaces/IWallet.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IWallet {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/IValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IValidator {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/MixinWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../utils/ReentrancyGuard/ReentrancyGuard.sol\";\nimport \"./libs/LibMath.sol\";\nimport \"./libs/LibOrder.sol\";\nimport \"./libs/LibFillResults.sol\";\nimport \"./libs/LibAbiEncoder.sol\";\nimport \"./mixins/MExchangeCore.sol\";\nimport \"./mixins/MWrapperFunctions.sol\";\n\n\ncontract MixinWrapperFunctions is\n ReentrancyGuard,\n LibMath,\n LibFillResults,\n LibAbiEncoder,\n MExchangeCore,\n MWrapperFunctions\n{\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n nonReentrant\n returns (FillResults memory fillResults)\n {\n fillResults = fillOrKillOrderInternal(\n order,\n takerAssetFillAmount,\n signature\n );\n return fillResults;\n }\n\n /// @dev Fills the input order.\n /// Returns false if the transaction would otherwise revert.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (FillResults memory fillResults)\n {\n // ABI encode calldata for `fillOrder`\n bytes memory fillOrderCalldata = abiEncodeFillOrder(\n order,\n takerAssetFillAmount,\n signature\n );\n\n // Delegate to `fillOrder` and handle any exceptions gracefully\n assembly {\n let success := delegatecall(\n gas, // forward all gas\n address, // call address of this contract\n add(fillOrderCalldata, 32), // pointer to start of input (skip array length in first 32 bytes)\n mload(fillOrderCalldata), // length of input\n fillOrderCalldata, // write output over input\n 128 // output size is 128 bytes\n )\n if success {\n mstore(fillResults, mload(fillOrderCalldata))\n mstore(add(fillResults, 32), mload(add(fillOrderCalldata, 32)))\n mstore(add(fillResults, 64), mload(add(fillOrderCalldata, 64)))\n mstore(add(fillResults, 96), mload(add(fillOrderCalldata, 96)))\n }\n }\n // fillResults values will be 0 by default if call was unsuccessful\n return fillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrder.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.\n function batchFillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n nonReentrant\n returns (FillResults memory totalFillResults)\n {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n FillResults memory singleFillResults = fillOrderInternal(\n orders[i],\n takerAssetFillAmounts[i],\n signatures[i]\n );\n addFillResults(totalFillResults, singleFillResults);\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrKill.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.\n function batchFillOrKillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n nonReentrant\n returns (FillResults memory totalFillResults)\n {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n FillResults memory singleFillResults = fillOrKillOrderInternal(\n orders[i],\n takerAssetFillAmounts[i],\n signatures[i]\n );\n addFillResults(totalFillResults, singleFillResults);\n }\n return totalFillResults;\n }\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.\n function batchFillOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (FillResults memory totalFillResults)\n {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n FillResults memory singleFillResults = fillOrderNoThrow(\n orders[i],\n takerAssetFillAmounts[i],\n signatures[i]\n );\n addFillResults(totalFillResults, singleFillResults);\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrders(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n nonReentrant\n returns (FillResults memory totalFillResults)\n {\n bytes memory takerAssetData = orders[0].takerAssetData;\n \n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // We assume that asset being sold by taker is the same for each order.\n // Rather than passing this in as calldata, we use the takerAssetData from the first order in all later orders.\n orders[i].takerAssetData = takerAssetData;\n\n // Calculate the remaining amount of takerAsset to sell\n uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);\n\n // Attempt to sell the remaining amount of takerAsset\n FillResults memory singleFillResults = fillOrderInternal(\n orders[i],\n remainingTakerAssetFillAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker\n addFillResults(totalFillResults, singleFillResults);\n\n // Stop execution if the entire amount of takerAsset has been sold\n if (totalFillResults.takerAssetFilledAmount >= takerAssetFillAmount) {\n break;\n }\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (FillResults memory totalFillResults)\n {\n bytes memory takerAssetData = orders[0].takerAssetData;\n\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // We assume that asset being sold by taker is the same for each order.\n // Rather than passing this in as calldata, we use the takerAssetData from the first order in all later orders.\n orders[i].takerAssetData = takerAssetData;\n\n // Calculate the remaining amount of takerAsset to sell\n uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);\n\n // Attempt to sell the remaining amount of takerAsset\n FillResults memory singleFillResults = fillOrderNoThrow(\n orders[i],\n remainingTakerAssetFillAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker\n addFillResults(totalFillResults, singleFillResults);\n\n // Stop execution if the entire amount of takerAsset has been sold\n if (totalFillResults.takerAssetFilledAmount >= takerAssetFillAmount) {\n break;\n }\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrders(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n nonReentrant\n returns (FillResults memory totalFillResults)\n {\n bytes memory makerAssetData = orders[0].makerAssetData;\n\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // We assume that asset being bought by taker is the same for each order.\n // Rather than passing this in as calldata, we copy the makerAssetData from the first order onto all later orders.\n orders[i].makerAssetData = makerAssetData;\n\n // Calculate the remaining amount of makerAsset to buy\n uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);\n\n // Convert the remaining amount of makerAsset to buy into remaining amount\n // of takerAsset to sell, assuming entire amount can be sold in the current order\n uint256 remainingTakerAssetFillAmount = getPartialAmountFloor(\n orders[i].takerAssetAmount,\n orders[i].makerAssetAmount,\n remainingMakerAssetFillAmount\n );\n\n // Attempt to sell the remaining amount of takerAsset\n FillResults memory singleFillResults = fillOrderInternal(\n orders[i],\n remainingTakerAssetFillAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker\n addFillResults(totalFillResults, singleFillResults);\n\n // Stop execution if the entire amount of makerAsset has been bought\n if (totalFillResults.makerAssetFilledAmount >= makerAssetFillAmount) {\n break;\n }\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (FillResults memory totalFillResults)\n {\n bytes memory makerAssetData = orders[0].makerAssetData;\n\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // We assume that asset being bought by taker is the same for each order.\n // Rather than passing this in as calldata, we copy the makerAssetData from the first order onto all later orders.\n orders[i].makerAssetData = makerAssetData;\n\n // Calculate the remaining amount of makerAsset to buy\n uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);\n\n // Convert the remaining amount of makerAsset to buy into remaining amount\n // of takerAsset to sell, assuming entire amount can be sold in the current order\n uint256 remainingTakerAssetFillAmount = getPartialAmountFloor(\n orders[i].takerAssetAmount,\n orders[i].makerAssetAmount,\n remainingMakerAssetFillAmount\n );\n\n // Attempt to sell the remaining amount of takerAsset\n FillResults memory singleFillResults = fillOrderNoThrow(\n orders[i],\n remainingTakerAssetFillAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker\n addFillResults(totalFillResults, singleFillResults);\n\n // Stop execution if the entire amount of makerAsset has been bought\n if (totalFillResults.makerAssetFilledAmount >= makerAssetFillAmount) {\n break;\n }\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously cancels multiple orders in a single transaction.\n /// @param orders Array of order specifications.\n function batchCancelOrders(LibOrder.Order[] memory orders)\n public\n nonReentrant\n {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n cancelOrderInternal(orders[i]);\n }\n }\n\n /// @dev Fetches information for all passed in orders.\n /// @param orders Array of order specifications.\n /// @return Array of OrderInfo instances that correspond to each order.\n function getOrdersInfo(LibOrder.Order[] memory orders)\n public\n view\n returns (LibOrder.OrderInfo[] memory)\n {\n uint256 ordersLength = orders.length;\n LibOrder.OrderInfo[] memory ordersInfo = new LibOrder.OrderInfo[](ordersLength);\n for (uint256 i = 0; i != ordersLength; i++) {\n ordersInfo[i] = getOrderInfo(orders[i]);\n }\n return ordersInfo;\n }\n\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrderInternal(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n returns (FillResults memory fillResults)\n {\n fillResults = fillOrderInternal(\n order,\n takerAssetFillAmount,\n signature\n );\n require(\n fillResults.takerAssetFilledAmount == takerAssetFillAmount,\n \"COMPLETE_FILL_FAILED\"\n );\n return fillResults;\n }\n}\n",
+ "protocol/Exchange/libs/LibAbiEncoder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./LibOrder.sol\";\n\n\ncontract LibAbiEncoder {\n\n /// @dev ABI encodes calldata for `fillOrder`.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return ABI encoded calldata for `fillOrder`.\n function abiEncodeFillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n pure\n returns (bytes memory fillOrderCalldata)\n {\n // We need to call MExchangeCore.fillOrder using a delegatecall in\n // assembly so that we can intercept a call that throws. For this, we\n // need the input encoded in memory in the Ethereum ABIv2 format [1].\n\n // | Area | Offset | Length | Contents |\n // | -------- |--------|---------|-------------------------------------------- |\n // | Header | 0x00 | 4 | function selector |\n // | Params | | 3 * 32 | function parameters: |\n // | | 0x00 | | 1. offset to order (*) |\n // | | 0x20 | | 2. takerAssetFillAmount |\n // | | 0x40 | | 3. offset to signature (*) |\n // | Data | | 12 * 32 | order: |\n // | | 0x000 | | 1. senderAddress |\n // | | 0x020 | | 2. makerAddress |\n // | | 0x040 | | 3. takerAddress |\n // | | 0x060 | | 4. feeRecipientAddress |\n // | | 0x080 | | 5. makerAssetAmount |\n // | | 0x0A0 | | 6. takerAssetAmount |\n // | | 0x0C0 | | 7. makerFeeAmount |\n // | | 0x0E0 | | 8. takerFeeAmount |\n // | | 0x100 | | 9. expirationTimeSeconds |\n // | | 0x120 | | 10. salt |\n // | | 0x140 | | 11. Offset to makerAssetData (*) |\n // | | 0x160 | | 12. Offset to takerAssetData (*) |\n // | | 0x180 | 32 | makerAssetData Length |\n // | | 0x1A0 | ** | makerAssetData Contents |\n // | | 0x1C0 | 32 | takerAssetData Length |\n // | | 0x1E0 | ** | takerAssetData Contents |\n // | | 0x200 | 32 | signature Length |\n // | | 0x220 | ** | signature Contents |\n\n // * Offsets are calculated from the beginning of the current area: Header, Params, Data:\n // An offset stored in the Params area is calculated from the beginning of the Params section.\n // An offset stored in the Data area is calculated from the beginning of the Data section.\n\n // ** The length of dynamic array contents are stored in the field immediately preceeding the contents.\n\n // [1]: https://solidity.readthedocs.io/en/develop/abi-spec.html\n\n assembly {\n\n // Areas below may use the following variables:\n // 1. <area>Start -- Start of this area in memory\n // 2. <area>End -- End of this area in memory. This value may\n // be precomputed (before writing contents),\n // or it may be computed as contents are written.\n // 3. <area>Offset -- Current offset into area. If an area's End\n // is precomputed, this variable tracks the\n // offsets of contents as they are written.\n\n /////// Setup Header Area ///////\n // Load free memory pointer\n fillOrderCalldata := mload(0x40)\n // bytes4(keccak256(\"fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)\"))\n // = 0xb4be83d5\n // Leave 0x20 bytes to store the length\n mstore(add(fillOrderCalldata, 0x20), 0xb4be83d500000000000000000000000000000000000000000000000000000000)\n let headerAreaEnd := add(fillOrderCalldata, 0x24)\n\n /////// Setup Params Area ///////\n // This area is preallocated and written to later.\n // This is because we need to fill in offsets that have not yet been calculated.\n let paramsAreaStart := headerAreaEnd\n let paramsAreaEnd := add(paramsAreaStart, 0x60)\n let paramsAreaOffset := paramsAreaStart\n\n /////// Setup Data Area ///////\n let dataAreaStart := paramsAreaEnd\n let dataAreaEnd := dataAreaStart\n\n // Offset from the source data we're reading from\n let sourceOffset := order\n // arrayLenBytes and arrayLenWords track the length of a dynamically-allocated bytes array.\n let arrayLenBytes := 0\n let arrayLenWords := 0\n\n /////// Write order Struct ///////\n // Write memory location of Order, relative to the start of the\n // parameter list, then increment the paramsAreaOffset respectively.\n mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))\n paramsAreaOffset := add(paramsAreaOffset, 0x20)\n\n // Write values for each field in the order\n // It would be nice to use a loop, but we save on gas by writing\n // the stores sequentially.\n mstore(dataAreaEnd, mload(sourceOffset)) // makerAddress\n mstore(add(dataAreaEnd, 0x20), mload(add(sourceOffset, 0x20))) // takerAddress\n mstore(add(dataAreaEnd, 0x40), mload(add(sourceOffset, 0x40))) // feeRecipientAddress\n mstore(add(dataAreaEnd, 0x60), mload(add(sourceOffset, 0x60))) // senderAddress\n mstore(add(dataAreaEnd, 0x80), mload(add(sourceOffset, 0x80))) // makerAssetAmount\n mstore(add(dataAreaEnd, 0xA0), mload(add(sourceOffset, 0xA0))) // takerAssetAmount\n mstore(add(dataAreaEnd, 0xC0), mload(add(sourceOffset, 0xC0))) // makerFeeAmount\n mstore(add(dataAreaEnd, 0xE0), mload(add(sourceOffset, 0xE0))) // takerFeeAmount\n mstore(add(dataAreaEnd, 0x100), mload(add(sourceOffset, 0x100))) // expirationTimeSeconds\n mstore(add(dataAreaEnd, 0x120), mload(add(sourceOffset, 0x120))) // salt\n mstore(add(dataAreaEnd, 0x140), mload(add(sourceOffset, 0x140))) // Offset to makerAssetData\n mstore(add(dataAreaEnd, 0x160), mload(add(sourceOffset, 0x160))) // Offset to takerAssetData\n dataAreaEnd := add(dataAreaEnd, 0x180)\n sourceOffset := add(sourceOffset, 0x180)\n\n // Write offset to <order.makerAssetData>\n mstore(add(dataAreaStart, mul(10, 0x20)), sub(dataAreaEnd, dataAreaStart))\n\n // Calculate length of <order.makerAssetData>\n sourceOffset := mload(add(order, 0x140)) // makerAssetData\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of <order.makerAssetData>\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of <order.makerAssetData>\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n // Write offset to <order.takerAssetData>\n mstore(add(dataAreaStart, mul(11, 0x20)), sub(dataAreaEnd, dataAreaStart))\n\n // Calculate length of <order.takerAssetData>\n sourceOffset := mload(add(order, 0x160)) // takerAssetData\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of <order.takerAssetData>\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of <order.takerAssetData>\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n /////// Write takerAssetFillAmount ///////\n mstore(paramsAreaOffset, takerAssetFillAmount)\n paramsAreaOffset := add(paramsAreaOffset, 0x20)\n\n /////// Write signature ///////\n // Write offset to paramsArea\n mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))\n\n // Calculate length of signature\n sourceOffset := signature\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of signature\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of signature\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n // Set length of calldata\n mstore(fillOrderCalldata, sub(dataAreaEnd, add(fillOrderCalldata, 0x20)))\n\n // Increment free memory pointer\n mstore(0x40, dataAreaEnd)\n }\n\n return fillOrderCalldata;\n }\n}\n",
+ "protocol/Exchange/mixins/MWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\nimport \"../interfaces/IWrapperFunctions.sol\";\n\n\ncontract MWrapperFunctions is \n IWrapperFunctions\n{\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrderInternal(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n returns (LibFillResults.FillResults memory fillResults);\n}\n",
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IWrapperFunctions {\n\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrKill.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrKillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrders(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrders(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously cancels multiple orders in a single transaction.\n /// @param orders Array of order specifications.\n function batchCancelOrders(LibOrder.Order[] memory orders)\n public;\n\n /// @dev Fetches information for all passed in orders\n /// @param orders Array of order specifications.\n /// @return Array of OrderInfo instances that correspond to each order.\n function getOrdersInfo(LibOrder.Order[] memory orders)\n public\n view\n returns (LibOrder.OrderInfo[] memory);\n}\n",
+ "protocol/Exchange/MixinAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/Ownable/Ownable.sol\";\nimport \"./mixins/MAssetProxyDispatcher.sol\";\nimport \"../AssetProxy/interfaces/IAssetProxy.sol\";\n\n\ncontract MixinAssetProxyDispatcher is\n Ownable,\n MAssetProxyDispatcher\n{\n // Mapping from Asset Proxy Id's to their respective Asset Proxy\n mapping (bytes4 => IAssetProxy) public assetProxies;\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external\n onlyOwner\n {\n IAssetProxy assetProxyContract = IAssetProxy(assetProxy);\n\n // Ensure that no asset proxy exists with current id.\n bytes4 assetProxyId = assetProxyContract.getProxyId();\n address currentAssetProxy = assetProxies[assetProxyId];\n require(\n currentAssetProxy == address(0),\n \"ASSET_PROXY_ALREADY_EXISTS\"\n );\n\n // Add asset proxy and log registration.\n assetProxies[assetProxyId] = assetProxyContract;\n emit AssetProxyRegistered(\n assetProxyId,\n assetProxy\n );\n }\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address)\n {\n return assetProxies[assetProxyId];\n }\n\n /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.\n /// @param assetData Byte array encoded for the asset.\n /// @param from Address to transfer token from.\n /// @param to Address to transfer token to.\n /// @param amount Amount of token to transfer.\n function dispatchTransferFrom(\n bytes memory assetData,\n address from,\n address to,\n uint256 amount\n )\n internal\n {\n // Do nothing if no amount should be transferred.\n if (amount > 0 && from != to) {\n // Ensure assetData length is valid\n require(\n assetData.length > 3,\n \"LENGTH_GREATER_THAN_3_REQUIRED\"\n );\n \n // Lookup assetProxy. We do not use `LibBytes.readBytes4` for gas efficiency reasons.\n bytes4 assetProxyId;\n assembly {\n assetProxyId := and(mload(\n add(assetData, 32)),\n 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000\n )\n }\n address assetProxy = assetProxies[assetProxyId];\n\n // Ensure that assetProxy exists\n require(\n assetProxy != address(0),\n \"ASSET_PROXY_DOES_NOT_EXIST\"\n );\n \n // We construct calldata for the `assetProxy.transferFrom` ABI.\n // The layout of this calldata is in the table below.\n // \n // | Area | Offset | Length | Contents |\n // | -------- |--------|---------|-------------------------------------------- |\n // | Header | 0 | 4 | function selector |\n // | Params | | 4 * 32 | function parameters: |\n // | | 4 | | 1. offset to assetData (*) |\n // | | 36 | | 2. from |\n // | | 68 | | 3. to |\n // | | 100 | | 4. amount |\n // | Data | | | assetData: |\n // | | 132 | 32 | assetData Length |\n // | | 164 | ** | assetData Contents |\n\n assembly {\n /////// Setup State ///////\n // `cdStart` is the start of the calldata for `assetProxy.transferFrom` (equal to free memory ptr).\n let cdStart := mload(64)\n // `dataAreaLength` is the total number of words needed to store `assetData`\n // As-per the ABI spec, this value is padded up to the nearest multiple of 32,\n // and includes 32-bytes for length.\n let dataAreaLength := and(add(mload(assetData), 63), 0xFFFFFFFFFFFE0)\n // `cdEnd` is the end of the calldata for `assetProxy.transferFrom`.\n let cdEnd := add(cdStart, add(132, dataAreaLength))\n\n \n /////// Setup Header Area ///////\n // This area holds the 4-byte `transferFromSelector`.\n // bytes4(keccak256(\"transferFrom(bytes,address,address,uint256)\")) = 0xa85e59e4\n mstore(cdStart, 0xa85e59e400000000000000000000000000000000000000000000000000000000)\n \n /////// Setup Params Area ///////\n // Each parameter is padded to 32-bytes. The entire Params Area is 128 bytes.\n // Notes:\n // 1. The offset to `assetData` is the length of the Params Area (128 bytes).\n // 2. A 20-byte mask is applied to addresses to zero-out the unused bytes.\n mstore(add(cdStart, 4), 128)\n mstore(add(cdStart, 36), and(from, 0xffffffffffffffffffffffffffffffffffffffff))\n mstore(add(cdStart, 68), and(to, 0xffffffffffffffffffffffffffffffffffffffff))\n mstore(add(cdStart, 100), amount)\n \n /////// Setup Data Area ///////\n // This area holds `assetData`.\n let dataArea := add(cdStart, 132)\n // solhint-disable-next-line no-empty-blocks\n for {} lt(dataArea, cdEnd) {} {\n mstore(dataArea, mload(assetData))\n dataArea := add(dataArea, 32)\n assetData := add(assetData, 32)\n }\n\n /////// Call `assetProxy.transferFrom` using the constructed calldata ///////\n let success := call(\n gas, // forward all gas\n assetProxy, // call address of asset proxy\n 0, // don't send any ETH\n cdStart, // pointer to start of input\n sub(cdEnd, cdStart), // length of input \n cdStart, // write output over input\n 512 // reserve 512 bytes for output\n )\n if iszero(success) {\n revert(cdStart, returndatasize())\n }\n }\n }\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n",
+ "protocol/AssetProxy/interfaces/IAssetProxy.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IAuthorizable.sol\";\n\n\ncontract IAssetProxy is\n IAuthorizable\n{\n /// @dev Transfers assets. Either succeeds or throws.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param from Address to transfer asset from.\n /// @param to Address to transfer asset to.\n /// @param amount Amount of asset to transfer.\n function transferFrom(\n bytes assetData,\n address from,\n address to,\n uint256 amount\n )\n external;\n \n /// @dev Gets the proxy id associated with the proxy address.\n /// @return Proxy id.\n function getProxyId()\n external\n pure\n returns (bytes4);\n}\n",
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/Ownable/IOwnable.sol\";\n\n\ncontract IAuthorizable is\n IOwnable\n{\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n \n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory);\n}\n",
+ "protocol/Exchange/MixinTransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\nimport \"./libs/LibExchangeErrors.sol\";\nimport \"./mixins/MSignatureValidator.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./libs/LibEIP712.sol\";\n\n\ncontract MixinTransactions is\n LibEIP712,\n MSignatureValidator,\n MTransactions\n{\n // Mapping of transaction hash => executed\n // This prevents transactions from being executed more than once.\n mapping (bytes32 => bool) public transactions;\n\n // Address of current transaction signer\n address public currentContextAddress;\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external\n {\n // Prevent reentrancy\n require(\n currentContextAddress == address(0),\n \"REENTRANCY_ILLEGAL\"\n );\n\n bytes32 transactionHash = hashEIP712Message(hashZeroExTransaction(\n salt,\n signerAddress,\n data\n ));\n\n // Validate transaction has not been executed\n require(\n !transactions[transactionHash],\n \"INVALID_TX_HASH\"\n );\n\n // Transaction always valid if signer is sender of transaction\n if (signerAddress != msg.sender) {\n // Validate signature\n require(\n isValidSignature(\n transactionHash,\n signerAddress,\n signature\n ),\n \"INVALID_TX_SIGNATURE\"\n );\n\n // Set the current transaction signer\n currentContextAddress = signerAddress;\n }\n\n // Execute transaction\n transactions[transactionHash] = true;\n require(\n address(this).delegatecall(data),\n \"FAILED_EXECUTION\"\n );\n\n // Reset current transaction signer if it was previously updated\n if (signerAddress != msg.sender) {\n currentContextAddress = address(0);\n }\n }\n\n /// @dev Calculates EIP712 hash of the Transaction.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @return EIP712 hash of the Transaction.\n function hashZeroExTransaction(\n uint256 salt,\n address signerAddress,\n bytes memory data\n )\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH;\n bytes32 dataHash = keccak256(data);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH,\n // salt,\n // bytes32(signerAddress),\n // keccak256(data)\n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, schemaHash) // hash of schema\n mstore(add(memPtr, 32), salt) // salt\n mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) // signerAddress\n mstore(add(memPtr, 96), dataHash) // hash of data\n\n // Compute hash\n result := keccak256(memPtr, 128)\n }\n return result;\n }\n\n /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).\n /// If calling a fill function, this address will represent the taker.\n /// If calling a cancel function, this address will represent the maker.\n /// @return Signer of 0x transaction if entry point is `executeTransaction`.\n /// `msg.sender` if entry point is any other function.\n function getCurrentContextAddress()\n internal\n view\n returns (address)\n {\n address currentContextAddress_ = currentContextAddress;\n address contextAddress = currentContextAddress_ == address(0) ? msg.sender : currentContextAddress_;\n return contextAddress;\n }\n}\n",
+ "protocol/Exchange/libs/LibExchangeErrors.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\n// solhint-disable\npragma solidity 0.4.24;\n\n\n/// @dev This contract documents the revert reasons used in the Exchange contract.\n/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.\ncontract LibExchangeErrors {\n\n /// Order validation errors ///\n string constant ORDER_UNFILLABLE = \"ORDER_UNFILLABLE\"; // Order cannot be filled.\n string constant INVALID_MAKER = \"INVALID_MAKER\"; // Invalid makerAddress.\n string constant INVALID_TAKER = \"INVALID_TAKER\"; // Invalid takerAddress.\n string constant INVALID_SENDER = \"INVALID_SENDER\"; // Invalid `msg.sender`.\n string constant INVALID_ORDER_SIGNATURE = \"INVALID_ORDER_SIGNATURE\"; // Signature validation failed. \n \n /// fillOrder validation errors ///\n string constant INVALID_TAKER_AMOUNT = \"INVALID_TAKER_AMOUNT\"; // takerAssetFillAmount cannot equal 0.\n string constant ROUNDING_ERROR = \"ROUNDING_ERROR\"; // Rounding error greater than 0.1% of takerAssetFillAmount. \n \n /// Signature validation errors ///\n string constant INVALID_SIGNATURE = \"INVALID_SIGNATURE\"; // Signature validation failed. \n string constant SIGNATURE_ILLEGAL = \"SIGNATURE_ILLEGAL\"; // Signature type is illegal.\n string constant SIGNATURE_UNSUPPORTED = \"SIGNATURE_UNSUPPORTED\"; // Signature type unsupported.\n \n /// cancelOrdersUptTo errors ///\n string constant INVALID_NEW_ORDER_EPOCH = \"INVALID_NEW_ORDER_EPOCH\"; // Specified salt must be greater than or equal to existing orderEpoch.\n\n /// fillOrKillOrder errors ///\n string constant COMPLETE_FILL_FAILED = \"COMPLETE_FILL_FAILED\"; // Desired takerAssetFillAmount could not be completely filled. \n\n /// matchOrders errors ///\n string constant NEGATIVE_SPREAD_REQUIRED = \"NEGATIVE_SPREAD_REQUIRED\"; // Matched orders must have a negative spread.\n\n /// Transaction errors ///\n string constant REENTRANCY_ILLEGAL = \"REENTRANCY_ILLEGAL\"; // Recursive reentrancy is not allowed. \n string constant INVALID_TX_HASH = \"INVALID_TX_HASH\"; // Transaction has already been executed. \n string constant INVALID_TX_SIGNATURE = \"INVALID_TX_SIGNATURE\"; // Signature validation failed. \n string constant FAILED_EXECUTION = \"FAILED_EXECUTION\"; // Transaction execution failed. \n \n /// registerAssetProxy errors ///\n string constant ASSET_PROXY_ALREADY_EXISTS = \"ASSET_PROXY_ALREADY_EXISTS\"; // AssetProxy with same id already exists.\n\n /// dispatchTransferFrom errors ///\n string constant ASSET_PROXY_DOES_NOT_EXIST = \"ASSET_PROXY_DOES_NOT_EXIST\"; // No assetProxy registered at given id.\n string constant TRANSFER_FAILED = \"TRANSFER_FAILED\"; // Asset transfer unsuccesful.\n\n /// Length validation errors ///\n string constant LENGTH_GREATER_THAN_0_REQUIRED = \"LENGTH_GREATER_THAN_0_REQUIRED\"; // Byte array must have a length greater than 0.\n string constant LENGTH_GREATER_THAN_3_REQUIRED = \"LENGTH_GREATER_THAN_3_REQUIRED\"; // Byte array must have a length greater than 3.\n string constant LENGTH_0_REQUIRED = \"LENGTH_0_REQUIRED\"; // Byte array must have a length of 0.\n string constant LENGTH_65_REQUIRED = \"LENGTH_65_REQUIRED\"; // Byte array must have a length of 65.\n}\n",
+ "protocol/Exchange/MixinMatchOrders.sol": "/*\n Copyright 2018 ZeroEx Intl.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../utils/ReentrancyGuard/ReentrancyGuard.sol\";\nimport \"./libs/LibConstants.sol\";\nimport \"./libs/LibMath.sol\";\nimport \"./libs/LibOrder.sol\";\nimport \"./libs/LibFillResults.sol\";\nimport \"./mixins/MExchangeCore.sol\";\nimport \"./mixins/MMatchOrders.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./mixins/MAssetProxyDispatcher.sol\";\n\n\ncontract MixinMatchOrders is\n ReentrancyGuard,\n LibConstants,\n LibMath,\n MAssetProxyDispatcher,\n MExchangeCore,\n MMatchOrders,\n MTransactions\n{\n /// @dev Match two complementary orders that have a profitable spread.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the left order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftSignature Proof that order was created by the left maker.\n /// @param rightSignature Proof that order was created by the right maker.\n /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.\n function matchOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n bytes memory leftSignature,\n bytes memory rightSignature\n )\n public\n nonReentrant\n returns (LibFillResults.MatchedFillResults memory matchedFillResults)\n {\n // We assume that rightOrder.takerAssetData == leftOrder.makerAssetData and rightOrder.makerAssetData == leftOrder.takerAssetData.\n // If this assumption isn't true, the match will fail at signature validation.\n rightOrder.makerAssetData = leftOrder.takerAssetData;\n rightOrder.takerAssetData = leftOrder.makerAssetData;\n\n // Get left & right order info\n LibOrder.OrderInfo memory leftOrderInfo = getOrderInfo(leftOrder);\n LibOrder.OrderInfo memory rightOrderInfo = getOrderInfo(rightOrder);\n\n // Fetch taker address\n address takerAddress = getCurrentContextAddress();\n \n // Either our context is valid or we revert\n assertFillableOrder(\n leftOrder,\n leftOrderInfo,\n takerAddress,\n leftSignature\n );\n assertFillableOrder(\n rightOrder,\n rightOrderInfo,\n takerAddress,\n rightSignature\n );\n assertValidMatch(leftOrder, rightOrder);\n\n // Compute proportional fill amounts\n matchedFillResults = calculateMatchedFillResults(\n leftOrder,\n rightOrder,\n leftOrderInfo.orderTakerAssetFilledAmount,\n rightOrderInfo.orderTakerAssetFilledAmount\n );\n\n // Validate fill contexts\n assertValidFill(\n leftOrder,\n leftOrderInfo,\n matchedFillResults.left.takerAssetFilledAmount,\n matchedFillResults.left.takerAssetFilledAmount,\n matchedFillResults.left.makerAssetFilledAmount\n );\n assertValidFill(\n rightOrder,\n rightOrderInfo,\n matchedFillResults.right.takerAssetFilledAmount,\n matchedFillResults.right.takerAssetFilledAmount,\n matchedFillResults.right.makerAssetFilledAmount\n );\n \n // Update exchange state\n updateFilledState(\n leftOrder,\n takerAddress,\n leftOrderInfo.orderHash,\n leftOrderInfo.orderTakerAssetFilledAmount,\n matchedFillResults.left\n );\n updateFilledState(\n rightOrder,\n takerAddress,\n rightOrderInfo.orderHash,\n rightOrderInfo.orderTakerAssetFilledAmount,\n matchedFillResults.right\n );\n\n // Settle matched orders. Succeeds or throws.\n settleMatchedOrders(\n leftOrder,\n rightOrder,\n takerAddress,\n matchedFillResults\n );\n\n return matchedFillResults;\n }\n\n /// @dev Validates context for matchOrders. Succeeds or throws.\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n function assertValidMatch(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder\n )\n internal\n pure\n {\n // Make sure there is a profitable spread.\n // There is a profitable spread iff the cost per unit bought (OrderA.MakerAmount/OrderA.TakerAmount) for each order is greater\n // than the profit per unit sold of the matched order (OrderB.TakerAmount/OrderB.MakerAmount).\n // This is satisfied by the equations below:\n // <leftOrder.makerAssetAmount> / <leftOrder.takerAssetAmount> >= <rightOrder.takerAssetAmount> / <rightOrder.makerAssetAmount>\n // AND\n // <rightOrder.makerAssetAmount> / <rightOrder.takerAssetAmount> >= <leftOrder.takerAssetAmount> / <leftOrder.makerAssetAmount>\n // These equations can be combined to get the following:\n require(\n safeMul(leftOrder.makerAssetAmount, rightOrder.makerAssetAmount) >=\n safeMul(leftOrder.takerAssetAmount, rightOrder.takerAssetAmount),\n \"NEGATIVE_SPREAD_REQUIRED\"\n );\n }\n\n /// @dev Calculates fill amounts for the matched orders.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the leftOrder order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftOrderTakerAssetFilledAmount Amount of left order already filled.\n /// @param rightOrderTakerAssetFilledAmount Amount of right order already filled.\n /// @param matchedFillResults Amounts to fill and fees to pay by maker and taker of matched orders.\n function calculateMatchedFillResults(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n uint256 leftOrderTakerAssetFilledAmount,\n uint256 rightOrderTakerAssetFilledAmount\n )\n internal\n pure\n returns (LibFillResults.MatchedFillResults memory matchedFillResults)\n {\n // Derive maker asset amounts for left & right orders, given store taker assert amounts\n uint256 leftTakerAssetAmountRemaining = safeSub(leftOrder.takerAssetAmount, leftOrderTakerAssetFilledAmount);\n uint256 leftMakerAssetAmountRemaining = safeGetPartialAmountFloor(\n leftOrder.makerAssetAmount,\n leftOrder.takerAssetAmount,\n leftTakerAssetAmountRemaining\n );\n uint256 rightTakerAssetAmountRemaining = safeSub(rightOrder.takerAssetAmount, rightOrderTakerAssetFilledAmount);\n uint256 rightMakerAssetAmountRemaining = safeGetPartialAmountFloor(\n rightOrder.makerAssetAmount,\n rightOrder.takerAssetAmount,\n rightTakerAssetAmountRemaining\n );\n\n // Calculate fill results for maker and taker assets: at least one order will be fully filled.\n // The maximum amount the left maker can buy is `leftTakerAssetAmountRemaining`\n // The maximum amount the right maker can sell is `rightMakerAssetAmountRemaining`\n // We have two distinct cases for calculating the fill results:\n // Case 1.\n // If the left maker can buy more than the right maker can sell, then only the right order is fully filled.\n // If the left maker can buy exactly what the right maker can sell, then both orders are fully filled.\n // Case 2.\n // If the left maker cannot buy more than the right maker can sell, then only the left order is fully filled.\n if (leftTakerAssetAmountRemaining >= rightMakerAssetAmountRemaining) {\n // Case 1: Right order is fully filled\n matchedFillResults.right.makerAssetFilledAmount = rightMakerAssetAmountRemaining;\n matchedFillResults.right.takerAssetFilledAmount = rightTakerAssetAmountRemaining;\n matchedFillResults.left.takerAssetFilledAmount = matchedFillResults.right.makerAssetFilledAmount;\n // Round down to ensure the maker's exchange rate does not exceed the price specified by the order. \n // We favor the maker when the exchange rate must be rounded.\n matchedFillResults.left.makerAssetFilledAmount = safeGetPartialAmountFloor(\n leftOrder.makerAssetAmount,\n leftOrder.takerAssetAmount,\n matchedFillResults.left.takerAssetFilledAmount\n );\n } else {\n // Case 2: Left order is fully filled\n matchedFillResults.left.makerAssetFilledAmount = leftMakerAssetAmountRemaining;\n matchedFillResults.left.takerAssetFilledAmount = leftTakerAssetAmountRemaining;\n matchedFillResults.right.makerAssetFilledAmount = matchedFillResults.left.takerAssetFilledAmount;\n // Round up to ensure the maker's exchange rate does not exceed the price specified by the order.\n // We favor the maker when the exchange rate must be rounded.\n matchedFillResults.right.takerAssetFilledAmount = safeGetPartialAmountCeil(\n rightOrder.takerAssetAmount,\n rightOrder.makerAssetAmount,\n matchedFillResults.right.makerAssetFilledAmount\n );\n }\n\n // Calculate amount given to taker\n matchedFillResults.leftMakerAssetSpreadAmount = safeSub(\n matchedFillResults.left.makerAssetFilledAmount,\n matchedFillResults.right.takerAssetFilledAmount\n );\n\n // Compute fees for left order\n matchedFillResults.left.makerFeePaid = safeGetPartialAmountFloor(\n matchedFillResults.left.makerAssetFilledAmount,\n leftOrder.makerAssetAmount,\n leftOrder.makerFee\n );\n matchedFillResults.left.takerFeePaid = safeGetPartialAmountFloor(\n matchedFillResults.left.takerAssetFilledAmount,\n leftOrder.takerAssetAmount,\n leftOrder.takerFee\n );\n\n // Compute fees for right order\n matchedFillResults.right.makerFeePaid = safeGetPartialAmountFloor(\n matchedFillResults.right.makerAssetFilledAmount,\n rightOrder.makerAssetAmount,\n rightOrder.makerFee\n );\n matchedFillResults.right.takerFeePaid = safeGetPartialAmountFloor(\n matchedFillResults.right.takerAssetFilledAmount,\n rightOrder.takerAssetAmount,\n rightOrder.takerFee\n );\n\n // Return fill results\n return matchedFillResults;\n }\n\n /// @dev Settles matched order by transferring appropriate funds between order makers, taker, and fee recipient.\n /// @param leftOrder First matched order.\n /// @param rightOrder Second matched order.\n /// @param takerAddress Address that matched the orders. The taker receives the spread between orders as profit.\n /// @param matchedFillResults Struct holding amounts to transfer between makers, taker, and fee recipients.\n function settleMatchedOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n address takerAddress,\n LibFillResults.MatchedFillResults memory matchedFillResults\n )\n private\n {\n bytes memory zrxAssetData = ZRX_ASSET_DATA;\n // Order makers and taker\n dispatchTransferFrom(\n leftOrder.makerAssetData,\n leftOrder.makerAddress,\n rightOrder.makerAddress,\n matchedFillResults.right.takerAssetFilledAmount\n );\n dispatchTransferFrom(\n rightOrder.makerAssetData,\n rightOrder.makerAddress,\n leftOrder.makerAddress,\n matchedFillResults.left.takerAssetFilledAmount\n );\n dispatchTransferFrom(\n leftOrder.makerAssetData,\n leftOrder.makerAddress,\n takerAddress,\n matchedFillResults.leftMakerAssetSpreadAmount\n );\n\n // Maker fees\n dispatchTransferFrom(\n zrxAssetData,\n leftOrder.makerAddress,\n leftOrder.feeRecipientAddress,\n matchedFillResults.left.makerFeePaid\n );\n dispatchTransferFrom(\n zrxAssetData,\n rightOrder.makerAddress,\n rightOrder.feeRecipientAddress,\n matchedFillResults.right.makerFeePaid\n );\n\n // Taker fees\n if (leftOrder.feeRecipientAddress == rightOrder.feeRecipientAddress) {\n dispatchTransferFrom(\n zrxAssetData,\n takerAddress,\n leftOrder.feeRecipientAddress,\n safeAdd(\n matchedFillResults.left.takerFeePaid,\n matchedFillResults.right.takerFeePaid\n )\n );\n } else {\n dispatchTransferFrom(\n zrxAssetData,\n takerAddress,\n leftOrder.feeRecipientAddress,\n matchedFillResults.left.takerFeePaid\n );\n dispatchTransferFrom(\n zrxAssetData,\n takerAddress,\n rightOrder.feeRecipientAddress,\n matchedFillResults.right.takerFeePaid\n );\n }\n }\n}\n",
+ "protocol/Exchange/mixins/MMatchOrders.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\nimport \"../interfaces/IMatchOrders.sol\";\n\n\ncontract MMatchOrders is\n IMatchOrders\n{\n /// @dev Validates context for matchOrders. Succeeds or throws.\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n function assertValidMatch(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder\n )\n internal\n pure;\n\n /// @dev Calculates fill amounts for the matched orders.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the leftOrder order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftOrderTakerAssetFilledAmount Amount of left order already filled.\n /// @param rightOrderTakerAssetFilledAmount Amount of right order already filled.\n /// @param matchedFillResults Amounts to fill and fees to pay by maker and taker of matched orders.\n function calculateMatchedFillResults(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n uint256 leftOrderTakerAssetFilledAmount,\n uint256 rightOrderTakerAssetFilledAmount\n )\n internal\n pure\n returns (LibFillResults.MatchedFillResults memory matchedFillResults);\n\n}\n",
+ "protocol/Exchange/interfaces/IMatchOrders.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IMatchOrders {\n\n /// @dev Match two complementary orders that have a profitable spread.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the left order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftSignature Proof that order was created by the left maker.\n /// @param rightSignature Proof that order was created by the right maker.\n /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.\n function matchOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n bytes memory leftSignature,\n bytes memory rightSignature\n )\n public\n returns (LibFillResults.MatchedFillResults memory matchedFillResults);\n}\n"
+ },
+ "sourceTreeHashHex": "0x6ff1018244f1bb1b06f24f9e10b69d8f303b9440899eef7a5dea9bb9c3817cb9",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/ExchangeWrapper.json b/packages/contracts/generated-artifacts/ExchangeWrapper.json
new file mode 100644
index 000000000..e8bb5e57b
--- /dev/null
+++ b/packages/contracts/generated-artifacts/ExchangeWrapper.json
@@ -0,0 +1,210 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "ExchangeWrapper",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "orderSignature",
+ "type": "bytes"
+ },
+ {
+ "name": "takerSignature",
+ "type": "bytes"
+ }
+ ],
+ "name": "fillOrder",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "targetOrderEpoch",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerSignature",
+ "type": "bytes"
+ }
+ ],
+ "name": "cancelOrdersUpTo",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_exchange",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b50604051602080610a86833981018060405261002f9190810190610067565b60008054600160a060020a031916600160a060020a0392909216919091179055610099565b6000610060825161008d565b9392505050565b60006020828403121561007957600080fd5b60006100858484610054565b949350505050565b600160a060020a031690565b6109de806100a86000396000f30060806040526004361061004b5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663a2dbfe658114610050578063f7de1c8b14610072575b600080fd5b34801561005c57600080fd5b5061007061006b366004610538565b610092565b005b34801561007e57600080fd5b5061007061008d3660046105f4565b6101e4565b60405133906060907fb4be83d500000000000000000000000000000000000000000000000000000000906100ce908990899088906024016107d5565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925260005491517fbfc8bfce00000000000000000000000000000000000000000000000000000000815290925073ffffffffffffffffffffffffffffffffffffffff9091169063bfc8bfce906101a9908890869086908990600401610868565b600060405180830381600087803b1580156101c357600080fd5b505af11580156101d7573d6000803e3d6000fd5b5050505050505050505050565b60405133906060907f4f9559b1000000000000000000000000000000000000000000000000000000009061021c908890602401610807565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925260005491517fbfc8bfce00000000000000000000000000000000000000000000000000000000815290925073ffffffffffffffffffffffffffffffffffffffff9091169063bfc8bfce906102f9908890869086908a908a9060040161081b565b600060405180830381600087803b15801561031357600080fd5b505af1158015610327573d6000803e3d6000fd5b50505050505050505050565b600061033f8235610924565b9392505050565b600080601f8301841361035857600080fd5b50813567ffffffffffffffff81111561037057600080fd5b60208301915083600182028301111561038857600080fd5b9250929050565b6000601f820183136103a057600080fd5b81356103b36103ae826108da565b6108b3565b915080825260208301602083018583830111156103cf57600080fd5b6103da838284610940565b50505092915050565b600061018082840312156103f657600080fd5b6104016101806108b3565b9050600061040f8484610333565b825250602061042084848301610333565b602083015250604061043484828501610333565b604083015250606061044884828501610333565b606083015250608061045c8482850161052c565b60808301525060a06104708482850161052c565b60a08301525060c06104848482850161052c565b60c08301525060e06104988482850161052c565b60e0830152506101006104ad8482850161052c565b610100830152506101206104c38482850161052c565b6101208301525061014082013567ffffffffffffffff8111156104e557600080fd5b6104f18482850161038f565b6101408301525061016082013567ffffffffffffffff81111561051357600080fd5b61051f8482850161038f565b6101608301525092915050565b600061033f823561093d565b600080600080600060a0868803121561055057600080fd5b853567ffffffffffffffff81111561056757600080fd5b610573888289016103e3565b95505060206105848882890161052c565b94505060406105958882890161052c565b935050606086013567ffffffffffffffff8111156105b257600080fd5b6105be8882890161038f565b925050608086013567ffffffffffffffff8111156105db57600080fd5b6105e78882890161038f565b9150509295509295909350565b6000806000806060858703121561060a57600080fd5b6000610616878761052c565b94505060206106278782880161052c565b935050604085013567ffffffffffffffff81111561064457600080fd5b61065087828801610346565b95989497509550505050565b61066581610924565b82525050565b6000828452602084019350610681838584610940565b61068a8361097c565b9093019392505050565b600061069f82610920565b8084526106b381602086016020860161094c565b6106bc8161097c565b9093016020019392505050565b80516000906101808401906106de858261065c565b5060208301516106f1602086018261065c565b506040830151610704604086018261065c565b506060830151610717606086018261065c565b50608083015161072a60808601826107cc565b5060a083015161073d60a08601826107cc565b5060c083015161075060c08601826107cc565b5060e083015161076360e08601826107cc565b506101008301516107786101008601826107cc565b5061012083015161078d6101208601826107cc565b506101408301518482036101408601526107a78282610694565b9150506101608301518482036101608601526107c38282610694565b95945050505050565b6106658161093d565b606080825281016107e681866106c9565b90506107f560208301856107cc565b81810360408301526107c38184610694565b6020810161081582846107cc565b92915050565b6080810161082982886107cc565b610836602083018761065c565b81810360408301526108488186610694565b9050818103606083015261085d81848661066b565b979650505050505050565b6080810161087682876107cc565b610883602083018661065c565b81810360408301526108958185610694565b905081810360608301526108a98184610694565b9695505050505050565b60405181810167ffffffffffffffff811182821017156108d257600080fd5b604052919050565b600067ffffffffffffffff8211156108f157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b82818337506000910152565b60005b8381101561096757818101518382015260200161094f565b83811115610976576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820969efa50ef179ee1cde30ae64f05866e1b135fc26eb442d3edcd7b3e0f8e4bae6c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP1 PUSH2 0xA86 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH2 0x2F SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x67 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH2 0x99 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x60 DUP3 MLOAD PUSH2 0x8D JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x79 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x85 DUP5 DUP5 PUSH2 0x54 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH2 0x9DE DUP1 PUSH2 0xA8 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4B JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0xA2DBFE65 DUP2 EQ PUSH2 0x50 JUMPI DUP1 PUSH4 0xF7DE1C8B EQ PUSH2 0x72 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x6B CALLDATASIZE PUSH1 0x4 PUSH2 0x538 JUMP JUMPDEST PUSH2 0x92 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x8D CALLDATASIZE PUSH1 0x4 PUSH2 0x5F4 JUMP JUMPDEST PUSH2 0x1E4 JUMP JUMPDEST PUSH1 0x40 MLOAD CALLER SWAP1 PUSH1 0x60 SWAP1 PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0xCE SWAP1 DUP10 SWAP1 DUP10 SWAP1 DUP9 SWAP1 PUSH1 0x24 ADD PUSH2 0x7D5 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE PUSH1 0x0 SLOAD SWAP2 MLOAD PUSH32 0xBFC8BFCE00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0xBFC8BFCE SWAP1 PUSH2 0x1A9 SWAP1 DUP9 SWAP1 DUP7 SWAP1 DUP7 SWAP1 DUP10 SWAP1 PUSH1 0x4 ADD PUSH2 0x868 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1D7 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD CALLER SWAP1 PUSH1 0x60 SWAP1 PUSH32 0x4F9559B100000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x21C SWAP1 DUP9 SWAP1 PUSH1 0x24 ADD PUSH2 0x807 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE PUSH1 0x0 SLOAD SWAP2 MLOAD PUSH32 0xBFC8BFCE00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0xBFC8BFCE SWAP1 PUSH2 0x2F9 SWAP1 DUP9 SWAP1 DUP7 SWAP1 DUP7 SWAP1 DUP11 SWAP1 DUP11 SWAP1 PUSH1 0x4 ADD PUSH2 0x81B JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x313 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x327 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x33F DUP3 CALLDATALOAD PUSH2 0x924 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1F DUP4 ADD DUP5 SGT PUSH2 0x358 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x370 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x1 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x388 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x3A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x3B3 PUSH2 0x3AE DUP3 PUSH2 0x8DA JUMP JUMPDEST PUSH2 0x8B3 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x3CF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x3DA DUP4 DUP3 DUP5 PUSH2 0x940 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x3F6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x401 PUSH2 0x180 PUSH2 0x8B3 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x40F DUP5 DUP5 PUSH2 0x333 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x420 DUP5 DUP5 DUP4 ADD PUSH2 0x333 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x434 DUP5 DUP3 DUP6 ADD PUSH2 0x333 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x448 DUP5 DUP3 DUP6 ADD PUSH2 0x333 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x45C DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x470 DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x484 DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x498 DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x4AD DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x4C3 DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4F1 DUP5 DUP3 DUP6 ADD PUSH2 0x38F JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x513 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x51F DUP5 DUP3 DUP6 ADD PUSH2 0x38F JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x33F DUP3 CALLDATALOAD PUSH2 0x93D JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0xA0 DUP7 DUP9 SUB SLT ISZERO PUSH2 0x550 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP6 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x567 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x573 DUP9 DUP3 DUP10 ADD PUSH2 0x3E3 JUMP JUMPDEST SWAP6 POP POP PUSH1 0x20 PUSH2 0x584 DUP9 DUP3 DUP10 ADD PUSH2 0x52C JUMP JUMPDEST SWAP5 POP POP PUSH1 0x40 PUSH2 0x595 DUP9 DUP3 DUP10 ADD PUSH2 0x52C JUMP JUMPDEST SWAP4 POP POP PUSH1 0x60 DUP7 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x5B2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x5BE DUP9 DUP3 DUP10 ADD PUSH2 0x38F JUMP JUMPDEST SWAP3 POP POP PUSH1 0x80 DUP7 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x5DB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x5E7 DUP9 DUP3 DUP10 ADD PUSH2 0x38F JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 SWAP1 SWAP4 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x60 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x60A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x616 DUP8 DUP8 PUSH2 0x52C JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x627 DUP8 DUP3 DUP9 ADD PUSH2 0x52C JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x644 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x650 DUP8 DUP3 DUP9 ADD PUSH2 0x346 JUMP JUMPDEST SWAP6 SWAP9 SWAP5 SWAP8 POP SWAP6 POP POP POP POP JUMP JUMPDEST PUSH2 0x665 DUP2 PUSH2 0x924 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x681 DUP4 DUP6 DUP5 PUSH2 0x940 JUMP JUMPDEST PUSH2 0x68A DUP4 PUSH2 0x97C JUMP JUMPDEST SWAP1 SWAP4 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x69F DUP3 PUSH2 0x920 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x6B3 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x94C JUMP JUMPDEST PUSH2 0x6BC DUP2 PUSH2 0x97C JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0x6DE DUP6 DUP3 PUSH2 0x65C JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0x6F1 PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0x65C JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0x704 PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0x65C JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0x717 PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x65C JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0x72A PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0x73D PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x750 PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0x763 PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0x778 PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0x78D PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0x7A7 DUP3 DUP3 PUSH2 0x694 JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0x7C3 DUP3 DUP3 PUSH2 0x694 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x665 DUP2 PUSH2 0x93D JUMP JUMPDEST PUSH1 0x60 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7E6 DUP2 DUP7 PUSH2 0x6C9 JUMP JUMPDEST SWAP1 POP PUSH2 0x7F5 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x7CC JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x7C3 DUP2 DUP5 PUSH2 0x694 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x815 DUP3 DUP5 PUSH2 0x7CC JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x829 DUP3 DUP9 PUSH2 0x7CC JUMP JUMPDEST PUSH2 0x836 PUSH1 0x20 DUP4 ADD DUP8 PUSH2 0x65C JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x848 DUP2 DUP7 PUSH2 0x694 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0x85D DUP2 DUP5 DUP7 PUSH2 0x66B JUMP JUMPDEST SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x876 DUP3 DUP8 PUSH2 0x7CC JUMP JUMPDEST PUSH2 0x883 PUSH1 0x20 DUP4 ADD DUP7 PUSH2 0x65C JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x895 DUP2 DUP6 PUSH2 0x694 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0x8A9 DUP2 DUP5 PUSH2 0x694 JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x8D2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x8F1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x967 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x94F JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x976 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 SWAP7 SWAP15 STATICCALL POP 0xef OR SWAP15 0xe1 0xcd 0xe3 EXP 0xe6 0x4f SDIV DUP7 PUSH15 0x1B135FC26EB442D3EDCD7B3E0F8E4B 0xae PUSH13 0x6578706572696D656E74616CF5 STOP CALLDATACOPY ",
+ "sourceMap": "752:2418:0:-;;;896:99;8:9:-1;5:2;;;30:1;27;20:12;5:2;896:99:0;;;;;;;;;;;;;;;;;;;;;;957:8;:31;;-1:-1:-1;;;;;;957:31:0;-1:-1:-1;;;;;957:31:0;;;;;;;;;;752:2418;;5:122:-1;;83:39;114:6;108:13;83:39;;;74:48;68:59;-1:-1;;;68:59;134:263;;249:2;237:9;228:7;224:23;220:32;217:2;;;265:1;262;255:12;217:2;300:1;317:64;373:7;353:9;317:64;;;307:74;211:186;-1:-1;;;;211:186;404:128;-1:-1;;;;;473:54;;456:76;;752:2418:0;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526004361061004b5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663a2dbfe658114610050578063f7de1c8b14610072575b600080fd5b34801561005c57600080fd5b5061007061006b366004610538565b610092565b005b34801561007e57600080fd5b5061007061008d3660046105f4565b6101e4565b60405133906060907fb4be83d500000000000000000000000000000000000000000000000000000000906100ce908990899088906024016107d5565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925260005491517fbfc8bfce00000000000000000000000000000000000000000000000000000000815290925073ffffffffffffffffffffffffffffffffffffffff9091169063bfc8bfce906101a9908890869086908990600401610868565b600060405180830381600087803b1580156101c357600080fd5b505af11580156101d7573d6000803e3d6000fd5b5050505050505050505050565b60405133906060907f4f9559b1000000000000000000000000000000000000000000000000000000009061021c908890602401610807565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925260005491517fbfc8bfce00000000000000000000000000000000000000000000000000000000815290925073ffffffffffffffffffffffffffffffffffffffff9091169063bfc8bfce906102f9908890869086908a908a9060040161081b565b600060405180830381600087803b15801561031357600080fd5b505af1158015610327573d6000803e3d6000fd5b50505050505050505050565b600061033f8235610924565b9392505050565b600080601f8301841361035857600080fd5b50813567ffffffffffffffff81111561037057600080fd5b60208301915083600182028301111561038857600080fd5b9250929050565b6000601f820183136103a057600080fd5b81356103b36103ae826108da565b6108b3565b915080825260208301602083018583830111156103cf57600080fd5b6103da838284610940565b50505092915050565b600061018082840312156103f657600080fd5b6104016101806108b3565b9050600061040f8484610333565b825250602061042084848301610333565b602083015250604061043484828501610333565b604083015250606061044884828501610333565b606083015250608061045c8482850161052c565b60808301525060a06104708482850161052c565b60a08301525060c06104848482850161052c565b60c08301525060e06104988482850161052c565b60e0830152506101006104ad8482850161052c565b610100830152506101206104c38482850161052c565b6101208301525061014082013567ffffffffffffffff8111156104e557600080fd5b6104f18482850161038f565b6101408301525061016082013567ffffffffffffffff81111561051357600080fd5b61051f8482850161038f565b6101608301525092915050565b600061033f823561093d565b600080600080600060a0868803121561055057600080fd5b853567ffffffffffffffff81111561056757600080fd5b610573888289016103e3565b95505060206105848882890161052c565b94505060406105958882890161052c565b935050606086013567ffffffffffffffff8111156105b257600080fd5b6105be8882890161038f565b925050608086013567ffffffffffffffff8111156105db57600080fd5b6105e78882890161038f565b9150509295509295909350565b6000806000806060858703121561060a57600080fd5b6000610616878761052c565b94505060206106278782880161052c565b935050604085013567ffffffffffffffff81111561064457600080fd5b61065087828801610346565b95989497509550505050565b61066581610924565b82525050565b6000828452602084019350610681838584610940565b61068a8361097c565b9093019392505050565b600061069f82610920565b8084526106b381602086016020860161094c565b6106bc8161097c565b9093016020019392505050565b80516000906101808401906106de858261065c565b5060208301516106f1602086018261065c565b506040830151610704604086018261065c565b506060830151610717606086018261065c565b50608083015161072a60808601826107cc565b5060a083015161073d60a08601826107cc565b5060c083015161075060c08601826107cc565b5060e083015161076360e08601826107cc565b506101008301516107786101008601826107cc565b5061012083015161078d6101208601826107cc565b506101408301518482036101408601526107a78282610694565b9150506101608301518482036101608601526107c38282610694565b95945050505050565b6106658161093d565b606080825281016107e681866106c9565b90506107f560208301856107cc565b81810360408301526107c38184610694565b6020810161081582846107cc565b92915050565b6080810161082982886107cc565b610836602083018761065c565b81810360408301526108488186610694565b9050818103606083015261085d81848661066b565b979650505050505050565b6080810161087682876107cc565b610883602083018661065c565b81810360408301526108958185610694565b905081810360608301526108a98184610694565b9695505050505050565b60405181810167ffffffffffffffff811182821017156108d257600080fd5b604052919050565b600067ffffffffffffffff8211156108f157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b82818337506000910152565b60005b8381101561096757818101518382015260200161094f565b83811115610976576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820969efa50ef179ee1cde30ae64f05866e1b135fc26eb442d3edcd7b3e0f8e4bae6c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4B JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0xA2DBFE65 DUP2 EQ PUSH2 0x50 JUMPI DUP1 PUSH4 0xF7DE1C8B EQ PUSH2 0x72 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x6B CALLDATASIZE PUSH1 0x4 PUSH2 0x538 JUMP JUMPDEST PUSH2 0x92 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x70 PUSH2 0x8D CALLDATASIZE PUSH1 0x4 PUSH2 0x5F4 JUMP JUMPDEST PUSH2 0x1E4 JUMP JUMPDEST PUSH1 0x40 MLOAD CALLER SWAP1 PUSH1 0x60 SWAP1 PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0xCE SWAP1 DUP10 SWAP1 DUP10 SWAP1 DUP9 SWAP1 PUSH1 0x24 ADD PUSH2 0x7D5 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE PUSH1 0x0 SLOAD SWAP2 MLOAD PUSH32 0xBFC8BFCE00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0xBFC8BFCE SWAP1 PUSH2 0x1A9 SWAP1 DUP9 SWAP1 DUP7 SWAP1 DUP7 SWAP1 DUP10 SWAP1 PUSH1 0x4 ADD PUSH2 0x868 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1D7 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD CALLER SWAP1 PUSH1 0x60 SWAP1 PUSH32 0x4F9559B100000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x21C SWAP1 DUP9 SWAP1 PUSH1 0x24 ADD PUSH2 0x807 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE PUSH1 0x0 SLOAD SWAP2 MLOAD PUSH32 0xBFC8BFCE00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0xBFC8BFCE SWAP1 PUSH2 0x2F9 SWAP1 DUP9 SWAP1 DUP7 SWAP1 DUP7 SWAP1 DUP11 SWAP1 DUP11 SWAP1 PUSH1 0x4 ADD PUSH2 0x81B JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x313 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x327 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x33F DUP3 CALLDATALOAD PUSH2 0x924 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1F DUP4 ADD DUP5 SGT PUSH2 0x358 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x370 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x1 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x388 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x3A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x3B3 PUSH2 0x3AE DUP3 PUSH2 0x8DA JUMP JUMPDEST PUSH2 0x8B3 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x3CF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x3DA DUP4 DUP3 DUP5 PUSH2 0x940 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x3F6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x401 PUSH2 0x180 PUSH2 0x8B3 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x40F DUP5 DUP5 PUSH2 0x333 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x420 DUP5 DUP5 DUP4 ADD PUSH2 0x333 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x434 DUP5 DUP3 DUP6 ADD PUSH2 0x333 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x448 DUP5 DUP3 DUP6 ADD PUSH2 0x333 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x45C DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x470 DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x484 DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x498 DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x4AD DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x4C3 DUP5 DUP3 DUP6 ADD PUSH2 0x52C JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4F1 DUP5 DUP3 DUP6 ADD PUSH2 0x38F JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x513 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x51F DUP5 DUP3 DUP6 ADD PUSH2 0x38F JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x33F DUP3 CALLDATALOAD PUSH2 0x93D JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0xA0 DUP7 DUP9 SUB SLT ISZERO PUSH2 0x550 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP6 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x567 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x573 DUP9 DUP3 DUP10 ADD PUSH2 0x3E3 JUMP JUMPDEST SWAP6 POP POP PUSH1 0x20 PUSH2 0x584 DUP9 DUP3 DUP10 ADD PUSH2 0x52C JUMP JUMPDEST SWAP5 POP POP PUSH1 0x40 PUSH2 0x595 DUP9 DUP3 DUP10 ADD PUSH2 0x52C JUMP JUMPDEST SWAP4 POP POP PUSH1 0x60 DUP7 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x5B2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x5BE DUP9 DUP3 DUP10 ADD PUSH2 0x38F JUMP JUMPDEST SWAP3 POP POP PUSH1 0x80 DUP7 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x5DB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x5E7 DUP9 DUP3 DUP10 ADD PUSH2 0x38F JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 SWAP1 SWAP4 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x60 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x60A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x616 DUP8 DUP8 PUSH2 0x52C JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x627 DUP8 DUP3 DUP9 ADD PUSH2 0x52C JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x644 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x650 DUP8 DUP3 DUP9 ADD PUSH2 0x346 JUMP JUMPDEST SWAP6 SWAP9 SWAP5 SWAP8 POP SWAP6 POP POP POP POP JUMP JUMPDEST PUSH2 0x665 DUP2 PUSH2 0x924 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x681 DUP4 DUP6 DUP5 PUSH2 0x940 JUMP JUMPDEST PUSH2 0x68A DUP4 PUSH2 0x97C JUMP JUMPDEST SWAP1 SWAP4 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x69F DUP3 PUSH2 0x920 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x6B3 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x94C JUMP JUMPDEST PUSH2 0x6BC DUP2 PUSH2 0x97C JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0x6DE DUP6 DUP3 PUSH2 0x65C JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0x6F1 PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0x65C JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0x704 PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0x65C JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0x717 PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x65C JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0x72A PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0x73D PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x750 PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0x763 PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0x778 PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0x78D PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0x7CC JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0x7A7 DUP3 DUP3 PUSH2 0x694 JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0x7C3 DUP3 DUP3 PUSH2 0x694 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x665 DUP2 PUSH2 0x93D JUMP JUMPDEST PUSH1 0x60 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7E6 DUP2 DUP7 PUSH2 0x6C9 JUMP JUMPDEST SWAP1 POP PUSH2 0x7F5 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x7CC JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x7C3 DUP2 DUP5 PUSH2 0x694 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x815 DUP3 DUP5 PUSH2 0x7CC JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x829 DUP3 DUP9 PUSH2 0x7CC JUMP JUMPDEST PUSH2 0x836 PUSH1 0x20 DUP4 ADD DUP8 PUSH2 0x65C JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x848 DUP2 DUP7 PUSH2 0x694 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0x85D DUP2 DUP5 DUP7 PUSH2 0x66B JUMP JUMPDEST SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x876 DUP3 DUP8 PUSH2 0x7CC JUMP JUMPDEST PUSH2 0x883 PUSH1 0x20 DUP4 ADD DUP7 PUSH2 0x65C JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x895 DUP2 DUP6 PUSH2 0x694 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0x8A9 DUP2 DUP5 PUSH2 0x694 JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x8D2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x8F1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x967 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x94F JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x976 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 SWAP7 SWAP15 STATICCALL POP 0xef OR SWAP15 0xe1 0xcd 0xe3 EXP 0xe6 0x4f SDIV DUP7 PUSH15 0x1B135FC26EB442D3EDCD7B3E0F8E4B 0xae PUSH13 0x6578706572696D656E74616CF5 STOP CALLDATACOPY ",
+ "sourceMap": "752:2418:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;2481:687;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2481:687:0;;;;;;;;;;;1446:574;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1446:574:0;;;;;;;;;2481:687;2815:154;;2729:10;;2795:17;;2851:27;;2815:154;;2892:5;;2911:20;;2945:14;;2815:154;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;2815:154:0;;;49:4:-1;25:18;;61:17;;2815:154:0;182:15:-1;2815:154:0;;;;179:29:-1;;;;160:49;;;-1:-1;3034:8:0;:127;;;;;2815:154;;-1:-1:-1;3034:8:0;;;;;:27;;:127;;3075:4;;3093:12;;2815:154;;3137:14;;3034:127;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3034:127:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3034:127:0;;;;2481:687;;;;;;;:::o;1446:574::-;1704:110;;1618:10;;1684:17;;1740:34;;1704:110;;1788:16;;1704:110;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;1704:110:0;;;49:4:-1;25:18;;61:17;;1704:110:0;182:15:-1;1704:110:0;;;;179:29:-1;;;;160:49;;;-1:-1;1886:8:0;:127;;;;;1704:110;;-1:-1:-1;1886:8:0;;;;;:27;;:127;;1927:4;;1945:12;;1704:110;;1989:14;;;;1886:127;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1886:127:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1886:127:0;;;;1446:574;;;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;;63:55;57:66;-1:-1;;;57:66;144:335;;;251:4;239:17;;235:27;-1:-1;225:2;;276:1;273;266:12;225:2;-1:-1;296:20;;336:18;325:30;;322:2;;;368:1;365;358:12;322:2;402:4;394:6;390:17;378:29;;452:3;445;437:6;433:16;423:8;419:31;416:40;413:2;;;469:1;466;459:12;413:2;218:261;;;;;;488:432;;578:4;566:17;;562:27;-1:-1;552:2;;603:1;600;593:12;552:2;640:6;627:20;662:60;677:44;714:6;677:44;;;662:60;;;653:69;;742:6;735:5;728:21;778:4;770:6;766:17;811:4;804:5;800:16;846:3;837:6;832:3;828:16;825:25;822:2;;;863:1;860;853:12;822:2;873:41;907:6;902:3;897;873:41;;;545:375;;;;;;;;1405:2209;;1517:5;1505:9;1500:3;1496:19;1492:31;1489:2;;;1536:1;1533;1526:12;1489:2;1554:21;1569:5;1554:21;;;1545:30;-1:-1;1633:1;1664:49;1709:3;1689:9;1664:49;;;1640:74;;-1:-1;1783:2;1816:49;1861:3;1837:22;;;1816:49;;;1809:4;1802:5;1798:16;1791:75;1735:142;1942:2;1975:49;2020:3;2011:6;2000:9;1996:22;1975:49;;;1968:4;1961:5;1957:16;1950:75;1887:149;2095:2;2128:49;2173:3;2164:6;2153:9;2149:22;2128:49;;;2121:4;2114:5;2110:16;2103:75;2046:143;2251:3;2285:49;2330:3;2321:6;2310:9;2306:22;2285:49;;;2278:4;2271:5;2267:16;2260:75;2199:147;2408:3;2442:49;2487:3;2478:6;2467:9;2463:22;2442:49;;;2435:4;2428:5;2424:16;2417:75;2356:147;2557:3;2591:49;2636:3;2627:6;2616:9;2612:22;2591:49;;;2584:4;2577:5;2573:16;2566:75;2513:139;2706:3;2740:49;2785:3;2776:6;2765:9;2761:22;2740:49;;;2733:4;2726:5;2722:16;2715:75;2662:139;2868:3;2903:49;2948:3;2939:6;2928:9;2924:22;2903:49;;;2895:5;2888;2884:17;2877:76;2811:153;3014:3;3049:49;3094:3;3085:6;3074:9;3070:22;3049:49;;;3041:5;3034;3030:17;3023:76;2974:136;3198:3;3187:9;3183:19;3170:33;3223:18;3215:6;3212:30;3209:2;;;3255:1;3252;3245:12;3209:2;3291:54;3341:3;3332:6;3321:9;3317:22;3291:54;;;3283:5;3276;3272:17;3265:81;3120:237;3445:3;3434:9;3430:19;3417:33;3470:18;3462:6;3459:30;3456:2;;;3502:1;3499;3492:12;3456:2;3538:54;3588:3;3579:6;3568:9;3564:22;3538:54;;;3530:5;3523;3519:17;3512:81;3367:237;1483:2131;;;;;3621:118;;3688:46;3726:6;3713:20;3688:46;;3746:1083;;;;;;3959:3;3947:9;3938:7;3934:23;3930:33;3927:2;;;3976:1;3973;3966:12;3927:2;4011:31;;4062:18;4051:30;;4048:2;;;4094:1;4091;4084:12;4048:2;4114:76;4182:7;4173:6;4162:9;4158:22;4114:76;;;4104:86;;3990:206;4227:2;4245:53;4290:7;4281:6;4270:9;4266:22;4245:53;;;4235:63;;4206:98;4335:2;4353:53;4398:7;4389:6;4378:9;4374:22;4353:53;;;4343:63;;4314:98;4471:2;4460:9;4456:18;4443:32;4495:18;4487:6;4484:30;4481:2;;;4527:1;4524;4517:12;4481:2;4547:62;4601:7;4592:6;4581:9;4577:22;4547:62;;;4537:72;;4422:193;4674:3;4663:9;4659:19;4646:33;4699:18;4691:6;4688:30;4685:2;;;4731:1;4728;4721:12;4685:2;4751:62;4805:7;4796:6;4785:9;4781:22;4751:62;;;4741:72;;4625:194;3921:908;;;;;;;;;4836:615;;;;;4993:2;4981:9;4972:7;4968:23;4964:32;4961:2;;;5009:1;5006;4999:12;4961:2;5044:1;5061:53;5106:7;5086:9;5061:53;;;5051:63;;5023:97;5151:2;5169:53;5214:7;5205:6;5194:9;5190:22;5169:53;;;5159:63;;5130:98;5287:2;5276:9;5272:18;5259:32;5311:18;5303:6;5300:30;5297:2;;;5343:1;5340;5333:12;5297:2;5371:64;5427:7;5418:6;5407:9;5403:22;5371:64;;;4955:496;;;;-1:-1;5353:82;-1:-1;;;;4955:496;5458:110;5531:31;5556:5;5531:31;;;5526:3;5519:44;5513:55;;;5596:261;;5704:6;5699:3;5692:19;5728:4;5723:3;5719:14;5712:21;;5758:43;5794:6;5789:3;5782:5;5758:43;;;5822:29;5844:6;5822:29;;;5813:39;;;;5686:171;-1:-1;;;5686:171;5864:297;;5964:38;5996:5;5964:38;;;6019:6;6014:3;6007:19;6031:63;6087:6;6080:4;6075:3;6071:14;6064:4;6057:5;6053:16;6031:63;;;6126:29;6148:6;6126:29;;;6106:50;;;6119:4;6106:50;;5944:217;-1:-1;;;5944:217;6517:2419;6732:22;;6517:2419;;6654:5;6645:15;;;6766:61;6649:3;6732:22;6766:61;;;6675:164;6923:4;6916:5;6912:16;6906:23;6941:62;6997:4;6992:3;6988:14;6975:11;6941:62;;;6849:166;7106:4;7099:5;7095:16;7089:23;7124:62;7180:4;7175:3;7171:14;7158:11;7124:62;;;7025:173;7283:4;7276:5;7272:16;7266:23;7301:62;7357:4;7352:3;7348:14;7335:11;7301:62;;;7208:167;7463:4;7456:5;7452:16;7446:23;7481:62;7537:4;7532:3;7528:14;7515:11;7481:62;;;7385:170;7643:4;7636:5;7632:16;7626:23;7661:62;7717:4;7712:3;7708:14;7695:11;7661:62;;;7565:170;7815:4;7808:5;7804:16;7798:23;7833:62;7889:4;7884:3;7880:14;7867:11;7833:62;;;7745:162;7987:4;7980:5;7976:16;7970:23;8005:62;8061:4;8056:3;8052:14;8039:11;8005:62;;;7917:162;8172:5;8165;8161:17;8155:24;8191:63;8247:5;8242:3;8238:15;8225:11;8191:63;;;8089:177;8342:5;8335;8331:17;8325:24;8361:63;8417:5;8412:3;8408:15;8395:11;8361:63;;;8276:160;8522:5;8515;8511:17;8505:24;8575:3;8569:4;8565:14;8557:5;8552:3;8548:15;8541:39;8595:66;8656:4;8643:11;8595:66;;;8587:74;;8446:227;8759:5;8752;8748:17;8742:24;8812:3;8806:4;8802:14;8794:5;8789:3;8785:15;8778:39;8832:66;8893:4;8880:11;8832:66;;;8824:74;6627:2309;-1:-1;;;;;6627:2309;8943:110;9016:31;9041:5;9016:31;;9060:619;9288:2;9302:47;;;9273:18;;9363:94;9273:18;9443:6;9363:94;;;9355:102;;9468:62;9526:2;9515:9;9511:18;9502:6;9468:62;;;9578:9;9572:4;9568:20;9563:2;9552:9;9548:18;9541:48;9603:66;9664:4;9655:6;9603:66;;9686:193;9794:2;9779:18;;9808:61;9783:9;9842:6;9808:61;;;9765:114;;;;;9886:685;10124:3;10109:19;;10139:61;10113:9;10173:6;10139:61;;;10211:62;10269:2;10258:9;10254:18;10245:6;10211:62;;;10321:9;10315:4;10311:20;10306:2;10295:9;10291:18;10284:48;10346:66;10407:4;10398:6;10346:66;;;10338:74;;10460:9;10454:4;10450:20;10445:2;10434:9;10430:18;10423:48;10485:76;10556:4;10547:6;10539;10485:76;;;10477:84;10095:476;-1:-1;;;;;;;10095:476;10578:665;10806:3;10791:19;;10821:61;10795:9;10855:6;10821:61;;;10893:62;10951:2;10940:9;10936:18;10927:6;10893:62;;;11003:9;10997:4;10993:20;10988:2;10977:9;10973:18;10966:48;11028:66;11089:4;11080:6;11028:66;;;11020:74;;11142:9;11136:4;11132:20;11127:2;11116:9;11112:18;11105:48;11167:66;11228:4;11219:6;11167:66;;;11159:74;10777:466;-1:-1;;;;;;10777:466;11250:256;11312:2;11306:9;11338:17;;;11413:18;11398:34;;11434:22;;;11395:62;11392:2;;;11470:1;11467;11460:12;11392:2;11486;11479:22;11290:216;;-1:-1;11290:216;11513:254;;11652:18;11644:6;11641:30;11638:2;;;11684:1;11681;11674:12;11638:2;-1:-1;11757:4;11728;11705:17;;;;11724:9;11701:33;11747:15;;11575:192;12039:87;12109:12;;12093:33;12231:128;12311:42;12300:54;;12283:76;12366:79;12435:5;12418:27;12674:145;12755:6;12750:3;12745;12732:30;-1:-1;12811:1;12793:16;;12786:27;12725:94;12828:268;12893:1;12900:101;12914:6;12911:1;12908:13;12900:101;;;12981:11;;;12975:18;12962:11;;;12955:39;12936:2;12929:10;12900:101;;;13016:6;13013:1;13010:13;13007:2;;;13081:1;13072:6;13067:3;13063:16;13056:27;13007:2;12877:219;;;;;13104:97;13192:2;13172:14;13188:7;13168:28;;13152:49"
+ }
+ }
+ },
+ "sources": {
+ "examples/ExchangeWrapper/ExchangeWrapper.sol": {
+ "id": 0
+ },
+ "protocol/Exchange/interfaces/IExchange.sol": {
+ "id": 34
+ },
+ "protocol/Exchange/interfaces/IExchangeCore.sol": {
+ "id": 35
+ },
+ "protocol/Exchange/libs/LibOrder.sol": {
+ "id": 48
+ },
+ "protocol/Exchange/libs/LibEIP712.sol": {
+ "id": 44
+ },
+ "protocol/Exchange/libs/LibFillResults.sol": {
+ "id": 46
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "protocol/Exchange/interfaces/IMatchOrders.sol": {
+ "id": 36
+ },
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": {
+ "id": 37
+ },
+ "protocol/Exchange/interfaces/ITransactions.sol": {
+ "id": 38
+ },
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": {
+ "id": 33
+ },
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": {
+ "id": 41
+ }
+ },
+ "sourceCodes": {
+ "examples/ExchangeWrapper/ExchangeWrapper.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../protocol/Exchange/interfaces/IExchange.sol\";\nimport \"../../protocol/Exchange/libs/LibOrder.sol\";\n\n\ncontract ExchangeWrapper {\n\n // Exchange contract.\n // solhint-disable-next-line var-name-mixedcase\n IExchange internal EXCHANGE;\n\n constructor (address _exchange)\n public\n {\n EXCHANGE = IExchange(_exchange);\n }\n\n /// @dev Cancels all orders created by sender with a salt less than or equal to the targetOrderEpoch\n /// and senderAddress equal to this contract.\n /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.\n /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.\n /// @param makerSignature Proof that maker wishes to call this function with given params.\n function cancelOrdersUpTo(\n uint256 targetOrderEpoch,\n uint256 salt,\n bytes makerSignature\n )\n external\n {\n address makerAddress = msg.sender;\n\n // Encode arguments into byte array.\n bytes memory data = abi.encodeWithSelector(\n EXCHANGE.cancelOrdersUpTo.selector,\n targetOrderEpoch\n );\n\n // Call `cancelOrdersUpTo` via `executeTransaction`.\n EXCHANGE.executeTransaction(\n salt,\n makerAddress,\n data,\n makerSignature\n );\n }\n\n /// @dev Fills an order using `msg.sender` as the taker.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.\n /// @param orderSignature Proof that order has been created by maker.\n /// @param takerSignature Proof that taker wishes to call this function with given params.\n function fillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n uint256 salt,\n bytes memory orderSignature,\n bytes memory takerSignature\n )\n public\n {\n address takerAddress = msg.sender;\n\n // Encode arguments into byte array.\n bytes memory data = abi.encodeWithSelector(\n EXCHANGE.fillOrder.selector,\n order,\n takerAssetFillAmount,\n orderSignature\n );\n\n // Call `fillOrder` via `executeTransaction`.\n EXCHANGE.executeTransaction(\n salt,\n takerAddress,\n data,\n takerSignature\n );\n }\n}\n",
+ "protocol/Exchange/interfaces/IExchange.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./IExchangeCore.sol\";\nimport \"./IMatchOrders.sol\";\nimport \"./ISignatureValidator.sol\";\nimport \"./ITransactions.sol\";\nimport \"./IAssetProxyDispatcher.sol\";\nimport \"./IWrapperFunctions.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract IExchange is\n IExchangeCore,\n IMatchOrders,\n ISignatureValidator,\n ITransactions,\n IAssetProxyDispatcher,\n IWrapperFunctions\n{}\n",
+ "protocol/Exchange/interfaces/IExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IExchangeCore {\n\n /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch\n /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).\n /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.\n function cancelOrdersUpTo(uint256 targetOrderEpoch)\n external;\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev After calling, the order can not be filled anymore.\n /// @param order Order struct containing order specifications.\n function cancelOrder(LibOrder.Order memory order)\n public;\n\n /// @dev Gets information about an order: status, hash, and amount filled.\n /// @param order Order to gather information on.\n /// @return OrderInfo Information about the order and its state.\n /// See LibOrder.OrderInfo for a complete description.\n function getOrderInfo(LibOrder.Order memory order)\n public\n view\n returns (LibOrder.OrderInfo memory orderInfo);\n}\n",
+ "protocol/Exchange/libs/LibOrder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./LibEIP712.sol\";\n\n\ncontract LibOrder is\n LibEIP712\n{\n // Hash for the EIP712 Order Schema\n bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"Order(\",\n \"address makerAddress,\",\n \"address takerAddress,\",\n \"address feeRecipientAddress,\",\n \"address senderAddress,\",\n \"uint256 makerAssetAmount,\",\n \"uint256 takerAssetAmount,\",\n \"uint256 makerFee,\",\n \"uint256 takerFee,\",\n \"uint256 expirationTimeSeconds,\",\n \"uint256 salt,\",\n \"bytes makerAssetData,\",\n \"bytes takerAssetData\",\n \")\"\n ));\n\n // A valid order remains fillable until it is expired, fully filled, or cancelled.\n // An order's state is unaffected by external factors, like account balances.\n enum OrderStatus {\n INVALID, // Default value\n INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount\n INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount\n FILLABLE, // Order is fillable\n EXPIRED, // Order has already expired\n FULLY_FILLED, // Order is fully filled\n CANCELLED // Order has been cancelled\n }\n\n // solhint-disable max-line-length\n struct Order {\n address makerAddress; // Address that created the order. \n address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. \n address feeRecipientAddress; // Address that will recieve fees when order is filled. \n address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.\n uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. \n uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. \n uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.\n uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.\n uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. \n uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. \n bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.\n bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.\n }\n // solhint-enable max-line-length\n\n struct OrderInfo {\n uint8 orderStatus; // Status that describes order's validity and fillability.\n bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash).\n uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled.\n }\n\n /// @dev Calculates Keccak-256 hash of the order.\n /// @param order The order structure.\n /// @return Keccak-256 EIP712 hash of the order.\n function getOrderHash(Order memory order)\n internal\n view\n returns (bytes32 orderHash)\n {\n orderHash = hashEIP712Message(hashOrder(order));\n return orderHash;\n }\n\n /// @dev Calculates EIP712 hash of the order.\n /// @param order The order structure.\n /// @return EIP712 hash of the order.\n function hashOrder(Order memory order)\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;\n bytes32 makerAssetDataHash = keccak256(order.makerAssetData);\n bytes32 takerAssetDataHash = keccak256(order.takerAssetData);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ORDER_SCHEMA_HASH,\n // bytes32(order.makerAddress),\n // bytes32(order.takerAddress),\n // bytes32(order.feeRecipientAddress),\n // bytes32(order.senderAddress),\n // order.makerAssetAmount,\n // order.takerAssetAmount,\n // order.makerFee,\n // order.takerFee,\n // order.expirationTimeSeconds,\n // order.salt,\n // keccak256(order.makerAssetData),\n // keccak256(order.takerAssetData)\n // ));\n\n assembly {\n // Calculate memory addresses that will be swapped out before hashing\n let pos1 := sub(order, 32)\n let pos2 := add(order, 320)\n let pos3 := add(order, 352)\n\n // Backup\n let temp1 := mload(pos1)\n let temp2 := mload(pos2)\n let temp3 := mload(pos3)\n \n // Hash in place\n mstore(pos1, schemaHash)\n mstore(pos2, makerAssetDataHash)\n mstore(pos3, takerAssetDataHash)\n result := keccak256(pos1, 416)\n \n // Restore\n mstore(pos1, temp1)\n mstore(pos2, temp2)\n mstore(pos3, temp3)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibEIP712.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract LibEIP712 {\n\n // EIP191 header for EIP712 prefix\n string constant internal EIP191_HEADER = \"\\x19\\x01\";\n\n // EIP712 Domain Name value\n string constant internal EIP712_DOMAIN_NAME = \"0x Protocol\";\n\n // EIP712 Domain Version value\n string constant internal EIP712_DOMAIN_VERSION = \"2\";\n\n // Hash of the EIP712 Domain Separator Schema\n bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"address verifyingContract\",\n \")\"\n ));\n\n // Hash of the EIP712 Domain Separator data\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public EIP712_DOMAIN_HASH;\n\n constructor ()\n public\n {\n EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(\n EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,\n keccak256(bytes(EIP712_DOMAIN_NAME)),\n keccak256(bytes(EIP712_DOMAIN_VERSION)),\n bytes32(address(this))\n ));\n }\n\n /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.\n /// @param hashStruct The EIP712 hash struct.\n /// @return EIP712 hash applied to this EIP712 Domain.\n function hashEIP712Message(bytes32 hashStruct)\n internal\n view\n returns (bytes32 result)\n {\n bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;\n\n // Assembly for more efficient computing:\n // keccak256(abi.encodePacked(\n // EIP191_HEADER,\n // EIP712_DOMAIN_HASH,\n // hashStruct \n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header\n mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash\n mstore(add(memPtr, 34), hashStruct) // Hash of struct\n\n // Compute hash\n result := keccak256(memPtr, 66)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibFillResults.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibFillResults is\n SafeMath\n{\n struct FillResults {\n uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.\n uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.\n uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).\n uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).\n }\n\n struct MatchedFillResults {\n FillResults left; // Amounts filled and fees paid of left order.\n FillResults right; // Amounts filled and fees paid of right order.\n uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker.\n }\n\n /// @dev Adds properties of both FillResults instances.\n /// Modifies the first FillResults instance specified.\n /// @param totalFillResults Fill results instance that will be added onto.\n /// @param singleFillResults Fill results instance that will be added to totalFillResults.\n function addFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)\n internal\n pure\n {\n totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);\n totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);\n totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);\n totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "protocol/Exchange/interfaces/IMatchOrders.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IMatchOrders {\n\n /// @dev Match two complementary orders that have a profitable spread.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the left order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftSignature Proof that order was created by the left maker.\n /// @param rightSignature Proof that order was created by the right maker.\n /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.\n function matchOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n bytes memory leftSignature,\n bytes memory rightSignature\n )\n public\n returns (LibFillResults.MatchedFillResults memory matchedFillResults);\n}\n",
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ISignatureValidator {\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external;\n \n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external;\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address of signer.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/ITransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\n\ncontract ITransactions {\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external;\n}\n",
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IAssetProxyDispatcher {\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external;\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address);\n}\n",
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IWrapperFunctions {\n\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrKill.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrKillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrders(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrders(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously cancels multiple orders in a single transaction.\n /// @param orders Array of order specifications.\n function batchCancelOrders(LibOrder.Order[] memory orders)\n public;\n\n /// @dev Fetches information for all passed in orders\n /// @param orders Array of order specifications.\n /// @return Array of OrderInfo instances that correspond to each order.\n function getOrdersInfo(LibOrder.Order[] memory orders)\n public\n view\n returns (LibOrder.OrderInfo[] memory);\n}\n"
+ },
+ "sourceTreeHashHex": "0x72933d8134f374ff9bf73cacacde5711ac65efd3ac167ef1b0be6f90ca4a642b",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/Forwarder.json b/packages/contracts/generated-artifacts/Forwarder.json
new file mode 100644
index 000000000..63ae5c72d
--- /dev/null
+++ b/packages/contracts/generated-artifacts/Forwarder.json
@@ -0,0 +1,601 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "Forwarder",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "makerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "feeOrders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "feeSignatures",
+ "type": "bytes[]"
+ },
+ {
+ "name": "feePercentage",
+ "type": "uint256"
+ },
+ {
+ "name": "feeRecipient",
+ "type": "address"
+ }
+ ],
+ "name": "marketBuyOrdersWithEth",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "orderFillResults",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "feeOrderFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "assetData",
+ "type": "bytes"
+ },
+ {
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "withdrawAsset",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "feeOrders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "feeSignatures",
+ "type": "bytes[]"
+ },
+ {
+ "name": "feePercentage",
+ "type": "uint256"
+ },
+ {
+ "name": "feeRecipient",
+ "type": "address"
+ }
+ ],
+ "name": "marketSellOrdersWithEth",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "orderFillResults",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "feeOrderFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_exchange",
+ "type": "address"
+ },
+ {
+ "name": "_zrxAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "_wethAssetData",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "fallback"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040523480156200001157600080fd5b5060405162002d2c38038062002d2c83398101806040526200003791908101906200051d565b6000805433600160a060020a031991821617825560018054909116600160a060020a0386161790558251849084908490849081906200007e906004906020870190620003d0565b50825162000094906005906020860190620003d0565b50620000b0836010640100000000620019476200036f82021704565b9150620000cd846010640100000000620019476200036f82021704565b60028054600160a060020a03948516600160a060020a031991821617909155600380549285169290911691909117905550600154604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130181207f6070410800000000000000000000000000000000000000000000000000000000825291909216945063607041089350620001739250906004016200068e565b602060405180830381600087803b1580156200018e57600080fd5b505af1158015620001a3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250620001c99190810190620004f4565b9050600160a060020a038116151562000219576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200021090620006b0565b60405180910390fd5b6002546040517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a039091169063095ea7b39062000268908490600019906004016200066f565b602060405180830381600087803b1580156200028357600080fd5b505af115801562000298573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250620002be9190810190620005a1565b506003546040517f095ea7b3000000000000000000000000000000000000000000000000000000008152600160a060020a039091169063095ea7b3906200030e908490600019906004016200066f565b602060405180830381600087803b1580156200032957600080fd5b505af11580156200033e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250620003649190810190620005a1565b50505050506200077a565b600081601401835110151515620003b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162000210906200069e565b506014818301810151910190600160a060020a03165b92915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200041357805160ff191683800117855562000443565b8280016001018555821562000443579182015b828111156200044357825182559160200191906001019062000426565b506200045192915062000455565b5090565b6200047291905b808211156200045157600081556001016200045c565b90565b600062000483825162000711565b9392505050565b600062000483825162000742565b6000601f82018313620004aa57600080fd5b8151620004c1620004bb82620006e9565b620006c2565b91508082526020830160208301858383011115620004de57600080fd5b620004eb83828462000747565b50505092915050565b6000602082840312156200050757600080fd5b600062000515848462000475565b949350505050565b6000806000606084860312156200053357600080fd5b600062000541868662000475565b93505060208401516001604060020a038111156200055e57600080fd5b6200056c8682870162000498565b92505060408401516001604060020a038111156200058957600080fd5b620005978682870162000498565b9150509250925092565b600060208284031215620005b457600080fd5b60006200051584846200048a565b620005cd8162000711565b82525050565b620005cd816200071d565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601881527f554e524547495354455245445f41535345545f50524f58590000000000000000602082015260400190565b620005cd8162000472565b604081016200067f8285620005c2565b62000483602083018462000664565b60208101620003ca8284620005d3565b60208082528101620003ca81620005de565b60208082528101620003ca8162000634565b6040518181016001604060020a0381118282101715620006e157600080fd5b604052919050565b60006001604060020a038211156200070057600080fd5b506020601f91909101601f19160190565b600160a060020a031690565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b151590565b60005b83811015620007645781810151838201526020016200074a565b8381111562000774576000848401525b50505050565b6125a2806200078a6000396000f30060806040526004361061006c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166318978e8281146100c8578063630f1e6c146100f25780638da5cb5b146101125780639395525c14610134578063f2fde38b14610147575b60025473ffffffffffffffffffffffffffffffffffffffff1633146100c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612388565b60405180910390fd5b005b6100db6100d6366004611df1565b610167565b6040516100e9929190612488565b60405180910390f35b3480156100fe57600080fd5b506100c661010d366004611eec565b6102f7565b34801561011e57600080fd5b50610127610388565b6040516100e99190612337565b6100db610142366004611d0b565b6103a4565b34801561015357600080fd5b506100c6610162366004611ce5565b61050a565b61016f6119fa565b6101776119fa565b6000806101826105bb565b60048054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815261025c939092909183018282801561022d5780601f106102025761010080835404028352916020019161022d565b820191906000526020600020905b81548152906001019060200180831161021057829003601f168201915b50505050508c600081518110151561024157fe5b6020908102909101015161014001519063ffffffff61069616565b156102875761026c8b8b8b6107c3565b935061028084600001518560600151610ac1565b90506102ae565b6102928b8b8b610b03565b9350836060015191506102a68883896107c3565b845190935090505b6102c2846020015184602001518888610d15565b6102e98b60008151811015156102d457fe5b90602001906020020151610140015182610f29565b505097509795505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610348576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612438565b61038383838080601f01602080910402602001604051908101604052809392919081815260200183838082843750879450610f299350505050565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6103ac6119fa565b6103b46119fa565b60008060006103c16105bb565b60048054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001881615020190951694909404938401819004810282018101909252828152610441939092909183018282801561022d5780601f106102025761010080835404028352916020019161022d565b156104925761046a670de0b6b3a7640000610464670de0b6b3a76400008a611045565b3461108f565b92506104778b848c6110e7565b945061048b85600001518660600151610ac1565b90506104d6565b6104ad670d2f13f7789f0000670de0b6b3a76400003461108f565b92506104ba8b848c6110e7565b9450846060015191506104ce89838a6107c3565b855190945090505b6104ea856020015185602001518989610d15565b6104fc8b60008151811015156102d457fe5b505050965096945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461055b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612438565b73ffffffffffffffffffffffffffffffffffffffff8116156105b857600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b600034116105f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612398565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016000604051808303818588803b15801561067b57600080fd5b505af115801561068f573d6000803e3d6000fd5b5050505050565b6000815183511480156107ba5750816040518082805190602001908083835b602083106106f257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016106b5565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052604051919093018190038120885190955088945090928392508401908083835b6020831061078757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161074a565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916145b90505b92915050565b6107cb6119fa565b60608060008060008060006107de6119fa565b8a15156107ea57610ab2565b6004805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561088e5780601f106108635761010080835404028352916020019161088e565b820191906000526020600020905b81548152906001019060200180831161087157829003601f168201915b505060058054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001881615020190951694909404938401819004810282018101909252828152969e509194509250840190508282801561093d5780601f106109125761010080835404028352916020019161093d565b820191906000526020600020905b81548152906001019060200180831161092057829003601f168201915b50505050509650600095508b519450600093505b838514610a7857878c8581518110151561096757fe5b6020908102909101015161014001528b5187908d908690811061098657fe5b60209081029091010151610160015261099f8b87610ac1565b9250610a068c858151811015156109b257fe5b9060200190602002015160a00151610a008e878151811015156109d157fe5b90602001906020020151608001518f888151811015156109ed57fe5b9060200190602002015160e00151610ac1565b8561128b565b9150610a418c85815181101515610a1957fe5b90602001906020020151838c87815181101515610a3257fe5b906020019060200201516112e6565b9050610a4d898261135e565b610a5f89600001518a60600151610ac1565b95508a8610610a6d57610a78565b600190930192610951565b8a861015610ab2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612418565b50505050505050509392505050565b600082821115610afd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123b8565b50900390565b610b0b6119fa565b606080600080600080610b1c6119fa565b60008b6000815181101515610b2d57fe5b6020908102919091018101516101400151600580546040805160026001841615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190931692909204601f8101869004860283018601909152808252929b5092909190830182828015610be55780601f10610bba57610100808354040283529160200191610be5565b820191906000526020600020905b815481529060010190602001808311610bc857829003601f168201915b505050505096508b519550600094505b848614610cdb57878c86815181101515610c0b57fe5b6020908102909101015161014001528b5187908d9087908110610c2a57fe5b6020908102909101015161016001528851610c46908c90610ac1565b9350610c898c86815181101515610c5957fe5b9060200190602002015160a001518d87815181101515610c7557fe5b90602001906020020151608001518661128b565b9250610cb58c86815181101515610c9c57fe5b90602001906020020151848c88815181101515610a3257fe5b9150610cc1898361135e565b5087518a8110610cd057610cdb565b600190940193610bf5565b8a811015610ab2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612418565b600080808066b1a2bc2ec50000861115610d5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612448565b610d658888611045565b935034841115610da1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123a8565b610dab3485610ac1565b9250610dc086670de0b6b3a76400008a61108f565b915082821115610dfc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612428565b6000831115610f1f576002546040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90610e5b9086906004016124a4565b600060405180830381600087803b158015610e7557600080fd5b505af1158015610e89573d6000803e3d6000fd5b505050506000821115610edb5760405173ffffffffffffffffffffffffffffffffffffffff86169083156108fc029084906000818181858888f19350505050158015610ed9573d6000803e3d6000fd5b505b610ee58383610ac1565b90506000811115610f1f57604051339082156108fc029083906000818181858888f19350505050158015610f1d573d6000803e3d6000fd5b505b5050505050505050565b6000610f3b838263ffffffff6113c016565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190209091507fffffffff0000000000000000000000000000000000000000000000000000000080831691161415610fab57610fa6838361142d565b610383565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190207fffffffff000000000000000000000000000000000000000000000000000000008281169116141561101357610fa6838361161b565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123f8565b600082820183811015611084576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123e8565b8091505b5092915050565b60008083116110ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123d8565b6110dd6110d78584611703565b8461175e565b90505b9392505050565b6110ef6119fa565b60608060008060006110ff6119fa565b89600081518110151561110e57fe5b6020908102919091018101516101400151600580546040805160026001841615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190931692909204601f8101869004860283018601909152808252929950929091908301828280156111c65780601f1061119b576101008083540402835291602001916111c6565b820191906000526020600020905b8154815290600101906020018083116111a957829003601f168201915b5050505050945089519350600092505b82841461127e57858a848151811015156111ec57fe5b602090810290910101516101400152895185908b908590811061120b57fe5b90602001906020020151610160018190525061122b898860200151610ac1565b91506112578a8481518110151561123e57fe5b90602001906020020151838a86815181101515610a3257fe5b9050611263878261135e565b602087015189116112735761127e565b6001909201916111d6565b5050505050509392505050565b60008083116112c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123d8565b6110dd6110d76112d68685611703565b6112e1866001610ac1565b611045565b6112ee6119fa565b606060006112fd868686611775565b600154815191935073ffffffffffffffffffffffffffffffffffffffff1691506080908390602082016000855af1801561135457825184526020830151602085015260408301516040850152606083015160608501525b5050509392505050565b8151815161136c9190611045565b8252602080830151908201516113829190611045565b60208301526040808301519082015161139b9190611045565b6040830152606080830151908201516113b49190611045565b60609092019190915250565b600081600401835110151515611402576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612468565b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b60008061144184601063ffffffff61194716565b604080517f7472616e7366657228616464726573732c75696e7432353629000000000000008152905190819003601901812091935073ffffffffffffffffffffffffffffffffffffffff8416919061149f903390879060240161236d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931783525181519192909182919080838360005b8381101561154357818101518382015260200161152b565b50505050905090810190601f1680156115705780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af1925050508015156115bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612408565b3d156115dc575060003d602014156115dc5760206000803e506000515b801515611615576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612408565b50505050565b60008060018314611658576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612478565b61166984601063ffffffff61194716565b915061167c84602463ffffffff6119a816565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff8316906323b872dd906116d590309033908690600401612345565b600060405180830381600087803b1580156116ef57600080fd5b505af1158015610f1f573d6000803e3d6000fd5b6000808315156117165760009150611088565b5082820282848281151561172657fe5b0414611084576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123e8565b600080828481151561176c57fe5b04949350505050565b604080517fb4be83d5000000000000000000000000000000000000000000000000000000006020808301919091526060602483018181528751608485019081528884015160a48601529488015160c48501529087015160e4840152608087015161010484015260a087015161012484015260c087015161014484015260e08701516101648401526101008701516101848401526101208701516101a4840152610140870180516101c485019081526101608901516101e4860152610180905251805161020485018190529394919384936044870192849261022489019291820191601f82010460005b8181101561187c57835185526020948501949093019260010161185e565b50505050818103610160808401919091528a0151805180835260209283019291820191601f82010460005b818110156118c55783518552602094850194909301926001016118a7565b50505089845250848103602093840190815288518083529093918201918981019190601f82010460005b8181101561190d5783518552602094850194909301926001016118ef565b5050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08883030188525060405250505050509392505050565b600081601401835110151515611989576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612458565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b60006107ba83836000816020018351101515156119f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123c8565b50016020015190565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b60006107ba8235612540565b6000601f82018313611a4057600080fd5b8135611a53611a4e826124d9565b6124b2565b81815260209384019390925082018360005b83811015611a915781358601611a7b8882611b41565b8452506020928301929190910190600101611a65565b5050505092915050565b6000601f82018313611aac57600080fd5b8135611aba611a4e826124d9565b81815260209384019390925082018360005b83811015611a915781358601611ae28882611b90565b8452506020928301929190910190600101611acc565b600080601f83018413611b0a57600080fd5b50813567ffffffffffffffff811115611b2257600080fd5b602083019150836001820283011115611b3a57600080fd5b9250929050565b6000601f82018313611b5257600080fd5b8135611b60611a4e826124fa565b91508082526020830160208301858383011115611b7c57600080fd5b611b8783828461255c565b50505092915050565b60006101808284031215611ba357600080fd5b611bae6101806124b2565b90506000611bbc8484611a23565b8252506020611bcd84848301611a23565b6020830152506040611be184828501611a23565b6040830152506060611bf584828501611a23565b6060830152506080611c0984828501611cd9565b60808301525060a0611c1d84828501611cd9565b60a08301525060c0611c3184828501611cd9565b60c08301525060e0611c4584828501611cd9565b60e083015250610100611c5a84828501611cd9565b61010083015250610120611c7084828501611cd9565b6101208301525061014082013567ffffffffffffffff811115611c9257600080fd5b611c9e84828501611b41565b6101408301525061016082013567ffffffffffffffff811115611cc057600080fd5b611ccc84828501611b41565b6101608301525092915050565b60006107ba8235612559565b600060208284031215611cf757600080fd5b6000611d038484611a23565b949350505050565b60008060008060008060c08789031215611d2457600080fd5b863567ffffffffffffffff811115611d3b57600080fd5b611d4789828a01611a9b565b965050602087013567ffffffffffffffff811115611d6457600080fd5b611d7089828a01611a2f565b955050604087013567ffffffffffffffff811115611d8d57600080fd5b611d9989828a01611a9b565b945050606087013567ffffffffffffffff811115611db657600080fd5b611dc289828a01611a2f565b9350506080611dd389828a01611cd9565b92505060a0611de489828a01611a23565b9150509295509295509295565b600080600080600080600060e0888a031215611e0c57600080fd5b873567ffffffffffffffff811115611e2357600080fd5b611e2f8a828b01611a9b565b9750506020611e408a828b01611cd9565b965050604088013567ffffffffffffffff811115611e5d57600080fd5b611e698a828b01611a2f565b955050606088013567ffffffffffffffff811115611e8657600080fd5b611e928a828b01611a9b565b945050608088013567ffffffffffffffff811115611eaf57600080fd5b611ebb8a828b01611a2f565b93505060a0611ecc8a828b01611cd9565b92505060c0611edd8a828b01611a23565b91505092959891949750929550565b600080600060408486031215611f0157600080fd5b833567ffffffffffffffff811115611f1857600080fd5b611f2486828701611af8565b93509350506020611f3786828701611cd9565b9150509250925092565b611f4a81612540565b82525050565b602381527f44454641554c545f46554e4354494f4e5f574554485f434f4e54524143545f4f60208201527f4e4c590000000000000000000000000000000000000000000000000000000000604082015260600190565b601181527f494e56414c49445f4d53475f56414c5545000000000000000000000000000000602082015260400190565b600d81527f4f564552534f4c445f5745544800000000000000000000000000000000000000602082015260400190565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601081527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b601781527f554e535550504f525445445f41535345545f50524f5859000000000000000000602082015260400190565b600f81527f5452414e534645525f4641494c45440000000000000000000000000000000000602082015260400190565b601481527f434f4d504c4554455f46494c4c5f4641494c4544000000000000000000000000602082015260400190565b601a81527f494e53554646494349454e545f4554485f52454d41494e494e47000000000000602082015260400190565b601381527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000602082015260400190565b601881527f4645455f50455243454e544147455f544f4f5f4c415247450000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b602581527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160208201527f5549524544000000000000000000000000000000000000000000000000000000604082015260600190565b600e81527f494e56414c49445f414d4f554e54000000000000000000000000000000000000602082015260400190565b805160808301906122f9848261232e565b50602082015161230c602085018261232e565b50604082015161231f604085018261232e565b50606082015161161560608501825b611f4a81612559565b602081016107bd8284611f41565b606081016123538286611f41565b6123606020830185611f41565b611d03604083018461232e565b6040810161237b8285611f41565b6110e0602083018461232e565b602080825281016107bd81611f50565b602080825281016107bd81611fa6565b602080825281016107bd81611fd6565b602080825281016107bd81612006565b602080825281016107bd81612036565b602080825281016107bd8161208c565b602080825281016107bd816120bc565b602080825281016107bd816120ec565b602080825281016107bd8161211c565b602080825281016107bd8161214c565b602080825281016107bd8161217c565b602080825281016107bd816121ac565b602080825281016107bd816121dc565b602080825281016107bd8161220c565b602080825281016107bd81612262565b602080825281016107bd816122b8565b610100810161249782856122e8565b6110e060808301846122e8565b602081016107bd828461232e565b60405181810167ffffffffffffffff811182821017156124d157600080fd5b604052919050565b600067ffffffffffffffff8211156124f057600080fd5b5060209081020190565b600067ffffffffffffffff82111561251157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b828183375060009101525600a265627a7a72305820d9f418f11e0f91f06f6f9d22924be0add925495eeb76a6388b5417adb505eeb36c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x2D2C CODESIZE SUB DUP1 PUSH3 0x2D2C DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH3 0x37 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH3 0x51D JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD CALLER PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT SWAP2 DUP3 AND OR DUP3 SSTORE PUSH1 0x1 DUP1 SLOAD SWAP1 SWAP2 AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP7 AND OR SWAP1 SSTORE DUP3 MLOAD DUP5 SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP2 SWAP1 PUSH3 0x7E SWAP1 PUSH1 0x4 SWAP1 PUSH1 0x20 DUP8 ADD SWAP1 PUSH3 0x3D0 JUMP JUMPDEST POP DUP3 MLOAD PUSH3 0x94 SWAP1 PUSH1 0x5 SWAP1 PUSH1 0x20 DUP7 ADD SWAP1 PUSH3 0x3D0 JUMP JUMPDEST POP PUSH3 0xB0 DUP4 PUSH1 0x10 PUSH5 0x100000000 PUSH3 0x1947 PUSH3 0x36F DUP3 MUL OR DIV JUMP JUMPDEST SWAP2 POP PUSH3 0xCD DUP5 PUSH1 0x10 PUSH5 0x100000000 PUSH3 0x1947 PUSH3 0x36F DUP3 MUL OR DIV JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP5 DUP6 AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT SWAP2 DUP3 AND OR SWAP1 SWAP2 SSTORE PUSH1 0x3 DUP1 SLOAD SWAP3 DUP6 AND SWAP3 SWAP1 SWAP2 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE POP PUSH1 0x1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD DUP2 KECCAK256 PUSH32 0x6070410800000000000000000000000000000000000000000000000000000000 DUP3 MSTORE SWAP2 SWAP1 SWAP3 AND SWAP5 POP PUSH4 0x60704108 SWAP4 POP PUSH3 0x173 SWAP3 POP SWAP1 PUSH1 0x4 ADD PUSH3 0x68E JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH3 0x18E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH3 0x1A3 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH3 0x1C9 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH3 0x4F4 JUMP JUMPDEST SWAP1 POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP2 AND ISZERO ISZERO PUSH3 0x219 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH3 0x210 SWAP1 PUSH3 0x6B0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x2 SLOAD PUSH1 0x40 MLOAD PUSH32 0x95EA7B300000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP2 AND SWAP1 PUSH4 0x95EA7B3 SWAP1 PUSH3 0x268 SWAP1 DUP5 SWAP1 PUSH1 0x0 NOT SWAP1 PUSH1 0x4 ADD PUSH3 0x66F JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH3 0x283 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH3 0x298 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH3 0x2BE SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH3 0x5A1 JUMP JUMPDEST POP PUSH1 0x3 SLOAD PUSH1 0x40 MLOAD PUSH32 0x95EA7B300000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP2 AND SWAP1 PUSH4 0x95EA7B3 SWAP1 PUSH3 0x30E SWAP1 DUP5 SWAP1 PUSH1 0x0 NOT SWAP1 PUSH1 0x4 ADD PUSH3 0x66F JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH3 0x329 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH3 0x33E JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH3 0x364 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH3 0x5A1 JUMP JUMPDEST POP POP POP POP POP PUSH3 0x77A JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH3 0x3B4 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH3 0x210 SWAP1 PUSH3 0x69E JUMP JUMPDEST POP PUSH1 0x14 DUP2 DUP4 ADD DUP2 ADD MLOAD SWAP2 ADD SWAP1 PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH3 0x413 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH3 0x443 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH3 0x443 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0x443 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH3 0x426 JUMP JUMPDEST POP PUSH3 0x451 SWAP3 SWAP2 POP PUSH3 0x455 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x472 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x451 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x45C JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH3 0x483 DUP3 MLOAD PUSH3 0x711 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x483 DUP3 MLOAD PUSH3 0x742 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH3 0x4AA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH3 0x4C1 PUSH3 0x4BB DUP3 PUSH3 0x6E9 JUMP JUMPDEST PUSH3 0x6C2 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH3 0x4DE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x4EB DUP4 DUP3 DUP5 PUSH3 0x747 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH3 0x507 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH3 0x515 DUP5 DUP5 PUSH3 0x475 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH3 0x533 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH3 0x541 DUP7 DUP7 PUSH3 0x475 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 DUP5 ADD MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH3 0x55E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x56C DUP7 DUP3 DUP8 ADD PUSH3 0x498 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH3 0x589 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x597 DUP7 DUP3 DUP8 ADD PUSH3 0x498 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH3 0x5B4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH3 0x515 DUP5 DUP5 PUSH3 0x48A JUMP JUMPDEST PUSH3 0x5CD DUP2 PUSH3 0x711 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH3 0x5CD DUP2 PUSH3 0x71D JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x18 DUP2 MSTORE PUSH32 0x554E524547495354455245445F41535345545F50524F58590000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH3 0x5CD DUP2 PUSH3 0x472 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH3 0x67F DUP3 DUP6 PUSH3 0x5C2 JUMP JUMPDEST PUSH3 0x483 PUSH1 0x20 DUP4 ADD DUP5 PUSH3 0x664 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH3 0x3CA DUP3 DUP5 PUSH3 0x5D3 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH3 0x3CA DUP2 PUSH3 0x5DE JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH3 0x3CA DUP2 PUSH3 0x634 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH3 0x6E1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP3 GT ISZERO PUSH3 0x700 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH3 0x764 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH3 0x74A JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH3 0x774 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH2 0x25A2 DUP1 PUSH3 0x78A PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x6C JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x18978E82 DUP2 EQ PUSH2 0xC8 JUMPI DUP1 PUSH4 0x630F1E6C EQ PUSH2 0xF2 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x112 JUMPI DUP1 PUSH4 0x9395525C EQ PUSH2 0x134 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x147 JUMPI JUMPDEST PUSH1 0x2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xC6 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2388 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST STOP JUMPDEST PUSH2 0xDB PUSH2 0xD6 CALLDATASIZE PUSH1 0x4 PUSH2 0x1DF1 JUMP JUMPDEST PUSH2 0x167 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xE9 SWAP3 SWAP2 SWAP1 PUSH2 0x2488 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xFE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC6 PUSH2 0x10D CALLDATASIZE PUSH1 0x4 PUSH2 0x1EEC JUMP JUMPDEST PUSH2 0x2F7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x11E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x127 PUSH2 0x388 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xE9 SWAP2 SWAP1 PUSH2 0x2337 JUMP JUMPDEST PUSH2 0xDB PUSH2 0x142 CALLDATASIZE PUSH1 0x4 PUSH2 0x1D0B JUMP JUMPDEST PUSH2 0x3A4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x153 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC6 PUSH2 0x162 CALLDATASIZE PUSH1 0x4 PUSH2 0x1CE5 JUMP JUMPDEST PUSH2 0x50A JUMP JUMPDEST PUSH2 0x16F PUSH2 0x19FA JUMP JUMPDEST PUSH2 0x177 PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x182 PUSH2 0x5BB JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP9 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH2 0x25C SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x22D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x202 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x22D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x210 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP13 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x241 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MLOAD SWAP1 PUSH4 0xFFFFFFFF PUSH2 0x696 AND JUMP JUMPDEST ISZERO PUSH2 0x287 JUMPI PUSH2 0x26C DUP12 DUP12 DUP12 PUSH2 0x7C3 JUMP JUMPDEST SWAP4 POP PUSH2 0x280 DUP5 PUSH1 0x0 ADD MLOAD DUP6 PUSH1 0x60 ADD MLOAD PUSH2 0xAC1 JUMP JUMPDEST SWAP1 POP PUSH2 0x2AE JUMP JUMPDEST PUSH2 0x292 DUP12 DUP12 DUP12 PUSH2 0xB03 JUMP JUMPDEST SWAP4 POP DUP4 PUSH1 0x60 ADD MLOAD SWAP2 POP PUSH2 0x2A6 DUP9 DUP4 DUP10 PUSH2 0x7C3 JUMP JUMPDEST DUP5 MLOAD SWAP1 SWAP4 POP SWAP1 POP JUMPDEST PUSH2 0x2C2 DUP5 PUSH1 0x20 ADD MLOAD DUP5 PUSH1 0x20 ADD MLOAD DUP9 DUP9 PUSH2 0xD15 JUMP JUMPDEST PUSH2 0x2E9 DUP12 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2D4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x140 ADD MLOAD DUP3 PUSH2 0xF29 JUMP JUMPDEST POP POP SWAP8 POP SWAP8 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x348 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2438 JUMP JUMPDEST PUSH2 0x383 DUP4 DUP4 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP DUP8 SWAP5 POP PUSH2 0xF29 SWAP4 POP POP POP POP JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH2 0x3AC PUSH2 0x19FA JUMP JUMPDEST PUSH2 0x3B4 PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x3C1 PUSH2 0x5BB JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP9 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH2 0x441 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x22D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x202 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x22D JUMP JUMPDEST ISZERO PUSH2 0x492 JUMPI PUSH2 0x46A PUSH8 0xDE0B6B3A7640000 PUSH2 0x464 PUSH8 0xDE0B6B3A7640000 DUP11 PUSH2 0x1045 JUMP JUMPDEST CALLVALUE PUSH2 0x108F JUMP JUMPDEST SWAP3 POP PUSH2 0x477 DUP12 DUP5 DUP13 PUSH2 0x10E7 JUMP JUMPDEST SWAP5 POP PUSH2 0x48B DUP6 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x60 ADD MLOAD PUSH2 0xAC1 JUMP JUMPDEST SWAP1 POP PUSH2 0x4D6 JUMP JUMPDEST PUSH2 0x4AD PUSH8 0xD2F13F7789F0000 PUSH8 0xDE0B6B3A7640000 CALLVALUE PUSH2 0x108F JUMP JUMPDEST SWAP3 POP PUSH2 0x4BA DUP12 DUP5 DUP13 PUSH2 0x10E7 JUMP JUMPDEST SWAP5 POP DUP5 PUSH1 0x60 ADD MLOAD SWAP2 POP PUSH2 0x4CE DUP10 DUP4 DUP11 PUSH2 0x7C3 JUMP JUMPDEST DUP6 MLOAD SWAP1 SWAP5 POP SWAP1 POP JUMPDEST PUSH2 0x4EA DUP6 PUSH1 0x20 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD DUP10 DUP10 PUSH2 0xD15 JUMP JUMPDEST PUSH2 0x4FC DUP12 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2D4 JUMPI INVALID JUMPDEST POP POP POP SWAP7 POP SWAP7 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x55B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2438 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x5B8 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 CALLVALUE GT PUSH2 0x5F5 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2398 JUMP JUMPDEST PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xD0E30DB0 CALLVALUE PUSH1 0x40 MLOAD DUP3 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x67B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x68F JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD DUP4 MLOAD EQ DUP1 ISZERO PUSH2 0x7BA JUMPI POP DUP2 PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x6F2 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x6B5 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP9 MLOAD SWAP1 SWAP6 POP DUP9 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x787 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x74A JUMP JUMPDEST PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP3 MLOAD AND DUP2 DUP5 MLOAD AND DUP1 DUP3 OR DUP6 MSTORE POP POP POP POP POP POP SWAP1 POP ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 PUSH1 0x0 NOT AND EQ JUMPDEST SWAP1 POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x7CB PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x7DE PUSH2 0x19FA JUMP JUMPDEST DUP11 ISZERO ISZERO PUSH2 0x7EA JUMPI PUSH2 0xAB2 JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x88E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x863 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x88E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x871 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP9 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE SWAP7 SWAP15 POP SWAP2 SWAP5 POP SWAP3 POP DUP5 ADD SWAP1 POP DUP3 DUP3 DUP1 ISZERO PUSH2 0x93D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x912 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x93D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x920 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP7 POP PUSH1 0x0 SWAP6 POP DUP12 MLOAD SWAP5 POP PUSH1 0x0 SWAP4 POP JUMPDEST DUP4 DUP6 EQ PUSH2 0xA78 JUMPI DUP8 DUP13 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x967 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP12 MLOAD DUP8 SWAP1 DUP14 SWAP1 DUP7 SWAP1 DUP2 LT PUSH2 0x986 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x160 ADD MSTORE PUSH2 0x99F DUP12 DUP8 PUSH2 0xAC1 JUMP JUMPDEST SWAP3 POP PUSH2 0xA06 DUP13 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x9B2 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0xA0 ADD MLOAD PUSH2 0xA00 DUP15 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x9D1 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x80 ADD MLOAD DUP16 DUP9 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x9ED JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0xE0 ADD MLOAD PUSH2 0xAC1 JUMP JUMPDEST DUP6 PUSH2 0x128B JUMP JUMPDEST SWAP2 POP PUSH2 0xA41 DUP13 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA19 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP13 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA32 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x12E6 JUMP JUMPDEST SWAP1 POP PUSH2 0xA4D DUP10 DUP3 PUSH2 0x135E JUMP JUMPDEST PUSH2 0xA5F DUP10 PUSH1 0x0 ADD MLOAD DUP11 PUSH1 0x60 ADD MLOAD PUSH2 0xAC1 JUMP JUMPDEST SWAP6 POP DUP11 DUP7 LT PUSH2 0xA6D JUMPI PUSH2 0xA78 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP4 ADD SWAP3 PUSH2 0x951 JUMP JUMPDEST DUP11 DUP7 LT ISZERO PUSH2 0xAB2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2418 JUMP JUMPDEST POP POP POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xAFD JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23B8 JUMP JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH2 0xB0B PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0xB1C PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x0 DUP12 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xB2D JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH2 0x140 ADD MLOAD PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x2 PUSH1 0x1 DUP5 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 DIV PUSH1 0x1F DUP2 ADD DUP7 SWAP1 DIV DUP7 MUL DUP4 ADD DUP7 ADD SWAP1 SWAP2 MSTORE DUP1 DUP3 MSTORE SWAP3 SWAP12 POP SWAP3 SWAP1 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xBE5 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xBBA JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xBE5 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xBC8 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP7 POP DUP12 MLOAD SWAP6 POP PUSH1 0x0 SWAP5 POP JUMPDEST DUP5 DUP7 EQ PUSH2 0xCDB JUMPI DUP8 DUP13 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC0B JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP12 MLOAD DUP8 SWAP1 DUP14 SWAP1 DUP8 SWAP1 DUP2 LT PUSH2 0xC2A JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x160 ADD MSTORE DUP9 MLOAD PUSH2 0xC46 SWAP1 DUP13 SWAP1 PUSH2 0xAC1 JUMP JUMPDEST SWAP4 POP PUSH2 0xC89 DUP13 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC59 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0xA0 ADD MLOAD DUP14 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC75 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x80 ADD MLOAD DUP7 PUSH2 0x128B JUMP JUMPDEST SWAP3 POP PUSH2 0xCB5 DUP13 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC9C JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP13 DUP9 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA32 JUMPI INVALID JUMPDEST SWAP2 POP PUSH2 0xCC1 DUP10 DUP4 PUSH2 0x135E JUMP JUMPDEST POP DUP8 MLOAD DUP11 DUP2 LT PUSH2 0xCD0 JUMPI PUSH2 0xCDB JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP5 ADD SWAP4 PUSH2 0xBF5 JUMP JUMPDEST DUP11 DUP2 LT ISZERO PUSH2 0xAB2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2418 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP1 PUSH7 0xB1A2BC2EC50000 DUP7 GT ISZERO PUSH2 0xD5B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2448 JUMP JUMPDEST PUSH2 0xD65 DUP9 DUP9 PUSH2 0x1045 JUMP JUMPDEST SWAP4 POP CALLVALUE DUP5 GT ISZERO PUSH2 0xDA1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23A8 JUMP JUMPDEST PUSH2 0xDAB CALLVALUE DUP6 PUSH2 0xAC1 JUMP JUMPDEST SWAP3 POP PUSH2 0xDC0 DUP7 PUSH8 0xDE0B6B3A7640000 DUP11 PUSH2 0x108F JUMP JUMPDEST SWAP2 POP DUP3 DUP3 GT ISZERO PUSH2 0xDFC JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2428 JUMP JUMPDEST PUSH1 0x0 DUP4 GT ISZERO PUSH2 0xF1F JUMPI PUSH1 0x2 SLOAD PUSH1 0x40 MLOAD PUSH32 0x2E1A7D4D00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0x2E1A7D4D SWAP1 PUSH2 0xE5B SWAP1 DUP7 SWAP1 PUSH1 0x4 ADD PUSH2 0x24A4 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xE75 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xE89 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x0 DUP3 GT ISZERO PUSH2 0xEDB JUMPI PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 DUP4 ISZERO PUSH2 0x8FC MUL SWAP1 DUP5 SWAP1 PUSH1 0x0 DUP2 DUP2 DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0xED9 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP JUMPDEST PUSH2 0xEE5 DUP4 DUP4 PUSH2 0xAC1 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 DUP2 GT ISZERO PUSH2 0xF1F JUMPI PUSH1 0x40 MLOAD CALLER SWAP1 DUP3 ISZERO PUSH2 0x8FC MUL SWAP1 DUP4 SWAP1 PUSH1 0x0 DUP2 DUP2 DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0xF1D JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP JUMPDEST POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xF3B DUP4 DUP3 PUSH4 0xFFFFFFFF PUSH2 0x13C0 AND JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP1 DUP4 AND SWAP2 AND EQ ISZERO PUSH2 0xFAB JUMPI PUSH2 0xFA6 DUP4 DUP4 PUSH2 0x142D JUMP JUMPDEST PUSH2 0x383 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x455243373231546F6B656E28616464726573732C75696E743235362900000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x1C ADD SWAP1 KECCAK256 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP3 DUP2 AND SWAP2 AND EQ ISZERO PUSH2 0x1013 JUMPI PUSH2 0xFA6 DUP4 DUP4 PUSH2 0x161B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23F8 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x1084 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23E8 JUMP JUMPDEST DUP1 SWAP2 POP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x10CA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23D8 JUMP JUMPDEST PUSH2 0x10DD PUSH2 0x10D7 DUP6 DUP5 PUSH2 0x1703 JUMP JUMPDEST DUP5 PUSH2 0x175E JUMP JUMPDEST SWAP1 POP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x10EF PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x10FF PUSH2 0x19FA JUMP JUMPDEST DUP10 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x110E JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH2 0x140 ADD MLOAD PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x2 PUSH1 0x1 DUP5 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 DIV PUSH1 0x1F DUP2 ADD DUP7 SWAP1 DIV DUP7 MUL DUP4 ADD DUP7 ADD SWAP1 SWAP2 MSTORE DUP1 DUP3 MSTORE SWAP3 SWAP10 POP SWAP3 SWAP1 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x11C6 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x119B JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x11C6 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x11A9 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP5 POP DUP10 MLOAD SWAP4 POP PUSH1 0x0 SWAP3 POP JUMPDEST DUP3 DUP5 EQ PUSH2 0x127E JUMPI DUP6 DUP11 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x11EC JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP10 MLOAD DUP6 SWAP1 DUP12 SWAP1 DUP6 SWAP1 DUP2 LT PUSH2 0x120B JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD DUP2 SWAP1 MSTORE POP PUSH2 0x122B DUP10 DUP9 PUSH1 0x20 ADD MLOAD PUSH2 0xAC1 JUMP JUMPDEST SWAP2 POP PUSH2 0x1257 DUP11 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x123E JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP11 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA32 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x1263 DUP8 DUP3 PUSH2 0x135E JUMP JUMPDEST PUSH1 0x20 DUP8 ADD MLOAD DUP10 GT PUSH2 0x1273 JUMPI PUSH2 0x127E JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x11D6 JUMP JUMPDEST POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x12C6 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23D8 JUMP JUMPDEST PUSH2 0x10DD PUSH2 0x10D7 PUSH2 0x12D6 DUP7 DUP6 PUSH2 0x1703 JUMP JUMPDEST PUSH2 0x12E1 DUP7 PUSH1 0x1 PUSH2 0xAC1 JUMP JUMPDEST PUSH2 0x1045 JUMP JUMPDEST PUSH2 0x12EE PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH2 0x12FD DUP7 DUP7 DUP7 PUSH2 0x1775 JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 MLOAD SWAP2 SWAP4 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 POP PUSH1 0x80 SWAP1 DUP4 SWAP1 PUSH1 0x20 DUP3 ADD PUSH1 0x0 DUP6 GAS CALL DUP1 ISZERO PUSH2 0x1354 JUMPI DUP3 MLOAD DUP5 MSTORE PUSH1 0x20 DUP4 ADD MLOAD PUSH1 0x20 DUP6 ADD MSTORE PUSH1 0x40 DUP4 ADD MLOAD PUSH1 0x40 DUP6 ADD MSTORE PUSH1 0x60 DUP4 ADD MLOAD PUSH1 0x60 DUP6 ADD MSTORE JUMPDEST POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP2 MLOAD DUP2 MLOAD PUSH2 0x136C SWAP2 SWAP1 PUSH2 0x1045 JUMP JUMPDEST DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x1382 SWAP2 SWAP1 PUSH2 0x1045 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE PUSH1 0x40 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x139B SWAP2 SWAP1 PUSH2 0x1045 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE PUSH1 0x60 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x13B4 SWAP2 SWAP1 PUSH2 0x1045 JUMP JUMPDEST PUSH1 0x60 SWAP1 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x4 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1402 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2468 JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x1441 DUP5 PUSH1 0x10 PUSH4 0xFFFFFFFF PUSH2 0x1947 AND JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x7472616E7366657228616464726573732C75696E743235362900000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x19 ADD DUP2 KECCAK256 SWAP2 SWAP4 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP2 SWAP1 PUSH2 0x149F SWAP1 CALLER SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x236D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 MSTORE MLOAD DUP2 MLOAD SWAP2 SWAP3 SWAP1 SWAP2 DUP3 SWAP2 SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1543 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x152B JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x1570 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP2 POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP7 GAS CALL SWAP3 POP POP POP DUP1 ISZERO ISZERO PUSH2 0x15BF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2408 JUMP JUMPDEST RETURNDATASIZE ISZERO PUSH2 0x15DC JUMPI POP PUSH1 0x0 RETURNDATASIZE PUSH1 0x20 EQ ISZERO PUSH2 0x15DC JUMPI PUSH1 0x20 PUSH1 0x0 DUP1 RETURNDATACOPY POP PUSH1 0x0 MLOAD JUMPDEST DUP1 ISZERO ISZERO PUSH2 0x1615 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2408 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1 DUP4 EQ PUSH2 0x1658 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2478 JUMP JUMPDEST PUSH2 0x1669 DUP5 PUSH1 0x10 PUSH4 0xFFFFFFFF PUSH2 0x1947 AND JUMP JUMPDEST SWAP2 POP PUSH2 0x167C DUP5 PUSH1 0x24 PUSH4 0xFFFFFFFF PUSH2 0x19A8 AND JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x23B872DD00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP2 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND SWAP1 PUSH4 0x23B872DD SWAP1 PUSH2 0x16D5 SWAP1 ADDRESS SWAP1 CALLER SWAP1 DUP7 SWAP1 PUSH1 0x4 ADD PUSH2 0x2345 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x16EF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xF1F JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP1 DUP4 ISZERO ISZERO PUSH2 0x1716 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x1088 JUMP JUMPDEST POP DUP3 DUP3 MUL DUP3 DUP5 DUP3 DUP2 ISZERO ISZERO PUSH2 0x1726 JUMPI INVALID JUMPDEST DIV EQ PUSH2 0x1084 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23E8 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 DUP5 DUP2 ISZERO ISZERO PUSH2 0x176C JUMPI INVALID JUMPDEST DIV SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x60 PUSH1 0x24 DUP4 ADD DUP2 DUP2 MSTORE DUP8 MLOAD PUSH1 0x84 DUP6 ADD SWAP1 DUP2 MSTORE DUP9 DUP5 ADD MLOAD PUSH1 0xA4 DUP7 ADD MSTORE SWAP5 DUP9 ADD MLOAD PUSH1 0xC4 DUP6 ADD MSTORE SWAP1 DUP8 ADD MLOAD PUSH1 0xE4 DUP5 ADD MSTORE PUSH1 0x80 DUP8 ADD MLOAD PUSH2 0x104 DUP5 ADD MSTORE PUSH1 0xA0 DUP8 ADD MLOAD PUSH2 0x124 DUP5 ADD MSTORE PUSH1 0xC0 DUP8 ADD MLOAD PUSH2 0x144 DUP5 ADD MSTORE PUSH1 0xE0 DUP8 ADD MLOAD PUSH2 0x164 DUP5 ADD MSTORE PUSH2 0x100 DUP8 ADD MLOAD PUSH2 0x184 DUP5 ADD MSTORE PUSH2 0x120 DUP8 ADD MLOAD PUSH2 0x1A4 DUP5 ADD MSTORE PUSH2 0x140 DUP8 ADD DUP1 MLOAD PUSH2 0x1C4 DUP6 ADD SWAP1 DUP2 MSTORE PUSH2 0x160 DUP10 ADD MLOAD PUSH2 0x1E4 DUP7 ADD MSTORE PUSH2 0x180 SWAP1 MSTORE MLOAD DUP1 MLOAD PUSH2 0x204 DUP6 ADD DUP2 SWAP1 MSTORE SWAP4 SWAP5 SWAP2 SWAP4 DUP5 SWAP4 PUSH1 0x44 DUP8 ADD SWAP3 DUP5 SWAP3 PUSH2 0x224 DUP10 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x187C JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x185E JUMP JUMPDEST POP POP POP POP DUP2 DUP2 SUB PUSH2 0x160 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP11 ADD MLOAD DUP1 MLOAD DUP1 DUP4 MSTORE PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x18C5 JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x18A7 JUMP JUMPDEST POP POP POP DUP10 DUP5 MSTORE POP DUP5 DUP2 SUB PUSH1 0x20 SWAP4 DUP5 ADD SWAP1 DUP2 MSTORE DUP9 MLOAD DUP1 DUP4 MSTORE SWAP1 SWAP4 SWAP2 DUP3 ADD SWAP2 DUP10 DUP2 ADD SWAP2 SWAP1 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x190D JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x18EF JUMP JUMPDEST POP POP POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP9 DUP4 SUB ADD DUP9 MSTORE POP PUSH1 0x40 MSTORE POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1989 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2458 JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7BA DUP4 DUP4 PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x19F1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23C8 JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x80 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7BA DUP3 CALLDATALOAD PUSH2 0x2540 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x1A40 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x1A53 PUSH2 0x1A4E DUP3 PUSH2 0x24D9 JUMP JUMPDEST PUSH2 0x24B2 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1A91 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x1A7B DUP9 DUP3 PUSH2 0x1B41 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x1A65 JUMP JUMPDEST POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x1AAC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x1ABA PUSH2 0x1A4E DUP3 PUSH2 0x24D9 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1A91 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x1AE2 DUP9 DUP3 PUSH2 0x1B90 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x1ACC JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1F DUP4 ADD DUP5 SGT PUSH2 0x1B0A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1B22 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x1 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x1B3A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x1B52 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x1B60 PUSH2 0x1A4E DUP3 PUSH2 0x24FA JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x1B7C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1B87 DUP4 DUP3 DUP5 PUSH2 0x255C JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1BA3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1BAE PUSH2 0x180 PUSH2 0x24B2 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x1BBC DUP5 DUP5 PUSH2 0x1A23 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x1BCD DUP5 DUP5 DUP4 ADD PUSH2 0x1A23 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x1BE1 DUP5 DUP3 DUP6 ADD PUSH2 0x1A23 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x1BF5 DUP5 DUP3 DUP6 ADD PUSH2 0x1A23 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x1C09 DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x1C1D DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x1C31 DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x1C45 DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x1C5A DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x1C70 DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1C92 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1C9E DUP5 DUP3 DUP6 ADD PUSH2 0x1B41 JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1CC0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1CCC DUP5 DUP3 DUP6 ADD PUSH2 0x1B41 JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7BA DUP3 CALLDATALOAD PUSH2 0x2559 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1CF7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1D03 DUP5 DUP5 PUSH2 0x1A23 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0xC0 DUP8 DUP10 SUB SLT ISZERO PUSH2 0x1D24 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP7 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1D3B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1D47 DUP10 DUP3 DUP11 ADD PUSH2 0x1A9B JUMP JUMPDEST SWAP7 POP POP PUSH1 0x20 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1D64 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1D70 DUP10 DUP3 DUP11 ADD PUSH2 0x1A2F JUMP JUMPDEST SWAP6 POP POP PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1D8D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1D99 DUP10 DUP3 DUP11 ADD PUSH2 0x1A9B JUMP JUMPDEST SWAP5 POP POP PUSH1 0x60 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1DB6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1DC2 DUP10 DUP3 DUP11 ADD PUSH2 0x1A2F JUMP JUMPDEST SWAP4 POP POP PUSH1 0x80 PUSH2 0x1DD3 DUP10 DUP3 DUP11 ADD PUSH2 0x1CD9 JUMP JUMPDEST SWAP3 POP POP PUSH1 0xA0 PUSH2 0x1DE4 DUP10 DUP3 DUP11 ADD PUSH2 0x1A23 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 POP SWAP3 SWAP6 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0xE0 DUP9 DUP11 SUB SLT ISZERO PUSH2 0x1E0C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP8 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1E23 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1E2F DUP11 DUP3 DUP12 ADD PUSH2 0x1A9B JUMP JUMPDEST SWAP8 POP POP PUSH1 0x20 PUSH2 0x1E40 DUP11 DUP3 DUP12 ADD PUSH2 0x1CD9 JUMP JUMPDEST SWAP7 POP POP PUSH1 0x40 DUP9 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1E5D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1E69 DUP11 DUP3 DUP12 ADD PUSH2 0x1A2F JUMP JUMPDEST SWAP6 POP POP PUSH1 0x60 DUP9 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1E86 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1E92 DUP11 DUP3 DUP12 ADD PUSH2 0x1A9B JUMP JUMPDEST SWAP5 POP POP PUSH1 0x80 DUP9 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1EAF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1EBB DUP11 DUP3 DUP12 ADD PUSH2 0x1A2F JUMP JUMPDEST SWAP4 POP POP PUSH1 0xA0 PUSH2 0x1ECC DUP11 DUP3 DUP12 ADD PUSH2 0x1CD9 JUMP JUMPDEST SWAP3 POP POP PUSH1 0xC0 PUSH2 0x1EDD DUP11 DUP3 DUP12 ADD PUSH2 0x1A23 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP9 SWAP2 SWAP5 SWAP8 POP SWAP3 SWAP6 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x40 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x1F01 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1F18 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1F24 DUP7 DUP3 DUP8 ADD PUSH2 0x1AF8 JUMP JUMPDEST SWAP4 POP SWAP4 POP POP PUSH1 0x20 PUSH2 0x1F37 DUP7 DUP3 DUP8 ADD PUSH2 0x1CD9 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH2 0x1F4A DUP2 PUSH2 0x2540 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x23 DUP2 MSTORE PUSH32 0x44454641554C545F46554E4354494F4E5F574554485F434F4E54524143545F4F PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x4E4C590000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x494E56414C49445F4D53475F56414C5545000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x4F564552534F4C445F5745544800000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4449564953494F4E5F42595F5A45524F00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x554E535550504F525445445F41535345545F50524F5859000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xF DUP2 MSTORE PUSH32 0x5452414E534645525F4641494C45440000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x434F4D504C4554455F46494C4C5F4641494C4544000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x494E53554646494349454E545F4554485F52454D41494E494E47000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x13 DUP2 MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x18 DUP2 MSTORE PUSH32 0x4645455F50455243454E544147455F544F4F5F4C415247450000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x25 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F345F4C454E4754485F524551 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5549524544000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x494E56414C49445F414D4F554E54000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x80 DUP4 ADD SWAP1 PUSH2 0x22F9 DUP5 DUP3 PUSH2 0x232E JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x230C PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x232E JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x231F PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x232E JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x1615 PUSH1 0x60 DUP6 ADD DUP3 JUMPDEST PUSH2 0x1F4A DUP2 PUSH2 0x2559 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x7BD DUP3 DUP5 PUSH2 0x1F41 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x2353 DUP3 DUP7 PUSH2 0x1F41 JUMP JUMPDEST PUSH2 0x2360 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x1F41 JUMP JUMPDEST PUSH2 0x1D03 PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0x232E JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x237B DUP3 DUP6 PUSH2 0x1F41 JUMP JUMPDEST PUSH2 0x10E0 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x232E JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x1F50 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x1FA6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x1FD6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x2006 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x2036 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x208C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x20BC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x20EC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x211C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x214C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x217C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x21AC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x21DC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x220C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x2262 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x22B8 JUMP JUMPDEST PUSH2 0x100 DUP2 ADD PUSH2 0x2497 DUP3 DUP6 PUSH2 0x22E8 JUMP JUMPDEST PUSH2 0x10E0 PUSH1 0x80 DUP4 ADD DUP5 PUSH2 0x22E8 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x7BD DUP3 DUP5 PUSH2 0x232E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x24D1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x24F0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 SWAP1 DUP2 MUL ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x2511 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 0xd9 DELEGATECALL XOR CALL 0x1e 0xf SWAP2 CREATE PUSH16 0x6F9D22924BE0ADD925495EEB76A6388B SLOAD OR 0xad 0xb5 SDIV 0xee 0xb3 PUSH13 0x6578706572696D656E74616CF5 STOP CALLDATACOPY ",
+ "sourceMap": "836:407:4:-;;;963:278;8:9:-1;5:2;;;30:1;27;20:12;5:2;963:278:4;;;;;;;;;;;;;;;;;;;;;;;;1348:20:7;162:18:82;;170:10;-1:-1:-1;;;;;;162:18:82;;;;;;-1:-1:-1;1795:31:11;;;;;-1:-1:-1;;;;;1795:31:11;;;;;1836:30;;1795:31;;1836:30;;1181:14:4;;1348:20:7;;;;1836:30:11;;:14;;:30;;;;;:::i;:::-;-1:-1:-1;1876:32:11;;;;:15;;:32;;;;;:::i;:::-;-1:-1:-1;1940:30:11;:14;1967:2;1940:26;;;;;;:30;:::i;:::-;1919:51;-1:-1:-1;1999:29:11;:13;2025:2;1999:25;;;;;;:29;:::i;:::-;2038:11;:37;;-1:-1:-1;;;;;2038:37:11;;;-1:-1:-1;;;;;;2038:37:11;;;;;;;2085:9;:33;;;;;;;;;;;;;;;-1:-1:-1;2038:37:11;1371:8:7;930:32:11;;;;;;;;;;;;;;;;1371:37:7;;;:8;;;;;-1:-1:-1;1371:22:7;;-1:-1:-1;1371:37:7;;-1:-1:-1;930:32:11;1371:37:7;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1371:37:7;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1371:37:7;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;1371:37:7;;;;;;;;;1348:60;-1:-1:-1;;;;;;1439:26:7;;;;1418:97;;;;;;;;;;;;;;;;;;;;;;1525:11;;:43;;;;;-1:-1:-1;;;;;1525:11:7;;;;:19;;:43;;1545:12;;-1:-1:-1;;1103:10:11;1525:43:7;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1525:43:7;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1525:43:7;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;1525:43:7;;;;;;;;;-1:-1:-1;1578:9:7;;:41;;;;;-1:-1:-1;;;;;1578:9:7;;;;:17;;:41;;1596:12;;-1:-1:-1;;1103:10:11;1578:41:7;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1578:41:7;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1578:41:7;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;1578:41:7;;;;;;;;;;1304:322;963:278:4;;;836:407;;10268:886:80;10389:14;10452:5;10460:2;10452:10;10440:1;:8;:22;;10419:135;;;;;;;;;;;;;;;;-1:-1:-1;10801:2:80;11056:13;;;;;11050:20;10792:11;;;-1:-1:-1;;;;;11046:69:80;10268:886;;;;;:::o;836:407:4:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;836:407:4;;;-1:-1:-1;836:407:4;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;5:122:-1:-;;83:39;114:6;108:13;83:39;;;74:48;68:59;-1:-1;;;68:59;134:116;;209:36;237:6;231:13;209:36;;258:442;;363:4;351:17;;347:27;-1:-1;337:2;;388:1;385;378:12;337:2;418:6;412:13;440:64;455:48;496:6;455:48;;;440:64;;;431:73;;524:6;517:5;510:21;560:4;552:6;548:17;593:4;586:5;582:16;628:3;619:6;614:3;610:16;607:25;604:2;;;645:1;642;635:12;604:2;655:39;687:6;682:3;677;655:39;;;330:370;;;;;;;;708:263;;823:2;811:9;802:7;798:23;794:32;791:2;;;839:1;836;829:12;791:2;874:1;891:64;947:7;927:9;891:64;;;881:74;785:186;-1:-1;;;;785:186;978:729;;;;1145:2;1133:9;1124:7;1120:23;1116:32;1113:2;;;1161:1;1158;1151:12;1113:2;1196:1;1213:64;1269:7;1249:9;1213:64;;;1203:74;;1175:108;1335:2;1324:9;1320:18;1314:25;-1:-1;;;;;1351:6;1348:30;1345:2;;;1391:1;1388;1381:12;1345:2;1411:73;1476:7;1467:6;1456:9;1452:22;1411:73;;;1401:83;;1293:197;1542:2;1531:9;1527:18;1521:25;-1:-1;;;;;1558:6;1555:30;1552:2;;;1598:1;1595;1588:12;1552:2;1618:73;1683:7;1674:6;1663:9;1659:22;1618:73;;;1608:83;;1500:197;1107:600;;;;;;1714:257;;1826:2;1814:9;1805:7;1801:23;1797:32;1794:2;;;1842:1;1839;1832:12;1794:2;1877:1;1894:61;1947:7;1927:9;1894:61;;1978:110;2051:31;2076:5;2051:31;;;2046:3;2039:44;2033:55;;;2095:107;2166:30;2190:5;2166:30;;2210:397;2365:2;2353:15;;2402:66;2397:2;2388:12;;2381:88;2503:66;2498:2;2489:12;;2482:88;2598:2;2589:12;;2346:261;2616:296;2771:2;2759:15;;2808:66;2803:2;2794:12;;2787:88;2903:2;2894:12;;2752:160;2920:110;2993:31;3018:5;2993:31;;3037:294;3173:2;3158:18;;3187:61;3162:9;3221:6;3187:61;;;3259:62;3317:2;3306:9;3302:18;3293:6;3259:62;;3338:189;3444:2;3429:18;;3458:59;3433:9;3490:6;3458:59;;3534:387;3715:2;3729:47;;;3700:18;;3790:121;3700:18;3790:121;;3928:387;4109:2;4123:47;;;4094:18;;4184:121;4094:18;4184:121;;4322:256;4384:2;4378:9;4410:17;;;-1:-1;;;;;4470:34;;4506:22;;;4467:62;4464:2;;;4542:1;4539;4532:12;4464:2;4558;4551:22;4362:216;;-1:-1;4362:216;4585:258;;-1:-1;;;;;4720:6;4717:30;4714:2;;;4760:1;4757;4750:12;4714:2;-1:-1;4833:4;4804;4781:17;;;;-1:-1;;4777:33;4823:15;;4651:192;4850:128;-1:-1;;;;;4919:54;;4902:76;4985:151;5064:66;5053:78;;5036:100;5364:92;5437:13;5430:21;;5413:43;5464:268;5529:1;5536:101;5550:6;5547:1;5544:13;5536:101;;;5617:11;;;5611:18;5598:11;;;5591:39;5572:2;5565:10;5536:101;;;5652:6;5649:1;5646:13;5643:2;;;5717:1;5708:6;5703:3;5699:16;5692:27;5643:2;5513:219;;;;;;836:407:4;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526004361061006c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166318978e8281146100c8578063630f1e6c146100f25780638da5cb5b146101125780639395525c14610134578063f2fde38b14610147575b60025473ffffffffffffffffffffffffffffffffffffffff1633146100c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612388565b60405180910390fd5b005b6100db6100d6366004611df1565b610167565b6040516100e9929190612488565b60405180910390f35b3480156100fe57600080fd5b506100c661010d366004611eec565b6102f7565b34801561011e57600080fd5b50610127610388565b6040516100e99190612337565b6100db610142366004611d0b565b6103a4565b34801561015357600080fd5b506100c6610162366004611ce5565b61050a565b61016f6119fa565b6101776119fa565b6000806101826105bb565b60048054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100600188161502019095169490940493840181900481028201810190925282815261025c939092909183018282801561022d5780601f106102025761010080835404028352916020019161022d565b820191906000526020600020905b81548152906001019060200180831161021057829003601f168201915b50505050508c600081518110151561024157fe5b6020908102909101015161014001519063ffffffff61069616565b156102875761026c8b8b8b6107c3565b935061028084600001518560600151610ac1565b90506102ae565b6102928b8b8b610b03565b9350836060015191506102a68883896107c3565b845190935090505b6102c2846020015184602001518888610d15565b6102e98b60008151811015156102d457fe5b90602001906020020151610140015182610f29565b505097509795505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610348576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612438565b61038383838080601f01602080910402602001604051908101604052809392919081815260200183838082843750879450610f299350505050565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6103ac6119fa565b6103b46119fa565b60008060006103c16105bb565b60048054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001881615020190951694909404938401819004810282018101909252828152610441939092909183018282801561022d5780601f106102025761010080835404028352916020019161022d565b156104925761046a670de0b6b3a7640000610464670de0b6b3a76400008a611045565b3461108f565b92506104778b848c6110e7565b945061048b85600001518660600151610ac1565b90506104d6565b6104ad670d2f13f7789f0000670de0b6b3a76400003461108f565b92506104ba8b848c6110e7565b9450846060015191506104ce89838a6107c3565b855190945090505b6104ea856020015185602001518989610d15565b6104fc8b60008151811015156102d457fe5b505050965096945050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461055b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612438565b73ffffffffffffffffffffffffffffffffffffffff8116156105b857600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b600034116105f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612398565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016000604051808303818588803b15801561067b57600080fd5b505af115801561068f573d6000803e3d6000fd5b5050505050565b6000815183511480156107ba5750816040518082805190602001908083835b602083106106f257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016106b5565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052604051919093018190038120885190955088945090928392508401908083835b6020831061078757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161074a565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916145b90505b92915050565b6107cb6119fa565b60608060008060008060006107de6119fa565b8a15156107ea57610ab2565b6004805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561088e5780601f106108635761010080835404028352916020019161088e565b820191906000526020600020905b81548152906001019060200180831161087157829003601f168201915b505060058054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101006001881615020190951694909404938401819004810282018101909252828152969e509194509250840190508282801561093d5780601f106109125761010080835404028352916020019161093d565b820191906000526020600020905b81548152906001019060200180831161092057829003601f168201915b50505050509650600095508b519450600093505b838514610a7857878c8581518110151561096757fe5b6020908102909101015161014001528b5187908d908690811061098657fe5b60209081029091010151610160015261099f8b87610ac1565b9250610a068c858151811015156109b257fe5b9060200190602002015160a00151610a008e878151811015156109d157fe5b90602001906020020151608001518f888151811015156109ed57fe5b9060200190602002015160e00151610ac1565b8561128b565b9150610a418c85815181101515610a1957fe5b90602001906020020151838c87815181101515610a3257fe5b906020019060200201516112e6565b9050610a4d898261135e565b610a5f89600001518a60600151610ac1565b95508a8610610a6d57610a78565b600190930192610951565b8a861015610ab2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612418565b50505050505050509392505050565b600082821115610afd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123b8565b50900390565b610b0b6119fa565b606080600080600080610b1c6119fa565b60008b6000815181101515610b2d57fe5b6020908102919091018101516101400151600580546040805160026001841615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190931692909204601f8101869004860283018601909152808252929b5092909190830182828015610be55780601f10610bba57610100808354040283529160200191610be5565b820191906000526020600020905b815481529060010190602001808311610bc857829003601f168201915b505050505096508b519550600094505b848614610cdb57878c86815181101515610c0b57fe5b6020908102909101015161014001528b5187908d9087908110610c2a57fe5b6020908102909101015161016001528851610c46908c90610ac1565b9350610c898c86815181101515610c5957fe5b9060200190602002015160a001518d87815181101515610c7557fe5b90602001906020020151608001518661128b565b9250610cb58c86815181101515610c9c57fe5b90602001906020020151848c88815181101515610a3257fe5b9150610cc1898361135e565b5087518a8110610cd057610cdb565b600190940193610bf5565b8a811015610ab2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612418565b600080808066b1a2bc2ec50000861115610d5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612448565b610d658888611045565b935034841115610da1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123a8565b610dab3485610ac1565b9250610dc086670de0b6b3a76400008a61108f565b915082821115610dfc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612428565b6000831115610f1f576002546040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90610e5b9086906004016124a4565b600060405180830381600087803b158015610e7557600080fd5b505af1158015610e89573d6000803e3d6000fd5b505050506000821115610edb5760405173ffffffffffffffffffffffffffffffffffffffff86169083156108fc029084906000818181858888f19350505050158015610ed9573d6000803e3d6000fd5b505b610ee58383610ac1565b90506000811115610f1f57604051339082156108fc029083906000818181858888f19350505050158015610f1d573d6000803e3d6000fd5b505b5050505050505050565b6000610f3b838263ffffffff6113c016565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190209091507fffffffff0000000000000000000000000000000000000000000000000000000080831691161415610fab57610fa6838361142d565b610383565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190207fffffffff000000000000000000000000000000000000000000000000000000008281169116141561101357610fa6838361161b565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123f8565b600082820183811015611084576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123e8565b8091505b5092915050565b60008083116110ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123d8565b6110dd6110d78584611703565b8461175e565b90505b9392505050565b6110ef6119fa565b60608060008060006110ff6119fa565b89600081518110151561110e57fe5b6020908102919091018101516101400151600580546040805160026001841615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190931692909204601f8101869004860283018601909152808252929950929091908301828280156111c65780601f1061119b576101008083540402835291602001916111c6565b820191906000526020600020905b8154815290600101906020018083116111a957829003601f168201915b5050505050945089519350600092505b82841461127e57858a848151811015156111ec57fe5b602090810290910101516101400152895185908b908590811061120b57fe5b90602001906020020151610160018190525061122b898860200151610ac1565b91506112578a8481518110151561123e57fe5b90602001906020020151838a86815181101515610a3257fe5b9050611263878261135e565b602087015189116112735761127e565b6001909201916111d6565b5050505050509392505050565b60008083116112c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123d8565b6110dd6110d76112d68685611703565b6112e1866001610ac1565b611045565b6112ee6119fa565b606060006112fd868686611775565b600154815191935073ffffffffffffffffffffffffffffffffffffffff1691506080908390602082016000855af1801561135457825184526020830151602085015260408301516040850152606083015160608501525b5050509392505050565b8151815161136c9190611045565b8252602080830151908201516113829190611045565b60208301526040808301519082015161139b9190611045565b6040830152606080830151908201516113b49190611045565b60609092019190915250565b600081600401835110151515611402576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612468565b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b60008061144184601063ffffffff61194716565b604080517f7472616e7366657228616464726573732c75696e7432353629000000000000008152905190819003601901812091935073ffffffffffffffffffffffffffffffffffffffff8416919061149f903390879060240161236d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931783525181519192909182919080838360005b8381101561154357818101518382015260200161152b565b50505050905090810190601f1680156115705780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af1925050508015156115bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612408565b3d156115dc575060003d602014156115dc5760206000803e506000515b801515611615576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612408565b50505050565b60008060018314611658576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612478565b61166984601063ffffffff61194716565b915061167c84602463ffffffff6119a816565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff8316906323b872dd906116d590309033908690600401612345565b600060405180830381600087803b1580156116ef57600080fd5b505af1158015610f1f573d6000803e3d6000fd5b6000808315156117165760009150611088565b5082820282848281151561172657fe5b0414611084576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123e8565b600080828481151561176c57fe5b04949350505050565b604080517fb4be83d5000000000000000000000000000000000000000000000000000000006020808301919091526060602483018181528751608485019081528884015160a48601529488015160c48501529087015160e4840152608087015161010484015260a087015161012484015260c087015161014484015260e08701516101648401526101008701516101848401526101208701516101a4840152610140870180516101c485019081526101608901516101e4860152610180905251805161020485018190529394919384936044870192849261022489019291820191601f82010460005b8181101561187c57835185526020948501949093019260010161185e565b50505050818103610160808401919091528a0151805180835260209283019291820191601f82010460005b818110156118c55783518552602094850194909301926001016118a7565b50505089845250848103602093840190815288518083529093918201918981019190601f82010460005b8181101561190d5783518552602094850194909301926001016118ef565b5050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08883030188525060405250505050509392505050565b600081601401835110151515611989576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd90612458565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b60006107ba83836000816020018351101515156119f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100bd906123c8565b50016020015190565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b60006107ba8235612540565b6000601f82018313611a4057600080fd5b8135611a53611a4e826124d9565b6124b2565b81815260209384019390925082018360005b83811015611a915781358601611a7b8882611b41565b8452506020928301929190910190600101611a65565b5050505092915050565b6000601f82018313611aac57600080fd5b8135611aba611a4e826124d9565b81815260209384019390925082018360005b83811015611a915781358601611ae28882611b90565b8452506020928301929190910190600101611acc565b600080601f83018413611b0a57600080fd5b50813567ffffffffffffffff811115611b2257600080fd5b602083019150836001820283011115611b3a57600080fd5b9250929050565b6000601f82018313611b5257600080fd5b8135611b60611a4e826124fa565b91508082526020830160208301858383011115611b7c57600080fd5b611b8783828461255c565b50505092915050565b60006101808284031215611ba357600080fd5b611bae6101806124b2565b90506000611bbc8484611a23565b8252506020611bcd84848301611a23565b6020830152506040611be184828501611a23565b6040830152506060611bf584828501611a23565b6060830152506080611c0984828501611cd9565b60808301525060a0611c1d84828501611cd9565b60a08301525060c0611c3184828501611cd9565b60c08301525060e0611c4584828501611cd9565b60e083015250610100611c5a84828501611cd9565b61010083015250610120611c7084828501611cd9565b6101208301525061014082013567ffffffffffffffff811115611c9257600080fd5b611c9e84828501611b41565b6101408301525061016082013567ffffffffffffffff811115611cc057600080fd5b611ccc84828501611b41565b6101608301525092915050565b60006107ba8235612559565b600060208284031215611cf757600080fd5b6000611d038484611a23565b949350505050565b60008060008060008060c08789031215611d2457600080fd5b863567ffffffffffffffff811115611d3b57600080fd5b611d4789828a01611a9b565b965050602087013567ffffffffffffffff811115611d6457600080fd5b611d7089828a01611a2f565b955050604087013567ffffffffffffffff811115611d8d57600080fd5b611d9989828a01611a9b565b945050606087013567ffffffffffffffff811115611db657600080fd5b611dc289828a01611a2f565b9350506080611dd389828a01611cd9565b92505060a0611de489828a01611a23565b9150509295509295509295565b600080600080600080600060e0888a031215611e0c57600080fd5b873567ffffffffffffffff811115611e2357600080fd5b611e2f8a828b01611a9b565b9750506020611e408a828b01611cd9565b965050604088013567ffffffffffffffff811115611e5d57600080fd5b611e698a828b01611a2f565b955050606088013567ffffffffffffffff811115611e8657600080fd5b611e928a828b01611a9b565b945050608088013567ffffffffffffffff811115611eaf57600080fd5b611ebb8a828b01611a2f565b93505060a0611ecc8a828b01611cd9565b92505060c0611edd8a828b01611a23565b91505092959891949750929550565b600080600060408486031215611f0157600080fd5b833567ffffffffffffffff811115611f1857600080fd5b611f2486828701611af8565b93509350506020611f3786828701611cd9565b9150509250925092565b611f4a81612540565b82525050565b602381527f44454641554c545f46554e4354494f4e5f574554485f434f4e54524143545f4f60208201527f4e4c590000000000000000000000000000000000000000000000000000000000604082015260600190565b601181527f494e56414c49445f4d53475f56414c5545000000000000000000000000000000602082015260400190565b600d81527f4f564552534f4c445f5745544800000000000000000000000000000000000000602082015260400190565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601081527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b601781527f554e535550504f525445445f41535345545f50524f5859000000000000000000602082015260400190565b600f81527f5452414e534645525f4641494c45440000000000000000000000000000000000602082015260400190565b601481527f434f4d504c4554455f46494c4c5f4641494c4544000000000000000000000000602082015260400190565b601a81527f494e53554646494349454e545f4554485f52454d41494e494e47000000000000602082015260400190565b601381527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000602082015260400190565b601881527f4645455f50455243454e544147455f544f4f5f4c415247450000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b602581527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160208201527f5549524544000000000000000000000000000000000000000000000000000000604082015260600190565b600e81527f494e56414c49445f414d4f554e54000000000000000000000000000000000000602082015260400190565b805160808301906122f9848261232e565b50602082015161230c602085018261232e565b50604082015161231f604085018261232e565b50606082015161161560608501825b611f4a81612559565b602081016107bd8284611f41565b606081016123538286611f41565b6123606020830185611f41565b611d03604083018461232e565b6040810161237b8285611f41565b6110e0602083018461232e565b602080825281016107bd81611f50565b602080825281016107bd81611fa6565b602080825281016107bd81611fd6565b602080825281016107bd81612006565b602080825281016107bd81612036565b602080825281016107bd8161208c565b602080825281016107bd816120bc565b602080825281016107bd816120ec565b602080825281016107bd8161211c565b602080825281016107bd8161214c565b602080825281016107bd8161217c565b602080825281016107bd816121ac565b602080825281016107bd816121dc565b602080825281016107bd8161220c565b602080825281016107bd81612262565b602080825281016107bd816122b8565b610100810161249782856122e8565b6110e060808301846122e8565b602081016107bd828461232e565b60405181810167ffffffffffffffff811182821017156124d157600080fd5b604052919050565b600067ffffffffffffffff8211156124f057600080fd5b5060209081020190565b600067ffffffffffffffff82111561251157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b828183375060009101525600a265627a7a72305820d9f418f11e0f91f06f6f9d22924be0add925495eeb76a6388b5417adb505eeb36c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x6C JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x18978E82 DUP2 EQ PUSH2 0xC8 JUMPI DUP1 PUSH4 0x630F1E6C EQ PUSH2 0xF2 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x112 JUMPI DUP1 PUSH4 0x9395525C EQ PUSH2 0x134 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x147 JUMPI JUMPDEST PUSH1 0x2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xC6 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2388 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST STOP JUMPDEST PUSH2 0xDB PUSH2 0xD6 CALLDATASIZE PUSH1 0x4 PUSH2 0x1DF1 JUMP JUMPDEST PUSH2 0x167 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xE9 SWAP3 SWAP2 SWAP1 PUSH2 0x2488 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xFE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC6 PUSH2 0x10D CALLDATASIZE PUSH1 0x4 PUSH2 0x1EEC JUMP JUMPDEST PUSH2 0x2F7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x11E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x127 PUSH2 0x388 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xE9 SWAP2 SWAP1 PUSH2 0x2337 JUMP JUMPDEST PUSH2 0xDB PUSH2 0x142 CALLDATASIZE PUSH1 0x4 PUSH2 0x1D0B JUMP JUMPDEST PUSH2 0x3A4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x153 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC6 PUSH2 0x162 CALLDATASIZE PUSH1 0x4 PUSH2 0x1CE5 JUMP JUMPDEST PUSH2 0x50A JUMP JUMPDEST PUSH2 0x16F PUSH2 0x19FA JUMP JUMPDEST PUSH2 0x177 PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x182 PUSH2 0x5BB JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP9 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH2 0x25C SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x22D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x202 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x22D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x210 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP13 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x241 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MLOAD SWAP1 PUSH4 0xFFFFFFFF PUSH2 0x696 AND JUMP JUMPDEST ISZERO PUSH2 0x287 JUMPI PUSH2 0x26C DUP12 DUP12 DUP12 PUSH2 0x7C3 JUMP JUMPDEST SWAP4 POP PUSH2 0x280 DUP5 PUSH1 0x0 ADD MLOAD DUP6 PUSH1 0x60 ADD MLOAD PUSH2 0xAC1 JUMP JUMPDEST SWAP1 POP PUSH2 0x2AE JUMP JUMPDEST PUSH2 0x292 DUP12 DUP12 DUP12 PUSH2 0xB03 JUMP JUMPDEST SWAP4 POP DUP4 PUSH1 0x60 ADD MLOAD SWAP2 POP PUSH2 0x2A6 DUP9 DUP4 DUP10 PUSH2 0x7C3 JUMP JUMPDEST DUP5 MLOAD SWAP1 SWAP4 POP SWAP1 POP JUMPDEST PUSH2 0x2C2 DUP5 PUSH1 0x20 ADD MLOAD DUP5 PUSH1 0x20 ADD MLOAD DUP9 DUP9 PUSH2 0xD15 JUMP JUMPDEST PUSH2 0x2E9 DUP12 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2D4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x140 ADD MLOAD DUP3 PUSH2 0xF29 JUMP JUMPDEST POP POP SWAP8 POP SWAP8 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x348 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2438 JUMP JUMPDEST PUSH2 0x383 DUP4 DUP4 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP DUP8 SWAP5 POP PUSH2 0xF29 SWAP4 POP POP POP POP JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH2 0x3AC PUSH2 0x19FA JUMP JUMPDEST PUSH2 0x3B4 PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x3C1 PUSH2 0x5BB JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP9 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH2 0x441 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x22D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x202 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x22D JUMP JUMPDEST ISZERO PUSH2 0x492 JUMPI PUSH2 0x46A PUSH8 0xDE0B6B3A7640000 PUSH2 0x464 PUSH8 0xDE0B6B3A7640000 DUP11 PUSH2 0x1045 JUMP JUMPDEST CALLVALUE PUSH2 0x108F JUMP JUMPDEST SWAP3 POP PUSH2 0x477 DUP12 DUP5 DUP13 PUSH2 0x10E7 JUMP JUMPDEST SWAP5 POP PUSH2 0x48B DUP6 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x60 ADD MLOAD PUSH2 0xAC1 JUMP JUMPDEST SWAP1 POP PUSH2 0x4D6 JUMP JUMPDEST PUSH2 0x4AD PUSH8 0xD2F13F7789F0000 PUSH8 0xDE0B6B3A7640000 CALLVALUE PUSH2 0x108F JUMP JUMPDEST SWAP3 POP PUSH2 0x4BA DUP12 DUP5 DUP13 PUSH2 0x10E7 JUMP JUMPDEST SWAP5 POP DUP5 PUSH1 0x60 ADD MLOAD SWAP2 POP PUSH2 0x4CE DUP10 DUP4 DUP11 PUSH2 0x7C3 JUMP JUMPDEST DUP6 MLOAD SWAP1 SWAP5 POP SWAP1 POP JUMPDEST PUSH2 0x4EA DUP6 PUSH1 0x20 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD DUP10 DUP10 PUSH2 0xD15 JUMP JUMPDEST PUSH2 0x4FC DUP12 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2D4 JUMPI INVALID JUMPDEST POP POP POP SWAP7 POP SWAP7 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x55B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2438 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x5B8 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 CALLVALUE GT PUSH2 0x5F5 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2398 JUMP JUMPDEST PUSH1 0x2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xD0E30DB0 CALLVALUE PUSH1 0x40 MLOAD DUP3 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP9 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x67B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x68F JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD DUP4 MLOAD EQ DUP1 ISZERO PUSH2 0x7BA JUMPI POP DUP2 PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x6F2 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x6B5 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP9 MLOAD SWAP1 SWAP6 POP DUP9 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x787 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x74A JUMP JUMPDEST PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP3 MLOAD AND DUP2 DUP5 MLOAD AND DUP1 DUP3 OR DUP6 MSTORE POP POP POP POP POP POP SWAP1 POP ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 PUSH1 0x0 NOT AND EQ JUMPDEST SWAP1 POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x7CB PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x7DE PUSH2 0x19FA JUMP JUMPDEST DUP11 ISZERO ISZERO PUSH2 0x7EA JUMPI PUSH2 0xAB2 JUMP JUMPDEST PUSH1 0x4 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x88E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x863 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x88E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x871 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP9 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE SWAP7 SWAP15 POP SWAP2 SWAP5 POP SWAP3 POP DUP5 ADD SWAP1 POP DUP3 DUP3 DUP1 ISZERO PUSH2 0x93D JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x912 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x93D JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x920 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP7 POP PUSH1 0x0 SWAP6 POP DUP12 MLOAD SWAP5 POP PUSH1 0x0 SWAP4 POP JUMPDEST DUP4 DUP6 EQ PUSH2 0xA78 JUMPI DUP8 DUP13 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x967 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP12 MLOAD DUP8 SWAP1 DUP14 SWAP1 DUP7 SWAP1 DUP2 LT PUSH2 0x986 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x160 ADD MSTORE PUSH2 0x99F DUP12 DUP8 PUSH2 0xAC1 JUMP JUMPDEST SWAP3 POP PUSH2 0xA06 DUP13 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x9B2 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0xA0 ADD MLOAD PUSH2 0xA00 DUP15 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x9D1 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x80 ADD MLOAD DUP16 DUP9 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x9ED JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0xE0 ADD MLOAD PUSH2 0xAC1 JUMP JUMPDEST DUP6 PUSH2 0x128B JUMP JUMPDEST SWAP2 POP PUSH2 0xA41 DUP13 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA19 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP13 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA32 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x12E6 JUMP JUMPDEST SWAP1 POP PUSH2 0xA4D DUP10 DUP3 PUSH2 0x135E JUMP JUMPDEST PUSH2 0xA5F DUP10 PUSH1 0x0 ADD MLOAD DUP11 PUSH1 0x60 ADD MLOAD PUSH2 0xAC1 JUMP JUMPDEST SWAP6 POP DUP11 DUP7 LT PUSH2 0xA6D JUMPI PUSH2 0xA78 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP4 ADD SWAP3 PUSH2 0x951 JUMP JUMPDEST DUP11 DUP7 LT ISZERO PUSH2 0xAB2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2418 JUMP JUMPDEST POP POP POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xAFD JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23B8 JUMP JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH2 0xB0B PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0xB1C PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x0 DUP12 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xB2D JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH2 0x140 ADD MLOAD PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x2 PUSH1 0x1 DUP5 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 DIV PUSH1 0x1F DUP2 ADD DUP7 SWAP1 DIV DUP7 MUL DUP4 ADD DUP7 ADD SWAP1 SWAP2 MSTORE DUP1 DUP3 MSTORE SWAP3 SWAP12 POP SWAP3 SWAP1 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xBE5 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xBBA JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xBE5 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xBC8 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP7 POP DUP12 MLOAD SWAP6 POP PUSH1 0x0 SWAP5 POP JUMPDEST DUP5 DUP7 EQ PUSH2 0xCDB JUMPI DUP8 DUP13 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC0B JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP12 MLOAD DUP8 SWAP1 DUP14 SWAP1 DUP8 SWAP1 DUP2 LT PUSH2 0xC2A JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x160 ADD MSTORE DUP9 MLOAD PUSH2 0xC46 SWAP1 DUP13 SWAP1 PUSH2 0xAC1 JUMP JUMPDEST SWAP4 POP PUSH2 0xC89 DUP13 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC59 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0xA0 ADD MLOAD DUP14 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC75 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x80 ADD MLOAD DUP7 PUSH2 0x128B JUMP JUMPDEST SWAP3 POP PUSH2 0xCB5 DUP13 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xC9C JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP13 DUP9 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA32 JUMPI INVALID JUMPDEST SWAP2 POP PUSH2 0xCC1 DUP10 DUP4 PUSH2 0x135E JUMP JUMPDEST POP DUP8 MLOAD DUP11 DUP2 LT PUSH2 0xCD0 JUMPI PUSH2 0xCDB JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP5 ADD SWAP4 PUSH2 0xBF5 JUMP JUMPDEST DUP11 DUP2 LT ISZERO PUSH2 0xAB2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2418 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP1 PUSH7 0xB1A2BC2EC50000 DUP7 GT ISZERO PUSH2 0xD5B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2448 JUMP JUMPDEST PUSH2 0xD65 DUP9 DUP9 PUSH2 0x1045 JUMP JUMPDEST SWAP4 POP CALLVALUE DUP5 GT ISZERO PUSH2 0xDA1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23A8 JUMP JUMPDEST PUSH2 0xDAB CALLVALUE DUP6 PUSH2 0xAC1 JUMP JUMPDEST SWAP3 POP PUSH2 0xDC0 DUP7 PUSH8 0xDE0B6B3A7640000 DUP11 PUSH2 0x108F JUMP JUMPDEST SWAP2 POP DUP3 DUP3 GT ISZERO PUSH2 0xDFC JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2428 JUMP JUMPDEST PUSH1 0x0 DUP4 GT ISZERO PUSH2 0xF1F JUMPI PUSH1 0x2 SLOAD PUSH1 0x40 MLOAD PUSH32 0x2E1A7D4D00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0x2E1A7D4D SWAP1 PUSH2 0xE5B SWAP1 DUP7 SWAP1 PUSH1 0x4 ADD PUSH2 0x24A4 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0xE75 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xE89 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x0 DUP3 GT ISZERO PUSH2 0xEDB JUMPI PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 DUP4 ISZERO PUSH2 0x8FC MUL SWAP1 DUP5 SWAP1 PUSH1 0x0 DUP2 DUP2 DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0xED9 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP JUMPDEST PUSH2 0xEE5 DUP4 DUP4 PUSH2 0xAC1 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 DUP2 GT ISZERO PUSH2 0xF1F JUMPI PUSH1 0x40 MLOAD CALLER SWAP1 DUP3 ISZERO PUSH2 0x8FC MUL SWAP1 DUP4 SWAP1 PUSH1 0x0 DUP2 DUP2 DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0xF1D JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP JUMPDEST POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xF3B DUP4 DUP3 PUSH4 0xFFFFFFFF PUSH2 0x13C0 AND JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD SWAP1 KECCAK256 SWAP1 SWAP2 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP1 DUP4 AND SWAP2 AND EQ ISZERO PUSH2 0xFAB JUMPI PUSH2 0xFA6 DUP4 DUP4 PUSH2 0x142D JUMP JUMPDEST PUSH2 0x383 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x455243373231546F6B656E28616464726573732C75696E743235362900000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x1C ADD SWAP1 KECCAK256 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP3 DUP2 AND SWAP2 AND EQ ISZERO PUSH2 0x1013 JUMPI PUSH2 0xFA6 DUP4 DUP4 PUSH2 0x161B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23F8 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x1084 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23E8 JUMP JUMPDEST DUP1 SWAP2 POP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x10CA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23D8 JUMP JUMPDEST PUSH2 0x10DD PUSH2 0x10D7 DUP6 DUP5 PUSH2 0x1703 JUMP JUMPDEST DUP5 PUSH2 0x175E JUMP JUMPDEST SWAP1 POP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x10EF PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x10FF PUSH2 0x19FA JUMP JUMPDEST DUP10 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x110E JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH2 0x140 ADD MLOAD PUSH1 0x5 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x2 PUSH1 0x1 DUP5 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 DIV PUSH1 0x1F DUP2 ADD DUP7 SWAP1 DIV DUP7 MUL DUP4 ADD DUP7 ADD SWAP1 SWAP2 MSTORE DUP1 DUP3 MSTORE SWAP3 SWAP10 POP SWAP3 SWAP1 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x11C6 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x119B JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x11C6 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x11A9 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP5 POP DUP10 MLOAD SWAP4 POP PUSH1 0x0 SWAP3 POP JUMPDEST DUP3 DUP5 EQ PUSH2 0x127E JUMPI DUP6 DUP11 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x11EC JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP10 MLOAD DUP6 SWAP1 DUP12 SWAP1 DUP6 SWAP1 DUP2 LT PUSH2 0x120B JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD DUP2 SWAP1 MSTORE POP PUSH2 0x122B DUP10 DUP9 PUSH1 0x20 ADD MLOAD PUSH2 0xAC1 JUMP JUMPDEST SWAP2 POP PUSH2 0x1257 DUP11 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x123E JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP11 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA32 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x1263 DUP8 DUP3 PUSH2 0x135E JUMP JUMPDEST PUSH1 0x20 DUP8 ADD MLOAD DUP10 GT PUSH2 0x1273 JUMPI PUSH2 0x127E JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x11D6 JUMP JUMPDEST POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x12C6 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23D8 JUMP JUMPDEST PUSH2 0x10DD PUSH2 0x10D7 PUSH2 0x12D6 DUP7 DUP6 PUSH2 0x1703 JUMP JUMPDEST PUSH2 0x12E1 DUP7 PUSH1 0x1 PUSH2 0xAC1 JUMP JUMPDEST PUSH2 0x1045 JUMP JUMPDEST PUSH2 0x12EE PUSH2 0x19FA JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH2 0x12FD DUP7 DUP7 DUP7 PUSH2 0x1775 JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 MLOAD SWAP2 SWAP4 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 POP PUSH1 0x80 SWAP1 DUP4 SWAP1 PUSH1 0x20 DUP3 ADD PUSH1 0x0 DUP6 GAS CALL DUP1 ISZERO PUSH2 0x1354 JUMPI DUP3 MLOAD DUP5 MSTORE PUSH1 0x20 DUP4 ADD MLOAD PUSH1 0x20 DUP6 ADD MSTORE PUSH1 0x40 DUP4 ADD MLOAD PUSH1 0x40 DUP6 ADD MSTORE PUSH1 0x60 DUP4 ADD MLOAD PUSH1 0x60 DUP6 ADD MSTORE JUMPDEST POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP2 MLOAD DUP2 MLOAD PUSH2 0x136C SWAP2 SWAP1 PUSH2 0x1045 JUMP JUMPDEST DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x1382 SWAP2 SWAP1 PUSH2 0x1045 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE PUSH1 0x40 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x139B SWAP2 SWAP1 PUSH2 0x1045 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE PUSH1 0x60 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x13B4 SWAP2 SWAP1 PUSH2 0x1045 JUMP JUMPDEST PUSH1 0x60 SWAP1 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x4 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1402 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2468 JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x1441 DUP5 PUSH1 0x10 PUSH4 0xFFFFFFFF PUSH2 0x1947 AND JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x7472616E7366657228616464726573732C75696E743235362900000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x19 ADD DUP2 KECCAK256 SWAP2 SWAP4 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP2 SWAP1 PUSH2 0x149F SWAP1 CALLER SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x236D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 MSTORE MLOAD DUP2 MLOAD SWAP2 SWAP3 SWAP1 SWAP2 DUP3 SWAP2 SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1543 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x152B JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x1570 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP2 POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP7 GAS CALL SWAP3 POP POP POP DUP1 ISZERO ISZERO PUSH2 0x15BF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2408 JUMP JUMPDEST RETURNDATASIZE ISZERO PUSH2 0x15DC JUMPI POP PUSH1 0x0 RETURNDATASIZE PUSH1 0x20 EQ ISZERO PUSH2 0x15DC JUMPI PUSH1 0x20 PUSH1 0x0 DUP1 RETURNDATACOPY POP PUSH1 0x0 MLOAD JUMPDEST DUP1 ISZERO ISZERO PUSH2 0x1615 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2408 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1 DUP4 EQ PUSH2 0x1658 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2478 JUMP JUMPDEST PUSH2 0x1669 DUP5 PUSH1 0x10 PUSH4 0xFFFFFFFF PUSH2 0x1947 AND JUMP JUMPDEST SWAP2 POP PUSH2 0x167C DUP5 PUSH1 0x24 PUSH4 0xFFFFFFFF PUSH2 0x19A8 AND JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x23B872DD00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP2 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND SWAP1 PUSH4 0x23B872DD SWAP1 PUSH2 0x16D5 SWAP1 ADDRESS SWAP1 CALLER SWAP1 DUP7 SWAP1 PUSH1 0x4 ADD PUSH2 0x2345 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x16EF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0xF1F JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP1 DUP4 ISZERO ISZERO PUSH2 0x1716 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x1088 JUMP JUMPDEST POP DUP3 DUP3 MUL DUP3 DUP5 DUP3 DUP2 ISZERO ISZERO PUSH2 0x1726 JUMPI INVALID JUMPDEST DIV EQ PUSH2 0x1084 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23E8 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 DUP5 DUP2 ISZERO ISZERO PUSH2 0x176C JUMPI INVALID JUMPDEST DIV SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x60 PUSH1 0x24 DUP4 ADD DUP2 DUP2 MSTORE DUP8 MLOAD PUSH1 0x84 DUP6 ADD SWAP1 DUP2 MSTORE DUP9 DUP5 ADD MLOAD PUSH1 0xA4 DUP7 ADD MSTORE SWAP5 DUP9 ADD MLOAD PUSH1 0xC4 DUP6 ADD MSTORE SWAP1 DUP8 ADD MLOAD PUSH1 0xE4 DUP5 ADD MSTORE PUSH1 0x80 DUP8 ADD MLOAD PUSH2 0x104 DUP5 ADD MSTORE PUSH1 0xA0 DUP8 ADD MLOAD PUSH2 0x124 DUP5 ADD MSTORE PUSH1 0xC0 DUP8 ADD MLOAD PUSH2 0x144 DUP5 ADD MSTORE PUSH1 0xE0 DUP8 ADD MLOAD PUSH2 0x164 DUP5 ADD MSTORE PUSH2 0x100 DUP8 ADD MLOAD PUSH2 0x184 DUP5 ADD MSTORE PUSH2 0x120 DUP8 ADD MLOAD PUSH2 0x1A4 DUP5 ADD MSTORE PUSH2 0x140 DUP8 ADD DUP1 MLOAD PUSH2 0x1C4 DUP6 ADD SWAP1 DUP2 MSTORE PUSH2 0x160 DUP10 ADD MLOAD PUSH2 0x1E4 DUP7 ADD MSTORE PUSH2 0x180 SWAP1 MSTORE MLOAD DUP1 MLOAD PUSH2 0x204 DUP6 ADD DUP2 SWAP1 MSTORE SWAP4 SWAP5 SWAP2 SWAP4 DUP5 SWAP4 PUSH1 0x44 DUP8 ADD SWAP3 DUP5 SWAP3 PUSH2 0x224 DUP10 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x187C JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x185E JUMP JUMPDEST POP POP POP POP DUP2 DUP2 SUB PUSH2 0x160 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP11 ADD MLOAD DUP1 MLOAD DUP1 DUP4 MSTORE PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x18C5 JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x18A7 JUMP JUMPDEST POP POP POP DUP10 DUP5 MSTORE POP DUP5 DUP2 SUB PUSH1 0x20 SWAP4 DUP5 ADD SWAP1 DUP2 MSTORE DUP9 MLOAD DUP1 DUP4 MSTORE SWAP1 SWAP4 SWAP2 DUP3 ADD SWAP2 DUP10 DUP2 ADD SWAP2 SWAP1 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x190D JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x18EF JUMP JUMPDEST POP POP POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP9 DUP4 SUB ADD DUP9 MSTORE POP PUSH1 0x40 MSTORE POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1989 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x2458 JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7BA DUP4 DUP4 PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x19F1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0xBD SWAP1 PUSH2 0x23C8 JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x80 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7BA DUP3 CALLDATALOAD PUSH2 0x2540 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x1A40 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x1A53 PUSH2 0x1A4E DUP3 PUSH2 0x24D9 JUMP JUMPDEST PUSH2 0x24B2 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1A91 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x1A7B DUP9 DUP3 PUSH2 0x1B41 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x1A65 JUMP JUMPDEST POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x1AAC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x1ABA PUSH2 0x1A4E DUP3 PUSH2 0x24D9 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1A91 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x1AE2 DUP9 DUP3 PUSH2 0x1B90 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x1ACC JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1F DUP4 ADD DUP5 SGT PUSH2 0x1B0A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1B22 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x1 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x1B3A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x1B52 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x1B60 PUSH2 0x1A4E DUP3 PUSH2 0x24FA JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x1B7C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1B87 DUP4 DUP3 DUP5 PUSH2 0x255C JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1BA3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1BAE PUSH2 0x180 PUSH2 0x24B2 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x1BBC DUP5 DUP5 PUSH2 0x1A23 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x1BCD DUP5 DUP5 DUP4 ADD PUSH2 0x1A23 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x1BE1 DUP5 DUP3 DUP6 ADD PUSH2 0x1A23 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x1BF5 DUP5 DUP3 DUP6 ADD PUSH2 0x1A23 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x1C09 DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x1C1D DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x1C31 DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x1C45 DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x1C5A DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x1C70 DUP5 DUP3 DUP6 ADD PUSH2 0x1CD9 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1C92 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1C9E DUP5 DUP3 DUP6 ADD PUSH2 0x1B41 JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1CC0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1CCC DUP5 DUP3 DUP6 ADD PUSH2 0x1B41 JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7BA DUP3 CALLDATALOAD PUSH2 0x2559 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1CF7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1D03 DUP5 DUP5 PUSH2 0x1A23 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0xC0 DUP8 DUP10 SUB SLT ISZERO PUSH2 0x1D24 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP7 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1D3B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1D47 DUP10 DUP3 DUP11 ADD PUSH2 0x1A9B JUMP JUMPDEST SWAP7 POP POP PUSH1 0x20 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1D64 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1D70 DUP10 DUP3 DUP11 ADD PUSH2 0x1A2F JUMP JUMPDEST SWAP6 POP POP PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1D8D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1D99 DUP10 DUP3 DUP11 ADD PUSH2 0x1A9B JUMP JUMPDEST SWAP5 POP POP PUSH1 0x60 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1DB6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1DC2 DUP10 DUP3 DUP11 ADD PUSH2 0x1A2F JUMP JUMPDEST SWAP4 POP POP PUSH1 0x80 PUSH2 0x1DD3 DUP10 DUP3 DUP11 ADD PUSH2 0x1CD9 JUMP JUMPDEST SWAP3 POP POP PUSH1 0xA0 PUSH2 0x1DE4 DUP10 DUP3 DUP11 ADD PUSH2 0x1A23 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 POP SWAP3 SWAP6 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0xE0 DUP9 DUP11 SUB SLT ISZERO PUSH2 0x1E0C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP8 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1E23 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1E2F DUP11 DUP3 DUP12 ADD PUSH2 0x1A9B JUMP JUMPDEST SWAP8 POP POP PUSH1 0x20 PUSH2 0x1E40 DUP11 DUP3 DUP12 ADD PUSH2 0x1CD9 JUMP JUMPDEST SWAP7 POP POP PUSH1 0x40 DUP9 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1E5D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1E69 DUP11 DUP3 DUP12 ADD PUSH2 0x1A2F JUMP JUMPDEST SWAP6 POP POP PUSH1 0x60 DUP9 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1E86 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1E92 DUP11 DUP3 DUP12 ADD PUSH2 0x1A9B JUMP JUMPDEST SWAP5 POP POP PUSH1 0x80 DUP9 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1EAF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1EBB DUP11 DUP3 DUP12 ADD PUSH2 0x1A2F JUMP JUMPDEST SWAP4 POP POP PUSH1 0xA0 PUSH2 0x1ECC DUP11 DUP3 DUP12 ADD PUSH2 0x1CD9 JUMP JUMPDEST SWAP3 POP POP PUSH1 0xC0 PUSH2 0x1EDD DUP11 DUP3 DUP12 ADD PUSH2 0x1A23 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP9 SWAP2 SWAP5 SWAP8 POP SWAP3 SWAP6 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x40 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x1F01 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1F18 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1F24 DUP7 DUP3 DUP8 ADD PUSH2 0x1AF8 JUMP JUMPDEST SWAP4 POP SWAP4 POP POP PUSH1 0x20 PUSH2 0x1F37 DUP7 DUP3 DUP8 ADD PUSH2 0x1CD9 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH2 0x1F4A DUP2 PUSH2 0x2540 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x23 DUP2 MSTORE PUSH32 0x44454641554C545F46554E4354494F4E5F574554485F434F4E54524143545F4F PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x4E4C590000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x494E56414C49445F4D53475F56414C5545000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x4F564552534F4C445F5745544800000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4449564953494F4E5F42595F5A45524F00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x554E535550504F525445445F41535345545F50524F5859000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xF DUP2 MSTORE PUSH32 0x5452414E534645525F4641494C45440000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x434F4D504C4554455F46494C4C5F4641494C4544000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x494E53554646494349454E545F4554485F52454D41494E494E47000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x13 DUP2 MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x18 DUP2 MSTORE PUSH32 0x4645455F50455243454E544147455F544F4F5F4C415247450000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x25 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F345F4C454E4754485F524551 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5549524544000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x494E56414C49445F414D4F554E54000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x80 DUP4 ADD SWAP1 PUSH2 0x22F9 DUP5 DUP3 PUSH2 0x232E JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x230C PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x232E JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x231F PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x232E JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x1615 PUSH1 0x60 DUP6 ADD DUP3 JUMPDEST PUSH2 0x1F4A DUP2 PUSH2 0x2559 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x7BD DUP3 DUP5 PUSH2 0x1F41 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x2353 DUP3 DUP7 PUSH2 0x1F41 JUMP JUMPDEST PUSH2 0x2360 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x1F41 JUMP JUMPDEST PUSH2 0x1D03 PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0x232E JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x237B DUP3 DUP6 PUSH2 0x1F41 JUMP JUMPDEST PUSH2 0x10E0 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x232E JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x1F50 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x1FA6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x1FD6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x2006 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x2036 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x208C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x20BC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x20EC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x211C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x214C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x217C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x21AC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x21DC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x220C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x2262 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7BD DUP2 PUSH2 0x22B8 JUMP JUMPDEST PUSH2 0x100 DUP2 ADD PUSH2 0x2497 DUP3 DUP6 PUSH2 0x22E8 JUMP JUMPDEST PUSH2 0x10E0 PUSH1 0x80 DUP4 ADD DUP5 PUSH2 0x22E8 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x7BD DUP3 DUP5 PUSH2 0x232E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x24D1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x24F0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 SWAP1 DUP2 MUL ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x2511 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 0xd9 DELEGATECALL XOR CALL 0x1e 0xf SWAP2 CREATE PUSH16 0x6F9D22924BE0ADD925495EEB76A6388B SLOAD OR 0xad 0xb5 SDIV 0xee 0xb3 PUSH13 0x6578706572696D656E74616CF5 STOP CALLDATACOPY ",
+ "sourceMap": "836:407:4:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;962:11:8;;;;940:10;:34;919:116;;;;;;;;;;;;;;;;;;;;;;836:407:4;6574:2360:7;;;;;;;;;;;;;;;;;;;;;;;;;;;1490:174:5;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1490:174:5;;;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;;;;;;;;;2756:2751:7;;;;;;;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;;;6574:2360:7;6929:35;;:::i;:::-;6978:38;;:::i;:::-;7102:20;7132:33;7073:18;:16;:18::i;:::-;7211:14;7179:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7211:14;;7179:47;;7211:14;7179:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:6;7186:1;7179:9;;;;;;;;;;;;;;;;;;;:24;;;;:47;:31;:47;:::i;:::-;7175:1275;;;7440:129;7483:6;7507:20;7545:10;7440:25;:129::i;:::-;7421:148;;7701:79;7709:16;:39;;;7750:16;:29;;;7701:7;:79::i;:::-;7673:107;;7175:1275;;;7958:132;8004:6;8028:20;8066:10;7958:28;:132::i;:::-;7939:151;;8166:16;:29;;;8151:44;;8231:127;8274:9;8301:12;8331:13;8231:25;:127::i;:::-;8400:39;;8209:149;;-1:-1:-1;8400:39:7;-1:-1:-1;7175:1275:7;8595:195;8632:16;:39;;;8685:19;:42;;;8741:13;8768:12;8595:23;:195::i;:::-;8853:74;8875:6;8882:1;8875:9;;;;;;;;;;;;;;;;;;:24;;;8901:25;8853:21;:74::i;:::-;6574:2360;;;;;;;;;;;;:::o;1490:174:5:-;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;1617:40:5;1639:9;;1617:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1650:6:5;;-1:-1:-1;1617:21:5;;-1:-1:-1;;;;1617:40:5:i;:::-;1490:174;;;:::o;91:20:82:-;;;;;;:::o;2756:2751:7:-;3074:35;;:::i;:::-;3123:38;;:::i;:::-;3247:22;3279:20;3309:33;3218:18;:16;:18::i;:::-;3388:14;3356:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3388:14;;3356:47;;3388:14;3356:47;;;;;;;;;;;;;;;;;;;;;;;;;3352:1671;;;3509:166;1170:6:11;3588:46:7;1170:6:11;3620:13:7;3588:7;:46::i;:::-;3652:9;3509:21;:166::i;:::-;3492:183;;3814:112;3846:6;3870:14;3902:10;3814:14;:112::i;:::-;3795:131;;4058:79;4066:16;:39;;;4107:16;:29;;;4058:7;:79::i;:::-;4030:107;;3352:1671;;;4270:144;1335:33:11;1170:6;4391:9:7;4270:21;:144::i;:::-;4253:161;;4551:112;4583:6;4607:14;4639:10;4551:14;:112::i;:::-;4532:131;;4739:16;:29;;;4724:44;;4804:127;4847:9;4874:12;4904:13;4804:25;:127::i;:::-;4973:39;;4782:149;;-1:-1:-1;4973:39:7;-1:-1:-1;3352:1671:7;5168:195;5205:16;:39;;;5258:19;:42;;;5314:13;5341:12;5168:23;:195::i;:::-;5426:74;5448:6;5455:1;5448:9;;;;;;;;;5426:74;2756:2751;;;;;;;;;;;;:::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;425:69;333:167;:::o;1106:191:8:-;1198:1;1186:9;:13;1165:77;;;;;;;;;;;;;;1252:11;;;;;;;;;;;:19;;;1278:9;1252:38;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1252:38:8;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1252:38:8;;;;;1106:191::o;9651:403:80:-;9772:10;10001:3;:10;9987:3;:10;:24;:60;;;;;10043:3;10033:14;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;10033:14:80;;;;;;;;;;;10015;;10033;;-1:-1:-1;10015:14:80;;-1:-1:-1;10033:14:80;;;;-1:-1:-1;10015:14:80;;;;10033;10015;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;10015:14:80;;;;;;;;;;;;;;;;:32;;;;9987:60;9980:67;;9651:403;;;;;:::o;8728:2363:6:-;8908:35;;:::i;:::-;9083:25;9135:26;9189:20;9224;9275:9;9595:29;10029:31;10363:35;;:::i;:::-;9006:17;;9002:71;;;9039:23;;9002:71;9111:14;9083:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9111:14;9083:42;;9111:14;9083:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;9164:15:6;9135:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9083:42;;-1:-1:-1;9164:15:6;;-1:-1:-1;9135:44:6;-1:-1:-1;9135:44:6;;;-1:-1:-1;9164:15:6;9135:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9212:1;9189:24;;9247:6;:13;9224:36;;9287:1;9275:13;;9270:1676;9290:17;;;9270:1676;;9453:12;9426:6;9433:1;9426:9;;;;;;;;;;;;;;;;;;;:24;;:39;9479:9;;9506:13;;9479:6;;9486:1;;9479:9;;;;;;;;;;;;;;;:24;;:40;9627:35;9635:12;9649;9627:7;:35::i;:::-;9595:67;;10063:224;10101:6;10108:1;10101:9;;;;;;;;;;;;;;;;;;:26;;;10145:55;10153:6;10160:1;10153:9;;;;;;;;;;;;;;;;;;:26;;;10181:6;10188:1;10181:9;;;;;;;;;;;;;;;;;;:18;;;10145:7;:55::i;:::-;10252:21;10063:20;:224::i;:::-;10029:258;;10401:129;10435:6;10442:1;10435:9;;;;;;;;;;;;;;;;;;10462:23;10503:10;10514:1;10503:13;;;;;;;;;;;;;;;;;;10401:16;:129::i;:::-;10363:167;;10616:50;10631:16;10649;10616:14;:50::i;:::-;10695:79;10703:16;:39;;;10744:16;:29;;;10695:7;:79::i;:::-;10680:94;-1:-1:-1;10868:28:6;;;10864:72;;10916:5;;10864:72;9309:3;;;;;9270:1676;;;10977:28;;;;10956:95;;;;;;;;;;;;;;8728:2363;;;;;;;;;;;;;:::o;502:208:84:-;588:7;632:6;;;;611:70;;;;;;;;;;;;;;-1:-1:-1;698:5:84;;;502:208::o;5554:2344:6:-;5745:35;;:::i;:::-;5796:27;5860:26;5915:20;5966:9;6363:37;6853;7143:36;;:::i;:::-;7549:30;5826:6;5833:1;5826:9;;;;;;;;;;;;;;;;;;;;;:24;;;5889:15;5860:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5826:24;;-1:-1:-1;5860:44:6;5889:15;;5860:44;;;5889:15;5860:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5938:6;:13;5915:36;;5978:1;5966:13;;5961:1774;5981:17;;;5961:1774;;6213:14;6186:6;6193:1;6186:9;;;;;;;;;;;;;;;;;;;:24;;:41;6241:9;;6268:13;;6241:6;;6248:1;;6241:9;;;;;;;;;;;;;;;:24;;:40;6433:39;;6403:70;;6411:20;;6403:7;:70::i;:::-;6363:110;;6893:169;6931:6;6938:1;6931:9;;;;;;;;;;;;;;;;;;:26;;;6975:6;6982:1;6975:9;;;;;;;;;;;;;;;;;;:26;;;7019:29;6893:20;:169::i;:::-;6853:209;;7182:135;7216:6;7223:1;7216:9;;;;;;;;;;;;;;;;;;7243:29;7290:10;7301:1;7290:13;;;;;;;;;7182:135;7143:174;;7402:51;7417:16;7435:17;7402:14;:51::i;:::-;-1:-1:-1;7582:39:6;;7639:46;;;7635:90;;7705:5;;7635:90;6000:3;;;;;5961:1774;;;7766:46;;;;7745:113;;;;;;;;;;;;;1829:1648:8;2277:16;;;;1230:32:11;2106:35:8;;;2085:106;;;;;;;;;;;;;;2296:51;2304:26;2332:14;2296:7;:51::i;:::-;2277:70;-1:-1:-1;2390:9:8;2378:21;;;2357:81;;;;;;;;;;;;;;2532:28;2540:9;2551:8;2532:7;:28::i;:::-;2508:52;;2641:134;2676:13;1170:6:11;2739:26:8;2641:21;:134::i;:::-;2624:151;-1:-1:-1;2868:23:8;;;;2847:96;;;;;;;;;;;;;;3021:1;3005:13;:17;3001:470;;;3083:11;;:35;;;;;:11;;;;;:20;;:35;;3104:13;;3083:35;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3083:35:8;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3083:35:8;;;;3185:1;3176:6;:10;3172:78;;;3206:29;;:21;;;;:29;;;;;3228:6;;3206:29;;;;3228:6;3206:21;:29;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3206:29:8;3172:78;3335:30;3343:13;3358:6;3335:7;:30::i;:::-;3315:50;;3395:1;3383:9;:13;3379:82;;;3416:30;;:10;;:30;;;;;3436:9;;3416:30;;;;3436:9;3416:10;:30;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3416:30:8;3379:82;1829:1648;;;;;;;;:::o;1863:437:5:-;1987:14;2004:23;:9;1987:14;2004:23;:20;:23;:::i;:::-;930:32:11;;;;;;;;;;;;;;;;1987:40:5;;-1:-1:-1;2042:24:5;;;;;;;2038:256;;;2082:37;2101:9;2112:6;2082:18;:37::i;:::-;2038:256;;;1018:41:11;;;;;;;;;;;;;;;;2140:25:5;;;;;;;2136:158;;;2181:38;2201:9;2212:6;2181:19;:38::i;2136:158::-;2250:33;;;;;;;;;;;716:230:84;802:7;837:5;;;873:6;;;;852:69;;;;;;;;;;;;;;938:1;931:8;;716:230;;;;;;:::o;3123:425:47:-;3287:21;3345:15;;;3324:78;;;;;;;;;;;;;;3429:82;3450:26;3458:9;3469:6;3450:7;:26::i;:::-;3490:11;3429:7;:82::i;:::-;3413:98;-1:-1:-1;3123:425:47;;;;;;:::o;3512:1517:6:-;3683:35;;:::i;:::-;3734:27;3798:26;3853:20;3904:9;4296:37;4475:36;;:::i;:::-;3764:6;3771:1;3764:9;;;;;;;;;;;;;;;;;;;;;:24;;;3827:15;3798:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3764:24;;-1:-1:-1;3798:44:6;3827:15;;3798:44;;;3827:15;3798:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3876:6;:13;3853:36;;3916:1;3904:13;;3899:1091;3919:17;;;3899:1091;;4151:14;4124:6;4131:1;4124:9;;;;;;;;;;;;;;;;;;;:24;;:41;4179:9;;4206:13;;4179:6;;4186:1;;4179:9;;;;;;;;;;;;;;:24;;:40;;;;4336:64;4344:14;4360:16;:39;;;4336:7;:64::i;:::-;4296:104;;4514:135;4548:6;4555:1;4548:9;;;;;;;;;;;;;;;;;;4575:29;4622:10;4633:1;4622:13;;;;;;;;;4514:135;4475:174;;4734:51;4749:16;4767:17;4734:14;:51::i;:::-;4883:39;;;;:57;-1:-1:-1;4879:101:6;;4960:5;;4879:101;3938:3;;;;;3899:1091;;;3512:1517;;;;;;;;;;;:::o;3825:691:47:-;3988:21;4046:15;;;4025:78;;;;;;;;;;;;;;4317:162;4338:106;4363:26;4371:9;4382:6;4363:7;:26::i;:::-;4407:23;4415:11;4428:1;4407:7;:23::i;:::-;4338:7;:106::i;1444:1623:6:-;1617:30;;:::i;:::-;1710;1858:16;1743:104;1775:5;1794:20;1828:9;1743:18;:104::i;:::-;1885:8;;2379:24;;1710:137;;-1:-1:-1;1885:8:6;;;-1:-1:-1;2529:3:6;;1710:137;;2283:2;2260:26;;1885:8;;2030:3;2008:598;2622:7;2619:2;;;2674:17;2668:24;2655:11;2648:45;2768:2;2749:17;2745:26;2739:33;2734:2;2721:11;2717:20;2710:63;2848:2;2829:17;2825:26;2819:33;2814:2;2801:11;2797:20;2790:63;2928:2;2909:17;2905:26;2899:33;2894:2;2881:11;2877:20;2870:63;2619:2;-1:-1:-1;1444:1623:6;;;;;;;:::o;1771:648:46:-;1964:39;;2005:40;;1956:90;;1964:39;1956:7;:90::i;:::-;1914:132;;2106:39;;;;;2147:40;;;;2098:90;;2106:39;2098:7;:90::i;:::-;2056:39;;;:132;2238:29;;;;;2269:30;;;;2230:70;;2238:29;2230:7;:70::i;:::-;2198:29;;;:102;2350:29;;;;;2381:30;;;;2342:70;;2350:29;2342:7;:70::i;:::-;2310:29;;;;:102;;;;-1:-1:-1;1771:648:46:o;15593:687:80:-;15713:13;15775:5;15783:1;15775:9;15763:1;:8;:21;;15742:105;;;;;;;;;;;;;;;;-1:-1:-1;16021:13:80;15924:2;16021:13;16015:20;16174:66;16162:79;;15593:687::o;2518:1273:5:-;2639:13;;2655:25;:9;2677:2;2655:25;:21;:25;:::i;:::-;1022:38;;;;;;;;;;;;;;;;2639:41;;-1:-1:-1;2832:10:5;;;;1022:38;2843:113;;2916:10;;2940:6;;2843:113;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;2843:113:5;;;49:4:-1;25:18;;61:17;;2843:113:5;182:15:-1;2843:113:5;;;;179:29:-1;;;;160:49;;2832:125:5;;;2843:113;;2832:125;;;;25:18:-1;2832:125:5;;25:18:-1;-1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;2832:125:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;2967:69:5;;;;;;;;;;;;;;;;;3415:14;3412:2;;;-1:-1:-1;3459:1:5;3483:14;3499:2;3480:22;3477:2;;;3621;3618:1;3615;3600:24;-1:-1:-1;3662:1:5;3656:8;3477:2;3736:7;3715:69;;;;;;;;;;;;;;;;2518:1273;;;;:::o;4010:489::-;4244:13;;4163:1;4153:11;;4132:72;;;;;;;;;;;;;;4260:25;:9;4282:2;4260:25;:21;:25;:::i;:::-;4244:41;-1:-1:-1;4313:25:5;:9;4335:2;4313:25;:21;:25;:::i;:::-;4378:114;;;;;4295:43;;-1:-1:-1;4378:32:5;;;;;;:114;;4432:4;;4451:10;;4295:43;;4378:114;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4378:114:5;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;51:288:84;137:7;;164:6;;160:45;;;193:1;186:8;;;;160:45;-1:-1:-1;226:5:84;;;230:1;226;:5;262;;;;;;;;:10;241:73;;;;;;;;;;;;;345:151;431:7;454:9;470:1;466;:5;;;;;;;;;345:151;-1:-1:-1;;;;345:151:84:o;1011:10099:42:-;5031:4;5025:11;;5321:66;5314:4;5291:28;;;5284:104;;;;1199:30;5445:4;5422:28;;6444:59;;;6770:19;;5736:26;;;6750:40;;;6883:23;;;6877:30;6853:22;;;6846:62;6979:23;;;6973:30;6949:22;;;6942:62;7082:23;;;7076:30;7052:22;;;7045:62;7197:4;7179:23;;7173:30;7149:22;;;7142:62;7297:4;7279:23;;7273:30;7249:22;;;7242:62;7397:4;7379:23;;7373:30;7349:22;;;7342:62;7495:4;7477:23;;7471:30;7447:22;;;7440:62;7594:5;7576:24;;7570:31;7545:23;;;7538:64;7699:5;7681:24;;7675:31;7650:23;;;7643:64;7787:5;7769:24;;7763:31;;7738:23;;;7731:64;;;7895:5;7877:24;;7871:31;7846:23;;;7839:64;7979:5;8106:74;;8268:24;8340:19;;7962:23;;;8544:34;;;5025:11;;5422:28;;;;6536:27;;;;5736:26;;8606:22;;;;8388:23;;;;8464:4;8445:24;;8441:35;6190:1;8698:237;8721:13;8718:1;8715:20;8698:237;;;8791:19;;8771:40;;8860:4;8843:22;;;;8898:23;;;;8749:1;8742:9;8698:237;;;-1:-1:-1;;;;9045:31:42;;;9029:13;9010:33;;;9003:74;;;;9171:17;;9165:24;9237:19;;9441:34;;;9037:4;9503:22;;;;9285:23;;;;9361:4;9342:24;;9338:35;9610:1;9596:237;9619:13;9616:1;9613:20;9596:237;;;9689:19;;9669:40;;9758:4;9741:22;;;;9796:23;;;;9647:1;9640:9;9596:237;;;-1:-1:-1;;;9902:46:42;;;-1:-1:-1;10133:33:42;;;10003:4;9981:27;;;10108:59;;;10281:19;;10472:34;;;9981:27;;10534:22;;;;10329:23;;;;10281:19;10405:4;10386:24;;10382:35;-1:-1:-1;10613:237:42;10636:13;10633:1;10630:20;10613:237;;;10706:19;;10686:40;;10775:4;10758:22;;;;10813:23;;;;10664:1;10657:9;10613:237;;;-1:-1:-1;;;10928:46:42;;;;;10902:73;;-1:-1:-1;11041:4:42;11034:25;-1:-1:-1;;;;;1011:10099:42;;;;;:::o;10268:886:80:-;10389:14;10452:5;10460:2;10452:10;10440:1;:8;:22;;10419:135;;;;;;;;;;;;;;;;-1:-1:-1;11056:13:80;10801:2;11056:13;11050:20;11072:42;11046:69;;10268:886::o;14708:220::-;14829:14;14876:21;14888:1;14891:5;13411:14;13474:5;13482:2;13474:10;13462:1;:8;:22;;13441:107;;;;;;;;;;;;;;;;-1:-1:-1;13727:13:80;13629:2;13727:13;13721:20;;13290:490::o;836:407:4:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;146:693;;261:4;249:17;;245:27;-1:-1;235:2;;286:1;283;276:12;235:2;323:6;310:20;345:85;360:69;422:6;360:69;;;345:85;;;458:21;;;502:4;490:17;;;;336:94;;-1:-1;515:14;;490:17;610:1;595:238;620:6;617:1;614:13;595:238;;;703:3;690:17;682:6;678:30;727:42;765:3;753:10;727:42;;;715:55;;-1:-1;793:4;784:14;;;;812;;;;;642:1;635:9;595:238;;;599:14;228:611;;;;;;;;879:735;;1008:4;996:17;;992:27;-1:-1;982:2;;1033:1;1030;1023:12;982:2;1070:6;1057:20;1092:99;1107:83;1183:6;1107:83;;1092:99;1219:21;;;1263:4;1251:17;;;;1083:108;;-1:-1;1276:14;;1251:17;1371:1;1356:252;1381:6;1378:1;1375:13;1356:252;;;1464:3;1451:17;1443:6;1439:30;1488:56;1540:3;1528:10;1488:56;;;1476:69;;-1:-1;1568:4;1559:14;;;;1587;;;;;1403:1;1396:9;1356:252;;1636:335;;;1743:4;1731:17;;1727:27;-1:-1;1717:2;;1768:1;1765;1758:12;1717:2;-1:-1;1788:20;;1828:18;1817:30;;1814:2;;;1860:1;1857;1850:12;1814:2;1894:4;1886:6;1882:17;1870:29;;1944:3;1937;1929:6;1925:16;1915:8;1911:31;1908:40;1905:2;;;1961:1;1958;1951:12;1905:2;1710:261;;;;;;1980:432;;2070:4;2058:17;;2054:27;-1:-1;2044:2;;2095:1;2092;2085:12;2044:2;2132:6;2119:20;2154:60;2169:44;2206:6;2169:44;;2154:60;2145:69;;2234:6;2227:5;2220:21;2270:4;2262:6;2258:17;2303:4;2296:5;2292:16;2338:3;2329:6;2324:3;2320:16;2317:25;2314:2;;;2355:1;2352;2345:12;2314:2;2365:41;2399:6;2394:3;2389;2365:41;;;2037:375;;;;;;;;2448:2205;;2556:5;2544:9;2539:3;2535:19;2531:31;2528:2;;;2575:1;2572;2565:12;2528:2;2593:21;2608:5;2593:21;;;2584:30;-1:-1;2672:1;2703:49;2748:3;2728:9;2703:49;;;2679:74;;-1:-1;2822:2;2855:49;2900:3;2876:22;;;2855:49;;;2848:4;2841:5;2837:16;2830:75;2774:142;2981:2;3014:49;3059:3;3050:6;3039:9;3035:22;3014:49;;;3007:4;3000:5;2996:16;2989:75;2926:149;3134:2;3167:49;3212:3;3203:6;3192:9;3188:22;3167:49;;;3160:4;3153:5;3149:16;3142:75;3085:143;3290:3;3324:49;3369:3;3360:6;3349:9;3345:22;3324:49;;;3317:4;3310:5;3306:16;3299:75;3238:147;3447:3;3481:49;3526:3;3517:6;3506:9;3502:22;3481:49;;;3474:4;3467:5;3463:16;3456:75;3395:147;3596:3;3630:49;3675:3;3666:6;3655:9;3651:22;3630:49;;;3623:4;3616:5;3612:16;3605:75;3552:139;3745:3;3779:49;3824:3;3815:6;3804:9;3800:22;3779:49;;;3772:4;3765:5;3761:16;3754:75;3701:139;3907:3;3942:49;3987:3;3978:6;3967:9;3963:22;3942:49;;;3934:5;3927;3923:17;3916:76;3850:153;4053:3;4088:49;4133:3;4124:6;4113:9;4109:22;4088:49;;;4080:5;4073;4069:17;4062:76;4013:136;4237:3;4226:9;4222:19;4209:33;4262:18;4254:6;4251:30;4248:2;;;4294:1;4291;4284:12;4248:2;4330:54;4380:3;4371:6;4360:9;4356:22;4330:54;;;4322:5;4315;4311:17;4304:81;4159:237;4484:3;4473:9;4469:19;4456:33;4509:18;4501:6;4498:30;4495:2;;;4541:1;4538;4531:12;4495:2;4577:54;4627:3;4618:6;4607:9;4603:22;4577:54;;;4569:5;4562;4558:17;4551:81;4406:237;2522:2131;;;;;4660:118;;4727:46;4765:6;4752:20;4727:46;;4785:241;;4889:2;4877:9;4868:7;4864:23;4860:32;4857:2;;;4905:1;4902;4895:12;4857:2;4940:1;4957:53;5002:7;4982:9;4957:53;;;4947:63;4851:175;-1:-1;;;;4851:175;5033:1509;;;;;;;5370:3;5358:9;5349:7;5345:23;5341:33;5338:2;;;5387:1;5384;5377:12;5338:2;5422:31;;5473:18;5462:30;;5459:2;;;5505:1;5502;5495:12;5459:2;5525:97;5614:7;5605:6;5594:9;5590:22;5525:97;;;5515:107;;5401:227;5687:2;5676:9;5672:18;5659:32;5711:18;5703:6;5700:30;5697:2;;;5743:1;5740;5733:12;5697:2;5763:83;5838:7;5829:6;5818:9;5814:22;5763:83;;;5753:93;;5638:214;5911:2;5900:9;5896:18;5883:32;5935:18;5927:6;5924:30;5921:2;;;5967:1;5964;5957:12;5921:2;5987:97;6076:7;6067:6;6056:9;6052:22;5987:97;;;5977:107;;5862:228;6149:2;6138:9;6134:18;6121:32;6173:18;6165:6;6162:30;6159:2;;;6205:1;6202;6195:12;6159:2;6225:83;6300:7;6291:6;6280:9;6276:22;6225:83;;;6215:93;;6100:214;6345:3;6364:53;6409:7;6400:6;6389:9;6385:22;6364:53;;;6354:63;;6324:99;6454:3;6473:53;6518:7;6509:6;6498:9;6494:22;6473:53;;;6463:63;;6433:99;5332:1210;;;;;;;;;6549:1635;;;;;;;;6903:3;6891:9;6882:7;6878:23;6874:33;6871:2;;;6920:1;6917;6910:12;6871:2;6955:31;;7006:18;6995:30;;6992:2;;;7038:1;7035;7028:12;6992:2;7058:97;7147:7;7138:6;7127:9;7123:22;7058:97;;;7048:107;;6934:227;7192:2;7210:53;7255:7;7246:6;7235:9;7231:22;7210:53;;;7200:63;;7171:98;7328:2;7317:9;7313:18;7300:32;7352:18;7344:6;7341:30;7338:2;;;7384:1;7381;7374:12;7338:2;7404:83;7479:7;7470:6;7459:9;7455:22;7404:83;;;7394:93;;7279:214;7552:2;7541:9;7537:18;7524:32;7576:18;7568:6;7565:30;7562:2;;;7608:1;7605;7598:12;7562:2;7628:97;7717:7;7708:6;7697:9;7693:22;7628:97;;;7618:107;;7503:228;7790:3;7779:9;7775:19;7762:33;7815:18;7807:6;7804:30;7801:2;;;7847:1;7844;7837:12;7801:2;7867:83;7942:7;7933:6;7922:9;7918:22;7867:83;;;7857:93;;7741:215;7987:3;8006:53;8051:7;8042:6;8031:9;8027:22;8006:53;;;7996:63;;7966:99;8096:3;8115:53;8160:7;8151:6;8140:9;8136:22;8115:53;;;8105:63;;8075:99;6865:1319;;;;;;;;;;;8191:490;;;;8331:2;8319:9;8310:7;8306:23;8302:32;8299:2;;;8347:1;8344;8337:12;8299:2;8382:31;;8433:18;8422:30;;8419:2;;;8465:1;8462;8455:12;8419:2;8493:64;8549:7;8540:6;8529:9;8525:22;8493:64;;;8475:82;;;;8361:202;8594:2;8612:53;8657:7;8648:6;8637:9;8633:22;8612:53;;;8602:63;;8573:98;8293:388;;;;;;8688:110;8761:31;8786:5;8761:31;;;8756:3;8749:44;8743:55;;;8806:397;8961:2;8949:15;;8998:66;8993:2;8984:12;;8977:88;9099:66;9094:2;9085:12;;9078:88;9194:2;9185:12;;8942:261;9212:296;9367:2;9355:15;;9404:66;9399:2;9390:12;;9383:88;9499:2;9490:12;;9348:160;9517:296;9672:2;9660:15;;9709:66;9704:2;9695:12;;9688:88;9804:2;9795:12;;9653:160;9822:296;9977:2;9965:15;;10014:66;10009:2;10000:12;;9993:88;10109:2;10100:12;;9958:160;10127:397;10282:2;10270:15;;10319:66;10314:2;10305:12;;10298:88;10420:66;10415:2;10406:12;;10399:88;10515:2;10506:12;;10263:261;10533:296;10688:2;10676:15;;10725:66;10720:2;10711:12;;10704:88;10820:2;10811:12;;10669:160;10838:296;10993:2;10981:15;;11030:66;11025:2;11016:12;;11009:88;11125:2;11116:12;;10974:160;11143:296;11298:2;11286:15;;11335:66;11330:2;11321:12;;11314:88;11430:2;11421:12;;11279:160;11448:296;11603:2;11591:15;;11640:66;11635:2;11626:12;;11619:88;11735:2;11726:12;;11584:160;11753:296;11908:2;11896:15;;11945:66;11940:2;11931:12;;11924:88;12040:2;12031:12;;11889:160;12058:296;12213:2;12201:15;;12250:66;12245:2;12236:12;;12229:88;12345:2;12336:12;;12194:160;12363:296;12518:2;12506:15;;12555:66;12550:2;12541:12;;12534:88;12650:2;12641:12;;12499:160;12668:296;12823:2;12811:15;;12860:66;12855:2;12846:12;;12839:88;12955:2;12946:12;;12804:160;12973:397;13128:2;13116:15;;13165:66;13160:2;13151:12;;13144:88;13266:66;13261:2;13252:12;;13245:88;13361:2;13352:12;;13109:261;13379:397;13534:2;13522:15;;13571:66;13566:2;13557:12;;13550:88;13672:66;13667:2;13658:12;;13651:88;13767:2;13758:12;;13515:261;13785:296;13940:2;13928:15;;13977:66;13972:2;13963:12;;13956:88;14072:2;14063:12;;13921:160;14166:890;14396:22;;14309:4;14300:14;;;14430:61;14304:3;14396:22;14430:61;;;14329:174;14597:4;14590:5;14586:16;14580:23;14615:62;14671:4;14666:3;14662:14;14649:11;14615:62;;;14513:176;14773:4;14766:5;14762:16;14756:23;14791:62;14847:4;14842:3;14838:14;14825:11;14791:62;;;14699:166;14949:4;14942:5;14938:16;14932:23;14967:62;15023:4;15018:3;15014:14;15001:11;15063:110;15136:31;15161:5;15136:31;;15180:193;15288:2;15273:18;;15302:61;15277:9;15336:6;15302:61;;15380:395;15544:2;15529:18;;15558:61;15533:9;15592:6;15558:61;;;15630:62;15688:2;15677:9;15673:18;15664:6;15630:62;;;15703;15761:2;15750:9;15746:18;15737:6;15703:62;;15782:294;15918:2;15903:18;;15932:61;15907:9;15966:6;15932:61;;;16004:62;16062:2;16051:9;16047:18;16038:6;16004:62;;16083:387;16264:2;16278:47;;;16249:18;;16339:121;16249:18;16339:121;;16477:387;16658:2;16672:47;;;16643:18;;16733:121;16643:18;16733:121;;16871:387;17052:2;17066:47;;;17037:18;;17127:121;17037:18;17127:121;;17265:387;17446:2;17460:47;;;17431:18;;17521:121;17431:18;17521:121;;17659:387;17840:2;17854:47;;;17825:18;;17915:121;17825:18;17915:121;;18053:387;18234:2;18248:47;;;18219:18;;18309:121;18219:18;18309:121;;18447:387;18628:2;18642:47;;;18613:18;;18703:121;18613:18;18703:121;;18841:387;19022:2;19036:47;;;19007:18;;19097:121;19007:18;19097:121;;19235:387;19416:2;19430:47;;;19401:18;;19491:121;19401:18;19491:121;;19629:387;19810:2;19824:47;;;19795:18;;19885:121;19795:18;19885:121;;20023:387;20204:2;20218:47;;;20189:18;;20279:121;20189:18;20279:121;;20417:387;20598:2;20612:47;;;20583:18;;20673:121;20583:18;20673:121;;20811:387;20992:2;21006:47;;;20977:18;;21067:121;20977:18;21067:121;;21205:387;21386:2;21400:47;;;21371:18;;21461:121;21371:18;21461:121;;21599:387;21780:2;21794:47;;;21765:18;;21855:121;21765:18;21855:121;;21993:387;22174:2;22188:47;;;22159:18;;22249:121;22159:18;22249:121;;22387:536;22643:3;22628:19;;22658:121;22632:9;22752:6;22658:121;;;22790:123;22908:3;22897:9;22893:19;22884:6;22790:123;;22930:193;23038:2;23023:18;;23052:61;23027:9;23086:6;23052:61;;23130:256;23192:2;23186:9;23218:17;;;23293:18;23278:34;;23314:22;;;23275:62;23272:2;;;23350:1;23347;23340:12;23272:2;23366;23359:22;23170:216;;-1:-1;23170:216;23393:263;;23557:18;23549:6;23546:30;23543:2;;;23589:1;23586;23579:12;23543:2;-1:-1;23618:4;23606:17;;;23636:15;;23480:176;23947:254;;24086:18;24078:6;24075:30;24072:2;;;24118:1;24115;24108:12;24072:2;-1:-1;24191:4;24162;24139:17;;;;24158:9;24135:33;24181:15;;24009:192;24208:128;24288:42;24277:54;;24260:76;24343:79;24412:5;24395:27;24651:145;24732:6;24727:3;24722;24709:30;-1:-1;24788:1;24770:16;;24763:27;24702:94"
+ }
+ }
+ },
+ "sources": {
+ "extensions/Forwarder/Forwarder.sol": {
+ "id": 4
+ },
+ "extensions/Forwarder/MixinWeth.sol": {
+ "id": 8
+ },
+ "protocol/Exchange/libs/LibMath.sol": {
+ "id": 47
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "extensions/Forwarder/libs/LibConstants.sol": {
+ "id": 11
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ },
+ "protocol/Exchange/interfaces/IExchange.sol": {
+ "id": 34
+ },
+ "protocol/Exchange/interfaces/IExchangeCore.sol": {
+ "id": 35
+ },
+ "protocol/Exchange/libs/LibOrder.sol": {
+ "id": 48
+ },
+ "protocol/Exchange/libs/LibEIP712.sol": {
+ "id": 44
+ },
+ "protocol/Exchange/libs/LibFillResults.sol": {
+ "id": 46
+ },
+ "protocol/Exchange/interfaces/IMatchOrders.sol": {
+ "id": 36
+ },
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": {
+ "id": 37
+ },
+ "protocol/Exchange/interfaces/ITransactions.sol": {
+ "id": 38
+ },
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": {
+ "id": 33
+ },
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": {
+ "id": 41
+ },
+ "tokens/EtherToken/IEtherToken.sol": {
+ "id": 78
+ },
+ "tokens/ERC20Token/IERC20Token.sol": {
+ "id": 71
+ },
+ "extensions/Forwarder/mixins/MWeth.sol": {
+ "id": 14
+ },
+ "extensions/Forwarder/MixinForwarderCore.sol": {
+ "id": 7
+ },
+ "extensions/Forwarder/mixins/MAssets.sol": {
+ "id": 12
+ },
+ "extensions/Forwarder/interfaces/IAssets.sol": {
+ "id": 9
+ },
+ "extensions/Forwarder/mixins/MExchangeWrapper.sol": {
+ "id": 13
+ },
+ "extensions/Forwarder/interfaces/IForwarderCore.sol": {
+ "id": 10
+ },
+ "extensions/Forwarder/MixinAssets.sol": {
+ "id": 5
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ },
+ "tokens/ERC721Token/IERC721Token.sol": {
+ "id": 76
+ },
+ "extensions/Forwarder/MixinExchangeWrapper.sol": {
+ "id": 6
+ },
+ "protocol/Exchange/libs/LibAbiEncoder.sol": {
+ "id": 42
+ }
+ },
+ "sourceCodes": {
+ "extensions/Forwarder/Forwarder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./MixinWeth.sol\";\nimport \"./MixinForwarderCore.sol\";\nimport \"./libs/LibConstants.sol\";\nimport \"./MixinAssets.sol\";\nimport \"./MixinExchangeWrapper.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract Forwarder is\n LibConstants,\n MixinWeth,\n MixinAssets,\n MixinExchangeWrapper,\n MixinForwarderCore\n{\n constructor (\n address _exchange,\n bytes memory _zrxAssetData,\n bytes memory _wethAssetData\n )\n public\n LibConstants(\n _exchange,\n _zrxAssetData,\n _wethAssetData\n )\n MixinForwarderCore()\n {}\n}\n",
+ "extensions/Forwarder/MixinWeth.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../protocol/Exchange/libs/LibMath.sol\";\nimport \"./libs/LibConstants.sol\";\nimport \"./mixins/MWeth.sol\";\n\n\ncontract MixinWeth is\n LibMath,\n LibConstants,\n MWeth\n{\n /// @dev Default payabale function, this allows us to withdraw WETH\n function ()\n public\n payable\n {\n require(\n msg.sender == address(ETHER_TOKEN),\n \"DEFAULT_FUNCTION_WETH_CONTRACT_ONLY\"\n );\n }\n\n /// @dev Converts message call's ETH value into WETH.\n function convertEthToWeth()\n internal\n {\n require(\n msg.value > 0,\n \"INVALID_MSG_VALUE\"\n );\n ETHER_TOKEN.deposit.value(msg.value)();\n }\n\n /// @dev Transfers feePercentage of WETH spent on primary orders to feeRecipient.\n /// Refunds any excess ETH to msg.sender.\n /// @param wethSoldExcludingFeeOrders Amount of WETH sold when filling primary orders.\n /// @param wethSoldForZrx Amount of WETH sold when purchasing ZRX required for primary order fees.\n /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.\n /// @param feeRecipient Address that will receive ETH when orders are filled.\n function transferEthFeeAndRefund(\n uint256 wethSoldExcludingFeeOrders,\n uint256 wethSoldForZrx,\n uint256 feePercentage,\n address feeRecipient\n )\n internal\n {\n // Ensure feePercentage is less than 5%.\n require(\n feePercentage <= MAX_FEE_PERCENTAGE,\n \"FEE_PERCENTAGE_TOO_LARGE\"\n );\n\n // Ensure that no extra WETH owned by this contract has been sold.\n uint256 wethSold = safeAdd(wethSoldExcludingFeeOrders, wethSoldForZrx);\n require(\n wethSold <= msg.value,\n \"OVERSOLD_WETH\"\n );\n\n // Calculate amount of WETH that hasn't been sold.\n uint256 wethRemaining = safeSub(msg.value, wethSold);\n\n // Calculate ETH fee to pay to feeRecipient.\n uint256 ethFee = getPartialAmountFloor(\n feePercentage,\n PERCENTAGE_DENOMINATOR,\n wethSoldExcludingFeeOrders\n );\n\n // Ensure fee is less than amount of WETH remaining.\n require(\n ethFee <= wethRemaining,\n \"INSUFFICIENT_ETH_REMAINING\"\n );\n \n // Do nothing if no WETH remaining\n if (wethRemaining > 0) {\n // Convert remaining WETH to ETH\n ETHER_TOKEN.withdraw(wethRemaining);\n\n // Pay ETH to feeRecipient\n if (ethFee > 0) {\n feeRecipient.transfer(ethFee);\n }\n\n // Refund remaining ETH to msg.sender.\n uint256 ethRefund = safeSub(wethRemaining, ethFee);\n if (ethRefund > 0) {\n msg.sender.transfer(ethRefund);\n }\n }\n }\n}\n",
+ "protocol/Exchange/libs/LibMath.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibMath is\n SafeMath\n{\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// Reverts if rounding error is >= 0.1%\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded down.\n function safeGetPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n require(\n !isRoundingErrorFloor(\n numerator,\n denominator,\n target\n ),\n \"ROUNDING_ERROR\"\n );\n \n partialAmount = safeDiv(\n safeMul(numerator, target),\n denominator\n );\n return partialAmount;\n }\n\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// Reverts if rounding error is >= 0.1%\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded up.\n function safeGetPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n require(\n !isRoundingErrorCeil(\n numerator,\n denominator,\n target\n ),\n \"ROUNDING_ERROR\"\n );\n \n // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):\n // ceil(a / b) = floor((a + b - 1) / b)\n // To implement `ceil(a / b)` using safeDiv.\n partialAmount = safeDiv(\n safeAdd(\n safeMul(numerator, target),\n safeSub(denominator, 1)\n ),\n denominator\n );\n return partialAmount;\n }\n\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded down.\n function getPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n partialAmount = safeDiv(\n safeMul(numerator, target),\n denominator\n );\n return partialAmount;\n }\n \n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded up.\n function getPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):\n // ceil(a / b) = floor((a + b - 1) / b)\n // To implement `ceil(a / b)` using safeDiv.\n partialAmount = safeDiv(\n safeAdd(\n safeMul(numerator, target),\n safeSub(denominator, 1)\n ),\n denominator\n );\n return partialAmount;\n }\n \n /// @dev Checks if rounding error >= 0.1% when rounding down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to multiply with numerator/denominator.\n /// @return Rounding error is present.\n function isRoundingErrorFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (bool isError)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n \n // The absolute rounding error is the difference between the rounded\n // value and the ideal value. The relative rounding error is the\n // absolute rounding error divided by the absolute value of the\n // ideal value. This is undefined when the ideal value is zero.\n //\n // The ideal value is `numerator * target / denominator`.\n // Let's call `numerator * target % denominator` the remainder.\n // The absolute error is `remainder / denominator`.\n //\n // When the ideal value is zero, we require the absolute error to\n // be zero. Fortunately, this is always the case. The ideal value is\n // zero iff `numerator == 0` and/or `target == 0`. In this case the\n // remainder and absolute error are also zero. \n if (target == 0 || numerator == 0) {\n return false;\n }\n \n // Otherwise, we want the relative rounding error to be strictly\n // less than 0.1%.\n // The relative error is `remainder / (numerator * target)`.\n // We want the relative error less than 1 / 1000:\n // remainder / (numerator * denominator) < 1 / 1000\n // or equivalently:\n // 1000 * remainder < numerator * target\n // so we have a rounding error iff:\n // 1000 * remainder >= numerator * target\n uint256 remainder = mulmod(\n target,\n numerator,\n denominator\n );\n isError = safeMul(1000, remainder) >= safeMul(numerator, target);\n return isError;\n }\n \n /// @dev Checks if rounding error >= 0.1% when rounding up.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to multiply with numerator/denominator.\n /// @return Rounding error is present.\n function isRoundingErrorCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (bool isError)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n \n // See the comments in `isRoundingError`.\n if (target == 0 || numerator == 0) {\n // When either is zero, the ideal value and rounded value are zero\n // and there is no rounding error. (Although the relative error\n // is undefined.)\n return false;\n }\n // Compute remainder as before\n uint256 remainder = mulmod(\n target,\n numerator,\n denominator\n );\n remainder = safeSub(denominator, remainder) % denominator;\n isError = safeMul(1000, remainder) >= safeMul(numerator, target);\n return isError;\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "extensions/Forwarder/libs/LibConstants.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/LibBytes/LibBytes.sol\";\nimport \"../../../protocol/Exchange/interfaces/IExchange.sol\";\nimport \"../../../tokens/EtherToken/IEtherToken.sol\";\nimport \"../../../tokens/ERC20Token/IERC20Token.sol\";\n\n\ncontract LibConstants {\n\n using LibBytes for bytes;\n\n bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256(\"ERC20Token(address)\"));\n bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256(\"ERC721Token(address,uint256)\"));\n uint256 constant internal MAX_UINT = 2**256 - 1;\n uint256 constant internal PERCENTAGE_DENOMINATOR = 10**18; \n uint256 constant internal MAX_FEE_PERCENTAGE = 5 * PERCENTAGE_DENOMINATOR / 100; // 5%\n uint256 constant internal MAX_WETH_FILL_PERCENTAGE = 95 * PERCENTAGE_DENOMINATOR / 100; // 95%\n \n // solhint-disable var-name-mixedcase\n IExchange internal EXCHANGE;\n IEtherToken internal ETHER_TOKEN;\n IERC20Token internal ZRX_TOKEN;\n bytes internal ZRX_ASSET_DATA;\n bytes internal WETH_ASSET_DATA;\n // solhint-enable var-name-mixedcase\n\n constructor (\n address _exchange,\n bytes memory _zrxAssetData,\n bytes memory _wethAssetData\n )\n public\n {\n EXCHANGE = IExchange(_exchange);\n ZRX_ASSET_DATA = _zrxAssetData;\n WETH_ASSET_DATA = _wethAssetData;\n\n address etherToken = _wethAssetData.readAddress(16);\n address zrxToken = _zrxAssetData.readAddress(16);\n ETHER_TOKEN = IEtherToken(etherToken);\n ZRX_TOKEN = IERC20Token(zrxToken);\n }\n}\n",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n",
+ "protocol/Exchange/interfaces/IExchange.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./IExchangeCore.sol\";\nimport \"./IMatchOrders.sol\";\nimport \"./ISignatureValidator.sol\";\nimport \"./ITransactions.sol\";\nimport \"./IAssetProxyDispatcher.sol\";\nimport \"./IWrapperFunctions.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract IExchange is\n IExchangeCore,\n IMatchOrders,\n ISignatureValidator,\n ITransactions,\n IAssetProxyDispatcher,\n IWrapperFunctions\n{}\n",
+ "protocol/Exchange/interfaces/IExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IExchangeCore {\n\n /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch\n /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).\n /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.\n function cancelOrdersUpTo(uint256 targetOrderEpoch)\n external;\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev After calling, the order can not be filled anymore.\n /// @param order Order struct containing order specifications.\n function cancelOrder(LibOrder.Order memory order)\n public;\n\n /// @dev Gets information about an order: status, hash, and amount filled.\n /// @param order Order to gather information on.\n /// @return OrderInfo Information about the order and its state.\n /// See LibOrder.OrderInfo for a complete description.\n function getOrderInfo(LibOrder.Order memory order)\n public\n view\n returns (LibOrder.OrderInfo memory orderInfo);\n}\n",
+ "protocol/Exchange/libs/LibOrder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./LibEIP712.sol\";\n\n\ncontract LibOrder is\n LibEIP712\n{\n // Hash for the EIP712 Order Schema\n bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"Order(\",\n \"address makerAddress,\",\n \"address takerAddress,\",\n \"address feeRecipientAddress,\",\n \"address senderAddress,\",\n \"uint256 makerAssetAmount,\",\n \"uint256 takerAssetAmount,\",\n \"uint256 makerFee,\",\n \"uint256 takerFee,\",\n \"uint256 expirationTimeSeconds,\",\n \"uint256 salt,\",\n \"bytes makerAssetData,\",\n \"bytes takerAssetData\",\n \")\"\n ));\n\n // A valid order remains fillable until it is expired, fully filled, or cancelled.\n // An order's state is unaffected by external factors, like account balances.\n enum OrderStatus {\n INVALID, // Default value\n INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount\n INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount\n FILLABLE, // Order is fillable\n EXPIRED, // Order has already expired\n FULLY_FILLED, // Order is fully filled\n CANCELLED // Order has been cancelled\n }\n\n // solhint-disable max-line-length\n struct Order {\n address makerAddress; // Address that created the order. \n address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. \n address feeRecipientAddress; // Address that will recieve fees when order is filled. \n address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.\n uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. \n uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. \n uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.\n uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.\n uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. \n uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. \n bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.\n bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.\n }\n // solhint-enable max-line-length\n\n struct OrderInfo {\n uint8 orderStatus; // Status that describes order's validity and fillability.\n bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash).\n uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled.\n }\n\n /// @dev Calculates Keccak-256 hash of the order.\n /// @param order The order structure.\n /// @return Keccak-256 EIP712 hash of the order.\n function getOrderHash(Order memory order)\n internal\n view\n returns (bytes32 orderHash)\n {\n orderHash = hashEIP712Message(hashOrder(order));\n return orderHash;\n }\n\n /// @dev Calculates EIP712 hash of the order.\n /// @param order The order structure.\n /// @return EIP712 hash of the order.\n function hashOrder(Order memory order)\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;\n bytes32 makerAssetDataHash = keccak256(order.makerAssetData);\n bytes32 takerAssetDataHash = keccak256(order.takerAssetData);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ORDER_SCHEMA_HASH,\n // bytes32(order.makerAddress),\n // bytes32(order.takerAddress),\n // bytes32(order.feeRecipientAddress),\n // bytes32(order.senderAddress),\n // order.makerAssetAmount,\n // order.takerAssetAmount,\n // order.makerFee,\n // order.takerFee,\n // order.expirationTimeSeconds,\n // order.salt,\n // keccak256(order.makerAssetData),\n // keccak256(order.takerAssetData)\n // ));\n\n assembly {\n // Calculate memory addresses that will be swapped out before hashing\n let pos1 := sub(order, 32)\n let pos2 := add(order, 320)\n let pos3 := add(order, 352)\n\n // Backup\n let temp1 := mload(pos1)\n let temp2 := mload(pos2)\n let temp3 := mload(pos3)\n \n // Hash in place\n mstore(pos1, schemaHash)\n mstore(pos2, makerAssetDataHash)\n mstore(pos3, takerAssetDataHash)\n result := keccak256(pos1, 416)\n \n // Restore\n mstore(pos1, temp1)\n mstore(pos2, temp2)\n mstore(pos3, temp3)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibEIP712.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract LibEIP712 {\n\n // EIP191 header for EIP712 prefix\n string constant internal EIP191_HEADER = \"\\x19\\x01\";\n\n // EIP712 Domain Name value\n string constant internal EIP712_DOMAIN_NAME = \"0x Protocol\";\n\n // EIP712 Domain Version value\n string constant internal EIP712_DOMAIN_VERSION = \"2\";\n\n // Hash of the EIP712 Domain Separator Schema\n bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"address verifyingContract\",\n \")\"\n ));\n\n // Hash of the EIP712 Domain Separator data\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public EIP712_DOMAIN_HASH;\n\n constructor ()\n public\n {\n EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(\n EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,\n keccak256(bytes(EIP712_DOMAIN_NAME)),\n keccak256(bytes(EIP712_DOMAIN_VERSION)),\n bytes32(address(this))\n ));\n }\n\n /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.\n /// @param hashStruct The EIP712 hash struct.\n /// @return EIP712 hash applied to this EIP712 Domain.\n function hashEIP712Message(bytes32 hashStruct)\n internal\n view\n returns (bytes32 result)\n {\n bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;\n\n // Assembly for more efficient computing:\n // keccak256(abi.encodePacked(\n // EIP191_HEADER,\n // EIP712_DOMAIN_HASH,\n // hashStruct \n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header\n mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash\n mstore(add(memPtr, 34), hashStruct) // Hash of struct\n\n // Compute hash\n result := keccak256(memPtr, 66)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibFillResults.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibFillResults is\n SafeMath\n{\n struct FillResults {\n uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.\n uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.\n uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).\n uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).\n }\n\n struct MatchedFillResults {\n FillResults left; // Amounts filled and fees paid of left order.\n FillResults right; // Amounts filled and fees paid of right order.\n uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker.\n }\n\n /// @dev Adds properties of both FillResults instances.\n /// Modifies the first FillResults instance specified.\n /// @param totalFillResults Fill results instance that will be added onto.\n /// @param singleFillResults Fill results instance that will be added to totalFillResults.\n function addFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)\n internal\n pure\n {\n totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);\n totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);\n totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);\n totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);\n }\n}\n",
+ "protocol/Exchange/interfaces/IMatchOrders.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IMatchOrders {\n\n /// @dev Match two complementary orders that have a profitable spread.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the left order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftSignature Proof that order was created by the left maker.\n /// @param rightSignature Proof that order was created by the right maker.\n /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.\n function matchOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n bytes memory leftSignature,\n bytes memory rightSignature\n )\n public\n returns (LibFillResults.MatchedFillResults memory matchedFillResults);\n}\n",
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ISignatureValidator {\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external;\n \n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external;\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address of signer.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/ITransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\n\ncontract ITransactions {\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external;\n}\n",
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IAssetProxyDispatcher {\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external;\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address);\n}\n",
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IWrapperFunctions {\n\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrKill.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrKillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrders(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrders(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously cancels multiple orders in a single transaction.\n /// @param orders Array of order specifications.\n function batchCancelOrders(LibOrder.Order[] memory orders)\n public;\n\n /// @dev Fetches information for all passed in orders\n /// @param orders Array of order specifications.\n /// @return Array of OrderInfo instances that correspond to each order.\n function getOrdersInfo(LibOrder.Order[] memory orders)\n public\n view\n returns (LibOrder.OrderInfo[] memory);\n}\n",
+ "tokens/EtherToken/IEtherToken.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../ERC20Token/IERC20Token.sol\";\n\n\ncontract IEtherToken is\n IERC20Token\n{\n function deposit()\n public\n payable;\n \n function withdraw(uint256 amount)\n public;\n}\n",
+ "tokens/ERC20Token/IERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC20Token {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool);\n \n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n \n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256);\n}\n",
+ "extensions/Forwarder/mixins/MWeth.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract MWeth {\n\n /// @dev Converts message call's ETH value into WETH.\n function convertEthToWeth()\n internal;\n\n /// @dev Transfers feePercentage of WETH spent on primary orders to feeRecipient.\n /// Refunds any excess ETH to msg.sender.\n /// @param wethSoldExcludingFeeOrders Amount of WETH sold when filling primary orders.\n /// @param wethSoldForZrx Amount of WETH sold when purchasing ZRX required for primary order fees.\n /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.\n /// @param feeRecipient Address that will receive ETH when orders are filled.\n function transferEthFeeAndRefund(\n uint256 wethSoldExcludingFeeOrders,\n uint256 wethSoldForZrx,\n uint256 feePercentage,\n address feeRecipient\n )\n internal;\n}\n",
+ "extensions/Forwarder/MixinForwarderCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./libs/LibConstants.sol\";\nimport \"./mixins/MWeth.sol\";\nimport \"./mixins/MAssets.sol\";\nimport \"./mixins/MExchangeWrapper.sol\";\nimport \"./interfaces/IForwarderCore.sol\";\nimport \"../../utils/LibBytes/LibBytes.sol\";\nimport \"../../protocol/Exchange/libs/LibOrder.sol\";\nimport \"../../protocol/Exchange/libs/LibFillResults.sol\";\nimport \"../../protocol/Exchange/libs/LibMath.sol\";\n\n\ncontract MixinForwarderCore is\n LibFillResults,\n LibMath,\n LibConstants,\n MWeth,\n MAssets,\n MExchangeWrapper,\n IForwarderCore\n{\n using LibBytes for bytes;\n\n /// @dev Constructor approves ERC20 proxy to transfer ZRX and WETH on this contract's behalf.\n constructor ()\n public\n {\n address proxyAddress = EXCHANGE.getAssetProxy(ERC20_DATA_ID);\n require(\n proxyAddress != address(0),\n \"UNREGISTERED_ASSET_PROXY\"\n );\n ETHER_TOKEN.approve(proxyAddress, MAX_UINT);\n ZRX_TOKEN.approve(proxyAddress, MAX_UINT);\n }\n\n /// @dev Purchases as much of orders' makerAssets as possible by selling up to 95% of transaction's ETH value.\n /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.\n /// 5% of ETH value is reserved for paying fees to order feeRecipients (in ZRX) and forwarding contract feeRecipient (in ETH).\n /// Any ETH not spent will be refunded to sender.\n /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset. \n /// @param signatures Proofs that orders have been created by makers.\n /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.\n /// @param feeSignatures Proofs that feeOrders have been created by makers.\n /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.\n /// @param feeRecipient Address that will receive ETH when orders are filled.\n /// @return Amounts filled and fees paid by maker and taker for both sets of orders.\n function marketSellOrdersWithEth(\n LibOrder.Order[] memory orders,\n bytes[] memory signatures,\n LibOrder.Order[] memory feeOrders,\n bytes[] memory feeSignatures,\n uint256 feePercentage,\n address feeRecipient\n )\n public\n payable\n returns (\n FillResults memory orderFillResults,\n FillResults memory feeOrderFillResults\n )\n {\n // Convert ETH to WETH.\n convertEthToWeth();\n\n uint256 wethSellAmount;\n uint256 zrxBuyAmount;\n uint256 makerAssetAmountPurchased;\n if (orders[0].makerAssetData.equals(ZRX_ASSET_DATA)) {\n // Calculate amount of WETH that won't be spent on ETH fees.\n wethSellAmount = getPartialAmountFloor(\n PERCENTAGE_DENOMINATOR,\n safeAdd(PERCENTAGE_DENOMINATOR, feePercentage),\n msg.value\n );\n // Market sell available WETH.\n // ZRX fees are paid with this contract's balance.\n orderFillResults = marketSellWeth(\n orders,\n wethSellAmount,\n signatures\n );\n // The fee amount must be deducted from the amount transfered back to sender.\n makerAssetAmountPurchased = safeSub(orderFillResults.makerAssetFilledAmount, orderFillResults.takerFeePaid);\n } else {\n // 5% of WETH is reserved for filling feeOrders and paying feeRecipient.\n wethSellAmount = getPartialAmountFloor(\n MAX_WETH_FILL_PERCENTAGE,\n PERCENTAGE_DENOMINATOR,\n msg.value\n );\n // Market sell 95% of WETH.\n // ZRX fees are payed with this contract's balance.\n orderFillResults = marketSellWeth(\n orders,\n wethSellAmount,\n signatures\n );\n // Buy back all ZRX spent on fees.\n zrxBuyAmount = orderFillResults.takerFeePaid;\n feeOrderFillResults = marketBuyExactZrxWithWeth(\n feeOrders,\n zrxBuyAmount,\n feeSignatures\n );\n makerAssetAmountPurchased = orderFillResults.makerAssetFilledAmount;\n }\n\n // Transfer feePercentage of total ETH spent on primary orders to feeRecipient.\n // Refund remaining ETH to msg.sender.\n transferEthFeeAndRefund(\n orderFillResults.takerAssetFilledAmount,\n feeOrderFillResults.takerAssetFilledAmount,\n feePercentage,\n feeRecipient\n );\n\n // Transfer purchased assets to msg.sender.\n transferAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);\n }\n\n /// @dev Attempt to purchase makerAssetFillAmount of makerAsset by selling ETH provided with transaction.\n /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.\n /// Any ETH not spent will be refunded to sender.\n /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset. \n /// @param makerAssetFillAmount Desired amount of makerAsset to purchase.\n /// @param signatures Proofs that orders have been created by makers.\n /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.\n /// @param feeSignatures Proofs that feeOrders have been created by makers.\n /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.\n /// @param feeRecipient Address that will receive ETH when orders are filled.\n /// @return Amounts filled and fees paid by maker and taker for both sets of orders.\n function marketBuyOrdersWithEth(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures,\n LibOrder.Order[] memory feeOrders,\n bytes[] memory feeSignatures,\n uint256 feePercentage,\n address feeRecipient\n )\n public\n payable\n returns (\n FillResults memory orderFillResults,\n FillResults memory feeOrderFillResults\n )\n {\n // Convert ETH to WETH.\n convertEthToWeth();\n\n uint256 zrxBuyAmount;\n uint256 makerAssetAmountPurchased;\n if (orders[0].makerAssetData.equals(ZRX_ASSET_DATA)) {\n // If the makerAsset is ZRX, it is not necessary to pay fees out of this\n // contracts's ZRX balance because fees are factored into the price of the order.\n orderFillResults = marketBuyExactZrxWithWeth(\n orders,\n makerAssetFillAmount,\n signatures\n );\n // The fee amount must be deducted from the amount transfered back to sender.\n makerAssetAmountPurchased = safeSub(orderFillResults.makerAssetFilledAmount, orderFillResults.takerFeePaid);\n } else {\n // Attemp to purchase desired amount of makerAsset.\n // ZRX fees are payed with this contract's balance.\n orderFillResults = marketBuyExactAmountWithWeth(\n orders,\n makerAssetFillAmount,\n signatures\n );\n // Buy back all ZRX spent on fees.\n zrxBuyAmount = orderFillResults.takerFeePaid;\n feeOrderFillResults = marketBuyExactZrxWithWeth(\n feeOrders,\n zrxBuyAmount,\n feeSignatures\n );\n makerAssetAmountPurchased = orderFillResults.makerAssetFilledAmount;\n }\n\n // Transfer feePercentage of total ETH spent on primary orders to feeRecipient.\n // Refund remaining ETH to msg.sender.\n transferEthFeeAndRefund(\n orderFillResults.takerAssetFilledAmount,\n feeOrderFillResults.takerAssetFilledAmount,\n feePercentage,\n feeRecipient\n );\n\n // Transfer purchased assets to msg.sender.\n transferAssetToSender(orders[0].makerAssetData, makerAssetAmountPurchased);\n }\n}\n",
+ "extensions/Forwarder/mixins/MAssets.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../interfaces/IAssets.sol\";\n\n\ncontract MAssets is\n IAssets\n{\n /// @dev Transfers given amount of asset to sender.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param amount Amount of asset to transfer to sender.\n function transferAssetToSender(\n bytes memory assetData,\n uint256 amount\n )\n internal;\n\n /// @dev Decodes ERC20 assetData and transfers given amount to sender.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param amount Amount of asset to transfer to sender.\n function transferERC20Token(\n bytes memory assetData,\n uint256 amount\n )\n internal;\n\n /// @dev Decodes ERC721 assetData and transfers given amount to sender.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param amount Amount of asset to transfer to sender.\n function transferERC721Token(\n bytes memory assetData,\n uint256 amount\n )\n internal;\n}\n",
+ "extensions/Forwarder/interfaces/IAssets.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IAssets {\n\n /// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to \n /// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be\n /// used to withdraw assets that were accidentally sent to this contract.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param amount Amount of ERC20 token to withdraw.\n function withdrawAsset(\n bytes assetData,\n uint256 amount\n )\n external;\n}\n",
+ "extensions/Forwarder/mixins/MExchangeWrapper.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../../protocol/Exchange/libs/LibOrder.sol\";\nimport \"../../../protocol/Exchange/libs/LibFillResults.sol\";\n\n\ncontract MExchangeWrapper {\n\n /// @dev Fills the input order.\n /// Returns false if the transaction would otherwise revert.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of WETH has been sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param wethSellAmount Desired amount of WETH to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellWeth(\n LibOrder.Order[] memory orders,\n uint256 wethSellAmount,\n bytes[] memory signatures\n )\n internal\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// The asset being sold by taker must always be WETH.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyExactAmountWithWeth(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n internal\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Buys zrxBuyAmount of ZRX fee tokens, taking into account ZRX fees for each order. This will guarantee\n /// that at least zrxBuyAmount of ZRX is purchased (sometimes slightly over due to rounding issues).\n /// It is possible that a request to buy 200 ZRX will require purchasing 202 ZRX\n /// as 2 ZRX is required to purchase the 200 ZRX fee tokens. This guarantees at least 200 ZRX for future purchases.\n /// The asset being sold by taker must always be WETH. \n /// @param orders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset.\n /// @param zrxBuyAmount Desired amount of ZRX to buy.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return totalFillResults Amounts filled and fees paid by maker and taker.\n function marketBuyExactZrxWithWeth(\n LibOrder.Order[] memory orders,\n uint256 zrxBuyAmount,\n bytes[] memory signatures\n )\n internal\n returns (LibFillResults.FillResults memory totalFillResults);\n}\n",
+ "extensions/Forwarder/interfaces/IForwarderCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../../protocol/Exchange/libs/LibOrder.sol\";\nimport \"../../../protocol/Exchange/libs/LibFillResults.sol\";\n\n\ncontract IForwarderCore {\n\n /// @dev Purchases as much of orders' makerAssets as possible by selling up to 95% of transaction's ETH value.\n /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.\n /// 5% of ETH value is reserved for paying fees to order feeRecipients (in ZRX) and forwarding contract feeRecipient (in ETH).\n /// Any ETH not spent will be refunded to sender.\n /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset. \n /// @param signatures Proofs that orders have been created by makers.\n /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.\n /// @param feeSignatures Proofs that feeOrders have been created by makers.\n /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.\n /// @param feeRecipient Address that will receive ETH when orders are filled.\n /// @return Amounts filled and fees paid by maker and taker for both sets of orders.\n function marketSellOrdersWithEth(\n LibOrder.Order[] memory orders,\n bytes[] memory signatures,\n LibOrder.Order[] memory feeOrders,\n bytes[] memory feeSignatures,\n uint256 feePercentage,\n address feeRecipient\n )\n public\n payable\n returns (\n LibFillResults.FillResults memory orderFillResults,\n LibFillResults.FillResults memory feeOrderFillResults\n );\n\n /// @dev Attempt to purchase makerAssetFillAmount of makerAsset by selling ETH provided with transaction.\n /// Any ZRX required to pay fees for primary orders will automatically be purchased by this contract.\n /// Any ETH not spent will be refunded to sender.\n /// @param orders Array of order specifications used containing desired makerAsset and WETH as takerAsset. \n /// @param makerAssetFillAmount Desired amount of makerAsset to purchase.\n /// @param signatures Proofs that orders have been created by makers.\n /// @param feeOrders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset. Used to purchase ZRX for primary order fees.\n /// @param feeSignatures Proofs that feeOrders have been created by makers.\n /// @param feePercentage Percentage of WETH sold that will payed as fee to forwarding contract feeRecipient.\n /// @param feeRecipient Address that will receive ETH when orders are filled.\n /// @return Amounts filled and fees paid by maker and taker for both sets of orders.\n function marketBuyOrdersWithEth(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures,\n LibOrder.Order[] memory feeOrders,\n bytes[] memory feeSignatures,\n uint256 feePercentage,\n address feeRecipient\n )\n public\n payable\n returns (\n LibFillResults.FillResults memory orderFillResults,\n LibFillResults.FillResults memory feeOrderFillResults\n );\n}\n",
+ "extensions/Forwarder/MixinAssets.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/LibBytes/LibBytes.sol\";\nimport \"../../utils/Ownable/Ownable.sol\";\nimport \"../../tokens/ERC20Token/IERC20Token.sol\";\nimport \"../../tokens/ERC721Token/IERC721Token.sol\";\nimport \"./libs/LibConstants.sol\";\nimport \"./mixins/MAssets.sol\";\n\n\ncontract MixinAssets is\n Ownable,\n LibConstants,\n MAssets\n{\n using LibBytes for bytes;\n\n bytes4 constant internal ERC20_TRANSFER_SELECTOR = bytes4(keccak256(\"transfer(address,uint256)\"));\n\n /// @dev Withdraws assets from this contract. The contract requires a ZRX balance in order to \n /// function optimally, and this function allows the ZRX to be withdrawn by owner. It may also be\n /// used to withdraw assets that were accidentally sent to this contract.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param amount Amount of ERC20 token to withdraw.\n function withdrawAsset(\n bytes assetData,\n uint256 amount\n )\n external\n onlyOwner\n {\n transferAssetToSender(assetData, amount);\n }\n\n /// @dev Transfers given amount of asset to sender.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param amount Amount of asset to transfer to sender.\n function transferAssetToSender(\n bytes memory assetData,\n uint256 amount\n )\n internal\n {\n bytes4 proxyId = assetData.readBytes4(0);\n\n if (proxyId == ERC20_DATA_ID) {\n transferERC20Token(assetData, amount);\n } else if (proxyId == ERC721_DATA_ID) {\n transferERC721Token(assetData, amount);\n } else {\n revert(\"UNSUPPORTED_ASSET_PROXY\");\n }\n }\n\n /// @dev Decodes ERC20 assetData and transfers given amount to sender.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param amount Amount of asset to transfer to sender.\n function transferERC20Token(\n bytes memory assetData,\n uint256 amount\n )\n internal\n {\n address token = assetData.readAddress(16);\n\n // Transfer tokens.\n // We do a raw call so we can check the success separate\n // from the return data.\n bool success = token.call(abi.encodeWithSelector(\n ERC20_TRANSFER_SELECTOR,\n msg.sender,\n amount\n ));\n require(\n success,\n \"TRANSFER_FAILED\"\n );\n \n // Check return data.\n // If there is no return data, we assume the token incorrectly\n // does not return a bool. In this case we expect it to revert\n // on failure, which was handled above.\n // If the token does return data, we require that it is a single\n // value that evaluates to true.\n assembly {\n if returndatasize {\n success := 0\n if eq(returndatasize, 32) {\n // First 64 bytes of memory are reserved scratch space\n returndatacopy(0, 0, 32)\n success := mload(0)\n }\n }\n }\n require(\n success,\n \"TRANSFER_FAILED\"\n );\n }\n\n /// @dev Decodes ERC721 assetData and transfers given amount to sender.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param amount Amount of asset to transfer to sender.\n function transferERC721Token(\n bytes memory assetData,\n uint256 amount\n )\n internal\n {\n require(\n amount == 1,\n \"INVALID_AMOUNT\"\n );\n // Decode asset data.\n address token = assetData.readAddress(16);\n uint256 tokenId = assetData.readUint256(36);\n\n // Perform transfer.\n IERC721Token(token).transferFrom(\n address(this),\n msg.sender,\n tokenId\n );\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n",
+ "tokens/ERC721Token/IERC721Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC721Token {\n\n /// @dev This emits when ownership of any NFT changes by any mechanism.\n /// This event emits when NFTs are created (`from` == 0) and destroyed\n /// (`to` == 0). Exception: during contract creation, any number of NFTs\n /// may be created and assigned without emitting Transfer. At the time of\n /// any transfer, the approved address for that NFT (if any) is reset to none.\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 indexed _tokenId\n );\n\n /// @dev This emits when the approved address for an NFT is changed or\n /// reaffirmed. The zero address indicates there is no approved address.\n /// When a Transfer event emits, this also indicates that the approved\n /// address for that NFT (if any) is reset to none.\n event Approval(\n address indexed _owner,\n address indexed _approved,\n uint256 indexed _tokenId\n );\n\n /// @dev This emits when an operator is enabled or disabled for an owner.\n /// The operator can manage all NFTs of the owner.\n event ApprovalForAll(\n address indexed _owner,\n address indexed _operator,\n bool _approved\n );\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// perator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT. When transfer is complete, this function\n /// checks if `_to` is a smart contract (code size > 0). If so, it calls\n /// `onERC721Received` on `_to` and throws if the return value is not\n /// `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n /// @param _data Additional data with no specified format, sent in call to `_to`\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes _data\n )\n external;\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev This works identically to the other function with an extra data parameter,\n /// except this function just sets data to \"\".\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n external;\n\n /// @notice Change or reaffirm the approved address for an NFT\n /// @dev The zero address indicates there is no approved address.\n /// Throws unless `msg.sender` is the current NFT owner, or an authorized\n /// operator of the current owner.\n /// @param _approved The new approved NFT controller\n /// @param _tokenId The NFT to approve\n function approve(address _approved, uint256 _tokenId)\n external;\n\n /// @notice Enable or disable approval for a third party (\"operator\") to manage\n /// all of `msg.sender`'s assets\n /// @dev Emits the ApprovalForAll event. The contract MUST allow\n /// multiple operators per owner.\n /// @param _operator Address to add to the set of authorized operators\n /// @param _approved True if the operator is approved, false to revoke approval\n function setApprovalForAll(address _operator, bool _approved)\n external;\n\n /// @notice Count all NFTs assigned to an owner\n /// @dev NFTs assigned to the zero address are considered invalid, and this\n /// function throws for queries about the zero address.\n /// @param _owner An address for whom to query the balance\n /// @return The number of NFTs owned by `_owner`, possibly zero\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n /// THEY MAY BE PERMANENTLY LOST\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function transferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n public;\n\n /// @notice Find the owner of an NFT\n /// @dev NFTs assigned to zero address are considered invalid, and queries\n /// about them do throw.\n /// @param _tokenId The identifier for an NFT\n /// @return The address of the owner of the NFT\n function ownerOf(uint256 _tokenId)\n public\n view\n returns (address);\n\n /// @notice Get the approved address for a single NFT\n /// @dev Throws if `_tokenId` is not a valid NFT.\n /// @param _tokenId The NFT to find the approved address for\n /// @return The approved address for this NFT, or the zero address if there is none\n function getApproved(uint256 _tokenId) \n public\n view\n returns (address);\n \n /// @notice Query if an address is an authorized operator for another address\n /// @param _owner The address that owns the NFTs\n /// @param _operator The address that acts on behalf of the owner\n /// @return True if `_operator` is an approved operator for `_owner`, false otherwise\n function isApprovedForAll(address _owner, address _operator)\n public\n view\n returns (bool);\n}\n",
+ "extensions/Forwarder/MixinExchangeWrapper.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./libs/LibConstants.sol\";\nimport \"./mixins/MExchangeWrapper.sol\";\nimport \"../../protocol/Exchange/libs/LibAbiEncoder.sol\";\nimport \"../../protocol/Exchange/libs/LibOrder.sol\";\nimport \"../../protocol/Exchange/libs/LibFillResults.sol\";\nimport \"../../protocol/Exchange/libs/LibMath.sol\";\n\n\ncontract MixinExchangeWrapper is\n LibAbiEncoder,\n LibFillResults,\n LibMath,\n LibConstants,\n MExchangeWrapper\n{\n /// @dev Fills the input order.\n /// Returns false if the transaction would otherwise revert.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n returns (FillResults memory fillResults)\n {\n // ABI encode calldata for `fillOrder`\n bytes memory fillOrderCalldata = abiEncodeFillOrder(\n order,\n takerAssetFillAmount,\n signature\n );\n\n address exchange = address(EXCHANGE);\n\n // Call `fillOrder` and handle any exceptions gracefully\n assembly {\n let success := call(\n gas, // forward all gas\n exchange, // call address of Exchange contract\n 0, // transfer 0 wei\n add(fillOrderCalldata, 32), // pointer to start of input (skip array length in first 32 bytes)\n mload(fillOrderCalldata), // length of input\n fillOrderCalldata, // write output over input\n 128 // output size is 128 bytes\n )\n if success {\n mstore(fillResults, mload(fillOrderCalldata))\n mstore(add(fillResults, 32), mload(add(fillOrderCalldata, 32)))\n mstore(add(fillResults, 64), mload(add(fillOrderCalldata, 64)))\n mstore(add(fillResults, 96), mload(add(fillOrderCalldata, 96)))\n }\n }\n // fillResults values will be 0 by default if call was unsuccessful\n return fillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of WETH has been sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param wethSellAmount Desired amount of WETH to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellWeth(\n LibOrder.Order[] memory orders,\n uint256 wethSellAmount,\n bytes[] memory signatures\n )\n internal\n returns (FillResults memory totalFillResults)\n {\n bytes memory makerAssetData = orders[0].makerAssetData;\n bytes memory wethAssetData = WETH_ASSET_DATA;\n\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // We assume that asset being bought by taker is the same for each order.\n // We assume that asset being sold by taker is WETH for each order.\n orders[i].makerAssetData = makerAssetData;\n orders[i].takerAssetData = wethAssetData;\n\n // Calculate the remaining amount of WETH to sell\n uint256 remainingTakerAssetFillAmount = safeSub(wethSellAmount, totalFillResults.takerAssetFilledAmount);\n\n // Attempt to sell the remaining amount of WETH\n FillResults memory singleFillResults = fillOrderNoThrow(\n orders[i],\n remainingTakerAssetFillAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker\n addFillResults(totalFillResults, singleFillResults);\n\n // Stop execution if the entire amount of takerAsset has been sold\n if (totalFillResults.takerAssetFilledAmount >= wethSellAmount) {\n break;\n }\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// The asset being sold by taker must always be WETH.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyExactAmountWithWeth(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n internal\n returns (FillResults memory totalFillResults)\n {\n bytes memory makerAssetData = orders[0].makerAssetData;\n bytes memory wethAssetData = WETH_ASSET_DATA;\n\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // We assume that asset being bought by taker is the same for each order.\n // We assume that asset being sold by taker is WETH for each order.\n orders[i].makerAssetData = makerAssetData;\n orders[i].takerAssetData = wethAssetData;\n\n // Calculate the remaining amount of makerAsset to buy\n uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);\n\n // Convert the remaining amount of makerAsset to buy into remaining amount\n // of takerAsset to sell, assuming entire amount can be sold in the current order.\n // We round up because the exchange rate computed by fillOrder rounds in favor\n // of the Maker. In this case we want to overestimate the amount of takerAsset.\n uint256 remainingTakerAssetFillAmount = getPartialAmountCeil(\n orders[i].takerAssetAmount,\n orders[i].makerAssetAmount,\n remainingMakerAssetFillAmount\n );\n\n // Attempt to sell the remaining amount of takerAsset\n FillResults memory singleFillResults = fillOrderNoThrow(\n orders[i],\n remainingTakerAssetFillAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker\n addFillResults(totalFillResults, singleFillResults);\n\n // Stop execution if the entire amount of makerAsset has been bought\n uint256 makerAssetFilledAmount = totalFillResults.makerAssetFilledAmount;\n if (makerAssetFilledAmount >= makerAssetFillAmount) {\n break;\n }\n }\n\n require(\n makerAssetFilledAmount >= makerAssetFillAmount,\n \"COMPLETE_FILL_FAILED\"\n );\n return totalFillResults;\n }\n\n /// @dev Buys zrxBuyAmount of ZRX fee tokens, taking into account ZRX fees for each order. This will guarantee\n /// that at least zrxBuyAmount of ZRX is purchased (sometimes slightly over due to rounding issues).\n /// It is possible that a request to buy 200 ZRX will require purchasing 202 ZRX\n /// as 2 ZRX is required to purchase the 200 ZRX fee tokens. This guarantees at least 200 ZRX for future purchases.\n /// The asset being sold by taker must always be WETH. \n /// @param orders Array of order specifications containing ZRX as makerAsset and WETH as takerAsset.\n /// @param zrxBuyAmount Desired amount of ZRX to buy.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return totalFillResults Amounts filled and fees paid by maker and taker.\n function marketBuyExactZrxWithWeth(\n LibOrder.Order[] memory orders,\n uint256 zrxBuyAmount,\n bytes[] memory signatures\n )\n internal\n returns (FillResults memory totalFillResults)\n {\n // Do nothing if zrxBuyAmount == 0\n if (zrxBuyAmount == 0) {\n return totalFillResults;\n }\n\n bytes memory zrxAssetData = ZRX_ASSET_DATA;\n bytes memory wethAssetData = WETH_ASSET_DATA;\n uint256 zrxPurchased = 0;\n\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // All of these are ZRX/WETH, so we can drop the respective assetData from calldata.\n orders[i].makerAssetData = zrxAssetData;\n orders[i].takerAssetData = wethAssetData;\n\n // Calculate the remaining amount of ZRX to buy.\n uint256 remainingZrxBuyAmount = safeSub(zrxBuyAmount, zrxPurchased);\n\n // Convert the remaining amount of ZRX to buy into remaining amount\n // of WETH to sell, assuming entire amount can be sold in the current order.\n // We round up because the exchange rate computed by fillOrder rounds in favor\n // of the Maker. In this case we want to overestimate the amount of takerAsset.\n uint256 remainingWethSellAmount = getPartialAmountCeil(\n orders[i].takerAssetAmount,\n safeSub(orders[i].makerAssetAmount, orders[i].takerFee), // our exchange rate after fees \n remainingZrxBuyAmount\n );\n\n // Attempt to sell the remaining amount of WETH.\n FillResults memory singleFillResult = fillOrderNoThrow(\n orders[i],\n remainingWethSellAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker.\n addFillResults(totalFillResults, singleFillResult);\n zrxPurchased = safeSub(totalFillResults.makerAssetFilledAmount, totalFillResults.takerFeePaid);\n\n // Stop execution if the entire amount of ZRX has been bought.\n if (zrxPurchased >= zrxBuyAmount) {\n break;\n }\n }\n\n require(\n zrxPurchased >= zrxBuyAmount,\n \"COMPLETE_FILL_FAILED\"\n );\n return totalFillResults;\n }\n}\n",
+ "protocol/Exchange/libs/LibAbiEncoder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./LibOrder.sol\";\n\n\ncontract LibAbiEncoder {\n\n /// @dev ABI encodes calldata for `fillOrder`.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return ABI encoded calldata for `fillOrder`.\n function abiEncodeFillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n pure\n returns (bytes memory fillOrderCalldata)\n {\n // We need to call MExchangeCore.fillOrder using a delegatecall in\n // assembly so that we can intercept a call that throws. For this, we\n // need the input encoded in memory in the Ethereum ABIv2 format [1].\n\n // | Area | Offset | Length | Contents |\n // | -------- |--------|---------|-------------------------------------------- |\n // | Header | 0x00 | 4 | function selector |\n // | Params | | 3 * 32 | function parameters: |\n // | | 0x00 | | 1. offset to order (*) |\n // | | 0x20 | | 2. takerAssetFillAmount |\n // | | 0x40 | | 3. offset to signature (*) |\n // | Data | | 12 * 32 | order: |\n // | | 0x000 | | 1. senderAddress |\n // | | 0x020 | | 2. makerAddress |\n // | | 0x040 | | 3. takerAddress |\n // | | 0x060 | | 4. feeRecipientAddress |\n // | | 0x080 | | 5. makerAssetAmount |\n // | | 0x0A0 | | 6. takerAssetAmount |\n // | | 0x0C0 | | 7. makerFeeAmount |\n // | | 0x0E0 | | 8. takerFeeAmount |\n // | | 0x100 | | 9. expirationTimeSeconds |\n // | | 0x120 | | 10. salt |\n // | | 0x140 | | 11. Offset to makerAssetData (*) |\n // | | 0x160 | | 12. Offset to takerAssetData (*) |\n // | | 0x180 | 32 | makerAssetData Length |\n // | | 0x1A0 | ** | makerAssetData Contents |\n // | | 0x1C0 | 32 | takerAssetData Length |\n // | | 0x1E0 | ** | takerAssetData Contents |\n // | | 0x200 | 32 | signature Length |\n // | | 0x220 | ** | signature Contents |\n\n // * Offsets are calculated from the beginning of the current area: Header, Params, Data:\n // An offset stored in the Params area is calculated from the beginning of the Params section.\n // An offset stored in the Data area is calculated from the beginning of the Data section.\n\n // ** The length of dynamic array contents are stored in the field immediately preceeding the contents.\n\n // [1]: https://solidity.readthedocs.io/en/develop/abi-spec.html\n\n assembly {\n\n // Areas below may use the following variables:\n // 1. <area>Start -- Start of this area in memory\n // 2. <area>End -- End of this area in memory. This value may\n // be precomputed (before writing contents),\n // or it may be computed as contents are written.\n // 3. <area>Offset -- Current offset into area. If an area's End\n // is precomputed, this variable tracks the\n // offsets of contents as they are written.\n\n /////// Setup Header Area ///////\n // Load free memory pointer\n fillOrderCalldata := mload(0x40)\n // bytes4(keccak256(\"fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)\"))\n // = 0xb4be83d5\n // Leave 0x20 bytes to store the length\n mstore(add(fillOrderCalldata, 0x20), 0xb4be83d500000000000000000000000000000000000000000000000000000000)\n let headerAreaEnd := add(fillOrderCalldata, 0x24)\n\n /////// Setup Params Area ///////\n // This area is preallocated and written to later.\n // This is because we need to fill in offsets that have not yet been calculated.\n let paramsAreaStart := headerAreaEnd\n let paramsAreaEnd := add(paramsAreaStart, 0x60)\n let paramsAreaOffset := paramsAreaStart\n\n /////// Setup Data Area ///////\n let dataAreaStart := paramsAreaEnd\n let dataAreaEnd := dataAreaStart\n\n // Offset from the source data we're reading from\n let sourceOffset := order\n // arrayLenBytes and arrayLenWords track the length of a dynamically-allocated bytes array.\n let arrayLenBytes := 0\n let arrayLenWords := 0\n\n /////// Write order Struct ///////\n // Write memory location of Order, relative to the start of the\n // parameter list, then increment the paramsAreaOffset respectively.\n mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))\n paramsAreaOffset := add(paramsAreaOffset, 0x20)\n\n // Write values for each field in the order\n // It would be nice to use a loop, but we save on gas by writing\n // the stores sequentially.\n mstore(dataAreaEnd, mload(sourceOffset)) // makerAddress\n mstore(add(dataAreaEnd, 0x20), mload(add(sourceOffset, 0x20))) // takerAddress\n mstore(add(dataAreaEnd, 0x40), mload(add(sourceOffset, 0x40))) // feeRecipientAddress\n mstore(add(dataAreaEnd, 0x60), mload(add(sourceOffset, 0x60))) // senderAddress\n mstore(add(dataAreaEnd, 0x80), mload(add(sourceOffset, 0x80))) // makerAssetAmount\n mstore(add(dataAreaEnd, 0xA0), mload(add(sourceOffset, 0xA0))) // takerAssetAmount\n mstore(add(dataAreaEnd, 0xC0), mload(add(sourceOffset, 0xC0))) // makerFeeAmount\n mstore(add(dataAreaEnd, 0xE0), mload(add(sourceOffset, 0xE0))) // takerFeeAmount\n mstore(add(dataAreaEnd, 0x100), mload(add(sourceOffset, 0x100))) // expirationTimeSeconds\n mstore(add(dataAreaEnd, 0x120), mload(add(sourceOffset, 0x120))) // salt\n mstore(add(dataAreaEnd, 0x140), mload(add(sourceOffset, 0x140))) // Offset to makerAssetData\n mstore(add(dataAreaEnd, 0x160), mload(add(sourceOffset, 0x160))) // Offset to takerAssetData\n dataAreaEnd := add(dataAreaEnd, 0x180)\n sourceOffset := add(sourceOffset, 0x180)\n\n // Write offset to <order.makerAssetData>\n mstore(add(dataAreaStart, mul(10, 0x20)), sub(dataAreaEnd, dataAreaStart))\n\n // Calculate length of <order.makerAssetData>\n sourceOffset := mload(add(order, 0x140)) // makerAssetData\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of <order.makerAssetData>\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of <order.makerAssetData>\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n // Write offset to <order.takerAssetData>\n mstore(add(dataAreaStart, mul(11, 0x20)), sub(dataAreaEnd, dataAreaStart))\n\n // Calculate length of <order.takerAssetData>\n sourceOffset := mload(add(order, 0x160)) // takerAssetData\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of <order.takerAssetData>\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of <order.takerAssetData>\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n /////// Write takerAssetFillAmount ///////\n mstore(paramsAreaOffset, takerAssetFillAmount)\n paramsAreaOffset := add(paramsAreaOffset, 0x20)\n\n /////// Write signature ///////\n // Write offset to paramsArea\n mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))\n\n // Calculate length of signature\n sourceOffset := signature\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of signature\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of signature\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n // Set length of calldata\n mstore(fillOrderCalldata, sub(dataAreaEnd, add(fillOrderCalldata, 0x20)))\n\n // Increment free memory pointer\n mstore(0x40, dataAreaEnd)\n }\n\n return fillOrderCalldata;\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0xc38fc1254bfaafefd27df73c5c812d8fd029e5dc01f313c5563dcb1a5a0bd65f",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/IAssetData.json b/packages/contracts/generated-artifacts/IAssetData.json
new file mode 100644
index 000000000..6a3ab6635
--- /dev/null
+++ b/packages/contracts/generated-artifacts/IAssetData.json
@@ -0,0 +1,89 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "IAssetData",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "tokenContract",
+ "type": "address"
+ },
+ {
+ "name": "tokenId",
+ "type": "uint256"
+ },
+ {
+ "name": "receiverData",
+ "type": "bytes"
+ }
+ ],
+ "name": "ERC721Token",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "tokenContract",
+ "type": "address"
+ }
+ ],
+ "name": "ERC20Token",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x",
+ "opcodes": "",
+ "sourceMap": ""
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x",
+ "opcodes": "",
+ "sourceMap": ""
+ }
+ }
+ },
+ "sources": {
+ "protocol/AssetProxy/interfaces/IAssetData.sol": {
+ "id": 21
+ }
+ },
+ "sourceCodes": {
+ "protocol/AssetProxy/interfaces/IAssetData.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\n// solhint-disable\npragma solidity 0.4.24;\n\n\n// @dev Interface of the asset proxy's assetData.\n// The asset proxies take an ABI encoded `bytes assetData` as argument.\n// This argument is ABI encoded as one of the methods of this interface.\ninterface IAssetData {\n\n function ERC20Token(address tokenContract)\n external\n pure;\n \n function ERC721Token(\n address tokenContract,\n uint256 tokenId,\n bytes receiverData\n )\n external\n pure;\n \n}\n"
+ },
+ "sourceTreeHashHex": "0x10f0df50f72cf7bac6d3719d59a2653e09ef05b38f349efd7d9417e844e165ca",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/IAssetProxy.json b/packages/contracts/generated-artifacts/IAssetProxy.json
new file mode 100644
index 000000000..970546205
--- /dev/null
+++ b/packages/contracts/generated-artifacts/IAssetProxy.json
@@ -0,0 +1,175 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "IAssetProxy",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "addAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "removeAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "removeAuthorizedAddressAtIndex",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "assetData",
+ "type": "bytes"
+ },
+ {
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getProxyId",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getAuthorizedAddresses",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x",
+ "opcodes": "",
+ "sourceMap": ""
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x",
+ "opcodes": "",
+ "sourceMap": ""
+ }
+ }
+ },
+ "sources": {
+ "protocol/AssetProxy/interfaces/IAssetProxy.sol": {
+ "id": 22
+ },
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": {
+ "id": 23
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ }
+ },
+ "sourceCodes": {
+ "protocol/AssetProxy/interfaces/IAssetProxy.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IAuthorizable.sol\";\n\n\ncontract IAssetProxy is\n IAuthorizable\n{\n /// @dev Transfers assets. Either succeeds or throws.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param from Address to transfer asset from.\n /// @param to Address to transfer asset to.\n /// @param amount Amount of asset to transfer.\n function transferFrom(\n bytes assetData,\n address from,\n address to,\n uint256 amount\n )\n external;\n \n /// @dev Gets the proxy id associated with the proxy address.\n /// @return Proxy id.\n function getProxyId()\n external\n pure\n returns (bytes4);\n}\n",
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/Ownable/IOwnable.sol\";\n\n\ncontract IAuthorizable is\n IOwnable\n{\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n \n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory);\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n"
+ },
+ "sourceTreeHashHex": "0xf9feee3358dbdc75f0486e970640a83087da05b8c6ddded318abd3b972513adf",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/IValidator.json b/packages/contracts/generated-artifacts/IValidator.json
new file mode 100644
index 000000000..3d7e604f8
--- /dev/null
+++ b/packages/contracts/generated-artifacts/IValidator.json
@@ -0,0 +1,80 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "IValidator",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x",
+ "opcodes": "",
+ "sourceMap": ""
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x",
+ "opcodes": "",
+ "sourceMap": ""
+ }
+ }
+ },
+ "sources": {
+ "protocol/Exchange/interfaces/IValidator.sol": {
+ "id": 39
+ }
+ },
+ "sourceCodes": {
+ "protocol/Exchange/interfaces/IValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IValidator {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n"
+ },
+ "sourceTreeHashHex": "0x560b257f8a4e1420a4586d5ba0c40e74042ef5af0f53aad412951444ea710a7e",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/IWallet.json b/packages/contracts/generated-artifacts/IWallet.json
new file mode 100644
index 000000000..a65caae21
--- /dev/null
+++ b/packages/contracts/generated-artifacts/IWallet.json
@@ -0,0 +1,76 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "IWallet",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x",
+ "opcodes": "",
+ "sourceMap": ""
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x",
+ "opcodes": "",
+ "sourceMap": ""
+ }
+ }
+ },
+ "sources": {
+ "protocol/Exchange/interfaces/IWallet.sol": {
+ "id": 40
+ }
+ },
+ "sourceCodes": {
+ "protocol/Exchange/interfaces/IWallet.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IWallet {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n"
+ },
+ "sourceTreeHashHex": "0x70b7d3c15ab87e6b4b1011d194282163232dfd88486038e4120d6bf245d58e44",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/InvalidERC721Receiver.json b/packages/contracts/generated-artifacts/InvalidERC721Receiver.json
new file mode 100644
index 000000000..fd7f2884a
--- /dev/null
+++ b/packages/contracts/generated-artifacts/InvalidERC721Receiver.json
@@ -0,0 +1,115 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "InvalidERC721Receiver",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_operator",
+ "type": "address"
+ },
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_tokenId",
+ "type": "uint256"
+ },
+ {
+ "name": "_data",
+ "type": "bytes"
+ }
+ ],
+ "name": "onERC721Received",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "operator",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "tokenId",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "name": "TokenReceived",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b50610210806100206000396000f3006080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663150b7a028114610045575b600080fd5b34801561005157600080fd5b5061008b73ffffffffffffffffffffffffffffffffffffffff600480358216916024803590911691604435916064359081019101356100c0565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b60007f5343d39c46825e39cfee854256354ed1b3837af99997a3242ae29e831889773c8686868686604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001828103825284848281815260200192508082843760405192018290039850909650505050505050a150604080517f6f6e455243373231526563656976656428616464726573732c75696e7432353681527f2c6279746573290000000000000000000000000000000000000000000000000060208201529051908190036027019020959450505050505600a165627a7a72305820be03706008be4cebda2cf3293514a86dce35c252ca36280c5cb6cf7206e4693d0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x210 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x40 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x150B7A02 DUP2 EQ PUSH2 0x45 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x51 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x8B PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 DUP1 CALLDATALOAD DUP3 AND SWAP2 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 SWAP2 AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 PUSH1 0x64 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0xC0 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH32 0x5343D39C46825E39CFEE854256354ED1B3837AF99997A3242AE29E831889773C DUP7 DUP7 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD DUP1 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP5 DUP3 DUP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP9 POP SWAP1 SWAP7 POP POP POP POP POP POP POP LOG1 POP PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C75696E74323536 DUP2 MSTORE PUSH32 0x2C62797465732900000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x27 ADD SWAP1 KECCAK256 SWAP6 SWAP5 POP POP POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xbe SUB PUSH17 0x6008BE4CEBDA2CF3293514A86DCE35C252 0xca CALLDATASIZE 0x28 0xc 0x5c 0xb6 0xcf PUSH19 0x6E4693D002900000000000000000000000000 ",
+ "sourceMap": "662:1522:59:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;662:1522:59;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663150b7a028114610045575b600080fd5b34801561005157600080fd5b5061008b73ffffffffffffffffffffffffffffffffffffffff600480358216916024803590911691604435916064359081019101356100c0565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b60007f5343d39c46825e39cfee854256354ed1b3837af99997a3242ae29e831889773c8686868686604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001828103825284848281815260200192508082843760405192018290039850909650505050505050a150604080517f6f6e455243373231526563656976656428616464726573732c75696e7432353681527f2c6279746573290000000000000000000000000000000000000000000000000060208201529051908190036027019020959450505050505600a165627a7a72305820be03706008be4cebda2cf3293514a86dce35c252ca36280c5cb6cf7206e4693d0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x40 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x150B7A02 DUP2 EQ PUSH2 0x45 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x51 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x8B PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 DUP1 CALLDATALOAD DUP3 AND SWAP2 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 SWAP2 AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 PUSH1 0x64 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0xC0 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH32 0x5343D39C46825E39CFEE854256354ED1B3837AF99997A3242AE29E831889773C DUP7 DUP7 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD DUP1 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP5 DUP3 DUP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP9 POP SWAP1 SWAP7 POP POP POP POP POP POP POP LOG1 POP PUSH1 0x40 DUP1 MLOAD PUSH32 0x6F6E455243373231526563656976656428616464726573732C75696E74323536 DUP2 MSTORE PUSH32 0x2C62797465732900000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x27 ADD SWAP1 KECCAK256 SWAP6 SWAP5 POP POP POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xbe SUB PUSH17 0x6008BE4CEBDA2CF3293514A86DCE35C252 0xca CALLDATASIZE 0x28 0xc 0x5c 0xb6 0xcf PUSH19 0x6E4693D002900000000000000000000000000 ",
+ "sourceMap": "662:1522:59:-;;;;;;;;;;;;;;;;;;;;;;;1839:343;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1839:343:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2002:6;2029:106;2056:9;2079:5;2098:8;2120:5;;2029:106;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2029:106:59;;-1:-1:-1;;;;;;;2029:106:59;-1:-1:-1;866:52:59;;;;;;;;;;;;;;;;;;;;;1839:343;;;;;;;:::o"
+ }
+ }
+ },
+ "sources": {
+ "test/DummyERC721Receiver/InvalidERC721Receiver.sol": {
+ "id": 59
+ },
+ "tokens/ERC721Token/IERC721Receiver.sol": {
+ "id": 75
+ }
+ },
+ "sourceCodes": {
+ "test/DummyERC721Receiver/InvalidERC721Receiver.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../tokens/ERC721Token/IERC721Receiver.sol\";\n\n\ncontract InvalidERC721Receiver is\n IERC721Receiver\n{\n // Actual function signature is `onERC721Received(address,address,uint256,bytes)`\n bytes4 constant internal INVALID_ERC721_RECEIVED = bytes4(keccak256(\"onERC721Received(address,uint256,bytes)\"));\n\n event TokenReceived(\n address operator,\n address from,\n uint256 tokenId,\n bytes data\n );\n\n /// @notice Handle the receipt of an NFT\n /// @dev The ERC721 smart contract calls this function on the recipient\n /// after a `transfer`. This function MAY throw to revert and reject the\n /// transfer. Return of other than the magic value MUST result in the\n /// transaction being reverted.\n /// Note: the contract address is always the message sender.\n /// @param _operator The address which called `safeTransferFrom` function\n /// @param _from The address which previously owned the token\n /// @param _tokenId The NFT identifier which is being transferred\n /// @param _data Additional data with no specified format\n /// @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n /// unless throwing\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes _data\n )\n external\n returns (bytes4)\n {\n emit TokenReceived(\n _operator,\n _from,\n _tokenId,\n _data\n );\n return INVALID_ERC721_RECEIVED;\n }\n}\n",
+ "tokens/ERC721Token/IERC721Receiver.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC721Receiver {\n\n /// @notice Handle the receipt of an NFT\n /// @dev The ERC721 smart contract calls this function on the recipient\n /// after a `transfer`. This function MAY throw to revert and reject the\n /// transfer. Return of other than the magic value MUST result in the\n /// transaction being reverted.\n /// Note: the contract address is always the message sender.\n /// @param _operator The address which called `safeTransferFrom` function\n /// @param _from The address which previously owned the token\n /// @param _tokenId The NFT identifier which is being transferred\n /// @param _data Additional data with no specified format\n /// @return `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`\n /// unless throwing\n function onERC721Received(\n address _operator,\n address _from,\n uint256 _tokenId,\n bytes _data\n )\n external\n returns (bytes4);\n}\n"
+ },
+ "sourceTreeHashHex": "0xa1e9bac07367f1d9394aa63c5e739d5abdde20c17d09a223e4f5635bf45ec2a4",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/MixinAuthorizable.json b/packages/contracts/generated-artifacts/MixinAuthorizable.json
new file mode 100644
index 000000000..24bf3e273
--- /dev/null
+++ b/packages/contracts/generated-artifacts/MixinAuthorizable.json
@@ -0,0 +1,229 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "MixinAuthorizable",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "addAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "authorities",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "removeAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "removeAuthorizedAddressAtIndex",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "authorized",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getAuthorizedAddresses",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "AuthorizedAddressAdded",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "AuthorizedAddressRemoved",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405260008054600160a060020a03191633179055610d15806100256000396000f30060806040526004361061008d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166342f1181e8114610092578063494503d4146100c257806370712939146101035780638da5cb5b146101315780639ad2674414610146578063b918161114610177578063d39de6e9146101b9578063f2fde38b1461021e575b600080fd5b34801561009e57600080fd5b506100c073ffffffffffffffffffffffffffffffffffffffff6004351661024c565b005b3480156100ce57600080fd5b506100da600435610438565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561010f57600080fd5b506100c073ffffffffffffffffffffffffffffffffffffffff6004351661046d565b34801561013d57600080fd5b506100da610766565b34801561015257600080fd5b506100c073ffffffffffffffffffffffffffffffffffffffff60043516602435610782565b34801561018357600080fd5b506101a573ffffffffffffffffffffffffffffffffffffffff60043516610b37565b604080519115158252519081900360200190f35b3480156101c557600080fd5b506101ce610b4c565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561020a5781810151838201526020016101f2565b505050509050019250505060405180910390f35b34801561022a57600080fd5b506100c073ffffffffffffffffffffffffffffffffffffffff60043516610bbc565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff161561036757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b600280548290811061044657fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146104f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16151561058a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b60025481101561071f578173ffffffffffffffffffffffffffffffffffffffff1660028281548110151561060757fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561071757600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061065f57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069257fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906107119082610ca2565b5061071f565b6001016105d7565b604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff16331461080857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16151561089e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b600254811061090e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110151561093457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16146109c257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610a3d57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610a7057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610aef9082610ca2565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60016020526000908152604090205460ff1681565b60606002805480602002602001604051908101604052809291908181526020018280548015610bb157602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610b86575b505050505090505b90565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c4257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615610c9f57600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b815481835581811115610cc657600083815260209020610cc6918101908301610ccb565b505050565b610bb991905b80821115610ce55760008155600101610cd1565b50905600a165627a7a72305820620643e0b82ce88185d561cbe4bc3b6e8e8a23bf230e2cc87b292f64a040bec40029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE PUSH2 0xD15 DUP1 PUSH2 0x25 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x8D JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x42F1181E DUP2 EQ PUSH2 0x92 JUMPI DUP1 PUSH4 0x494503D4 EQ PUSH2 0xC2 JUMPI DUP1 PUSH4 0x70712939 EQ PUSH2 0x103 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x131 JUMPI DUP1 PUSH4 0x9AD26744 EQ PUSH2 0x146 JUMPI DUP1 PUSH4 0xB9181611 EQ PUSH2 0x177 JUMPI DUP1 PUSH4 0xD39DE6E9 EQ PUSH2 0x1B9 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x21E JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x9E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x24C JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xCE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xDA PUSH1 0x4 CALLDATALOAD PUSH2 0x438 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x10F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x46D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x13D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xDA PUSH2 0x766 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x152 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x782 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x183 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1A5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xB37 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1CE PUSH2 0xB4C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x20A JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1F2 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x22A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xBBC JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x2D2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x367 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F414C52454144595F415554484F52495A454400000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP4 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD SWAP3 DUP4 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0x405787FA12A823E0F2B7631CC41B3BA8828B3321CA811111FA75CD3AA3BB5ACE SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD CALLER SWAP3 SWAP2 PUSH32 0x3147867C59D17E8FA9D522465651D44AAE0A9E38F902F3475B97E58072F0ED4C SWAP2 LOG3 POP JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x446 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x4F4 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x58A JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST PUSH1 0x2 SLOAD DUP2 LT ISZERO PUSH2 0x71F JUMPI DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x607 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x717 JUMPI PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x65F JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0x692 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x711 SWAP1 DUP3 PUSH2 0xCA2 JUMP JUMPDEST POP PUSH2 0x71F JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0x5D7 JUMP JUMPDEST PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x808 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x89E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x2 SLOAD DUP2 LT PUSH2 0x90E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E4445585F4F55545F4F465F424F554E445300000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x934 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x9C2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1B PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x415554484F52495A45445F414444524553535F4D49534D415443480000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0xA3D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0xA70 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0xAEF SWAP1 DUP3 PUSH2 0xCA2 JUMP JUMPDEST POP PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x2 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0xBB1 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xB86 JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xC42 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0xC9F JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0xCC6 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0xCC6 SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0xCCB JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH2 0xBB9 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0xCE5 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0xCD1 JUMP JUMPDEST POP SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH3 0x643E0 0xb8 0x2c 0xe8 DUP2 DUP6 0xd5 PUSH2 0xCBE4 0xbc EXTCODESIZE PUSH15 0x8E8A23BF230E2CC87B292F64A040BE 0xc4 STOP 0x29 ",
+ "sourceMap": "686:2493:20:-;;;162:5:82;:18;;-1:-1:-1;;;;;;162:18:82;170:10;162:18;;;686:2493:20;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526004361061008d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166342f1181e8114610092578063494503d4146100c257806370712939146101035780638da5cb5b146101315780639ad2674414610146578063b918161114610177578063d39de6e9146101b9578063f2fde38b1461021e575b600080fd5b34801561009e57600080fd5b506100c073ffffffffffffffffffffffffffffffffffffffff6004351661024c565b005b3480156100ce57600080fd5b506100da600435610438565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561010f57600080fd5b506100c073ffffffffffffffffffffffffffffffffffffffff6004351661046d565b34801561013d57600080fd5b506100da610766565b34801561015257600080fd5b506100c073ffffffffffffffffffffffffffffffffffffffff60043516602435610782565b34801561018357600080fd5b506101a573ffffffffffffffffffffffffffffffffffffffff60043516610b37565b604080519115158252519081900360200190f35b3480156101c557600080fd5b506101ce610b4c565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561020a5781810151838201526020016101f2565b505050509050019250505060405180910390f35b34801561022a57600080fd5b506100c073ffffffffffffffffffffffffffffffffffffffff60043516610bbc565b60005473ffffffffffffffffffffffffffffffffffffffff1633146102d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff161561036757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b600280548290811061044657fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b6000805473ffffffffffffffffffffffffffffffffffffffff1633146104f457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16151561058a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b60025481101561071f578173ffffffffffffffffffffffffffffffffffffffff1660028281548110151561060757fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561071757600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061065f57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061069257fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906107119082610ca2565b5061071f565b6001016105d7565b604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff16331461080857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16151561089e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b600254811061090e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110151561093457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16146109c257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610a3d57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610a7057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610aef9082610ca2565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60016020526000908152604090205460ff1681565b60606002805480602002602001604051908101604052809291908181526020018280548015610bb157602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610b86575b505050505090505b90565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c4257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615610c9f57600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b815481835581811115610cc657600083815260209020610cc6918101908301610ccb565b505050565b610bb991905b80821115610ce55760008155600101610cd1565b50905600a165627a7a72305820620643e0b82ce88185d561cbe4bc3b6e8e8a23bf230e2cc87b292f64a040bec40029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x8D JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x42F1181E DUP2 EQ PUSH2 0x92 JUMPI DUP1 PUSH4 0x494503D4 EQ PUSH2 0xC2 JUMPI DUP1 PUSH4 0x70712939 EQ PUSH2 0x103 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x131 JUMPI DUP1 PUSH4 0x9AD26744 EQ PUSH2 0x146 JUMPI DUP1 PUSH4 0xB9181611 EQ PUSH2 0x177 JUMPI DUP1 PUSH4 0xD39DE6E9 EQ PUSH2 0x1B9 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x21E JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x9E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x24C JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xCE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xDA PUSH1 0x4 CALLDATALOAD PUSH2 0x438 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x10F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x46D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x13D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xDA PUSH2 0x766 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x152 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x782 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x183 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1A5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xB37 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1CE PUSH2 0xB4C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x20A JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1F2 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x22A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xBBC JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x2D2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x367 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F414C52454144595F415554484F52495A454400000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP4 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD SWAP3 DUP4 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0x405787FA12A823E0F2B7631CC41B3BA8828B3321CA811111FA75CD3AA3BB5ACE SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD CALLER SWAP3 SWAP2 PUSH32 0x3147867C59D17E8FA9D522465651D44AAE0A9E38F902F3475B97E58072F0ED4C SWAP2 LOG3 POP JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x446 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x4F4 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x58A JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST PUSH1 0x2 SLOAD DUP2 LT ISZERO PUSH2 0x71F JUMPI DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x607 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x717 JUMPI PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x65F JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0x692 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x711 SWAP1 DUP3 PUSH2 0xCA2 JUMP JUMPDEST POP PUSH2 0x71F JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0x5D7 JUMP JUMPDEST PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x808 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x89E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5441524745545F4E4F545F415554484F52495A45440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x2 SLOAD DUP2 LT PUSH2 0x90E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E4445585F4F55545F4F465F424F554E445300000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x2 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x934 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x9C2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1B PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x415554484F52495A45445F414444524553535F4D49534D415443480000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0xA3D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x2 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP4 SWAP1 DUP2 LT PUSH2 0xA70 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x2 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0xAEF SWAP1 DUP3 PUSH2 0xCA2 JUMP JUMPDEST POP PUSH1 0x40 MLOAD CALLER SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x1F32C1B084E2DE0713B8FB16BD46BB9DF710A3DBEAE2F3CA93AF46E016DCC6B0 SWAP1 PUSH1 0x0 SWAP1 LOG3 POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x2 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0xBB1 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xB86 JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0xC42 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0xC9F JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0xCC6 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0xCC6 SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0xCCB JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH2 0xBB9 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0xCE5 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0xCD1 JUMP JUMPDEST POP SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH3 0x643E0 0xb8 0x2c 0xe8 DUP2 DUP6 0xd5 PUSH2 0xCBE4 0xbc EXTCODESIZE PUSH15 0x8E8A23BF230E2CC87B292F64A040BE 0xc4 STOP 0x29 ",
+ "sourceMap": "686:2493:20:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1145:320;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1145:320:20;;;;;;;;;1030:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1030:28:20;;;;;;;;;;;;;;;;;;;;;;;;1579:547;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1579:547:20;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;2299:643:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2299:643:20;;;;;;;;;981:43;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;981:43:20;;;;;;;;;;;;;;;;;;;;;;;;;3039:138;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3039:138:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;3039:138:20;;;;;;;;;;;;;;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;1145:320:20;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1262:18:20;;;;;;;:10;:18;;;;;;;;1261:19;1240:91;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1342:18;;;;;;;1363:4;1342:18;;;;;;;;:25;;;;;;;;1377:11;27:10:-1;;23:18;;;45:23;;1377:24:20;;;;;;;;;;;;;;1416:42;1447:10;;1342:18;1416:42;;;1145:320;:::o;1030:28::-;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1030:28:20;:::o;1579:547::-;1814:9;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1698:18:20;;;;;;;:10;:18;;;;;;;;1677:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1781:18:20;;;;;;;:10;:18;;;;;1774:25;;;;;;1809:252;1833:11;:18;1829:22;;1809:252;;;1894:6;1876:24;;:11;1888:1;1876:14;;;;;;;;;;;;;;;;;;;;;;:24;1872:179;;;1937:11;1949:18;;:22;;;;1937:35;;;;;;;;;;;;;;;;1920:11;:14;;1937:35;;;;;1932:1;;1920:14;;;;;;;;;;;;;;;:52;;;;;;;;;;;;;;;1990:11;:23;;;;;;;;;:::i;:::-;;2031:5;;1872:179;1853:3;;1809:252;;;2075:44;;2108:10;;2075:44;;;;;;;;;1579:547;;:::o;91:20:82:-;;;;;;:::o;2299:643:20:-;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2462:18:20;;;;;;;:10;:18;;;;;;;;2441:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2566:11;:18;2558:26;;2537:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2682:6;2660:28;;:11;2672:5;2660:18;;;;;;;;;;;;;;;;;;;;;;:28;2639:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2759:18;;;;;;;:10;:18;;;;;2752:25;;;;;;2808:11;2820:18;;:22;;;;2808:35;;;;;;;;;;;;;;;;2787:11;:18;;2808:35;;;;;2799:5;;2787:18;;;;;;;;;;;;;;;:56;;;;;;;;;;;;;;;2853:11;:23;;;;;;;;;:::i;:::-;-1:-1:-1;2891:44:20;;2924:10;;2891:44;;;;;;;;;2299:643;;:::o;981:43::-;;;;;;;;;;;;;;;:::o;3039:138::-;3120:9;3159:11;3152:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3039:138;;:::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;425:69;333:167;:::o;686:2493:20:-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;"
+ }
+ }
+ },
+ "sources": {
+ "protocol/AssetProxy/MixinAuthorizable.sol": {
+ "id": 20
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ },
+ "protocol/AssetProxy/mixins/MAuthorizable.sol": {
+ "id": 24
+ },
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": {
+ "id": 23
+ }
+ },
+ "sourceCodes": {
+ "protocol/AssetProxy/MixinAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/Ownable/Ownable.sol\";\nimport \"./mixins/MAuthorizable.sol\";\n\n\ncontract MixinAuthorizable is\n Ownable,\n MAuthorizable\n{\n /// @dev Only authorized addresses can invoke functions with this modifier.\n modifier onlyAuthorized {\n require(\n authorized[msg.sender],\n \"SENDER_NOT_AUTHORIZED\"\n );\n _;\n }\n\n mapping (address => bool) public authorized;\n address[] public authorities;\n\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external\n onlyOwner\n {\n require(\n !authorized[target],\n \"TARGET_ALREADY_AUTHORIZED\"\n );\n\n authorized[target] = true;\n authorities.push(target);\n emit AuthorizedAddressAdded(target, msg.sender);\n }\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external\n onlyOwner\n {\n require(\n authorized[target],\n \"TARGET_NOT_AUTHORIZED\"\n );\n\n delete authorized[target];\n for (uint256 i = 0; i < authorities.length; i++) {\n if (authorities[i] == target) {\n authorities[i] = authorities[authorities.length - 1];\n authorities.length -= 1;\n break;\n }\n }\n emit AuthorizedAddressRemoved(target, msg.sender);\n }\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external\n onlyOwner\n {\n require(\n authorized[target],\n \"TARGET_NOT_AUTHORIZED\"\n );\n require(\n index < authorities.length,\n \"INDEX_OUT_OF_BOUNDS\"\n );\n require(\n authorities[index] == target,\n \"AUTHORIZED_ADDRESS_MISMATCH\"\n );\n\n delete authorized[target];\n authorities[index] = authorities[authorities.length - 1];\n authorities.length -= 1;\n emit AuthorizedAddressRemoved(target, msg.sender);\n }\n\n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory)\n {\n return authorities;\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n",
+ "protocol/AssetProxy/mixins/MAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../interfaces/IAuthorizable.sol\";\n\n\ncontract MAuthorizable is\n IAuthorizable\n{\n // Event logged when a new address is authorized.\n event AuthorizedAddressAdded(\n address indexed target,\n address indexed caller\n );\n\n // Event logged when a currently authorized address is unauthorized.\n event AuthorizedAddressRemoved(\n address indexed target,\n address indexed caller\n );\n\n /// @dev Only authorized addresses can invoke functions with this modifier.\n modifier onlyAuthorized { revert(); _; }\n}\n",
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/Ownable/IOwnable.sol\";\n\n\ncontract IAuthorizable is\n IOwnable\n{\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n \n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory);\n}\n"
+ },
+ "sourceTreeHashHex": "0xb3d5fa60c84c76d95b5c051d760384db0ac8b6feda233055d067b13bbe898989",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/MultiSigWallet.json b/packages/contracts/generated-artifacts/MultiSigWallet.json
new file mode 100644
index 000000000..e675a81ac
--- /dev/null
+++ b/packages/contracts/generated-artifacts/MultiSigWallet.json
@@ -0,0 +1,584 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "MultiSigWallet",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "owners",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "removeOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "revokeConfirmation",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "isOwner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "confirmations",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "pending",
+ "type": "bool"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "name": "getTransactionCount",
+ "outputs": [
+ {
+ "name": "count",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "addOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "isConfirmed",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getConfirmationCount",
+ "outputs": [
+ {
+ "name": "count",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "transactions",
+ "outputs": [
+ {
+ "name": "destination",
+ "type": "address"
+ },
+ {
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getOwners",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "from",
+ "type": "uint256"
+ },
+ {
+ "name": "to",
+ "type": "uint256"
+ },
+ {
+ "name": "pending",
+ "type": "bool"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "name": "getTransactionIds",
+ "outputs": [
+ {
+ "name": "_transactionIds",
+ "type": "uint256[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getConfirmations",
+ "outputs": [
+ {
+ "name": "_confirmations",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "transactionCount",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_required",
+ "type": "uint256"
+ }
+ ],
+ "name": "changeRequirement",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "confirmTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "destination",
+ "type": "address"
+ },
+ {
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "name": "submitTransaction",
+ "outputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "MAX_OWNER_COUNT",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "required",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "replaceOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "executeTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_owners",
+ "type": "address[]"
+ },
+ {
+ "name": "_required",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "fallback"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Confirmation",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Revocation",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Submission",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Execution",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "ExecutionFailure",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Deposit",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnerAddition",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnerRemoval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "required",
+ "type": "uint256"
+ }
+ ],
+ "name": "RequirementChange",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040523480156200001157600080fd5b5060405162001a8638038062001a8683398101604052805160208201519101805190919060009082603282118015906200004b5750818111155b80156200005757508015155b80156200006357508115155b15156200006f57600080fd5b600092505b845183101562000147576002600086858151811015156200009157fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16158015620000e757508483815181101515620000cf57fe5b90602001906020020151600160a060020a0316600014155b1515620000f357600080fd5b60016002600087868151811015156200010857fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff19169115159190911790556001929092019162000074565b84516200015c9060039060208801906200016e565b50505060049190915550620002029050565b828054828255906000526020600020908101928215620001c6579160200282015b82811115620001c65782518254600160a060020a031916600160a060020a039091161782556020909201916001909101906200018f565b50620001d4929150620001d8565b5090565b620001ff91905b80821115620001d4578054600160a060020a0319168155600101620001df565b90565b61187480620002126000396000f30060806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d91461019f57806320ea8d86146101cd5780632f54bf6e146101e55780633411c81c1461022757806354741525146102585780637065cb4814610289578063784547a7146102b75780638b51d13f146102cf5780639ace38c2146102e7578063a0e67e2b146103bc578063a8abe69a14610421578063b5dc40c314610446578063b77bf6001461045e578063ba51a6df14610473578063c01a8c841461048b578063c6427474146104a3578063d74f8edd14610519578063dc8452cd1461052e578063e20056e614610543578063ee22610b14610577575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b5061017660043561058f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101ab57600080fd5b5061015c73ffffffffffffffffffffffffffffffffffffffff600435166105c4565b3480156101d957600080fd5b5061015c60043561081b565b3480156101f157600080fd5b5061021373ffffffffffffffffffffffffffffffffffffffff600435166108f3565b604080519115158252519081900360200190f35b34801561023357600080fd5b5061021360043573ffffffffffffffffffffffffffffffffffffffff60243516610908565b34801561026457600080fd5b5061027760043515156024351515610928565b60408051918252519081900360200190f35b34801561029557600080fd5b5061015c73ffffffffffffffffffffffffffffffffffffffff60043516610994565b3480156102c357600080fd5b50610213600435610b09565b3480156102db57600080fd5b50610277600435610b9a565b3480156102f357600080fd5b506102ff600435610c16565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561037e578181015183820152602001610366565b50505050905090810190601f1680156103ab5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156103c857600080fd5b506103d1610cff565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561040d5781810151838201526020016103f5565b505050509050019250505060405180910390f35b34801561042d57600080fd5b506103d160043560243560443515156064351515610d6f565b34801561045257600080fd5b506103d1600435610ea8565b34801561046a57600080fd5b50610277611055565b34801561047f57600080fd5b5061015c60043561105b565b34801561049757600080fd5b5061015c6004356110da565b3480156104af57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261027794823573ffffffffffffffffffffffffffffffffffffffff169460248035953695946064949201919081908401838280828437509497506111d09650505050505050565b34801561052557600080fd5b506102776111ef565b34801561053a57600080fd5b506102776111f4565b34801561054f57600080fd5b5061015c73ffffffffffffffffffffffffffffffffffffffff600435811690602435166111fa565b34801561058357600080fd5b5061015c60043561140a565b600380548290811061059d57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60003330146105d257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054829060ff16151561060857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905591505b6003547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0182101561078b578273ffffffffffffffffffffffffffffffffffffffff166003838154811015156106a857fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561078057600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061070057fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff909216918490811061073357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061078b565b600190910190610656565b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906107bc9082611787565b5060035460045411156107d5576003546107d59061105b565b60405173ffffffffffffffffffffffffffffffffffffffff8416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff16151561083957600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561086557600080fd5b600084815260208190526040902060030154849060ff161561088657600080fd5b600085815260016020908152604080832033808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561098d57838015610955575060008181526020819052604090206003015460ff16155b806109795750828015610979575060008181526020819052604090206003015460ff165b15610985576001820191505b60010161092c565b5092915050565b3330146109a057600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054819060ff16156109d557600080fd5b8173ffffffffffffffffffffffffffffffffffffffff811615156109f857600080fd5b60038054905060010160045460328211158015610a155750818111155b8015610a2057508015155b8015610a2b57508115155b1515610a3657600080fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b600354811015610b935760008481526001602052604081206003805491929184908110610b3757fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610b78576001820191505b600454821415610b8b5760019250610b93565b600101610b0e565b5050919050565b6000805b600354811015610c105760008381526001602052604081206003805491929184908110610bc757fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610c08576001820191505b600101610b9e565b50919050565b60006020818152918152604090819020805460018083015460028085018054875161010095821615959095027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f810188900488028401880190965285835273ffffffffffffffffffffffffffffffffffffffff90931695909491929190830182828015610cec5780601f10610cc157610100808354040283529160200191610cec565b820191906000526020600020905b815481529060010190602001808311610ccf57829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610d6457602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610d39575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610da1578160200160208202803883390190505b50925060009150600090505b600554811015610e2857858015610dd6575060008181526020819052604090206003015460ff16155b80610dfa5750848015610dfa575060008181526020819052604090206003015460ff165b15610e2057808383815181101515610e0e57fe5b60209081029091010152600191909101905b600101610dad565b878703604051908082528060200260200182016040528015610e54578160200160208202803883390190505b5093508790505b86811015610e9d578281815181101515610e7157fe5b9060200190602002015184898303815181101515610e8b57fe5b60209081029091010152600101610e5b565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610edd578160200160208202803883390190505b50925060009150600090505b600354811015610fc15760008581526001602052604081206003805491929184908110610f1257fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610fb9576003805482908110610f5a57fe5b600091825260209091200154835173ffffffffffffffffffffffffffffffffffffffff90911690849084908110610f8d57fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600191909101905b600101610ee9565b81604051908082528060200260200182016040528015610feb578160200160208202803883390190505b509350600090505b8181101561104d57828181518110151561100957fe5b90602001906020020151848281518110151561102157fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600101610ff3565b505050919050565b60055481565b33301461106757600080fd5b600354816032821180159061107c5750818111155b801561108757508015155b801561109257508115155b151561109d57600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff1615156110f857600080fd5b600082815260208190526040902054829073ffffffffffffffffffffffffffffffffffffffff16151561112a57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff161561115557600080fd5b600085815260016020818152604080842033808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a36111c98561140a565b5050505050565b60006111dd848484611631565b90506111e8816110da565b9392505050565b603281565b60045481565b600033301461120857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff16151561123e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff161561127357600080fd5b600092505b600354831015611338578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156112a857fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561132d57836003848154811015156112e057fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611338565b600190920191611278565b73ffffffffffffffffffffffffffffffffffffffff80861660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a260405173ffffffffffffffffffffffffffffffffffffffff8516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b3360008181526002602052604081205490919060ff16151561142b57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff16151561145757600080fd5b600085815260208190526040902060030154859060ff161561147857600080fd5b61148186610b09565b1561162957600086815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff97831615610100029790970190911692909204948501879004870282018701909752838152939a5061159e9573ffffffffffffffffffffffffffffffffffffffff909216949093919083908301828280156115945780601f1061156957610100808354040283529160200191611594565b820191906000526020600020905b81548152906001019060200180831161157757829003601f168201915b5050505050611764565b156115d35760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2611629565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003850180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b505050505050565b60008373ffffffffffffffffffffffffffffffffffffffff8116151561165657600080fd5b6005546040805160808101825273ffffffffffffffffffffffffffffffffffffffff8881168252602080830189815283850189815260006060860181905287815280845295909520845181547fffffffffffffffffffffffff000000000000000000000000000000000000000016941693909317835551600183015592518051949650919390926116ee9260028501929101906117b0565b5060609190910151600390910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b8154818355818111156117ab576000838152602090206117ab91810190830161182e565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106117f157805160ff191683800117855561181e565b8280016001018555821561181e579182015b8281111561181e578251825591602001919060010190611803565b5061182a92915061182e565b5090565b610d6c91905b8082111561182a57600081556001016118345600a165627a7a723058205ec9b1f0864ae69331e894f69421e6389dd3d49c0192e2c2478ea678b4158e440029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x1A86 CODESIZE SUB DUP1 PUSH3 0x1A86 DUP4 CODECOPY DUP2 ADD PUSH1 0x40 MSTORE DUP1 MLOAD PUSH1 0x20 DUP3 ADD MLOAD SWAP2 ADD DUP1 MLOAD SWAP1 SWAP2 SWAP1 PUSH1 0x0 SWAP1 DUP3 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH3 0x4B JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH3 0x57 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH3 0x63 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH3 0x6F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST DUP5 MLOAD DUP4 LT ISZERO PUSH3 0x147 JUMPI PUSH1 0x2 PUSH1 0x0 DUP7 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x91 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP3 MSTORE DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x40 ADD PUSH1 0x0 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO DUP1 ISZERO PUSH3 0xE7 JUMPI POP DUP5 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0xCF JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 EQ ISZERO JUMPDEST ISZERO ISZERO PUSH3 0xF3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x2 PUSH1 0x0 DUP8 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x108 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP3 MSTORE DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x40 ADD PUSH1 0x0 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x1 SWAP3 SWAP1 SWAP3 ADD SWAP2 PUSH3 0x74 JUMP JUMPDEST DUP5 MLOAD PUSH3 0x15C SWAP1 PUSH1 0x3 SWAP1 PUSH1 0x20 DUP9 ADD SWAP1 PUSH3 0x16E JUMP JUMPDEST POP POP POP PUSH1 0x4 SWAP2 SWAP1 SWAP2 SSTORE POP PUSH3 0x202 SWAP1 POP JUMP JUMPDEST DUP3 DUP1 SLOAD DUP3 DUP3 SSTORE SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 DUP2 ADD SWAP3 DUP3 ISZERO PUSH3 0x1C6 JUMPI SWAP2 PUSH1 0x20 MUL DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0x1C6 JUMPI DUP3 MLOAD DUP3 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP2 AND OR DUP3 SSTORE PUSH1 0x20 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH3 0x18F JUMP JUMPDEST POP PUSH3 0x1D4 SWAP3 SWAP2 POP PUSH3 0x1D8 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x1FF SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x1D4 JUMPI DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x1DF JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x1874 DUP1 PUSH3 0x212 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x11C JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x25E7C27 DUP2 EQ PUSH2 0x15E JUMPI DUP1 PUSH4 0x173825D9 EQ PUSH2 0x19F JUMPI DUP1 PUSH4 0x20EA8D86 EQ PUSH2 0x1CD JUMPI DUP1 PUSH4 0x2F54BF6E EQ PUSH2 0x1E5 JUMPI DUP1 PUSH4 0x3411C81C EQ PUSH2 0x227 JUMPI DUP1 PUSH4 0x54741525 EQ PUSH2 0x258 JUMPI DUP1 PUSH4 0x7065CB48 EQ PUSH2 0x289 JUMPI DUP1 PUSH4 0x784547A7 EQ PUSH2 0x2B7 JUMPI DUP1 PUSH4 0x8B51D13F EQ PUSH2 0x2CF JUMPI DUP1 PUSH4 0x9ACE38C2 EQ PUSH2 0x2E7 JUMPI DUP1 PUSH4 0xA0E67E2B EQ PUSH2 0x3BC JUMPI DUP1 PUSH4 0xA8ABE69A EQ PUSH2 0x421 JUMPI DUP1 PUSH4 0xB5DC40C3 EQ PUSH2 0x446 JUMPI DUP1 PUSH4 0xB77BF600 EQ PUSH2 0x45E JUMPI DUP1 PUSH4 0xBA51A6DF EQ PUSH2 0x473 JUMPI DUP1 PUSH4 0xC01A8C84 EQ PUSH2 0x48B JUMPI DUP1 PUSH4 0xC6427474 EQ PUSH2 0x4A3 JUMPI DUP1 PUSH4 0xD74F8EDD EQ PUSH2 0x519 JUMPI DUP1 PUSH4 0xDC8452CD EQ PUSH2 0x52E JUMPI DUP1 PUSH4 0xE20056E6 EQ PUSH2 0x543 JUMPI DUP1 PUSH4 0xEE22610B EQ PUSH2 0x577 JUMPI JUMPDEST PUSH1 0x0 CALLVALUE GT ISZERO PUSH2 0x15C JUMPI PUSH1 0x40 DUP1 MLOAD CALLVALUE DUP2 MSTORE SWAP1 MLOAD CALLER SWAP2 PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C SWAP2 SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG2 JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x16A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x176 PUSH1 0x4 CALLDATALOAD PUSH2 0x58F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x5C4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1D9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH1 0x4 CALLDATALOAD PUSH2 0x81B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1F1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x213 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x8F3 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x233 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x213 PUSH1 0x4 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x24 CALLDATALOAD AND PUSH2 0x908 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x264 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x277 PUSH1 0x4 CALLDATALOAD ISZERO ISZERO PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0x928 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x295 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x994 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x213 PUSH1 0x4 CALLDATALOAD PUSH2 0xB09 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2DB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x277 PUSH1 0x4 CALLDATALOAD PUSH2 0xB9A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2FF PUSH1 0x4 CALLDATALOAD PUSH2 0xC16 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x37E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x366 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x3AB JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP6 POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3C8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3D1 PUSH2 0xCFF JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x40D JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x3F5 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x42D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3D1 PUSH1 0x4 CALLDATALOAD PUSH1 0x24 CALLDATALOAD PUSH1 0x44 CALLDATALOAD ISZERO ISZERO PUSH1 0x64 CALLDATALOAD ISZERO ISZERO PUSH2 0xD6F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x452 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3D1 PUSH1 0x4 CALLDATALOAD PUSH2 0xEA8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x46A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x277 PUSH2 0x1055 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x47F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH1 0x4 CALLDATALOAD PUSH2 0x105B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x497 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH1 0x4 CALLDATALOAD PUSH2 0x10DA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x277 SWAP5 DUP3 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x11D0 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x525 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x277 PUSH2 0x11EF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x53A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x277 PUSH2 0x11F4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x54F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x11FA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x583 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH1 0x4 CALLDATALOAD PUSH2 0x140A JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x59D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x5D2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x608 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP2 POP JUMPDEST PUSH1 0x3 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP3 LT ISZERO PUSH2 0x78B JUMPI DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x6A8 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x780 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x700 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x3 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x733 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x78B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x656 JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x7BC SWAP1 DUP3 PUSH2 0x1787 JUMP JUMPDEST POP PUSH1 0x3 SLOAD PUSH1 0x4 SLOAD GT ISZERO PUSH2 0x7D5 JUMPI PUSH1 0x3 SLOAD PUSH2 0x7D5 SWAP1 PUSH2 0x105B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x839 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP4 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x865 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD DUP5 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x886 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE MLOAD DUP8 SWAP3 PUSH32 0xF6A317157440607F36269043EB55F1287A5A19BA2216AFEAB88CD46CBCFB88E9 SWAP2 LOG3 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0x98D JUMPI DUP4 DUP1 ISZERO PUSH2 0x955 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0x979 JUMPI POP DUP3 DUP1 ISZERO PUSH2 0x979 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0x985 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0x92C JUMP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x9A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x9D5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x9F8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x1 ADD PUSH1 0x4 SLOAD PUSH1 0x32 DUP3 GT ISZERO DUP1 ISZERO PUSH2 0xA15 JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0xA20 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0xA2B JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0xA36 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE PUSH1 0x3 DUP1 SLOAD SWAP2 DUP3 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0xC2575A0E9E593C00F959F8C92F12DB2869C3395A3B0502D05E2516446F71F85B ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP2 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0xB93 JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xB37 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xB78 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x4 SLOAD DUP3 EQ ISZERO PUSH2 0xB8B JUMPI PUSH1 0x1 SWAP3 POP PUSH2 0xB93 JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0xB0E JUMP JUMPDEST POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0xC10 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xBC7 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xC08 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0xB9E JUMP JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP2 DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP1 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP8 MLOAD PUSH2 0x100 SWAP6 DUP3 AND ISZERO SWAP6 SWAP1 SWAP6 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD AND SWAP2 SWAP1 SWAP2 DIV PUSH1 0x1F DUP2 ADD DUP9 SWAP1 DIV DUP9 MUL DUP5 ADD DUP9 ADD SWAP1 SWAP7 MSTORE DUP6 DUP4 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND SWAP6 SWAP1 SWAP5 SWAP2 SWAP3 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xCEC JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xCC1 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xCEC JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xCCF JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP PUSH1 0x3 SWAP1 SWAP4 ADD SLOAD SWAP2 SWAP3 POP POP PUSH1 0xFF AND DUP5 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0xD64 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xD39 JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x5 SLOAD PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xDA1 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0xE28 JUMPI DUP6 DUP1 ISZERO PUSH2 0xDD6 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0xDFA JUMPI POP DUP5 DUP1 ISZERO PUSH2 0xDFA JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0xE20 JUMPI DUP1 DUP4 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE0E JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0xDAD JUMP JUMPDEST DUP8 DUP8 SUB PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xE54 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP DUP8 SWAP1 POP JUMPDEST DUP7 DUP2 LT ISZERO PUSH2 0xE9D JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE71 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP10 DUP4 SUB DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE8B JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0xE5B JUMP JUMPDEST POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xEDD JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0xFC1 JUMPI PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xF12 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xFB9 JUMPI PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0xF5A JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD DUP4 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP2 LT PUSH2 0xF8D JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0xEE9 JUMP JUMPDEST DUP2 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xFEB JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x104D JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1009 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1021 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 ADD PUSH2 0xFF3 JUMP JUMPDEST POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x5 SLOAD DUP2 JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x1067 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 SLOAD DUP2 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH2 0x107C JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1087 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1092 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x109D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x4 DUP4 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP5 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xA3F1EE9126A074D9326C682F561767F710E927FAA811F7A99829D49DC421797A SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x10F8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO ISZERO PUSH2 0x112A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP5 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1155 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 CALLER DUP1 DUP7 MSTORE SWAP3 MSTORE DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SWAP4 OR SWAP1 SWAP3 SSTORE SWAP1 MLOAD DUP8 SWAP3 PUSH32 0x4A504A94899432A9846E1AA406DCEB1BCFD538BB839071D49D1E5E23F5BE30EF SWAP2 LOG3 PUSH2 0x11C9 DUP6 PUSH2 0x140A JUMP JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x11DD DUP5 DUP5 DUP5 PUSH2 0x1631 JUMP JUMPDEST SWAP1 POP PUSH2 0x11E8 DUP2 PUSH2 0x10DA JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x32 DUP2 JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x1208 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x123E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1273 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST PUSH1 0x3 SLOAD DUP4 LT ISZERO PUSH2 0x1338 JUMPI DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x12A8 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x132D JUMPI DUP4 PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x12E0 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x1338 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x1278 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 SWAP1 DUP2 AND SWAP1 SWAP2 SSTORE SWAP4 DUP9 AND DUP3 MSTORE DUP1 DUP3 KECCAK256 DUP1 SLOAD SWAP1 SWAP5 AND PUSH1 0x1 OR SWAP1 SWAP4 SSTORE SWAP2 MLOAD SWAP1 SWAP2 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP2 LOG2 PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP1 PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD SWAP1 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x142B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP5 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1457 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD DUP6 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1478 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1481 DUP7 PUSH2 0xB09 JUMP JUMPDEST ISZERO PUSH2 0x1629 JUMPI PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP11 POP PUSH2 0x159E SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x1594 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1569 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1594 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1577 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x1764 JUMP JUMPDEST ISZERO PUSH2 0x15D3 JUMPI PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0x1629 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP6 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x1656 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x80 DUP2 ADD DUP3 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 DUP2 AND DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD DUP10 DUP2 MSTORE DUP4 DUP6 ADD DUP10 DUP2 MSTORE PUSH1 0x0 PUSH1 0x60 DUP7 ADD DUP2 SWAP1 MSTORE DUP8 DUP2 MSTORE DUP1 DUP5 MSTORE SWAP6 SWAP1 SWAP6 KECCAK256 DUP5 MLOAD DUP2 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 SSTORE MLOAD PUSH1 0x1 DUP4 ADD SSTORE SWAP3 MLOAD DUP1 MLOAD SWAP5 SWAP7 POP SWAP2 SWAP4 SWAP1 SWAP3 PUSH2 0x16EE SWAP3 PUSH1 0x2 DUP6 ADD SWAP3 SWAP2 ADD SWAP1 PUSH2 0x17B0 JUMP JUMPDEST POP PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD MLOAD PUSH1 0x3 SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x5 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE PUSH1 0x40 MLOAD DUP3 SWAP1 PUSH32 0xC0BA8FE4B176C1714197D43B9CC6BCF797A4A7461C5FE8D0EF6E184AE7601E51 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 MLOAD PUSH1 0x20 DUP5 ADD PUSH1 0x0 DUP3 DUP8 DUP4 DUP11 DUP13 PUSH2 0x8796 GAS SUB CALL SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0x17AB JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0x17AB SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0x182E JUMP JUMPDEST POP POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x17F1 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x181E JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x181E JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x181E JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x1803 JUMP JUMPDEST POP PUSH2 0x182A SWAP3 SWAP2 POP PUSH2 0x182E JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0xD6C SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x182A JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x1834 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0x5e 0xc9 0xb1 CREATE DUP7 0x4a 0xe6 SWAP4 BALANCE 0xe8 SWAP5 0xf6 SWAP5 0x21 0xe6 CODESIZE SWAP14 0xd3 0xd4 SWAP13 ADD SWAP3 0xe2 0xc2 0x47 DUP15 0xa6 PUSH25 0xB4158E44002900000000000000000000000000000000000000 ",
+ "sourceMap": "206:12628:16:-;;;2835:353;8:9:-1;5:2;;;30:1;27;20:12;5:2;2835:353:16;;;;;;;;;;;;;;;;;;;;;;2934:14;;2835:353;;;2980:6;;2835:353;839:2;2273:29;;;;;:68;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;2987:1;2980:8;;2975:151;2992:7;:14;2990:1;:16;2975:151;;;3036:7;:19;3044:7;3052:1;3044:10;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3036:19:16;;;;;;;;;;;-1:-1:-1;3036:19:16;;;;3035:20;:39;;;;;3059:7;3067:1;3059:10;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3059:15:16;3073:1;3059:15;;3035:39;3027:48;;;;;;;;3111:4;3089:7;:19;3097:7;3105:1;3097:10;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3089:19:16;;;;;;;;;;;-1:-1:-1;3089:19:16;:26;;-1:-1:-1;;3089:26:16;;;;;;;;;;-1:-1:-1;3008:3:16;;;;;2975:151;;;3135:16;;;;:6;;:16;;;;;:::i;:::-;-1:-1:-1;;;3161:8:16;:20;;;;-1:-1:-1;206:12628:16;;-1:-1:-1;206:12628:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;206:12628:16;-1:-1:-1;;;;;206:12628:16;;;;;;;;;;;-1:-1:-1;206:12628:16;;;;;;;-1:-1:-1;206:12628:16;;;-1:-1:-1;206:12628:16;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;;;;;;206:12628:16;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d91461019f57806320ea8d86146101cd5780632f54bf6e146101e55780633411c81c1461022757806354741525146102585780637065cb4814610289578063784547a7146102b75780638b51d13f146102cf5780639ace38c2146102e7578063a0e67e2b146103bc578063a8abe69a14610421578063b5dc40c314610446578063b77bf6001461045e578063ba51a6df14610473578063c01a8c841461048b578063c6427474146104a3578063d74f8edd14610519578063dc8452cd1461052e578063e20056e614610543578063ee22610b14610577575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b5061017660043561058f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101ab57600080fd5b5061015c73ffffffffffffffffffffffffffffffffffffffff600435166105c4565b3480156101d957600080fd5b5061015c60043561081b565b3480156101f157600080fd5b5061021373ffffffffffffffffffffffffffffffffffffffff600435166108f3565b604080519115158252519081900360200190f35b34801561023357600080fd5b5061021360043573ffffffffffffffffffffffffffffffffffffffff60243516610908565b34801561026457600080fd5b5061027760043515156024351515610928565b60408051918252519081900360200190f35b34801561029557600080fd5b5061015c73ffffffffffffffffffffffffffffffffffffffff60043516610994565b3480156102c357600080fd5b50610213600435610b09565b3480156102db57600080fd5b50610277600435610b9a565b3480156102f357600080fd5b506102ff600435610c16565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561037e578181015183820152602001610366565b50505050905090810190601f1680156103ab5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156103c857600080fd5b506103d1610cff565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561040d5781810151838201526020016103f5565b505050509050019250505060405180910390f35b34801561042d57600080fd5b506103d160043560243560443515156064351515610d6f565b34801561045257600080fd5b506103d1600435610ea8565b34801561046a57600080fd5b50610277611055565b34801561047f57600080fd5b5061015c60043561105b565b34801561049757600080fd5b5061015c6004356110da565b3480156104af57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261027794823573ffffffffffffffffffffffffffffffffffffffff169460248035953695946064949201919081908401838280828437509497506111d09650505050505050565b34801561052557600080fd5b506102776111ef565b34801561053a57600080fd5b506102776111f4565b34801561054f57600080fd5b5061015c73ffffffffffffffffffffffffffffffffffffffff600435811690602435166111fa565b34801561058357600080fd5b5061015c60043561140a565b600380548290811061059d57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60003330146105d257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054829060ff16151561060857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905591505b6003547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0182101561078b578273ffffffffffffffffffffffffffffffffffffffff166003838154811015156106a857fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561078057600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061070057fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff909216918490811061073357fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061078b565b600190910190610656565b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906107bc9082611787565b5060035460045411156107d5576003546107d59061105b565b60405173ffffffffffffffffffffffffffffffffffffffff8416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff16151561083957600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561086557600080fd5b600084815260208190526040902060030154849060ff161561088657600080fd5b600085815260016020908152604080832033808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561098d57838015610955575060008181526020819052604090206003015460ff16155b806109795750828015610979575060008181526020819052604090206003015460ff165b15610985576001820191505b60010161092c565b5092915050565b3330146109a057600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054819060ff16156109d557600080fd5b8173ffffffffffffffffffffffffffffffffffffffff811615156109f857600080fd5b60038054905060010160045460328211158015610a155750818111155b8015610a2057508015155b8015610a2b57508115155b1515610a3657600080fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b600354811015610b935760008481526001602052604081206003805491929184908110610b3757fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610b78576001820191505b600454821415610b8b5760019250610b93565b600101610b0e565b5050919050565b6000805b600354811015610c105760008381526001602052604081206003805491929184908110610bc757fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610c08576001820191505b600101610b9e565b50919050565b60006020818152918152604090819020805460018083015460028085018054875161010095821615959095027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f810188900488028401880190965285835273ffffffffffffffffffffffffffffffffffffffff90931695909491929190830182828015610cec5780601f10610cc157610100808354040283529160200191610cec565b820191906000526020600020905b815481529060010190602001808311610ccf57829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610d6457602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610d39575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610da1578160200160208202803883390190505b50925060009150600090505b600554811015610e2857858015610dd6575060008181526020819052604090206003015460ff16155b80610dfa5750848015610dfa575060008181526020819052604090206003015460ff165b15610e2057808383815181101515610e0e57fe5b60209081029091010152600191909101905b600101610dad565b878703604051908082528060200260200182016040528015610e54578160200160208202803883390190505b5093508790505b86811015610e9d578281815181101515610e7157fe5b9060200190602002015184898303815181101515610e8b57fe5b60209081029091010152600101610e5b565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610edd578160200160208202803883390190505b50925060009150600090505b600354811015610fc15760008581526001602052604081206003805491929184908110610f1257fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610fb9576003805482908110610f5a57fe5b600091825260209091200154835173ffffffffffffffffffffffffffffffffffffffff90911690849084908110610f8d57fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600191909101905b600101610ee9565b81604051908082528060200260200182016040528015610feb578160200160208202803883390190505b509350600090505b8181101561104d57828181518110151561100957fe5b90602001906020020151848281518110151561102157fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600101610ff3565b505050919050565b60055481565b33301461106757600080fd5b600354816032821180159061107c5750818111155b801561108757508015155b801561109257508115155b151561109d57600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff1615156110f857600080fd5b600082815260208190526040902054829073ffffffffffffffffffffffffffffffffffffffff16151561112a57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff161561115557600080fd5b600085815260016020818152604080842033808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a36111c98561140a565b5050505050565b60006111dd848484611631565b90506111e8816110da565b9392505050565b603281565b60045481565b600033301461120857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff16151561123e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff161561127357600080fd5b600092505b600354831015611338578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156112a857fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561132d57836003848154811015156112e057fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611338565b600190920191611278565b73ffffffffffffffffffffffffffffffffffffffff80861660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a260405173ffffffffffffffffffffffffffffffffffffffff8516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b3360008181526002602052604081205490919060ff16151561142b57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff16151561145757600080fd5b600085815260208190526040902060030154859060ff161561147857600080fd5b61148186610b09565b1561162957600086815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff97831615610100029790970190911692909204948501879004870282018701909752838152939a5061159e9573ffffffffffffffffffffffffffffffffffffffff909216949093919083908301828280156115945780601f1061156957610100808354040283529160200191611594565b820191906000526020600020905b81548152906001019060200180831161157757829003601f168201915b5050505050611764565b156115d35760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2611629565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003850180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b505050505050565b60008373ffffffffffffffffffffffffffffffffffffffff8116151561165657600080fd5b6005546040805160808101825273ffffffffffffffffffffffffffffffffffffffff8881168252602080830189815283850189815260006060860181905287815280845295909520845181547fffffffffffffffffffffffff000000000000000000000000000000000000000016941693909317835551600183015592518051949650919390926116ee9260028501929101906117b0565b5060609190910151600390910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b8154818355818111156117ab576000838152602090206117ab91810190830161182e565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106117f157805160ff191683800117855561181e565b8280016001018555821561181e579182015b8281111561181e578251825591602001919060010190611803565b5061182a92915061182e565b5090565b610d6c91905b8082111561182a57600081556001016118345600a165627a7a723058205ec9b1f0864ae69331e894f69421e6389dd3d49c0192e2c2478ea678b4158e440029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x11C JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x25E7C27 DUP2 EQ PUSH2 0x15E JUMPI DUP1 PUSH4 0x173825D9 EQ PUSH2 0x19F JUMPI DUP1 PUSH4 0x20EA8D86 EQ PUSH2 0x1CD JUMPI DUP1 PUSH4 0x2F54BF6E EQ PUSH2 0x1E5 JUMPI DUP1 PUSH4 0x3411C81C EQ PUSH2 0x227 JUMPI DUP1 PUSH4 0x54741525 EQ PUSH2 0x258 JUMPI DUP1 PUSH4 0x7065CB48 EQ PUSH2 0x289 JUMPI DUP1 PUSH4 0x784547A7 EQ PUSH2 0x2B7 JUMPI DUP1 PUSH4 0x8B51D13F EQ PUSH2 0x2CF JUMPI DUP1 PUSH4 0x9ACE38C2 EQ PUSH2 0x2E7 JUMPI DUP1 PUSH4 0xA0E67E2B EQ PUSH2 0x3BC JUMPI DUP1 PUSH4 0xA8ABE69A EQ PUSH2 0x421 JUMPI DUP1 PUSH4 0xB5DC40C3 EQ PUSH2 0x446 JUMPI DUP1 PUSH4 0xB77BF600 EQ PUSH2 0x45E JUMPI DUP1 PUSH4 0xBA51A6DF EQ PUSH2 0x473 JUMPI DUP1 PUSH4 0xC01A8C84 EQ PUSH2 0x48B JUMPI DUP1 PUSH4 0xC6427474 EQ PUSH2 0x4A3 JUMPI DUP1 PUSH4 0xD74F8EDD EQ PUSH2 0x519 JUMPI DUP1 PUSH4 0xDC8452CD EQ PUSH2 0x52E JUMPI DUP1 PUSH4 0xE20056E6 EQ PUSH2 0x543 JUMPI DUP1 PUSH4 0xEE22610B EQ PUSH2 0x577 JUMPI JUMPDEST PUSH1 0x0 CALLVALUE GT ISZERO PUSH2 0x15C JUMPI PUSH1 0x40 DUP1 MLOAD CALLVALUE DUP2 MSTORE SWAP1 MLOAD CALLER SWAP2 PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C SWAP2 SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG2 JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x16A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x176 PUSH1 0x4 CALLDATALOAD PUSH2 0x58F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x5C4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1D9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH1 0x4 CALLDATALOAD PUSH2 0x81B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1F1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x213 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x8F3 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x233 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x213 PUSH1 0x4 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x24 CALLDATALOAD AND PUSH2 0x908 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x264 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x277 PUSH1 0x4 CALLDATALOAD ISZERO ISZERO PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0x928 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x295 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x994 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x213 PUSH1 0x4 CALLDATALOAD PUSH2 0xB09 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2DB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x277 PUSH1 0x4 CALLDATALOAD PUSH2 0xB9A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2FF PUSH1 0x4 CALLDATALOAD PUSH2 0xC16 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x37E JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x366 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x3AB JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP6 POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3C8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3D1 PUSH2 0xCFF JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x40D JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x3F5 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x42D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3D1 PUSH1 0x4 CALLDATALOAD PUSH1 0x24 CALLDATALOAD PUSH1 0x44 CALLDATALOAD ISZERO ISZERO PUSH1 0x64 CALLDATALOAD ISZERO ISZERO PUSH2 0xD6F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x452 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x3D1 PUSH1 0x4 CALLDATALOAD PUSH2 0xEA8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x46A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x277 PUSH2 0x1055 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x47F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH1 0x4 CALLDATALOAD PUSH2 0x105B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x497 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH1 0x4 CALLDATALOAD PUSH2 0x10DA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x277 SWAP5 DUP3 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x11D0 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x525 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x277 PUSH2 0x11EF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x53A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x277 PUSH2 0x11F4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x54F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x11FA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x583 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH1 0x4 CALLDATALOAD PUSH2 0x140A JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x59D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x5D2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x608 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP2 POP JUMPDEST PUSH1 0x3 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP3 LT ISZERO PUSH2 0x78B JUMPI DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x6A8 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x780 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x700 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x3 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x733 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x78B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x656 JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x7BC SWAP1 DUP3 PUSH2 0x1787 JUMP JUMPDEST POP PUSH1 0x3 SLOAD PUSH1 0x4 SLOAD GT ISZERO PUSH2 0x7D5 JUMPI PUSH1 0x3 SLOAD PUSH2 0x7D5 SWAP1 PUSH2 0x105B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x839 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP4 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x865 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD DUP5 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x886 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE MLOAD DUP8 SWAP3 PUSH32 0xF6A317157440607F36269043EB55F1287A5A19BA2216AFEAB88CD46CBCFB88E9 SWAP2 LOG3 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0x98D JUMPI DUP4 DUP1 ISZERO PUSH2 0x955 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0x979 JUMPI POP DUP3 DUP1 ISZERO PUSH2 0x979 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0x985 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0x92C JUMP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x9A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x9D5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x9F8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x1 ADD PUSH1 0x4 SLOAD PUSH1 0x32 DUP3 GT ISZERO DUP1 ISZERO PUSH2 0xA15 JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0xA20 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0xA2B JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0xA36 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE PUSH1 0x3 DUP1 SLOAD SWAP2 DUP3 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0xC2575A0E9E593C00F959F8C92F12DB2869C3395A3B0502D05E2516446F71F85B ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP2 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0xB93 JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xB37 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xB78 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x4 SLOAD DUP3 EQ ISZERO PUSH2 0xB8B JUMPI PUSH1 0x1 SWAP3 POP PUSH2 0xB93 JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0xB0E JUMP JUMPDEST POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0xC10 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xBC7 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xC08 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0xB9E JUMP JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP2 DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP1 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP8 MLOAD PUSH2 0x100 SWAP6 DUP3 AND ISZERO SWAP6 SWAP1 SWAP6 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD AND SWAP2 SWAP1 SWAP2 DIV PUSH1 0x1F DUP2 ADD DUP9 SWAP1 DIV DUP9 MUL DUP5 ADD DUP9 ADD SWAP1 SWAP7 MSTORE DUP6 DUP4 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND SWAP6 SWAP1 SWAP5 SWAP2 SWAP3 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xCEC JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xCC1 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xCEC JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xCCF JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP PUSH1 0x3 SWAP1 SWAP4 ADD SLOAD SWAP2 SWAP3 POP POP PUSH1 0xFF AND DUP5 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0xD64 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xD39 JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x5 SLOAD PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xDA1 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0xE28 JUMPI DUP6 DUP1 ISZERO PUSH2 0xDD6 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0xDFA JUMPI POP DUP5 DUP1 ISZERO PUSH2 0xDFA JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0xE20 JUMPI DUP1 DUP4 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE0E JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0xDAD JUMP JUMPDEST DUP8 DUP8 SUB PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xE54 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP DUP8 SWAP1 POP JUMPDEST DUP7 DUP2 LT ISZERO PUSH2 0xE9D JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE71 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP10 DUP4 SUB DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE8B JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0xE5B JUMP JUMPDEST POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xEDD JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0xFC1 JUMPI PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xF12 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xFB9 JUMPI PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0xF5A JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD DUP4 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP2 LT PUSH2 0xF8D JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0xEE9 JUMP JUMPDEST DUP2 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xFEB JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x104D JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1009 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1021 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 ADD PUSH2 0xFF3 JUMP JUMPDEST POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x5 SLOAD DUP2 JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x1067 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 SLOAD DUP2 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH2 0x107C JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1087 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1092 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x109D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x4 DUP4 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP5 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xA3F1EE9126A074D9326C682F561767F710E927FAA811F7A99829D49DC421797A SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x10F8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO ISZERO PUSH2 0x112A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP5 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1155 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 CALLER DUP1 DUP7 MSTORE SWAP3 MSTORE DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SWAP4 OR SWAP1 SWAP3 SSTORE SWAP1 MLOAD DUP8 SWAP3 PUSH32 0x4A504A94899432A9846E1AA406DCEB1BCFD538BB839071D49D1E5E23F5BE30EF SWAP2 LOG3 PUSH2 0x11C9 DUP6 PUSH2 0x140A JUMP JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x11DD DUP5 DUP5 DUP5 PUSH2 0x1631 JUMP JUMPDEST SWAP1 POP PUSH2 0x11E8 DUP2 PUSH2 0x10DA JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x32 DUP2 JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x1208 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x123E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1273 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST PUSH1 0x3 SLOAD DUP4 LT ISZERO PUSH2 0x1338 JUMPI DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x12A8 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x132D JUMPI DUP4 PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x12E0 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x1338 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x1278 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 SWAP1 DUP2 AND SWAP1 SWAP2 SSTORE SWAP4 DUP9 AND DUP3 MSTORE DUP1 DUP3 KECCAK256 DUP1 SLOAD SWAP1 SWAP5 AND PUSH1 0x1 OR SWAP1 SWAP4 SSTORE SWAP2 MLOAD SWAP1 SWAP2 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP2 LOG2 PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP1 PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD SWAP1 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x142B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP5 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1457 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD DUP6 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1478 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1481 DUP7 PUSH2 0xB09 JUMP JUMPDEST ISZERO PUSH2 0x1629 JUMPI PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP11 POP PUSH2 0x159E SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x1594 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1569 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x1594 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1577 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x1764 JUMP JUMPDEST ISZERO PUSH2 0x15D3 JUMPI PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0x1629 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP6 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x1656 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x80 DUP2 ADD DUP3 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 DUP2 AND DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD DUP10 DUP2 MSTORE DUP4 DUP6 ADD DUP10 DUP2 MSTORE PUSH1 0x0 PUSH1 0x60 DUP7 ADD DUP2 SWAP1 MSTORE DUP8 DUP2 MSTORE DUP1 DUP5 MSTORE SWAP6 SWAP1 SWAP6 KECCAK256 DUP5 MLOAD DUP2 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 SSTORE MLOAD PUSH1 0x1 DUP4 ADD SSTORE SWAP3 MLOAD DUP1 MLOAD SWAP5 SWAP7 POP SWAP2 SWAP4 SWAP1 SWAP3 PUSH2 0x16EE SWAP3 PUSH1 0x2 DUP6 ADD SWAP3 SWAP2 ADD SWAP1 PUSH2 0x17B0 JUMP JUMPDEST POP PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD MLOAD PUSH1 0x3 SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x5 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE PUSH1 0x40 MLOAD DUP3 SWAP1 PUSH32 0xC0BA8FE4B176C1714197D43B9CC6BCF797A4A7461C5FE8D0EF6E184AE7601E51 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 MLOAD PUSH1 0x20 DUP5 ADD PUSH1 0x0 DUP3 DUP8 DUP4 DUP11 DUP13 PUSH2 0x8796 GAS SUB CALL SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0x17AB JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0x17AB SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0x182E JUMP JUMPDEST POP POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x17F1 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x181E JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x181E JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x181E JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x1803 JUMP JUMPDEST POP PUSH2 0x182A SWAP3 SWAP2 POP PUSH2 0x182E JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0xD6C SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x182A JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x1834 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0x5e 0xc9 0xb1 CREATE DUP7 0x4a 0xe6 SWAP4 BALANCE 0xe8 SWAP5 0xf6 SWAP5 0x21 0xe6 CODESIZE SWAP14 0xd3 0xd4 SWAP13 ADD SWAP3 0xe2 0xc2 0x47 DUP15 0xa6 PUSH25 0xB4158E44002900000000000000000000000000000000000000 ",
+ "sourceMap": "206:12628:16:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2540:1;2528:9;:13;2524:61;;;2555:30;;;2575:9;2555:30;;;;2563:10;;2555:30;;;;;;;;;;2524:61;206:12628;1050:23;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1050:23:16;;;;;;;;;;;;;;;;;;;;;;;;3715:460;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3715:460:16;;;;;;;6281:291;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6281:291:16;;;;;1004:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1004:40:16;;;;;;;;;;;;;;;;;;;;;;;;;934:64;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;934:64:16;;;;;;;;;10535:319;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;10535:319:16;;;;;;;;;;;;;;;;;;;;;;;;;;;3315:277;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3315:277:16;;;;;;;8703:337;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8703:337:16;;;;;10021:252;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;10021:252:16;;;;;879:49;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;879:49:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;879:49:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10938:115;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10938:115:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;10938:115:16;;;;;;;;;;;;;;;;;12156:676;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;12156:676:16;;;;;;;;;;;;;;;11232:575;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;11232:575:16;;;;;1105:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1105:28:16;;;;4997:207;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4997:207:16;;;;;5813:344;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5813:344:16;;;;;5463:244;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5463:244:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5463:244:16;;-1:-1:-1;5463:244:16;;-1:-1:-1;;;;;;;5463:244:16;800:41;;8:9:-1;5:2;;;30:1;27;20:12;5:2;800:41:16;;;;1079:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1079:20:16;;;;4377:449;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4377:449:16;;;;;;;;;;;;6686:586;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6686:586:16;;;;;1050:23;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1050:23:16;:::o;3715:460::-;3863:6;1337:10;1359:4;1337:27;1329:36;;;;;;1543:14;;;;;;;:7;:14;;;;;;3805:5;;1543:14;;1535:23;;;;;;;;3826:14;;;3843:5;3826:14;;;:7;:14;;;;;:22;;;;;;3843:5;-1:-1:-1;3858:170:16;3875:6;:13;:17;;3873:19;;3858:170;;;3928:5;3915:18;;:6;3922:1;3915:9;;;;;;;;;;;;;;;;;;;;;;:18;3911:117;;;3965:6;3972:13;;:17;;;;3965:25;;;;;;;;;;;;;;;;3953:6;:9;;3965:25;;;;;3960:1;;3953:9;;;;;;;;;;;;;;:37;;;;;;;;;;;;;;;;;;4008:5;;3911:117;3894:3;;;;;3858:170;;;4037:6;:18;;;;;;;;;:::i;:::-;-1:-1:-1;4080:6:16;:13;4069:8;;:24;4065:74;;;4125:6;:13;4107:32;;:17;:32::i;:::-;4149:19;;;;;;;;;;;1375:1;3715:460;;:::o;6281:291::-;6364:10;1543:14;;;;:7;:14;;;;;;;;1535:23;;;;;;;;1788:28;;;;:13;:28;;;;;;;;6409:10;1788:35;;;;;;;;;6394:13;;6409:10;1788:35;;1780:44;;;;;;;;2044:12;:27;;;;;;;;;;:36;;;6441:13;;2044:36;;2043:37;2035:46;;;;;;6513:5;6470:28;;;:13;:28;;;;;;;;6499:10;6470:40;;;;;;;;:48;;;;;;6528:37;6484:13;;6528:37;;;1834:1;1568;;6281:291;;:::o;1004:40::-;;;;;;;;;;;;;;;:::o;934:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;10535:319::-;10642:10;;10668:179;10685:16;;10683:1;:18;10668:179;;;10727:7;:36;;;;-1:-1:-1;10739:12:16;:15;;;;;;;;;;:24;;;;;10738:25;10727:36;:92;;;;10783:8;:36;;;;-1:-1:-1;10795:12:16;:15;;;;;;;;;;:24;;;;;10783:36;10720:127;;;10846:1;10837:10;;;;10720:127;10703:3;;10668:179;;;10535:319;;;;;:::o;3315:277::-;1337:10;1359:4;1337:27;1329:36;;;;;;1450:14;;;;;;;:7;:14;;;;;;3408:5;;1450:14;;1449:15;1441:24;;;;;;3431:5;2158:13;;;;;2150:22;;;;;;3463:6;:13;;;;3479:1;3463:17;3482:8;;839:2;2273:10;:29;;:68;;;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;3506:14;;;;;;;:7;:14;;;;;;:21;;;;3523:4;3506:21;;;;;;3537:6;27:10:-1;;23:18;;;45:23;;3537:18:16;;;;;;;;;;;;3565:20;;;3506:14;3565:20;2182:1;;1475;1375;3315:277;:::o;8703:337::-;8793:4;;;8837:197;8854:6;:13;8852:15;;8837:197;;;8892:28;;;;:13;:28;;;;;8921:6;:9;;8892:28;;;8928:1;;8921:9;;;;;;;;;;;;;;;;;;;;8892:39;;;;;;;;;;;;;;;8888:71;;;8958:1;8949:10;;;;8888:71;8986:8;;8977:5;:17;8973:50;;;9019:4;9012:11;;;;8973:50;8869:3;;8837:197;;;8703:337;;;;;:::o;10021:252::-;10120:10;;10146:120;10163:6;:13;10161:15;;10146:120;;;10199:28;;;;:13;:28;;;;;10228:6;:9;;10199:28;;;10235:1;;10228:9;;;;;;;;;;;;;;;;;;;;10199:39;;;;;;;;;;;;;;;10195:71;;;10265:1;10256:10;;;;10195:71;10178:3;;10146:120;;;10021:252;;;;:::o;879:49::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;879:49:16;;;;;;;-1:-1:-1;;879:49:16;;;:::o;10938:115::-;11008:9;11040:6;11033:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10938:115;;:::o;12156:676::-;12281:22;12319:32;12392:10;12416:6;12365:16;;12354:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;12354:28:16;;12319:63;;12405:1;12392:14;;12439:1;12437:3;;12432:250;12444:16;;12442:1;:18;12432:250;;;12486:7;:36;;;;-1:-1:-1;12498:12:16;:15;;;;;;;;;;:24;;;;;12497:25;12486:36;:92;;;;12542:8;:36;;;;-1:-1:-1;12554:12:16;:15;;;;;;;;;;:24;;;;;12542:36;12479:203;;;12638:1;12610:18;12629:5;12610:25;;;;;;;;;;;;;;;;;;:29;12666:1;12657:10;;;;;12479:203;12462:3;;12432:250;;;12725:4;12720:2;:9;12709:21;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;12709:21:16;;12691:39;;12747:4;12745:6;;12740:85;12755:2;12753:1;:4;12740:85;;;12804:18;12823:1;12804:21;;;;;;;;;;;;;;;;;;12776:15;12796:4;12792:1;:8;12776:25;;;;;;;;;;;;;;;;;;:49;12759:3;;12740:85;;;12156:676;;;;;;;;;:::o;11232:575::-;11327:24;11367:34;11442:10;11466:6;11418;:13;;;;11404:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;11404:28:16;;11367:65;;11455:1;11442:14;;11489:1;11487:3;;11482:186;11494:6;:13;11492:15;;11482:186;;;11530:28;;;;:13;:28;;;;;11559:6;:9;;11530:28;;;11566:1;;11559:9;;;;;;;;;;;;;;;;;;;;11530:39;;;;;;;;;;;;;;;11526:142;;;11616:6;:9;;11623:1;;11616:9;;;;;;;;;;;;;;;;11589:24;;11616:9;;;;;11589:17;;11607:5;;11589:24;;;;;;:36;;;;:24;;;;;;;;;;:36;11652:1;11643:10;;;;;11526:142;11509:3;;11482:186;;;11708:5;11694:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;11694:20:16;;11677:37;;11731:1;11729:3;;11724:76;11736:5;11734:1;:7;11724:76;;;11780:17;11798:1;11780:20;;;;;;;;;;;;;;;;;;11760:14;11775:1;11760:17;;;;;;;;;;:40;;;;:17;;;;;;;;;;:40;11743:3;;11724:76;;;11232:575;;;;;;:::o;1105:28::-;;;;:::o;4997:207::-;1337:10;1359:4;1337:27;1329:36;;;;;;5099:6;:13;5114:9;839:2;2273:29;;;;;:68;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;5139:8;:20;;;5169:28;;;;;;;;;;;;;;;;;1375:1;;4997:207;:::o;5813:344::-;5896:10;1543:14;;;;:7;:14;;;;;;;;1535:23;;;;;;;;1647:12;:27;;;;;;;;;;:39;5934:13;;1647:39;;:44;;1639:53;;;;;;1924:28;;;;:13;:28;;;;;;;;5985:10;1924:35;;;;;;;;;5970:13;;5985:10;1924:35;;1923:36;1915:45;;;;;;6011:28;;;;6054:4;6011:28;;;;;;;;6040:10;6011:40;;;;;;;;:47;;;;;;;;;;6068:39;;6025:13;;6068:39;;;6117:33;6136:13;6117:18;:33::i;:::-;1702:1;;1568;5813:344;;:::o;5463:244::-;5567:18;5617:40;5632:11;5645:5;5652:4;5617:14;:40::i;:::-;5601:56;;5667:33;5686:13;5667:18;:33::i;:::-;5463:244;;;;;:::o;800:41::-;839:2;800:41;:::o;1079:20::-;;;;:::o;4377:449::-;4548:6;1337:10;1359:4;1337:27;1329:36;;;;;;1543:14;;;;;;;:7;:14;;;;;;4486:5;;1543:14;;1535:23;;;;;;;;1450:14;;;;;;;:7;:14;;;;;;4519:8;;1450:14;;1449:15;1441:24;;;;;;4555:1;4548:8;;4543:149;4560:6;:13;4558:15;;4543:149;;;4609:5;4596:18;;:6;4603:1;4596:9;;;;;;;;;;;;;;;;;;;;;;:18;4592:100;;;4646:8;4634:6;4641:1;4634:9;;;;;;;;;;;;;;;;;;:20;;;;;;;;;;;;;;;;;;4672:5;;4592:100;4575:3;;;;;4543:149;;;4701:14;;;;4718:5;4701:14;;;:7;:14;;;;;;:22;;;;;;;;;4733:17;;;;;;;;:24;;;;;4701:22;4733:24;;;;4767:19;;4701:14;;4767:19;;;4796:23;;;;;;;;;;;1568:1;1375;4377:449;;;:::o;6686:586::-;6769:10;6921:23;1543:14;;;:7;:14;;;;;;6921:23;;6769:10;1543:14;;1535:23;;;;;;;;1788:28;;;;:13;:28;;;;;;;;6814:10;1788:35;;;;;;;;;6799:13;;6814:10;1788:35;;1780:44;;;;;;;;2044:12;:27;;;;;;;;;;:36;;;6846:13;;2044:36;;2043:37;2035:46;;;;;;6879:26;6891:13;6879:11;:26::i;:::-;6875:391;;;6947:12;:27;;;;;;;;;;;;6988:12;;;:19;;;;7003:4;6988:19;;;;;;7039:15;;7056:9;;;;7067:8;;;;:15;;7025:68;;;7067:15;;;;;6988:19;7067:15;;;;;;;;;;;;7025:68;;;;;;;;;;;;;;;;;;6947:27;;-1:-1:-1;7025:68:16;;7039:15;;;;;7056:9;;7025:68;7067:8;:15;;7025:68;;7067:8;:15;7025:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:13;:68::i;:::-;7021:235;;;7111:24;;7121:13;;7111:24;;;;;7021:235;;;7172:31;;7189:13;;7172:31;;;;;7221:12;;;:20;;;;;;7021:235;1834:1;1568;;6686:586;;;:::o;9373:451::-;9505:18;9475:11;2158:13;;;;;2150:22;;;;;;9555:16;;9611:140;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9611:140:16;;;;;;9581:27;;;;;;;;;;:170;;;;;;;;;;;;;;;-1:-1:-1;9581:170:16;;;;;;;9555:16;;-1:-1:-1;9611:140:16;;9581:27;;:170;;;;;;;;;;:::i;:::-;-1:-1:-1;9581:170:16;;;;;;;;;;;;;;;;;;;;;;;9761:16;:21;;-1:-1:-1;9761:21:16;;;9792:25;;9803:13;;9792:25;;-1:-1:-1;;9792:25:16;9373:451;;;;;;:::o;7449:1103::-;7552:4;7568:11;7627:4;7621:11;7760:2;7754:4;7750:13;8425:1;8406;8298:10;8279:1;8256:5;8227:11;7882:5;7877:3;7873:15;7851:662;7841:672;7449:1103;-1:-1:-1;;;;;;;;7449:1103:16:o;206:12628::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;206:12628:16;;;-1:-1:-1;206:12628:16;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;"
+ }
+ }
+ },
+ "sources": {
+ "multisig/MultiSigWallet.sol": {
+ "id": 16
+ }
+ },
+ "sourceCodes": {
+ "multisig/MultiSigWallet.sol": "// solhint-disable\npragma solidity ^0.4.15;\n\n\n/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.\n/// @author Stefan George - <stefan.george@consensys.net>\ncontract MultiSigWallet {\n\n /*\n * Events\n */\n event Confirmation(address indexed sender, uint indexed transactionId);\n event Revocation(address indexed sender, uint indexed transactionId);\n event Submission(uint indexed transactionId);\n event Execution(uint indexed transactionId);\n event ExecutionFailure(uint indexed transactionId);\n event Deposit(address indexed sender, uint value);\n event OwnerAddition(address indexed owner);\n event OwnerRemoval(address indexed owner);\n event RequirementChange(uint required);\n\n /*\n * Constants\n */\n uint constant public MAX_OWNER_COUNT = 50;\n\n /*\n * Storage\n */\n mapping (uint => Transaction) public transactions;\n mapping (uint => mapping (address => bool)) public confirmations;\n mapping (address => bool) public isOwner;\n address[] public owners;\n uint public required;\n uint public transactionCount;\n\n struct Transaction {\n address destination;\n uint value;\n bytes data;\n bool executed;\n }\n\n /*\n * Modifiers\n */\n modifier onlyWallet() {\n require(msg.sender == address(this));\n _;\n }\n\n modifier ownerDoesNotExist(address owner) {\n require(!isOwner[owner]);\n _;\n }\n\n modifier ownerExists(address owner) {\n require(isOwner[owner]);\n _;\n }\n\n modifier transactionExists(uint transactionId) {\n require(transactions[transactionId].destination != 0);\n _;\n }\n\n modifier confirmed(uint transactionId, address owner) {\n require(confirmations[transactionId][owner]);\n _;\n }\n\n modifier notConfirmed(uint transactionId, address owner) {\n require(!confirmations[transactionId][owner]);\n _;\n }\n\n modifier notExecuted(uint transactionId) {\n require(!transactions[transactionId].executed);\n _;\n }\n\n modifier notNull(address _address) {\n require(_address != 0);\n _;\n }\n\n modifier validRequirement(uint ownerCount, uint _required) {\n require(ownerCount <= MAX_OWNER_COUNT\n && _required <= ownerCount\n && _required != 0\n && ownerCount != 0);\n _;\n }\n\n /// @dev Fallback function allows to deposit ether.\n function()\n payable\n {\n if (msg.value > 0)\n Deposit(msg.sender, msg.value);\n }\n\n /*\n * Public functions\n */\n /// @dev Contract constructor sets initial owners and required number of confirmations.\n /// @param _owners List of initial owners.\n /// @param _required Number of required confirmations.\n function MultiSigWallet(address[] _owners, uint _required)\n public\n validRequirement(_owners.length, _required)\n {\n for (uint i=0; i<_owners.length; i++) {\n require(!isOwner[_owners[i]] && _owners[i] != 0);\n isOwner[_owners[i]] = true;\n }\n owners = _owners;\n required = _required;\n }\n\n /// @dev Allows to add a new owner. Transaction has to be sent by wallet.\n /// @param owner Address of new owner.\n function addOwner(address owner)\n public\n onlyWallet\n ownerDoesNotExist(owner)\n notNull(owner)\n validRequirement(owners.length + 1, required)\n {\n isOwner[owner] = true;\n owners.push(owner);\n OwnerAddition(owner);\n }\n\n /// @dev Allows to remove an owner. Transaction has to be sent by wallet.\n /// @param owner Address of owner.\n function removeOwner(address owner)\n public\n onlyWallet\n ownerExists(owner)\n {\n isOwner[owner] = false;\n for (uint i=0; i<owners.length - 1; i++)\n if (owners[i] == owner) {\n owners[i] = owners[owners.length - 1];\n break;\n }\n owners.length -= 1;\n if (required > owners.length)\n changeRequirement(owners.length);\n OwnerRemoval(owner);\n }\n\n /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.\n /// @param owner Address of owner to be replaced.\n /// @param newOwner Address of new owner.\n function replaceOwner(address owner, address newOwner)\n public\n onlyWallet\n ownerExists(owner)\n ownerDoesNotExist(newOwner)\n {\n for (uint i=0; i<owners.length; i++)\n if (owners[i] == owner) {\n owners[i] = newOwner;\n break;\n }\n isOwner[owner] = false;\n isOwner[newOwner] = true;\n OwnerRemoval(owner);\n OwnerAddition(newOwner);\n }\n\n /// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.\n /// @param _required Number of required confirmations.\n function changeRequirement(uint _required)\n public\n onlyWallet\n validRequirement(owners.length, _required)\n {\n required = _required;\n RequirementChange(_required);\n }\n\n /// @dev Allows an owner to submit and confirm a transaction.\n /// @param destination Transaction target address.\n /// @param value Transaction ether value.\n /// @param data Transaction data payload.\n /// @return Returns transaction ID.\n function submitTransaction(address destination, uint value, bytes data)\n public\n returns (uint transactionId)\n {\n transactionId = addTransaction(destination, value, data);\n confirmTransaction(transactionId);\n }\n\n /// @dev Allows an owner to confirm a transaction.\n /// @param transactionId Transaction ID.\n function confirmTransaction(uint transactionId)\n public\n ownerExists(msg.sender)\n transactionExists(transactionId)\n notConfirmed(transactionId, msg.sender)\n {\n confirmations[transactionId][msg.sender] = true;\n Confirmation(msg.sender, transactionId);\n executeTransaction(transactionId);\n }\n\n /// @dev Allows an owner to revoke a confirmation for a transaction.\n /// @param transactionId Transaction ID.\n function revokeConfirmation(uint transactionId)\n public\n ownerExists(msg.sender)\n confirmed(transactionId, msg.sender)\n notExecuted(transactionId)\n {\n confirmations[transactionId][msg.sender] = false;\n Revocation(msg.sender, transactionId);\n }\n\n /// @dev Allows anyone to execute a confirmed transaction.\n /// @param transactionId Transaction ID.\n function executeTransaction(uint transactionId)\n public\n ownerExists(msg.sender)\n confirmed(transactionId, msg.sender)\n notExecuted(transactionId)\n {\n if (isConfirmed(transactionId)) {\n Transaction storage txn = transactions[transactionId];\n txn.executed = true;\n if (external_call(txn.destination, txn.value, txn.data.length, txn.data))\n Execution(transactionId);\n else {\n ExecutionFailure(transactionId);\n txn.executed = false;\n }\n }\n }\n\n // call has been separated into its own function in order to take advantage\n // of the Solidity's code generator to produce a loop that copies tx.data into memory.\n function external_call(address destination, uint value, uint dataLength, bytes data) internal returns (bool) {\n bool result;\n assembly {\n let x := mload(0x40) // \"Allocate\" memory for output (0x40 is where \"free memory\" pointer is stored by convention)\n let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that\n result := call(\n sub(gas, 34710), // 34710 is the value that solidity is currently emitting\n // It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +\n // callNewAccountGas (25000, in case the destination address does not exist and needs creating)\n destination,\n value,\n d,\n dataLength, // Size of the input (in bytes) - this is what fixes the padding problem\n x,\n 0 // Output is ignored, therefore the output size is zero\n )\n }\n return result;\n }\n\n /// @dev Returns the confirmation status of a transaction.\n /// @param transactionId Transaction ID.\n /// @return Confirmation status.\n function isConfirmed(uint transactionId)\n public\n constant\n returns (bool)\n {\n uint count = 0;\n for (uint i=0; i<owners.length; i++) {\n if (confirmations[transactionId][owners[i]])\n count += 1;\n if (count == required)\n return true;\n }\n }\n\n /*\n * Internal functions\n */\n /// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.\n /// @param destination Transaction target address.\n /// @param value Transaction ether value.\n /// @param data Transaction data payload.\n /// @return Returns transaction ID.\n function addTransaction(address destination, uint value, bytes data)\n internal\n notNull(destination)\n returns (uint transactionId)\n {\n transactionId = transactionCount;\n transactions[transactionId] = Transaction({\n destination: destination,\n value: value,\n data: data,\n executed: false\n });\n transactionCount += 1;\n Submission(transactionId);\n }\n\n /*\n * Web3 call functions\n */\n /// @dev Returns number of confirmations of a transaction.\n /// @param transactionId Transaction ID.\n /// @return Number of confirmations.\n function getConfirmationCount(uint transactionId)\n public\n constant\n returns (uint count)\n {\n for (uint i=0; i<owners.length; i++)\n if (confirmations[transactionId][owners[i]])\n count += 1;\n }\n\n /// @dev Returns total number of transactions after filers are applied.\n /// @param pending Include pending transactions.\n /// @param executed Include executed transactions.\n /// @return Total number of transactions after filters are applied.\n function getTransactionCount(bool pending, bool executed)\n public\n constant\n returns (uint count)\n {\n for (uint i=0; i<transactionCount; i++)\n if ( pending && !transactions[i].executed\n || executed && transactions[i].executed)\n count += 1;\n }\n\n /// @dev Returns list of owners.\n /// @return List of owner addresses.\n function getOwners()\n public\n constant\n returns (address[])\n {\n return owners;\n }\n\n /// @dev Returns array with owner addresses, which confirmed transaction.\n /// @param transactionId Transaction ID.\n /// @return Returns array of owner addresses.\n function getConfirmations(uint transactionId)\n public\n constant\n returns (address[] _confirmations)\n {\n address[] memory confirmationsTemp = new address[](owners.length);\n uint count = 0;\n uint i;\n for (i=0; i<owners.length; i++)\n if (confirmations[transactionId][owners[i]]) {\n confirmationsTemp[count] = owners[i];\n count += 1;\n }\n _confirmations = new address[](count);\n for (i=0; i<count; i++)\n _confirmations[i] = confirmationsTemp[i];\n }\n\n /// @dev Returns list of transaction IDs in defined range.\n /// @param from Index start position of transaction array.\n /// @param to Index end position of transaction array.\n /// @param pending Include pending transactions.\n /// @param executed Include executed transactions.\n /// @return Returns array of transaction IDs.\n function getTransactionIds(uint from, uint to, bool pending, bool executed)\n public\n constant\n returns (uint[] _transactionIds)\n {\n uint[] memory transactionIdsTemp = new uint[](transactionCount);\n uint count = 0;\n uint i;\n for (i=0; i<transactionCount; i++)\n if ( pending && !transactions[i].executed\n || executed && transactions[i].executed)\n {\n transactionIdsTemp[count] = i;\n count += 1;\n }\n _transactionIds = new uint[](to - from);\n for (i=from; i<to; i++)\n _transactionIds[i - from] = transactionIdsTemp[i];\n }\n}"
+ },
+ "sourceTreeHashHex": "0x960961fe6f74d74cb4aa95376a52cc114f07f4b00bde9ddd056d2eb1b1bbcb35",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/MultiSigWalletWithTimeLock.json b/packages/contracts/generated-artifacts/MultiSigWalletWithTimeLock.json
new file mode 100644
index 000000000..a6ae0ff7c
--- /dev/null
+++ b/packages/contracts/generated-artifacts/MultiSigWalletWithTimeLock.json
@@ -0,0 +1,668 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "MultiSigWalletWithTimeLock",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "owners",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "removeOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "revokeConfirmation",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "isOwner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "confirmations",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "secondsTimeLocked",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "pending",
+ "type": "bool"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "name": "getTransactionCount",
+ "outputs": [
+ {
+ "name": "count",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "addOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "isConfirmed",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_secondsTimeLocked",
+ "type": "uint256"
+ }
+ ],
+ "name": "changeTimeLock",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getConfirmationCount",
+ "outputs": [
+ {
+ "name": "count",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "transactions",
+ "outputs": [
+ {
+ "name": "destination",
+ "type": "address"
+ },
+ {
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getOwners",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "from",
+ "type": "uint256"
+ },
+ {
+ "name": "to",
+ "type": "uint256"
+ },
+ {
+ "name": "pending",
+ "type": "bool"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "name": "getTransactionIds",
+ "outputs": [
+ {
+ "name": "_transactionIds",
+ "type": "uint256[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getConfirmations",
+ "outputs": [
+ {
+ "name": "_confirmations",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "transactionCount",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_required",
+ "type": "uint256"
+ }
+ ],
+ "name": "changeRequirement",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "confirmTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "destination",
+ "type": "address"
+ },
+ {
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "name": "submitTransaction",
+ "outputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "confirmationTimes",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "MAX_OWNER_COUNT",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "required",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "replaceOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "executeTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_owners",
+ "type": "address[]"
+ },
+ {
+ "name": "_required",
+ "type": "uint256"
+ },
+ {
+ "name": "_secondsTimeLocked",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "fallback"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "confirmationTime",
+ "type": "uint256"
+ }
+ ],
+ "name": "ConfirmationTimeSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "secondsTimeLocked",
+ "type": "uint256"
+ }
+ ],
+ "name": "TimeLockChange",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Confirmation",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Revocation",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Submission",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Execution",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "ExecutionFailure",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Deposit",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnerAddition",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnerRemoval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "required",
+ "type": "uint256"
+ }
+ ],
+ "name": "RequirementChange",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040523480156200001157600080fd5b5060405162001cc938038062001cc9833981016040908152815160208301519183015192018051909290839083906000908260328211801590620000555750818111155b80156200006157508015155b80156200006d57508115155b15156200007957600080fd5b600092505b845183101562000151576002600086858151811015156200009b57fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16158015620000f157508483815181101515620000d957fe5b90602001906020020151600160a060020a0316600014155b1515620000fd57600080fd5b60016002600087868151811015156200011257fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff1916911515919091179055600192909201916200007e565b8451620001669060039060208801906200017d565b505050600491909155505060065550620002119050565b828054828255906000526020600020908101928215620001d5579160200282015b82811115620001d55782518254600160a060020a031916600160a060020a039091161782556020909201916001909101906200019e565b50620001e3929150620001e7565b5090565b6200020e91905b80821115620001e3578054600160a060020a0319168155600101620001ee565b90565b611aa880620002216000396000f30060806040526004361061013d5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461017f578063173825d9146101c057806320ea8d86146101ee5780632f54bf6e146102065780633411c81c1461024857806337bd78a01461027957806354741525146102a05780637065cb48146102bf578063784547a7146102ed5780637ad28c51146103055780638b51d13f1461031d5780639ace38c214610335578063a0e67e2b1461040a578063a8abe69a1461046f578063b5dc40c314610494578063b77bf600146104ac578063ba51a6df146104c1578063c01a8c84146104d9578063c6427474146104f1578063d38f2d8214610567578063d74f8edd1461057f578063dc8452cd14610594578063e20056e6146105a9578063ee22610b146105dd575b600034111561017d5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561018b57600080fd5b506101976004356105f5565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101cc57600080fd5b5061017d73ffffffffffffffffffffffffffffffffffffffff6004351661062a565b3480156101fa57600080fd5b5061017d600435610881565b34801561021257600080fd5b5061023473ffffffffffffffffffffffffffffffffffffffff60043516610959565b604080519115158252519081900360200190f35b34801561025457600080fd5b5061023460043573ffffffffffffffffffffffffffffffffffffffff6024351661096e565b34801561028557600080fd5b5061028e61098e565b60408051918252519081900360200190f35b3480156102ac57600080fd5b5061028e60043515156024351515610994565b3480156102cb57600080fd5b5061017d73ffffffffffffffffffffffffffffffffffffffff60043516610a00565b3480156102f957600080fd5b50610234600435610b75565b34801561031157600080fd5b5061017d600435610c06565b34801561032957600080fd5b5061028e600435610c4d565b34801561034157600080fd5b5061034d600435610cc9565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156103cc5781810151838201526020016103b4565b50505050905090810190601f1680156103f95780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561041657600080fd5b5061041f610db2565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561045b578181015183820152602001610443565b505050509050019250505060405180910390f35b34801561047b57600080fd5b5061041f60043560243560443515156064351515610e22565b3480156104a057600080fd5b5061041f600435610f5b565b3480156104b857600080fd5b5061028e611108565b3480156104cd57600080fd5b5061017d60043561110e565b3480156104e557600080fd5b5061017d60043561118d565b3480156104fd57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261028e94823573ffffffffffffffffffffffffffffffffffffffff169460248035953695946064949201919081908401838280828437509497506113099650505050505050565b34801561057357600080fd5b5061028e600435611328565b34801561058b57600080fd5b5061028e61133a565b3480156105a057600080fd5b5061028e61133f565b3480156105b557600080fd5b5061017d73ffffffffffffffffffffffffffffffffffffffff60043581169060243516611345565b3480156105e957600080fd5b5061017d600435611555565b600380548290811061060357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b600033301461063857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054829060ff16151561066e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905591505b6003547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018210156107f1578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561070e57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156107e657600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061076657fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff909216918490811061079957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506107f1565b6001909101906106bc565b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061082290826119bb565b50600354600454111561083b5760035461083b9061110e565b60405173ffffffffffffffffffffffffffffffffffffffff8416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff16151561089f57600080fd5b60008281526001602090815260408083203380855292529091205483919060ff1615156108cb57600080fd5b600084815260208190526040902060030154849060ff16156108ec57600080fd5b600085815260016020908152604080832033808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b60065481565b6000805b6005548110156109f9578380156109c1575060008181526020819052604090206003015460ff16155b806109e557508280156109e5575060008181526020819052604090206003015460ff165b156109f1576001820191505b600101610998565b5092915050565b333014610a0c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054819060ff1615610a4157600080fd5b8173ffffffffffffffffffffffffffffffffffffffff81161515610a6457600080fd5b60038054905060010160045460328211158015610a815750818111155b8015610a8c57508015155b8015610a9757508115155b1515610aa257600080fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b600354811015610bff5760008481526001602052604081206003805491929184908110610ba357fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610be4576001820191505b600454821415610bf75760019250610bff565b600101610b7a565b5050919050565b333014610c1257600080fd5b60068190556040805182815290517fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b43779181900360200190a150565b6000805b600354811015610cc35760008381526001602052604081206003805491929184908110610c7a57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610cbb576001820191505b600101610c51565b50919050565b60006020818152918152604090819020805460018083015460028085018054875161010095821615959095027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f810188900488028401880190965285835273ffffffffffffffffffffffffffffffffffffffff90931695909491929190830182828015610d9f5780601f10610d7457610100808354040283529160200191610d9f565b820191906000526020600020905b815481529060010190602001808311610d8257829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610e1757602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dec575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610e54578160200160208202803883390190505b50925060009150600090505b600554811015610edb57858015610e89575060008181526020819052604090206003015460ff16155b80610ead5750848015610ead575060008181526020819052604090206003015460ff165b15610ed357808383815181101515610ec157fe5b60209081029091010152600191909101905b600101610e60565b878703604051908082528060200260200182016040528015610f07578160200160208202803883390190505b5093508790505b86811015610f50578281815181101515610f2457fe5b9060200190602002015184898303815181101515610f3e57fe5b60209081029091010152600101610f0e565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610f90578160200160208202803883390190505b50925060009150600090505b6003548110156110745760008581526001602052604081206003805491929184908110610fc557fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff161561106c57600380548290811061100d57fe5b600091825260209091200154835173ffffffffffffffffffffffffffffffffffffffff9091169084908490811061104057fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600191909101905b600101610f9c565b8160405190808252806020026020018201604052801561109e578160200160208202803883390190505b509350600090505b818110156111005782818151811015156110bc57fe5b9060200190602002015184828151811015156110d457fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302909101909101526001016110a6565b505050919050565b60055481565b33301461111a57600080fd5b600354816032821180159061112f5750818111155b801561113a57508015155b801561114557508115155b151561115057600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff1615156111ab57600080fd5b600082815260208190526040902054829073ffffffffffffffffffffffffffffffffffffffff1615156111dd57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff161561120857600080fd5b8461121281610b75565b1561127e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f54585f46554c4c595f434f4e4649524d45440000000000000000000000000000604482015290519081900360640190fd5b600086815260016020818152604080842033808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909317909255905188927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a36112f286610b75565b1561130157611301864261181a565b505050505050565b6000611316848484611865565b90506113218161118d565b9392505050565b60076020526000908152604090205481565b603281565b60045481565b600033301461135357600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff16151561138957600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff16156113be57600080fd5b600092505b600354831015611483578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156113f357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611478578360038481548110151561142b57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611483565b6001909201916113c3565b73ffffffffffffffffffffffffffffffffffffffff80861660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a260405173ffffffffffffffffffffffffffffffffffffffff8516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b600081815260208190526040812060030154829060ff161561157657600080fd5b8261158081610b75565b15156115ed57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604482015290519081900360640190fd5b60065460008581526007602052604090205485910142101561167057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f54494d455f4c4f434b5f494e434f4d504c455445000000000000000000000000604482015290519081900360640190fd5b600085815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff978316156101000297909701909116929092049485018790048702820187019097528381529399506117889573ffffffffffffffffffffffffffffffffffffffff9092169490939190839083018282801561177e5780601f106117535761010080835404028352916020019161177e565b820191906000526020600020905b81548152906001019060200180831161176157829003601f168201915b5050505050611998565b156117bd5760405185907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2611813565b60405185907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b5050505050565b6000828152600760209081526040918290208390558151838152915184927f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d92908290030190a25050565b60008373ffffffffffffffffffffffffffffffffffffffff8116151561188a57600080fd5b6005546040805160808101825273ffffffffffffffffffffffffffffffffffffffff8881168252602080830189815283850189815260006060860181905287815280845295909520845181547fffffffffffffffffffffffff000000000000000000000000000000000000000016941693909317835551600183015592518051949650919390926119229260028501929101906119e4565b5060609190910151600390910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b8154818355818111156119df576000838152602090206119df918101908301611a62565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611a2557805160ff1916838001178555611a52565b82800160010185558215611a52579182015b82811115611a52578251825591602001919060010190611a37565b50611a5e929150611a62565b5090565b610e1f91905b80821115611a5e5760008155600101611a685600a165627a7a72305820e5babec10610b2cd6468fa63c48e69cdad30621a7c944401386af3715285734e0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x1CC9 CODESIZE SUB DUP1 PUSH3 0x1CC9 DUP4 CODECOPY DUP2 ADD PUSH1 0x40 SWAP1 DUP2 MSTORE DUP2 MLOAD PUSH1 0x20 DUP4 ADD MLOAD SWAP2 DUP4 ADD MLOAD SWAP3 ADD DUP1 MLOAD SWAP1 SWAP3 SWAP1 DUP4 SWAP1 DUP4 SWAP1 PUSH1 0x0 SWAP1 DUP3 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH3 0x55 JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH3 0x61 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH3 0x6D JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH3 0x79 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST DUP5 MLOAD DUP4 LT ISZERO PUSH3 0x151 JUMPI PUSH1 0x2 PUSH1 0x0 DUP7 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x9B JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP3 MSTORE DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x40 ADD PUSH1 0x0 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO DUP1 ISZERO PUSH3 0xF1 JUMPI POP DUP5 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0xD9 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 EQ ISZERO JUMPDEST ISZERO ISZERO PUSH3 0xFD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x2 PUSH1 0x0 DUP8 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x112 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP3 MSTORE DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x40 ADD PUSH1 0x0 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x1 SWAP3 SWAP1 SWAP3 ADD SWAP2 PUSH3 0x7E JUMP JUMPDEST DUP5 MLOAD PUSH3 0x166 SWAP1 PUSH1 0x3 SWAP1 PUSH1 0x20 DUP9 ADD SWAP1 PUSH3 0x17D JUMP JUMPDEST POP POP POP PUSH1 0x4 SWAP2 SWAP1 SWAP2 SSTORE POP POP PUSH1 0x6 SSTORE POP PUSH3 0x211 SWAP1 POP JUMP JUMPDEST DUP3 DUP1 SLOAD DUP3 DUP3 SSTORE SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 DUP2 ADD SWAP3 DUP3 ISZERO PUSH3 0x1D5 JUMPI SWAP2 PUSH1 0x20 MUL DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0x1D5 JUMPI DUP3 MLOAD DUP3 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP2 AND OR DUP3 SSTORE PUSH1 0x20 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH3 0x19E JUMP JUMPDEST POP PUSH3 0x1E3 SWAP3 SWAP2 POP PUSH3 0x1E7 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x20E SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x1E3 JUMPI DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x1EE JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x1AA8 DUP1 PUSH3 0x221 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x13D JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x25E7C27 DUP2 EQ PUSH2 0x17F JUMPI DUP1 PUSH4 0x173825D9 EQ PUSH2 0x1C0 JUMPI DUP1 PUSH4 0x20EA8D86 EQ PUSH2 0x1EE JUMPI DUP1 PUSH4 0x2F54BF6E EQ PUSH2 0x206 JUMPI DUP1 PUSH4 0x3411C81C EQ PUSH2 0x248 JUMPI DUP1 PUSH4 0x37BD78A0 EQ PUSH2 0x279 JUMPI DUP1 PUSH4 0x54741525 EQ PUSH2 0x2A0 JUMPI DUP1 PUSH4 0x7065CB48 EQ PUSH2 0x2BF JUMPI DUP1 PUSH4 0x784547A7 EQ PUSH2 0x2ED JUMPI DUP1 PUSH4 0x7AD28C51 EQ PUSH2 0x305 JUMPI DUP1 PUSH4 0x8B51D13F EQ PUSH2 0x31D JUMPI DUP1 PUSH4 0x9ACE38C2 EQ PUSH2 0x335 JUMPI DUP1 PUSH4 0xA0E67E2B EQ PUSH2 0x40A JUMPI DUP1 PUSH4 0xA8ABE69A EQ PUSH2 0x46F JUMPI DUP1 PUSH4 0xB5DC40C3 EQ PUSH2 0x494 JUMPI DUP1 PUSH4 0xB77BF600 EQ PUSH2 0x4AC JUMPI DUP1 PUSH4 0xBA51A6DF EQ PUSH2 0x4C1 JUMPI DUP1 PUSH4 0xC01A8C84 EQ PUSH2 0x4D9 JUMPI DUP1 PUSH4 0xC6427474 EQ PUSH2 0x4F1 JUMPI DUP1 PUSH4 0xD38F2D82 EQ PUSH2 0x567 JUMPI DUP1 PUSH4 0xD74F8EDD EQ PUSH2 0x57F JUMPI DUP1 PUSH4 0xDC8452CD EQ PUSH2 0x594 JUMPI DUP1 PUSH4 0xE20056E6 EQ PUSH2 0x5A9 JUMPI DUP1 PUSH4 0xEE22610B EQ PUSH2 0x5DD JUMPI JUMPDEST PUSH1 0x0 CALLVALUE GT ISZERO PUSH2 0x17D JUMPI PUSH1 0x40 DUP1 MLOAD CALLVALUE DUP2 MSTORE SWAP1 MLOAD CALLER SWAP2 PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C SWAP2 SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG2 JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x18B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x197 PUSH1 0x4 CALLDATALOAD PUSH2 0x5F5 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x62A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1FA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH1 0x4 CALLDATALOAD PUSH2 0x881 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x212 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x234 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x959 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x254 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x234 PUSH1 0x4 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x24 CALLDATALOAD AND PUSH2 0x96E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x285 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH2 0x98E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2AC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH1 0x4 CALLDATALOAD ISZERO ISZERO PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0x994 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2CB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xA00 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x234 PUSH1 0x4 CALLDATALOAD PUSH2 0xB75 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x311 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH1 0x4 CALLDATALOAD PUSH2 0xC06 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x329 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH1 0x4 CALLDATALOAD PUSH2 0xC4D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x341 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x34D PUSH1 0x4 CALLDATALOAD PUSH2 0xCC9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x3CC JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x3B4 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x3F9 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP6 POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x416 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x41F PUSH2 0xDB2 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x45B JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x443 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x47B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x41F PUSH1 0x4 CALLDATALOAD PUSH1 0x24 CALLDATALOAD PUSH1 0x44 CALLDATALOAD ISZERO ISZERO PUSH1 0x64 CALLDATALOAD ISZERO ISZERO PUSH2 0xE22 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x41F PUSH1 0x4 CALLDATALOAD PUSH2 0xF5B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4B8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH2 0x1108 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4CD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH1 0x4 CALLDATALOAD PUSH2 0x110E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH1 0x4 CALLDATALOAD PUSH2 0x118D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x28E SWAP5 DUP3 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x1309 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x573 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH1 0x4 CALLDATALOAD PUSH2 0x1328 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x58B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH2 0x133A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH2 0x133F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5B5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x1345 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5E9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH1 0x4 CALLDATALOAD PUSH2 0x1555 JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x603 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x638 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x66E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP2 POP JUMPDEST PUSH1 0x3 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP3 LT ISZERO PUSH2 0x7F1 JUMPI DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x70E JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x7E6 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x766 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x3 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x799 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x7F1 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x6BC JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x822 SWAP1 DUP3 PUSH2 0x19BB JUMP JUMPDEST POP PUSH1 0x3 SLOAD PUSH1 0x4 SLOAD GT ISZERO PUSH2 0x83B JUMPI PUSH1 0x3 SLOAD PUSH2 0x83B SWAP1 PUSH2 0x110E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x89F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP4 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x8CB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD DUP5 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x8EC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE MLOAD DUP8 SWAP3 PUSH32 0xF6A317157440607F36269043EB55F1287A5A19BA2216AFEAB88CD46CBCFB88E9 SWAP2 LOG3 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0x9F9 JUMPI DUP4 DUP1 ISZERO PUSH2 0x9C1 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0x9E5 JUMPI POP DUP3 DUP1 ISZERO PUSH2 0x9E5 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0x9F1 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0x998 JUMP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0xA0C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xA41 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0xA64 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x1 ADD PUSH1 0x4 SLOAD PUSH1 0x32 DUP3 GT ISZERO DUP1 ISZERO PUSH2 0xA81 JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0xA8C JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0xA97 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0xAA2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE PUSH1 0x3 DUP1 SLOAD SWAP2 DUP3 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0xC2575A0E9E593C00F959F8C92F12DB2869C3395A3B0502D05E2516446F71F85B ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP2 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0xBFF JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xBA3 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xBE4 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x4 SLOAD DUP3 EQ ISZERO PUSH2 0xBF7 JUMPI PUSH1 0x1 SWAP3 POP PUSH2 0xBFF JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0xB7A JUMP JUMPDEST POP POP SWAP2 SWAP1 POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0xC12 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x6 DUP2 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xD1C9101A34FEFF75CCCEF14A28785A0279CB0B49C1F321F21F5F422E746B4377 SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0xCC3 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xC7A JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xCBB JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0xC51 JUMP JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP2 DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP1 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP8 MLOAD PUSH2 0x100 SWAP6 DUP3 AND ISZERO SWAP6 SWAP1 SWAP6 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD AND SWAP2 SWAP1 SWAP2 DIV PUSH1 0x1F DUP2 ADD DUP9 SWAP1 DIV DUP9 MUL DUP5 ADD DUP9 ADD SWAP1 SWAP7 MSTORE DUP6 DUP4 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND SWAP6 SWAP1 SWAP5 SWAP2 SWAP3 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xD9F JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xD74 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD9F JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xD82 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP PUSH1 0x3 SWAP1 SWAP4 ADD SLOAD SWAP2 SWAP3 POP POP PUSH1 0xFF AND DUP5 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0xE17 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xDEC JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x5 SLOAD PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xE54 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0xEDB JUMPI DUP6 DUP1 ISZERO PUSH2 0xE89 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0xEAD JUMPI POP DUP5 DUP1 ISZERO PUSH2 0xEAD JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0xED3 JUMPI DUP1 DUP4 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xEC1 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0xE60 JUMP JUMPDEST DUP8 DUP8 SUB PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xF07 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP DUP8 SWAP1 POP JUMPDEST DUP7 DUP2 LT ISZERO PUSH2 0xF50 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xF24 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP10 DUP4 SUB DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xF3E JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0xF0E JUMP JUMPDEST POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xF90 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x1074 JUMPI PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xFC5 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x106C JUMPI PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x100D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD DUP4 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP2 LT PUSH2 0x1040 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0xF9C JUMP JUMPDEST DUP2 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x109E JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x1100 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x10BC JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x10D4 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 ADD PUSH2 0x10A6 JUMP JUMPDEST POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x5 SLOAD DUP2 JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x111A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 SLOAD DUP2 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH2 0x112F JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x113A JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1145 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x1150 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x4 DUP4 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP5 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xA3F1EE9126A074D9326C682F561767F710E927FAA811F7A99829D49DC421797A SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x11AB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO ISZERO PUSH2 0x11DD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP5 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1208 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 PUSH2 0x1212 DUP2 PUSH2 0xB75 JUMP JUMPDEST ISZERO PUSH2 0x127E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F46554C4C595F434F4E4649524D45440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 CALLER DUP1 DUP7 MSTORE SWAP3 MSTORE DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SWAP4 OR SWAP1 SWAP3 SSTORE SWAP1 MLOAD DUP9 SWAP3 PUSH32 0x4A504A94899432A9846E1AA406DCEB1BCFD538BB839071D49D1E5E23F5BE30EF SWAP2 LOG3 PUSH2 0x12F2 DUP7 PUSH2 0xB75 JUMP JUMPDEST ISZERO PUSH2 0x1301 JUMPI PUSH2 0x1301 DUP7 TIMESTAMP PUSH2 0x181A JUMP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1316 DUP5 DUP5 DUP5 PUSH2 0x1865 JUMP JUMPDEST SWAP1 POP PUSH2 0x1321 DUP2 PUSH2 0x118D JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x32 DUP2 JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x1353 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1389 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x13BE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST PUSH1 0x3 SLOAD DUP4 LT ISZERO PUSH2 0x1483 JUMPI DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x13F3 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x1478 JUMPI DUP4 PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x142B JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x1483 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x13C3 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 SWAP1 DUP2 AND SWAP1 SWAP2 SSTORE SWAP4 DUP9 AND DUP3 MSTORE DUP1 DUP3 KECCAK256 DUP1 SLOAD SWAP1 SWAP5 AND PUSH1 0x1 OR SWAP1 SWAP4 SSTORE SWAP2 MLOAD SWAP1 SWAP2 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP2 LOG2 PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP1 PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 ADD SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1576 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 PUSH2 0x1580 DUP2 PUSH2 0xB75 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x15ED JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F4E4F545F46554C4C595F434F4E4649524D454400000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x6 SLOAD PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP6 SWAP2 ADD TIMESTAMP LT ISZERO PUSH2 0x1670 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x14 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54494D455F4C4F434B5F494E434F4D504C455445000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP10 POP PUSH2 0x1788 SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x177E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1753 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x177E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1761 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x1998 JUMP JUMPDEST ISZERO PUSH2 0x17BD JUMPI PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0x1813 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP5 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP4 SWAP1 SSTORE DUP2 MLOAD DUP4 DUP2 MSTORE SWAP2 MLOAD DUP5 SWAP3 PUSH32 0xB237AFE65F1514FD7EA3F923EA4FE792BDD07000A912B6CD1602A8E7F573C8D SWAP3 SWAP1 DUP3 SWAP1 SUB ADD SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x188A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x80 DUP2 ADD DUP3 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 DUP2 AND DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD DUP10 DUP2 MSTORE DUP4 DUP6 ADD DUP10 DUP2 MSTORE PUSH1 0x0 PUSH1 0x60 DUP7 ADD DUP2 SWAP1 MSTORE DUP8 DUP2 MSTORE DUP1 DUP5 MSTORE SWAP6 SWAP1 SWAP6 KECCAK256 DUP5 MLOAD DUP2 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 SSTORE MLOAD PUSH1 0x1 DUP4 ADD SSTORE SWAP3 MLOAD DUP1 MLOAD SWAP5 SWAP7 POP SWAP2 SWAP4 SWAP1 SWAP3 PUSH2 0x1922 SWAP3 PUSH1 0x2 DUP6 ADD SWAP3 SWAP2 ADD SWAP1 PUSH2 0x19E4 JUMP JUMPDEST POP PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD MLOAD PUSH1 0x3 SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x5 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE PUSH1 0x40 MLOAD DUP3 SWAP1 PUSH32 0xC0BA8FE4B176C1714197D43B9CC6BCF797A4A7461C5FE8D0EF6E184AE7601E51 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 MLOAD PUSH1 0x20 DUP5 ADD PUSH1 0x0 DUP3 DUP8 DUP4 DUP11 DUP13 PUSH2 0x8796 GAS SUB CALL SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0x19DF JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0x19DF SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0x1A62 JUMP JUMPDEST POP POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x1A25 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x1A52 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x1A52 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x1A52 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x1A37 JUMP JUMPDEST POP PUSH2 0x1A5E SWAP3 SWAP2 POP PUSH2 0x1A62 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0xE1F SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x1A5E JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x1A68 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xe5 0xba 0xbe 0xc1 MOD LT 0xb2 0xcd PUSH5 0x68FA63C48E PUSH10 0xCDAD30621A7C94440138 PUSH11 0xF3715285734E0029000000 ",
+ "sourceMap": "851:3344:17:-;;;2064:226;8:9:-1;5:2;;;30:1;27;20:12;5:2;2064:226:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;2934:14:16;;2064:226:17;;;;;;;2980:6:16;;2064:226:17;839:2:16;2273:29;;;;;:68;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;2987:1;2980:8;;2975:151;2992:7;:14;2990:1;:16;2975:151;;;3036:7;:19;3044:7;3052:1;3044:10;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3036:19:16;;;;;;;;;;;-1:-1:-1;3036:19:16;;;;3035:20;:39;;;;;3059:7;3067:1;3059:10;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3059:15:16;3073:1;3059:15;;3035:39;3027:48;;;;;;;;3111:4;3089:7;:19;3097:7;3105:1;3097:10;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3089:19:16;;;;;;;;;;;-1:-1:-1;3089:19:16;:26;;-1:-1:-1;;3089:26:16;;;;;;;;;;-1:-1:-1;3008:3:16;;;;;2975:151;;;3135:16;;;;:6;;:16;;;;;:::i;:::-;-1:-1:-1;;;3161:8:16;:20;;;;-1:-1:-1;;2245:17:17;:38;-1:-1:-1;851:3344:17;;-1:-1:-1;851:3344:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;851:3344:17;-1:-1:-1;;;;;851:3344:17;;;;;;;;;;;-1:-1:-1;851:3344:17;;;;;;;-1:-1:-1;851:3344:17;;;-1:-1:-1;851:3344:17;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;;;;;;851:3344:17;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526004361061013d5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461017f578063173825d9146101c057806320ea8d86146101ee5780632f54bf6e146102065780633411c81c1461024857806337bd78a01461027957806354741525146102a05780637065cb48146102bf578063784547a7146102ed5780637ad28c51146103055780638b51d13f1461031d5780639ace38c214610335578063a0e67e2b1461040a578063a8abe69a1461046f578063b5dc40c314610494578063b77bf600146104ac578063ba51a6df146104c1578063c01a8c84146104d9578063c6427474146104f1578063d38f2d8214610567578063d74f8edd1461057f578063dc8452cd14610594578063e20056e6146105a9578063ee22610b146105dd575b600034111561017d5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561018b57600080fd5b506101976004356105f5565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101cc57600080fd5b5061017d73ffffffffffffffffffffffffffffffffffffffff6004351661062a565b3480156101fa57600080fd5b5061017d600435610881565b34801561021257600080fd5b5061023473ffffffffffffffffffffffffffffffffffffffff60043516610959565b604080519115158252519081900360200190f35b34801561025457600080fd5b5061023460043573ffffffffffffffffffffffffffffffffffffffff6024351661096e565b34801561028557600080fd5b5061028e61098e565b60408051918252519081900360200190f35b3480156102ac57600080fd5b5061028e60043515156024351515610994565b3480156102cb57600080fd5b5061017d73ffffffffffffffffffffffffffffffffffffffff60043516610a00565b3480156102f957600080fd5b50610234600435610b75565b34801561031157600080fd5b5061017d600435610c06565b34801561032957600080fd5b5061028e600435610c4d565b34801561034157600080fd5b5061034d600435610cc9565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156103cc5781810151838201526020016103b4565b50505050905090810190601f1680156103f95780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561041657600080fd5b5061041f610db2565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561045b578181015183820152602001610443565b505050509050019250505060405180910390f35b34801561047b57600080fd5b5061041f60043560243560443515156064351515610e22565b3480156104a057600080fd5b5061041f600435610f5b565b3480156104b857600080fd5b5061028e611108565b3480156104cd57600080fd5b5061017d60043561110e565b3480156104e557600080fd5b5061017d60043561118d565b3480156104fd57600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261028e94823573ffffffffffffffffffffffffffffffffffffffff169460248035953695946064949201919081908401838280828437509497506113099650505050505050565b34801561057357600080fd5b5061028e600435611328565b34801561058b57600080fd5b5061028e61133a565b3480156105a057600080fd5b5061028e61133f565b3480156105b557600080fd5b5061017d73ffffffffffffffffffffffffffffffffffffffff60043581169060243516611345565b3480156105e957600080fd5b5061017d600435611555565b600380548290811061060357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b600033301461063857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054829060ff16151561066e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905591505b6003547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018210156107f1578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561070e57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156107e657600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061076657fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff909216918490811061079957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506107f1565b6001909101906106bc565b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061082290826119bb565b50600354600454111561083b5760035461083b9061110e565b60405173ffffffffffffffffffffffffffffffffffffffff8416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff16151561089f57600080fd5b60008281526001602090815260408083203380855292529091205483919060ff1615156108cb57600080fd5b600084815260208190526040902060030154849060ff16156108ec57600080fd5b600085815260016020908152604080832033808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b60065481565b6000805b6005548110156109f9578380156109c1575060008181526020819052604090206003015460ff16155b806109e557508280156109e5575060008181526020819052604090206003015460ff165b156109f1576001820191505b600101610998565b5092915050565b333014610a0c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054819060ff1615610a4157600080fd5b8173ffffffffffffffffffffffffffffffffffffffff81161515610a6457600080fd5b60038054905060010160045460328211158015610a815750818111155b8015610a8c57508015155b8015610a9757508115155b1515610aa257600080fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b600354811015610bff5760008481526001602052604081206003805491929184908110610ba357fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610be4576001820191505b600454821415610bf75760019250610bff565b600101610b7a565b5050919050565b333014610c1257600080fd5b60068190556040805182815290517fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b43779181900360200190a150565b6000805b600354811015610cc35760008381526001602052604081206003805491929184908110610c7a57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610cbb576001820191505b600101610c51565b50919050565b60006020818152918152604090819020805460018083015460028085018054875161010095821615959095027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f810188900488028401880190965285835273ffffffffffffffffffffffffffffffffffffffff90931695909491929190830182828015610d9f5780601f10610d7457610100808354040283529160200191610d9f565b820191906000526020600020905b815481529060010190602001808311610d8257829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610e1757602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dec575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610e54578160200160208202803883390190505b50925060009150600090505b600554811015610edb57858015610e89575060008181526020819052604090206003015460ff16155b80610ead5750848015610ead575060008181526020819052604090206003015460ff165b15610ed357808383815181101515610ec157fe5b60209081029091010152600191909101905b600101610e60565b878703604051908082528060200260200182016040528015610f07578160200160208202803883390190505b5093508790505b86811015610f50578281815181101515610f2457fe5b9060200190602002015184898303815181101515610f3e57fe5b60209081029091010152600101610f0e565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610f90578160200160208202803883390190505b50925060009150600090505b6003548110156110745760008581526001602052604081206003805491929184908110610fc557fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff161561106c57600380548290811061100d57fe5b600091825260209091200154835173ffffffffffffffffffffffffffffffffffffffff9091169084908490811061104057fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600191909101905b600101610f9c565b8160405190808252806020026020018201604052801561109e578160200160208202803883390190505b509350600090505b818110156111005782818151811015156110bc57fe5b9060200190602002015184828151811015156110d457fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302909101909101526001016110a6565b505050919050565b60055481565b33301461111a57600080fd5b600354816032821180159061112f5750818111155b801561113a57508015155b801561114557508115155b151561115057600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff1615156111ab57600080fd5b600082815260208190526040902054829073ffffffffffffffffffffffffffffffffffffffff1615156111dd57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff161561120857600080fd5b8461121281610b75565b1561127e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f54585f46554c4c595f434f4e4649524d45440000000000000000000000000000604482015290519081900360640190fd5b600086815260016020818152604080842033808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909317909255905188927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a36112f286610b75565b1561130157611301864261181a565b505050505050565b6000611316848484611865565b90506113218161118d565b9392505050565b60076020526000908152604090205481565b603281565b60045481565b600033301461135357600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff16151561138957600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff16156113be57600080fd5b600092505b600354831015611483578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156113f357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611478578360038481548110151561142b57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611483565b6001909201916113c3565b73ffffffffffffffffffffffffffffffffffffffff80861660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a260405173ffffffffffffffffffffffffffffffffffffffff8516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b600081815260208190526040812060030154829060ff161561157657600080fd5b8261158081610b75565b15156115ed57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604482015290519081900360640190fd5b60065460008581526007602052604090205485910142101561167057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f54494d455f4c4f434b5f494e434f4d504c455445000000000000000000000000604482015290519081900360640190fd5b600085815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff978316156101000297909701909116929092049485018790048702820187019097528381529399506117889573ffffffffffffffffffffffffffffffffffffffff9092169490939190839083018282801561177e5780601f106117535761010080835404028352916020019161177e565b820191906000526020600020905b81548152906001019060200180831161176157829003601f168201915b5050505050611998565b156117bd5760405185907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2611813565b60405185907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b5050505050565b6000828152600760209081526040918290208390558151838152915184927f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d92908290030190a25050565b60008373ffffffffffffffffffffffffffffffffffffffff8116151561188a57600080fd5b6005546040805160808101825273ffffffffffffffffffffffffffffffffffffffff8881168252602080830189815283850189815260006060860181905287815280845295909520845181547fffffffffffffffffffffffff000000000000000000000000000000000000000016941693909317835551600183015592518051949650919390926119229260028501929101906119e4565b5060609190910151600390910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b8154818355818111156119df576000838152602090206119df918101908301611a62565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611a2557805160ff1916838001178555611a52565b82800160010185558215611a52579182015b82811115611a52578251825591602001919060010190611a37565b50611a5e929150611a62565b5090565b610e1f91905b80821115611a5e5760008155600101611a685600a165627a7a72305820e5babec10610b2cd6468fa63c48e69cdad30621a7c944401386af3715285734e0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x13D JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x25E7C27 DUP2 EQ PUSH2 0x17F JUMPI DUP1 PUSH4 0x173825D9 EQ PUSH2 0x1C0 JUMPI DUP1 PUSH4 0x20EA8D86 EQ PUSH2 0x1EE JUMPI DUP1 PUSH4 0x2F54BF6E EQ PUSH2 0x206 JUMPI DUP1 PUSH4 0x3411C81C EQ PUSH2 0x248 JUMPI DUP1 PUSH4 0x37BD78A0 EQ PUSH2 0x279 JUMPI DUP1 PUSH4 0x54741525 EQ PUSH2 0x2A0 JUMPI DUP1 PUSH4 0x7065CB48 EQ PUSH2 0x2BF JUMPI DUP1 PUSH4 0x784547A7 EQ PUSH2 0x2ED JUMPI DUP1 PUSH4 0x7AD28C51 EQ PUSH2 0x305 JUMPI DUP1 PUSH4 0x8B51D13F EQ PUSH2 0x31D JUMPI DUP1 PUSH4 0x9ACE38C2 EQ PUSH2 0x335 JUMPI DUP1 PUSH4 0xA0E67E2B EQ PUSH2 0x40A JUMPI DUP1 PUSH4 0xA8ABE69A EQ PUSH2 0x46F JUMPI DUP1 PUSH4 0xB5DC40C3 EQ PUSH2 0x494 JUMPI DUP1 PUSH4 0xB77BF600 EQ PUSH2 0x4AC JUMPI DUP1 PUSH4 0xBA51A6DF EQ PUSH2 0x4C1 JUMPI DUP1 PUSH4 0xC01A8C84 EQ PUSH2 0x4D9 JUMPI DUP1 PUSH4 0xC6427474 EQ PUSH2 0x4F1 JUMPI DUP1 PUSH4 0xD38F2D82 EQ PUSH2 0x567 JUMPI DUP1 PUSH4 0xD74F8EDD EQ PUSH2 0x57F JUMPI DUP1 PUSH4 0xDC8452CD EQ PUSH2 0x594 JUMPI DUP1 PUSH4 0xE20056E6 EQ PUSH2 0x5A9 JUMPI DUP1 PUSH4 0xEE22610B EQ PUSH2 0x5DD JUMPI JUMPDEST PUSH1 0x0 CALLVALUE GT ISZERO PUSH2 0x17D JUMPI PUSH1 0x40 DUP1 MLOAD CALLVALUE DUP2 MSTORE SWAP1 MLOAD CALLER SWAP2 PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C SWAP2 SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG2 JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x18B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x197 PUSH1 0x4 CALLDATALOAD PUSH2 0x5F5 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x62A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1FA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH1 0x4 CALLDATALOAD PUSH2 0x881 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x212 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x234 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x959 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x254 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x234 PUSH1 0x4 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x24 CALLDATALOAD AND PUSH2 0x96E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x285 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH2 0x98E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2AC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH1 0x4 CALLDATALOAD ISZERO ISZERO PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0x994 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2CB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xA00 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2F9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x234 PUSH1 0x4 CALLDATALOAD PUSH2 0xB75 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x311 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH1 0x4 CALLDATALOAD PUSH2 0xC06 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x329 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH1 0x4 CALLDATALOAD PUSH2 0xC4D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x341 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x34D PUSH1 0x4 CALLDATALOAD PUSH2 0xCC9 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x3CC JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x3B4 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x3F9 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP6 POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x416 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x41F PUSH2 0xDB2 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x45B JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x443 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x47B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x41F PUSH1 0x4 CALLDATALOAD PUSH1 0x24 CALLDATALOAD PUSH1 0x44 CALLDATALOAD ISZERO ISZERO PUSH1 0x64 CALLDATALOAD ISZERO ISZERO PUSH2 0xE22 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x41F PUSH1 0x4 CALLDATALOAD PUSH2 0xF5B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4B8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH2 0x1108 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4CD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH1 0x4 CALLDATALOAD PUSH2 0x110E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH1 0x4 CALLDATALOAD PUSH2 0x118D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x28E SWAP5 DUP3 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x1309 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x573 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH1 0x4 CALLDATALOAD PUSH2 0x1328 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x58B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH2 0x133A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x28E PUSH2 0x133F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5B5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x1345 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5E9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x17D PUSH1 0x4 CALLDATALOAD PUSH2 0x1555 JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x603 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x638 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x66E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP2 POP JUMPDEST PUSH1 0x3 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP3 LT ISZERO PUSH2 0x7F1 JUMPI DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x70E JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x7E6 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x766 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x3 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x799 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x7F1 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x6BC JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x822 SWAP1 DUP3 PUSH2 0x19BB JUMP JUMPDEST POP PUSH1 0x3 SLOAD PUSH1 0x4 SLOAD GT ISZERO PUSH2 0x83B JUMPI PUSH1 0x3 SLOAD PUSH2 0x83B SWAP1 PUSH2 0x110E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x89F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP4 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x8CB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD DUP5 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x8EC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE MLOAD DUP8 SWAP3 PUSH32 0xF6A317157440607F36269043EB55F1287A5A19BA2216AFEAB88CD46CBCFB88E9 SWAP2 LOG3 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0x9F9 JUMPI DUP4 DUP1 ISZERO PUSH2 0x9C1 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0x9E5 JUMPI POP DUP3 DUP1 ISZERO PUSH2 0x9E5 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0x9F1 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0x998 JUMP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0xA0C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xA41 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0xA64 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x1 ADD PUSH1 0x4 SLOAD PUSH1 0x32 DUP3 GT ISZERO DUP1 ISZERO PUSH2 0xA81 JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0xA8C JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0xA97 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0xAA2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE PUSH1 0x3 DUP1 SLOAD SWAP2 DUP3 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0xC2575A0E9E593C00F959F8C92F12DB2869C3395A3B0502D05E2516446F71F85B ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP2 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0xBFF JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xBA3 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xBE4 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x4 SLOAD DUP3 EQ ISZERO PUSH2 0xBF7 JUMPI PUSH1 0x1 SWAP3 POP PUSH2 0xBFF JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0xB7A JUMP JUMPDEST POP POP SWAP2 SWAP1 POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0xC12 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x6 DUP2 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xD1C9101A34FEFF75CCCEF14A28785A0279CB0B49C1F321F21F5F422E746B4377 SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0xCC3 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xC7A JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xCBB JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0xC51 JUMP JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP2 DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP1 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP8 MLOAD PUSH2 0x100 SWAP6 DUP3 AND ISZERO SWAP6 SWAP1 SWAP6 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD AND SWAP2 SWAP1 SWAP2 DIV PUSH1 0x1F DUP2 ADD DUP9 SWAP1 DIV DUP9 MUL DUP5 ADD DUP9 ADD SWAP1 SWAP7 MSTORE DUP6 DUP4 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND SWAP6 SWAP1 SWAP5 SWAP2 SWAP3 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xD9F JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xD74 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD9F JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xD82 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP PUSH1 0x3 SWAP1 SWAP4 ADD SLOAD SWAP2 SWAP3 POP POP PUSH1 0xFF AND DUP5 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0xE17 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xDEC JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x5 SLOAD PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xE54 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0xEDB JUMPI DUP6 DUP1 ISZERO PUSH2 0xE89 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0xEAD JUMPI POP DUP5 DUP1 ISZERO PUSH2 0xEAD JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0xED3 JUMPI DUP1 DUP4 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xEC1 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0xE60 JUMP JUMPDEST DUP8 DUP8 SUB PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xF07 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP DUP8 SWAP1 POP JUMPDEST DUP7 DUP2 LT ISZERO PUSH2 0xF50 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xF24 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP10 DUP4 SUB DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xF3E JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0xF0E JUMP JUMPDEST POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xF90 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x1074 JUMPI PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0xFC5 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x106C JUMPI PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x100D JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD DUP4 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP2 LT PUSH2 0x1040 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0xF9C JUMP JUMPDEST DUP2 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x109E JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x1100 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x10BC JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x10D4 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 ADD PUSH2 0x10A6 JUMP JUMPDEST POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x5 SLOAD DUP2 JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x111A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 SLOAD DUP2 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH2 0x112F JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x113A JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1145 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x1150 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x4 DUP4 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP5 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xA3F1EE9126A074D9326C682F561767F710E927FAA811F7A99829D49DC421797A SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x11AB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO ISZERO PUSH2 0x11DD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP5 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1208 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 PUSH2 0x1212 DUP2 PUSH2 0xB75 JUMP JUMPDEST ISZERO PUSH2 0x127E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F46554C4C595F434F4E4649524D45440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 CALLER DUP1 DUP7 MSTORE SWAP3 MSTORE DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SWAP4 OR SWAP1 SWAP3 SSTORE SWAP1 MLOAD DUP9 SWAP3 PUSH32 0x4A504A94899432A9846E1AA406DCEB1BCFD538BB839071D49D1E5E23F5BE30EF SWAP2 LOG3 PUSH2 0x12F2 DUP7 PUSH2 0xB75 JUMP JUMPDEST ISZERO PUSH2 0x1301 JUMPI PUSH2 0x1301 DUP7 TIMESTAMP PUSH2 0x181A JUMP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1316 DUP5 DUP5 DUP5 PUSH2 0x1865 JUMP JUMPDEST SWAP1 POP PUSH2 0x1321 DUP2 PUSH2 0x118D JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x32 DUP2 JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x1353 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1389 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x13BE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST PUSH1 0x3 SLOAD DUP4 LT ISZERO PUSH2 0x1483 JUMPI DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x13F3 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x1478 JUMPI DUP4 PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x142B JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x1483 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x13C3 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 SWAP1 DUP2 AND SWAP1 SWAP2 SSTORE SWAP4 DUP9 AND DUP3 MSTORE DUP1 DUP3 KECCAK256 DUP1 SLOAD SWAP1 SWAP5 AND PUSH1 0x1 OR SWAP1 SWAP4 SSTORE SWAP2 MLOAD SWAP1 SWAP2 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP2 LOG2 PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP1 PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 ADD SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1576 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 PUSH2 0x1580 DUP2 PUSH2 0xB75 JUMP JUMPDEST ISZERO ISZERO PUSH2 0x15ED JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F4E4F545F46554C4C595F434F4E4649524D454400000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x6 SLOAD PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP6 SWAP2 ADD TIMESTAMP LT ISZERO PUSH2 0x1670 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x14 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54494D455F4C4F434B5F494E434F4D504C455445000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP10 POP PUSH2 0x1788 SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x177E JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x1753 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x177E JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1761 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x1998 JUMP JUMPDEST ISZERO PUSH2 0x17BD JUMPI PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0x1813 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP5 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP4 SWAP1 SSTORE DUP2 MLOAD DUP4 DUP2 MSTORE SWAP2 MLOAD DUP5 SWAP3 PUSH32 0xB237AFE65F1514FD7EA3F923EA4FE792BDD07000A912B6CD1602A8E7F573C8D SWAP3 SWAP1 DUP3 SWAP1 SUB ADD SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x188A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x80 DUP2 ADD DUP3 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 DUP2 AND DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD DUP10 DUP2 MSTORE DUP4 DUP6 ADD DUP10 DUP2 MSTORE PUSH1 0x0 PUSH1 0x60 DUP7 ADD DUP2 SWAP1 MSTORE DUP8 DUP2 MSTORE DUP1 DUP5 MSTORE SWAP6 SWAP1 SWAP6 KECCAK256 DUP5 MLOAD DUP2 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 SSTORE MLOAD PUSH1 0x1 DUP4 ADD SSTORE SWAP3 MLOAD DUP1 MLOAD SWAP5 SWAP7 POP SWAP2 SWAP4 SWAP1 SWAP3 PUSH2 0x1922 SWAP3 PUSH1 0x2 DUP6 ADD SWAP3 SWAP2 ADD SWAP1 PUSH2 0x19E4 JUMP JUMPDEST POP PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD MLOAD PUSH1 0x3 SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x5 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE PUSH1 0x40 MLOAD DUP3 SWAP1 PUSH32 0xC0BA8FE4B176C1714197D43B9CC6BCF797A4A7461C5FE8D0EF6E184AE7601E51 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 MLOAD PUSH1 0x20 DUP5 ADD PUSH1 0x0 DUP3 DUP8 DUP4 DUP11 DUP13 PUSH2 0x8796 GAS SUB CALL SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0x19DF JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0x19DF SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0x1A62 JUMP JUMPDEST POP POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x1A25 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x1A52 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x1A52 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x1A52 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x1A37 JUMP JUMPDEST POP PUSH2 0x1A5E SWAP3 SWAP2 POP PUSH2 0x1A62 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0xE1F SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x1A5E JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x1A68 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xe5 0xba 0xbe 0xc1 MOD LT 0xb2 0xcd PUSH5 0x68FA63C48E PUSH10 0xCDAD30621A7C94440138 PUSH11 0xF3715285734E0029000000 ",
+ "sourceMap": "851:3344:17:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2540:1:16;2528:9;:13;2524:61;;;2555:30;;;2575:9;2555:30;;;;2563:10;;2555:30;;;;;;;;;;2524:61;851:3344:17;1050:23:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1050:23:16;;;;;;;;;;;;;;;;;;;;;;;;3715:460;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3715:460:16;;;;;;;6281:291;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6281:291:16;;;;;1004:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1004:40:16;;;;;;;;;;;;;;;;;;;;;;;;;934:64;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;934:64:16;;;;;;;;;1057:32:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1057:32:17;;;;;;;;;;;;;;;;;;;;10535:319:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;10535:319:16;;;;;;;;;;;3315:277;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3315:277:16;;;;;;;8703:337;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8703:337:16;;;;;2494:194:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2494:194:17;;;;;10021:252:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;10021:252:16;;;;;879:49;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;879:49:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;879:49:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10938:115;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10938:115:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;10938:115:16;;;;;;;;;;;;;;;;;12156:676;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;12156:676:16;;;;;;;;;;;;;;;11232:575;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;11232:575:16;;;;;1105:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1105:28:16;;;;4997:207;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4997:207:16;;;;;2794:467:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2794:467:17;;;;;5463:244:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5463:244:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5463:244:16;;-1:-1:-1;5463:244:16;;-1:-1:-1;;;;;;;5463:244:16;1096:53:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1096:53:17;;;;;800:41:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;800:41:16;;;;1079:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1079:20:16;;;;4377:449;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4377:449:16;;;;;;;;;;;;3375:516:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3375:516:17;;;;;1050:23:16;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1050:23:16;:::o;3715:460::-;3863:6;1337:10;1359:4;1337:27;1329:36;;;;;;1543:14;;;;;;;:7;:14;;;;;;3805:5;;1543:14;;1535:23;;;;;;;;3826:14;;;3843:5;3826:14;;;:7;:14;;;;;:22;;;;;;3843:5;-1:-1:-1;3858:170:16;3875:6;:13;:17;;3873:19;;3858:170;;;3928:5;3915:18;;:6;3922:1;3915:9;;;;;;;;;;;;;;;;;;;;;;:18;3911:117;;;3965:6;3972:13;;:17;;;;3965:25;;;;;;;;;;;;;;;;3953:6;:9;;3965:25;;;;;3960:1;;3953:9;;;;;;;;;;;;;;:37;;;;;;;;;;;;;;;;;;4008:5;;3911:117;3894:3;;;;;3858:170;;;4037:6;:18;;;;;;;;;:::i;:::-;-1:-1:-1;4080:6:16;:13;4069:8;;:24;4065:74;;;4125:6;:13;4107:32;;:17;:32::i;:::-;4149:19;;;;;;;;;;;1375:1;3715:460;;:::o;6281:291::-;6364:10;1543:14;;;;:7;:14;;;;;;;;1535:23;;;;;;;;1788:28;;;;:13;:28;;;;;;;;6409:10;1788:35;;;;;;;;;6394:13;;6409:10;1788:35;;1780:44;;;;;;;;2044:12;:27;;;;;;;;;;:36;;;6441:13;;2044:36;;2043:37;2035:46;;;;;;6513:5;6470:28;;;:13;:28;;;;;;;;6499:10;6470:40;;;;;;;;:48;;;;;;6528:37;6484:13;;6528:37;;;1834:1;1568;;6281:291;;:::o;1004:40::-;;;;;;;;;;;;;;;:::o;934:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1057:32:17:-;;;;:::o;10535:319:16:-;10642:10;;10668:179;10685:16;;10683:1;:18;10668:179;;;10727:7;:36;;;;-1:-1:-1;10739:12:16;:15;;;;;;;;;;:24;;;;;10738:25;10727:36;:92;;;;10783:8;:36;;;;-1:-1:-1;10795:12:16;:15;;;;;;;;;;:24;;;;;10783:36;10720:127;;;10846:1;10837:10;;;;10720:127;10703:3;;10668:179;;;10535:319;;;;;:::o;3315:277::-;1337:10;1359:4;1337:27;1329:36;;;;;;1450:14;;;;;;;:7;:14;;;;;;3408:5;;1450:14;;1449:15;1441:24;;;;;;3431:5;2158:13;;;;;2150:22;;;;;;3463:6;:13;;;;3479:1;3463:17;3482:8;;839:2;2273:10;:29;;:68;;;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;3506:14;;;;;;;:7;:14;;;;;;:21;;;;3523:4;3506:21;;;;;;3537:6;27:10:-1;;23:18;;;45:23;;3537:18:16;;;;;;;;;;;;3565:20;;;3506:14;3565:20;2182:1;;1475;1375;3315:277;:::o;8703:337::-;8793:4;;;8837:197;8854:6;:13;8852:15;;8837:197;;;8892:28;;;;:13;:28;;;;;8921:6;:9;;8892:28;;;8928:1;;8921:9;;;;;;;;;;;;;;;;;;;;8892:39;;;;;;;;;;;;;;;8888:71;;;8958:1;8949:10;;;;8888:71;8986:8;;8977:5;:17;8973:50;;;9019:4;9012:11;;;;8973:50;8869:3;;8837:197;;;8703:337;;;;;:::o;2494:194:17:-;1337:10:16;1359:4;1337:27;1329:36;;;;;;2594:17:17;:38;;;2647:34;;;;;;;;;;;;;;;;;2494:194;:::o;10021:252:16:-;10120:10;;10146:120;10163:6;:13;10161:15;;10146:120;;;10199:28;;;;:13;:28;;;;;10228:6;:9;;10199:28;;;10235:1;;10228:9;;;;;;;;;;;;;;;;;;;;10199:39;;;;;;;;;;;;;;;10195:71;;;10265:1;10256:10;;;;10195:71;10178:3;;10146:120;;;10021:252;;;;:::o;879:49::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;879:49:16;;;;;;;-1:-1:-1;;879:49:16;;;:::o;10938:115::-;11008:9;11040:6;11033:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10938:115;;:::o;12156:676::-;12281:22;12319:32;12392:10;12416:6;12365:16;;12354:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;12354:28:16;;12319:63;;12405:1;12392:14;;12439:1;12437:3;;12432:250;12444:16;;12442:1;:18;12432:250;;;12486:7;:36;;;;-1:-1:-1;12498:12:16;:15;;;;;;;;;;:24;;;;;12497:25;12486:36;:92;;;;12542:8;:36;;;;-1:-1:-1;12554:12:16;:15;;;;;;;;;;:24;;;;;12542:36;12479:203;;;12638:1;12610:18;12629:5;12610:25;;;;;;;;;;;;;;;;;;:29;12666:1;12657:10;;;;;12479:203;12462:3;;12432:250;;;12725:4;12720:2;:9;12709:21;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;12709:21:16;;12691:39;;12747:4;12745:6;;12740:85;12755:2;12753:1;:4;12740:85;;;12804:18;12823:1;12804:21;;;;;;;;;;;;;;;;;;12776:15;12796:4;12792:1;:8;12776:25;;;;;;;;;;;;;;;;;;:49;12759:3;;12740:85;;;12156:676;;;;;;;;;:::o;11232:575::-;11327:24;11367:34;11442:10;11466:6;11418;:13;;;;11404:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;11404:28:16;;11367:65;;11455:1;11442:14;;11489:1;11487:3;;11482:186;11494:6;:13;11492:15;;11482:186;;;11530:28;;;;:13;:28;;;;;11559:6;:9;;11530:28;;;11566:1;;11559:9;;;;;;;;;;;;;;;;;;;;11530:39;;;;;;;;;;;;;;;11526:142;;;11616:6;:9;;11623:1;;11616:9;;;;;;;;;;;;;;;;11589:24;;11616:9;;;;;11589:17;;11607:5;;11589:24;;;;;;:36;;;;:24;;;;;;;;;;:36;11652:1;11643:10;;;;;11526:142;11509:3;;11482:186;;;11708:5;11694:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;11694:20:16;;11677:37;;11731:1;11729:3;;11724:76;11736:5;11734:1;:7;11724:76;;;11780:17;11798:1;11780:20;;;;;;;;;;;;;;;;;;11760:14;11775:1;11760:17;;;;;;;;;;:40;;;;:17;;;;;;;;;;:40;11743:3;;11724:76;;;11232:575;;;;;;:::o;1105:28::-;;;;:::o;4997:207::-;1337:10;1359:4;1337:27;1329:36;;;;;;5099:6;:13;5114:9;839:2;2273:29;;;;;:68;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;5139:8;:20;;;5169:28;;;;;;;;;;;;;;;;;1375:1;;4997:207;:::o;2794:467:17:-;2880:10;1543:14:16;;;;:7;:14;;;;;;;;1535:23;;;;;;;;1647:12;:27;;;;;;;;;;:39;2918:13:17;;1647:39:16;;:44;;1639:53;;;;;;1924:28;;;;:13;:28;;;;;;;;2969:10:17;1924:35:16;;;;;;;;;2954:13:17;;2969:10;1924:35:16;;1923:36;1915:45;;;;;;3007:13:17;1238:26;1250:13;1238:11;:26::i;:::-;1237:27;1216:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3036:28;;;;3079:4;3036:28;;;;;;;;3065:10;3036:40;;;;;;;;:47;;;;;;;;;;3098:39;;3050:13;;3098:39;;;3151:26;3163:13;3151:11;:26::i;:::-;3147:108;;;3193:51;3213:13;3228:15;3193:19;:51::i;:::-;1970:1:16;1702;;1568;2794:467:17;;:::o;5463:244:16:-;5567:18;5617:40;5632:11;5645:5;5652:4;5617:14;:40::i;:::-;5601:56;;5667:33;5686:13;5667:18;:33::i;:::-;5463:244;;;;;:::o;1096:53:17:-;;;;;;;;;;;;;:::o;800:41:16:-;839:2;800:41;:::o;1079:20::-;;;;:::o;4377:449::-;4548:6;1337:10;1359:4;1337:27;1329:36;;;;;;1543:14;;;;;;;:7;:14;;;;;;4486:5;;1543:14;;1535:23;;;;;;;;1450:14;;;;;;;:7;:14;;;;;;4519:8;;1450:14;;1449:15;1441:24;;;;;;4555:1;4548:8;;4543:149;4560:6;:13;4558:15;;4543:149;;;4609:5;4596:18;;:6;4603:1;4596:9;;;;;;;;;;;;;;;;;;;;;;:18;4592:100;;;4646:8;4634:6;4641:1;4634:9;;;;;;;;;;;;;;;;;;:20;;;;;;;;;;;;;;;;;;4672:5;;4592:100;4575:3;;;;;4543:149;;;4701:14;;;;4718:5;4701:14;;;:7;:14;;;;;;:22;;;;;;;;;4733:17;;;;;;;;:24;;;;;4701:22;4733:24;;;;4767:19;;4701:14;;4767:19;;;4796:23;;;;;;;;;;;1568:1;1375;4377:449;;;:::o;3375:516:17:-;3564:23;2044:27:16;;;;;;;;;;:36;;;3461:13:17;;2044:36:16;;2043:37;2035:46;;;;;;3499:13:17;1410:26;1422:13;1410:11;:26::i;:::-;1389:95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1638:17;;1603:32;;;;:17;:32;;;;;;3535:13;;1603:52;1584:15;:71;;1563:138;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3590:12;:27;;;;;;;;;;;;3627:12;;;:19;;;;3642:4;3627:19;;;;;;3674:15;;3691:9;;;;3702:8;;;;:15;;3660:68;;;3702:15;;;;;3627:19;3702:15;;;;;;;;;;;;3660:68;;;;;;;;;;;;;;;;;;3590:27;;-1:-1:-1;3660:68:17;;3674:15;;;;;3691:9;;3660:68;3702:8;:15;;3660:68;;3702:8;:15;3660:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:13;:68::i;:::-;3656:229;;;3749:24;;3759:13;;3749:24;;;;;3656:229;;;3809:31;;3826:13;;3809:31;;;;;3854:12;;;:20;;;;;;3656:229;1494:1;2091::16;3375:516:17;;;:::o;3959:234::-;4068:32;;;;:17;:32;;;;;;;;;:51;;;4134:52;;;;;;;4086:13;;4134:52;;;;;;;;;3959:234;;:::o;9373:451:16:-;9505:18;9475:11;2158:13;;;;;2150:22;;;;;;9555:16;;9611:140;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9611:140:16;;;;;;9581:27;;;;;;;;;;:170;;;;;;;;;;;;;;;-1:-1:-1;9581:170:16;;;;;;;9555:16;;-1:-1:-1;9611:140:16;;9581:27;;:170;;;;;;;;;;:::i;:::-;-1:-1:-1;9581:170:16;;;;;;;;;;;;;;;;;;;;;;;9761:16;:21;;-1:-1:-1;9761:21:16;;;9792:25;;9803:13;;9792:25;;-1:-1:-1;;9792:25:16;9373:451;;;;;;:::o;7449:1103::-;7552:4;7568:11;7627:4;7621:11;7760:2;7754:4;7750:13;8425:1;8406;8298:10;8279:1;8256:5;8227:11;7882:5;7877:3;7873:15;7851:662;7841:672;7449:1103;-1:-1:-1;;;;;;;;7449:1103:16:o;851:3344:17:-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;851:3344:17;;;-1:-1:-1;851:3344:17;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;"
+ }
+ }
+ },
+ "sources": {
+ "multisig/MultiSigWalletWithTimeLock.sol": {
+ "id": 17
+ },
+ "multisig/MultiSigWallet.sol": {
+ "id": 16
+ }
+ },
+ "sourceCodes": {
+ "multisig/MultiSigWalletWithTimeLock.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./MultiSigWallet.sol\";\n\n\n/// @title Multisignature wallet with time lock- Allows multiple parties to execute a transaction after a time lock has passed.\n/// @author Amir Bandeali - <amir@0xProject.com>\n// solhint-disable not-rely-on-time\ncontract MultiSigWalletWithTimeLock is\n MultiSigWallet\n{\n event ConfirmationTimeSet(uint256 indexed transactionId, uint256 confirmationTime);\n event TimeLockChange(uint256 secondsTimeLocked);\n\n uint256 public secondsTimeLocked;\n\n mapping (uint256 => uint256) public confirmationTimes;\n\n modifier notFullyConfirmed(uint256 transactionId) {\n require(\n !isConfirmed(transactionId),\n \"TX_FULLY_CONFIRMED\"\n );\n _;\n }\n\n modifier fullyConfirmed(uint256 transactionId) {\n require(\n isConfirmed(transactionId),\n \"TX_NOT_FULLY_CONFIRMED\"\n );\n _;\n }\n\n modifier pastTimeLock(uint256 transactionId) {\n require(\n block.timestamp >= confirmationTimes[transactionId] + secondsTimeLocked,\n \"TIME_LOCK_INCOMPLETE\"\n );\n _;\n }\n\n /// @dev Contract constructor sets initial owners, required number of confirmations, and time lock.\n /// @param _owners List of initial owners.\n /// @param _required Number of required confirmations.\n /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.\n constructor (\n address[] _owners,\n uint256 _required,\n uint256 _secondsTimeLocked\n )\n public\n MultiSigWallet(_owners, _required)\n {\n secondsTimeLocked = _secondsTimeLocked;\n }\n\n /// @dev Changes the duration of the time lock for transactions.\n /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.\n function changeTimeLock(uint256 _secondsTimeLocked)\n public\n onlyWallet\n {\n secondsTimeLocked = _secondsTimeLocked;\n emit TimeLockChange(_secondsTimeLocked);\n }\n\n /// @dev Allows an owner to confirm a transaction.\n /// @param transactionId Transaction ID.\n function confirmTransaction(uint256 transactionId)\n public\n ownerExists(msg.sender)\n transactionExists(transactionId)\n notConfirmed(transactionId, msg.sender)\n notFullyConfirmed(transactionId)\n {\n confirmations[transactionId][msg.sender] = true;\n emit Confirmation(msg.sender, transactionId);\n if (isConfirmed(transactionId)) {\n setConfirmationTime(transactionId, block.timestamp);\n }\n }\n\n /// @dev Allows anyone to execute a confirmed transaction.\n /// @param transactionId Transaction ID.\n function executeTransaction(uint256 transactionId)\n public\n notExecuted(transactionId)\n fullyConfirmed(transactionId)\n pastTimeLock(transactionId)\n {\n Transaction storage txn = transactions[transactionId];\n txn.executed = true;\n if (external_call(txn.destination, txn.value, txn.data.length, txn.data)) {\n emit Execution(transactionId);\n } else {\n emit ExecutionFailure(transactionId);\n txn.executed = false;\n }\n }\n\n /// @dev Sets the time of when a submission first passed.\n function setConfirmationTime(uint256 transactionId, uint256 confirmationTime)\n internal\n {\n confirmationTimes[transactionId] = confirmationTime;\n emit ConfirmationTimeSet(transactionId, confirmationTime);\n }\n}\n",
+ "multisig/MultiSigWallet.sol": "// solhint-disable\npragma solidity ^0.4.15;\n\n\n/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.\n/// @author Stefan George - <stefan.george@consensys.net>\ncontract MultiSigWallet {\n\n /*\n * Events\n */\n event Confirmation(address indexed sender, uint indexed transactionId);\n event Revocation(address indexed sender, uint indexed transactionId);\n event Submission(uint indexed transactionId);\n event Execution(uint indexed transactionId);\n event ExecutionFailure(uint indexed transactionId);\n event Deposit(address indexed sender, uint value);\n event OwnerAddition(address indexed owner);\n event OwnerRemoval(address indexed owner);\n event RequirementChange(uint required);\n\n /*\n * Constants\n */\n uint constant public MAX_OWNER_COUNT = 50;\n\n /*\n * Storage\n */\n mapping (uint => Transaction) public transactions;\n mapping (uint => mapping (address => bool)) public confirmations;\n mapping (address => bool) public isOwner;\n address[] public owners;\n uint public required;\n uint public transactionCount;\n\n struct Transaction {\n address destination;\n uint value;\n bytes data;\n bool executed;\n }\n\n /*\n * Modifiers\n */\n modifier onlyWallet() {\n require(msg.sender == address(this));\n _;\n }\n\n modifier ownerDoesNotExist(address owner) {\n require(!isOwner[owner]);\n _;\n }\n\n modifier ownerExists(address owner) {\n require(isOwner[owner]);\n _;\n }\n\n modifier transactionExists(uint transactionId) {\n require(transactions[transactionId].destination != 0);\n _;\n }\n\n modifier confirmed(uint transactionId, address owner) {\n require(confirmations[transactionId][owner]);\n _;\n }\n\n modifier notConfirmed(uint transactionId, address owner) {\n require(!confirmations[transactionId][owner]);\n _;\n }\n\n modifier notExecuted(uint transactionId) {\n require(!transactions[transactionId].executed);\n _;\n }\n\n modifier notNull(address _address) {\n require(_address != 0);\n _;\n }\n\n modifier validRequirement(uint ownerCount, uint _required) {\n require(ownerCount <= MAX_OWNER_COUNT\n && _required <= ownerCount\n && _required != 0\n && ownerCount != 0);\n _;\n }\n\n /// @dev Fallback function allows to deposit ether.\n function()\n payable\n {\n if (msg.value > 0)\n Deposit(msg.sender, msg.value);\n }\n\n /*\n * Public functions\n */\n /// @dev Contract constructor sets initial owners and required number of confirmations.\n /// @param _owners List of initial owners.\n /// @param _required Number of required confirmations.\n function MultiSigWallet(address[] _owners, uint _required)\n public\n validRequirement(_owners.length, _required)\n {\n for (uint i=0; i<_owners.length; i++) {\n require(!isOwner[_owners[i]] && _owners[i] != 0);\n isOwner[_owners[i]] = true;\n }\n owners = _owners;\n required = _required;\n }\n\n /// @dev Allows to add a new owner. Transaction has to be sent by wallet.\n /// @param owner Address of new owner.\n function addOwner(address owner)\n public\n onlyWallet\n ownerDoesNotExist(owner)\n notNull(owner)\n validRequirement(owners.length + 1, required)\n {\n isOwner[owner] = true;\n owners.push(owner);\n OwnerAddition(owner);\n }\n\n /// @dev Allows to remove an owner. Transaction has to be sent by wallet.\n /// @param owner Address of owner.\n function removeOwner(address owner)\n public\n onlyWallet\n ownerExists(owner)\n {\n isOwner[owner] = false;\n for (uint i=0; i<owners.length - 1; i++)\n if (owners[i] == owner) {\n owners[i] = owners[owners.length - 1];\n break;\n }\n owners.length -= 1;\n if (required > owners.length)\n changeRequirement(owners.length);\n OwnerRemoval(owner);\n }\n\n /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.\n /// @param owner Address of owner to be replaced.\n /// @param newOwner Address of new owner.\n function replaceOwner(address owner, address newOwner)\n public\n onlyWallet\n ownerExists(owner)\n ownerDoesNotExist(newOwner)\n {\n for (uint i=0; i<owners.length; i++)\n if (owners[i] == owner) {\n owners[i] = newOwner;\n break;\n }\n isOwner[owner] = false;\n isOwner[newOwner] = true;\n OwnerRemoval(owner);\n OwnerAddition(newOwner);\n }\n\n /// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.\n /// @param _required Number of required confirmations.\n function changeRequirement(uint _required)\n public\n onlyWallet\n validRequirement(owners.length, _required)\n {\n required = _required;\n RequirementChange(_required);\n }\n\n /// @dev Allows an owner to submit and confirm a transaction.\n /// @param destination Transaction target address.\n /// @param value Transaction ether value.\n /// @param data Transaction data payload.\n /// @return Returns transaction ID.\n function submitTransaction(address destination, uint value, bytes data)\n public\n returns (uint transactionId)\n {\n transactionId = addTransaction(destination, value, data);\n confirmTransaction(transactionId);\n }\n\n /// @dev Allows an owner to confirm a transaction.\n /// @param transactionId Transaction ID.\n function confirmTransaction(uint transactionId)\n public\n ownerExists(msg.sender)\n transactionExists(transactionId)\n notConfirmed(transactionId, msg.sender)\n {\n confirmations[transactionId][msg.sender] = true;\n Confirmation(msg.sender, transactionId);\n executeTransaction(transactionId);\n }\n\n /// @dev Allows an owner to revoke a confirmation for a transaction.\n /// @param transactionId Transaction ID.\n function revokeConfirmation(uint transactionId)\n public\n ownerExists(msg.sender)\n confirmed(transactionId, msg.sender)\n notExecuted(transactionId)\n {\n confirmations[transactionId][msg.sender] = false;\n Revocation(msg.sender, transactionId);\n }\n\n /// @dev Allows anyone to execute a confirmed transaction.\n /// @param transactionId Transaction ID.\n function executeTransaction(uint transactionId)\n public\n ownerExists(msg.sender)\n confirmed(transactionId, msg.sender)\n notExecuted(transactionId)\n {\n if (isConfirmed(transactionId)) {\n Transaction storage txn = transactions[transactionId];\n txn.executed = true;\n if (external_call(txn.destination, txn.value, txn.data.length, txn.data))\n Execution(transactionId);\n else {\n ExecutionFailure(transactionId);\n txn.executed = false;\n }\n }\n }\n\n // call has been separated into its own function in order to take advantage\n // of the Solidity's code generator to produce a loop that copies tx.data into memory.\n function external_call(address destination, uint value, uint dataLength, bytes data) internal returns (bool) {\n bool result;\n assembly {\n let x := mload(0x40) // \"Allocate\" memory for output (0x40 is where \"free memory\" pointer is stored by convention)\n let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that\n result := call(\n sub(gas, 34710), // 34710 is the value that solidity is currently emitting\n // It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +\n // callNewAccountGas (25000, in case the destination address does not exist and needs creating)\n destination,\n value,\n d,\n dataLength, // Size of the input (in bytes) - this is what fixes the padding problem\n x,\n 0 // Output is ignored, therefore the output size is zero\n )\n }\n return result;\n }\n\n /// @dev Returns the confirmation status of a transaction.\n /// @param transactionId Transaction ID.\n /// @return Confirmation status.\n function isConfirmed(uint transactionId)\n public\n constant\n returns (bool)\n {\n uint count = 0;\n for (uint i=0; i<owners.length; i++) {\n if (confirmations[transactionId][owners[i]])\n count += 1;\n if (count == required)\n return true;\n }\n }\n\n /*\n * Internal functions\n */\n /// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.\n /// @param destination Transaction target address.\n /// @param value Transaction ether value.\n /// @param data Transaction data payload.\n /// @return Returns transaction ID.\n function addTransaction(address destination, uint value, bytes data)\n internal\n notNull(destination)\n returns (uint transactionId)\n {\n transactionId = transactionCount;\n transactions[transactionId] = Transaction({\n destination: destination,\n value: value,\n data: data,\n executed: false\n });\n transactionCount += 1;\n Submission(transactionId);\n }\n\n /*\n * Web3 call functions\n */\n /// @dev Returns number of confirmations of a transaction.\n /// @param transactionId Transaction ID.\n /// @return Number of confirmations.\n function getConfirmationCount(uint transactionId)\n public\n constant\n returns (uint count)\n {\n for (uint i=0; i<owners.length; i++)\n if (confirmations[transactionId][owners[i]])\n count += 1;\n }\n\n /// @dev Returns total number of transactions after filers are applied.\n /// @param pending Include pending transactions.\n /// @param executed Include executed transactions.\n /// @return Total number of transactions after filters are applied.\n function getTransactionCount(bool pending, bool executed)\n public\n constant\n returns (uint count)\n {\n for (uint i=0; i<transactionCount; i++)\n if ( pending && !transactions[i].executed\n || executed && transactions[i].executed)\n count += 1;\n }\n\n /// @dev Returns list of owners.\n /// @return List of owner addresses.\n function getOwners()\n public\n constant\n returns (address[])\n {\n return owners;\n }\n\n /// @dev Returns array with owner addresses, which confirmed transaction.\n /// @param transactionId Transaction ID.\n /// @return Returns array of owner addresses.\n function getConfirmations(uint transactionId)\n public\n constant\n returns (address[] _confirmations)\n {\n address[] memory confirmationsTemp = new address[](owners.length);\n uint count = 0;\n uint i;\n for (i=0; i<owners.length; i++)\n if (confirmations[transactionId][owners[i]]) {\n confirmationsTemp[count] = owners[i];\n count += 1;\n }\n _confirmations = new address[](count);\n for (i=0; i<count; i++)\n _confirmations[i] = confirmationsTemp[i];\n }\n\n /// @dev Returns list of transaction IDs in defined range.\n /// @param from Index start position of transaction array.\n /// @param to Index end position of transaction array.\n /// @param pending Include pending transactions.\n /// @param executed Include executed transactions.\n /// @return Returns array of transaction IDs.\n function getTransactionIds(uint from, uint to, bool pending, bool executed)\n public\n constant\n returns (uint[] _transactionIds)\n {\n uint[] memory transactionIdsTemp = new uint[](transactionCount);\n uint count = 0;\n uint i;\n for (i=0; i<transactionCount; i++)\n if ( pending && !transactions[i].executed\n || executed && transactions[i].executed)\n {\n transactionIdsTemp[count] = i;\n count += 1;\n }\n _transactionIds = new uint[](to - from);\n for (i=from; i<to; i++)\n _transactionIds[i - from] = transactionIdsTemp[i];\n }\n}"
+ },
+ "sourceTreeHashHex": "0xe122976ffe33df38d409d2f249e6d0a1816704035f2cdc0bbf822d1b28a62259",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/OrderValidator.json b/packages/contracts/generated-artifacts/OrderValidator.json
new file mode 100644
index 000000000..b3c3a81eb
--- /dev/null
+++ b/packages/contracts/generated-artifacts/OrderValidator.json
@@ -0,0 +1,665 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "OrderValidator",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ }
+ ],
+ "name": "getOrderAndTraderInfo",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "orderStatus",
+ "type": "uint8"
+ },
+ {
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "orderTakerAssetFilledAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "orderInfo",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerZrxBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerZrxAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerZrxBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerZrxAllowance",
+ "type": "uint256"
+ }
+ ],
+ "name": "traderInfo",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "name": "assetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "getBalanceAndAllowance",
+ "outputs": [
+ {
+ "name": "balance",
+ "type": "uint256"
+ },
+ {
+ "name": "allowance",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAddresses",
+ "type": "address[]"
+ }
+ ],
+ "name": "getOrdersAndTradersInfo",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "orderStatus",
+ "type": "uint8"
+ },
+ {
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "orderTakerAssetFilledAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "ordersInfo",
+ "type": "tuple[]"
+ },
+ {
+ "components": [
+ {
+ "name": "makerBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerZrxBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerZrxAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerZrxBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerZrxAllowance",
+ "type": "uint256"
+ }
+ ],
+ "name": "tradersInfo",
+ "type": "tuple[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAddresses",
+ "type": "address[]"
+ }
+ ],
+ "name": "getTradersInfo",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerZrxBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerZrxAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerZrxBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerZrxAllowance",
+ "type": "uint256"
+ }
+ ],
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "name": "tokenId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getERC721TokenOwner",
+ "outputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "name": "assetData",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "getBalancesAndAllowances",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256[]"
+ },
+ {
+ "name": "",
+ "type": "uint256[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ }
+ ],
+ "name": "getTraderInfo",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerZrxBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "makerZrxAllowance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerZrxBalance",
+ "type": "uint256"
+ },
+ {
+ "name": "takerZrxAllowance",
+ "type": "uint256"
+ }
+ ],
+ "name": "traderInfo",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_exchange",
+ "type": "address"
+ },
+ {
+ "name": "_zrxAssetData",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040523480156200001157600080fd5b5060405162001d3a38038062001d3a833981018060405262000037919081019062000186565b60008054600160a060020a031916600160a060020a03841617905580516200006790600190602084019062000070565b5050506200026b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000b357805160ff1916838001178555620000e3565b82800160010185558215620000e3579182015b82811115620000e3578251825591602001919060010190620000c6565b50620000f1929150620000f5565b5090565b6200011291905b80821115620000f15760008155600101620000fc565b90565b60006200012382516200022c565b9392505050565b6000601f820183136200013c57600080fd5b8151620001536200014d8262000204565b620001dd565b915080825260208301602083018583830111156200017057600080fd5b6200017d83828462000238565b50505092915050565b600080604083850312156200019a57600080fd5b6000620001a8858562000115565b92505060208301516001604060020a03811115620001c557600080fd5b620001d3858286016200012a565b9150509250929050565b6040518181016001604060020a0381118282101715620001fc57600080fd5b604052919050565b60006001604060020a038211156200021b57600080fd5b506020601f91909101601f19160190565b600160a060020a031690565b60005b83811015620002555781810151838201526020016200023b565b8381111562000265576000848401525b50505050565b611abf806200027b6000396000f3006080604052600436106100825763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304ad1e5381146100875780632cd0fc73146100be5780634b95de13146100ec578063690d31141461011a578063b698846314610147578063c6b7f4ee14610174578063f241ffb0146101a2575b600080fd5b34801561009357600080fd5b506100a76100a23660046112d3565b6101cf565b6040516100b59291906118dc565b60405180910390f35b3480156100ca57600080fd5b506100de6100d936600461118b565b61029c565b6040516100b5929190611926565b3480156100f857600080fd5b5061010c610107366004611238565b6107cd565b6040516100b5929190611822565b34801561012657600080fd5b5061013a610135366004611238565b6108a4565b6040516100b59190611858565b34801561015357600080fd5b506101676101623660046111d3565b61095e565b6040516100b591906117f9565b34801561018057600080fd5b5061019461018f366004611139565b6109a9565b6040516100b5929190611869565b3480156101ae57600080fd5b506101c26101bd3660046112d3565b610a86565b6040516100b59190611909565b6101d7610cd0565b6101df610cf0565b6000546040517fc75e0a8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063c75e0a81906102359087906004016118f8565b606060405180830381600087803b15801561024f57600080fd5b505af1158015610263573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061028791908101906112b5565b91506102938484610a86565b90509250929050565b6000808080808080806102b5898263ffffffff610ba416565b95506102c889601063ffffffff610c1116565b6000546040517f6070410800000000000000000000000000000000000000000000000000000000815291965073ffffffffffffffffffffffffffffffffffffffff169063607041089061031f90899060040161188e565b602060405180830381600087803b15801561033957600080fd5b505af115801561034d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103719190810190611113565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190209094507fffffffff0000000000000000000000000000000000000000000000000000000087811691161415610526576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616906370a0823190610424908d906004016117f9565b602060405180830381600087803b15801561043e57600080fd5b505af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610476919081019061131a565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815290985073ffffffffffffffffffffffffffffffffffffffff86169063dd62ed3e906104cd908d908890600401611807565b602060405180830381600087803b1580156104e757600080fd5b505af11580156104fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061051f919081019061131a565b96506107c0565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190207fffffffff00000000000000000000000000000000000000000000000000000000878116911614156107855761059589602463ffffffff610c7216565b92506105a1858461095e565b91508173ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16146105dd5760006105e0565b60015b60ff1697508473ffffffffffffffffffffffffffffffffffffffff1663e985e9c58b866040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161063c929190611807565b602060405180830381600087803b15801561065657600080fd5b505af115801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061068e9190810190611297565b8061076a57508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1663081812fc856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016107009190611918565b602060405180830381600087803b15801561071a57600080fd5b505af115801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107529190810190611113565b73ffffffffffffffffffffffffffffffffffffffff16145b90508061077857600061077b565b60015b60ff1696506107c0565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118ac565b60405180910390fd5b5050505050509250929050565b6000546040517f7e9d74dc000000000000000000000000000000000000000000000000000000008152606091829173ffffffffffffffffffffffffffffffffffffffff90911690637e9d74dc90610828908790600401611847565b600060405180830381600087803b15801561084257600080fd5b505af1158015610856573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261089c9190810190611203565b915061029384845b606060006060600085519250826040519080825280602002602001820160405280156108ea57816020015b6108d7610cf0565b8152602001906001900390816108cf5790505b509150600090505b80831461095157610931868281518110151561090a57fe5b90602001906020020151868381518110151561092257fe5b90602001906020020151610a86565b828281518110151561093f57fe5b602090810290910101526001016108f2565b8193505b50505092915050565b60006040517f6352211e000000000000000000000000000000000000000000000000000000008152826004820152602081602483875afa80156109a057815192505b50505b92915050565b6060806000606080600086519350836040519080825280602002602001820160405280156109e1578160200160208202803883390190505b50925083604051908082528060200260200182016040528015610a0e578160200160208202803883390190505b509150600090505b808414610a7957610a3e888883815181101515610a2f57fe5b9060200190602002015161029c565b8483815181101515610a4c57fe5b9060200190602002018484815181101515610a6357fe5b6020908102909101019190915252600101610a16565b5090969095509350505050565b610a8e610cf0565b6060610aa3846000015185610140015161029c565b60208401528252610160840151610abb90849061029c565b60608401526040808401919091526001805482516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008688161502019094169390930492830181900481028201810190945281815292830182828015610b6a5780601f10610b3f57610100808354040283529160200191610b6a565b820191906000526020600020905b815481529060010190602001808311610b4d57829003601f168201915b50505050509050610b7f84600001518261029c565b60a08401526080830152610b93838261029c565b60e084015260c08301525092915050565b600081600401835110151515610be6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118cc565b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b600081601401835110151515610c53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118bc565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000610c7e8383610c85565b9392505050565b600081602001835110151515610cc7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b79061189c565b50016020015190565b604080516060810182526000808252602082018190529181019190915290565b6101006040519081016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000610c7e82356119d9565b6000610c7e82516119d9565b6000601f82018313610d5f57600080fd5b8135610d72610d6d82611968565b611941565b91508181835260208401935060208101905083856020840282011115610d9757600080fd5b60005b83811015610dc35781610dad8882610d36565b8452506020928301929190910190600101610d9a565b5050505092915050565b6000601f82018313610dde57600080fd5b8135610dec610d6d82611968565b81815260209384019390925082018360005b83811015610dc35781358601610e148882610f11565b8452506020928301929190910190600101610dfe565b6000601f82018313610e3b57600080fd5b8151610e49610d6d82611968565b91508181835260208401935060208101905083856060840282011115610e6e57600080fd5b60005b83811015610dc35781610e848882610f57565b84525060209092019160609190910190600101610e71565b6000601f82018313610ead57600080fd5b8135610ebb610d6d82611968565b81815260209384019390925082018360005b83811015610dc35781358601610ee38882610fb2565b8452506020928301929190910190600101610ecd565b6000610c7e8251611a20565b6000610c7e82516119f2565b6000601f82018313610f2257600080fd5b8135610f30610d6d82611989565b91508082526020830160208301858383011115610f4c57600080fd5b610955838284611a25565b600060608284031215610f6957600080fd5b610f736060611941565b90506000610f818484611107565b8252506020610f9284848301610f05565b6020830152506040610fa684828501610f05565b60408301525092915050565b60006101808284031215610fc557600080fd5b610fd0610180611941565b90506000610fde8484610d36565b8252506020610fef84848301610d36565b602083015250604061100384828501610d36565b604083015250606061101784828501610d36565b606083015250608061102b848285016110fb565b60808301525060a061103f848285016110fb565b60a08301525060c0611053848285016110fb565b60c08301525060e0611067848285016110fb565b60e08301525061010061107c848285016110fb565b61010083015250610120611092848285016110fb565b6101208301525061014082013567ffffffffffffffff8111156110b457600080fd5b6110c084828501610f11565b6101408301525061016082013567ffffffffffffffff8111156110e257600080fd5b6110ee84828501610f11565b6101608301525092915050565b6000610c7e82356119f2565b6000610c7e8251611a1a565b60006020828403121561112557600080fd5b60006111318484610d42565b949350505050565b6000806040838503121561114c57600080fd5b60006111588585610d36565b925050602083013567ffffffffffffffff81111561117557600080fd5b61118185828601610dcd565b9150509250929050565b6000806040838503121561119e57600080fd5b60006111aa8585610d36565b925050602083013567ffffffffffffffff8111156111c757600080fd5b61118185828601610f11565b600080604083850312156111e657600080fd5b60006111f28585610d36565b9250506020611181858286016110fb565b60006020828403121561121557600080fd5b815167ffffffffffffffff81111561122c57600080fd5b61113184828501610e2a565b6000806040838503121561124b57600080fd5b823567ffffffffffffffff81111561126257600080fd5b61126e85828601610e9c565b925050602083013567ffffffffffffffff81111561128b57600080fd5b61118185828601610d4e565b6000602082840312156112a957600080fd5b60006111318484610ef9565b6000606082840312156112c757600080fd5b60006111318484610f57565b600080604083850312156112e657600080fd5b823567ffffffffffffffff8111156112fd57600080fd5b61130985828601610fb2565b925050602061118185828601610d36565b60006020828403121561132c57600080fd5b60006111318484610f05565b611341816119d9565b82525050565b6000611352826119d5565b808452602084019350611364836119cf565b60005b828110156113945761137a868351611619565b611383826119cf565b606096909601959150600101611367565b5093949350505050565b60006113a9826119d5565b808452602084019350836020820285016113c2856119cf565b60005b848110156113f95783830388526113dd838351611656565b92506113e8826119cf565b6020989098019791506001016113c5565b50909695505050505050565b6000611410826119d5565b808452602084019350611422836119cf565b60005b8281101561139457611438868351611759565b611441826119cf565b61010096909601959150600101611425565b600061145e826119d5565b808452602084019350611470836119cf565b60005b82811015611394576114868683516114a0565b61148f826119cf565b602096909601959150600101611473565b611341816119f2565b611341816119f5565b60006114bd826119d5565b8084526114d1816020860160208601611a31565b6114da81611a5d565b9093016020019392505050565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601781527f554e535550504f525445445f41535345545f50524f5859000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b602581527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160208201527f5549524544000000000000000000000000000000000000000000000000000000604082015260600190565b8051606083019061162a84826117f0565b50602082015161163d60208501826114a0565b50604082015161165060408501826114a0565b50505050565b805160009061018084019061166b8582611338565b50602083015161167e6020860182611338565b5060408301516116916040860182611338565b5060608301516116a46060860182611338565b5060808301516116b760808601826114a0565b5060a08301516116ca60a08601826114a0565b5060c08301516116dd60c08601826114a0565b5060e08301516116f060e08601826114a0565b506101008301516117056101008601826114a0565b5061012083015161171a6101208601826114a0565b5061014083015184820361014086015261173482826114b2565b91505061016083015184820361016086015261175082826114b2565b95945050505050565b805161010083019061176b84826114a0565b50602082015161177e60208501826114a0565b50604082015161179160408501826114a0565b5060608201516117a460608501826114a0565b5060808201516117b760808501826114a0565b5060a08201516117ca60a08501826114a0565b5060c08201516117dd60c08501826114a0565b5060e082015161165060e08501826114a0565b61134181611a1a565b602081016109a38284611338565b604081016118158285611338565b610c7e6020830184611338565b604080825281016118338185611347565b905081810360208301526111318184611405565b60208082528101610c7e818461139e565b60208082528101610c7e8184611405565b6040808252810161187a8185611453565b905081810360208301526111318184611453565b602081016109a382846114a9565b602080825281016109a3816114e7565b602080825281016109a38161153d565b602080825281016109a38161156d565b602080825281016109a3816115c3565b61016081016118eb8285611619565b610c7e6060830184611759565b60208082528101610c7e8184611656565b61010081016109a38284611759565b602081016109a382846114a0565b6040810161193482856114a0565b610c7e60208301846114a0565b60405181810167ffffffffffffffff8111828210171561196057600080fd5b604052919050565b600067ffffffffffffffff82111561197f57600080fd5b5060209081020190565b600067ffffffffffffffff8211156119a057600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b151590565b82818337506000910152565b60005b83811015611a4c578181015183820152602001611a34565b838111156116505750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a723058207043dcb374049761fee11cc22172badc651189933d531cd452016dc5fc1aa3016c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x1D3A CODESIZE SUB DUP1 PUSH3 0x1D3A DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH3 0x37 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH3 0x186 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP5 AND OR SWAP1 SSTORE DUP1 MLOAD PUSH3 0x67 SWAP1 PUSH1 0x1 SWAP1 PUSH1 0x20 DUP5 ADD SWAP1 PUSH3 0x70 JUMP JUMPDEST POP POP POP PUSH3 0x26B JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH3 0xB3 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH3 0xE3 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH3 0xE3 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0xE3 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH3 0xC6 JUMP JUMPDEST POP PUSH3 0xF1 SWAP3 SWAP2 POP PUSH3 0xF5 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x112 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0xF1 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0xFC JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH3 0x123 DUP3 MLOAD PUSH3 0x22C JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH3 0x13C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH3 0x153 PUSH3 0x14D DUP3 PUSH3 0x204 JUMP JUMPDEST PUSH3 0x1DD JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH3 0x170 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x17D DUP4 DUP3 DUP5 PUSH3 0x238 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH3 0x19A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH3 0x1A8 DUP6 DUP6 PUSH3 0x115 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD MLOAD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT ISZERO PUSH3 0x1C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH3 0x1D3 DUP6 DUP3 DUP7 ADD PUSH3 0x12A JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH3 0x1FC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 PUSH1 0x40 PUSH1 0x2 EXP SUB DUP3 GT ISZERO PUSH3 0x21B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH1 0x1F NOT AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH3 0x255 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH3 0x23B JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH3 0x265 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH2 0x1ABF DUP1 PUSH3 0x27B PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x82 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x4AD1E53 DUP2 EQ PUSH2 0x87 JUMPI DUP1 PUSH4 0x2CD0FC73 EQ PUSH2 0xBE JUMPI DUP1 PUSH4 0x4B95DE13 EQ PUSH2 0xEC JUMPI DUP1 PUSH4 0x690D3114 EQ PUSH2 0x11A JUMPI DUP1 PUSH4 0xB6988463 EQ PUSH2 0x147 JUMPI DUP1 PUSH4 0xC6B7F4EE EQ PUSH2 0x174 JUMPI DUP1 PUSH4 0xF241FFB0 EQ PUSH2 0x1A2 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x93 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xA7 PUSH2 0xA2 CALLDATASIZE PUSH1 0x4 PUSH2 0x12D3 JUMP JUMPDEST PUSH2 0x1CF JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP3 SWAP2 SWAP1 PUSH2 0x18DC JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xCA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xDE PUSH2 0xD9 CALLDATASIZE PUSH1 0x4 PUSH2 0x118B JUMP JUMPDEST PUSH2 0x29C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP3 SWAP2 SWAP1 PUSH2 0x1926 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xF8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10C PUSH2 0x107 CALLDATASIZE PUSH1 0x4 PUSH2 0x1238 JUMP JUMPDEST PUSH2 0x7CD JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP3 SWAP2 SWAP1 PUSH2 0x1822 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x126 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x13A PUSH2 0x135 CALLDATASIZE PUSH1 0x4 PUSH2 0x1238 JUMP JUMPDEST PUSH2 0x8A4 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP2 SWAP1 PUSH2 0x1858 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x153 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x167 PUSH2 0x162 CALLDATASIZE PUSH1 0x4 PUSH2 0x11D3 JUMP JUMPDEST PUSH2 0x95E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP2 SWAP1 PUSH2 0x17F9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x180 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x194 PUSH2 0x18F CALLDATASIZE PUSH1 0x4 PUSH2 0x1139 JUMP JUMPDEST PUSH2 0x9A9 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP3 SWAP2 SWAP1 PUSH2 0x1869 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1C2 PUSH2 0x1BD CALLDATASIZE PUSH1 0x4 PUSH2 0x12D3 JUMP JUMPDEST PUSH2 0xA86 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP2 SWAP1 PUSH2 0x1909 JUMP JUMPDEST PUSH2 0x1D7 PUSH2 0xCD0 JUMP JUMPDEST PUSH2 0x1DF PUSH2 0xCF0 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0xC75E0A8100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0xC75E0A81 SWAP1 PUSH2 0x235 SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0x18F8 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x24F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x263 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x287 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x12B5 JUMP JUMPDEST SWAP2 POP PUSH2 0x293 DUP5 DUP5 PUSH2 0xA86 JUMP JUMPDEST SWAP1 POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP1 DUP1 DUP1 DUP1 DUP1 PUSH2 0x2B5 DUP10 DUP3 PUSH4 0xFFFFFFFF PUSH2 0xBA4 AND JUMP JUMPDEST SWAP6 POP PUSH2 0x2C8 DUP10 PUSH1 0x10 PUSH4 0xFFFFFFFF PUSH2 0xC11 AND JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0x6070410800000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP2 SWAP7 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH4 0x60704108 SWAP1 PUSH2 0x31F SWAP1 DUP10 SWAP1 PUSH1 0x4 ADD PUSH2 0x188E JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x339 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x34D JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x371 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1113 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD SWAP1 KECCAK256 SWAP1 SWAP5 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP8 DUP2 AND SWAP2 AND EQ ISZERO PUSH2 0x526 JUMPI PUSH1 0x40 MLOAD PUSH32 0x70A0823100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 PUSH4 0x70A08231 SWAP1 PUSH2 0x424 SWAP1 DUP14 SWAP1 PUSH1 0x4 ADD PUSH2 0x17F9 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x43E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x452 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x476 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x131A JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xDD62ED3E00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP9 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 PUSH4 0xDD62ED3E SWAP1 PUSH2 0x4CD SWAP1 DUP14 SWAP1 DUP9 SWAP1 PUSH1 0x4 ADD PUSH2 0x1807 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x4E7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x4FB JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x51F SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x131A JUMP JUMPDEST SWAP7 POP PUSH2 0x7C0 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x455243373231546F6B656E28616464726573732C75696E743235362900000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x1C ADD SWAP1 KECCAK256 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP8 DUP2 AND SWAP2 AND EQ ISZERO PUSH2 0x785 JUMPI PUSH2 0x595 DUP10 PUSH1 0x24 PUSH4 0xFFFFFFFF PUSH2 0xC72 AND JUMP JUMPDEST SWAP3 POP PUSH2 0x5A1 DUP6 DUP5 PUSH2 0x95E JUMP JUMPDEST SWAP2 POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP11 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x5DD JUMPI PUSH1 0x0 PUSH2 0x5E0 JUMP JUMPDEST PUSH1 0x1 JUMPDEST PUSH1 0xFF AND SWAP8 POP DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xE985E9C5 DUP12 DUP7 PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x63C SWAP3 SWAP2 SWAP1 PUSH2 0x1807 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x656 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x66A JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x68E SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1297 JUMP JUMPDEST DUP1 PUSH2 0x76A JUMPI POP DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x81812FC DUP6 PUSH1 0x40 MLOAD DUP3 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x700 SWAP2 SWAP1 PUSH2 0x1918 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x71A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x72E JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x752 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1113 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ JUMPDEST SWAP1 POP DUP1 PUSH2 0x778 JUMPI PUSH1 0x0 PUSH2 0x77B JUMP JUMPDEST PUSH1 0x1 JUMPDEST PUSH1 0xFF AND SWAP7 POP PUSH2 0x7C0 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x7B7 SWAP1 PUSH2 0x18AC JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP POP POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0x7E9D74DC00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x60 SWAP2 DUP3 SWAP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0x7E9D74DC SWAP1 PUSH2 0x828 SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0x1847 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x842 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x856 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x0 DUP3 RETURNDATACOPY PUSH1 0x1F RETURNDATASIZE SWAP1 DUP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND DUP3 ADD PUSH1 0x40 MSTORE PUSH2 0x89C SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1203 JUMP JUMPDEST SWAP2 POP PUSH2 0x293 DUP5 DUP5 JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH1 0x60 PUSH1 0x0 DUP6 MLOAD SWAP3 POP DUP3 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x8EA JUMPI DUP2 PUSH1 0x20 ADD JUMPDEST PUSH2 0x8D7 PUSH2 0xCF0 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 SWAP1 SUB SWAP1 DUP2 PUSH2 0x8CF JUMPI SWAP1 POP JUMPDEST POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP1 DUP4 EQ PUSH2 0x951 JUMPI PUSH2 0x931 DUP7 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x90A JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP7 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x922 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0xA86 JUMP JUMPDEST DUP3 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x93F JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x8F2 JUMP JUMPDEST DUP2 SWAP4 POP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD PUSH32 0x6352211E00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE DUP3 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x20 DUP2 PUSH1 0x24 DUP4 DUP8 GAS STATICCALL DUP1 ISZERO PUSH2 0x9A0 JUMPI DUP2 MLOAD SWAP3 POP JUMPDEST POP POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 PUSH1 0x60 DUP1 PUSH1 0x0 DUP7 MLOAD SWAP4 POP DUP4 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x9E1 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP DUP4 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xA0E JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP1 DUP5 EQ PUSH2 0xA79 JUMPI PUSH2 0xA3E DUP9 DUP9 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA2F JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x29C JUMP JUMPDEST DUP5 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA4C JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD DUP5 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA63 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD SWAP2 SWAP1 SWAP2 MSTORE MSTORE PUSH1 0x1 ADD PUSH2 0xA16 JUMP JUMPDEST POP SWAP1 SWAP7 SWAP1 SWAP6 POP SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0xA8E PUSH2 0xCF0 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xAA3 DUP5 PUSH1 0x0 ADD MLOAD DUP6 PUSH2 0x140 ADD MLOAD PUSH2 0x29C JUMP JUMPDEST PUSH1 0x20 DUP5 ADD MSTORE DUP3 MSTORE PUSH2 0x160 DUP5 ADD MLOAD PUSH2 0xABB SWAP1 DUP5 SWAP1 PUSH2 0x29C JUMP JUMPDEST PUSH1 0x60 DUP5 ADD MSTORE PUSH1 0x40 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x1 DUP1 SLOAD DUP3 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 DUP7 DUP9 AND ISZERO MUL ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV SWAP3 DUP4 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP5 MSTORE DUP2 DUP2 MSTORE SWAP3 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xB6A JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xB3F JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xB6A JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xB4D JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0xB7F DUP5 PUSH1 0x0 ADD MLOAD DUP3 PUSH2 0x29C JUMP JUMPDEST PUSH1 0xA0 DUP5 ADD MSTORE PUSH1 0x80 DUP4 ADD MSTORE PUSH2 0xB93 DUP4 DUP3 PUSH2 0x29C JUMP JUMPDEST PUSH1 0xE0 DUP5 ADD MSTORE PUSH1 0xC0 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x4 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xBE6 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x7B7 SWAP1 PUSH2 0x18CC JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xC53 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x7B7 SWAP1 PUSH2 0x18BC JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP4 DUP4 PUSH2 0xC85 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xCC7 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x7B7 SWAP1 PUSH2 0x189C JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x60 DUP2 ADD DUP3 MSTORE PUSH1 0x0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP2 SWAP1 MSTORE SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE SWAP1 JUMP JUMPDEST PUSH2 0x100 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 CALLDATALOAD PUSH2 0x19D9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 MLOAD PUSH2 0x19D9 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xD5F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xD72 PUSH2 0xD6D DUP3 PUSH2 0x1968 JUMP JUMPDEST PUSH2 0x1941 JUMP JUMPDEST SWAP2 POP DUP2 DUP2 DUP4 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP2 ADD SWAP1 POP DUP4 DUP6 PUSH1 0x20 DUP5 MUL DUP3 ADD GT ISZERO PUSH2 0xD97 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xDC3 JUMPI DUP2 PUSH2 0xDAD DUP9 DUP3 PUSH2 0xD36 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xD9A JUMP JUMPDEST POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xDDE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xDEC PUSH2 0xD6D DUP3 PUSH2 0x1968 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xDC3 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0xE14 DUP9 DUP3 PUSH2 0xF11 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xDFE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xE3B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH2 0xE49 PUSH2 0xD6D DUP3 PUSH2 0x1968 JUMP JUMPDEST SWAP2 POP DUP2 DUP2 DUP4 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP2 ADD SWAP1 POP DUP4 DUP6 PUSH1 0x60 DUP5 MUL DUP3 ADD GT ISZERO PUSH2 0xE6E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xDC3 JUMPI DUP2 PUSH2 0xE84 DUP9 DUP3 PUSH2 0xF57 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xE71 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xEAD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xEBB PUSH2 0xD6D DUP3 PUSH2 0x1968 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xDC3 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0xEE3 DUP9 DUP3 PUSH2 0xFB2 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xECD JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 MLOAD PUSH2 0x1A20 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 MLOAD PUSH2 0x19F2 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xF22 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xF30 PUSH2 0xD6D DUP3 PUSH2 0x1989 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0xF4C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x955 DUP4 DUP3 DUP5 PUSH2 0x1A25 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xF69 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xF73 PUSH1 0x60 PUSH2 0x1941 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0xF81 DUP5 DUP5 PUSH2 0x1107 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0xF92 DUP5 DUP5 DUP4 ADD PUSH2 0xF05 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0xFA6 DUP5 DUP3 DUP6 ADD PUSH2 0xF05 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xFC5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xFD0 PUSH2 0x180 PUSH2 0x1941 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0xFDE DUP5 DUP5 PUSH2 0xD36 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0xFEF DUP5 DUP5 DUP4 ADD PUSH2 0xD36 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x1003 DUP5 DUP3 DUP6 ADD PUSH2 0xD36 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x1017 DUP5 DUP3 DUP6 ADD PUSH2 0xD36 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x102B DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x103F DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x1053 DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x1067 DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x107C DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x1092 DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x10B4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x10C0 DUP5 DUP3 DUP6 ADD PUSH2 0xF11 JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x10E2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x10EE DUP5 DUP3 DUP6 ADD PUSH2 0xF11 JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 CALLDATALOAD PUSH2 0x19F2 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 MLOAD PUSH2 0x1A1A JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1125 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1131 DUP5 DUP5 PUSH2 0xD42 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x114C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1158 DUP6 DUP6 PUSH2 0xD36 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1175 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1181 DUP6 DUP3 DUP7 ADD PUSH2 0xDCD JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x119E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x11AA DUP6 DUP6 PUSH2 0xD36 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x11C7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1181 DUP6 DUP3 DUP7 ADD PUSH2 0xF11 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x11E6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x11F2 DUP6 DUP6 PUSH2 0xD36 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x1181 DUP6 DUP3 DUP7 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1215 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x122C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1131 DUP5 DUP3 DUP6 ADD PUSH2 0xE2A JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x124B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1262 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x126E DUP6 DUP3 DUP7 ADD PUSH2 0xE9C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x128B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1181 DUP6 DUP3 DUP7 ADD PUSH2 0xD4E JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x12A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1131 DUP5 DUP5 PUSH2 0xEF9 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x12C7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1131 DUP5 DUP5 PUSH2 0xF57 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x12E6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x12FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1309 DUP6 DUP3 DUP7 ADD PUSH2 0xFB2 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x1181 DUP6 DUP3 DUP7 ADD PUSH2 0xD36 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x132C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1131 DUP5 DUP5 PUSH2 0xF05 JUMP JUMPDEST PUSH2 0x1341 DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1352 DUP3 PUSH2 0x19D5 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x1364 DUP4 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x1394 JUMPI PUSH2 0x137A DUP7 DUP4 MLOAD PUSH2 0x1619 JUMP JUMPDEST PUSH2 0x1383 DUP3 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x60 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x1367 JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x13A9 DUP3 PUSH2 0x19D5 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP DUP4 PUSH1 0x20 DUP3 MUL DUP6 ADD PUSH2 0x13C2 DUP6 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP5 DUP2 LT ISZERO PUSH2 0x13F9 JUMPI DUP4 DUP4 SUB DUP9 MSTORE PUSH2 0x13DD DUP4 DUP4 MLOAD PUSH2 0x1656 JUMP JUMPDEST SWAP3 POP PUSH2 0x13E8 DUP3 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x20 SWAP9 SWAP1 SWAP9 ADD SWAP8 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x13C5 JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1410 DUP3 PUSH2 0x19D5 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x1422 DUP4 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x1394 JUMPI PUSH2 0x1438 DUP7 DUP4 MLOAD PUSH2 0x1759 JUMP JUMPDEST PUSH2 0x1441 DUP3 PUSH2 0x19CF JUMP JUMPDEST PUSH2 0x100 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x1425 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x145E DUP3 PUSH2 0x19D5 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x1470 DUP4 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x1394 JUMPI PUSH2 0x1486 DUP7 DUP4 MLOAD PUSH2 0x14A0 JUMP JUMPDEST PUSH2 0x148F DUP3 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x20 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x1473 JUMP JUMPDEST PUSH2 0x1341 DUP2 PUSH2 0x19F2 JUMP JUMPDEST PUSH2 0x1341 DUP2 PUSH2 0x19F5 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x14BD DUP3 PUSH2 0x19D5 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x14D1 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x1A31 JUMP JUMPDEST PUSH2 0x14DA DUP2 PUSH2 0x1A5D JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x554E535550504F525445445F41535345545F50524F5859000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x25 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F345F4C454E4754485F524551 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5549524544000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x60 DUP4 ADD SWAP1 PUSH2 0x162A DUP5 DUP3 PUSH2 0x17F0 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x163D PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x1650 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0x166B DUP6 DUP3 PUSH2 0x1338 JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0x167E PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0x1338 JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0x1691 PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0x1338 JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0x16A4 PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x1338 JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0x16B7 PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0x16CA PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x16DD PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0x16F0 PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0x1705 PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0x171A PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0x1734 DUP3 DUP3 PUSH2 0x14B2 JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0x1750 DUP3 DUP3 PUSH2 0x14B2 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH2 0x100 DUP4 ADD SWAP1 PUSH2 0x176B DUP5 DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x177E PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x1791 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x17A4 PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0x80 DUP3 ADD MLOAD PUSH2 0x17B7 PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xA0 DUP3 ADD MLOAD PUSH2 0x17CA PUSH1 0xA0 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xC0 DUP3 ADD MLOAD PUSH2 0x17DD PUSH1 0xC0 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xE0 DUP3 ADD MLOAD PUSH2 0x1650 PUSH1 0xE0 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST PUSH2 0x1341 DUP2 PUSH2 0x1A1A JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x9A3 DUP3 DUP5 PUSH2 0x1338 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x1815 DUP3 DUP6 PUSH2 0x1338 JUMP JUMPDEST PUSH2 0xC7E PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x1338 JUMP JUMPDEST PUSH1 0x40 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1833 DUP2 DUP6 PUSH2 0x1347 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x1131 DUP2 DUP5 PUSH2 0x1405 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xC7E DUP2 DUP5 PUSH2 0x139E JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xC7E DUP2 DUP5 PUSH2 0x1405 JUMP JUMPDEST PUSH1 0x40 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x187A DUP2 DUP6 PUSH2 0x1453 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x1131 DUP2 DUP5 PUSH2 0x1453 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x9A3 DUP3 DUP5 PUSH2 0x14A9 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x9A3 DUP2 PUSH2 0x14E7 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x9A3 DUP2 PUSH2 0x153D JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x9A3 DUP2 PUSH2 0x156D JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x9A3 DUP2 PUSH2 0x15C3 JUMP JUMPDEST PUSH2 0x160 DUP2 ADD PUSH2 0x18EB DUP3 DUP6 PUSH2 0x1619 JUMP JUMPDEST PUSH2 0xC7E PUSH1 0x60 DUP4 ADD DUP5 PUSH2 0x1759 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xC7E DUP2 DUP5 PUSH2 0x1656 JUMP JUMPDEST PUSH2 0x100 DUP2 ADD PUSH2 0x9A3 DUP3 DUP5 PUSH2 0x1759 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x9A3 DUP3 DUP5 PUSH2 0x14A0 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x1934 DUP3 DUP6 PUSH2 0x14A0 JUMP JUMPDEST PUSH2 0xC7E PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x14A0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x1960 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x197F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 SWAP1 DUP2 MUL ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x19A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0xFF AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1A4C JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1A34 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x1650 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 PUSH17 0x43DCB374049761FEE11CC22172BADC6511 DUP10 SWAP4 RETURNDATASIZE MSTORE8 SHR 0xd4 MSTORE ADD PUSH14 0xC5FC1AA3016C6578706572696D65 PUSH15 0x74616CF50037000000000000000000 ",
+ "sourceMap": "898:8536:15:-;;;1916:167;8:9:-1;5:2;;;30:1;27;20:12;5:2;1916:167:15;;;;;;;;;;;;;;;;;;;;;;;;2005:8;:31;;-1:-1:-1;;;;;;2005:31:15;-1:-1:-1;;;;;2005:31:15;;;;;2046:30;;;;-1:-1:-1;;2046:30:15;;;;;:::i;:::-;;1916:167;;898:8536;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;898:8536:15;;;-1:-1:-1;898:8536:15;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;5:122:-1:-;;83:39;114:6;108:13;83:39;;;74:48;68:59;-1:-1;;;68:59;135:442;;240:4;228:17;;224:27;-1:-1;214:2;;265:1;262;255:12;214:2;295:6;289:13;317:64;332:48;373:6;332:48;;;317:64;;;308:73;;401:6;394:5;387:21;437:4;429:6;425:17;470:4;463:5;459:16;505:3;496:6;491:3;487:16;484:25;481:2;;;522:1;519;512:12;481:2;532:39;564:6;559:3;554;532:39;;;207:370;;;;;;;;585:496;;;726:2;714:9;705:7;701:23;697:32;694:2;;;742:1;739;732:12;694:2;777:1;794:64;850:7;830:9;794:64;;;784:74;;756:108;916:2;905:9;901:18;895:25;-1:-1;;;;;932:6;929:30;926:2;;;972:1;969;962:12;926:2;992:73;1057:7;1048:6;1037:9;1033:22;992:73;;;982:83;;874:197;688:393;;;;;;1088:256;1150:2;1144:9;1176:17;;;-1:-1;;;;;1236:34;;1272:22;;;1233:62;1230:2;;;1308:1;1305;1298:12;1230:2;1324;1317:22;1128:216;;-1:-1;1128:216;1351:258;;-1:-1;;;;;1486:6;1483:30;1480:2;;;1526:1;1523;1516:12;1480:2;-1:-1;1599:4;1570;1547:17;;;;-1:-1;;1543:33;1589:15;;1417:192;1616:128;-1:-1;;;;;1685:54;;1668:76;1752:268;1817:1;1824:101;1838:6;1835:1;1832:13;1824:101;;;1905:11;;;1899:18;1886:11;;;1879:39;1860:2;1853:10;1824:101;;;1940:6;1937:1;1934:13;1931:2;;;2005:1;1996:6;1991:3;1987:16;1980:27;1931:2;1801:219;;;;;;898:8536:15;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100825763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304ad1e5381146100875780632cd0fc73146100be5780634b95de13146100ec578063690d31141461011a578063b698846314610147578063c6b7f4ee14610174578063f241ffb0146101a2575b600080fd5b34801561009357600080fd5b506100a76100a23660046112d3565b6101cf565b6040516100b59291906118dc565b60405180910390f35b3480156100ca57600080fd5b506100de6100d936600461118b565b61029c565b6040516100b5929190611926565b3480156100f857600080fd5b5061010c610107366004611238565b6107cd565b6040516100b5929190611822565b34801561012657600080fd5b5061013a610135366004611238565b6108a4565b6040516100b59190611858565b34801561015357600080fd5b506101676101623660046111d3565b61095e565b6040516100b591906117f9565b34801561018057600080fd5b5061019461018f366004611139565b6109a9565b6040516100b5929190611869565b3480156101ae57600080fd5b506101c26101bd3660046112d3565b610a86565b6040516100b59190611909565b6101d7610cd0565b6101df610cf0565b6000546040517fc75e0a8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063c75e0a81906102359087906004016118f8565b606060405180830381600087803b15801561024f57600080fd5b505af1158015610263573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061028791908101906112b5565b91506102938484610a86565b90509250929050565b6000808080808080806102b5898263ffffffff610ba416565b95506102c889601063ffffffff610c1116565b6000546040517f6070410800000000000000000000000000000000000000000000000000000000815291965073ffffffffffffffffffffffffffffffffffffffff169063607041089061031f90899060040161188e565b602060405180830381600087803b15801561033957600080fd5b505af115801561034d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103719190810190611113565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190209094507fffffffff0000000000000000000000000000000000000000000000000000000087811691161415610526576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616906370a0823190610424908d906004016117f9565b602060405180830381600087803b15801561043e57600080fd5b505af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610476919081019061131a565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815290985073ffffffffffffffffffffffffffffffffffffffff86169063dd62ed3e906104cd908d908890600401611807565b602060405180830381600087803b1580156104e757600080fd5b505af11580156104fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061051f919081019061131a565b96506107c0565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190207fffffffff00000000000000000000000000000000000000000000000000000000878116911614156107855761059589602463ffffffff610c7216565b92506105a1858461095e565b91508173ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16146105dd5760006105e0565b60015b60ff1697508473ffffffffffffffffffffffffffffffffffffffff1663e985e9c58b866040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161063c929190611807565b602060405180830381600087803b15801561065657600080fd5b505af115801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061068e9190810190611297565b8061076a57508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1663081812fc856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016107009190611918565b602060405180830381600087803b15801561071a57600080fd5b505af115801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107529190810190611113565b73ffffffffffffffffffffffffffffffffffffffff16145b90508061077857600061077b565b60015b60ff1696506107c0565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118ac565b60405180910390fd5b5050505050509250929050565b6000546040517f7e9d74dc000000000000000000000000000000000000000000000000000000008152606091829173ffffffffffffffffffffffffffffffffffffffff90911690637e9d74dc90610828908790600401611847565b600060405180830381600087803b15801561084257600080fd5b505af1158015610856573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261089c9190810190611203565b915061029384845b606060006060600085519250826040519080825280602002602001820160405280156108ea57816020015b6108d7610cf0565b8152602001906001900390816108cf5790505b509150600090505b80831461095157610931868281518110151561090a57fe5b90602001906020020151868381518110151561092257fe5b90602001906020020151610a86565b828281518110151561093f57fe5b602090810290910101526001016108f2565b8193505b50505092915050565b60006040517f6352211e000000000000000000000000000000000000000000000000000000008152826004820152602081602483875afa80156109a057815192505b50505b92915050565b6060806000606080600086519350836040519080825280602002602001820160405280156109e1578160200160208202803883390190505b50925083604051908082528060200260200182016040528015610a0e578160200160208202803883390190505b509150600090505b808414610a7957610a3e888883815181101515610a2f57fe5b9060200190602002015161029c565b8483815181101515610a4c57fe5b9060200190602002018484815181101515610a6357fe5b6020908102909101019190915252600101610a16565b5090969095509350505050565b610a8e610cf0565b6060610aa3846000015185610140015161029c565b60208401528252610160840151610abb90849061029c565b60608401526040808401919091526001805482516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008688161502019094169390930492830181900481028201810190945281815292830182828015610b6a5780601f10610b3f57610100808354040283529160200191610b6a565b820191906000526020600020905b815481529060010190602001808311610b4d57829003601f168201915b50505050509050610b7f84600001518261029c565b60a08401526080830152610b93838261029c565b60e084015260c08301525092915050565b600081600401835110151515610be6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118cc565b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b600081601401835110151515610c53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118bc565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000610c7e8383610c85565b9392505050565b600081602001835110151515610cc7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b79061189c565b50016020015190565b604080516060810182526000808252602082018190529181019190915290565b6101006040519081016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000610c7e82356119d9565b6000610c7e82516119d9565b6000601f82018313610d5f57600080fd5b8135610d72610d6d82611968565b611941565b91508181835260208401935060208101905083856020840282011115610d9757600080fd5b60005b83811015610dc35781610dad8882610d36565b8452506020928301929190910190600101610d9a565b5050505092915050565b6000601f82018313610dde57600080fd5b8135610dec610d6d82611968565b81815260209384019390925082018360005b83811015610dc35781358601610e148882610f11565b8452506020928301929190910190600101610dfe565b6000601f82018313610e3b57600080fd5b8151610e49610d6d82611968565b91508181835260208401935060208101905083856060840282011115610e6e57600080fd5b60005b83811015610dc35781610e848882610f57565b84525060209092019160609190910190600101610e71565b6000601f82018313610ead57600080fd5b8135610ebb610d6d82611968565b81815260209384019390925082018360005b83811015610dc35781358601610ee38882610fb2565b8452506020928301929190910190600101610ecd565b6000610c7e8251611a20565b6000610c7e82516119f2565b6000601f82018313610f2257600080fd5b8135610f30610d6d82611989565b91508082526020830160208301858383011115610f4c57600080fd5b610955838284611a25565b600060608284031215610f6957600080fd5b610f736060611941565b90506000610f818484611107565b8252506020610f9284848301610f05565b6020830152506040610fa684828501610f05565b60408301525092915050565b60006101808284031215610fc557600080fd5b610fd0610180611941565b90506000610fde8484610d36565b8252506020610fef84848301610d36565b602083015250604061100384828501610d36565b604083015250606061101784828501610d36565b606083015250608061102b848285016110fb565b60808301525060a061103f848285016110fb565b60a08301525060c0611053848285016110fb565b60c08301525060e0611067848285016110fb565b60e08301525061010061107c848285016110fb565b61010083015250610120611092848285016110fb565b6101208301525061014082013567ffffffffffffffff8111156110b457600080fd5b6110c084828501610f11565b6101408301525061016082013567ffffffffffffffff8111156110e257600080fd5b6110ee84828501610f11565b6101608301525092915050565b6000610c7e82356119f2565b6000610c7e8251611a1a565b60006020828403121561112557600080fd5b60006111318484610d42565b949350505050565b6000806040838503121561114c57600080fd5b60006111588585610d36565b925050602083013567ffffffffffffffff81111561117557600080fd5b61118185828601610dcd565b9150509250929050565b6000806040838503121561119e57600080fd5b60006111aa8585610d36565b925050602083013567ffffffffffffffff8111156111c757600080fd5b61118185828601610f11565b600080604083850312156111e657600080fd5b60006111f28585610d36565b9250506020611181858286016110fb565b60006020828403121561121557600080fd5b815167ffffffffffffffff81111561122c57600080fd5b61113184828501610e2a565b6000806040838503121561124b57600080fd5b823567ffffffffffffffff81111561126257600080fd5b61126e85828601610e9c565b925050602083013567ffffffffffffffff81111561128b57600080fd5b61118185828601610d4e565b6000602082840312156112a957600080fd5b60006111318484610ef9565b6000606082840312156112c757600080fd5b60006111318484610f57565b600080604083850312156112e657600080fd5b823567ffffffffffffffff8111156112fd57600080fd5b61130985828601610fb2565b925050602061118185828601610d36565b60006020828403121561132c57600080fd5b60006111318484610f05565b611341816119d9565b82525050565b6000611352826119d5565b808452602084019350611364836119cf565b60005b828110156113945761137a868351611619565b611383826119cf565b606096909601959150600101611367565b5093949350505050565b60006113a9826119d5565b808452602084019350836020820285016113c2856119cf565b60005b848110156113f95783830388526113dd838351611656565b92506113e8826119cf565b6020989098019791506001016113c5565b50909695505050505050565b6000611410826119d5565b808452602084019350611422836119cf565b60005b8281101561139457611438868351611759565b611441826119cf565b61010096909601959150600101611425565b600061145e826119d5565b808452602084019350611470836119cf565b60005b82811015611394576114868683516114a0565b61148f826119cf565b602096909601959150600101611473565b611341816119f2565b611341816119f5565b60006114bd826119d5565b8084526114d1816020860160208601611a31565b6114da81611a5d565b9093016020019392505050565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601781527f554e535550504f525445445f41535345545f50524f5859000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b602581527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160208201527f5549524544000000000000000000000000000000000000000000000000000000604082015260600190565b8051606083019061162a84826117f0565b50602082015161163d60208501826114a0565b50604082015161165060408501826114a0565b50505050565b805160009061018084019061166b8582611338565b50602083015161167e6020860182611338565b5060408301516116916040860182611338565b5060608301516116a46060860182611338565b5060808301516116b760808601826114a0565b5060a08301516116ca60a08601826114a0565b5060c08301516116dd60c08601826114a0565b5060e08301516116f060e08601826114a0565b506101008301516117056101008601826114a0565b5061012083015161171a6101208601826114a0565b5061014083015184820361014086015261173482826114b2565b91505061016083015184820361016086015261175082826114b2565b95945050505050565b805161010083019061176b84826114a0565b50602082015161177e60208501826114a0565b50604082015161179160408501826114a0565b5060608201516117a460608501826114a0565b5060808201516117b760808501826114a0565b5060a08201516117ca60a08501826114a0565b5060c08201516117dd60c08501826114a0565b5060e082015161165060e08501826114a0565b61134181611a1a565b602081016109a38284611338565b604081016118158285611338565b610c7e6020830184611338565b604080825281016118338185611347565b905081810360208301526111318184611405565b60208082528101610c7e818461139e565b60208082528101610c7e8184611405565b6040808252810161187a8185611453565b905081810360208301526111318184611453565b602081016109a382846114a9565b602080825281016109a3816114e7565b602080825281016109a38161153d565b602080825281016109a38161156d565b602080825281016109a3816115c3565b61016081016118eb8285611619565b610c7e6060830184611759565b60208082528101610c7e8184611656565b61010081016109a38284611759565b602081016109a382846114a0565b6040810161193482856114a0565b610c7e60208301846114a0565b60405181810167ffffffffffffffff8111828210171561196057600080fd5b604052919050565b600067ffffffffffffffff82111561197f57600080fd5b5060209081020190565b600067ffffffffffffffff8211156119a057600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b151590565b82818337506000910152565b60005b83811015611a4c578181015183820152602001611a34565b838111156116505750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a723058207043dcb374049761fee11cc22172badc651189933d531cd452016dc5fc1aa3016c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x82 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x4AD1E53 DUP2 EQ PUSH2 0x87 JUMPI DUP1 PUSH4 0x2CD0FC73 EQ PUSH2 0xBE JUMPI DUP1 PUSH4 0x4B95DE13 EQ PUSH2 0xEC JUMPI DUP1 PUSH4 0x690D3114 EQ PUSH2 0x11A JUMPI DUP1 PUSH4 0xB6988463 EQ PUSH2 0x147 JUMPI DUP1 PUSH4 0xC6B7F4EE EQ PUSH2 0x174 JUMPI DUP1 PUSH4 0xF241FFB0 EQ PUSH2 0x1A2 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x93 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xA7 PUSH2 0xA2 CALLDATASIZE PUSH1 0x4 PUSH2 0x12D3 JUMP JUMPDEST PUSH2 0x1CF JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP3 SWAP2 SWAP1 PUSH2 0x18DC JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xCA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xDE PUSH2 0xD9 CALLDATASIZE PUSH1 0x4 PUSH2 0x118B JUMP JUMPDEST PUSH2 0x29C JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP3 SWAP2 SWAP1 PUSH2 0x1926 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xF8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x10C PUSH2 0x107 CALLDATASIZE PUSH1 0x4 PUSH2 0x1238 JUMP JUMPDEST PUSH2 0x7CD JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP3 SWAP2 SWAP1 PUSH2 0x1822 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x126 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x13A PUSH2 0x135 CALLDATASIZE PUSH1 0x4 PUSH2 0x1238 JUMP JUMPDEST PUSH2 0x8A4 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP2 SWAP1 PUSH2 0x1858 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x153 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x167 PUSH2 0x162 CALLDATASIZE PUSH1 0x4 PUSH2 0x11D3 JUMP JUMPDEST PUSH2 0x95E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP2 SWAP1 PUSH2 0x17F9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x180 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x194 PUSH2 0x18F CALLDATASIZE PUSH1 0x4 PUSH2 0x1139 JUMP JUMPDEST PUSH2 0x9A9 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP3 SWAP2 SWAP1 PUSH2 0x1869 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1C2 PUSH2 0x1BD CALLDATASIZE PUSH1 0x4 PUSH2 0x12D3 JUMP JUMPDEST PUSH2 0xA86 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB5 SWAP2 SWAP1 PUSH2 0x1909 JUMP JUMPDEST PUSH2 0x1D7 PUSH2 0xCD0 JUMP JUMPDEST PUSH2 0x1DF PUSH2 0xCF0 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0xC75E0A8100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0xC75E0A81 SWAP1 PUSH2 0x235 SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0x18F8 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x24F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x263 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x287 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x12B5 JUMP JUMPDEST SWAP2 POP PUSH2 0x293 DUP5 DUP5 PUSH2 0xA86 JUMP JUMPDEST SWAP1 POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP1 DUP1 DUP1 DUP1 DUP1 PUSH2 0x2B5 DUP10 DUP3 PUSH4 0xFFFFFFFF PUSH2 0xBA4 AND JUMP JUMPDEST SWAP6 POP PUSH2 0x2C8 DUP10 PUSH1 0x10 PUSH4 0xFFFFFFFF PUSH2 0xC11 AND JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0x6070410800000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP2 SWAP7 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH4 0x60704108 SWAP1 PUSH2 0x31F SWAP1 DUP10 SWAP1 PUSH1 0x4 ADD PUSH2 0x188E JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x339 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x34D JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x371 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1113 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD SWAP1 KECCAK256 SWAP1 SWAP5 POP PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP8 DUP2 AND SWAP2 AND EQ ISZERO PUSH2 0x526 JUMPI PUSH1 0x40 MLOAD PUSH32 0x70A0823100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 PUSH4 0x70A08231 SWAP1 PUSH2 0x424 SWAP1 DUP14 SWAP1 PUSH1 0x4 ADD PUSH2 0x17F9 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x43E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x452 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x476 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x131A JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xDD62ED3E00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP9 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 PUSH4 0xDD62ED3E SWAP1 PUSH2 0x4CD SWAP1 DUP14 SWAP1 DUP9 SWAP1 PUSH1 0x4 ADD PUSH2 0x1807 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x4E7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x4FB JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x51F SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x131A JUMP JUMPDEST SWAP7 POP PUSH2 0x7C0 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x455243373231546F6B656E28616464726573732C75696E743235362900000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x1C ADD SWAP1 KECCAK256 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP8 DUP2 AND SWAP2 AND EQ ISZERO PUSH2 0x785 JUMPI PUSH2 0x595 DUP10 PUSH1 0x24 PUSH4 0xFFFFFFFF PUSH2 0xC72 AND JUMP JUMPDEST SWAP3 POP PUSH2 0x5A1 DUP6 DUP5 PUSH2 0x95E JUMP JUMPDEST SWAP2 POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP11 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x5DD JUMPI PUSH1 0x0 PUSH2 0x5E0 JUMP JUMPDEST PUSH1 0x1 JUMPDEST PUSH1 0xFF AND SWAP8 POP DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xE985E9C5 DUP12 DUP7 PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x63C SWAP3 SWAP2 SWAP1 PUSH2 0x1807 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x656 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x66A JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x68E SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1297 JUMP JUMPDEST DUP1 PUSH2 0x76A JUMPI POP DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x81812FC DUP6 PUSH1 0x40 MLOAD DUP3 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x700 SWAP2 SWAP1 PUSH2 0x1918 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x71A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x72E JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x752 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1113 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ JUMPDEST SWAP1 POP DUP1 PUSH2 0x778 JUMPI PUSH1 0x0 PUSH2 0x77B JUMP JUMPDEST PUSH1 0x1 JUMPDEST PUSH1 0xFF AND SWAP7 POP PUSH2 0x7C0 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x7B7 SWAP1 PUSH2 0x18AC JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST POP POP POP POP POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0x7E9D74DC00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x60 SWAP2 DUP3 SWAP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0x7E9D74DC SWAP1 PUSH2 0x828 SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0x1847 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x842 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x856 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x0 DUP3 RETURNDATACOPY PUSH1 0x1F RETURNDATASIZE SWAP1 DUP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND DUP3 ADD PUSH1 0x40 MSTORE PUSH2 0x89C SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1203 JUMP JUMPDEST SWAP2 POP PUSH2 0x293 DUP5 DUP5 JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH1 0x60 PUSH1 0x0 DUP6 MLOAD SWAP3 POP DUP3 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x8EA JUMPI DUP2 PUSH1 0x20 ADD JUMPDEST PUSH2 0x8D7 PUSH2 0xCF0 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 SWAP1 SUB SWAP1 DUP2 PUSH2 0x8CF JUMPI SWAP1 POP JUMPDEST POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP1 DUP4 EQ PUSH2 0x951 JUMPI PUSH2 0x931 DUP7 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x90A JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP7 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x922 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0xA86 JUMP JUMPDEST DUP3 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x93F JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x8F2 JUMP JUMPDEST DUP2 SWAP4 POP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD PUSH32 0x6352211E00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE DUP3 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x20 DUP2 PUSH1 0x24 DUP4 DUP8 GAS STATICCALL DUP1 ISZERO PUSH2 0x9A0 JUMPI DUP2 MLOAD SWAP3 POP JUMPDEST POP POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 PUSH1 0x60 DUP1 PUSH1 0x0 DUP7 MLOAD SWAP4 POP DUP4 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x9E1 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP DUP4 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0xA0E JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP1 DUP5 EQ PUSH2 0xA79 JUMPI PUSH2 0xA3E DUP9 DUP9 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA2F JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x29C JUMP JUMPDEST DUP5 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA4C JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD DUP5 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xA63 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD SWAP2 SWAP1 SWAP2 MSTORE MSTORE PUSH1 0x1 ADD PUSH2 0xA16 JUMP JUMPDEST POP SWAP1 SWAP7 SWAP1 SWAP6 POP SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0xA8E PUSH2 0xCF0 JUMP JUMPDEST PUSH1 0x60 PUSH2 0xAA3 DUP5 PUSH1 0x0 ADD MLOAD DUP6 PUSH2 0x140 ADD MLOAD PUSH2 0x29C JUMP JUMPDEST PUSH1 0x20 DUP5 ADD MSTORE DUP3 MSTORE PUSH2 0x160 DUP5 ADD MLOAD PUSH2 0xABB SWAP1 DUP5 SWAP1 PUSH2 0x29C JUMP JUMPDEST PUSH1 0x60 DUP5 ADD MSTORE PUSH1 0x40 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x1 DUP1 SLOAD DUP3 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 DUP7 DUP9 AND ISZERO MUL ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV SWAP3 DUP4 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP5 MSTORE DUP2 DUP2 MSTORE SWAP3 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xB6A JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xB3F JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xB6A JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xB4D JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0xB7F DUP5 PUSH1 0x0 ADD MLOAD DUP3 PUSH2 0x29C JUMP JUMPDEST PUSH1 0xA0 DUP5 ADD MSTORE PUSH1 0x80 DUP4 ADD MSTORE PUSH2 0xB93 DUP4 DUP3 PUSH2 0x29C JUMP JUMPDEST PUSH1 0xE0 DUP5 ADD MSTORE PUSH1 0xC0 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x4 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xBE6 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x7B7 SWAP1 PUSH2 0x18CC JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xC53 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x7B7 SWAP1 PUSH2 0x18BC JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP4 DUP4 PUSH2 0xC85 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xCC7 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x7B7 SWAP1 PUSH2 0x189C JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x60 DUP2 ADD DUP3 MSTORE PUSH1 0x0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP2 SWAP1 MSTORE SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE SWAP1 JUMP JUMPDEST PUSH2 0x100 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 CALLDATALOAD PUSH2 0x19D9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 MLOAD PUSH2 0x19D9 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xD5F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xD72 PUSH2 0xD6D DUP3 PUSH2 0x1968 JUMP JUMPDEST PUSH2 0x1941 JUMP JUMPDEST SWAP2 POP DUP2 DUP2 DUP4 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP2 ADD SWAP1 POP DUP4 DUP6 PUSH1 0x20 DUP5 MUL DUP3 ADD GT ISZERO PUSH2 0xD97 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xDC3 JUMPI DUP2 PUSH2 0xDAD DUP9 DUP3 PUSH2 0xD36 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xD9A JUMP JUMPDEST POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xDDE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xDEC PUSH2 0xD6D DUP3 PUSH2 0x1968 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xDC3 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0xE14 DUP9 DUP3 PUSH2 0xF11 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xDFE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xE3B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH2 0xE49 PUSH2 0xD6D DUP3 PUSH2 0x1968 JUMP JUMPDEST SWAP2 POP DUP2 DUP2 DUP4 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP2 ADD SWAP1 POP DUP4 DUP6 PUSH1 0x60 DUP5 MUL DUP3 ADD GT ISZERO PUSH2 0xE6E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xDC3 JUMPI DUP2 PUSH2 0xE84 DUP9 DUP3 PUSH2 0xF57 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xE71 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xEAD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xEBB PUSH2 0xD6D DUP3 PUSH2 0x1968 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xDC3 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0xEE3 DUP9 DUP3 PUSH2 0xFB2 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xECD JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 MLOAD PUSH2 0x1A20 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 MLOAD PUSH2 0x19F2 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xF22 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xF30 PUSH2 0xD6D DUP3 PUSH2 0x1989 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0xF4C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x955 DUP4 DUP3 DUP5 PUSH2 0x1A25 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xF69 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xF73 PUSH1 0x60 PUSH2 0x1941 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0xF81 DUP5 DUP5 PUSH2 0x1107 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0xF92 DUP5 DUP5 DUP4 ADD PUSH2 0xF05 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0xFA6 DUP5 DUP3 DUP6 ADD PUSH2 0xF05 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xFC5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xFD0 PUSH2 0x180 PUSH2 0x1941 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0xFDE DUP5 DUP5 PUSH2 0xD36 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0xFEF DUP5 DUP5 DUP4 ADD PUSH2 0xD36 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x1003 DUP5 DUP3 DUP6 ADD PUSH2 0xD36 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x1017 DUP5 DUP3 DUP6 ADD PUSH2 0xD36 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x102B DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x103F DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x1053 DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x1067 DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x107C DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x1092 DUP5 DUP3 DUP6 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x10B4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x10C0 DUP5 DUP3 DUP6 ADD PUSH2 0xF11 JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x10E2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x10EE DUP5 DUP3 DUP6 ADD PUSH2 0xF11 JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 CALLDATALOAD PUSH2 0x19F2 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xC7E DUP3 MLOAD PUSH2 0x1A1A JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1125 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1131 DUP5 DUP5 PUSH2 0xD42 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x114C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1158 DUP6 DUP6 PUSH2 0xD36 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1175 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1181 DUP6 DUP3 DUP7 ADD PUSH2 0xDCD JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x119E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x11AA DUP6 DUP6 PUSH2 0xD36 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x11C7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1181 DUP6 DUP3 DUP7 ADD PUSH2 0xF11 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x11E6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x11F2 DUP6 DUP6 PUSH2 0xD36 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x1181 DUP6 DUP3 DUP7 ADD PUSH2 0x10FB JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1215 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x122C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1131 DUP5 DUP3 DUP6 ADD PUSH2 0xE2A JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x124B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1262 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x126E DUP6 DUP3 DUP7 ADD PUSH2 0xE9C JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x128B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1181 DUP6 DUP3 DUP7 ADD PUSH2 0xD4E JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x12A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1131 DUP5 DUP5 PUSH2 0xEF9 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x12C7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1131 DUP5 DUP5 PUSH2 0xF57 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x12E6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x12FD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1309 DUP6 DUP3 DUP7 ADD PUSH2 0xFB2 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x1181 DUP6 DUP3 DUP7 ADD PUSH2 0xD36 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x132C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1131 DUP5 DUP5 PUSH2 0xF05 JUMP JUMPDEST PUSH2 0x1341 DUP2 PUSH2 0x19D9 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1352 DUP3 PUSH2 0x19D5 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x1364 DUP4 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x1394 JUMPI PUSH2 0x137A DUP7 DUP4 MLOAD PUSH2 0x1619 JUMP JUMPDEST PUSH2 0x1383 DUP3 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x60 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x1367 JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x13A9 DUP3 PUSH2 0x19D5 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP DUP4 PUSH1 0x20 DUP3 MUL DUP6 ADD PUSH2 0x13C2 DUP6 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP5 DUP2 LT ISZERO PUSH2 0x13F9 JUMPI DUP4 DUP4 SUB DUP9 MSTORE PUSH2 0x13DD DUP4 DUP4 MLOAD PUSH2 0x1656 JUMP JUMPDEST SWAP3 POP PUSH2 0x13E8 DUP3 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x20 SWAP9 SWAP1 SWAP9 ADD SWAP8 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x13C5 JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1410 DUP3 PUSH2 0x19D5 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x1422 DUP4 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x1394 JUMPI PUSH2 0x1438 DUP7 DUP4 MLOAD PUSH2 0x1759 JUMP JUMPDEST PUSH2 0x1441 DUP3 PUSH2 0x19CF JUMP JUMPDEST PUSH2 0x100 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x1425 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x145E DUP3 PUSH2 0x19D5 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x1470 DUP4 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x1394 JUMPI PUSH2 0x1486 DUP7 DUP4 MLOAD PUSH2 0x14A0 JUMP JUMPDEST PUSH2 0x148F DUP3 PUSH2 0x19CF JUMP JUMPDEST PUSH1 0x20 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x1473 JUMP JUMPDEST PUSH2 0x1341 DUP2 PUSH2 0x19F2 JUMP JUMPDEST PUSH2 0x1341 DUP2 PUSH2 0x19F5 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x14BD DUP3 PUSH2 0x19D5 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x14D1 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x1A31 JUMP JUMPDEST PUSH2 0x14DA DUP2 PUSH2 0x1A5D JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x554E535550504F525445445F41535345545F50524F5859000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x25 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F345F4C454E4754485F524551 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5549524544000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x60 DUP4 ADD SWAP1 PUSH2 0x162A DUP5 DUP3 PUSH2 0x17F0 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x163D PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x1650 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0x166B DUP6 DUP3 PUSH2 0x1338 JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0x167E PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0x1338 JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0x1691 PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0x1338 JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0x16A4 PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x1338 JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0x16B7 PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0x16CA PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x16DD PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0x16F0 PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0x1705 PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0x171A PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0x1734 DUP3 DUP3 PUSH2 0x14B2 JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0x1750 DUP3 DUP3 PUSH2 0x14B2 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH2 0x100 DUP4 ADD SWAP1 PUSH2 0x176B DUP5 DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x177E PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x1791 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x17A4 PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0x80 DUP3 ADD MLOAD PUSH2 0x17B7 PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xA0 DUP3 ADD MLOAD PUSH2 0x17CA PUSH1 0xA0 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xC0 DUP3 ADD MLOAD PUSH2 0x17DD PUSH1 0xC0 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST POP PUSH1 0xE0 DUP3 ADD MLOAD PUSH2 0x1650 PUSH1 0xE0 DUP6 ADD DUP3 PUSH2 0x14A0 JUMP JUMPDEST PUSH2 0x1341 DUP2 PUSH2 0x1A1A JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x9A3 DUP3 DUP5 PUSH2 0x1338 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x1815 DUP3 DUP6 PUSH2 0x1338 JUMP JUMPDEST PUSH2 0xC7E PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x1338 JUMP JUMPDEST PUSH1 0x40 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1833 DUP2 DUP6 PUSH2 0x1347 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x1131 DUP2 DUP5 PUSH2 0x1405 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xC7E DUP2 DUP5 PUSH2 0x139E JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xC7E DUP2 DUP5 PUSH2 0x1405 JUMP JUMPDEST PUSH1 0x40 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x187A DUP2 DUP6 PUSH2 0x1453 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x1131 DUP2 DUP5 PUSH2 0x1453 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x9A3 DUP3 DUP5 PUSH2 0x14A9 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x9A3 DUP2 PUSH2 0x14E7 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x9A3 DUP2 PUSH2 0x153D JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x9A3 DUP2 PUSH2 0x156D JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x9A3 DUP2 PUSH2 0x15C3 JUMP JUMPDEST PUSH2 0x160 DUP2 ADD PUSH2 0x18EB DUP3 DUP6 PUSH2 0x1619 JUMP JUMPDEST PUSH2 0xC7E PUSH1 0x60 DUP4 ADD DUP5 PUSH2 0x1759 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xC7E DUP2 DUP5 PUSH2 0x1656 JUMP JUMPDEST PUSH2 0x100 DUP2 ADD PUSH2 0x9A3 DUP3 DUP5 PUSH2 0x1759 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x9A3 DUP3 DUP5 PUSH2 0x14A0 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x1934 DUP3 DUP6 PUSH2 0x14A0 JUMP JUMPDEST PUSH2 0xC7E PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x14A0 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x1960 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x197F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 SWAP1 DUP2 MUL ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x19A0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0xFF AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1A4C JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1A34 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x1650 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 PUSH17 0x43DCB374049761FEE11CC22172BADC6511 DUP10 SWAP4 RETURNDATASIZE MSTORE8 SHR 0xd4 MSTORE ADD PUSH14 0xC5FC1AA3016C6578706572696D65 PUSH15 0x74616CF50037000000000000000000 ",
+ "sourceMap": "898:8536:15:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2336:352;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2336:352:15;;;;;;;;;;;;;;;;;;;;;;;;;;5614:1359;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5614:1359:15;;;;;;;;;;;;;;;;;;3018:384;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3018:384:15;;;;;;;;;;;;;;;;;;4716:452;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4716:452:15;;;;;;;;;;;;;;;;;8218:1214;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8218:1214:15;;;;;;;;;;;;;;;;;7416:517;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7416:517:15;;;;;;;;;;;;;;;;;;3661:739;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3661:739:15;;;;;;;;;;;;;;;;;2336:352;2463:35;;:::i;:::-;2500:28;;:::i;:::-;2556:8;;:28;;;;;:8;;;;;:21;;:28;;2578:5;;2556:28;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2556:28:15;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2556:28:15;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;2556:28:15;;;;;;;;;2544:40;;2607:34;2621:5;2628:12;2607:13;:34::i;:::-;2594:47;-1:-1:-1;2336:352:15;;;;;:::o;5614:1359::-;5731:15;;;;;;;;5803:23;:9;5731:15;5803:23;:20;:23;:::i;:::-;5781:45;-1:-1:-1;5852:25:15;:9;5874:2;5852:25;:21;:25;:::i;:::-;5908:8;;:36;;;;;5836:41;;-1:-1:-1;5908:8:15;;;:22;;:36;;5931:12;;5908:36;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5908:36:15;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5908:36:15;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;5908:36:15;;;;;;;;;1008:32;;;;;;;;;;;;;;;;5887:57;;-1:-1:-1;5959:29:15;;;;;;;5955:975;;;6043:36;;;;;:28;;;;;;:36;;6072:6;;6043:36;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6043:36:15;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6043:36:15;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;6043:36:15;;;;;;;;;6137:48;;;;;6033:46;;-1:-1:-1;6137:28:15;;;;;;:48;;6166:6;;6174:10;;6137:48;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6137:48:15;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6137:48:15;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;6137:48:15;;;;;;;;;6125:60;;5955:975;;;1096:41;;;;;;;;;;;;;;;;6206:30;;;;;;;6202:728;;;6270:25;:9;6292:2;6270:25;:21;:25;:::i;:::-;6252:43;;6364:35;6384:5;6391:7;6364:19;:35::i;:::-;6348:51;;6496:5;6486:15;;:6;:15;;;:23;;6508:1;6486:23;;;6504:1;6486:23;6476:33;;;;6620:5;6607:36;;;6644:6;6652:10;6607:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6607:56:15;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6607:56:15;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;6607:56:15;;;;;;;;;:114;;;;6711:10;6667:54;;6680:5;6667:31;;;6699:7;6667:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6667:40:15;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6667:40:15;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;6667:40:15;;;;;;;;;:54;;;6607:114;6589:132;;6837:10;:18;;6854:1;6837:18;;;6850:1;6837:18;6825:30;;;;6202:728;;;6886:33;;;;;;;;;;;;;;;;;;;6202:728;5614:1359;;;;;;;;;;;:::o;3018:384::-;3261:8;;:30;;;;;3161:38;;;;3261:8;;;;;:22;;:30;;3284:6;;3261:30;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3261:30:15;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3261:30:15;;;;;;39:16:-1;36:1;17:17;2:54;101:4;3261:30:15;80:15:-1;;;97:9;76:31;65:43;;120:4;113:20;3261:30:15;;;;;;;;;3248:43;;3315:38;3330:6;3338:14;4716:452;4850:12;4885:20;4931:31;5010:9;4908:6;:13;4885:36;;4982:12;4965:30;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;4931:64;;5022:1;5010:13;;5005:129;5025:17;;;5005:129;;5080:43;5094:6;5101:1;5094:9;;;;;;;;;;;;;;;;;;5105:14;5120:1;5105:17;;;;;;;;;;;;;;;;;;5080:13;:43::i;:::-;5063:11;5075:1;5063:14;;;;;;;;;;;;;;;;;;:60;5044:3;;5005:129;;;5150:11;5143:18;;4716:452;;;;;;;;:::o;8218:1214::-;8324:13;8437:2;8431:9;8534:66;8525:7;8518:83;8638:7;8634:1;8625:7;8621:15;8614:32;9060:2;9007:7;8950:2;8903:7;8854:5;8809:3;8781:332;9240:7;9237:2;;;9281:7;9275:14;9266:23;;9237:2;-1:-1:-1;;8218:1214:15;;;;;:::o;7416:517::-;7537:9;7555;7587:14;7630:25;7689:27;7755:9;7604;:16;7587:33;;7672:6;7658:21;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;7658:21:15;;7630:49;;7733:6;7719:21;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;7719:21:15;;7689:51;;7767:1;7755:13;;7750:138;7770:11;;;7750:138;;7833:44;7856:6;7864:9;7874:1;7864:12;;;;;;;;;;;;;;;;;;7833:22;:44::i;:::-;7803:8;7812:1;7803:11;;;;;;;;;;;;;;;;;7816:10;7827:1;7816:13;;;;;;;;;;;;;;;;;;7802:75;;;;;7783:3;;7750:138;;;-1:-1:-1;7905:8:15;;7915:10;;-1:-1:-1;7416:517:15;-1:-1:-1;;;;7416:517:15:o;3661:739::-;3780:28;;:::i;:::-;4076:25;3879:64;3902:5;:18;;;3922:5;:20;;;3879:22;:64::i;:::-;3850:25;;;3824:119;;;4045:20;;;;4008:58;;4031:12;;4008:22;:58::i;:::-;3979:25;;;3953:113;3954:23;;;;3953:113;;;;4104:14;4076:42;;;;-1:-1:-1;4076:42:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4104:14;4076:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4189:56;4212:5;:18;;;4232:12;4189:22;:56::i;:::-;4157:28;;;4128:117;4129:26;;;4128:117;4316:50;4339:12;4353;4316:22;:50::i;:::-;4284:28;;;4255:111;4256:26;;;4255:111;3661:739;;;;;:::o;15593:687:80:-;15713:13;15775:5;15783:1;15775:9;15763:1;:8;:21;;15742:105;;;;;;;;;;;;;;;;-1:-1:-1;16021:13:80;15924:2;16021:13;16015:20;16174:66;16162:79;;15593:687::o;10268:886::-;10389:14;10452:5;10460:2;10452:10;10440:1;:8;:22;;10419:135;;;;;;;;;;;;;;;;-1:-1:-1;11056:13:80;10801:2;11056:13;11050:20;11072:42;11046:69;;10268:886::o;14708:220::-;14829:14;14876:21;14888:1;14891:5;14876:11;:21::i;:::-;14868:30;14708:220;-1:-1:-1;;;14708:220:80:o;13290:490::-;13411:14;13474:5;13482:2;13474:10;13462:1;:8;:22;;13441:107;;;;;;;;;;;;;;;;-1:-1:-1;13727:13:80;13629:2;13727:13;13721:20;;13290:490::o;898:8536:15:-;;;;;;;;;-1:-1:-1;898:8536:15;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;130:122;;208:39;239:6;233:13;208:39;;277:707;;387:4;375:17;;371:27;-1:-1;361:2;;412:1;409;402:12;361:2;449:6;436:20;471:80;486:64;543:6;486:64;;;471:80;;;462:89;;568:5;593:6;586:5;579:21;623:4;615:6;611:17;601:27;;645:4;640:3;636:14;629:21;;698:6;745:3;737:4;729:6;725:17;720:3;716:27;713:36;710:2;;;762:1;759;752:12;710:2;787:1;772:206;797:6;794:1;791:13;772:206;;;855:3;877:37;910:3;898:10;877:37;;;865:50;;-1:-1;938:4;929:14;;;;957;;;;;819:1;812:9;772:206;;;776:14;354:630;;;;;;;;1008:693;;1123:4;1111:17;;1107:27;-1:-1;1097:2;;1148:1;1145;1138:12;1097:2;1185:6;1172:20;1207:85;1222:69;1284:6;1222:69;;1207:85;1320:21;;;1364:4;1352:17;;;;1198:94;;-1:-1;1377:14;;1352:17;1472:1;1457:238;1482:6;1479:1;1476:13;1457:238;;;1565:3;1552:17;1544:6;1540:30;1589:42;1627:3;1615:10;1589:42;;;1577:55;;-1:-1;1655:4;1646:14;;;;1674;;;;;1504:1;1497:9;1457:238;;1745:791;;1889:4;1877:17;;1873:27;-1:-1;1863:2;;1914:1;1911;1904:12;1863:2;1944:6;1938:13;1966:103;1981:87;2061:6;1981:87;;1966:103;1957:112;;2086:5;2111:6;2104:5;2097:21;2141:4;2133:6;2129:17;2119:27;;2163:4;2158:3;2154:14;2147:21;;2216:6;2263:3;2255:4;2247:6;2243:17;2238:3;2234:27;2231:36;2228:2;;;2280:1;2277;2270:12;2228:2;2305:1;2290:240;2315:6;2312:1;2309:13;2290:240;;;2373:3;2395:71;2462:3;2450:10;2395:71;;;2383:84;;-1:-1;2490:4;2481:14;;;;2518:4;2509:14;;;;;2337:1;2330:9;2290:240;;2576:735;;2705:4;2693:17;;2689:27;-1:-1;2679:2;;2730:1;2727;2720:12;2679:2;2767:6;2754:20;2789:99;2804:83;2880:6;2804:83;;2789:99;2916:21;;;2960:4;2948:17;;;;2780:108;;-1:-1;2973:14;;2948:17;3068:1;3053:252;3078:6;3075:1;3072:13;3053:252;;;3161:3;3148:17;3140:6;3136:30;3185:56;3237:3;3225:10;3185:56;;;3173:69;;-1:-1;3265:4;3256:14;;;;3284;;;;;3100:1;3093:9;3053:252;;3319:116;;3394:36;3422:6;3416:13;3394:36;;3442:122;;3520:39;3551:6;3545:13;3520:39;;3572:432;;3662:4;3650:17;;3646:27;-1:-1;3636:2;;3687:1;3684;3677:12;3636:2;3724:6;3711:20;3746:60;3761:44;3798:6;3761:44;;3746:60;3737:69;;3826:6;3819:5;3812:21;3862:4;3854:6;3850:17;3895:4;3888:5;3884:16;3930:3;3921:6;3916:3;3912:16;3909:25;3906:2;;;3947:1;3944;3937:12;3906:2;3957:41;3991:6;3986:3;3981;3957:41;;4493:685;;4616:4;4604:9;4599:3;4595:19;4591:30;4588:2;;;4634:1;4631;4624:12;4588:2;4652:20;4667:4;4652:20;;;4643:29;-1:-1;4729:1;4760:58;4814:3;4794:9;4760:58;;;4736:83;;-1:-1;4885:2;4918:60;4974:3;4950:22;;;4918:60;;;4911:4;4904:5;4900:16;4893:86;4840:150;5063:2;5096:60;5152:3;5143:6;5132:9;5128:22;5096:60;;;5089:4;5082:5;5078:16;5071:86;5000:168;4582:596;;;;;5941:2205;;6049:5;6037:9;6032:3;6028:19;6024:31;6021:2;;;6068:1;6065;6058:12;6021:2;6086:21;6101:5;6086:21;;;6077:30;-1:-1;6165:1;6196:49;6241:3;6221:9;6196:49;;;6172:74;;-1:-1;6315:2;6348:49;6393:3;6369:22;;;6348:49;;;6341:4;6334:5;6330:16;6323:75;6267:142;6474:2;6507:49;6552:3;6543:6;6532:9;6528:22;6507:49;;;6500:4;6493:5;6489:16;6482:75;6419:149;6627:2;6660:49;6705:3;6696:6;6685:9;6681:22;6660:49;;;6653:4;6646:5;6642:16;6635:75;6578:143;6783:3;6817:49;6862:3;6853:6;6842:9;6838:22;6817:49;;;6810:4;6803:5;6799:16;6792:75;6731:147;6940:3;6974:49;7019:3;7010:6;6999:9;6995:22;6974:49;;;6967:4;6960:5;6956:16;6949:75;6888:147;7089:3;7123:49;7168:3;7159:6;7148:9;7144:22;7123:49;;;7116:4;7109:5;7105:16;7098:75;7045:139;7238:3;7272:49;7317:3;7308:6;7297:9;7293:22;7272:49;;;7265:4;7258:5;7254:16;7247:75;7194:139;7400:3;7435:49;7480:3;7471:6;7460:9;7456:22;7435:49;;;7427:5;7420;7416:17;7409:76;7343:153;7546:3;7581:49;7626:3;7617:6;7606:9;7602:22;7581:49;;;7573:5;7566;7562:17;7555:76;7506:136;7730:3;7719:9;7715:19;7702:33;7755:18;7747:6;7744:30;7741:2;;;7787:1;7784;7777:12;7741:2;7823:54;7873:3;7864:6;7853:9;7849:22;7823:54;;;7815:5;7808;7804:17;7797:81;7652:237;7977:3;7966:9;7962:19;7949:33;8002:18;7994:6;7991:30;7988:2;;;8034:1;8031;8024:12;7988:2;8070:54;8120:3;8111:6;8100:9;8096:22;8070:54;;;8062:5;8055;8051:17;8044:81;7899:237;6015:2131;;;;;10397:118;;10464:46;10502:6;10489:20;10464:46;;10651:118;;10727:37;10756:6;10750:13;10727:37;;10776:263;;10891:2;10879:9;10870:7;10866:23;10862:32;10859:2;;;10907:1;10904;10897:12;10859:2;10942:1;10959:64;11015:7;10995:9;10959:64;;;10949:74;10853:186;-1:-1;;;;10853:186;11046:512;;;11197:2;11185:9;11176:7;11172:23;11168:32;11165:2;;;11213:1;11210;11203:12;11165:2;11248:1;11265:53;11310:7;11290:9;11265:53;;;11255:63;;11227:97;11383:2;11372:9;11368:18;11355:32;11407:18;11399:6;11396:30;11393:2;;;11439:1;11436;11429:12;11393:2;11459:83;11534:7;11525:6;11514:9;11510:22;11459:83;;;11449:93;;11334:214;11159:399;;;;;;11565:470;;;11695:2;11683:9;11674:7;11670:23;11666:32;11663:2;;;11711:1;11708;11701:12;11663:2;11746:1;11763:53;11808:7;11788:9;11763:53;;;11753:63;;11725:97;11881:2;11870:9;11866:18;11853:32;11905:18;11897:6;11894:30;11891:2;;;11937:1;11934;11927:12;11891:2;11957:62;12011:7;12002:6;11991:9;11987:22;11957:62;;12042:366;;;12163:2;12151:9;12142:7;12138:23;12134:32;12131:2;;;12179:1;12176;12169:12;12131:2;12214:1;12231:53;12276:7;12256:9;12231:53;;;12221:63;;12193:97;12321:2;12339:53;12384:7;12375:6;12364:9;12360:22;12339:53;;12415:438;;12578:2;12566:9;12557:7;12553:23;12549:32;12546:2;;;12594:1;12591;12584:12;12546:2;12629:24;;12673:18;12662:30;;12659:2;;;12705:1;12702;12695:12;12659:2;12725:112;12829:7;12820:6;12809:9;12805:22;12725:112;;12860:676;;;13050:2;13038:9;13029:7;13025:23;13021:32;13018:2;;;13066:1;13063;13056:12;13018:2;13101:31;;13152:18;13141:30;;13138:2;;;13184:1;13181;13174:12;13138:2;13204:97;13293:7;13284:6;13273:9;13269:22;13204:97;;;13194:107;;13080:227;13366:2;13355:9;13351:18;13338:32;13390:18;13382:6;13379:30;13376:2;;;13422:1;13419;13412:12;13376:2;13442:78;13512:7;13503:6;13492:9;13488:22;13442:78;;13543:257;;13655:2;13643:9;13634:7;13630:23;13626:32;13623:2;;;13671:1;13668;13661:12;13623:2;13706:1;13723:61;13776:7;13756:9;13723:61;;13807:317;;13949:2;13937:9;13928:7;13924:23;13920:32;13917:2;;;13965:1;13962;13955:12;13917:2;14000:1;14017:91;14100:7;14080:9;14017:91;;14131:498;;;14275:2;14263:9;14254:7;14250:23;14246:32;14243:2;;;14291:1;14288;14281:12;14243:2;14326:31;;14377:18;14366:30;;14363:2;;;14409:1;14406;14399:12;14363:2;14429:76;14497:7;14488:6;14477:9;14473:22;14429:76;;;14419:86;;14305:206;14542:2;14560:53;14605:7;14596:6;14585:9;14581:22;14560:53;;14636:263;;14751:2;14739:9;14730:7;14726:23;14722:32;14719:2;;;14767:1;14764;14757:12;14719:2;14802:1;14819:64;14875:7;14855:9;14819:64;;14906:110;14979:31;15004:5;14979:31;;;14974:3;14967:44;14961:55;;;15090:755;;15271:77;15342:5;15271:77;;;15366:6;15361:3;15354:19;15390:4;15385:3;15381:14;15374:21;;15435:79;15508:5;15435:79;;;15535:1;15520:303;15545:6;15542:1;15539:13;15520:303;;;15585:103;15684:3;15675:6;15669:13;15585:103;;;15705:83;15781:6;15705:83;;;15811:4;15802:14;;;;;15695:93;-1:-1;15567:1;15560:9;15520:303;;;-1:-1;15836:3;;15250:595;-1:-1;;;;15250:595;15912:864;;16085:73;16152:5;16085:73;;;16176:6;16171:3;16164:19;16200:4;16195:3;16191:14;16184:21;;16248:3;16290:4;16282:6;16278:17;16273:3;16269:27;16316:75;16385:5;16316:75;;;16412:1;16397:340;16422:6;16419:1;16416:13;16397:340;;;16484:9;16478:4;16474:20;16469:3;16462:33;16510:96;16601:4;16592:6;16586:13;16510:96;;;16502:104;;16623:79;16695:6;16623:79;;;16725:4;16716:14;;;;;16613:89;-1:-1;16444:1;16437:9;16397:340;;;-1:-1;16750:4;;16064:712;-1:-1;;;;;;16064:712;16865:756;;17046:77;17117:5;17046:77;;;17141:6;17136:3;17129:19;17165:4;17160:3;17156:14;17149:21;;17210:79;17283:5;17210:79;;;17310:1;17295:304;17320:6;17317:1;17314:13;17295:304;;;17360:103;17459:3;17450:6;17444:13;17360:103;;;17480:83;17556:6;17480:83;;;17586:5;17577:15;;;;;17470:93;-1:-1;17342:1;17335:9;17295:304;;17660:590;;17795:54;17843:5;17795:54;;;17867:6;17862:3;17855:19;17891:4;17886:3;17882:14;17875:21;;17936:56;17986:5;17936:56;;;18013:1;17998:230;18023:6;18020:1;18017:13;17998:230;;;18063:53;18112:3;18103:6;18097:13;18063:53;;;18133:60;18186:6;18133:60;;;18216:4;18207:14;;;;;18123:70;-1:-1;18045:1;18038:9;17998:230;;18258:110;18331:31;18356:5;18331:31;;18375:107;18446:30;18470:5;18446:30;;18489:289;;18585:34;18613:5;18585:34;;;18636:6;18631:3;18624:19;18648:63;18704:6;18697:4;18692:3;18688:14;18681:4;18674:5;18670:16;18648:63;;;18743:29;18765:6;18743:29;;;18723:50;;;18736:4;18723:50;;18565:213;-1:-1;;;18565:213;18786:397;18941:2;18929:15;;18978:66;18973:2;18964:12;;18957:88;19079:66;19074:2;19065:12;;19058:88;19174:2;19165:12;;18922:261;19192:296;19347:2;19335:15;;19384:66;19379:2;19370:12;;19363:88;19479:2;19470:12;;19328:160;19497:397;19652:2;19640:15;;19689:66;19684:2;19675:12;;19668:88;19790:66;19785:2;19776:12;;19769:88;19885:2;19876:12;;19633:261;19903:397;20058:2;20046:15;;20095:66;20090:2;20081:12;;20074:88;20196:66;20191:2;20182:12;;20175:88;20291:2;20282:12;;20039:261;20369:695;20582:22;;20506:4;20497:14;;;20616:57;20501:3;20582:22;20616:57;;;20526:159;20766:4;20759:5;20755:16;20749:23;20784:62;20840:4;20835:3;20831:14;20818:11;20784:62;;;20695:163;20957:4;20950:5;20946:16;20940:23;20975:62;21031:4;21026:3;21022:14;21009:11;20975:62;;;20868:181;20479:585;;;;21883:2419;22098:22;;21883:2419;;22020:5;22011:15;;;22132:61;22015:3;22098:22;22132:61;;;22041:164;22289:4;22282:5;22278:16;22272:23;22307:62;22363:4;22358:3;22354:14;22341:11;22307:62;;;22215:166;22472:4;22465:5;22461:16;22455:23;22490:62;22546:4;22541:3;22537:14;22524:11;22490:62;;;22391:173;22649:4;22642:5;22638:16;22632:23;22667:62;22723:4;22718:3;22714:14;22701:11;22667:62;;;22574:167;22829:4;22822:5;22818:16;22812:23;22847:62;22903:4;22898:3;22894:14;22881:11;22847:62;;;22751:170;23009:4;23002:5;22998:16;22992:23;23027:62;23083:4;23078:3;23074:14;23061:11;23027:62;;;22931:170;23181:4;23174:5;23170:16;23164:23;23199:62;23255:4;23250:3;23246:14;23233:11;23199:62;;;23111:162;23353:4;23346:5;23342:16;23336:23;23371:62;23427:4;23422:3;23418:14;23405:11;23371:62;;;23283:162;23538:5;23531;23527:17;23521:24;23557:63;23613:5;23608:3;23604:15;23591:11;23557:63;;;23455:177;23708:5;23701;23697:17;23691:24;23727:63;23783:5;23778:3;23774:15;23761:11;23727:63;;;23642:160;23888:5;23881;23877:17;23871:24;23941:3;23935:4;23931:14;23923:5;23918:3;23914:15;23907:39;23961:66;24022:4;24009:11;23961:66;;;23953:74;;23812:227;24125:5;24118;24114:17;24108:24;24178:3;24172:4;24168:14;24160:5;24155:3;24151:15;24144:39;24198:66;24259:4;24246:11;24198:66;;;24190:74;21993:2309;-1:-1;;;;;21993:2309;26859:1589;27074:22;;26996:5;26987:15;;;27108:61;26991:3;27074:22;27108:61;;;27017:164;27267:4;27260:5;27256:16;27250:23;27285:62;27341:4;27336:3;27332:14;27319:11;27285:62;;;27191:168;27443:4;27436:5;27432:16;27426:23;27461:62;27517:4;27512:3;27508:14;27495:11;27461:62;;;27369:166;27621:4;27614:5;27610:16;27604:23;27639:62;27695:4;27690:3;27686:14;27673:11;27639:62;;;27545:168;27800:4;27793:5;27789:16;27783:23;27818:62;27874:4;27869:3;27865:14;27852:11;27818:62;;;27723:169;27981:4;27974:5;27970:16;27964:23;27999:62;28055:4;28050:3;28046:14;28033:11;27999:62;;;27902:171;28160:4;28153:5;28149:16;28143:23;28178:62;28234:4;28229:3;28225:14;28212:11;28178:62;;;28083:169;28341:4;28334:5;28330:16;28324:23;28359:62;28415:4;28410:3;28406:14;28393:11;28359:62;;30239:104;30308:29;30331:5;30308:29;;30350:193;30458:2;30443:18;;30472:61;30447:9;30506:6;30472:61;;30550:294;30686:2;30671:18;;30700:61;30675:9;30734:6;30700:61;;;30772:62;30830:2;30819:9;30815:18;30806:6;30772:62;;30851:774;31179:2;31193:47;;;31164:18;;31254:144;31164:18;31384:6;31254:144;;;31246:152;;31446:9;31440:4;31436:20;31431:2;31420:9;31416:18;31409:48;31471:144;31610:4;31601:6;31471:144;;31632:417;31828:2;31842:47;;;31813:18;;31903:136;31813:18;32025:6;31903:136;;32056:433;32260:2;32274:47;;;32245:18;;32335:144;32245:18;32465:6;32335:144;;32496:590;32732:2;32746:47;;;32717:18;;32807:98;32717:18;32891:6;32807:98;;;32799:106;;32953:9;32947:4;32943:20;32938:2;32927:9;32923:18;32916:48;32978:98;33071:4;33062:6;32978:98;;33093:189;33199:2;33184:18;;33213:59;33188:9;33245:6;33213:59;;33289:387;33470:2;33484:47;;;33455:18;;33545:121;33455:18;33545:121;;33683:387;33864:2;33878:47;;;33849:18;;33939:121;33849:18;33939:121;;34077:387;34258:2;34272:47;;;34243:18;;34333:121;34243:18;34333:121;;34471:387;34652:2;34666:47;;;34637:18;;34727:121;34637:18;34727:121;;34865:511;35109:3;35094:19;;35124:115;35098:9;35212:6;35124:115;;;35250:116;35362:2;35351:9;35347:18;35338:6;35250:116;;35383:333;35537:2;35551:47;;;35522:18;;35612:94;35522:18;35692:6;35612:94;;35723:302;35885:3;35870:19;;35900:115;35874:9;35988:6;35900:115;;36032:193;36140:2;36125:18;;36154:61;36129:9;36188:6;36154:61;;36232:294;36368:2;36353:18;;36382:61;36357:9;36416:6;36382:61;;;36454:62;36512:2;36501:9;36497:18;36488:6;36454:62;;36533:256;36595:2;36589:9;36621:17;;;36696:18;36681:34;;36717:22;;;36678:62;36675:2;;;36753:1;36750;36743:12;36675:2;36769;36762:22;36573:216;;-1:-1;36573:216;36796:258;;36955:18;36947:6;36944:30;36941:2;;;36987:1;36984;36977:12;36941:2;-1:-1;37016:4;37004:17;;;37034:15;;36878:176;37903:254;;38042:18;38034:6;38031:30;38028:2;;;38074:1;38071;38064:12;38028:2;-1:-1;38147:4;38118;38095:17;;;;38114:9;38091:33;38137:15;;37965:192;38431:144;38563:4;38551:17;;38532:43;39022:130;39135:12;;39119:33;40226:128;40306:42;40295:54;;40278:76;40361:79;40430:5;40413:27;40447:151;40526:66;40515:78;;40498:100;40691:88;40769:4;40758:16;;40741:38;40921:92;40994:13;40987:21;;40970:43;41288:145;41369:6;41364:3;41359;41346:30;-1:-1;41425:1;41407:16;;41400:27;41339:94;41442:268;41507:1;41514:101;41528:6;41525:1;41522:13;41514:101;;;41595:11;;;41589:18;41576:11;;;41569:39;41550:2;41543:10;41514:101;;;41630:6;41627:1;41624:13;41621:2;;;-1:-1;;41695:1;41677:16;;41670:27;41491:219;41718:97;41806:2;41786:14;41802:7;41782:28;;41766:49"
+ }
+ }
+ },
+ "sources": {
+ "extensions/OrderValidator/OrderValidator.sol": {
+ "id": 15
+ },
+ "protocol/Exchange/interfaces/IExchange.sol": {
+ "id": 34
+ },
+ "protocol/Exchange/interfaces/IExchangeCore.sol": {
+ "id": 35
+ },
+ "protocol/Exchange/libs/LibOrder.sol": {
+ "id": 48
+ },
+ "protocol/Exchange/libs/LibEIP712.sol": {
+ "id": 44
+ },
+ "protocol/Exchange/libs/LibFillResults.sol": {
+ "id": 46
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "protocol/Exchange/interfaces/IMatchOrders.sol": {
+ "id": 36
+ },
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": {
+ "id": 37
+ },
+ "protocol/Exchange/interfaces/ITransactions.sol": {
+ "id": 38
+ },
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": {
+ "id": 33
+ },
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": {
+ "id": 41
+ },
+ "tokens/ERC20Token/IERC20Token.sol": {
+ "id": 71
+ },
+ "tokens/ERC721Token/IERC721Token.sol": {
+ "id": 76
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ }
+ },
+ "sourceCodes": {
+ "extensions/OrderValidator/OrderValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../protocol/Exchange/interfaces/IExchange.sol\";\nimport \"../../protocol/Exchange/libs/LibOrder.sol\";\nimport \"../../tokens/ERC20Token/IERC20Token.sol\";\nimport \"../../tokens/ERC721Token/IERC721Token.sol\";\nimport \"../../utils/LibBytes/LibBytes.sol\";\n\n\ncontract OrderValidator {\n\n using LibBytes for bytes;\n\n bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256(\"ERC20Token(address)\"));\n bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256(\"ERC721Token(address,uint256)\"));\n\n struct TraderInfo {\n uint256 makerBalance; // Maker's balance of makerAsset\n uint256 makerAllowance; // Maker's allowance to corresponding AssetProxy\n uint256 takerBalance; // Taker's balance of takerAsset\n uint256 takerAllowance; // Taker's allowance to corresponding AssetProxy\n uint256 makerZrxBalance; // Maker's balance of ZRX\n uint256 makerZrxAllowance; // Maker's allowance of ZRX to ERC20Proxy\n uint256 takerZrxBalance; // Taker's balance of ZRX\n uint256 takerZrxAllowance; // Taker's allowance of ZRX to ERC20Proxy\n }\n\n // solhint-disable var-name-mixedcase\n IExchange internal EXCHANGE;\n bytes internal ZRX_ASSET_DATA;\n // solhint-enable var-name-mixedcase\n\n constructor (address _exchange, bytes memory _zrxAssetData)\n public\n {\n EXCHANGE = IExchange(_exchange);\n ZRX_ASSET_DATA = _zrxAssetData;\n }\n\n /// @dev Fetches information for order and maker/taker of order.\n /// @param order The order structure.\n /// @param takerAddress Address that will be filling the order.\n /// @return OrderInfo and TraderInfo instances for given order.\n function getOrderAndTraderInfo(LibOrder.Order memory order, address takerAddress)\n public\n view\n returns (LibOrder.OrderInfo memory orderInfo, TraderInfo memory traderInfo)\n {\n orderInfo = EXCHANGE.getOrderInfo(order);\n traderInfo = getTraderInfo(order, takerAddress);\n return (orderInfo, traderInfo);\n }\n\n /// @dev Fetches information for all passed in orders and the makers/takers of each order.\n /// @param orders Array of order specifications.\n /// @param takerAddresses Array of taker addresses corresponding to each order.\n /// @return Arrays of OrderInfo and TraderInfo instances that correspond to each order.\n function getOrdersAndTradersInfo(LibOrder.Order[] memory orders, address[] memory takerAddresses)\n public\n view\n returns (LibOrder.OrderInfo[] memory ordersInfo, TraderInfo[] memory tradersInfo)\n {\n ordersInfo = EXCHANGE.getOrdersInfo(orders);\n tradersInfo = getTradersInfo(orders, takerAddresses);\n return (ordersInfo, tradersInfo);\n }\n\n /// @dev Fetches balance and allowances for maker and taker of order.\n /// @param order The order structure.\n /// @param takerAddress Address that will be filling the order.\n /// @return Balances and allowances of maker and taker of order.\n function getTraderInfo(LibOrder.Order memory order, address takerAddress)\n public\n view\n returns (TraderInfo memory traderInfo)\n {\n (traderInfo.makerBalance, traderInfo.makerAllowance) = getBalanceAndAllowance(order.makerAddress, order.makerAssetData);\n (traderInfo.takerBalance, traderInfo.takerAllowance) = getBalanceAndAllowance(takerAddress, order.takerAssetData);\n bytes memory zrxAssetData = ZRX_ASSET_DATA;\n (traderInfo.makerZrxBalance, traderInfo.makerZrxAllowance) = getBalanceAndAllowance(order.makerAddress, zrxAssetData);\n (traderInfo.takerZrxBalance, traderInfo.takerZrxAllowance) = getBalanceAndAllowance(takerAddress, zrxAssetData);\n return traderInfo;\n }\n\n /// @dev Fetches balances and allowances of maker and taker for each provided order.\n /// @param orders Array of order specifications.\n /// @param takerAddresses Array of taker addresses corresponding to each order.\n /// @return Array of balances and allowances for maker and taker of each order.\n function getTradersInfo(LibOrder.Order[] memory orders, address[] memory takerAddresses)\n public\n view\n returns (TraderInfo[] memory)\n {\n uint256 ordersLength = orders.length;\n TraderInfo[] memory tradersInfo = new TraderInfo[](ordersLength);\n for (uint256 i = 0; i != ordersLength; i++) {\n tradersInfo[i] = getTraderInfo(orders[i], takerAddresses[i]);\n }\n return tradersInfo;\n }\n\n /// @dev Fetches token balances and allowances of an address to given assetProxy. Supports ERC20 and ERC721.\n /// @param target Address to fetch balances and allowances of.\n /// @param assetData Encoded data that can be decoded by a specified proxy contract when transferring asset.\n /// @return Balance of asset and allowance set to given proxy of asset.\n /// For ERC721 tokens, these values will always be 1 or 0.\n function getBalanceAndAllowance(address target, bytes memory assetData)\n public\n view\n returns (uint256 balance, uint256 allowance)\n {\n bytes4 assetProxyId = assetData.readBytes4(0);\n address token = assetData.readAddress(16);\n address assetProxy = EXCHANGE.getAssetProxy(assetProxyId);\n\n if (assetProxyId == ERC20_DATA_ID) {\n // Query balance\n balance = IERC20Token(token).balanceOf(target);\n\n // Query allowance\n allowance = IERC20Token(token).allowance(target, assetProxy);\n } else if (assetProxyId == ERC721_DATA_ID) {\n uint256 tokenId = assetData.readUint256(36);\n\n // Query owner of tokenId\n address owner = getERC721TokenOwner(token, tokenId);\n\n // Set balance to 1 if tokenId is owned by target\n balance = target == owner ? 1 : 0;\n\n // Check if ERC721Proxy is approved to spend tokenId\n bool isApproved = IERC721Token(token).isApprovedForAll(target, assetProxy) || IERC721Token(token).getApproved(tokenId) == assetProxy;\n \n // Set alowance to 1 if ERC721Proxy is approved to spend tokenId\n allowance = isApproved ? 1 : 0;\n } else {\n revert(\"UNSUPPORTED_ASSET_PROXY\");\n }\n return (balance, allowance);\n }\n\n /// @dev Fetches token balances and allowances of an address for each given assetProxy. Supports ERC20 and ERC721.\n /// @param target Address to fetch balances and allowances of.\n /// @param assetData Array of encoded byte arrays that can be decoded by a specified proxy contract when transferring asset.\n /// @return Balances and allowances of assets.\n /// For ERC721 tokens, these values will always be 1 or 0.\n function getBalancesAndAllowances(address target, bytes[] memory assetData)\n public\n view\n returns (uint256[] memory, uint256[] memory)\n {\n uint256 length = assetData.length;\n uint256[] memory balances = new uint256[](length);\n uint256[] memory allowances = new uint256[](length);\n for (uint256 i = 0; i != length; i++) {\n (balances[i], allowances[i]) = getBalanceAndAllowance(target, assetData[i]);\n }\n return (balances, allowances);\n }\n\n /// @dev Calls `token.ownerOf(tokenId)`, but returns a null owner instead of reverting on an unowned token.\n /// @param token Address of ERC721 token.\n /// @param tokenId The identifier for the specific NFT.\n /// @return Owner of tokenId or null address if unowned.\n function getERC721TokenOwner(address token, uint256 tokenId)\n public\n view\n returns (address owner)\n {\n assembly {\n // load free memory pointer\n let cdStart := mload(64)\n\n // bytes4(keccak256(ownerOf(uint256))) = 0x6352211e\n mstore(cdStart, 0x6352211e00000000000000000000000000000000000000000000000000000000)\n mstore(add(cdStart, 4), tokenId)\n\n // staticcall `ownerOf(tokenId)`\n // `ownerOf` will revert if tokenId is not owned\n let success := staticcall(\n gas, // forward all gas\n token, // call token contract\n cdStart, // start of calldata\n 36, // length of input is 36 bytes\n cdStart, // write output over input\n 32 // size of output is 32 bytes\n )\n\n // Success implies that tokenId is owned\n // Copy owner from return data if successful\n if success {\n owner := mload(cdStart)\n } \n }\n\n // Owner initialized to address(0), no need to modify if call is unsuccessful\n return owner;\n }\n}\n",
+ "protocol/Exchange/interfaces/IExchange.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./IExchangeCore.sol\";\nimport \"./IMatchOrders.sol\";\nimport \"./ISignatureValidator.sol\";\nimport \"./ITransactions.sol\";\nimport \"./IAssetProxyDispatcher.sol\";\nimport \"./IWrapperFunctions.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract IExchange is\n IExchangeCore,\n IMatchOrders,\n ISignatureValidator,\n ITransactions,\n IAssetProxyDispatcher,\n IWrapperFunctions\n{}\n",
+ "protocol/Exchange/interfaces/IExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IExchangeCore {\n\n /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch\n /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).\n /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.\n function cancelOrdersUpTo(uint256 targetOrderEpoch)\n external;\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev After calling, the order can not be filled anymore.\n /// @param order Order struct containing order specifications.\n function cancelOrder(LibOrder.Order memory order)\n public;\n\n /// @dev Gets information about an order: status, hash, and amount filled.\n /// @param order Order to gather information on.\n /// @return OrderInfo Information about the order and its state.\n /// See LibOrder.OrderInfo for a complete description.\n function getOrderInfo(LibOrder.Order memory order)\n public\n view\n returns (LibOrder.OrderInfo memory orderInfo);\n}\n",
+ "protocol/Exchange/libs/LibOrder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./LibEIP712.sol\";\n\n\ncontract LibOrder is\n LibEIP712\n{\n // Hash for the EIP712 Order Schema\n bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"Order(\",\n \"address makerAddress,\",\n \"address takerAddress,\",\n \"address feeRecipientAddress,\",\n \"address senderAddress,\",\n \"uint256 makerAssetAmount,\",\n \"uint256 takerAssetAmount,\",\n \"uint256 makerFee,\",\n \"uint256 takerFee,\",\n \"uint256 expirationTimeSeconds,\",\n \"uint256 salt,\",\n \"bytes makerAssetData,\",\n \"bytes takerAssetData\",\n \")\"\n ));\n\n // A valid order remains fillable until it is expired, fully filled, or cancelled.\n // An order's state is unaffected by external factors, like account balances.\n enum OrderStatus {\n INVALID, // Default value\n INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount\n INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount\n FILLABLE, // Order is fillable\n EXPIRED, // Order has already expired\n FULLY_FILLED, // Order is fully filled\n CANCELLED // Order has been cancelled\n }\n\n // solhint-disable max-line-length\n struct Order {\n address makerAddress; // Address that created the order. \n address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. \n address feeRecipientAddress; // Address that will recieve fees when order is filled. \n address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.\n uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. \n uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. \n uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.\n uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.\n uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. \n uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. \n bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.\n bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.\n }\n // solhint-enable max-line-length\n\n struct OrderInfo {\n uint8 orderStatus; // Status that describes order's validity and fillability.\n bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash).\n uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled.\n }\n\n /// @dev Calculates Keccak-256 hash of the order.\n /// @param order The order structure.\n /// @return Keccak-256 EIP712 hash of the order.\n function getOrderHash(Order memory order)\n internal\n view\n returns (bytes32 orderHash)\n {\n orderHash = hashEIP712Message(hashOrder(order));\n return orderHash;\n }\n\n /// @dev Calculates EIP712 hash of the order.\n /// @param order The order structure.\n /// @return EIP712 hash of the order.\n function hashOrder(Order memory order)\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;\n bytes32 makerAssetDataHash = keccak256(order.makerAssetData);\n bytes32 takerAssetDataHash = keccak256(order.takerAssetData);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ORDER_SCHEMA_HASH,\n // bytes32(order.makerAddress),\n // bytes32(order.takerAddress),\n // bytes32(order.feeRecipientAddress),\n // bytes32(order.senderAddress),\n // order.makerAssetAmount,\n // order.takerAssetAmount,\n // order.makerFee,\n // order.takerFee,\n // order.expirationTimeSeconds,\n // order.salt,\n // keccak256(order.makerAssetData),\n // keccak256(order.takerAssetData)\n // ));\n\n assembly {\n // Calculate memory addresses that will be swapped out before hashing\n let pos1 := sub(order, 32)\n let pos2 := add(order, 320)\n let pos3 := add(order, 352)\n\n // Backup\n let temp1 := mload(pos1)\n let temp2 := mload(pos2)\n let temp3 := mload(pos3)\n \n // Hash in place\n mstore(pos1, schemaHash)\n mstore(pos2, makerAssetDataHash)\n mstore(pos3, takerAssetDataHash)\n result := keccak256(pos1, 416)\n \n // Restore\n mstore(pos1, temp1)\n mstore(pos2, temp2)\n mstore(pos3, temp3)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibEIP712.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract LibEIP712 {\n\n // EIP191 header for EIP712 prefix\n string constant internal EIP191_HEADER = \"\\x19\\x01\";\n\n // EIP712 Domain Name value\n string constant internal EIP712_DOMAIN_NAME = \"0x Protocol\";\n\n // EIP712 Domain Version value\n string constant internal EIP712_DOMAIN_VERSION = \"2\";\n\n // Hash of the EIP712 Domain Separator Schema\n bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"address verifyingContract\",\n \")\"\n ));\n\n // Hash of the EIP712 Domain Separator data\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public EIP712_DOMAIN_HASH;\n\n constructor ()\n public\n {\n EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(\n EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,\n keccak256(bytes(EIP712_DOMAIN_NAME)),\n keccak256(bytes(EIP712_DOMAIN_VERSION)),\n bytes32(address(this))\n ));\n }\n\n /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.\n /// @param hashStruct The EIP712 hash struct.\n /// @return EIP712 hash applied to this EIP712 Domain.\n function hashEIP712Message(bytes32 hashStruct)\n internal\n view\n returns (bytes32 result)\n {\n bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;\n\n // Assembly for more efficient computing:\n // keccak256(abi.encodePacked(\n // EIP191_HEADER,\n // EIP712_DOMAIN_HASH,\n // hashStruct \n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header\n mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash\n mstore(add(memPtr, 34), hashStruct) // Hash of struct\n\n // Compute hash\n result := keccak256(memPtr, 66)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibFillResults.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibFillResults is\n SafeMath\n{\n struct FillResults {\n uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.\n uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.\n uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).\n uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).\n }\n\n struct MatchedFillResults {\n FillResults left; // Amounts filled and fees paid of left order.\n FillResults right; // Amounts filled and fees paid of right order.\n uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker.\n }\n\n /// @dev Adds properties of both FillResults instances.\n /// Modifies the first FillResults instance specified.\n /// @param totalFillResults Fill results instance that will be added onto.\n /// @param singleFillResults Fill results instance that will be added to totalFillResults.\n function addFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)\n internal\n pure\n {\n totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);\n totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);\n totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);\n totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "protocol/Exchange/interfaces/IMatchOrders.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IMatchOrders {\n\n /// @dev Match two complementary orders that have a profitable spread.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the left order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftSignature Proof that order was created by the left maker.\n /// @param rightSignature Proof that order was created by the right maker.\n /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.\n function matchOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n bytes memory leftSignature,\n bytes memory rightSignature\n )\n public\n returns (LibFillResults.MatchedFillResults memory matchedFillResults);\n}\n",
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ISignatureValidator {\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external;\n \n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external;\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address of signer.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/ITransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\n\ncontract ITransactions {\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external;\n}\n",
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IAssetProxyDispatcher {\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external;\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address);\n}\n",
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IWrapperFunctions {\n\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrKill.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrKillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrders(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrders(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously cancels multiple orders in a single transaction.\n /// @param orders Array of order specifications.\n function batchCancelOrders(LibOrder.Order[] memory orders)\n public;\n\n /// @dev Fetches information for all passed in orders\n /// @param orders Array of order specifications.\n /// @return Array of OrderInfo instances that correspond to each order.\n function getOrdersInfo(LibOrder.Order[] memory orders)\n public\n view\n returns (LibOrder.OrderInfo[] memory);\n}\n",
+ "tokens/ERC20Token/IERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC20Token {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool);\n \n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n \n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256);\n}\n",
+ "tokens/ERC721Token/IERC721Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC721Token {\n\n /// @dev This emits when ownership of any NFT changes by any mechanism.\n /// This event emits when NFTs are created (`from` == 0) and destroyed\n /// (`to` == 0). Exception: during contract creation, any number of NFTs\n /// may be created and assigned without emitting Transfer. At the time of\n /// any transfer, the approved address for that NFT (if any) is reset to none.\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 indexed _tokenId\n );\n\n /// @dev This emits when the approved address for an NFT is changed or\n /// reaffirmed. The zero address indicates there is no approved address.\n /// When a Transfer event emits, this also indicates that the approved\n /// address for that NFT (if any) is reset to none.\n event Approval(\n address indexed _owner,\n address indexed _approved,\n uint256 indexed _tokenId\n );\n\n /// @dev This emits when an operator is enabled or disabled for an owner.\n /// The operator can manage all NFTs of the owner.\n event ApprovalForAll(\n address indexed _owner,\n address indexed _operator,\n bool _approved\n );\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// perator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT. When transfer is complete, this function\n /// checks if `_to` is a smart contract (code size > 0). If so, it calls\n /// `onERC721Received` on `_to` and throws if the return value is not\n /// `bytes4(keccak256(\"onERC721Received(address,address,uint256,bytes)\"))`.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n /// @param _data Additional data with no specified format, sent in call to `_to`\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId,\n bytes _data\n )\n external;\n\n /// @notice Transfers the ownership of an NFT from one address to another address\n /// @dev This works identically to the other function with an extra data parameter,\n /// except this function just sets data to \"\".\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function safeTransferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n external;\n\n /// @notice Change or reaffirm the approved address for an NFT\n /// @dev The zero address indicates there is no approved address.\n /// Throws unless `msg.sender` is the current NFT owner, or an authorized\n /// operator of the current owner.\n /// @param _approved The new approved NFT controller\n /// @param _tokenId The NFT to approve\n function approve(address _approved, uint256 _tokenId)\n external;\n\n /// @notice Enable or disable approval for a third party (\"operator\") to manage\n /// all of `msg.sender`'s assets\n /// @dev Emits the ApprovalForAll event. The contract MUST allow\n /// multiple operators per owner.\n /// @param _operator Address to add to the set of authorized operators\n /// @param _approved True if the operator is approved, false to revoke approval\n function setApprovalForAll(address _operator, bool _approved)\n external;\n\n /// @notice Count all NFTs assigned to an owner\n /// @dev NFTs assigned to the zero address are considered invalid, and this\n /// function throws for queries about the zero address.\n /// @param _owner An address for whom to query the balance\n /// @return The number of NFTs owned by `_owner`, possibly zero\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE\n /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE\n /// THEY MAY BE PERMANENTLY LOST\n /// @dev Throws unless `msg.sender` is the current owner, an authorized\n /// operator, or the approved address for this NFT. Throws if `_from` is\n /// not the current owner. Throws if `_to` is the zero address. Throws if\n /// `_tokenId` is not a valid NFT.\n /// @param _from The current owner of the NFT\n /// @param _to The new owner\n /// @param _tokenId The NFT to transfer\n function transferFrom(\n address _from,\n address _to,\n uint256 _tokenId\n )\n public;\n\n /// @notice Find the owner of an NFT\n /// @dev NFTs assigned to zero address are considered invalid, and queries\n /// about them do throw.\n /// @param _tokenId The identifier for an NFT\n /// @return The address of the owner of the NFT\n function ownerOf(uint256 _tokenId)\n public\n view\n returns (address);\n\n /// @notice Get the approved address for a single NFT\n /// @dev Throws if `_tokenId` is not a valid NFT.\n /// @param _tokenId The NFT to find the approved address for\n /// @return The approved address for this NFT, or the zero address if there is none\n function getApproved(uint256 _tokenId) \n public\n view\n returns (address);\n \n /// @notice Query if an address is an authorized operator for another address\n /// @param _owner The address that owns the NFTs\n /// @param _operator The address that acts on behalf of the owner\n /// @return True if `_operator` is an approved operator for `_owner`, false otherwise\n function isApprovedForAll(address _owner, address _operator)\n public\n view\n returns (bool);\n}\n",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0x95729ff69e872a60a92c7eef28cea3188d821ab1a379a46c12b21fc386a9855c",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/ReentrantERC20Token.json b/packages/contracts/generated-artifacts/ReentrantERC20Token.json
new file mode 100644
index 000000000..a4e6ce0bc
--- /dev/null
+++ b/packages/contracts/generated-artifacts/ReentrantERC20Token.json
@@ -0,0 +1,307 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "ReentrantERC20Token",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_currentFunctionId",
+ "type": "uint8"
+ }
+ ],
+ "name": "setCurrentFunction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_exchange",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526003805460a060020a60ff021916905534801561002057600080fd5b506040516020806113a3833981018060405261003f9190810190610077565b60038054600160a060020a031916600160a060020a03929092169190911790556100a9565b6000610070825161009d565b9392505050565b60006020828403121561008957600080fd5b60006100958484610064565b949350505050565b600160a060020a031690565b6112eb806100b86000396000f3006080604052600436106100825763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461008757806318160ddd146100bd57806323b872dd146100df57806370a08231146100ff578063a9059cbb1461011f578063b348a4d41461013f578063dd62ed3e14610161575b600080fd5b34801561009357600080fd5b506100a76100a2366004610d39565b610181565b6040516100b49190611129565b60405180910390f35b3480156100c957600080fd5b506100d26101f9565b6040516100b4919061120f565b3480156100eb57600080fd5b506100a76100fa366004610cec565b6101ff565b34801561010b57600080fd5b506100d261011a366004610c8c565b6108b8565b34801561012b57600080fd5b506100a761013a366004610d39565b6108e0565b34801561014b57600080fd5b5061015f61015a366004610d69565b6109ff565b005b34801561016d57600080fd5b506100d261017c366004610cb2565b610a4b565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906101e790869061120f565b60405180910390a35060015b92915050565b60025490565b6000610209610bae565b60608080808080600060035474010000000000000000000000000000000000000000900460ff908116911614156102f6576040517fb4be83d500000000000000000000000000000000000000000000000000000000906102729089906000908a90602401611186565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529150610719565b60035460ff740100000000000000000000000000000000000000009091041660011415610355576040517f64a3bc1500000000000000000000000000000000000000000000000000000000906102729089906000908a90602401611186565b60035460ff7401000000000000000000000000000000000000000090910416600214156103b3576040517f297bb70b0000000000000000000000000000000000000000000000000000000090610272908790879087906024016110be565b6003805474010000000000000000000000000000000000000000900460ff16141561040f576040517f4d0ae5460000000000000000000000000000000000000000000000000000000090610272908790879087906024016110be565b60035460ff74010000000000000000000000000000000000000000909104166004141561046e576040517fe5fa431b000000000000000000000000000000000000000000000000000000009061027290879060009087906024016110f7565b60035460ff7401000000000000000000000000000000000000000090910416600514156104cd576040517f7e1d9808000000000000000000000000000000000000000000000000000000009061027290879060009087906024016110f7565b60035460ff74010000000000000000000000000000000000000000909104166006141561052d576040517f3c28d861000000000000000000000000000000000000000000000000000000009061027290899081908a9081906024016111b8565b60035460ff740100000000000000000000000000000000000000009091041660071415610587576040517fd46b02c30000000000000000000000000000000000000000000000000000000090610272908990602401611175565b60035460ff7401000000000000000000000000000000000000000090910416600814156105e1576040517f4ac1478200000000000000000000000000000000000000000000000000000000906102729087906024016110ad565b60035460ff74010000000000000000000000000000000000000000909104166009141561063c576040517f4f9559b1000000000000000000000000000000000000000000000000000000009061027290600090602401611137565b60035460ff7401000000000000000000000000000000000000000090910416600a1415610719576040517f77fcce680000000000000000000000000000000000000000000000000000000090610699906000908190602401611092565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915291505b600354604051835173ffffffffffffffffffffffffffffffffffffffff909216918491908190602084019080838360005b8381101561076257818101518382015260200161074a565b50505050905090810190601f16801561078f5780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af1505060408051606480825260a08201909252915060208201610c808038833901905050905060646000602083013e604080517f4572726f7228737472696e6729000000000000000000000000000000000000008152905190819003600d01812061089d9183919061081490602401611165565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529063ffffffff610a8316565b156108a757600080fd5b5060019a9950505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b33600090815260208190526040812054821115610932576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092990611145565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548281011015610993576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092990611155565b336000818152602081905260408082208054869003905573ffffffffffffffffffffffffffffffffffffffff861680835291819020805486019055519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906101e790869061120f565b6003805460ff90921674010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b600081518351148015610ba75750816040518082805190602001908083835b60208310610adf57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610aa2565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052604051919093018190038120885190955088945090928392508401908083835b60208310610b7457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b37565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916145b9392505050565b61018060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001606081525090565b6000610ba78235611227565b6000610ba78235611245565b6000610ba78235611248565b600060208284031215610c9e57600080fd5b6000610caa8484610c68565b949350505050565b60008060408385031215610cc557600080fd5b6000610cd18585610c68565b9250506020610ce285828601610c68565b9150509250929050565b600080600060608486031215610d0157600080fd5b6000610d0d8686610c68565b9350506020610d1e86828701610c68565b9250506040610d2f86828701610c74565b9150509250925092565b60008060408385031215610d4c57600080fd5b6000610d588585610c68565b9250506020610ce285828601610c74565b600060208284031215610d7b57600080fd5b6000610caa8484610c80565b610d9081611227565b82525050565b6000610da182611223565b80845260208401935083602082028501610dba8561121d565b60005b84811015610df1578383038852610dd5838351610eb8565b9250610de08261121d565b602098909801979150600101610dbd565b50909695505050505050565b6000610e0882611223565b80845260208401935083602082028501610e218561121d565b60005b84811015610df1578383038852610e3c838351610f86565b9250610e478261121d565b602098909801979150600101610e24565b6000610e6382611223565b808452602084019350610e758361121d565b60005b82811015610ea557610e8b868351611089565b610e948261121d565b602096909601959150600101610e78565b5093949350505050565b610d9081611240565b6000610ec382611223565b808452610ed7816020860160208601611259565b610ee081611289565b9093016020019392505050565b610d908161124e565b601a81527f45524332305f494e53554646494349454e545f42414c414e4345000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b601281527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000602082015260400190565b8051600090610180840190610f9b8582610d87565b506020830151610fae6020860182610d87565b506040830151610fc16040860182610d87565b506060830151610fd46060860182610d87565b506080830151610fe76080860182611089565b5060a0830151610ffa60a0860182611089565b5060c083015161100d60c0860182611089565b5060e083015161102060e0860182611089565b50610100830151611035610100860182611089565b5061012083015161104a610120860182611089565b506101408301518482036101408601526110648282610eb8565b9150506101608301518482036101608601526110808282610eb8565b95945050505050565b610d9081611245565b604081016110a08285610d87565b610ba76020830184610eaf565b60208082528101610ba78184610dfd565b606080825281016110cf8186610dfd565b905081810360208301526110e38185610e58565b905081810360408301526110808184610d96565b606080825281016111088186610dfd565b90506111176020830185610eed565b81810360408301526110808184610d96565b602081016101f38284610eaf565b602081016101f38284610eed565b602080825281016101f381610ef6565b602080825281016101f381610f26565b602080825281016101f381610f56565b60208082528101610ba78184610f86565b606080825281016111978186610f86565b90506111a66020830185610eed565b81810360408301526110808184610eb8565b608080825281016111c98187610f86565b905081810360208301526111dd8186610f86565b905081810360408301526111f18185610eb8565b905081810360608301526112058184610eb8565b9695505050505050565b602081016101f38284611089565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b60ff1690565b60006101f382611248565b60005b8381101561127457818101518382015260200161125c565b83811115611283576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820ad6a59a75df05d02f4fc07b1e6946ed489d4b2023352e62893eb449bb73ffc166c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x3 DUP1 SLOAD PUSH1 0xA0 PUSH1 0x2 EXP PUSH1 0xFF MUL NOT AND SWAP1 SSTORE CALLVALUE DUP1 ISZERO PUSH2 0x20 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP1 PUSH2 0x13A3 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH2 0x3F SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x77 JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH2 0xA9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x70 DUP3 MLOAD PUSH2 0x9D JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x89 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x95 DUP5 DUP5 PUSH2 0x64 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH2 0x12EB DUP1 PUSH2 0xB8 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x82 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x95EA7B3 DUP2 EQ PUSH2 0x87 JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0xBD JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0xDF JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0xFF JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x11F JUMPI DUP1 PUSH4 0xB348A4D4 EQ PUSH2 0x13F JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x161 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x93 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xA7 PUSH2 0xA2 CALLDATASIZE PUSH1 0x4 PUSH2 0xD39 JUMP JUMPDEST PUSH2 0x181 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB4 SWAP2 SWAP1 PUSH2 0x1129 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xC9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD2 PUSH2 0x1F9 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB4 SWAP2 SWAP1 PUSH2 0x120F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xA7 PUSH2 0xFA CALLDATASIZE PUSH1 0x4 PUSH2 0xCEC JUMP JUMPDEST PUSH2 0x1FF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x10B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD2 PUSH2 0x11A CALLDATASIZE PUSH1 0x4 PUSH2 0xC8C JUMP JUMPDEST PUSH2 0x8B8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x12B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xA7 PUSH2 0x13A CALLDATASIZE PUSH1 0x4 PUSH2 0xD39 JUMP JUMPDEST PUSH2 0x8E0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x14B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15F PUSH2 0x15A CALLDATASIZE PUSH1 0x4 PUSH2 0xD69 JUMP JUMPDEST PUSH2 0x9FF JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x16D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD2 PUSH2 0x17C CALLDATASIZE PUSH1 0x4 PUSH2 0xCB2 JUMP JUMPDEST PUSH2 0xA4B JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP3 MSTORE DUP1 DUP4 KECCAK256 DUP6 SWAP1 SSTORE MLOAD SWAP2 SWAP3 SWAP1 SWAP2 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP1 PUSH2 0x1E7 SWAP1 DUP7 SWAP1 PUSH2 0x120F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP PUSH1 0x1 JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x2 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x209 PUSH2 0xBAE JUMP JUMPDEST PUSH1 0x60 DUP1 DUP1 DUP1 DUP1 DUP1 PUSH1 0x0 PUSH1 0x3 SLOAD PUSH21 0x10000000000000000000000000000000000000000 SWAP1 DIV PUSH1 0xFF SWAP1 DUP2 AND SWAP2 AND EQ ISZERO PUSH2 0x2F6 JUMPI PUSH1 0x40 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP10 SWAP1 PUSH1 0x0 SWAP1 DUP11 SWAP1 PUSH1 0x24 ADD PUSH2 0x1186 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP2 POP PUSH2 0x719 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x1 EQ ISZERO PUSH2 0x355 JUMPI PUSH1 0x40 MLOAD PUSH32 0x64A3BC1500000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP10 SWAP1 PUSH1 0x0 SWAP1 DUP11 SWAP1 PUSH1 0x24 ADD PUSH2 0x1186 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x2 EQ ISZERO PUSH2 0x3B3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x297BB70B00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP8 SWAP1 DUP8 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x10BE JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH21 0x10000000000000000000000000000000000000000 SWAP1 DIV PUSH1 0xFF AND EQ ISZERO PUSH2 0x40F JUMPI PUSH1 0x40 MLOAD PUSH32 0x4D0AE54600000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP8 SWAP1 DUP8 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x10BE JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x4 EQ ISZERO PUSH2 0x46E JUMPI PUSH1 0x40 MLOAD PUSH32 0xE5FA431B00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP8 SWAP1 PUSH1 0x0 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x10F7 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x5 EQ ISZERO PUSH2 0x4CD JUMPI PUSH1 0x40 MLOAD PUSH32 0x7E1D980800000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP8 SWAP1 PUSH1 0x0 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x10F7 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x6 EQ ISZERO PUSH2 0x52D JUMPI PUSH1 0x40 MLOAD PUSH32 0x3C28D86100000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP10 SWAP1 DUP2 SWAP1 DUP11 SWAP1 DUP2 SWAP1 PUSH1 0x24 ADD PUSH2 0x11B8 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x7 EQ ISZERO PUSH2 0x587 JUMPI PUSH1 0x40 MLOAD PUSH32 0xD46B02C300000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP10 SWAP1 PUSH1 0x24 ADD PUSH2 0x1175 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x8 EQ ISZERO PUSH2 0x5E1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x4AC1478200000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x10AD JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x9 EQ ISZERO PUSH2 0x63C JUMPI PUSH1 0x40 MLOAD PUSH32 0x4F9559B100000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 PUSH1 0x0 SWAP1 PUSH1 0x24 ADD PUSH2 0x1137 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0xA EQ ISZERO PUSH2 0x719 JUMPI PUSH1 0x40 MLOAD PUSH32 0x77FCCE6800000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x699 SWAP1 PUSH1 0x0 SWAP1 DUP2 SWAP1 PUSH1 0x24 ADD PUSH2 0x1092 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP2 POP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x40 MLOAD DUP4 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP5 SWAP2 SWAP1 DUP2 SWAP1 PUSH1 0x20 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x762 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x74A JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x78F JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP2 POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP7 GAS CALL POP POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x64 DUP1 DUP3 MSTORE PUSH1 0xA0 DUP3 ADD SWAP1 SWAP3 MSTORE SWAP2 POP PUSH1 0x20 DUP3 ADD PUSH2 0xC80 DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP POP SWAP1 POP PUSH1 0x64 PUSH1 0x0 PUSH1 0x20 DUP4 ADD RETURNDATACOPY PUSH1 0x40 DUP1 MLOAD PUSH32 0x4572726F7228737472696E672900000000000000000000000000000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0xD ADD DUP2 KECCAK256 PUSH2 0x89D SWAP2 DUP4 SWAP2 SWAP1 PUSH2 0x814 SWAP1 PUSH1 0x24 ADD PUSH2 0x1165 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP1 PUSH4 0xFFFFFFFF PUSH2 0xA83 AND JUMP JUMPDEST ISZERO PUSH2 0x8A7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x1 SWAP11 SWAP10 POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x932 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x929 SWAP1 PUSH2 0x1145 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x993 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x929 SWAP1 PUSH2 0x1155 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD DUP7 SWAP1 SUB SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND DUP1 DUP4 MSTORE SWAP2 DUP2 SWAP1 KECCAK256 DUP1 SLOAD DUP7 ADD SWAP1 SSTORE MLOAD SWAP1 SWAP2 SWAP1 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP1 PUSH2 0x1E7 SWAP1 DUP7 SWAP1 PUSH2 0x120F JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH1 0xFF SWAP1 SWAP3 AND PUSH21 0x10000000000000000000000000000000000000000 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD DUP4 MLOAD EQ DUP1 ISZERO PUSH2 0xBA7 JUMPI POP DUP2 PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xADF JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xAA2 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP9 MLOAD SWAP1 SWAP6 POP DUP9 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xB74 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xB37 JUMP JUMPDEST PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP3 MLOAD AND DUP2 DUP5 MLOAD AND DUP1 DUP3 OR DUP6 MSTORE POP POP POP POP POP POP SWAP1 POP ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 PUSH1 0x0 NOT AND EQ JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x180 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xBA7 DUP3 CALLDATALOAD PUSH2 0x1227 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xBA7 DUP3 CALLDATALOAD PUSH2 0x1245 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xBA7 DUP3 CALLDATALOAD PUSH2 0x1248 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xC9E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xCAA DUP5 DUP5 PUSH2 0xC68 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xCC5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xCD1 DUP6 DUP6 PUSH2 0xC68 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xCE2 DUP6 DUP3 DUP7 ADD PUSH2 0xC68 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0xD01 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xD0D DUP7 DUP7 PUSH2 0xC68 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0xD1E DUP7 DUP3 DUP8 ADD PUSH2 0xC68 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0xD2F DUP7 DUP3 DUP8 ADD PUSH2 0xC74 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xD4C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xD58 DUP6 DUP6 PUSH2 0xC68 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xCE2 DUP6 DUP3 DUP7 ADD PUSH2 0xC74 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xD7B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xCAA DUP5 DUP5 PUSH2 0xC80 JUMP JUMPDEST PUSH2 0xD90 DUP2 PUSH2 0x1227 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xDA1 DUP3 PUSH2 0x1223 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP DUP4 PUSH1 0x20 DUP3 MUL DUP6 ADD PUSH2 0xDBA DUP6 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP5 DUP2 LT ISZERO PUSH2 0xDF1 JUMPI DUP4 DUP4 SUB DUP9 MSTORE PUSH2 0xDD5 DUP4 DUP4 MLOAD PUSH2 0xEB8 JUMP JUMPDEST SWAP3 POP PUSH2 0xDE0 DUP3 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x20 SWAP9 SWAP1 SWAP9 ADD SWAP8 SWAP2 POP PUSH1 0x1 ADD PUSH2 0xDBD JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE08 DUP3 PUSH2 0x1223 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP DUP4 PUSH1 0x20 DUP3 MUL DUP6 ADD PUSH2 0xE21 DUP6 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP5 DUP2 LT ISZERO PUSH2 0xDF1 JUMPI DUP4 DUP4 SUB DUP9 MSTORE PUSH2 0xE3C DUP4 DUP4 MLOAD PUSH2 0xF86 JUMP JUMPDEST SWAP3 POP PUSH2 0xE47 DUP3 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x20 SWAP9 SWAP1 SWAP9 ADD SWAP8 SWAP2 POP PUSH1 0x1 ADD PUSH2 0xE24 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE63 DUP3 PUSH2 0x1223 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0xE75 DUP4 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0xEA5 JUMPI PUSH2 0xE8B DUP7 DUP4 MLOAD PUSH2 0x1089 JUMP JUMPDEST PUSH2 0xE94 DUP3 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x20 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0xE78 JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0xD90 DUP2 PUSH2 0x1240 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xEC3 DUP3 PUSH2 0x1223 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0xED7 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x1259 JUMP JUMPDEST PUSH2 0xEE0 DUP2 PUSH2 0x1289 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0xD90 DUP2 PUSH2 0x124E JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x5245454E5452414E43595F494C4C4547414C0000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0xF9B DUP6 DUP3 PUSH2 0xD87 JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0xFAE PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0xD87 JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0xFC1 PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0xD87 JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0xFD4 PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0xD87 JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0xFE7 PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0xFFA PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x100D PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0x1020 PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0x1035 PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0x104A PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0x1064 DUP3 DUP3 PUSH2 0xEB8 JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0x1080 DUP3 DUP3 PUSH2 0xEB8 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0xD90 DUP2 PUSH2 0x1245 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x10A0 DUP3 DUP6 PUSH2 0xD87 JUMP JUMPDEST PUSH2 0xBA7 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0xEAF JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xBA7 DUP2 DUP5 PUSH2 0xDFD JUMP JUMPDEST PUSH1 0x60 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x10CF DUP2 DUP7 PUSH2 0xDFD JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x10E3 DUP2 DUP6 PUSH2 0xE58 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1080 DUP2 DUP5 PUSH2 0xD96 JUMP JUMPDEST PUSH1 0x60 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1108 DUP2 DUP7 PUSH2 0xDFD JUMP JUMPDEST SWAP1 POP PUSH2 0x1117 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0xEED JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1080 DUP2 DUP5 PUSH2 0xD96 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x1F3 DUP3 DUP5 PUSH2 0xEAF JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x1F3 DUP3 DUP5 PUSH2 0xEED JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1F3 DUP2 PUSH2 0xEF6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1F3 DUP2 PUSH2 0xF26 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1F3 DUP2 PUSH2 0xF56 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xBA7 DUP2 DUP5 PUSH2 0xF86 JUMP JUMPDEST PUSH1 0x60 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1197 DUP2 DUP7 PUSH2 0xF86 JUMP JUMPDEST SWAP1 POP PUSH2 0x11A6 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0xEED JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1080 DUP2 DUP5 PUSH2 0xEB8 JUMP JUMPDEST PUSH1 0x80 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x11C9 DUP2 DUP8 PUSH2 0xF86 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x11DD DUP2 DUP7 PUSH2 0xF86 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x11F1 DUP2 DUP6 PUSH2 0xEB8 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0x1205 DUP2 DUP5 PUSH2 0xEB8 JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x1F3 DUP3 DUP5 PUSH2 0x1089 JUMP JUMPDEST PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1F3 DUP3 PUSH2 0x1248 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1274 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x125C JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x1283 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 0xad PUSH11 0x59A75DF05D02F4FC07B1E6 SWAP5 PUSH15 0xD489D4B2023352E62893EB449BB73F 0xfc AND PUSH13 0x6578706572696D656E74616CF5 STOP CALLDATACOPY ",
+ "sourceMap": "879:5654:61:-;;;1740:36;;;-1:-1:-1;;;;;;1740:36:61;;;1783:99;5:2:-1;;;;30:1;27;20:12;5:2;1783:99:61;;;;;;;;;;;;;;;;;;;;;;1844:8;:31;;-1:-1:-1;;;;;;1844:31:61;-1:-1:-1;;;;;1844:31:61;;;;;;;;;;879:5654;;5:122:-1;;83:39;114:6;108:13;83:39;;;74:48;68:59;-1:-1;;;68:59;134:263;;249:2;237:9;228:7;224:23;220:32;217:2;;;265:1;262;255:12;217:2;300:1;317:64;373:7;353:9;317:64;;;307:74;211:186;-1:-1;;;;211:186;404:128;-1:-1;;;;;473:54;;456:76;;879:5654:61;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100825763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461008757806318160ddd146100bd57806323b872dd146100df57806370a08231146100ff578063a9059cbb1461011f578063b348a4d41461013f578063dd62ed3e14610161575b600080fd5b34801561009357600080fd5b506100a76100a2366004610d39565b610181565b6040516100b49190611129565b60405180910390f35b3480156100c957600080fd5b506100d26101f9565b6040516100b4919061120f565b3480156100eb57600080fd5b506100a76100fa366004610cec565b6101ff565b34801561010b57600080fd5b506100d261011a366004610c8c565b6108b8565b34801561012b57600080fd5b506100a761013a366004610d39565b6108e0565b34801561014b57600080fd5b5061015f61015a366004610d69565b6109ff565b005b34801561016d57600080fd5b506100d261017c366004610cb2565b610a4b565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906101e790869061120f565b60405180910390a35060015b92915050565b60025490565b6000610209610bae565b60608080808080600060035474010000000000000000000000000000000000000000900460ff908116911614156102f6576040517fb4be83d500000000000000000000000000000000000000000000000000000000906102729089906000908a90602401611186565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529150610719565b60035460ff740100000000000000000000000000000000000000009091041660011415610355576040517f64a3bc1500000000000000000000000000000000000000000000000000000000906102729089906000908a90602401611186565b60035460ff7401000000000000000000000000000000000000000090910416600214156103b3576040517f297bb70b0000000000000000000000000000000000000000000000000000000090610272908790879087906024016110be565b6003805474010000000000000000000000000000000000000000900460ff16141561040f576040517f4d0ae5460000000000000000000000000000000000000000000000000000000090610272908790879087906024016110be565b60035460ff74010000000000000000000000000000000000000000909104166004141561046e576040517fe5fa431b000000000000000000000000000000000000000000000000000000009061027290879060009087906024016110f7565b60035460ff7401000000000000000000000000000000000000000090910416600514156104cd576040517f7e1d9808000000000000000000000000000000000000000000000000000000009061027290879060009087906024016110f7565b60035460ff74010000000000000000000000000000000000000000909104166006141561052d576040517f3c28d861000000000000000000000000000000000000000000000000000000009061027290899081908a9081906024016111b8565b60035460ff740100000000000000000000000000000000000000009091041660071415610587576040517fd46b02c30000000000000000000000000000000000000000000000000000000090610272908990602401611175565b60035460ff7401000000000000000000000000000000000000000090910416600814156105e1576040517f4ac1478200000000000000000000000000000000000000000000000000000000906102729087906024016110ad565b60035460ff74010000000000000000000000000000000000000000909104166009141561063c576040517f4f9559b1000000000000000000000000000000000000000000000000000000009061027290600090602401611137565b60035460ff7401000000000000000000000000000000000000000090910416600a1415610719576040517f77fcce680000000000000000000000000000000000000000000000000000000090610699906000908190602401611092565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915291505b600354604051835173ffffffffffffffffffffffffffffffffffffffff909216918491908190602084019080838360005b8381101561076257818101518382015260200161074a565b50505050905090810190601f16801561078f5780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af1505060408051606480825260a08201909252915060208201610c808038833901905050905060646000602083013e604080517f4572726f7228737472696e6729000000000000000000000000000000000000008152905190819003600d01812061089d9183919061081490602401611165565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529063ffffffff610a8316565b156108a757600080fd5b5060019a9950505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b33600090815260208190526040812054821115610932576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092990611145565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020548281011015610993576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092990611155565b336000818152602081905260408082208054869003905573ffffffffffffffffffffffffffffffffffffffff861680835291819020805486019055519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906101e790869061120f565b6003805460ff90921674010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b600081518351148015610ba75750816040518082805190602001908083835b60208310610adf57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610aa2565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052604051919093018190038120885190955088945090928392508401908083835b60208310610b7457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b37565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916145b9392505050565b61018060405190810160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160608152602001606081525090565b6000610ba78235611227565b6000610ba78235611245565b6000610ba78235611248565b600060208284031215610c9e57600080fd5b6000610caa8484610c68565b949350505050565b60008060408385031215610cc557600080fd5b6000610cd18585610c68565b9250506020610ce285828601610c68565b9150509250929050565b600080600060608486031215610d0157600080fd5b6000610d0d8686610c68565b9350506020610d1e86828701610c68565b9250506040610d2f86828701610c74565b9150509250925092565b60008060408385031215610d4c57600080fd5b6000610d588585610c68565b9250506020610ce285828601610c74565b600060208284031215610d7b57600080fd5b6000610caa8484610c80565b610d9081611227565b82525050565b6000610da182611223565b80845260208401935083602082028501610dba8561121d565b60005b84811015610df1578383038852610dd5838351610eb8565b9250610de08261121d565b602098909801979150600101610dbd565b50909695505050505050565b6000610e0882611223565b80845260208401935083602082028501610e218561121d565b60005b84811015610df1578383038852610e3c838351610f86565b9250610e478261121d565b602098909801979150600101610e24565b6000610e6382611223565b808452602084019350610e758361121d565b60005b82811015610ea557610e8b868351611089565b610e948261121d565b602096909601959150600101610e78565b5093949350505050565b610d9081611240565b6000610ec382611223565b808452610ed7816020860160208601611259565b610ee081611289565b9093016020019392505050565b610d908161124e565b601a81527f45524332305f494e53554646494349454e545f42414c414e4345000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b601281527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000602082015260400190565b8051600090610180840190610f9b8582610d87565b506020830151610fae6020860182610d87565b506040830151610fc16040860182610d87565b506060830151610fd46060860182610d87565b506080830151610fe76080860182611089565b5060a0830151610ffa60a0860182611089565b5060c083015161100d60c0860182611089565b5060e083015161102060e0860182611089565b50610100830151611035610100860182611089565b5061012083015161104a610120860182611089565b506101408301518482036101408601526110648282610eb8565b9150506101608301518482036101608601526110808282610eb8565b95945050505050565b610d9081611245565b604081016110a08285610d87565b610ba76020830184610eaf565b60208082528101610ba78184610dfd565b606080825281016110cf8186610dfd565b905081810360208301526110e38185610e58565b905081810360408301526110808184610d96565b606080825281016111088186610dfd565b90506111176020830185610eed565b81810360408301526110808184610d96565b602081016101f38284610eaf565b602081016101f38284610eed565b602080825281016101f381610ef6565b602080825281016101f381610f26565b602080825281016101f381610f56565b60208082528101610ba78184610f86565b606080825281016111978186610f86565b90506111a66020830185610eed565b81810360408301526110808184610eb8565b608080825281016111c98187610f86565b905081810360208301526111dd8186610f86565b905081810360408301526111f18185610eb8565b905081810360608301526112058184610eb8565b9695505050505050565b602081016101f38284611089565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b60ff1690565b60006101f382611248565b60005b8381101561127457818101518382015260200161125c565b83811115611283576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820ad6a59a75df05d02f4fc07b1e6946ed489d4b2023352e62893eb449bb73ffc166c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x82 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x95EA7B3 DUP2 EQ PUSH2 0x87 JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0xBD JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0xDF JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0xFF JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x11F JUMPI DUP1 PUSH4 0xB348A4D4 EQ PUSH2 0x13F JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x161 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x93 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xA7 PUSH2 0xA2 CALLDATASIZE PUSH1 0x4 PUSH2 0xD39 JUMP JUMPDEST PUSH2 0x181 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB4 SWAP2 SWAP1 PUSH2 0x1129 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xC9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD2 PUSH2 0x1F9 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xB4 SWAP2 SWAP1 PUSH2 0x120F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xA7 PUSH2 0xFA CALLDATASIZE PUSH1 0x4 PUSH2 0xCEC JUMP JUMPDEST PUSH2 0x1FF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x10B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD2 PUSH2 0x11A CALLDATASIZE PUSH1 0x4 PUSH2 0xC8C JUMP JUMPDEST PUSH2 0x8B8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x12B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xA7 PUSH2 0x13A CALLDATASIZE PUSH1 0x4 PUSH2 0xD39 JUMP JUMPDEST PUSH2 0x8E0 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x14B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15F PUSH2 0x15A CALLDATASIZE PUSH1 0x4 PUSH2 0xD69 JUMP JUMPDEST PUSH2 0x9FF JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x16D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD2 PUSH2 0x17C CALLDATASIZE PUSH1 0x4 PUSH2 0xCB2 JUMP JUMPDEST PUSH2 0xA4B JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP3 MSTORE DUP1 DUP4 KECCAK256 DUP6 SWAP1 SSTORE MLOAD SWAP2 SWAP3 SWAP1 SWAP2 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP1 PUSH2 0x1E7 SWAP1 DUP7 SWAP1 PUSH2 0x120F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP PUSH1 0x1 JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x2 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x209 PUSH2 0xBAE JUMP JUMPDEST PUSH1 0x60 DUP1 DUP1 DUP1 DUP1 DUP1 PUSH1 0x0 PUSH1 0x3 SLOAD PUSH21 0x10000000000000000000000000000000000000000 SWAP1 DIV PUSH1 0xFF SWAP1 DUP2 AND SWAP2 AND EQ ISZERO PUSH2 0x2F6 JUMPI PUSH1 0x40 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP10 SWAP1 PUSH1 0x0 SWAP1 DUP11 SWAP1 PUSH1 0x24 ADD PUSH2 0x1186 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP2 POP PUSH2 0x719 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x1 EQ ISZERO PUSH2 0x355 JUMPI PUSH1 0x40 MLOAD PUSH32 0x64A3BC1500000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP10 SWAP1 PUSH1 0x0 SWAP1 DUP11 SWAP1 PUSH1 0x24 ADD PUSH2 0x1186 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x2 EQ ISZERO PUSH2 0x3B3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x297BB70B00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP8 SWAP1 DUP8 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x10BE JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH21 0x10000000000000000000000000000000000000000 SWAP1 DIV PUSH1 0xFF AND EQ ISZERO PUSH2 0x40F JUMPI PUSH1 0x40 MLOAD PUSH32 0x4D0AE54600000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP8 SWAP1 DUP8 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x10BE JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x4 EQ ISZERO PUSH2 0x46E JUMPI PUSH1 0x40 MLOAD PUSH32 0xE5FA431B00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP8 SWAP1 PUSH1 0x0 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x10F7 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x5 EQ ISZERO PUSH2 0x4CD JUMPI PUSH1 0x40 MLOAD PUSH32 0x7E1D980800000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP8 SWAP1 PUSH1 0x0 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x10F7 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x6 EQ ISZERO PUSH2 0x52D JUMPI PUSH1 0x40 MLOAD PUSH32 0x3C28D86100000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP10 SWAP1 DUP2 SWAP1 DUP11 SWAP1 DUP2 SWAP1 PUSH1 0x24 ADD PUSH2 0x11B8 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x7 EQ ISZERO PUSH2 0x587 JUMPI PUSH1 0x40 MLOAD PUSH32 0xD46B02C300000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP10 SWAP1 PUSH1 0x24 ADD PUSH2 0x1175 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x8 EQ ISZERO PUSH2 0x5E1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x4AC1478200000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x10AD JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0x9 EQ ISZERO PUSH2 0x63C JUMPI PUSH1 0x40 MLOAD PUSH32 0x4F9559B100000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x272 SWAP1 PUSH1 0x0 SWAP1 PUSH1 0x24 ADD PUSH2 0x1137 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0xFF PUSH21 0x10000000000000000000000000000000000000000 SWAP1 SWAP2 DIV AND PUSH1 0xA EQ ISZERO PUSH2 0x719 JUMPI PUSH1 0x40 MLOAD PUSH32 0x77FCCE6800000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x699 SWAP1 PUSH1 0x0 SWAP1 DUP2 SWAP1 PUSH1 0x24 ADD PUSH2 0x1092 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP2 POP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x40 MLOAD DUP4 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP5 SWAP2 SWAP1 DUP2 SWAP1 PUSH1 0x20 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x762 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x74A JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x78F JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP2 POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP7 GAS CALL POP POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x64 DUP1 DUP3 MSTORE PUSH1 0xA0 DUP3 ADD SWAP1 SWAP3 MSTORE SWAP2 POP PUSH1 0x20 DUP3 ADD PUSH2 0xC80 DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP POP SWAP1 POP PUSH1 0x64 PUSH1 0x0 PUSH1 0x20 DUP4 ADD RETURNDATACOPY PUSH1 0x40 DUP1 MLOAD PUSH32 0x4572726F7228737472696E672900000000000000000000000000000000000000 DUP2 MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0xD ADD DUP2 KECCAK256 PUSH2 0x89D SWAP2 DUP4 SWAP2 SWAP1 PUSH2 0x814 SWAP1 PUSH1 0x24 ADD PUSH2 0x1165 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP1 PUSH4 0xFFFFFFFF PUSH2 0xA83 AND JUMP JUMPDEST ISZERO PUSH2 0x8A7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x1 SWAP11 SWAP10 POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x932 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x929 SWAP1 PUSH2 0x1145 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 DUP2 ADD LT ISZERO PUSH2 0x993 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x929 SWAP1 PUSH2 0x1155 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD DUP7 SWAP1 SUB SWAP1 SSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND DUP1 DUP4 MSTORE SWAP2 DUP2 SWAP1 KECCAK256 DUP1 SLOAD DUP7 ADD SWAP1 SSTORE MLOAD SWAP1 SWAP2 SWAP1 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP1 PUSH2 0x1E7 SWAP1 DUP7 SWAP1 PUSH2 0x120F JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH1 0xFF SWAP1 SWAP3 AND PUSH21 0x10000000000000000000000000000000000000000 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 SWAP1 SWAP5 AND DUP3 MSTORE SWAP2 SWAP1 SWAP2 MSTORE KECCAK256 SLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD DUP4 MLOAD EQ DUP1 ISZERO PUSH2 0xBA7 JUMPI POP DUP2 PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xADF JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xAA2 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP9 MLOAD SWAP1 SWAP6 POP DUP9 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xB74 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xB37 JUMP JUMPDEST PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP3 MLOAD AND DUP2 DUP5 MLOAD AND DUP1 DUP3 OR DUP6 MSTORE POP POP POP POP POP POP SWAP1 POP ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 PUSH1 0x0 NOT AND EQ JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x180 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xBA7 DUP3 CALLDATALOAD PUSH2 0x1227 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xBA7 DUP3 CALLDATALOAD PUSH2 0x1245 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xBA7 DUP3 CALLDATALOAD PUSH2 0x1248 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xC9E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xCAA DUP5 DUP5 PUSH2 0xC68 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xCC5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xCD1 DUP6 DUP6 PUSH2 0xC68 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xCE2 DUP6 DUP3 DUP7 ADD PUSH2 0xC68 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0xD01 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xD0D DUP7 DUP7 PUSH2 0xC68 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0xD1E DUP7 DUP3 DUP8 ADD PUSH2 0xC68 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0xD2F DUP7 DUP3 DUP8 ADD PUSH2 0xC74 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xD4C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xD58 DUP6 DUP6 PUSH2 0xC68 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0xCE2 DUP6 DUP3 DUP7 ADD PUSH2 0xC74 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xD7B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xCAA DUP5 DUP5 PUSH2 0xC80 JUMP JUMPDEST PUSH2 0xD90 DUP2 PUSH2 0x1227 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xDA1 DUP3 PUSH2 0x1223 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP DUP4 PUSH1 0x20 DUP3 MUL DUP6 ADD PUSH2 0xDBA DUP6 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP5 DUP2 LT ISZERO PUSH2 0xDF1 JUMPI DUP4 DUP4 SUB DUP9 MSTORE PUSH2 0xDD5 DUP4 DUP4 MLOAD PUSH2 0xEB8 JUMP JUMPDEST SWAP3 POP PUSH2 0xDE0 DUP3 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x20 SWAP9 SWAP1 SWAP9 ADD SWAP8 SWAP2 POP PUSH1 0x1 ADD PUSH2 0xDBD JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE08 DUP3 PUSH2 0x1223 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP DUP4 PUSH1 0x20 DUP3 MUL DUP6 ADD PUSH2 0xE21 DUP6 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP5 DUP2 LT ISZERO PUSH2 0xDF1 JUMPI DUP4 DUP4 SUB DUP9 MSTORE PUSH2 0xE3C DUP4 DUP4 MLOAD PUSH2 0xF86 JUMP JUMPDEST SWAP3 POP PUSH2 0xE47 DUP3 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x20 SWAP9 SWAP1 SWAP9 ADD SWAP8 SWAP2 POP PUSH1 0x1 ADD PUSH2 0xE24 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xE63 DUP3 PUSH2 0x1223 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0xE75 DUP4 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0xEA5 JUMPI PUSH2 0xE8B DUP7 DUP4 MLOAD PUSH2 0x1089 JUMP JUMPDEST PUSH2 0xE94 DUP3 PUSH2 0x121D JUMP JUMPDEST PUSH1 0x20 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0xE78 JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0xD90 DUP2 PUSH2 0x1240 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xEC3 DUP3 PUSH2 0x1223 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0xED7 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x1259 JUMP JUMPDEST PUSH2 0xEE0 DUP2 PUSH2 0x1289 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0xD90 DUP2 PUSH2 0x124E JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x45524332305F494E53554646494349454E545F42414C414E4345000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x5245454E5452414E43595F494C4C4547414C0000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0xF9B DUP6 DUP3 PUSH2 0xD87 JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0xFAE PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0xD87 JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0xFC1 PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0xD87 JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0xFD4 PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0xD87 JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0xFE7 PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0xFFA PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x100D PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0x1020 PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0x1035 PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0x104A PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0x1089 JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0x1064 DUP3 DUP3 PUSH2 0xEB8 JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0x1080 DUP3 DUP3 PUSH2 0xEB8 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0xD90 DUP2 PUSH2 0x1245 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x10A0 DUP3 DUP6 PUSH2 0xD87 JUMP JUMPDEST PUSH2 0xBA7 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0xEAF JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xBA7 DUP2 DUP5 PUSH2 0xDFD JUMP JUMPDEST PUSH1 0x60 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x10CF DUP2 DUP7 PUSH2 0xDFD JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x10E3 DUP2 DUP6 PUSH2 0xE58 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1080 DUP2 DUP5 PUSH2 0xD96 JUMP JUMPDEST PUSH1 0x60 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1108 DUP2 DUP7 PUSH2 0xDFD JUMP JUMPDEST SWAP1 POP PUSH2 0x1117 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0xEED JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1080 DUP2 DUP5 PUSH2 0xD96 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x1F3 DUP3 DUP5 PUSH2 0xEAF JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x1F3 DUP3 DUP5 PUSH2 0xEED JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1F3 DUP2 PUSH2 0xEF6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1F3 DUP2 PUSH2 0xF26 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1F3 DUP2 PUSH2 0xF56 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xBA7 DUP2 DUP5 PUSH2 0xF86 JUMP JUMPDEST PUSH1 0x60 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1197 DUP2 DUP7 PUSH2 0xF86 JUMP JUMPDEST SWAP1 POP PUSH2 0x11A6 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0xEED JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x1080 DUP2 DUP5 PUSH2 0xEB8 JUMP JUMPDEST PUSH1 0x80 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x11C9 DUP2 DUP8 PUSH2 0xF86 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x11DD DUP2 DUP7 PUSH2 0xF86 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x11F1 DUP2 DUP6 PUSH2 0xEB8 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0x1205 DUP2 DUP5 PUSH2 0xEB8 JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x1F3 DUP3 DUP5 PUSH2 0x1089 JUMP JUMPDEST PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1F3 DUP3 PUSH2 0x1248 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1274 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x125C JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x1283 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 0xad PUSH11 0x59A75DF05D02F4FC07B1E6 SWAP5 PUSH15 0xD489D4B2023352E62893EB449BB73F 0xfc AND PUSH13 0x6578706572696D656E74616CF5 STOP CALLDATACOPY ",
+ "sourceMap": "879:5654:61:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2896:270:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2896:270:70;;;;;;;;;;;;;;;;;;;;;;;;;3251:119;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3251:119:70;;;;;;;;;;;;2429:4102:61;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2429:4102:61;;;;;;;;;3524:135:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3524:135:70;;;;;;;;;1055:514;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1055:514:70;;;;;;;;;2049:130:61;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2049:130:61;;;;;;;;;;;3867:162:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3867:162:70;;;;;;;;;2896:270;3009:10;2981:4;3001:19;;;:7;:19;;;;;;;;;:29;;;;;;;;;;:38;;;3054:84;2981:4;;3001:29;;3054:84;;;;3033:6;;3054:84;;;;;;;;;;-1:-1:-1;3155:4:70;2896:270;;;;;:::o;3251:119::-;3351:12;;3251:119;:::o;2429:4102:61:-;2559:4;2777:27;;:::i;:::-;2863:22;;;;;;3159:27;3132:17;;;;;:55;:17;;;:55;;;3128:2862;;;3214:150;;3254:27;;3214:150;;3299:5;;3254:8;;3341:9;;3214:150;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;3214:150:61;;;49:4:-1;25:18;;61:17;;3214:150:61;182:15:-1;3214:150:61;;;;179:29:-1;;;;160:49;;;3214:150:61;-1:-1:-1;3128:2862:61;;;3385:17;;:63;:17;;;;;3412:35;3385:63;3381:2609;;;3475:156;;3515:33;;3475:156;;3566:5;;3515:8;;3608:9;;3475:156;;;;3381:2609;3652:17;;:62;:17;;;;;3679:34;3652:62;3648:2342;;;3741:178;;3781:33;;3741:178;;3832:6;;3856:21;;3895:10;;3741:178;;;;3648:2342;3967:42;3940:17;;;;;:70;:17;:70;3936:2054;;;4037:184;;4077:39;;4037:184;;4134:6;;4158:21;;4197:10;;4037:184;;;;3936:2054;4242:17;;:62;:17;;;;;4269:34;4242:62;4238:1752;;;4331:158;;4371:33;;4331:158;;4422:6;;4371:8;;4465:10;;4331:158;;;;4238:1752;4510:17;;:63;:17;;;;;4537:35;4510:63;4506:1484;;;4600:159;;4640:34;;4600:159;;4692:6;;4640:8;;4735:10;;4600:159;;;;4506:1484;4780:17;;:57;:17;;;;;4807:29;4780:57;4776:1214;;;4864:183;;4904:29;;4864:183;;4951:5;;;;4997:9;;;;4864:183;;;;4776:1214;5068:17;;:57;:17;;;;;5095:29;5068:57;5064:926;;;5152:106;;5192:29;;5152:106;;5239:5;;5152:106;;;;5064:926;5279:17;;:64;:17;;;;;5306:36;5279:64;5275:715;;;5370:113;;5410:35;;5370:113;;5463:6;;5370:113;;;;5275:715;5504:17;;:64;:17;;;;;5531:36;5504:64;5500:490;;;5595:107;;5635:34;;5595:107;;5635:8;;5595:107;;;;5500:490;5723:17;;:77;:17;;;;;5750:49;5723:77;5719:271;;;5827:152;;5867:47;;5827:152;;5867:8;;;;5827:152;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;5827:152:61;;;49:4:-1;25:18;;61:17;;5827:152:61;182:15:-1;5827:152:61;;;;179:29:-1;;;;160:49;;;5827:152:61;-1:-1:-1;5719:271:61;6057:8;;6049:32;;;;6057:8;;;;;6072;;6049:32;;;;;;;;;;6057:8;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;6049:32:61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;6156:14:61;;;6166:3;6156:14;;;;;;;;;;-1:-1:-1;6156:14:61;;;17:15:-1;;105:10;6156:14:61;88:34:-1;136:17;;-1:-1;6156:14:61;6130:40;;6271:3;6268:1;6263:2;6251:10;6247:19;6232:43;1147:26;;;;;;;;;;;;;;;;6373:51;;6413:10;;1147:26;1108:102;;;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;1108:102:61;;;49:4:-1;25:18;;61:17;;1108:102:61;182:15:-1;1108:102:61;;;;179:29:-1;;;;160:49;;;1108:102:61;6373:51;:39;:51;:::i;:::-;6372:52;6364:61;;;;;;-1:-1:-1;6520:4:61;;2429:4102;-1:-1:-1;;;;;;;;;;2429:4102:61:o;3524:135:70:-;3636:16;;3606:7;3636:16;;;;;;;;;;;;3524:135::o;1055:514::-;1186:10;1136:4;1177:20;;;;;;;;;;;:30;-1:-1:-1;1177:30:70;1156:103;;;;;;;;;;;;;;;;;;;;;;1316:13;;;:8;:13;;;;;;;;;;;1290:22;;;:39;;1269:102;;;;;;;;;;;;;;1391:10;1382:8;:20;;;;;;;;;;;:30;;;;;;;:20;1422:13;;;;;;;;;:23;;;;;;1461:79;1422:13;;1391:10;1461:79;;;;1406:6;;1461:79;;2049:130:61;2134:17;:38;;;;;;;;;;;;;;;;;;2049:130::o;3867:162:70:-;3997:15;;;;3967:7;3997:15;;;:7;:15;;;;;;;;:25;;;;;;;;;;;;;3867:162::o;9651:403:80:-;9772:10;10001:3;:10;9987:3;:10;:24;:60;;;;;10043:3;10033:14;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;10033:14:80;;;;;;;;;;;10015;;10033;;-1:-1:-1;10015:14:80;;-1:-1:-1;10033:14:80;;;;-1:-1:-1;10015:14:80;;;;10033;10015;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;10015:14:80;;;;;;;;;;;;;;;;:32;;;;9987:60;9980:67;9651:403;-1:-1:-1;;;9651:403:80:o;879:5654:61:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;130:118;;197:46;235:6;222:20;197:46;;255:114;;320:44;356:6;343:20;320:44;;376:241;;480:2;468:9;459:7;455:23;451:32;448:2;;;496:1;493;486:12;448:2;531:1;548:53;593:7;573:9;548:53;;;538:63;442:175;-1:-1;;;;442:175;624:366;;;745:2;733:9;724:7;720:23;716:32;713:2;;;761:1;758;751:12;713:2;796:1;813:53;858:7;838:9;813:53;;;803:63;;775:97;903:2;921:53;966:7;957:6;946:9;942:22;921:53;;;911:63;;882:98;707:283;;;;;;997:491;;;;1135:2;1123:9;1114:7;1110:23;1106:32;1103:2;;;1151:1;1148;1141:12;1103:2;1186:1;1203:53;1248:7;1228:9;1203:53;;;1193:63;;1165:97;1293:2;1311:53;1356:7;1347:6;1336:9;1332:22;1311:53;;;1301:63;;1272:98;1401:2;1419:53;1464:7;1455:6;1444:9;1440:22;1419:53;;;1409:63;;1380:98;1097:391;;;;;;1495:366;;;1616:2;1604:9;1595:7;1591:23;1587:32;1584:2;;;1632:1;1629;1622:12;1584:2;1667:1;1684:53;1729:7;1709:9;1684:53;;;1674:63;;1646:97;1774:2;1792:53;1837:7;1828:6;1817:9;1813:22;1792:53;;1868:237;;1970:2;1958:9;1949:7;1945:23;1941:32;1938:2;;;1986:1;1983;1976:12;1938:2;2021:1;2038:51;2081:7;2061:9;2038:51;;2112:110;2185:31;2210:5;2185:31;;;2180:3;2173:44;2167:55;;;2256:766;;2401:59;2454:5;2401:59;;;2478:6;2473:3;2466:19;2502:4;2497:3;2493:14;2486:21;;2550:3;2592:4;2584:6;2580:17;2575:3;2571:27;2618:61;2673:5;2618:61;;;2700:1;2685:298;2710:6;2707:1;2704:13;2685:298;;;2772:9;2766:4;2762:20;2757:3;2750:33;2798:68;2861:4;2852:6;2846:13;2798:68;;;2790:76;;2883:65;2941:6;2883:65;;;2971:4;2962:14;;;;;2873:75;-1:-1;2732:1;2725:9;2685:298;;;-1:-1;2996:4;;2380:642;-1:-1;;;;;;2380:642;3089:864;;3262:73;3329:5;3262:73;;;3353:6;3348:3;3341:19;3377:4;3372:3;3368:14;3361:21;;3425:3;3467:4;3459:6;3455:17;3450:3;3446:27;3493:75;3562:5;3493:75;;;3589:1;3574:340;3599:6;3596:1;3593:13;3574:340;;;3661:9;3655:4;3651:20;3646:3;3639:33;3687:96;3778:4;3769:6;3763:13;3687:96;;;3679:104;;3800:79;3872:6;3800:79;;;3902:4;3893:14;;;;;3790:89;-1:-1;3621:1;3614:9;3574:340;;3992:590;;4127:54;4175:5;4127:54;;;4199:6;4194:3;4187:19;4223:4;4218:3;4214:14;4207:21;;4268:56;4318:5;4268:56;;;4345:1;4330:230;4355:6;4352:1;4349:13;4330:230;;;4395:53;4444:3;4435:6;4429:13;4395:53;;;4465:60;4518:6;4465:60;;;4548:4;4539:14;;;;;4455:70;-1:-1;4377:1;4370:9;4330:230;;;-1:-1;4573:3;;4106:476;-1:-1;;;;4106:476;4590:101;4657:28;4679:5;4657:28;;4698:297;;4798:38;4830:5;4798:38;;;4853:6;4848:3;4841:19;4865:63;4921:6;4914:4;4909:3;4905:14;4898:4;4891:5;4887:16;4865:63;;;4960:29;4982:6;4960:29;;;4940:50;;;4953:4;4940:50;;4778:217;-1:-1;;;4778:217;5298:128;5377:43;5414:5;5377:43;;5434:296;5589:2;5577:15;;5626:66;5621:2;5612:12;;5605:88;5721:2;5712:12;;5570:160;5739:296;5894:2;5882:15;;5931:66;5926:2;5917:12;;5910:88;6026:2;6017:12;;5875:160;6044:296;6199:2;6187:15;;6236:66;6231:2;6222:12;;6215:88;6331:2;6322:12;;6180:160;6401:2419;6616:22;;6401:2419;;6538:5;6529:15;;;6650:61;6533:3;6616:22;6650:61;;;6559:164;6807:4;6800:5;6796:16;6790:23;6825:62;6881:4;6876:3;6872:14;6859:11;6825:62;;;6733:166;6990:4;6983:5;6979:16;6973:23;7008:62;7064:4;7059:3;7055:14;7042:11;7008:62;;;6909:173;7167:4;7160:5;7156:16;7150:23;7185:62;7241:4;7236:3;7232:14;7219:11;7185:62;;;7092:167;7347:4;7340:5;7336:16;7330:23;7365:62;7421:4;7416:3;7412:14;7399:11;7365:62;;;7269:170;7527:4;7520:5;7516:16;7510:23;7545:62;7601:4;7596:3;7592:14;7579:11;7545:62;;;7449:170;7699:4;7692:5;7688:16;7682:23;7717:62;7773:4;7768:3;7764:14;7751:11;7717:62;;;7629:162;7871:4;7864:5;7860:16;7854:23;7889:62;7945:4;7940:3;7936:14;7923:11;7889:62;;;7801:162;8056:5;8049;8045:17;8039:24;8075:63;8131:5;8126:3;8122:15;8109:11;8075:63;;;7973:177;8226:5;8219;8215:17;8209:24;8245:63;8301:5;8296:3;8292:15;8279:11;8245:63;;;8160:160;8406:5;8399;8395:17;8389:24;8459:3;8453:4;8449:14;8441:5;8436:3;8432:15;8425:39;8479:66;8540:4;8527:11;8479:66;;;8471:74;;8330:227;8643:5;8636;8632:17;8626:24;8696:3;8690:4;8686:14;8678:5;8673:3;8669:15;8662:39;8716:66;8777:4;8764:11;8716:66;;;8708:74;6511:2309;-1:-1;;;;;6511:2309;11302:110;11375:31;11400:5;11375:31;;11419:282;11549:2;11534:18;;11563:61;11538:9;11597:6;11563:61;;;11635:56;11687:2;11676:9;11672:18;11663:6;11635:56;;11708:417;11904:2;11918:47;;;11889:18;;11979:136;11889:18;12101:6;11979:136;;12132:935;12494:2;12508:47;;;12479:18;;12569:136;12479:18;12691:6;12569:136;;;12561:144;;12753:9;12747:4;12743:20;12738:2;12727:9;12723:18;12716:48;12778:98;12871:4;12862:6;12778:98;;;12770:106;;12924:9;12918:4;12914:20;12909:2;12898:9;12894:18;12887:48;12949:108;13052:4;13043:6;12949:108;;13074:799;13392:2;13406:47;;;13377:18;;13467:136;13377:18;13589:6;13467:136;;;13459:144;;13614:68;13678:2;13667:9;13663:18;13654:6;13614:68;;;13730:9;13724:4;13720:20;13715:2;13704:9;13700:18;13693:48;13755:108;13858:4;13849:6;13755:108;;13880:181;13982:2;13967:18;;13996:55;13971:9;14024:6;13996:55;;14068:205;14182:2;14167:18;;14196:67;14171:9;14236:6;14196:67;;14280:387;14461:2;14475:47;;;14446:18;;14536:121;14446:18;14536:121;;14674:387;14855:2;14869:47;;;14840:18;;14930:121;14840:18;14930:121;;15068:387;15249:2;15263:47;;;15234:18;;15324:121;15234:18;15324:121;;15462:333;15616:2;15630:47;;;15601:18;;15691:94;15601:18;15771:6;15691:94;;15802:631;16036:2;16050:47;;;16021:18;;16111:94;16021:18;16191:6;16111:94;;;16103:102;;16216:68;16280:2;16269:9;16265:18;16256:6;16216:68;;;16332:9;16326:4;16322:20;16317:2;16306:9;16302:18;16295:48;16357:66;16418:4;16409:6;16357:66;;16440:945;16760:3;16775:47;;;16745:19;;16836:94;16745:19;16916:6;16836:94;;;16828:102;;16978:9;16972:4;16968:20;16963:2;16952:9;16948:18;16941:48;17003:94;17092:4;17083:6;17003:94;;;16995:102;;17145:9;17139:4;17135:20;17130:2;17119:9;17115:18;17108:48;17170:66;17231:4;17222:6;17170:66;;;17162:74;;17284:9;17278:4;17274:20;17269:2;17258:9;17254:18;17247:48;17309:66;17370:4;17361:6;17309:66;;;17301:74;16731:654;-1:-1;;;;;;16731:654;17392:193;17500:2;17485:18;;17514:61;17489:9;17548:6;17514:61;;17594:126;17708:4;17696:17;;17677:43;18012:112;18107:12;;18091:33;18987:128;19067:42;19056:54;;19039:76;19122:92;19195:13;19188:21;;19171:43;19221:79;19290:5;19273:27;19307:88;19385:4;19374:16;;19357:38;19718:119;;19803:29;19826:5;19803:29;;19845:268;19910:1;19917:101;19931:6;19928:1;19925:13;19917:101;;;19998:11;;;19992:18;19979:11;;;19972:39;19953:2;19946:10;19917:101;;;20033:6;20030:1;20027:13;20024:2;;;20098:1;20089:6;20084:3;20080:16;20073:27;20024:2;19894:219;;;;;20121:97;20209:2;20189:14;20205:7;20185:28;;20169:49"
+ }
+ }
+ },
+ "sources": {
+ "test/ReentrantERC20Token/ReentrantERC20Token.sol": {
+ "id": 61
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ },
+ "tokens/ERC20Token/ERC20Token.sol": {
+ "id": 70
+ },
+ "tokens/ERC20Token/IERC20Token.sol": {
+ "id": 71
+ },
+ "protocol/Exchange/interfaces/IExchange.sol": {
+ "id": 34
+ },
+ "protocol/Exchange/interfaces/IExchangeCore.sol": {
+ "id": 35
+ },
+ "protocol/Exchange/libs/LibOrder.sol": {
+ "id": 48
+ },
+ "protocol/Exchange/libs/LibEIP712.sol": {
+ "id": 44
+ },
+ "protocol/Exchange/libs/LibFillResults.sol": {
+ "id": 46
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "protocol/Exchange/interfaces/IMatchOrders.sol": {
+ "id": 36
+ },
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": {
+ "id": 37
+ },
+ "protocol/Exchange/interfaces/ITransactions.sol": {
+ "id": 38
+ },
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": {
+ "id": 33
+ },
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": {
+ "id": 41
+ }
+ },
+ "sourceCodes": {
+ "test/ReentrantERC20Token/ReentrantERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../utils/LibBytes/LibBytes.sol\";\nimport \"../../tokens/ERC20Token/ERC20Token.sol\";\nimport \"../../protocol/Exchange/interfaces/IExchange.sol\";\nimport \"../../protocol/Exchange/libs/LibOrder.sol\";\n\n\n// solhint-disable no-unused-vars\ncontract ReentrantERC20Token is\n ERC20Token\n{\n using LibBytes for bytes;\n\n // solhint-disable-next-line var-name-mixedcase\n IExchange internal EXCHANGE;\n\n bytes internal constant REENTRANCY_ILLEGAL_REVERT_REASON = abi.encodeWithSelector(\n bytes4(keccak256(\"Error(string)\")),\n \"REENTRANCY_ILLEGAL\"\n );\n\n // All of these functions are potentially vulnerable to reentrancy\n // We do not test any \"noThrow\" functions because `fillOrderNoThrow` makes a delegatecall to `fillOrder`\n enum ExchangeFunction {\n FILL_ORDER,\n FILL_OR_KILL_ORDER,\n BATCH_FILL_ORDERS,\n BATCH_FILL_OR_KILL_ORDERS,\n MARKET_BUY_ORDERS,\n MARKET_SELL_ORDERS,\n MATCH_ORDERS,\n CANCEL_ORDER,\n BATCH_CANCEL_ORDERS,\n CANCEL_ORDERS_UP_TO,\n SET_SIGNATURE_VALIDATOR_APPROVAL\n }\n\n uint8 internal currentFunctionId = 0;\n\n constructor (address _exchange)\n public\n {\n EXCHANGE = IExchange(_exchange);\n }\n\n /// @dev Set the current function that will be called when `transferFrom` is called.\n /// @param _currentFunctionId Id that corresponds to function name.\n function setCurrentFunction(uint8 _currentFunctionId)\n external\n {\n currentFunctionId = _currentFunctionId;\n }\n\n /// @dev A version of `transferFrom` that attempts to reenter the Exchange contract.\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n // This order would normally be invalid, but it will be used strictly for testing reentrnacy.\n // Any reentrancy checks will happen before any other checks that invalidate the order.\n LibOrder.Order memory order;\n\n // Initialize remaining null parameters\n bytes memory signature;\n LibOrder.Order[] memory orders;\n uint256[] memory takerAssetFillAmounts;\n bytes[] memory signatures;\n bytes memory calldata;\n\n // Create calldata for function that corresponds to currentFunctionId\n if (currentFunctionId == uint8(ExchangeFunction.FILL_ORDER)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.fillOrder.selector,\n order,\n 0,\n signature\n );\n } else if (currentFunctionId == uint8(ExchangeFunction.FILL_OR_KILL_ORDER)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.fillOrKillOrder.selector,\n order,\n 0,\n signature\n );\n } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_FILL_ORDERS)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.batchFillOrders.selector,\n orders,\n takerAssetFillAmounts,\n signatures\n );\n } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_FILL_OR_KILL_ORDERS)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.batchFillOrKillOrders.selector,\n orders,\n takerAssetFillAmounts,\n signatures\n );\n } else if (currentFunctionId == uint8(ExchangeFunction.MARKET_BUY_ORDERS)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.marketBuyOrders.selector,\n orders,\n 0,\n signatures\n );\n } else if (currentFunctionId == uint8(ExchangeFunction.MARKET_SELL_ORDERS)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.marketSellOrders.selector,\n orders,\n 0,\n signatures\n );\n } else if (currentFunctionId == uint8(ExchangeFunction.MATCH_ORDERS)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.matchOrders.selector,\n order,\n order,\n signature,\n signature\n );\n } else if (currentFunctionId == uint8(ExchangeFunction.CANCEL_ORDER)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.cancelOrder.selector,\n order\n );\n } else if (currentFunctionId == uint8(ExchangeFunction.BATCH_CANCEL_ORDERS)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.batchCancelOrders.selector,\n orders\n );\n } else if (currentFunctionId == uint8(ExchangeFunction.CANCEL_ORDERS_UP_TO)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.cancelOrdersUpTo.selector,\n 0\n );\n } else if (currentFunctionId == uint8(ExchangeFunction.SET_SIGNATURE_VALIDATOR_APPROVAL)) {\n calldata = abi.encodeWithSelector(\n EXCHANGE.setSignatureValidatorApproval.selector,\n address(0),\n false\n );\n }\n\n // Call Exchange function, swallow error\n address(EXCHANGE).call(calldata);\n\n // Revert reason is 100 bytes\n bytes memory returnData = new bytes(100);\n\n // Copy return data\n assembly {\n returndatacopy(add(returnData, 32), 0, 100)\n }\n\n // Revert if function reverted with REENTRANCY_ILLEGAL error\n require(!REENTRANCY_ILLEGAL_REVERT_REASON.equals(returnData));\n\n // Transfer will return true if function failed for any other reason\n return true;\n }\n}",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n",
+ "tokens/ERC20Token/ERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IERC20Token.sol\";\n\n\ncontract ERC20Token is\n IERC20Token\n{\n mapping (address => uint256) internal balances;\n mapping (address => mapping (address => uint256)) internal allowed;\n\n uint256 internal _totalSupply;\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool)\n {\n require(\n balances[msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[msg.sender] -= _value;\n balances[_to] += _value;\n\n emit Transfer(\n msg.sender,\n _to,\n _value\n );\n\n return true;\n }\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool)\n {\n require(\n balances[_from] >= _value,\n \"ERC20_INSUFFICIENT_BALANCE\"\n );\n require(\n allowed[_from][msg.sender] >= _value,\n \"ERC20_INSUFFICIENT_ALLOWANCE\"\n );\n require(\n balances[_to] + _value >= balances[_to],\n \"UINT256_OVERFLOW\"\n );\n\n balances[_to] += _value;\n balances[_from] -= _value;\n allowed[_from][msg.sender] -= _value;\n \n emit Transfer(\n _from,\n _to,\n _value\n );\n \n return true;\n }\n\n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool)\n {\n allowed[msg.sender][_spender] = _value;\n emit Approval(\n msg.sender,\n _spender,\n _value\n );\n return true;\n }\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256)\n {\n return _totalSupply;\n }\n\n /// @dev Query the balance of owner\n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256)\n {\n return balances[_owner];\n }\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256)\n {\n return allowed[_owner][_spender];\n }\n}\n",
+ "tokens/ERC20Token/IERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC20Token {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool);\n \n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n \n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256);\n}\n",
+ "protocol/Exchange/interfaces/IExchange.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./IExchangeCore.sol\";\nimport \"./IMatchOrders.sol\";\nimport \"./ISignatureValidator.sol\";\nimport \"./ITransactions.sol\";\nimport \"./IAssetProxyDispatcher.sol\";\nimport \"./IWrapperFunctions.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract IExchange is\n IExchangeCore,\n IMatchOrders,\n ISignatureValidator,\n ITransactions,\n IAssetProxyDispatcher,\n IWrapperFunctions\n{}\n",
+ "protocol/Exchange/interfaces/IExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IExchangeCore {\n\n /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch\n /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).\n /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.\n function cancelOrdersUpTo(uint256 targetOrderEpoch)\n external;\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev After calling, the order can not be filled anymore.\n /// @param order Order struct containing order specifications.\n function cancelOrder(LibOrder.Order memory order)\n public;\n\n /// @dev Gets information about an order: status, hash, and amount filled.\n /// @param order Order to gather information on.\n /// @return OrderInfo Information about the order and its state.\n /// See LibOrder.OrderInfo for a complete description.\n function getOrderInfo(LibOrder.Order memory order)\n public\n view\n returns (LibOrder.OrderInfo memory orderInfo);\n}\n",
+ "protocol/Exchange/libs/LibOrder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./LibEIP712.sol\";\n\n\ncontract LibOrder is\n LibEIP712\n{\n // Hash for the EIP712 Order Schema\n bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"Order(\",\n \"address makerAddress,\",\n \"address takerAddress,\",\n \"address feeRecipientAddress,\",\n \"address senderAddress,\",\n \"uint256 makerAssetAmount,\",\n \"uint256 takerAssetAmount,\",\n \"uint256 makerFee,\",\n \"uint256 takerFee,\",\n \"uint256 expirationTimeSeconds,\",\n \"uint256 salt,\",\n \"bytes makerAssetData,\",\n \"bytes takerAssetData\",\n \")\"\n ));\n\n // A valid order remains fillable until it is expired, fully filled, or cancelled.\n // An order's state is unaffected by external factors, like account balances.\n enum OrderStatus {\n INVALID, // Default value\n INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount\n INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount\n FILLABLE, // Order is fillable\n EXPIRED, // Order has already expired\n FULLY_FILLED, // Order is fully filled\n CANCELLED // Order has been cancelled\n }\n\n // solhint-disable max-line-length\n struct Order {\n address makerAddress; // Address that created the order. \n address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. \n address feeRecipientAddress; // Address that will recieve fees when order is filled. \n address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.\n uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. \n uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. \n uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.\n uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.\n uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. \n uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. \n bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.\n bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.\n }\n // solhint-enable max-line-length\n\n struct OrderInfo {\n uint8 orderStatus; // Status that describes order's validity and fillability.\n bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash).\n uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled.\n }\n\n /// @dev Calculates Keccak-256 hash of the order.\n /// @param order The order structure.\n /// @return Keccak-256 EIP712 hash of the order.\n function getOrderHash(Order memory order)\n internal\n view\n returns (bytes32 orderHash)\n {\n orderHash = hashEIP712Message(hashOrder(order));\n return orderHash;\n }\n\n /// @dev Calculates EIP712 hash of the order.\n /// @param order The order structure.\n /// @return EIP712 hash of the order.\n function hashOrder(Order memory order)\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;\n bytes32 makerAssetDataHash = keccak256(order.makerAssetData);\n bytes32 takerAssetDataHash = keccak256(order.takerAssetData);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ORDER_SCHEMA_HASH,\n // bytes32(order.makerAddress),\n // bytes32(order.takerAddress),\n // bytes32(order.feeRecipientAddress),\n // bytes32(order.senderAddress),\n // order.makerAssetAmount,\n // order.takerAssetAmount,\n // order.makerFee,\n // order.takerFee,\n // order.expirationTimeSeconds,\n // order.salt,\n // keccak256(order.makerAssetData),\n // keccak256(order.takerAssetData)\n // ));\n\n assembly {\n // Calculate memory addresses that will be swapped out before hashing\n let pos1 := sub(order, 32)\n let pos2 := add(order, 320)\n let pos3 := add(order, 352)\n\n // Backup\n let temp1 := mload(pos1)\n let temp2 := mload(pos2)\n let temp3 := mload(pos3)\n \n // Hash in place\n mstore(pos1, schemaHash)\n mstore(pos2, makerAssetDataHash)\n mstore(pos3, takerAssetDataHash)\n result := keccak256(pos1, 416)\n \n // Restore\n mstore(pos1, temp1)\n mstore(pos2, temp2)\n mstore(pos3, temp3)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibEIP712.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract LibEIP712 {\n\n // EIP191 header for EIP712 prefix\n string constant internal EIP191_HEADER = \"\\x19\\x01\";\n\n // EIP712 Domain Name value\n string constant internal EIP712_DOMAIN_NAME = \"0x Protocol\";\n\n // EIP712 Domain Version value\n string constant internal EIP712_DOMAIN_VERSION = \"2\";\n\n // Hash of the EIP712 Domain Separator Schema\n bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"address verifyingContract\",\n \")\"\n ));\n\n // Hash of the EIP712 Domain Separator data\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public EIP712_DOMAIN_HASH;\n\n constructor ()\n public\n {\n EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(\n EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,\n keccak256(bytes(EIP712_DOMAIN_NAME)),\n keccak256(bytes(EIP712_DOMAIN_VERSION)),\n bytes32(address(this))\n ));\n }\n\n /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.\n /// @param hashStruct The EIP712 hash struct.\n /// @return EIP712 hash applied to this EIP712 Domain.\n function hashEIP712Message(bytes32 hashStruct)\n internal\n view\n returns (bytes32 result)\n {\n bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;\n\n // Assembly for more efficient computing:\n // keccak256(abi.encodePacked(\n // EIP191_HEADER,\n // EIP712_DOMAIN_HASH,\n // hashStruct \n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header\n mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash\n mstore(add(memPtr, 34), hashStruct) // Hash of struct\n\n // Compute hash\n result := keccak256(memPtr, 66)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibFillResults.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibFillResults is\n SafeMath\n{\n struct FillResults {\n uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.\n uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.\n uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).\n uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).\n }\n\n struct MatchedFillResults {\n FillResults left; // Amounts filled and fees paid of left order.\n FillResults right; // Amounts filled and fees paid of right order.\n uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker.\n }\n\n /// @dev Adds properties of both FillResults instances.\n /// Modifies the first FillResults instance specified.\n /// @param totalFillResults Fill results instance that will be added onto.\n /// @param singleFillResults Fill results instance that will be added to totalFillResults.\n function addFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)\n internal\n pure\n {\n totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);\n totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);\n totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);\n totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "protocol/Exchange/interfaces/IMatchOrders.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IMatchOrders {\n\n /// @dev Match two complementary orders that have a profitable spread.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the left order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftSignature Proof that order was created by the left maker.\n /// @param rightSignature Proof that order was created by the right maker.\n /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.\n function matchOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n bytes memory leftSignature,\n bytes memory rightSignature\n )\n public\n returns (LibFillResults.MatchedFillResults memory matchedFillResults);\n}\n",
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ISignatureValidator {\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external;\n \n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external;\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address of signer.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/ITransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\n\ncontract ITransactions {\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external;\n}\n",
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IAssetProxyDispatcher {\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external;\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address);\n}\n",
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IWrapperFunctions {\n\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrKill.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrKillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrders(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrders(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously cancels multiple orders in a single transaction.\n /// @param orders Array of order specifications.\n function batchCancelOrders(LibOrder.Order[] memory orders)\n public;\n\n /// @dev Fetches information for all passed in orders\n /// @param orders Array of order specifications.\n /// @return Array of OrderInfo instances that correspond to each order.\n function getOrdersInfo(LibOrder.Order[] memory orders)\n public\n view\n returns (LibOrder.OrderInfo[] memory);\n}\n"
+ },
+ "sourceTreeHashHex": "0x0a50f8669272e24a379ae0e6b297acf97d913b411d5c072fa0e68e4296260e74",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/TestAssetProxyDispatcher.json b/packages/contracts/generated-artifacts/TestAssetProxyDispatcher.json
new file mode 100644
index 000000000..f94f6acaf
--- /dev/null
+++ b/packages/contracts/generated-artifacts/TestAssetProxyDispatcher.json
@@ -0,0 +1,204 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "TestAssetProxyDispatcher",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "name": "assetProxies",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "assetProxyId",
+ "type": "bytes4"
+ }
+ ],
+ "name": "getAssetProxy",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "assetData",
+ "type": "bytes"
+ },
+ {
+ "name": "from",
+ "type": "address"
+ },
+ {
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "name": "amount",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicDispatchTransferFrom",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "assetProxy",
+ "type": "address"
+ }
+ ],
+ "name": "registerAssetProxy",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "id",
+ "type": "bytes4"
+ },
+ {
+ "indexed": false,
+ "name": "assetProxy",
+ "type": "address"
+ }
+ ],
+ "name": "AssetProxyRegistered",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405260008054600160a060020a0319163317905561087d806100256000396000f3006080604052600436106100775763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fd3c997811461007c57806360704108146100df578063889b6d8d146101195780638da5cb5b14610199578063c585bb93146101ae578063f2fde38b146101dc575b600080fd5b34801561008857600080fd5b506100b67fffffffff000000000000000000000000000000000000000000000000000000006004351661020a565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100eb57600080fd5b506100b67fffffffff0000000000000000000000000000000000000000000000000000000060043516610232565b34801561012557600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101979436949293602493928401919081908401838280828437509497505073ffffffffffffffffffffffffffffffffffffffff8535811696506020860135169460400135935061027c92505050565b005b3480156101a557600080fd5b506100b661028e565b3480156101ba57600080fd5b5061019773ffffffffffffffffffffffffffffffffffffffff600435166102aa565b3480156101e857600080fd5b5061019773ffffffffffffffffffffffffffffffffffffffff60043516610537565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b7fffffffff000000000000000000000000000000000000000000000000000000001660009081526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b6102888484848461061d565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b600080548190819073ffffffffffffffffffffffffffffffffffffffff16331461033557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b8392508273ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561039c57600080fd5b505af11580156103b0573d6000803e3d6000fd5b505050506040513d60208110156103c657600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000811660009081526001602052604090205490925073ffffffffffffffffffffffffffffffffffffffff169050801561048257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f41535345545f50524f58595f414c52454144595f455849535453000000000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000821660008181526001602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88811691909117909155825193845287169083015280517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c031949281900390910190a150505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146105bd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561061a57600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60008060008311801561065c57508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b156108495785516003106106d157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4c454e4754485f475245415445525f5448414e5f335f52455155495245440000604482015290519081900360640190fd5b50506020848101517fffffffff00000000000000000000000000000000000000000000000000000000166000818152600190925260409091205473ffffffffffffffffffffffffffffffffffffffff1680151561078f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f41535345545f50524f58595f444f45535f4e4f545f4558495354000000000000604482015290519081900360640190fd5b604051660fffffffffffe0603f885101168060840182017fa85e59e40000000000000000000000000000000000000000000000000000000083526080600484015273ffffffffffffffffffffffffffffffffffffffff8816602484015273ffffffffffffffffffffffffffffffffffffffff87166044840152856064840152608483015b8181101561082b57895181526020998a019901610813565b61020084858403866000895af1801515610843573d85fd5b50505050505b5050505050505600a165627a7a72305820a25ed51a8aa3b34b6ab6f270764a780a01c2eae8e2368fec143c07837647d8f50029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE PUSH2 0x87D DUP1 PUSH2 0x25 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x77 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x3FD3C997 DUP2 EQ PUSH2 0x7C JUMPI DUP1 PUSH4 0x60704108 EQ PUSH2 0xDF JUMPI DUP1 PUSH4 0x889B6D8D EQ PUSH2 0x119 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x199 JUMPI DUP1 PUSH4 0xC585BB93 EQ PUSH2 0x1AE JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x1DC JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x88 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB6 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 PUSH1 0x4 CALLDATALOAD AND PUSH2 0x20A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB6 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 PUSH1 0x4 CALLDATALOAD AND PUSH2 0x232 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x125 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x197 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 CALLDATALOAD DUP2 AND SWAP7 POP PUSH1 0x20 DUP7 ADD CALLDATALOAD AND SWAP5 PUSH1 0x40 ADD CALLDATALOAD SWAP4 POP PUSH2 0x27C SWAP3 POP POP POP JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1A5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB6 PUSH2 0x28E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1BA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x197 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x2AA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1E8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x197 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x537 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH2 0x288 DUP5 DUP5 DUP5 DUP5 PUSH2 0x61D JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD DUP2 SWAP1 DUP2 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x335 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP4 SWAP3 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xAE25532E PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x39C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x3B0 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x3C6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP1 ISZERO PUSH2 0x482 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x41535345545F50524F58595F414C52454144595F455849535453000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP3 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 DUP2 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SWAP2 SSTORE DUP3 MLOAD SWAP4 DUP5 MSTORE DUP8 AND SWAP1 DUP4 ADD MSTORE DUP1 MLOAD PUSH32 0xD2C6B762299C609BDB96520B58A49BFB80186934D4F71A86A367571A15C03194 SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG1 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x5BD JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x61A JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP4 GT DUP1 ISZERO PUSH2 0x65C JUMPI POP DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO JUMPDEST ISZERO PUSH2 0x849 JUMPI DUP6 MLOAD PUSH1 0x3 LT PUSH2 0x6D1 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1E PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F335F52455155495245440000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP PUSH1 0x20 DUP5 DUP2 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP3 MSTORE PUSH1 0x40 SWAP1 SWAP2 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO ISZERO PUSH2 0x78F JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x41535345545F50524F58595F444F45535F4E4F545F4558495354000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH7 0xFFFFFFFFFFFE0 PUSH1 0x3F DUP9 MLOAD ADD AND DUP1 PUSH1 0x84 ADD DUP3 ADD PUSH32 0xA85E59E400000000000000000000000000000000000000000000000000000000 DUP4 MSTORE PUSH1 0x80 PUSH1 0x4 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND PUSH1 0x24 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND PUSH1 0x44 DUP5 ADD MSTORE DUP6 PUSH1 0x64 DUP5 ADD MSTORE PUSH1 0x84 DUP4 ADD JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x82B JUMPI DUP10 MLOAD DUP2 MSTORE PUSH1 0x20 SWAP10 DUP11 ADD SWAP10 ADD PUSH2 0x813 JUMP JUMPDEST PUSH2 0x200 DUP5 DUP6 DUP5 SUB DUP7 PUSH1 0x0 DUP10 GAS CALL DUP1 ISZERO ISZERO PUSH2 0x843 JUMPI RETURNDATASIZE DUP6 REVERT JUMPDEST POP POP POP POP POP JUMPDEST POP POP POP POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 LOG2 0x5e 0xd5 BYTE DUP11 LOG3 0xb3 0x4b PUSH11 0xB6F270764A780A01C2EAE8 0xe2 CALLDATASIZE DUP16 0xec EQ EXTCODECOPY SMOD DUP4 PUSH23 0x47D8F50029000000000000000000000000000000000000 ",
+ "sourceMap": "671:301:62:-;;;162:5:82;:18;;-1:-1:-1;;;;;;162:18:82;170:10;162:18;;;671:301:62;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100775763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fd3c997811461007c57806360704108146100df578063889b6d8d146101195780638da5cb5b14610199578063c585bb93146101ae578063f2fde38b146101dc575b600080fd5b34801561008857600080fd5b506100b67fffffffff000000000000000000000000000000000000000000000000000000006004351661020a565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100eb57600080fd5b506100b67fffffffff0000000000000000000000000000000000000000000000000000000060043516610232565b34801561012557600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101979436949293602493928401919081908401838280828437509497505073ffffffffffffffffffffffffffffffffffffffff8535811696506020860135169460400135935061027c92505050565b005b3480156101a557600080fd5b506100b661028e565b3480156101ba57600080fd5b5061019773ffffffffffffffffffffffffffffffffffffffff600435166102aa565b3480156101e857600080fd5b5061019773ffffffffffffffffffffffffffffffffffffffff60043516610537565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b7fffffffff000000000000000000000000000000000000000000000000000000001660009081526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b6102888484848461061d565b50505050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b600080548190819073ffffffffffffffffffffffffffffffffffffffff16331461033557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b8392508273ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561039c57600080fd5b505af11580156103b0573d6000803e3d6000fd5b505050506040513d60208110156103c657600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000811660009081526001602052604090205490925073ffffffffffffffffffffffffffffffffffffffff169050801561048257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f41535345545f50524f58595f414c52454144595f455849535453000000000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000821660008181526001602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88811691909117909155825193845287169083015280517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c031949281900390910190a150505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146105bd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561061a57600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60008060008311801561065c57508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b156108495785516003106106d157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4c454e4754485f475245415445525f5448414e5f335f52455155495245440000604482015290519081900360640190fd5b50506020848101517fffffffff00000000000000000000000000000000000000000000000000000000166000818152600190925260409091205473ffffffffffffffffffffffffffffffffffffffff1680151561078f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f41535345545f50524f58595f444f45535f4e4f545f4558495354000000000000604482015290519081900360640190fd5b604051660fffffffffffe0603f885101168060840182017fa85e59e40000000000000000000000000000000000000000000000000000000083526080600484015273ffffffffffffffffffffffffffffffffffffffff8816602484015273ffffffffffffffffffffffffffffffffffffffff87166044840152856064840152608483015b8181101561082b57895181526020998a019901610813565b61020084858403866000895af1801515610843573d85fd5b50505050505b5050505050505600a165627a7a72305820a25ed51a8aa3b34b6ab6f270764a780a01c2eae8e2368fec143c07837647d8f50029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x77 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x3FD3C997 DUP2 EQ PUSH2 0x7C JUMPI DUP1 PUSH4 0x60704108 EQ PUSH2 0xDF JUMPI DUP1 PUSH4 0x889B6D8D EQ PUSH2 0x119 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x199 JUMPI DUP1 PUSH4 0xC585BB93 EQ PUSH2 0x1AE JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x1DC JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x88 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB6 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 PUSH1 0x4 CALLDATALOAD AND PUSH2 0x20A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB6 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 PUSH1 0x4 CALLDATALOAD AND PUSH2 0x232 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x125 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x197 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 CALLDATALOAD DUP2 AND SWAP7 POP PUSH1 0x20 DUP7 ADD CALLDATALOAD AND SWAP5 PUSH1 0x40 ADD CALLDATALOAD SWAP4 POP PUSH2 0x27C SWAP3 POP POP POP JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1A5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB6 PUSH2 0x28E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1BA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x197 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x2AA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1E8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x197 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x537 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH2 0x288 DUP5 DUP5 DUP5 DUP5 PUSH2 0x61D JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD DUP2 SWAP1 DUP2 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x335 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP4 SWAP3 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xAE25532E PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x39C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x3B0 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x3C6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP1 ISZERO PUSH2 0x482 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x41535345545F50524F58595F414C52454144595F455849535453000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP3 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 DUP2 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SWAP2 SSTORE DUP3 MLOAD SWAP4 DUP5 MSTORE DUP8 AND SWAP1 DUP4 ADD MSTORE DUP1 MLOAD PUSH32 0xD2C6B762299C609BDB96520B58A49BFB80186934D4F71A86A367571A15C03194 SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG1 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x5BD JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x61A JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP4 GT DUP1 ISZERO PUSH2 0x65C JUMPI POP DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO JUMPDEST ISZERO PUSH2 0x849 JUMPI DUP6 MLOAD PUSH1 0x3 LT PUSH2 0x6D1 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1E PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F335F52455155495245440000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP PUSH1 0x20 DUP5 DUP2 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP3 MSTORE PUSH1 0x40 SWAP1 SWAP2 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO ISZERO PUSH2 0x78F JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1A PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x41535345545F50524F58595F444F45535F4E4F545F4558495354000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH7 0xFFFFFFFFFFFE0 PUSH1 0x3F DUP9 MLOAD ADD AND DUP1 PUSH1 0x84 ADD DUP3 ADD PUSH32 0xA85E59E400000000000000000000000000000000000000000000000000000000 DUP4 MSTORE PUSH1 0x80 PUSH1 0x4 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND PUSH1 0x24 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND PUSH1 0x44 DUP5 ADD MSTORE DUP6 PUSH1 0x64 DUP5 ADD MSTORE PUSH1 0x84 DUP4 ADD JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x82B JUMPI DUP10 MLOAD DUP2 MSTORE PUSH1 0x20 SWAP10 DUP11 ADD SWAP10 ADD PUSH2 0x813 JUMP JUMPDEST PUSH2 0x200 DUP5 DUP6 DUP5 SUB DUP7 PUSH1 0x0 DUP10 GAS CALL DUP1 ISZERO ISZERO PUSH2 0x843 JUMPI RETURNDATASIZE DUP6 REVERT JUMPDEST POP POP POP POP POP JUMPDEST POP POP POP POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 LOG2 0x5e 0xd5 BYTE DUP11 LOG3 0xb3 0x4b PUSH11 0xB6F270764A780A01C2EAE8 0xe2 CALLDATASIZE DUP16 0xec EQ EXTCODECOPY SMOD DUP4 PUSH23 0x47D8F50029000000000000000000000000000000000000 ",
+ "sourceMap": "671:301:62:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;897:51:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;897:51:27;;;;;;;;;;;;;;;;;;;;;;;;;;2013:154;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2013:154:27;;;;;;;745:225:62;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;745:225:62;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;745:225:62;;-1:-1:-1;;745:225:62;;;;;;-1:-1:-1;745:225:62;;;;;;;;;;-1:-1:-1;745:225:62;;-1:-1:-1;;;745:225:62;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;1157:666:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1157:666:27;;;;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;897:51:27;;;;;;;;;;;;;;;:::o;2013:154::-;2134:26;;2104:7;2134:26;;;:12;:26;;;;;;;;;2013:154::o;745:225:62:-;914:49;935:9;946:4;952:2;956:6;914:20;:49::i;:::-;745:225;;;;:::o;91:20:82:-;;;;;;:::o;1157:666:27:-;1254:30;259:5:82;;1254:30:27;;;;259:5:82;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1299:10:27;1254:56;;1405:18;:29;;;:31;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1405:31:27;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1405:31:27;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1405:31:27;1474:26;;;;;;;:12;1405:31;1474:26;;;;;1405:31;;-1:-1:-1;1474:26:27;;;-1:-1:-1;1531:31:27;;1510:104;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1674:26;;;;;;;:12;:26;;;;;;;;;:47;;;;;;;;;;;;;;;1736:80;;;;;;;;;;;;;;;;;;;;;;;1157:666;;;;:::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;425:69;333:167;:::o;2482:5147:27:-;3031:19;3290:18;2718:1;2709:6;:10;:24;;;;;2731:2;2723:10;;:4;:10;;;;2709:24;2705:4918;;;2822:16;;2841:1;-1:-1:-1;2797:109:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;3153:2:27;3138:18;;;3111:46;3179:66;3107:156;3311:26;;;;:12;:26;;;;;;;;;;3422:24;;;3397:109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4923:2;4917:9;5239:15;5234:2;5222:9;5216:16;5212:25;5208:47;5392:14;5387:3;5383:24;5374:7;5370:38;5676:66;5667:7;5660:83;6160:3;6156:1;6147:7;6143:15;6136:28;6216:42;6210:4;6206:53;6201:2;6192:7;6188:16;6181:79;6310:42;6306:2;6302:51;6297:2;6288:7;6284:16;6277:77;6397:6;6391:3;6382:7;6378:17;6371:33;6563:3;6554:7;6550:17;6645:206;6665:5;6655:8;6652:19;6645:206;;;6714:16;;6697:34;;6778:2;6815:18;;;;6764:17;6645:206;;;7417:3;7346:7;7292;7285:5;7281:19;7208:7;7142:1;7067:10;7004:3;6978:512;7517:7;7510:15;7507:2;;;7564:16;7555:7;7548:33;7507:2;4724:2889;;;;;;2482:5147;;;;;;:::o"
+ }
+ }
+ },
+ "sources": {
+ "test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol": {
+ "id": 62
+ },
+ "protocol/Exchange/MixinAssetProxyDispatcher.sol": {
+ "id": 27
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ },
+ "protocol/Exchange/mixins/MAssetProxyDispatcher.sol": {
+ "id": 49
+ },
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": {
+ "id": 33
+ },
+ "protocol/AssetProxy/interfaces/IAssetProxy.sol": {
+ "id": 22
+ },
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": {
+ "id": 23
+ }
+ },
+ "sourceCodes": {
+ "test/TestAssetProxyDispatcher/TestAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../protocol/Exchange/MixinAssetProxyDispatcher.sol\";\n\n\ncontract TestAssetProxyDispatcher is \n MixinAssetProxyDispatcher\n{\n function publicDispatchTransferFrom(\n bytes memory assetData,\n address from,\n address to,\n uint256 amount\n )\n public\n {\n dispatchTransferFrom(assetData, from, to, amount);\n }\n}\n",
+ "protocol/Exchange/MixinAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/Ownable/Ownable.sol\";\nimport \"./mixins/MAssetProxyDispatcher.sol\";\nimport \"../AssetProxy/interfaces/IAssetProxy.sol\";\n\n\ncontract MixinAssetProxyDispatcher is\n Ownable,\n MAssetProxyDispatcher\n{\n // Mapping from Asset Proxy Id's to their respective Asset Proxy\n mapping (bytes4 => IAssetProxy) public assetProxies;\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external\n onlyOwner\n {\n IAssetProxy assetProxyContract = IAssetProxy(assetProxy);\n\n // Ensure that no asset proxy exists with current id.\n bytes4 assetProxyId = assetProxyContract.getProxyId();\n address currentAssetProxy = assetProxies[assetProxyId];\n require(\n currentAssetProxy == address(0),\n \"ASSET_PROXY_ALREADY_EXISTS\"\n );\n\n // Add asset proxy and log registration.\n assetProxies[assetProxyId] = assetProxyContract;\n emit AssetProxyRegistered(\n assetProxyId,\n assetProxy\n );\n }\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address)\n {\n return assetProxies[assetProxyId];\n }\n\n /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.\n /// @param assetData Byte array encoded for the asset.\n /// @param from Address to transfer token from.\n /// @param to Address to transfer token to.\n /// @param amount Amount of token to transfer.\n function dispatchTransferFrom(\n bytes memory assetData,\n address from,\n address to,\n uint256 amount\n )\n internal\n {\n // Do nothing if no amount should be transferred.\n if (amount > 0 && from != to) {\n // Ensure assetData length is valid\n require(\n assetData.length > 3,\n \"LENGTH_GREATER_THAN_3_REQUIRED\"\n );\n \n // Lookup assetProxy. We do not use `LibBytes.readBytes4` for gas efficiency reasons.\n bytes4 assetProxyId;\n assembly {\n assetProxyId := and(mload(\n add(assetData, 32)),\n 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000\n )\n }\n address assetProxy = assetProxies[assetProxyId];\n\n // Ensure that assetProxy exists\n require(\n assetProxy != address(0),\n \"ASSET_PROXY_DOES_NOT_EXIST\"\n );\n \n // We construct calldata for the `assetProxy.transferFrom` ABI.\n // The layout of this calldata is in the table below.\n // \n // | Area | Offset | Length | Contents |\n // | -------- |--------|---------|-------------------------------------------- |\n // | Header | 0 | 4 | function selector |\n // | Params | | 4 * 32 | function parameters: |\n // | | 4 | | 1. offset to assetData (*) |\n // | | 36 | | 2. from |\n // | | 68 | | 3. to |\n // | | 100 | | 4. amount |\n // | Data | | | assetData: |\n // | | 132 | 32 | assetData Length |\n // | | 164 | ** | assetData Contents |\n\n assembly {\n /////// Setup State ///////\n // `cdStart` is the start of the calldata for `assetProxy.transferFrom` (equal to free memory ptr).\n let cdStart := mload(64)\n // `dataAreaLength` is the total number of words needed to store `assetData`\n // As-per the ABI spec, this value is padded up to the nearest multiple of 32,\n // and includes 32-bytes for length.\n let dataAreaLength := and(add(mload(assetData), 63), 0xFFFFFFFFFFFE0)\n // `cdEnd` is the end of the calldata for `assetProxy.transferFrom`.\n let cdEnd := add(cdStart, add(132, dataAreaLength))\n\n \n /////// Setup Header Area ///////\n // This area holds the 4-byte `transferFromSelector`.\n // bytes4(keccak256(\"transferFrom(bytes,address,address,uint256)\")) = 0xa85e59e4\n mstore(cdStart, 0xa85e59e400000000000000000000000000000000000000000000000000000000)\n \n /////// Setup Params Area ///////\n // Each parameter is padded to 32-bytes. The entire Params Area is 128 bytes.\n // Notes:\n // 1. The offset to `assetData` is the length of the Params Area (128 bytes).\n // 2. A 20-byte mask is applied to addresses to zero-out the unused bytes.\n mstore(add(cdStart, 4), 128)\n mstore(add(cdStart, 36), and(from, 0xffffffffffffffffffffffffffffffffffffffff))\n mstore(add(cdStart, 68), and(to, 0xffffffffffffffffffffffffffffffffffffffff))\n mstore(add(cdStart, 100), amount)\n \n /////// Setup Data Area ///////\n // This area holds `assetData`.\n let dataArea := add(cdStart, 132)\n // solhint-disable-next-line no-empty-blocks\n for {} lt(dataArea, cdEnd) {} {\n mstore(dataArea, mload(assetData))\n dataArea := add(dataArea, 32)\n assetData := add(assetData, 32)\n }\n\n /////// Call `assetProxy.transferFrom` using the constructed calldata ///////\n let success := call(\n gas, // forward all gas\n assetProxy, // call address of asset proxy\n 0, // don't send any ETH\n cdStart, // pointer to start of input\n sub(cdEnd, cdStart), // length of input \n cdStart, // write output over input\n 512 // reserve 512 bytes for output\n )\n if iszero(success) {\n revert(cdStart, returndatasize())\n }\n }\n }\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n",
+ "protocol/Exchange/mixins/MAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../interfaces/IAssetProxyDispatcher.sol\";\n\n\ncontract MAssetProxyDispatcher is\n IAssetProxyDispatcher\n{\n // Logs registration of new asset proxy\n event AssetProxyRegistered(\n bytes4 id, // Id of new registered AssetProxy.\n address assetProxy // Address of new registered AssetProxy.\n );\n\n /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.\n /// @param assetData Byte array encoded for the asset.\n /// @param from Address to transfer token from.\n /// @param to Address to transfer token to.\n /// @param amount Amount of token to transfer.\n function dispatchTransferFrom(\n bytes memory assetData,\n address from,\n address to,\n uint256 amount\n )\n internal;\n}\n",
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IAssetProxyDispatcher {\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external;\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address);\n}\n",
+ "protocol/AssetProxy/interfaces/IAssetProxy.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IAuthorizable.sol\";\n\n\ncontract IAssetProxy is\n IAuthorizable\n{\n /// @dev Transfers assets. Either succeeds or throws.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param from Address to transfer asset from.\n /// @param to Address to transfer asset to.\n /// @param amount Amount of asset to transfer.\n function transferFrom(\n bytes assetData,\n address from,\n address to,\n uint256 amount\n )\n external;\n \n /// @dev Gets the proxy id associated with the proxy address.\n /// @return Proxy id.\n function getProxyId()\n external\n pure\n returns (bytes4);\n}\n",
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/Ownable/IOwnable.sol\";\n\n\ncontract IAuthorizable is\n IOwnable\n{\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n \n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory);\n}\n"
+ },
+ "sourceTreeHashHex": "0x391113c0e5b5f43e46977a276c90b883002505bbc9f128766b029e03607bc0b8",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/TestAssetProxyOwner.json b/packages/contracts/generated-artifacts/TestAssetProxyOwner.json
new file mode 100644
index 000000000..5f5f71880
--- /dev/null
+++ b/packages/contracts/generated-artifacts/TestAssetProxyOwner.json
@@ -0,0 +1,790 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "TestAssetProxyOwner",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "owners",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "removeOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "revokeConfirmation",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "isOwner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "confirmations",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "executeRemoveAuthorizedAddressAtIndex",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "secondsTimeLocked",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "pending",
+ "type": "bool"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "name": "getTransactionCount",
+ "outputs": [
+ {
+ "name": "count",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "assetProxyContract",
+ "type": "address"
+ },
+ {
+ "name": "isRegistered",
+ "type": "bool"
+ }
+ ],
+ "name": "registerAssetProxy",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "addOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "name": "isFunctionRemoveAuthorizedAddressAtIndex",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "isConfirmed",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_secondsTimeLocked",
+ "type": "uint256"
+ }
+ ],
+ "name": "changeTimeLock",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "isAssetProxyRegistered",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getConfirmationCount",
+ "outputs": [
+ {
+ "name": "count",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "transactions",
+ "outputs": [
+ {
+ "name": "destination",
+ "type": "address"
+ },
+ {
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getOwners",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "from",
+ "type": "uint256"
+ },
+ {
+ "name": "to",
+ "type": "uint256"
+ },
+ {
+ "name": "pending",
+ "type": "bool"
+ },
+ {
+ "name": "executed",
+ "type": "bool"
+ }
+ ],
+ "name": "getTransactionIds",
+ "outputs": [
+ {
+ "name": "_transactionIds",
+ "type": "uint256[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "getConfirmations",
+ "outputs": [
+ {
+ "name": "_confirmations",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "transactionCount",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_required",
+ "type": "uint256"
+ }
+ ],
+ "name": "changeRequirement",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "confirmTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "id",
+ "type": "uint256"
+ }
+ ],
+ "name": "testValidRemoveAuthorizedAddressAtIndexTx",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "destination",
+ "type": "address"
+ },
+ {
+ "name": "value",
+ "type": "uint256"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ }
+ ],
+ "name": "submitTransaction",
+ "outputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "confirmationTimes",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "MAX_OWNER_COUNT",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "required",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "owner",
+ "type": "address"
+ },
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "replaceOwner",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "executeTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_owners",
+ "type": "address[]"
+ },
+ {
+ "name": "_assetProxyContracts",
+ "type": "address[]"
+ },
+ {
+ "name": "_required",
+ "type": "uint256"
+ },
+ {
+ "name": "_secondsTimeLocked",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "fallback"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "assetProxyContract",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "isRegistered",
+ "type": "bool"
+ }
+ ],
+ "name": "AssetProxyRegistration",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "confirmationTime",
+ "type": "uint256"
+ }
+ ],
+ "name": "ConfirmationTimeSet",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "secondsTimeLocked",
+ "type": "uint256"
+ }
+ ],
+ "name": "TimeLockChange",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Confirmation",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Revocation",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Submission",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "Execution",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "transactionId",
+ "type": "uint256"
+ }
+ ],
+ "name": "ExecutionFailure",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "sender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Deposit",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnerAddition",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "owner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnerRemoval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "required",
+ "type": "uint256"
+ }
+ ],
+ "name": "RequirementChange",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040523480156200001157600080fd5b50604051620027e6380380620027e683398101604090815281516020830151918301516060840151918401805190949390930192909190849084908490849060009081908690859085908390839086908260328211801590620000745750818111155b80156200008057508015155b80156200008c57508115155b15156200009857600080fd5b600092505b84518310156200017057600260008685815181101515620000ba57fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff161580156200011057508483815181101515620000f857fe5b90602001906020020151600160a060020a0316600014155b15156200011c57600080fd5b60016002600087868151811015156200013157fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff1916911515919091179055600192909201916200009d565b84516200018590600390602088019062000278565b50505060049190915550506006555060009250505b845182101562000268578482815181101515620001b357fe5b602090810290910101519050600160a060020a03811615156200023757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e56414c49445f41535345545f50524f585900000000000000000000000000604482015290519081900360640190fd5b600160a060020a0381166000908152600860205260409020805460ff1916600190811790915591909101906200019a565b505050505050505050506200030c565b828054828255906000526020600020908101928215620002d0579160200282015b82811115620002d05782518254600160a060020a031916600160a060020a0390911617825560209092019160019091019062000299565b50620002de929150620002e2565b5090565b6200030991905b80821115620002de578054600160a060020a0319168155600101620002e9565b90565b6124ca806200031c6000396000f3006080604052600436106101745763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c2781146101b6578063173825d9146101f757806320ea8d86146102255780632f54bf6e1461023d5780633411c81c1461027f5780633589b35c146102b057806337bd78a0146102c857806354741525146102ef5780635a1a66af1461030e5780637065cb481461034157806372cbe61d1461036f578063784547a7146103c85780637ad28c51146103e057806383250f79146103f85780638b51d13f146104265780639ace38c21461043e578063a0e67e2b14610513578063a8abe69a14610578578063b5dc40c31461059d578063b77bf600146105b5578063ba51a6df146105ca578063c01a8c84146105e2578063c296e43c146105fa578063c642747414610612578063d38f2d8214610688578063d74f8edd146106a0578063dc8452cd146106b5578063e20056e6146106ca578063ee22610b146106fe575b60003411156101b45760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b3480156101c257600080fd5b506101ce600435610716565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561020357600080fd5b506101b473ffffffffffffffffffffffffffffffffffffffff6004351661074b565b34801561023157600080fd5b506101b46004356109a2565b34801561024957600080fd5b5061026b73ffffffffffffffffffffffffffffffffffffffff60043516610a7a565b604080519115158252519081900360200190f35b34801561028b57600080fd5b5061026b60043573ffffffffffffffffffffffffffffffffffffffff60243516610a8f565b3480156102bc57600080fd5b506101b4600435610aaf565b3480156102d457600080fd5b506102dd610f61565b60408051918252519081900360200190f35b3480156102fb57600080fd5b506102dd60043515156024351515610f67565b34801561031a57600080fd5b506101b473ffffffffffffffffffffffffffffffffffffffff600435166024351515610fd3565b34801561034d57600080fd5b506101b473ffffffffffffffffffffffffffffffffffffffff60043516611092565b34801561037b57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261026b9436949293602493928401919081908401838280828437509497506112079650505050505050565b3480156103d457600080fd5b5061026b6004356112bd565b3480156103ec57600080fd5b506101b460043561134e565b34801561040457600080fd5b5061026b73ffffffffffffffffffffffffffffffffffffffff60043516611395565b34801561043257600080fd5b506102dd6004356113aa565b34801561044a57600080fd5b50610456600435611426565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d55781810151838201526020016104bd565b50505050905090810190601f1680156105025780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561051f57600080fd5b5061052861150f565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561056457818101518382015260200161054c565b505050509050019250505060405180910390f35b34801561058457600080fd5b506105286004356024356044351515606435151561157f565b3480156105a957600080fd5b506105286004356116b8565b3480156105c157600080fd5b506102dd611865565b3480156105d657600080fd5b506101b460043561186b565b3480156105ee57600080fd5b506101b46004356118ea565b34801561060657600080fd5b5061026b600435611a5e565b34801561061e57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526102dd94823573ffffffffffffffffffffffffffffffffffffffff16946024803595369594606494920191908190840183828082843750949750611c989650505050505050565b34801561069457600080fd5b506102dd600435611cb7565b3480156106ac57600080fd5b506102dd611cc9565b3480156106c157600080fd5b506102dd611cce565b3480156106d657600080fd5b506101b473ffffffffffffffffffffffffffffffffffffffff60043581169060243516611cd4565b34801561070a57600080fd5b506101b4600435611ee4565b600380548290811061072457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b600033301461075957600080fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054829060ff16151561078f57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905591505b6003547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01821015610912578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561082f57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561090757600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061088757fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff90921691849081106108ba57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610912565b6001909101906107dd565b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061094390826123dd565b50600354600454111561095c5760035461095c9061186b565b60405173ffffffffffffffffffffffffffffffffffffffff8416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff1615156109c057600080fd5b60008281526001602090815260408083203380855292529091205483919060ff1615156109ec57600080fd5b600084815260208190526040902060030154849060ff1615610a0d57600080fd5b600085815260016020908152604080832033808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b600081815260208190526040812060030154829060ff1615610ad057600080fd5b82610ada816112bd565b1515610b4757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604482015290519081900360640190fd5b600084815260208181526040808320805473ffffffffffffffffffffffffffffffffffffffff16845260089092529091205485919060ff161515610bec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f554e524547495354455245445f41535345545f50524f58590000000000000000604482015290519081900360640190fd5b604080517f72656d6f7665417574686f72697a6564416464726573734174496e646578286181527f6464726573732c75696e74323536290000000000000000000000000000000000602080830191909152825191829003602f01822060028086018054601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018416150201909116929092049182018490048402850184019095528084527fffffffff0000000000000000000000000000000000000000000000000000000090911693610d2893600093909290830182828015610d155780601f10610cea57610100808354040283529160200191610d15565b820191906000526020600020905b815481529060010190602001808311610cf857829003601f168201915b505050505061217490919063ffffffff16565b7fffffffff000000000000000000000000000000000000000000000000000000001614610db657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f494e56414c49445f46554e4354494f4e5f53454c4543544f5200000000000000604482015290519081900360640190fd5b600086815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff97831615610100029790970190911692909204948501879004870282018701909752838152939a50610ece9573ffffffffffffffffffffffffffffffffffffffff90921694909391908390830182828015610ec45780601f10610e9957610100808354040283529160200191610ec4565b820191906000526020600020905b815481529060010190602001808311610ea757829003601f168201915b505050505061223c565b15610f035760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2610f59565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003850180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b505050505050565b60065481565b6000805b600554811015610fcc57838015610f94575060008181526020819052604090206003015460ff16155b80610fb85750828015610fb8575060008181526020819052604090206003015460ff165b15610fc4576001820191505b600101610f6b565b5092915050565b333014610fdf57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff8116151561100257600080fd5b73ffffffffffffffffffffffffffffffffffffffff831660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915582519384529083015280517fdaef8ff7dc66c5e34eb9c338aab679d9f427f89868d9228494455a4d982eb2b09281900390910190a1505050565b33301461109e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054819060ff16156110d357600080fd5b8173ffffffffffffffffffffffffffffffffffffffff811615156110f657600080fd5b600380549050600101600454603282111580156111135750818111155b801561111e57508015155b801561112957508115155b151561113457600080fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b604080517f72656d6f7665417574686f72697a6564416464726573734174496e646578286181527f6464726573732c75696e743235362900000000000000000000000000000000006020820152905190819003602f0190206000907fffffffff0000000000000000000000000000000000000000000000000000000016611294838363ffffffff61217416565b7fffffffff00000000000000000000000000000000000000000000000000000000161492915050565b600080805b60035481101561134757600084815260016020526040812060038054919291849081106112eb57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff161561132c576001820191505b60045482141561133f5760019250611347565b6001016112c2565b5050919050565b33301461135a57600080fd5b60068190556040805182815290517fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b43779181900360200190a150565b60086020526000908152604090205460ff1681565b6000805b60035481101561142057600083815260016020526040812060038054919291849081106113d757fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615611418576001820191505b6001016113ae565b50919050565b60006020818152918152604090819020805460018083015460028085018054875161010095821615959095027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f810188900488028401880190965285835273ffffffffffffffffffffffffffffffffffffffff909316959094919291908301828280156114fc5780601f106114d1576101008083540402835291602001916114fc565b820191906000526020600020905b8154815290600101906020018083116114df57829003601f168201915b5050506003909301549192505060ff1684565b6060600380548060200260200160405190810160405280929190818152602001828054801561157457602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611549575b505050505090505b90565b6060806000806005546040519080825280602002602001820160405280156115b1578160200160208202803883390190505b50925060009150600090505b600554811015611638578580156115e6575060008181526020819052604090206003015460ff16155b8061160a575084801561160a575060008181526020819052604090206003015460ff165b156116305780838381518110151561161e57fe5b60209081029091010152600191909101905b6001016115bd565b878703604051908082528060200260200182016040528015611664578160200160208202803883390190505b5093508790505b868110156116ad57828181518110151561168157fe5b906020019060200201518489830381518110151561169b57fe5b6020908102909101015260010161166b565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156116ed578160200160208202803883390190505b50925060009150600090505b6003548110156117d1576000858152600160205260408120600380549192918490811061172257fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff16156117c957600380548290811061176a57fe5b600091825260209091200154835173ffffffffffffffffffffffffffffffffffffffff9091169084908490811061179d57fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600191909101905b6001016116f9565b816040519080825280602002602001820160405280156117fb578160200160208202803883390190505b509350600090505b8181101561185d57828181518110151561181957fe5b90602001906020020151848281518110151561183157fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600101611803565b505050919050565b60055481565b33301461187757600080fd5b600354816032821180159061188c5750818111155b801561189757508015155b80156118a257508115155b15156118ad57600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff16151561190857600080fd5b600082815260208190526040902054829073ffffffffffffffffffffffffffffffffffffffff16151561193a57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff161561196557600080fd5b8461196f816112bd565b156119db57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f54585f46554c4c595f434f4e4649524d45440000000000000000000000000000604482015290519081900360640190fd5b600086815260016020818152604080842033808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909317909255905188927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3611a4f866112bd565b15610f5957610f59864261225f565b600081815260208181526040808320805473ffffffffffffffffffffffffffffffffffffffff168452600890925282205483919060ff161515611b0257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f554e524547495354455245445f41535345545f50524f58590000000000000000604482015290519081900360640190fd5b604080517f72656d6f7665417574686f72697a6564416464726573734174496e646578286181527f6464726573732c75696e74323536290000000000000000000000000000000000602080830191909152825191829003602f01822060028086018054601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018416150201909116929092049182018490048402850184019095528084527fffffffff0000000000000000000000000000000000000000000000000000000090911693611c0093600093909290830182828015610d155780601f10610cea57610100808354040283529160200191610d15565b7fffffffff000000000000000000000000000000000000000000000000000000001614611c8e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f494e56414c49445f46554e4354494f4e5f53454c4543544f5200000000000000604482015290519081900360640190fd5b5060019392505050565b6000611ca58484846122aa565b9050611cb0816118ea565b9392505050565b60076020526000908152604090205481565b603281565b60045481565b6000333014611ce257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff161515611d1857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff1615611d4d57600080fd5b600092505b600354831015611e12578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611d8257fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611e075783600384815481101515611dba57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611e12565b600190920191611d52565b73ffffffffffffffffffffffffffffffffffffffff80861660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a260405173ffffffffffffffffffffffffffffffffffffffff8516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b600081815260208190526040812060030154829060ff1615611f0557600080fd5b82611f0f816112bd565b1515611f7c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604482015290519081900360640190fd5b600654600085815260076020526040902054859101421015611fff57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f54494d455f4c4f434b5f494e434f4d504c455445000000000000000000000000604482015290519081900360640190fd5b600085815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff978316156101000297909701909116929092049485018790048702820187019097528381529399506120e29573ffffffffffffffffffffffffffffffffffffffff90921694909391908390830182828015610ec45780601f10610e9957610100808354040283529160200191610ec4565b156121175760405185907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a261216d565b60405185907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b5050505050565b60008160040183511015151561221157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160448201527f5549524544000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b6000828152600760209081526040918290208390558151838152915184927f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d92908290030190a25050565b60008373ffffffffffffffffffffffffffffffffffffffff811615156122cf57600080fd5b6005546040805160808101825273ffffffffffffffffffffffffffffffffffffffff8881168252602080830189815283850189815260006060860181905287815280845295909520845181547fffffffffffffffffffffffff00000000000000000000000000000000000000001694169390931783555160018301559251805194965091939092612367926002850192910190612406565b5060609190910151600390910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b81548183558181111561240157600083815260209020612401918101908301612484565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061244757805160ff1916838001178555612474565b82800160010185558215612474579182015b82811115612474578251825591602001919060010190612459565b50612480929150612484565b5090565b61157c91905b80821115612480576000815560010161248a5600a165627a7a72305820c3531da3b2f302406663b78875d8ee2a4b187969553730d3a9e04bc55e0b22850029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x27E6 CODESIZE SUB DUP1 PUSH3 0x27E6 DUP4 CODECOPY DUP2 ADD PUSH1 0x40 SWAP1 DUP2 MSTORE DUP2 MLOAD PUSH1 0x20 DUP4 ADD MLOAD SWAP2 DUP4 ADD MLOAD PUSH1 0x60 DUP5 ADD MLOAD SWAP2 DUP5 ADD DUP1 MLOAD SWAP1 SWAP5 SWAP4 SWAP1 SWAP4 ADD SWAP3 SWAP1 SWAP2 SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP5 SWAP1 PUSH1 0x0 SWAP1 DUP2 SWAP1 DUP7 SWAP1 DUP6 SWAP1 DUP6 SWAP1 DUP4 SWAP1 DUP4 SWAP1 DUP7 SWAP1 DUP3 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH3 0x74 JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH3 0x80 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH3 0x8C JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH3 0x98 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST DUP5 MLOAD DUP4 LT ISZERO PUSH3 0x170 JUMPI PUSH1 0x2 PUSH1 0x0 DUP7 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0xBA JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP3 MSTORE DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x40 ADD PUSH1 0x0 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO DUP1 ISZERO PUSH3 0x110 JUMPI POP DUP5 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0xF8 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND PUSH1 0x0 EQ ISZERO JUMPDEST ISZERO ISZERO PUSH3 0x11C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0x2 PUSH1 0x0 DUP8 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x131 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP2 SWAP1 SWAP2 ADD DUP2 ADD MLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND DUP3 MSTORE DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x40 ADD PUSH1 0x0 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x1 SWAP3 SWAP1 SWAP3 ADD SWAP2 PUSH3 0x9D JUMP JUMPDEST DUP5 MLOAD PUSH3 0x185 SWAP1 PUSH1 0x3 SWAP1 PUSH1 0x20 DUP9 ADD SWAP1 PUSH3 0x278 JUMP JUMPDEST POP POP POP PUSH1 0x4 SWAP2 SWAP1 SWAP2 SSTORE POP POP PUSH1 0x6 SSTORE POP PUSH1 0x0 SWAP3 POP POP JUMPDEST DUP5 MLOAD DUP3 LT ISZERO PUSH3 0x268 JUMPI DUP5 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x1B3 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD SWAP1 POP PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP2 AND ISZERO ISZERO PUSH3 0x237 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x13 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F41535345545F50524F585900000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH3 0x19A JUMP JUMPDEST POP POP POP POP POP POP POP POP POP POP PUSH3 0x30C JUMP JUMPDEST DUP3 DUP1 SLOAD DUP3 DUP3 SSTORE SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 DUP2 ADD SWAP3 DUP3 ISZERO PUSH3 0x2D0 JUMPI SWAP2 PUSH1 0x20 MUL DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0x2D0 JUMPI DUP3 MLOAD DUP3 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP2 AND OR DUP3 SSTORE PUSH1 0x20 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH3 0x299 JUMP JUMPDEST POP PUSH3 0x2DE SWAP3 SWAP2 POP PUSH3 0x2E2 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x309 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x2DE JUMPI DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x2E9 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x24CA DUP1 PUSH3 0x31C PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x174 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x25E7C27 DUP2 EQ PUSH2 0x1B6 JUMPI DUP1 PUSH4 0x173825D9 EQ PUSH2 0x1F7 JUMPI DUP1 PUSH4 0x20EA8D86 EQ PUSH2 0x225 JUMPI DUP1 PUSH4 0x2F54BF6E EQ PUSH2 0x23D JUMPI DUP1 PUSH4 0x3411C81C EQ PUSH2 0x27F JUMPI DUP1 PUSH4 0x3589B35C EQ PUSH2 0x2B0 JUMPI DUP1 PUSH4 0x37BD78A0 EQ PUSH2 0x2C8 JUMPI DUP1 PUSH4 0x54741525 EQ PUSH2 0x2EF JUMPI DUP1 PUSH4 0x5A1A66AF EQ PUSH2 0x30E JUMPI DUP1 PUSH4 0x7065CB48 EQ PUSH2 0x341 JUMPI DUP1 PUSH4 0x72CBE61D EQ PUSH2 0x36F JUMPI DUP1 PUSH4 0x784547A7 EQ PUSH2 0x3C8 JUMPI DUP1 PUSH4 0x7AD28C51 EQ PUSH2 0x3E0 JUMPI DUP1 PUSH4 0x83250F79 EQ PUSH2 0x3F8 JUMPI DUP1 PUSH4 0x8B51D13F EQ PUSH2 0x426 JUMPI DUP1 PUSH4 0x9ACE38C2 EQ PUSH2 0x43E JUMPI DUP1 PUSH4 0xA0E67E2B EQ PUSH2 0x513 JUMPI DUP1 PUSH4 0xA8ABE69A EQ PUSH2 0x578 JUMPI DUP1 PUSH4 0xB5DC40C3 EQ PUSH2 0x59D JUMPI DUP1 PUSH4 0xB77BF600 EQ PUSH2 0x5B5 JUMPI DUP1 PUSH4 0xBA51A6DF EQ PUSH2 0x5CA JUMPI DUP1 PUSH4 0xC01A8C84 EQ PUSH2 0x5E2 JUMPI DUP1 PUSH4 0xC296E43C EQ PUSH2 0x5FA JUMPI DUP1 PUSH4 0xC6427474 EQ PUSH2 0x612 JUMPI DUP1 PUSH4 0xD38F2D82 EQ PUSH2 0x688 JUMPI DUP1 PUSH4 0xD74F8EDD EQ PUSH2 0x6A0 JUMPI DUP1 PUSH4 0xDC8452CD EQ PUSH2 0x6B5 JUMPI DUP1 PUSH4 0xE20056E6 EQ PUSH2 0x6CA JUMPI DUP1 PUSH4 0xEE22610B EQ PUSH2 0x6FE JUMPI JUMPDEST PUSH1 0x0 CALLVALUE GT ISZERO PUSH2 0x1B4 JUMPI PUSH1 0x40 DUP1 MLOAD CALLVALUE DUP2 MSTORE SWAP1 MLOAD CALLER SWAP2 PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C SWAP2 SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG2 JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1C2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1CE PUSH1 0x4 CALLDATALOAD PUSH2 0x716 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x203 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x74B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x231 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0x9A2 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x249 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xA7A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x28B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH1 0x4 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x24 CALLDATALOAD AND PUSH2 0xA8F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0xAAF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2D4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0xF61 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2FB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH1 0x4 CALLDATALOAD ISZERO ISZERO PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xF67 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x31A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xFD3 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x34D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x1092 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x37B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x26B SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x1207 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3D4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH1 0x4 CALLDATALOAD PUSH2 0x12BD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3EC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0x134E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x404 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x1395 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x432 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH1 0x4 CALLDATALOAD PUSH2 0x13AA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x44A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x456 PUSH1 0x4 CALLDATALOAD PUSH2 0x1426 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x4D5 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x4BD JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x502 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP6 POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x51F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x528 PUSH2 0x150F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x564 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x54C JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x584 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x528 PUSH1 0x4 CALLDATALOAD PUSH1 0x24 CALLDATALOAD PUSH1 0x44 CALLDATALOAD ISZERO ISZERO PUSH1 0x64 CALLDATALOAD ISZERO ISZERO PUSH2 0x157F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x528 PUSH1 0x4 CALLDATALOAD PUSH2 0x16B8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5C1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x1865 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0x186B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0x18EA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x606 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH1 0x4 CALLDATALOAD PUSH2 0x1A5E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x61E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x2DD SWAP5 DUP3 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x1C98 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x694 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH1 0x4 CALLDATALOAD PUSH2 0x1CB7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6AC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x1CC9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6C1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x1CCE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x1CD4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x70A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0x1EE4 JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x724 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x759 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x78F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP2 POP JUMPDEST PUSH1 0x3 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP3 LT ISZERO PUSH2 0x912 JUMPI DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x82F JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x907 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x887 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x3 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x8BA JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x912 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x7DD JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x943 SWAP1 DUP3 PUSH2 0x23DD JUMP JUMPDEST POP PUSH1 0x3 SLOAD PUSH1 0x4 SLOAD GT ISZERO PUSH2 0x95C JUMPI PUSH1 0x3 SLOAD PUSH2 0x95C SWAP1 PUSH2 0x186B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x9C0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP4 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x9EC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD DUP5 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xA0D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE MLOAD DUP8 SWAP3 PUSH32 0xF6A317157440607F36269043EB55F1287A5A19BA2216AFEAB88CD46CBCFB88E9 SWAP2 LOG3 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 ADD SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xAD0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 PUSH2 0xADA DUP2 PUSH2 0x12BD JUMP JUMPDEST ISZERO ISZERO PUSH2 0xB47 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F4E4F545F46554C4C595F434F4E4649524D454400000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 MSTORE PUSH1 0x8 SWAP1 SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP6 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0xBEC JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x18 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x554E524547495354455245445F41535345545F50524F58590000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x72656D6F7665417574686F72697A6564416464726573734174496E6465782861 DUP2 MSTORE PUSH32 0x6464726573732C75696E74323536290000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP3 MLOAD SWAP2 DUP3 SWAP1 SUB PUSH1 0x2F ADD DUP3 KECCAK256 PUSH1 0x2 DUP1 DUP7 ADD DUP1 SLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP5 AND ISZERO MUL ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP2 DUP3 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP1 DUP5 MSTORE PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP2 AND SWAP4 PUSH2 0xD28 SWAP4 PUSH1 0x0 SWAP4 SWAP1 SWAP3 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xD15 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xCEA JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD15 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xCF8 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x2174 SWAP1 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND EQ PUSH2 0xDB6 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F46554E4354494F4E5F53454C4543544F5200000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP11 POP PUSH2 0xECE SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xEC4 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xE99 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xEC4 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xEA7 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x223C JUMP JUMPDEST ISZERO PUSH2 0xF03 JUMPI PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0xF59 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP6 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0xFCC JUMPI DUP4 DUP1 ISZERO PUSH2 0xF94 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0xFB8 JUMPI POP DUP3 DUP1 ISZERO PUSH2 0xFB8 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0xFC4 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0xF6B JUMP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0xFDF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x1002 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP7 ISZERO ISZERO SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP3 MLOAD SWAP4 DUP5 MSTORE SWAP1 DUP4 ADD MSTORE DUP1 MLOAD PUSH32 0xDAEF8FF7DC66C5E34EB9C338AAB679D9F427F89868D9228494455A4D982EB2B0 SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x109E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x10D3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x10F6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x1 ADD PUSH1 0x4 SLOAD PUSH1 0x32 DUP3 GT ISZERO DUP1 ISZERO PUSH2 0x1113 JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x111E JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1129 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x1134 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE PUSH1 0x3 DUP1 SLOAD SWAP2 DUP3 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0xC2575A0E9E593C00F959F8C92F12DB2869C3395A3B0502D05E2516446F71F85B ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP2 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x72656D6F7665417574686F72697A6564416464726573734174496E6465782861 DUP2 MSTORE PUSH32 0x6464726573732C75696E74323536290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 PUSH1 0x0 SWAP1 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND PUSH2 0x1294 DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x2174 AND JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND EQ SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x1347 JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x12EB JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x132C JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x4 SLOAD DUP3 EQ ISZERO PUSH2 0x133F JUMPI PUSH1 0x1 SWAP3 POP PUSH2 0x1347 JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0x12C2 JUMP JUMPDEST POP POP SWAP2 SWAP1 POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x135A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x6 DUP2 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xD1C9101A34FEFF75CCCEF14A28785A0279CB0B49C1F321F21F5F422E746B4377 SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP JUMP JUMPDEST PUSH1 0x8 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x1420 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x13D7 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x1418 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0x13AE JUMP JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP2 DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP1 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP8 MLOAD PUSH2 0x100 SWAP6 DUP3 AND ISZERO SWAP6 SWAP1 SWAP6 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD AND SWAP2 SWAP1 SWAP2 DIV PUSH1 0x1F DUP2 ADD DUP9 SWAP1 DIV DUP9 MUL DUP5 ADD DUP9 ADD SWAP1 SWAP7 MSTORE DUP6 DUP4 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND SWAP6 SWAP1 SWAP5 SWAP2 SWAP3 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x14FC JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x14D1 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x14FC JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x14DF JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP PUSH1 0x3 SWAP1 SWAP4 ADD SLOAD SWAP2 SWAP3 POP POP PUSH1 0xFF AND DUP5 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0x1574 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1549 JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x5 SLOAD PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x15B1 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0x1638 JUMPI DUP6 DUP1 ISZERO PUSH2 0x15E6 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0x160A JUMPI POP DUP5 DUP1 ISZERO PUSH2 0x160A JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0x1630 JUMPI DUP1 DUP4 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x161E JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0x15BD JUMP JUMPDEST DUP8 DUP8 SUB PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x1664 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP DUP8 SWAP1 POP JUMPDEST DUP7 DUP2 LT ISZERO PUSH2 0x16AD JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1681 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP10 DUP4 SUB DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x169B JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x166B JUMP JUMPDEST POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x16ED JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x17D1 JUMPI PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x1722 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x17C9 JUMPI PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x176A JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD DUP4 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP2 LT PUSH2 0x179D JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0x16F9 JUMP JUMPDEST DUP2 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x17FB JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x185D JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1819 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1831 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 ADD PUSH2 0x1803 JUMP JUMPDEST POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x5 SLOAD DUP2 JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x1877 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 SLOAD DUP2 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH2 0x188C JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1897 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x18A2 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x18AD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x4 DUP4 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP5 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xA3F1EE9126A074D9326C682F561767F710E927FAA811F7A99829D49DC421797A SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1908 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO ISZERO PUSH2 0x193A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP5 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1965 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 PUSH2 0x196F DUP2 PUSH2 0x12BD JUMP JUMPDEST ISZERO PUSH2 0x19DB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F46554C4C595F434F4E4649524D45440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 CALLER DUP1 DUP7 MSTORE SWAP3 MSTORE DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SWAP4 OR SWAP1 SWAP3 SSTORE SWAP1 MLOAD DUP9 SWAP3 PUSH32 0x4A504A94899432A9846E1AA406DCEB1BCFD538BB839071D49D1E5E23F5BE30EF SWAP2 LOG3 PUSH2 0x1A4F DUP7 PUSH2 0x12BD JUMP JUMPDEST ISZERO PUSH2 0xF59 JUMPI PUSH2 0xF59 DUP7 TIMESTAMP PUSH2 0x225F JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 MSTORE PUSH1 0x8 SWAP1 SWAP3 MSTORE DUP3 KECCAK256 SLOAD DUP4 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1B02 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x18 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x554E524547495354455245445F41535345545F50524F58590000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x72656D6F7665417574686F72697A6564416464726573734174496E6465782861 DUP2 MSTORE PUSH32 0x6464726573732C75696E74323536290000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP3 MLOAD SWAP2 DUP3 SWAP1 SUB PUSH1 0x2F ADD DUP3 KECCAK256 PUSH1 0x2 DUP1 DUP7 ADD DUP1 SLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP5 AND ISZERO MUL ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP2 DUP3 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP1 DUP5 MSTORE PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP2 AND SWAP4 PUSH2 0x1C00 SWAP4 PUSH1 0x0 SWAP4 SWAP1 SWAP3 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xD15 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xCEA JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD15 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND EQ PUSH2 0x1C8E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F46554E4354494F4E5F53454C4543544F5200000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH1 0x1 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1CA5 DUP5 DUP5 DUP5 PUSH2 0x22AA JUMP JUMPDEST SWAP1 POP PUSH2 0x1CB0 DUP2 PUSH2 0x18EA JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x32 DUP2 JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x1CE2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1D18 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1D4D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST PUSH1 0x3 SLOAD DUP4 LT ISZERO PUSH2 0x1E12 JUMPI DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1D82 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x1E07 JUMPI DUP4 PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1DBA JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x1E12 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x1D52 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 SWAP1 DUP2 AND SWAP1 SWAP2 SSTORE SWAP4 DUP9 AND DUP3 MSTORE DUP1 DUP3 KECCAK256 DUP1 SLOAD SWAP1 SWAP5 AND PUSH1 0x1 OR SWAP1 SWAP4 SSTORE SWAP2 MLOAD SWAP1 SWAP2 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP2 LOG2 PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP1 PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 ADD SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1F05 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 PUSH2 0x1F0F DUP2 PUSH2 0x12BD JUMP JUMPDEST ISZERO ISZERO PUSH2 0x1F7C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F4E4F545F46554C4C595F434F4E4649524D454400000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x6 SLOAD PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP6 SWAP2 ADD TIMESTAMP LT ISZERO PUSH2 0x1FFF JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x14 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54494D455F4C4F434B5F494E434F4D504C455445000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP10 POP PUSH2 0x20E2 SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xEC4 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xE99 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xEC4 JUMP JUMPDEST ISZERO PUSH2 0x2117 JUMPI PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0x216D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP5 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x4 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x2211 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x25 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F345F4C454E4754485F524551 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5549524544000000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 MLOAD PUSH1 0x20 DUP5 ADD PUSH1 0x0 DUP3 DUP8 DUP4 DUP11 DUP13 PUSH2 0x8796 GAS SUB CALL SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP4 SWAP1 SSTORE DUP2 MLOAD DUP4 DUP2 MSTORE SWAP2 MLOAD DUP5 SWAP3 PUSH32 0xB237AFE65F1514FD7EA3F923EA4FE792BDD07000A912B6CD1602A8E7F573C8D SWAP3 SWAP1 DUP3 SWAP1 SUB ADD SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x22CF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x80 DUP2 ADD DUP3 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 DUP2 AND DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD DUP10 DUP2 MSTORE DUP4 DUP6 ADD DUP10 DUP2 MSTORE PUSH1 0x0 PUSH1 0x60 DUP7 ADD DUP2 SWAP1 MSTORE DUP8 DUP2 MSTORE DUP1 DUP5 MSTORE SWAP6 SWAP1 SWAP6 KECCAK256 DUP5 MLOAD DUP2 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 SSTORE MLOAD PUSH1 0x1 DUP4 ADD SSTORE SWAP3 MLOAD DUP1 MLOAD SWAP5 SWAP7 POP SWAP2 SWAP4 SWAP1 SWAP3 PUSH2 0x2367 SWAP3 PUSH1 0x2 DUP6 ADD SWAP3 SWAP2 ADD SWAP1 PUSH2 0x2406 JUMP JUMPDEST POP PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD MLOAD PUSH1 0x3 SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x5 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE PUSH1 0x40 MLOAD DUP3 SWAP1 PUSH32 0xC0BA8FE4B176C1714197D43B9CC6BCF797A4A7461C5FE8D0EF6E184AE7601E51 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0x2401 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0x2401 SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0x2484 JUMP JUMPDEST POP POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x2447 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x2474 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x2474 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x2474 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x2459 JUMP JUMPDEST POP PUSH2 0x2480 SWAP3 SWAP2 POP PUSH2 0x2484 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x157C SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x2480 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x248A JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xc3 MSTORE8 SAR LOG3 0xb2 RETURN MUL BLOCKHASH PUSH7 0x63B78875D8EE2A 0x4b XOR PUSH26 0x69553730D3A9E04BC55E0B228500290000000000000000000000 ",
+ "sourceMap": "703:1046:63:-;;;761:270;8:9:-1;5:2;;;30:1;27;20:12;5:2;761:270:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2934:14:16;;761:270:63;;;;;;;;;;;;;;;;;;2570:9:25;;;;761:270:63;;;;;;;;;;2570:9:25;;761:270:63;839:2:16;2273:29;;;;;:68;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;2987:1;2980:8;;2975:151;2992:7;:14;2990:1;:16;2975:151;;;3036:7;:19;3044:7;3052:1;3044:10;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3036:19:16;;;;;;;;;;;-1:-1:-1;3036:19:16;;;;3035:20;:39;;;;;3059:7;3067:1;3059:10;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3059:15:16;3073:1;3059:15;;3035:39;3027:48;;;;;;;;3111:4;3089:7;:19;3097:7;3105:1;3097:10;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3089:19:16;;;;;;;;;;;-1:-1:-1;3089:19:16;:26;;-1:-1:-1;;3089:26:16;;;;;;;;;;-1:-1:-1;3008:3:16;;;;;2975:151;;;3135:16;;;;:6;;:16;;;;;:::i;:::-;-1:-1:-1;;;3161:8:16;:20;;;;-1:-1:-1;;2245:17:17;:38;-1:-1:-1;;;;;2565:298:25;2589:20;:27;2585:1;:31;2565:298;;;2658:20;2679:1;2658:23;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;2720:24:25;;;;2695:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;2811:34:25;;;;;;:22;:34;;;;;:41;;-1:-1:-1;;2811:41:25;2848:4;2811:41;;;;;;2618:3;;;;;2565:298;;;2298:571;;;;;;761:270:63;;;;703:1046;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;703:1046:63;-1:-1:-1;;;;;703:1046:63;;;;;;;;;;;-1:-1:-1;703:1046:63;;;;;;;-1:-1:-1;703:1046:63;;;-1:-1:-1;703:1046:63;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;-1:-1:-1;;;;;;703:1046:63;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106101745763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c2781146101b6578063173825d9146101f757806320ea8d86146102255780632f54bf6e1461023d5780633411c81c1461027f5780633589b35c146102b057806337bd78a0146102c857806354741525146102ef5780635a1a66af1461030e5780637065cb481461034157806372cbe61d1461036f578063784547a7146103c85780637ad28c51146103e057806383250f79146103f85780638b51d13f146104265780639ace38c21461043e578063a0e67e2b14610513578063a8abe69a14610578578063b5dc40c31461059d578063b77bf600146105b5578063ba51a6df146105ca578063c01a8c84146105e2578063c296e43c146105fa578063c642747414610612578063d38f2d8214610688578063d74f8edd146106a0578063dc8452cd146106b5578063e20056e6146106ca578063ee22610b146106fe575b60003411156101b45760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b3480156101c257600080fd5b506101ce600435610716565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561020357600080fd5b506101b473ffffffffffffffffffffffffffffffffffffffff6004351661074b565b34801561023157600080fd5b506101b46004356109a2565b34801561024957600080fd5b5061026b73ffffffffffffffffffffffffffffffffffffffff60043516610a7a565b604080519115158252519081900360200190f35b34801561028b57600080fd5b5061026b60043573ffffffffffffffffffffffffffffffffffffffff60243516610a8f565b3480156102bc57600080fd5b506101b4600435610aaf565b3480156102d457600080fd5b506102dd610f61565b60408051918252519081900360200190f35b3480156102fb57600080fd5b506102dd60043515156024351515610f67565b34801561031a57600080fd5b506101b473ffffffffffffffffffffffffffffffffffffffff600435166024351515610fd3565b34801561034d57600080fd5b506101b473ffffffffffffffffffffffffffffffffffffffff60043516611092565b34801561037b57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261026b9436949293602493928401919081908401838280828437509497506112079650505050505050565b3480156103d457600080fd5b5061026b6004356112bd565b3480156103ec57600080fd5b506101b460043561134e565b34801561040457600080fd5b5061026b73ffffffffffffffffffffffffffffffffffffffff60043516611395565b34801561043257600080fd5b506102dd6004356113aa565b34801561044a57600080fd5b50610456600435611426565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104d55781810151838201526020016104bd565b50505050905090810190601f1680156105025780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561051f57600080fd5b5061052861150f565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561056457818101518382015260200161054c565b505050509050019250505060405180910390f35b34801561058457600080fd5b506105286004356024356044351515606435151561157f565b3480156105a957600080fd5b506105286004356116b8565b3480156105c157600080fd5b506102dd611865565b3480156105d657600080fd5b506101b460043561186b565b3480156105ee57600080fd5b506101b46004356118ea565b34801561060657600080fd5b5061026b600435611a5e565b34801561061e57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526102dd94823573ffffffffffffffffffffffffffffffffffffffff16946024803595369594606494920191908190840183828082843750949750611c989650505050505050565b34801561069457600080fd5b506102dd600435611cb7565b3480156106ac57600080fd5b506102dd611cc9565b3480156106c157600080fd5b506102dd611cce565b3480156106d657600080fd5b506101b473ffffffffffffffffffffffffffffffffffffffff60043581169060243516611cd4565b34801561070a57600080fd5b506101b4600435611ee4565b600380548290811061072457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b600033301461075957600080fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054829060ff16151561078f57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905591505b6003547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01821015610912578273ffffffffffffffffffffffffffffffffffffffff1660038381548110151561082f57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561090757600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061088757fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff90921691849081106108ba57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610912565b6001909101906107dd565b600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061094390826123dd565b50600354600454111561095c5760035461095c9061186b565b60405173ffffffffffffffffffffffffffffffffffffffff8416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff1615156109c057600080fd5b60008281526001602090815260408083203380855292529091205483919060ff1615156109ec57600080fd5b600084815260208190526040902060030154849060ff1615610a0d57600080fd5b600085815260016020908152604080832033808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b600081815260208190526040812060030154829060ff1615610ad057600080fd5b82610ada816112bd565b1515610b4757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604482015290519081900360640190fd5b600084815260208181526040808320805473ffffffffffffffffffffffffffffffffffffffff16845260089092529091205485919060ff161515610bec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f554e524547495354455245445f41535345545f50524f58590000000000000000604482015290519081900360640190fd5b604080517f72656d6f7665417574686f72697a6564416464726573734174496e646578286181527f6464726573732c75696e74323536290000000000000000000000000000000000602080830191909152825191829003602f01822060028086018054601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018416150201909116929092049182018490048402850184019095528084527fffffffff0000000000000000000000000000000000000000000000000000000090911693610d2893600093909290830182828015610d155780601f10610cea57610100808354040283529160200191610d15565b820191906000526020600020905b815481529060010190602001808311610cf857829003601f168201915b505050505061217490919063ffffffff16565b7fffffffff000000000000000000000000000000000000000000000000000000001614610db657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f494e56414c49445f46554e4354494f4e5f53454c4543544f5200000000000000604482015290519081900360640190fd5b600086815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff97831615610100029790970190911692909204948501879004870282018701909752838152939a50610ece9573ffffffffffffffffffffffffffffffffffffffff90921694909391908390830182828015610ec45780601f10610e9957610100808354040283529160200191610ec4565b820191906000526020600020905b815481529060010190602001808311610ea757829003601f168201915b505050505061223c565b15610f035760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2610f59565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003850180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b505050505050565b60065481565b6000805b600554811015610fcc57838015610f94575060008181526020819052604090206003015460ff16155b80610fb85750828015610fb8575060008181526020819052604090206003015460ff165b15610fc4576001820191505b600101610f6b565b5092915050565b333014610fdf57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff8116151561100257600080fd5b73ffffffffffffffffffffffffffffffffffffffff831660008181526008602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915582519384529083015280517fdaef8ff7dc66c5e34eb9c338aab679d9f427f89868d9228494455a4d982eb2b09281900390910190a1505050565b33301461109e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054819060ff16156110d357600080fd5b8173ffffffffffffffffffffffffffffffffffffffff811615156110f657600080fd5b600380549050600101600454603282111580156111135750818111155b801561111e57508015155b801561112957508115155b151561113457600080fd5b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b604080517f72656d6f7665417574686f72697a6564416464726573734174496e646578286181527f6464726573732c75696e743235362900000000000000000000000000000000006020820152905190819003602f0190206000907fffffffff0000000000000000000000000000000000000000000000000000000016611294838363ffffffff61217416565b7fffffffff00000000000000000000000000000000000000000000000000000000161492915050565b600080805b60035481101561134757600084815260016020526040812060038054919291849081106112eb57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff161561132c576001820191505b60045482141561133f5760019250611347565b6001016112c2565b5050919050565b33301461135a57600080fd5b60068190556040805182815290517fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b43779181900360200190a150565b60086020526000908152604090205460ff1681565b6000805b60035481101561142057600083815260016020526040812060038054919291849081106113d757fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615611418576001820191505b6001016113ae565b50919050565b60006020818152918152604090819020805460018083015460028085018054875161010095821615959095027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f810188900488028401880190965285835273ffffffffffffffffffffffffffffffffffffffff909316959094919291908301828280156114fc5780601f106114d1576101008083540402835291602001916114fc565b820191906000526020600020905b8154815290600101906020018083116114df57829003601f168201915b5050506003909301549192505060ff1684565b6060600380548060200260200160405190810160405280929190818152602001828054801561157457602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611549575b505050505090505b90565b6060806000806005546040519080825280602002602001820160405280156115b1578160200160208202803883390190505b50925060009150600090505b600554811015611638578580156115e6575060008181526020819052604090206003015460ff16155b8061160a575084801561160a575060008181526020819052604090206003015460ff165b156116305780838381518110151561161e57fe5b60209081029091010152600191909101905b6001016115bd565b878703604051908082528060200260200182016040528015611664578160200160208202803883390190505b5093508790505b868110156116ad57828181518110151561168157fe5b906020019060200201518489830381518110151561169b57fe5b6020908102909101015260010161166b565b505050949350505050565b6060806000806003805490506040519080825280602002602001820160405280156116ed578160200160208202803883390190505b50925060009150600090505b6003548110156117d1576000858152600160205260408120600380549192918490811061172257fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff16156117c957600380548290811061176a57fe5b600091825260209091200154835173ffffffffffffffffffffffffffffffffffffffff9091169084908490811061179d57fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600191909101905b6001016116f9565b816040519080825280602002602001820160405280156117fb578160200160208202803883390190505b509350600090505b8181101561185d57828181518110151561181957fe5b90602001906020020151848281518110151561183157fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830290910190910152600101611803565b505050919050565b60055481565b33301461187757600080fd5b600354816032821180159061188c5750818111155b801561189757508015155b80156118a257508115155b15156118ad57600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff16151561190857600080fd5b600082815260208190526040902054829073ffffffffffffffffffffffffffffffffffffffff16151561193a57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff161561196557600080fd5b8461196f816112bd565b156119db57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f54585f46554c4c595f434f4e4649524d45440000000000000000000000000000604482015290519081900360640190fd5b600086815260016020818152604080842033808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909317909255905188927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3611a4f866112bd565b15610f5957610f59864261225f565b600081815260208181526040808320805473ffffffffffffffffffffffffffffffffffffffff168452600890925282205483919060ff161515611b0257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f554e524547495354455245445f41535345545f50524f58590000000000000000604482015290519081900360640190fd5b604080517f72656d6f7665417574686f72697a6564416464726573734174496e646578286181527f6464726573732c75696e74323536290000000000000000000000000000000000602080830191909152825191829003602f01822060028086018054601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010060018416150201909116929092049182018490048402850184019095528084527fffffffff0000000000000000000000000000000000000000000000000000000090911693611c0093600093909290830182828015610d155780601f10610cea57610100808354040283529160200191610d15565b7fffffffff000000000000000000000000000000000000000000000000000000001614611c8e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f494e56414c49445f46554e4354494f4e5f53454c4543544f5200000000000000604482015290519081900360640190fd5b5060019392505050565b6000611ca58484846122aa565b9050611cb0816118ea565b9392505050565b60076020526000908152604090205481565b603281565b60045481565b6000333014611ce257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff161515611d1857600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260026020526040902054839060ff1615611d4d57600080fd5b600092505b600354831015611e12578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611d8257fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415611e075783600384815481101515611dba57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611e12565b600190920191611d52565b73ffffffffffffffffffffffffffffffffffffffff80861660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a260405173ffffffffffffffffffffffffffffffffffffffff8516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b600081815260208190526040812060030154829060ff1615611f0557600080fd5b82611f0f816112bd565b1515611f7c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604482015290519081900360640190fd5b600654600085815260076020526040902054859101421015611fff57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f54494d455f4c4f434b5f494e434f4d504c455445000000000000000000000000604482015290519081900360640190fd5b600085815260208181526040918290206003810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155815481830154600280850180548851601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff978316156101000297909701909116929092049485018790048702820187019097528381529399506120e29573ffffffffffffffffffffffffffffffffffffffff90921694909391908390830182828015610ec45780601f10610e9957610100808354040283529160200191610ec4565b156121175760405185907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a261216d565b60405185907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a26003840180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b5050505050565b60008160040183511015151561221157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160448201527f5549524544000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b6000828152600760209081526040918290208390558151838152915184927f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d92908290030190a25050565b60008373ffffffffffffffffffffffffffffffffffffffff811615156122cf57600080fd5b6005546040805160808101825273ffffffffffffffffffffffffffffffffffffffff8881168252602080830189815283850189815260006060860181905287815280845295909520845181547fffffffffffffffffffffffff00000000000000000000000000000000000000001694169390931783555160018301559251805194965091939092612367926002850192910190612406565b5060609190910151600390910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b81548183558181111561240157600083815260209020612401918101908301612484565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061244757805160ff1916838001178555612474565b82800160010185558215612474579182015b82811115612474578251825591602001919060010190612459565b50612480929150612484565b5090565b61157c91905b80821115612480576000815560010161248a5600a165627a7a72305820c3531da3b2f302406663b78875d8ee2a4b187969553730d3a9e04bc55e0b22850029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x174 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x25E7C27 DUP2 EQ PUSH2 0x1B6 JUMPI DUP1 PUSH4 0x173825D9 EQ PUSH2 0x1F7 JUMPI DUP1 PUSH4 0x20EA8D86 EQ PUSH2 0x225 JUMPI DUP1 PUSH4 0x2F54BF6E EQ PUSH2 0x23D JUMPI DUP1 PUSH4 0x3411C81C EQ PUSH2 0x27F JUMPI DUP1 PUSH4 0x3589B35C EQ PUSH2 0x2B0 JUMPI DUP1 PUSH4 0x37BD78A0 EQ PUSH2 0x2C8 JUMPI DUP1 PUSH4 0x54741525 EQ PUSH2 0x2EF JUMPI DUP1 PUSH4 0x5A1A66AF EQ PUSH2 0x30E JUMPI DUP1 PUSH4 0x7065CB48 EQ PUSH2 0x341 JUMPI DUP1 PUSH4 0x72CBE61D EQ PUSH2 0x36F JUMPI DUP1 PUSH4 0x784547A7 EQ PUSH2 0x3C8 JUMPI DUP1 PUSH4 0x7AD28C51 EQ PUSH2 0x3E0 JUMPI DUP1 PUSH4 0x83250F79 EQ PUSH2 0x3F8 JUMPI DUP1 PUSH4 0x8B51D13F EQ PUSH2 0x426 JUMPI DUP1 PUSH4 0x9ACE38C2 EQ PUSH2 0x43E JUMPI DUP1 PUSH4 0xA0E67E2B EQ PUSH2 0x513 JUMPI DUP1 PUSH4 0xA8ABE69A EQ PUSH2 0x578 JUMPI DUP1 PUSH4 0xB5DC40C3 EQ PUSH2 0x59D JUMPI DUP1 PUSH4 0xB77BF600 EQ PUSH2 0x5B5 JUMPI DUP1 PUSH4 0xBA51A6DF EQ PUSH2 0x5CA JUMPI DUP1 PUSH4 0xC01A8C84 EQ PUSH2 0x5E2 JUMPI DUP1 PUSH4 0xC296E43C EQ PUSH2 0x5FA JUMPI DUP1 PUSH4 0xC6427474 EQ PUSH2 0x612 JUMPI DUP1 PUSH4 0xD38F2D82 EQ PUSH2 0x688 JUMPI DUP1 PUSH4 0xD74F8EDD EQ PUSH2 0x6A0 JUMPI DUP1 PUSH4 0xDC8452CD EQ PUSH2 0x6B5 JUMPI DUP1 PUSH4 0xE20056E6 EQ PUSH2 0x6CA JUMPI DUP1 PUSH4 0xEE22610B EQ PUSH2 0x6FE JUMPI JUMPDEST PUSH1 0x0 CALLVALUE GT ISZERO PUSH2 0x1B4 JUMPI PUSH1 0x40 DUP1 MLOAD CALLVALUE DUP2 MSTORE SWAP1 MLOAD CALLER SWAP2 PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C SWAP2 SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG2 JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1C2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1CE PUSH1 0x4 CALLDATALOAD PUSH2 0x716 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x203 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x74B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x231 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0x9A2 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x249 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0xA7A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x28B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH1 0x4 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x24 CALLDATALOAD AND PUSH2 0xA8F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2BC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0xAAF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2D4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0xF61 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2FB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH1 0x4 CALLDATALOAD ISZERO ISZERO PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xF67 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x31A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0xFD3 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x34D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x1092 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x37B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x26B SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x1207 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3D4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH1 0x4 CALLDATALOAD PUSH2 0x12BD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3EC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0x134E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x404 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x1395 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x432 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH1 0x4 CALLDATALOAD PUSH2 0x13AA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x44A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x456 PUSH1 0x4 CALLDATALOAD PUSH2 0x1426 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x4D5 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x4BD JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x502 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP6 POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x51F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x528 PUSH2 0x150F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x564 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x54C JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x584 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x528 PUSH1 0x4 CALLDATALOAD PUSH1 0x24 CALLDATALOAD PUSH1 0x44 CALLDATALOAD ISZERO ISZERO PUSH1 0x64 CALLDATALOAD ISZERO ISZERO PUSH2 0x157F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x528 PUSH1 0x4 CALLDATALOAD PUSH2 0x16B8 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5C1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x1865 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0x186B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0x18EA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x606 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x26B PUSH1 0x4 CALLDATALOAD PUSH2 0x1A5E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x61E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x2DD SWAP5 DUP3 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x1C98 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x694 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH1 0x4 CALLDATALOAD PUSH2 0x1CB7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6AC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x1CC9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6C1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2DD PUSH2 0x1CCE JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x1CD4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x70A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1B4 PUSH1 0x4 CALLDATALOAD PUSH2 0x1EE4 JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x724 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x759 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x78F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP2 POP JUMPDEST PUSH1 0x3 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP3 LT ISZERO PUSH2 0x912 JUMPI DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x82F JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x907 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x887 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH1 0x3 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x8BA JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x912 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x7DD JUMP JUMPDEST PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 PUSH2 0x943 SWAP1 DUP3 PUSH2 0x23DD JUMP JUMPDEST POP PUSH1 0x3 SLOAD PUSH1 0x4 SLOAD GT ISZERO PUSH2 0x95C JUMPI PUSH1 0x3 SLOAD PUSH2 0x95C SWAP1 PUSH2 0x186B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND SWAP1 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x9C0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP4 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x9EC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD DUP5 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xA0D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE MLOAD DUP8 SWAP3 PUSH32 0xF6A317157440607F36269043EB55F1287A5A19BA2216AFEAB88CD46CBCFB88E9 SWAP2 LOG3 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 ADD SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xAD0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 PUSH2 0xADA DUP2 PUSH2 0x12BD JUMP JUMPDEST ISZERO ISZERO PUSH2 0xB47 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F4E4F545F46554C4C595F434F4E4649524D454400000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 MSTORE PUSH1 0x8 SWAP1 SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP6 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0xBEC JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x18 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x554E524547495354455245445F41535345545F50524F58590000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x72656D6F7665417574686F72697A6564416464726573734174496E6465782861 DUP2 MSTORE PUSH32 0x6464726573732C75696E74323536290000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP3 MLOAD SWAP2 DUP3 SWAP1 SUB PUSH1 0x2F ADD DUP3 KECCAK256 PUSH1 0x2 DUP1 DUP7 ADD DUP1 SLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP5 AND ISZERO MUL ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP2 DUP3 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP1 DUP5 MSTORE PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP2 AND SWAP4 PUSH2 0xD28 SWAP4 PUSH1 0x0 SWAP4 SWAP1 SWAP3 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xD15 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xCEA JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD15 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xCF8 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x2174 SWAP1 SWAP2 SWAP1 PUSH4 0xFFFFFFFF AND JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND EQ PUSH2 0xDB6 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F46554E4354494F4E5F53454C4543544F5200000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP11 POP PUSH2 0xECE SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xEC4 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xE99 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xEC4 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xEA7 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x223C JUMP JUMPDEST ISZERO PUSH2 0xF03 JUMPI PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0xF59 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP7 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP6 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x6 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0xFCC JUMPI DUP4 DUP1 ISZERO PUSH2 0xF94 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0xFB8 JUMPI POP DUP3 DUP1 ISZERO PUSH2 0xFB8 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0xFC4 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0xF6B JUMP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0xFDF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x1002 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP7 ISZERO ISZERO SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP3 MLOAD SWAP4 DUP5 MSTORE SWAP1 DUP4 ADD MSTORE DUP1 MLOAD PUSH32 0xDAEF8FF7DC66C5E34EB9C338AAB679D9F427F89868D9228494455A4D982EB2B0 SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x109E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x10D3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x10F6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x1 ADD PUSH1 0x4 SLOAD PUSH1 0x32 DUP3 GT ISZERO DUP1 ISZERO PUSH2 0x1113 JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x111E JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1129 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x1134 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE PUSH1 0x3 DUP1 SLOAD SWAP2 DUP3 ADD DUP2 SSTORE DUP4 MSTORE PUSH32 0xC2575A0E9E593C00F959F8C92F12DB2869C3395A3B0502D05E2516446F71F85B ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND DUP5 OR SWAP1 SSTORE MLOAD PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP2 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x72656D6F7665417574686F72697A6564416464726573734174496E6465782861 DUP2 MSTORE PUSH32 0x6464726573732C75696E74323536290000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x2F ADD SWAP1 KECCAK256 PUSH1 0x0 SWAP1 PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND PUSH2 0x1294 DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x2174 AND JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND EQ SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x1347 JUMPI PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x12EB JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x132C JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x4 SLOAD DUP3 EQ ISZERO PUSH2 0x133F JUMPI PUSH1 0x1 SWAP3 POP PUSH2 0x1347 JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0x12C2 JUMP JUMPDEST POP POP SWAP2 SWAP1 POP JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x135A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x6 DUP2 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xD1C9101A34FEFF75CCCEF14A28785A0279CB0B49C1F321F21F5F422E746B4377 SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP JUMP JUMPDEST PUSH1 0x8 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x1420 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x13D7 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x1418 JUMPI PUSH1 0x1 DUP3 ADD SWAP2 POP JUMPDEST PUSH1 0x1 ADD PUSH2 0x13AE JUMP JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP2 DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH1 0x1 DUP1 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP8 MLOAD PUSH2 0x100 SWAP6 DUP3 AND ISZERO SWAP6 SWAP1 SWAP6 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD AND SWAP2 SWAP1 SWAP2 DIV PUSH1 0x1F DUP2 ADD DUP9 SWAP1 DIV DUP9 MUL DUP5 ADD DUP9 ADD SWAP1 SWAP7 MSTORE DUP6 DUP4 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND SWAP6 SWAP1 SWAP5 SWAP2 SWAP3 SWAP2 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x14FC JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x14D1 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x14FC JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x14DF JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP PUSH1 0x3 SWAP1 SWAP4 ADD SLOAD SWAP2 SWAP3 POP POP PUSH1 0xFF AND DUP5 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x3 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH2 0x1574 JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x1549 JUMPI JUMPDEST POP POP POP POP POP SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x5 SLOAD PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x15B1 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x5 SLOAD DUP2 LT ISZERO PUSH2 0x1638 JUMPI DUP6 DUP1 ISZERO PUSH2 0x15E6 JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND ISZERO JUMPDEST DUP1 PUSH2 0x160A JUMPI POP DUP5 DUP1 ISZERO PUSH2 0x160A JUMPI POP PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 PUSH1 0x3 ADD SLOAD PUSH1 0xFF AND JUMPDEST ISZERO PUSH2 0x1630 JUMPI DUP1 DUP4 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x161E JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0x15BD JUMP JUMPDEST DUP8 DUP8 SUB PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x1664 JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP DUP8 SWAP1 POP JUMPDEST DUP7 DUP2 LT ISZERO PUSH2 0x16AD JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1681 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP10 DUP4 SUB DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x169B JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x166B JUMP JUMPDEST POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP1 PUSH1 0x0 DUP1 PUSH1 0x3 DUP1 SLOAD SWAP1 POP PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x16ED JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP3 POP PUSH1 0x0 SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST PUSH1 0x3 SLOAD DUP2 LT ISZERO PUSH2 0x17D1 JUMPI PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 DUP1 SLOAD SWAP2 SWAP3 SWAP2 DUP5 SWAP1 DUP2 LT PUSH2 0x1722 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 KECCAK256 SWAP1 SWAP2 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 MSTORE DUP3 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 ADD SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x17C9 JUMPI PUSH1 0x3 DUP1 SLOAD DUP3 SWAP1 DUP2 LT PUSH2 0x176A JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD DUP4 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 DUP5 SWAP1 DUP5 SWAP1 DUP2 LT PUSH2 0x179D JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 SWAP2 SWAP1 SWAP2 ADD SWAP1 JUMPDEST PUSH1 0x1 ADD PUSH2 0x16F9 JUMP JUMPDEST DUP2 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x17FB JUMPI DUP2 PUSH1 0x20 ADD PUSH1 0x20 DUP3 MUL DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP JUMPDEST POP SWAP4 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x185D JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1819 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP5 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1831 JUMPI INVALID JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND PUSH1 0x20 SWAP3 DUP4 MUL SWAP1 SWAP2 ADD SWAP1 SWAP2 ADD MSTORE PUSH1 0x1 ADD PUSH2 0x1803 JUMP JUMPDEST POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x5 SLOAD DUP2 JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x1877 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x3 SLOAD DUP2 PUSH1 0x32 DUP3 GT DUP1 ISZERO SWAP1 PUSH2 0x188C JUMPI POP DUP2 DUP2 GT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1897 JUMPI POP DUP1 ISZERO ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x18A2 JUMPI POP DUP2 ISZERO ISZERO JUMPDEST ISZERO ISZERO PUSH2 0x18AD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x4 DUP4 SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD DUP5 DUP2 MSTORE SWAP1 MLOAD PUSH32 0xA3F1EE9126A074D9326C682F561767F710E927FAA811F7A99829D49DC421797A SWAP2 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG1 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1908 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP3 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO ISZERO PUSH2 0x193A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP1 DUP6 MSTORE SWAP3 MSTORE SWAP1 SWAP2 KECCAK256 SLOAD DUP5 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1965 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 PUSH2 0x196F DUP2 PUSH2 0x12BD JUMP JUMPDEST ISZERO PUSH2 0x19DB JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F46554C4C595F434F4E4649524D45440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP7 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 CALLER DUP1 DUP7 MSTORE SWAP3 MSTORE DUP1 DUP5 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SWAP4 OR SWAP1 SWAP3 SSTORE SWAP1 MLOAD DUP9 SWAP3 PUSH32 0x4A504A94899432A9846E1AA406DCEB1BCFD538BB839071D49D1E5E23F5BE30EF SWAP2 LOG3 PUSH2 0x1A4F DUP7 PUSH2 0x12BD JUMP JUMPDEST ISZERO PUSH2 0xF59 JUMPI PUSH2 0xF59 DUP7 TIMESTAMP PUSH2 0x225F JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 MSTORE PUSH1 0x8 SWAP1 SWAP3 MSTORE DUP3 KECCAK256 SLOAD DUP4 SWAP2 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1B02 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x18 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x554E524547495354455245445F41535345545F50524F58590000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x72656D6F7665417574686F72697A6564416464726573734174496E6465782861 DUP2 MSTORE PUSH32 0x6464726573732C75696E74323536290000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP3 MLOAD SWAP2 DUP3 SWAP1 SUB PUSH1 0x2F ADD DUP3 KECCAK256 PUSH1 0x2 DUP1 DUP7 ADD DUP1 SLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 PUSH1 0x1 DUP5 AND ISZERO MUL ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP2 DUP3 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP1 DUP5 MSTORE PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP2 AND SWAP4 PUSH2 0x1C00 SWAP4 PUSH1 0x0 SWAP4 SWAP1 SWAP3 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xD15 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xCEA JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD15 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND EQ PUSH2 0x1C8E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x19 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F46554E4354494F4E5F53454C4543544F5200000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH1 0x1 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1CA5 DUP5 DUP5 DUP5 PUSH2 0x22AA JUMP JUMPDEST SWAP1 POP PUSH2 0x1CB0 DUP2 PUSH2 0x18EA JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x32 DUP2 JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER ADDRESS EQ PUSH2 0x1CE2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1D18 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP4 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1D4D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 SWAP3 POP JUMPDEST PUSH1 0x3 SLOAD DUP4 LT ISZERO PUSH2 0x1E12 JUMPI DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1D82 JUMPI INVALID JUMPDEST PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x20 SWAP1 SWAP2 KECCAK256 ADD SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x1E07 JUMPI DUP4 PUSH1 0x3 DUP5 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1DBA JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP PUSH2 0x1E12 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x1D52 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 SWAP1 DUP2 AND SWAP1 SWAP2 SSTORE SWAP4 DUP9 AND DUP3 MSTORE DUP1 DUP3 KECCAK256 DUP1 SLOAD SWAP1 SWAP5 AND PUSH1 0x1 OR SWAP1 SWAP4 SSTORE SWAP2 MLOAD SWAP1 SWAP2 PUSH32 0x8001553A916EF2F495D26A907CC54D96ED840D7BDA71E73194BF5A9DF7A76B90 SWAP2 LOG2 PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP6 AND SWAP1 PUSH32 0xF39E6E1EB0EDCF53C221607B54B00CD28F3196FED0A24994DC308B8F611B682D SWAP1 PUSH1 0x0 SWAP1 LOG2 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 KECCAK256 PUSH1 0x3 ADD SLOAD DUP3 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0x1F05 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 PUSH2 0x1F0F DUP2 PUSH2 0x12BD JUMP JUMPDEST ISZERO ISZERO PUSH2 0x1F7C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x16 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54585F4E4F545F46554C4C595F434F4E4649524D454400000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x6 SLOAD PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP6 SWAP2 ADD TIMESTAMP LT ISZERO PUSH2 0x1FFF JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x14 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x54494D455F4C4F434B5F494E434F4D504C455445000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP6 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 PUSH1 0x3 DUP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP2 SLOAD DUP2 DUP4 ADD SLOAD PUSH1 0x2 DUP1 DUP6 ADD DUP1 SLOAD DUP9 MLOAD PUSH1 0x1F PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP4 AND ISZERO PUSH2 0x100 MUL SWAP8 SWAP1 SWAP8 ADD SWAP1 SWAP2 AND SWAP3 SWAP1 SWAP3 DIV SWAP5 DUP6 ADD DUP8 SWAP1 DIV DUP8 MUL DUP3 ADD DUP8 ADD SWAP1 SWAP8 MSTORE DUP4 DUP2 MSTORE SWAP4 SWAP10 POP PUSH2 0x20E2 SWAP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP5 SWAP1 SWAP4 SWAP2 SWAP1 DUP4 SWAP1 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0xEC4 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xE99 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xEC4 JUMP JUMPDEST ISZERO PUSH2 0x2117 JUMPI PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x33E13ECB54C3076D8E8BB8C2881800A4D972B792045FFAE98FDF46DF365FED75 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH2 0x216D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP6 SWAP1 PUSH32 0x526441BB6C1ABA3C9A4A6CA1D6545DA9C2333C8C48343EF398EB858D72B79236 SWAP1 PUSH1 0x0 SWAP1 LOG2 PUSH1 0x3 DUP5 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x4 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x2211 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x25 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F345F4C454E4754485F524551 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5549524544000000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 MLOAD PUSH1 0x20 DUP5 ADD PUSH1 0x0 DUP3 DUP8 DUP4 DUP11 DUP13 PUSH2 0x8796 GAS SUB CALL SWAP9 SWAP8 POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP4 SWAP1 SSTORE DUP2 MLOAD DUP4 DUP2 MSTORE SWAP2 MLOAD DUP5 SWAP3 PUSH32 0xB237AFE65F1514FD7EA3F923EA4FE792BDD07000A912B6CD1602A8E7F573C8D SWAP3 SWAP1 DUP3 SWAP1 SUB ADD SWAP1 LOG2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO ISZERO PUSH2 0x22CF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x80 DUP2 ADD DUP3 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 DUP2 AND DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD DUP10 DUP2 MSTORE DUP4 DUP6 ADD DUP10 DUP2 MSTORE PUSH1 0x0 PUSH1 0x60 DUP7 ADD DUP2 SWAP1 MSTORE DUP8 DUP2 MSTORE DUP1 DUP5 MSTORE SWAP6 SWAP1 SWAP6 KECCAK256 DUP5 MLOAD DUP2 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 SSTORE MLOAD PUSH1 0x1 DUP4 ADD SSTORE SWAP3 MLOAD DUP1 MLOAD SWAP5 SWAP7 POP SWAP2 SWAP4 SWAP1 SWAP3 PUSH2 0x2367 SWAP3 PUSH1 0x2 DUP6 ADD SWAP3 SWAP2 ADD SWAP1 PUSH2 0x2406 JUMP JUMPDEST POP PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD MLOAD PUSH1 0x3 SWAP1 SWAP2 ADD DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0x5 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE PUSH1 0x40 MLOAD DUP3 SWAP1 PUSH32 0xC0BA8FE4B176C1714197D43B9CC6BCF797A4A7461C5FE8D0EF6E184AE7601E51 SWAP1 PUSH1 0x0 SWAP1 LOG2 POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 GT ISZERO PUSH2 0x2401 JUMPI PUSH1 0x0 DUP4 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 PUSH2 0x2401 SWAP2 DUP2 ADD SWAP1 DUP4 ADD PUSH2 0x2484 JUMP JUMPDEST POP POP POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x2447 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x2474 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x2474 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x2474 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x2459 JUMP JUMPDEST POP PUSH2 0x2480 SWAP3 SWAP2 POP PUSH2 0x2484 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x157C SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x2480 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x248A JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xc3 MSTORE8 SAR LOG3 0xb2 RETURN MUL BLOCKHASH PUSH7 0x63B78875D8EE2A 0x4b XOR PUSH26 0x69553730D3A9E04BC55E0B228500290000000000000000000000 ",
+ "sourceMap": "703:1046:63:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2540:1:16;2528:9;:13;2524:61;;;2555:30;;;2575:9;2555:30;;;;2563:10;;2555:30;;;;;;;;;;2524:61;703:1046:63;1050:23:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1050:23:16;;;;;;;;;;;;;;;;;;;;;;;;3715:460;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3715:460:16;;;;;;;6281:291;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6281:291:16;;;;;1004:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1004:40:16;;;;;;;;;;;;;;;;;;;;;;;;;934:64;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;934:64:16;;;;;;;;;3583:560:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3583:560:25;;;;;1057:32:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1057:32:17;;;;;;;;;;;;;;;;;;;;10535:319:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;10535:319:16;;;;;;;;;;;3153:294:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3153:294:25;;;;;;;;;;;3315:277:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3315:277:16;;;;;;;1534:213:63;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1534:213:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1534:213:63;;-1:-1:-1;1534:213:63;;-1:-1:-1;;;;;;;1534:213:63;8703:337:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8703:337:16;;;;;2494:194:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2494:194:17;;;;;1055:55:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1055:55:25;;;;;;;10021:252:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;10021:252:16;;;;;879:49;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;879:49:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;879:49:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10938:115;;8:9:-1;5:2;;;30:1;27;20:12;5:2;10938:115:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;10938:115:16;;;;;;;;;;;;;;;;;12156:676;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;12156:676:16;;;;;;;;;;;;;;;11232:575;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;11232:575:16;;;;;1105:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1105:28:16;;;;4997:207;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4997:207:16;;;;;2794:467:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2794:467:17;;;;;1041:258:63;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1041:258:63;;;;;5463:244:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5463:244:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5463:244:16;;-1:-1:-1;5463:244:16;;-1:-1:-1;;;;;;;5463:244:16;1096:53:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1096:53:17;;;;;800:41:16;;8:9:-1;5:2;;;30:1;27;20:12;5:2;800:41:16;;;;1079:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1079:20:16;;;;4377:449;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4377:449:16;;;;;;;;;;;;3375:516:17;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3375:516:17;;;;;1050:23:16;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1050:23:16;:::o;3715:460::-;3863:6;1337:10;1359:4;1337:27;1329:36;;;;;;1543:14;;;;;;;:7;:14;;;;;;3805:5;;1543:14;;1535:23;;;;;;;;3826:14;;;3843:5;3826:14;;;:7;:14;;;;;:22;;;;;;3843:5;-1:-1:-1;3858:170:16;3875:6;:13;:17;;3873:19;;3858:170;;;3928:5;3915:18;;:6;3922:1;3915:9;;;;;;;;;;;;;;;;;;;;;;:18;3911:117;;;3965:6;3972:13;;:17;;;;3965:25;;;;;;;;;;;;;;;;3953:6;:9;;3965:25;;;;;3960:1;;3953:9;;;;;;;;;;;;;;:37;;;;;;;;;;;;;;;;;;4008:5;;3911:117;3894:3;;;;;3858:170;;;4037:6;:18;;;;;;;;;:::i;:::-;-1:-1:-1;4080:6:16;:13;4069:8;;:24;4065:74;;;4125:6;:13;4107:32;;:17;:32::i;:::-;4149:19;;;;;;;;;;;1375:1;3715:460;;:::o;6281:291::-;6364:10;1543:14;;;;:7;:14;;;;;;;;1535:23;;;;;;;;1788:28;;;;:13;:28;;;;;;;;6409:10;1788:35;;;;;;;;;6394:13;;6409:10;1788:35;;1780:44;;;;;;;;2044:12;:27;;;;;;;;;;:36;;;6441:13;;2044:36;;2043:37;2035:46;;;;;;6513:5;6470:28;;;:13;:28;;;;;;;;6499:10;6470:40;;;;;;;;:48;;;;;;6528:37;6484:13;;6528:37;;;1834:1;1568;;6281:291;;:::o;1004:40::-;;;;;;;;;;;;;;;:::o;934:64::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;3583:560:25:-;3816:23;2044:27:16;;;;;;;;;;:36;;;3688:13:25;;2044:36:16;;2043:37;2035:46;;;;;;3726:13:25;1410:26:17;1422:13;1410:11;:26::i;:::-;1389:95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1492:23:25;1518:27;;;;;;;;;;;1599:15;;;;1576:39;;:22;:39;;;;;;;3787:13;;1518:27;1576:39;;1555:110;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1195:60;;;;;;;;;;;;;;;;;;;;;;;;;1696:8;;;;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:69;;;;;:22;;-1:-1:-1;;1195:60:25;;1696:19;;;:8;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:22;;;;:::i;:::-;:69;;;1675:141;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3842:12;:27;;;;;;;;;;;;3879:12;;;:19;;;;3894:4;3879:19;;;;;;3926:15;;3943:9;;;;3954:8;;;;:15;;3912:68;;;3954:15;;;;;3879:19;3954:15;;;;;;;;;;;;3912:68;;;;;;;;;;;;;;;;;;3842:27;;-1:-1:-1;3912:68:25;;3926:15;;;;;3943:9;;3912:68;3954:8;:15;;3912:68;;3954:8;:15;3912:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:13;:68::i;:::-;3908:229;;;4001:24;;4011:13;;4001:24;;;;;3908:229;;;4061:31;;4078:13;;4061:31;;;;;4106:12;;;:20;;;;;;3908:229;1494:1:17;;2091::16;3583:560:25;;;:::o;1057:32:17:-;;;;:::o;10535:319:16:-;10642:10;;10668:179;10685:16;;10683:1;:18;10668:179;;;10727:7;:36;;;;-1:-1:-1;10739:12:16;:15;;;;;;;;;;:24;;;;;10738:25;10727:36;:92;;;;10783:8;:36;;;;-1:-1:-1;10795:12:16;:15;;;;;;;;;;:24;;;;;10783:36;10720:127;;;10846:1;10837:10;;;;10720:127;10703:3;;10668:179;;;10535:319;;;;;:::o;3153:294:25:-;1337:10:16;1359:4;1337:27;1329:36;;;;;;3278:18:25;2158:13:16;;;;;2150:22;;;;;;3312:42:25;;;;;;;:22;:42;;;;;;;;;:57;;;;;;;;;;;;;3384:56;;;;;;;;;;;;;;;;;;;;;1375:1:16;3153:294:25;;:::o;3315:277:16:-;1337:10;1359:4;1337:27;1329:36;;;;;;1450:14;;;;;;;:7;:14;;;;;;3408:5;;1450:14;;1449:15;1441:24;;;;;;3431:5;2158:13;;;;;2150:22;;;;;;3463:6;:13;;;;3479:1;3463:17;3482:8;;839:2;2273:10;:29;;:68;;;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;3506:14;;;;;;;:7;:14;;;;;;:21;;;;3523:4;3506:21;;;;;;3537:6;27:10:-1;;23:18;;;45:23;;3537:18:16;;;;;;;;;;;;3565:20;;;3506:14;3565:20;2182:1;;1475;1375;3315:277;:::o;1534:213:63:-;1195:60:25;;;;;;;;;;;;;;;;;;;;;1648:4:63;;1675:65;;:18;:4;1648;1675:18;:15;:18;:::i;:::-;:65;;;;1534:213;-1:-1:-1;;1534:213:63:o;8703:337:16:-;8793:4;;;8837:197;8854:6;:13;8852:15;;8837:197;;;8892:28;;;;:13;:28;;;;;8921:6;:9;;8892:28;;;8928:1;;8921:9;;;;;;;;;;;;;;;;;;;;8892:39;;;;;;;;;;;;;;;8888:71;;;8958:1;8949:10;;;;8888:71;8986:8;;8977:5;:17;8973:50;;;9019:4;9012:11;;;;8973:50;8869:3;;8837:197;;;8703:337;;;;;:::o;2494:194:17:-;1337:10:16;1359:4;1337:27;1329:36;;;;;;2594:17:17;:38;;;2647:34;;;;;;;;;;;;;;;;;2494:194;:::o;1055:55:25:-;;;;;;;;;;;;;;;:::o;10021:252:16:-;10120:10;;10146:120;10163:6;:13;10161:15;;10146:120;;;10199:28;;;;:13;:28;;;;;10228:6;:9;;10199:28;;;10235:1;;10228:9;;;;;;;;;;;;;;;;;;;;10199:39;;;;;;;;;;;;;;;10195:71;;;10265:1;10256:10;;;;10195:71;10178:3;;10146:120;;;10021:252;;;;:::o;879:49::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;879:49:16;;;;;;;-1:-1:-1;;879:49:16;;;:::o;10938:115::-;11008:9;11040:6;11033:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10938:115;;:::o;12156:676::-;12281:22;12319:32;12392:10;12416:6;12365:16;;12354:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;12354:28:16;;12319:63;;12405:1;12392:14;;12439:1;12437:3;;12432:250;12444:16;;12442:1;:18;12432:250;;;12486:7;:36;;;;-1:-1:-1;12498:12:16;:15;;;;;;;;;;:24;;;;;12497:25;12486:36;:92;;;;12542:8;:36;;;;-1:-1:-1;12554:12:16;:15;;;;;;;;;;:24;;;;;12542:36;12479:203;;;12638:1;12610:18;12629:5;12610:25;;;;;;;;;;;;;;;;;;:29;12666:1;12657:10;;;;;12479:203;12462:3;;12432:250;;;12725:4;12720:2;:9;12709:21;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;12709:21:16;;12691:39;;12747:4;12745:6;;12740:85;12755:2;12753:1;:4;12740:85;;;12804:18;12823:1;12804:21;;;;;;;;;;;;;;;;;;12776:15;12796:4;12792:1;:8;12776:25;;;;;;;;;;;;;;;;;;:49;12759:3;;12740:85;;;12156:676;;;;;;;;;:::o;11232:575::-;11327:24;11367:34;11442:10;11466:6;11418;:13;;;;11404:28;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;11404:28:16;;11367:65;;11455:1;11442:14;;11489:1;11487:3;;11482:186;11494:6;:13;11492:15;;11482:186;;;11530:28;;;;:13;:28;;;;;11559:6;:9;;11530:28;;;11566:1;;11559:9;;;;;;;;;;;;;;;;;;;;11530:39;;;;;;;;;;;;;;;11526:142;;;11616:6;:9;;11623:1;;11616:9;;;;;;;;;;;;;;;;11589:24;;11616:9;;;;;11589:17;;11607:5;;11589:24;;;;;;:36;;;;:24;;;;;;;;;;:36;11652:1;11643:10;;;;;11526:142;11509:3;;11482:186;;;11708:5;11694:20;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;11694:20:16;;11677:37;;11731:1;11729:3;;11724:76;11736:5;11734:1;:7;11724:76;;;11780:17;11798:1;11780:20;;;;;;;;;;;;;;;;;;11760:14;11775:1;11760:17;;;;;;;;;;:40;;;;:17;;;;;;;;;;:40;11743:3;;11724:76;;;11232:575;;;;;;:::o;1105:28::-;;;;:::o;4997:207::-;1337:10;1359:4;1337:27;1329:36;;;;;;5099:6;:13;5114:9;839:2;2273:29;;;;;:68;;;2331:10;2318:9;:23;;2273:68;:98;;;;-1:-1:-1;2357:14:16;;;2273:98;:129;;;;-1:-1:-1;2387:15:16;;;2273:129;2265:138;;;;;;;;5139:8;:20;;;5169:28;;;;;;;;;;;;;;;;;1375:1;;4997:207;:::o;2794:467:17:-;2880:10;1543:14:16;;;;:7;:14;;;;;;;;1535:23;;;;;;;;1647:12;:27;;;;;;;;;;:39;2918:13:17;;1647:39:16;;:44;;1639:53;;;;;;1924:28;;;;:13;:28;;;;;;;;2969:10:17;1924:35:16;;;;;;;;;2954:13:17;;2969:10;1924:35:16;;1923:36;1915:45;;;;;;3007:13:17;1238:26;1250:13;1238:11;:26::i;:::-;1237:27;1216:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3036:28;;;;3079:4;3036:28;;;;;;;;3065:10;3036:40;;;;;;;;:47;;;;;;;;;;3098:39;;3050:13;;3098:39;;;3151:26;3163:13;3151:11;:26::i;:::-;3147:108;;;3193:51;3213:13;3228:15;3193:19;:51::i;1041:258:63:-;1199:4;1518:27:25;;;;;;;;;;;1599:15;;;;1576:39;;:22;:39;;;;;;1178:2:63;;1518:27:25;1576:39;;1555:110;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1195:60;;;;;;;;;;;;;;;;;;;;;;;;;1696:8;;;;:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:69;;;;;:22;;-1:-1:-1;;1195:60:25;;1696:19;;;:8;:19;;;;;;;;;;;;;;;;;;;;;;;;:22;:69;;;1675:141;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1288:4:63;;1041:258;-1:-1:-1;;;1041:258:63:o;5463:244:16:-;5567:18;5617:40;5632:11;5645:5;5652:4;5617:14;:40::i;:::-;5601:56;;5667:33;5686:13;5667:18;:33::i;:::-;5463:244;;;;;:::o;1096:53:17:-;;;;;;;;;;;;;:::o;800:41:16:-;839:2;800:41;:::o;1079:20::-;;;;:::o;4377:449::-;4548:6;1337:10;1359:4;1337:27;1329:36;;;;;;1543:14;;;;;;;:7;:14;;;;;;4486:5;;1543:14;;1535:23;;;;;;;;1450:14;;;;;;;:7;:14;;;;;;4519:8;;1450:14;;1449:15;1441:24;;;;;;4555:1;4548:8;;4543:149;4560:6;:13;4558:15;;4543:149;;;4609:5;4596:18;;:6;4603:1;4596:9;;;;;;;;;;;;;;;;;;;;;;:18;4592:100;;;4646:8;4634:6;4641:1;4634:9;;;;;;;;;;;;;;;;;;:20;;;;;;;;;;;;;;;;;;4672:5;;4592:100;4575:3;;;;;4543:149;;;4701:14;;;;4718:5;4701:14;;;:7;:14;;;;;;:22;;;;;;;;;4733:17;;;;;;;;:24;;;;;4701:22;4733:24;;;;4767:19;;4701:14;;4767:19;;;4796:23;;;;;;;;;;;1568:1;1375;4377:449;;;:::o;3375:516:17:-;3564:23;2044:27:16;;;;;;;;;;:36;;;3461:13:17;;2044:36:16;;2043:37;2035:46;;;;;;3499:13:17;1410:26;1422:13;1410:11;:26::i;:::-;1389:95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1638:17;;1603:32;;;;:17;:32;;;;;;3535:13;;1603:52;1584:15;:71;;1563:138;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3590:12;:27;;;;;;;;;;;;3627:12;;;:19;;;;3642:4;3627:19;;;;;;3674:15;;3691:9;;;;3702:8;;;;:15;;3660:68;;;3702:15;;;;;3627:19;3702:15;;;;;;;;;;;;3660:68;;;;;;;;;;;;;;;;;;3590:27;;-1:-1:-1;3660:68:17;;3674:15;;;;;3691:9;;3660:68;3702:8;:15;;3660:68;;3702:8;:15;3660:68;;;;;;;;;;;;;;;;;;;;;;;;3656:229;;;3749:24;;3759:13;;3749:24;;;;;3656:229;;;3809:31;;3826:13;;3809:31;;;;;3854:12;;;:20;;;;;;3656:229;1494:1;2091::16;3375:516:17;;;:::o;15593:687:80:-;15713:13;15775:5;15783:1;15775:9;15763:1;:8;:21;;15742:105;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;16021:13:80;15924:2;16021:13;16015:20;16174:66;16162:79;;15593:687::o;7449:1103:16:-;7552:4;7568:11;7627:4;7621:11;7760:2;7754:4;7750:13;8425:1;8406;8298:10;8279:1;8256:5;8227:11;7882:5;7877:3;7873:15;7851:662;7841:672;7449:1103;-1:-1:-1;;;;;;;;7449:1103:16:o;3959:234:17:-;4068:32;;;;:17;:32;;;;;;;;;:51;;;4134:52;;;;;;;4086:13;;4134:52;;;;;;;;;3959:234;;:::o;9373:451:16:-;9505:18;9475:11;2158:13;;;;;2150:22;;;;;;9555:16;;9611:140;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9611:140:16;;;;;;9581:27;;;;;;;;;;:170;;;;;;;;;;;;;;;-1:-1:-1;9581:170:16;;;;;;;9555:16;;-1:-1:-1;9611:140:16;;9581:27;;:170;;;;;;;;;;:::i;:::-;-1:-1:-1;9581:170:16;;;;;;;;;;;;;;;;;;;;;;;9761:16;:21;;-1:-1:-1;9761:21:16;;;9792:25;;9803:13;;9792:25;;-1:-1:-1;;9792:25:16;9373:451;;;;;;:::o;703:1046:63:-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;703:1046:63;;;-1:-1:-1;703:1046:63;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;"
+ }
+ }
+ },
+ "sources": {
+ "test/TestAssetProxyOwner/TestAssetProxyOwner.sol": {
+ "id": 63
+ },
+ "protocol/AssetProxyOwner/AssetProxyOwner.sol": {
+ "id": 25
+ },
+ "multisig/MultiSigWalletWithTimeLock.sol": {
+ "id": 17
+ },
+ "multisig/MultiSigWallet.sol": {
+ "id": 16
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ }
+ },
+ "sourceCodes": {
+ "test/TestAssetProxyOwner/TestAssetProxyOwner.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../protocol/AssetProxyOwner/AssetProxyOwner.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract TestAssetProxyOwner is\n AssetProxyOwner\n{\n constructor (\n address[] memory _owners,\n address[] memory _assetProxyContracts,\n uint256 _required,\n uint256 _secondsTimeLocked\n )\n public\n AssetProxyOwner(_owners, _assetProxyContracts, _required, _secondsTimeLocked)\n {}\n \n function testValidRemoveAuthorizedAddressAtIndexTx(uint256 id)\n public\n view\n validRemoveAuthorizedAddressAtIndexTx(id)\n returns (bool)\n {\n // Do nothing. We expect reverts through the modifier\n return true;\n }\n \n /// @dev Compares first 4 bytes of byte array to `removeAuthorizedAddressAtIndex` function selector.\n /// @param data Transaction data.\n /// @return Successful if data is a call to `removeAuthorizedAddressAtIndex`.\n function isFunctionRemoveAuthorizedAddressAtIndex(bytes memory data)\n public\n pure\n returns (bool)\n {\n return data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR;\n }\n}\n",
+ "protocol/AssetProxyOwner/AssetProxyOwner.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../multisig/MultiSigWalletWithTimeLock.sol\";\nimport \"../../utils/LibBytes/LibBytes.sol\";\n\n\ncontract AssetProxyOwner is\n MultiSigWalletWithTimeLock\n{\n using LibBytes for bytes;\n\n event AssetProxyRegistration(address assetProxyContract, bool isRegistered);\n\n // Mapping of AssetProxy contract address =>\n // if this contract is allowed to call the AssetProxy's `removeAuthorizedAddressAtIndex` method without a time lock.\n mapping (address => bool) public isAssetProxyRegistered;\n\n bytes4 constant internal REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR = bytes4(keccak256(\"removeAuthorizedAddressAtIndex(address,uint256)\"));\n\n /// @dev Function will revert if the transaction does not call `removeAuthorizedAddressAtIndex`\n /// on an approved AssetProxy contract.\n modifier validRemoveAuthorizedAddressAtIndexTx(uint256 transactionId) {\n Transaction storage txn = transactions[transactionId];\n require(\n isAssetProxyRegistered[txn.destination],\n \"UNREGISTERED_ASSET_PROXY\"\n );\n require(\n txn.data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR,\n \"INVALID_FUNCTION_SELECTOR\"\n );\n _;\n }\n\n /// @dev Contract constructor sets initial owners, required number of confirmations,\n /// time lock, and list of AssetProxy addresses.\n /// @param _owners List of initial owners.\n /// @param _assetProxyContracts Array of AssetProxy contract addresses.\n /// @param _required Number of required confirmations.\n /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.\n constructor (\n address[] memory _owners,\n address[] memory _assetProxyContracts,\n uint256 _required,\n uint256 _secondsTimeLocked\n )\n public\n MultiSigWalletWithTimeLock(_owners, _required, _secondsTimeLocked)\n {\n for (uint256 i = 0; i < _assetProxyContracts.length; i++) {\n address assetProxy = _assetProxyContracts[i];\n require(\n assetProxy != address(0),\n \"INVALID_ASSET_PROXY\"\n );\n isAssetProxyRegistered[assetProxy] = true;\n }\n }\n\n /// @dev Registers or deregisters an AssetProxy to be able to execute\n /// `removeAuthorizedAddressAtIndex` without a timelock.\n /// @param assetProxyContract Address of AssetProxy contract.\n /// @param isRegistered Status of approval for AssetProxy contract.\n function registerAssetProxy(address assetProxyContract, bool isRegistered)\n public\n onlyWallet\n notNull(assetProxyContract)\n {\n isAssetProxyRegistered[assetProxyContract] = isRegistered;\n emit AssetProxyRegistration(assetProxyContract, isRegistered);\n }\n\n /// @dev Allows execution of `removeAuthorizedAddressAtIndex` without time lock.\n /// @param transactionId Transaction ID.\n function executeRemoveAuthorizedAddressAtIndex(uint256 transactionId)\n public\n notExecuted(transactionId)\n fullyConfirmed(transactionId)\n validRemoveAuthorizedAddressAtIndexTx(transactionId)\n {\n Transaction storage txn = transactions[transactionId];\n txn.executed = true;\n if (external_call(txn.destination, txn.value, txn.data.length, txn.data)) {\n emit Execution(transactionId);\n } else {\n emit ExecutionFailure(transactionId);\n txn.executed = false;\n }\n }\n}\n",
+ "multisig/MultiSigWalletWithTimeLock.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./MultiSigWallet.sol\";\n\n\n/// @title Multisignature wallet with time lock- Allows multiple parties to execute a transaction after a time lock has passed.\n/// @author Amir Bandeali - <amir@0xProject.com>\n// solhint-disable not-rely-on-time\ncontract MultiSigWalletWithTimeLock is\n MultiSigWallet\n{\n event ConfirmationTimeSet(uint256 indexed transactionId, uint256 confirmationTime);\n event TimeLockChange(uint256 secondsTimeLocked);\n\n uint256 public secondsTimeLocked;\n\n mapping (uint256 => uint256) public confirmationTimes;\n\n modifier notFullyConfirmed(uint256 transactionId) {\n require(\n !isConfirmed(transactionId),\n \"TX_FULLY_CONFIRMED\"\n );\n _;\n }\n\n modifier fullyConfirmed(uint256 transactionId) {\n require(\n isConfirmed(transactionId),\n \"TX_NOT_FULLY_CONFIRMED\"\n );\n _;\n }\n\n modifier pastTimeLock(uint256 transactionId) {\n require(\n block.timestamp >= confirmationTimes[transactionId] + secondsTimeLocked,\n \"TIME_LOCK_INCOMPLETE\"\n );\n _;\n }\n\n /// @dev Contract constructor sets initial owners, required number of confirmations, and time lock.\n /// @param _owners List of initial owners.\n /// @param _required Number of required confirmations.\n /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.\n constructor (\n address[] _owners,\n uint256 _required,\n uint256 _secondsTimeLocked\n )\n public\n MultiSigWallet(_owners, _required)\n {\n secondsTimeLocked = _secondsTimeLocked;\n }\n\n /// @dev Changes the duration of the time lock for transactions.\n /// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.\n function changeTimeLock(uint256 _secondsTimeLocked)\n public\n onlyWallet\n {\n secondsTimeLocked = _secondsTimeLocked;\n emit TimeLockChange(_secondsTimeLocked);\n }\n\n /// @dev Allows an owner to confirm a transaction.\n /// @param transactionId Transaction ID.\n function confirmTransaction(uint256 transactionId)\n public\n ownerExists(msg.sender)\n transactionExists(transactionId)\n notConfirmed(transactionId, msg.sender)\n notFullyConfirmed(transactionId)\n {\n confirmations[transactionId][msg.sender] = true;\n emit Confirmation(msg.sender, transactionId);\n if (isConfirmed(transactionId)) {\n setConfirmationTime(transactionId, block.timestamp);\n }\n }\n\n /// @dev Allows anyone to execute a confirmed transaction.\n /// @param transactionId Transaction ID.\n function executeTransaction(uint256 transactionId)\n public\n notExecuted(transactionId)\n fullyConfirmed(transactionId)\n pastTimeLock(transactionId)\n {\n Transaction storage txn = transactions[transactionId];\n txn.executed = true;\n if (external_call(txn.destination, txn.value, txn.data.length, txn.data)) {\n emit Execution(transactionId);\n } else {\n emit ExecutionFailure(transactionId);\n txn.executed = false;\n }\n }\n\n /// @dev Sets the time of when a submission first passed.\n function setConfirmationTime(uint256 transactionId, uint256 confirmationTime)\n internal\n {\n confirmationTimes[transactionId] = confirmationTime;\n emit ConfirmationTimeSet(transactionId, confirmationTime);\n }\n}\n",
+ "multisig/MultiSigWallet.sol": "// solhint-disable\npragma solidity ^0.4.15;\n\n\n/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.\n/// @author Stefan George - <stefan.george@consensys.net>\ncontract MultiSigWallet {\n\n /*\n * Events\n */\n event Confirmation(address indexed sender, uint indexed transactionId);\n event Revocation(address indexed sender, uint indexed transactionId);\n event Submission(uint indexed transactionId);\n event Execution(uint indexed transactionId);\n event ExecutionFailure(uint indexed transactionId);\n event Deposit(address indexed sender, uint value);\n event OwnerAddition(address indexed owner);\n event OwnerRemoval(address indexed owner);\n event RequirementChange(uint required);\n\n /*\n * Constants\n */\n uint constant public MAX_OWNER_COUNT = 50;\n\n /*\n * Storage\n */\n mapping (uint => Transaction) public transactions;\n mapping (uint => mapping (address => bool)) public confirmations;\n mapping (address => bool) public isOwner;\n address[] public owners;\n uint public required;\n uint public transactionCount;\n\n struct Transaction {\n address destination;\n uint value;\n bytes data;\n bool executed;\n }\n\n /*\n * Modifiers\n */\n modifier onlyWallet() {\n require(msg.sender == address(this));\n _;\n }\n\n modifier ownerDoesNotExist(address owner) {\n require(!isOwner[owner]);\n _;\n }\n\n modifier ownerExists(address owner) {\n require(isOwner[owner]);\n _;\n }\n\n modifier transactionExists(uint transactionId) {\n require(transactions[transactionId].destination != 0);\n _;\n }\n\n modifier confirmed(uint transactionId, address owner) {\n require(confirmations[transactionId][owner]);\n _;\n }\n\n modifier notConfirmed(uint transactionId, address owner) {\n require(!confirmations[transactionId][owner]);\n _;\n }\n\n modifier notExecuted(uint transactionId) {\n require(!transactions[transactionId].executed);\n _;\n }\n\n modifier notNull(address _address) {\n require(_address != 0);\n _;\n }\n\n modifier validRequirement(uint ownerCount, uint _required) {\n require(ownerCount <= MAX_OWNER_COUNT\n && _required <= ownerCount\n && _required != 0\n && ownerCount != 0);\n _;\n }\n\n /// @dev Fallback function allows to deposit ether.\n function()\n payable\n {\n if (msg.value > 0)\n Deposit(msg.sender, msg.value);\n }\n\n /*\n * Public functions\n */\n /// @dev Contract constructor sets initial owners and required number of confirmations.\n /// @param _owners List of initial owners.\n /// @param _required Number of required confirmations.\n function MultiSigWallet(address[] _owners, uint _required)\n public\n validRequirement(_owners.length, _required)\n {\n for (uint i=0; i<_owners.length; i++) {\n require(!isOwner[_owners[i]] && _owners[i] != 0);\n isOwner[_owners[i]] = true;\n }\n owners = _owners;\n required = _required;\n }\n\n /// @dev Allows to add a new owner. Transaction has to be sent by wallet.\n /// @param owner Address of new owner.\n function addOwner(address owner)\n public\n onlyWallet\n ownerDoesNotExist(owner)\n notNull(owner)\n validRequirement(owners.length + 1, required)\n {\n isOwner[owner] = true;\n owners.push(owner);\n OwnerAddition(owner);\n }\n\n /// @dev Allows to remove an owner. Transaction has to be sent by wallet.\n /// @param owner Address of owner.\n function removeOwner(address owner)\n public\n onlyWallet\n ownerExists(owner)\n {\n isOwner[owner] = false;\n for (uint i=0; i<owners.length - 1; i++)\n if (owners[i] == owner) {\n owners[i] = owners[owners.length - 1];\n break;\n }\n owners.length -= 1;\n if (required > owners.length)\n changeRequirement(owners.length);\n OwnerRemoval(owner);\n }\n\n /// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.\n /// @param owner Address of owner to be replaced.\n /// @param newOwner Address of new owner.\n function replaceOwner(address owner, address newOwner)\n public\n onlyWallet\n ownerExists(owner)\n ownerDoesNotExist(newOwner)\n {\n for (uint i=0; i<owners.length; i++)\n if (owners[i] == owner) {\n owners[i] = newOwner;\n break;\n }\n isOwner[owner] = false;\n isOwner[newOwner] = true;\n OwnerRemoval(owner);\n OwnerAddition(newOwner);\n }\n\n /// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.\n /// @param _required Number of required confirmations.\n function changeRequirement(uint _required)\n public\n onlyWallet\n validRequirement(owners.length, _required)\n {\n required = _required;\n RequirementChange(_required);\n }\n\n /// @dev Allows an owner to submit and confirm a transaction.\n /// @param destination Transaction target address.\n /// @param value Transaction ether value.\n /// @param data Transaction data payload.\n /// @return Returns transaction ID.\n function submitTransaction(address destination, uint value, bytes data)\n public\n returns (uint transactionId)\n {\n transactionId = addTransaction(destination, value, data);\n confirmTransaction(transactionId);\n }\n\n /// @dev Allows an owner to confirm a transaction.\n /// @param transactionId Transaction ID.\n function confirmTransaction(uint transactionId)\n public\n ownerExists(msg.sender)\n transactionExists(transactionId)\n notConfirmed(transactionId, msg.sender)\n {\n confirmations[transactionId][msg.sender] = true;\n Confirmation(msg.sender, transactionId);\n executeTransaction(transactionId);\n }\n\n /// @dev Allows an owner to revoke a confirmation for a transaction.\n /// @param transactionId Transaction ID.\n function revokeConfirmation(uint transactionId)\n public\n ownerExists(msg.sender)\n confirmed(transactionId, msg.sender)\n notExecuted(transactionId)\n {\n confirmations[transactionId][msg.sender] = false;\n Revocation(msg.sender, transactionId);\n }\n\n /// @dev Allows anyone to execute a confirmed transaction.\n /// @param transactionId Transaction ID.\n function executeTransaction(uint transactionId)\n public\n ownerExists(msg.sender)\n confirmed(transactionId, msg.sender)\n notExecuted(transactionId)\n {\n if (isConfirmed(transactionId)) {\n Transaction storage txn = transactions[transactionId];\n txn.executed = true;\n if (external_call(txn.destination, txn.value, txn.data.length, txn.data))\n Execution(transactionId);\n else {\n ExecutionFailure(transactionId);\n txn.executed = false;\n }\n }\n }\n\n // call has been separated into its own function in order to take advantage\n // of the Solidity's code generator to produce a loop that copies tx.data into memory.\n function external_call(address destination, uint value, uint dataLength, bytes data) internal returns (bool) {\n bool result;\n assembly {\n let x := mload(0x40) // \"Allocate\" memory for output (0x40 is where \"free memory\" pointer is stored by convention)\n let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that\n result := call(\n sub(gas, 34710), // 34710 is the value that solidity is currently emitting\n // It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +\n // callNewAccountGas (25000, in case the destination address does not exist and needs creating)\n destination,\n value,\n d,\n dataLength, // Size of the input (in bytes) - this is what fixes the padding problem\n x,\n 0 // Output is ignored, therefore the output size is zero\n )\n }\n return result;\n }\n\n /// @dev Returns the confirmation status of a transaction.\n /// @param transactionId Transaction ID.\n /// @return Confirmation status.\n function isConfirmed(uint transactionId)\n public\n constant\n returns (bool)\n {\n uint count = 0;\n for (uint i=0; i<owners.length; i++) {\n if (confirmations[transactionId][owners[i]])\n count += 1;\n if (count == required)\n return true;\n }\n }\n\n /*\n * Internal functions\n */\n /// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.\n /// @param destination Transaction target address.\n /// @param value Transaction ether value.\n /// @param data Transaction data payload.\n /// @return Returns transaction ID.\n function addTransaction(address destination, uint value, bytes data)\n internal\n notNull(destination)\n returns (uint transactionId)\n {\n transactionId = transactionCount;\n transactions[transactionId] = Transaction({\n destination: destination,\n value: value,\n data: data,\n executed: false\n });\n transactionCount += 1;\n Submission(transactionId);\n }\n\n /*\n * Web3 call functions\n */\n /// @dev Returns number of confirmations of a transaction.\n /// @param transactionId Transaction ID.\n /// @return Number of confirmations.\n function getConfirmationCount(uint transactionId)\n public\n constant\n returns (uint count)\n {\n for (uint i=0; i<owners.length; i++)\n if (confirmations[transactionId][owners[i]])\n count += 1;\n }\n\n /// @dev Returns total number of transactions after filers are applied.\n /// @param pending Include pending transactions.\n /// @param executed Include executed transactions.\n /// @return Total number of transactions after filters are applied.\n function getTransactionCount(bool pending, bool executed)\n public\n constant\n returns (uint count)\n {\n for (uint i=0; i<transactionCount; i++)\n if ( pending && !transactions[i].executed\n || executed && transactions[i].executed)\n count += 1;\n }\n\n /// @dev Returns list of owners.\n /// @return List of owner addresses.\n function getOwners()\n public\n constant\n returns (address[])\n {\n return owners;\n }\n\n /// @dev Returns array with owner addresses, which confirmed transaction.\n /// @param transactionId Transaction ID.\n /// @return Returns array of owner addresses.\n function getConfirmations(uint transactionId)\n public\n constant\n returns (address[] _confirmations)\n {\n address[] memory confirmationsTemp = new address[](owners.length);\n uint count = 0;\n uint i;\n for (i=0; i<owners.length; i++)\n if (confirmations[transactionId][owners[i]]) {\n confirmationsTemp[count] = owners[i];\n count += 1;\n }\n _confirmations = new address[](count);\n for (i=0; i<count; i++)\n _confirmations[i] = confirmationsTemp[i];\n }\n\n /// @dev Returns list of transaction IDs in defined range.\n /// @param from Index start position of transaction array.\n /// @param to Index end position of transaction array.\n /// @param pending Include pending transactions.\n /// @param executed Include executed transactions.\n /// @return Returns array of transaction IDs.\n function getTransactionIds(uint from, uint to, bool pending, bool executed)\n public\n constant\n returns (uint[] _transactionIds)\n {\n uint[] memory transactionIdsTemp = new uint[](transactionCount);\n uint count = 0;\n uint i;\n for (i=0; i<transactionCount; i++)\n if ( pending && !transactions[i].executed\n || executed && transactions[i].executed)\n {\n transactionIdsTemp[count] = i;\n count += 1;\n }\n _transactionIds = new uint[](to - from);\n for (i=from; i<to; i++)\n _transactionIds[i - from] = transactionIdsTemp[i];\n }\n}",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0x97f52a300e361955853c490e7d697ed578afa4a52761eb204e101ece2749ae4c",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/TestConstants.json b/packages/contracts/generated-artifacts/TestConstants.json
new file mode 100644
index 000000000..005f603d3
--- /dev/null
+++ b/packages/contracts/generated-artifacts/TestConstants.json
@@ -0,0 +1,85 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "TestConstants",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "assertValidZrxAssetData",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "MAINNET_ZRX_ASSET_DATA",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b506105dc806100206000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634e7411e28114610050578063a7e889e714610079575b600080fd5b34801561005c57600080fd5b50610065610103565b604080519115158252519081900360200190f35b34801561008557600080fd5b5061008e610425565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c85781810151838201526020016100b0565b50505050905090810190601f1680156100f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b604080517f4552433230546f6b656e2861646472657373290000000000000000000000000081528151908190036013018120736ff6c0ff1d68b964901f986d4c9fa3ac6834657060248084019190915283518084038201815260449093018452602083810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092528351606081810186529181527ff47261b00000000000000000000000006ff6c0ff1d68b964901f986d4c9fa3ac928101929092527f6834657000000000000000000000000000000000000000000000000000000000938201939093526000929061022490839063ffffffff61048516565b151561029157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f494e56414c49445f4b4f56414e5f5a52585f41535345545f4441544100000000604482015290519081900360640190fd5b50604080517f4552433230546f6b656e286164647265737329000000000000000000000000008152815190819003601301812073e41d2489571d322189246dafa5ebde1f4699f49860248084019190915283518084038201815260449093018452602083810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925283516060810185529081527ff47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f918101919091527f4699f4980000000000000000000000000000000000000000000000000000000092810192909252906103af90829063ffffffff61048516565b151561041c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f494e56414c49445f4d41494e4e45545f5a52585f41535345545f444154410000604482015290519081900360640190fd5b60019250505090565b606060405190810160405280602481526020017ff47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f81526020017f4699f4980000000000000000000000000000000000000000000000000000000081525081565b6000815183511480156105a95750816040518082805190602001908083835b602083106104e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016104a4565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052604051919093018190038120885190955088945090928392508401908083835b6020831061057657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610539565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916145b93925050505600a165627a7a72305820d1186e3adfc11ea29a1e3af60e1237ac912010ff7e24279e8d1e16b22a96c42c0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x5DC DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4B JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x4E7411E2 DUP2 EQ PUSH2 0x50 JUMPI DUP1 PUSH4 0xA7E889E7 EQ PUSH2 0x79 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x65 PUSH2 0x103 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x85 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x8E PUSH2 0x425 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC8 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xB0 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xF5 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE DUP2 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD DUP2 KECCAK256 PUSH20 0x6FF6C0FF1D68B964901F986D4C9FA3AC68346570 PUSH1 0x24 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP4 MLOAD DUP1 DUP5 SUB DUP3 ADD DUP2 MSTORE PUSH1 0x44 SWAP1 SWAP4 ADD DUP5 MSTORE PUSH1 0x20 DUP4 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE DUP4 MLOAD PUSH1 0x60 DUP2 DUP2 ADD DUP7 MSTORE SWAP2 DUP2 MSTORE PUSH32 0xF47261B00000000000000000000000006FF6C0FF1D68B964901F986D4C9FA3AC SWAP3 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH32 0x6834657000000000000000000000000000000000000000000000000000000000 SWAP4 DUP3 ADD SWAP4 SWAP1 SWAP4 MSTORE PUSH1 0x0 SWAP3 SWAP1 PUSH2 0x224 SWAP1 DUP4 SWAP1 PUSH4 0xFFFFFFFF PUSH2 0x485 AND JUMP JUMPDEST ISZERO ISZERO PUSH2 0x291 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F4B4F56414E5F5A52585F41535345545F4441544100000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE DUP2 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD DUP2 KECCAK256 PUSH20 0xE41D2489571D322189246DAFA5EBDE1F4699F498 PUSH1 0x24 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP4 MLOAD DUP1 DUP5 SUB DUP3 ADD DUP2 MSTORE PUSH1 0x44 SWAP1 SWAP4 ADD DUP5 MSTORE PUSH1 0x20 DUP4 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE DUP4 MLOAD PUSH1 0x60 DUP2 ADD DUP6 MSTORE SWAP1 DUP2 MSTORE PUSH32 0xF47261B0000000000000000000000000E41D2489571D322189246DAFA5EBDE1F SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x4699F49800000000000000000000000000000000000000000000000000000000 SWAP3 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE SWAP1 PUSH2 0x3AF SWAP1 DUP3 SWAP1 PUSH4 0xFFFFFFFF PUSH2 0x485 AND JUMP JUMPDEST ISZERO ISZERO PUSH2 0x41C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1E PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F4D41494E4E45545F5A52585F41535345545F444154410000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x1 SWAP3 POP POP POP SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x24 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0xF47261B0000000000000000000000000E41D2489571D322189246DAFA5EBDE1F DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x4699F49800000000000000000000000000000000000000000000000000000000 DUP2 MSTORE POP DUP2 JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD DUP4 MLOAD EQ DUP1 ISZERO PUSH2 0x5A9 JUMPI POP DUP2 PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x4E1 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x4A4 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP9 MLOAD SWAP1 SWAP6 POP DUP9 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x576 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x539 JUMP JUMPDEST PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP3 MLOAD AND DUP2 DUP5 MLOAD AND DUP1 DUP3 OR DUP6 MSTORE POP POP POP POP POP POP SWAP1 POP ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 PUSH1 0x0 NOT AND EQ JUMPDEST SWAP4 SWAP3 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xd1 XOR PUSH15 0x3ADFC11EA29A1E3AF60E1237AC9120 LT SELFDESTRUCT PUSH31 0x24279E8D1E16B22A96C42C0029000000000000000000000000000000000000 ",
+ "sourceMap": "686:1347:64:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;686:1347:64;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416634e7411e28114610050578063a7e889e714610079575b600080fd5b34801561005c57600080fd5b50610065610103565b604080519115158252519081900360200190f35b34801561008557600080fd5b5061008e610425565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c85781810151838201526020016100b0565b50505050905090810190601f1680156100f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b604080517f4552433230546f6b656e2861646472657373290000000000000000000000000081528151908190036013018120736ff6c0ff1d68b964901f986d4c9fa3ac6834657060248084019190915283518084038201815260449093018452602083810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092528351606081810186529181527ff47261b00000000000000000000000006ff6c0ff1d68b964901f986d4c9fa3ac928101929092527f6834657000000000000000000000000000000000000000000000000000000000938201939093526000929061022490839063ffffffff61048516565b151561029157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f494e56414c49445f4b4f56414e5f5a52585f41535345545f4441544100000000604482015290519081900360640190fd5b50604080517f4552433230546f6b656e286164647265737329000000000000000000000000008152815190819003601301812073e41d2489571d322189246dafa5ebde1f4699f49860248084019190915283518084038201815260449093018452602083810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925283516060810185529081527ff47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f918101919091527f4699f4980000000000000000000000000000000000000000000000000000000092810192909252906103af90829063ffffffff61048516565b151561041c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f494e56414c49445f4d41494e4e45545f5a52585f41535345545f444154410000604482015290519081900360640190fd5b60019250505090565b606060405190810160405280602481526020017ff47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f81526020017f4699f4980000000000000000000000000000000000000000000000000000000081525081565b6000815183511480156105a95750816040518082805190602001908083835b602083106104e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016104a4565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052604051919093018190038120885190955088945090928392508401908083835b6020831061057657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610539565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916145b93925050505600a165627a7a72305820d1186e3adfc11ea29a1e3af60e1237ac912010ff7e24279e8d1e16b22a96c42c0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4B JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x4E7411E2 DUP2 EQ PUSH2 0x50 JUMPI DUP1 PUSH4 0xA7E889E7 EQ PUSH2 0x79 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x65 PUSH2 0x103 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x85 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x8E PUSH2 0x425 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xC8 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xB0 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0xF5 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE DUP2 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD DUP2 KECCAK256 PUSH20 0x6FF6C0FF1D68B964901F986D4C9FA3AC68346570 PUSH1 0x24 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP4 MLOAD DUP1 DUP5 SUB DUP3 ADD DUP2 MSTORE PUSH1 0x44 SWAP1 SWAP4 ADD DUP5 MSTORE PUSH1 0x20 DUP4 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE DUP4 MLOAD PUSH1 0x60 DUP2 DUP2 ADD DUP7 MSTORE SWAP2 DUP2 MSTORE PUSH32 0xF47261B00000000000000000000000006FF6C0FF1D68B964901F986D4C9FA3AC SWAP3 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH32 0x6834657000000000000000000000000000000000000000000000000000000000 SWAP4 DUP3 ADD SWAP4 SWAP1 SWAP4 MSTORE PUSH1 0x0 SWAP3 SWAP1 PUSH2 0x224 SWAP1 DUP4 SWAP1 PUSH4 0xFFFFFFFF PUSH2 0x485 AND JUMP JUMPDEST ISZERO ISZERO PUSH2 0x291 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1C PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F4B4F56414E5F5A52585F41535345545F4441544100000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH32 0x4552433230546F6B656E28616464726573732900000000000000000000000000 DUP2 MSTORE DUP2 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x13 ADD DUP2 KECCAK256 PUSH20 0xE41D2489571D322189246DAFA5EBDE1F4699F498 PUSH1 0x24 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP4 MLOAD DUP1 DUP5 SUB DUP3 ADD DUP2 MSTORE PUSH1 0x44 SWAP1 SWAP4 ADD DUP5 MSTORE PUSH1 0x20 DUP4 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE DUP4 MLOAD PUSH1 0x60 DUP2 ADD DUP6 MSTORE SWAP1 DUP2 MSTORE PUSH32 0xF47261B0000000000000000000000000E41D2489571D322189246DAFA5EBDE1F SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x4699F49800000000000000000000000000000000000000000000000000000000 SWAP3 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE SWAP1 PUSH2 0x3AF SWAP1 DUP3 SWAP1 PUSH4 0xFFFFFFFF PUSH2 0x485 AND JUMP JUMPDEST ISZERO ISZERO PUSH2 0x41C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1E PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F4D41494E4E45545F5A52585F41535345545F444154410000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x1 SWAP3 POP POP POP SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x24 DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0xF47261B0000000000000000000000000E41D2489571D322189246DAFA5EBDE1F DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x4699F49800000000000000000000000000000000000000000000000000000000 DUP2 MSTORE POP DUP2 JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD DUP4 MLOAD EQ DUP1 ISZERO PUSH2 0x5A9 JUMPI POP DUP2 PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x4E1 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x4A4 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP9 MLOAD SWAP1 SWAP6 POP DUP9 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x576 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x539 JUMP JUMPDEST PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP3 MLOAD AND DUP2 DUP5 MLOAD AND DUP1 DUP3 OR DUP6 MSTORE POP POP POP POP POP POP SWAP1 POP ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 PUSH1 0x0 NOT AND EQ JUMPDEST SWAP4 SWAP3 POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xd1 XOR PUSH15 0x3ADFC11EA29A1E3AF60E1237AC9120 LT SELFDESTRUCT PUSH31 0x24279E8D1E16B22A96C42C0029000000000000000000000000000000000000 ",
+ "sourceMap": "686:1347:64:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;1441:590;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1441:590:64;;;;;;;;;;;;;;;;;;;;;;1237:193;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1237:193:64;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;1237:193:64;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1441:590;799:32;;;;;;;;;;;;;;;;889:42;1574:57;;;;;;;;;;26:21:-1;;;22:32;;6:49;;1574:57:64;;;;;;;25:18:-1;;;61:17;;1574:57:64;182:15:-1;1574:57:64;;;;179:29:-1;;;;160:49;;;1687:20:64;;1541:30;1687:20;;;;;;;;;;;;;;;;;;;;;;;;1521:4;;1541:30;1662:46;;1574:57;;1662:46;:24;:46;:::i;:::-;1641:121;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;799:32:64;;;;;;;;;;;;;;;;1189:42;1807:59;;;;;;;;;;26:21:-1;;;22:32;;6:49;;1807:59:64;;;;;;;25:18:-1;;;61:17;;1807:59:64;182:15:-1;1807:59:64;;;;179:29:-1;;;;160:49;;;1923:22:64;;;;;;;;;;;;;;;;;;;;;;;;;;1807:59;1897:49;;1807:59;;1897:49;:25;:49;:::i;:::-;1876:126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2020:4;2013:11;;1441:590;;;:::o;1237:193::-;;;;;;;;;;;;;;;;;;;;;;;;;:::o;9651:403:80:-;9772:10;10001:3;:10;9987:3;:10;:24;:60;;;;;10043:3;10033:14;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;10033:14:80;;;;;;;;;;;10015;;10033;;-1:-1:-1;10015:14:80;;-1:-1:-1;10033:14:80;;;;-1:-1:-1;10015:14:80;;;;10033;10015;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;10015:14:80;;;;;;;;;;;;;;;;:32;;;;9987:60;9980:67;9651:403;-1:-1:-1;;;9651:403:80:o"
+ }
+ }
+ },
+ "sources": {
+ "test/TestConstants/TestConstants.sol": {
+ "id": 64
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ }
+ },
+ "sourceCodes": {
+ "test/TestConstants/TestConstants.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/LibBytes/LibBytes.sol\";\n\n\n// solhint-disable max-line-length\ncontract TestConstants {\n \n using LibBytes for bytes;\n\n bytes4 constant internal ERC20_PROXY_ID = bytes4(keccak256(\"ERC20Token(address)\"));\n \n address constant internal KOVAN_ZRX_ADDRESS = 0x6Ff6C0Ff1d68b964901F986d4C9FA3ac68346570;\n bytes constant internal KOVAN_ZRX_ASSET_DATA = \"\\xf4\\x72\\x61\\xb0\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x6f\\xf6\\xc0\\xff\\x1d\\x68\\xb9\\x64\\x90\\x1f\\x98\\x6d\\x4c\\x9f\\xa3\\xac\\x68\\x34\\x65\\x70\";\n \n address constant internal MAINNET_ZRX_ADDRESS = 0xE41d2489571d322189246DaFA5ebDe1F4699F498;\n bytes constant public MAINNET_ZRX_ASSET_DATA = \"\\xf4\\x72\\x61\\xb0\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xe4\\x1d\\x24\\x89\\x57\\x1d\\x32\\x21\\x89\\x24\\x6d\\xaf\\xa5\\xeb\\xde\\x1f\\x46\\x99\\xf4\\x98\";\n \n function assertValidZrxAssetData()\n public\n pure\n returns (bool)\n {\n bytes memory kovanZrxAssetData = abi.encodeWithSelector(ERC20_PROXY_ID, KOVAN_ZRX_ADDRESS);\n require(\n kovanZrxAssetData.equals(KOVAN_ZRX_ASSET_DATA),\n \"INVALID_KOVAN_ZRX_ASSET_DATA\"\n );\n\n bytes memory mainetZrxAssetData = abi.encodeWithSelector(ERC20_PROXY_ID, MAINNET_ZRX_ADDRESS);\n require(\n mainetZrxAssetData.equals(MAINNET_ZRX_ASSET_DATA),\n \"INVALID_MAINNET_ZRX_ASSET_DATA\"\n );\n\n return true;\n }\n}\n// solhint-enable max-line-length",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0x0927159bcd2717a87c59aa5152b5e6c8d135436568acf22cfc8885e97f5f33ff",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/TestExchangeInternals.json b/packages/contracts/generated-artifacts/TestExchangeInternals.json
new file mode 100644
index 000000000..9cd3c7ec4
--- /dev/null
+++ b/packages/contracts/generated-artifacts/TestExchangeInternals.json
@@ -0,0 +1,2581 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "TestExchangeInternals",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicIsRoundingErrorFloor",
+ "outputs": [
+ {
+ "name": "isError",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "orderTakerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "fillResults",
+ "type": "tuple"
+ }
+ ],
+ "name": "publicUpdateFilledState",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicGetPartialAmountCeil",
+ "outputs": [
+ {
+ "name": "partialAmount",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "filled",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAssetFillAmounts",
+ "type": "uint256[]"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "batchFillOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "cancelled",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "preSign",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "leftOrder",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "rightOrder",
+ "type": "tuple"
+ },
+ {
+ "name": "leftSignature",
+ "type": "bytes"
+ },
+ {
+ "name": "rightSignature",
+ "type": "bytes"
+ }
+ ],
+ "name": "matchOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "left",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "right",
+ "type": "tuple"
+ },
+ {
+ "name": "leftMakerAssetSpreadAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "matchedFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "fillOrderNoThrow",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "fillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "name": "assetProxies",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "batchCancelOrders",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAssetFillAmounts",
+ "type": "uint256[]"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "batchFillOrKillOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "targetOrderEpoch",
+ "type": "uint256"
+ }
+ ],
+ "name": "cancelOrdersUpTo",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAssetFillAmounts",
+ "type": "uint256[]"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "batchFillOrdersNoThrow",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "assetProxyId",
+ "type": "bytes4"
+ }
+ ],
+ "name": "getAssetProxy",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "transactions",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "fillOrKillOrder",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "fillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "singleFillResults",
+ "type": "tuple"
+ }
+ ],
+ "name": "publicAddFillResults",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicIsRoundingErrorCeil",
+ "outputs": [
+ {
+ "name": "isError",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "validatorAddress",
+ "type": "address"
+ },
+ {
+ "name": "approval",
+ "type": "bool"
+ }
+ ],
+ "name": "setSignatureValidatorApproval",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "allowedValidators",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "marketSellOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ }
+ ],
+ "name": "getOrdersInfo",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "orderStatus",
+ "type": "uint8"
+ },
+ {
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "orderTakerAssetFilledAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "",
+ "type": "tuple[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "preSigned",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "makerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "marketBuyOrdersNoThrow",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "fillOrder",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "fillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicGetPartialAmountFloor",
+ "outputs": [
+ {
+ "name": "partialAmount",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "executeTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "assetProxy",
+ "type": "address"
+ }
+ ],
+ "name": "registerAssetProxy",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ }
+ ],
+ "name": "getOrderInfo",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "orderStatus",
+ "type": "uint8"
+ },
+ {
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "name": "orderTakerAssetFilledAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "orderInfo",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ }
+ ],
+ "name": "cancelOrder",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "orderEpoch",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "ZRX_ASSET_DATA",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "marketSellOrdersNoThrow",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicSafeGetPartialAmountFloor",
+ "outputs": [
+ {
+ "name": "partialAmount",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicSafeGetPartialAmountCeil",
+ "outputs": [
+ {
+ "name": "partialAmount",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicCalculateFillResults",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "fillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "EIP712_DOMAIN_HASH",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "orders",
+ "type": "tuple[]"
+ },
+ {
+ "name": "makerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signatures",
+ "type": "bytes[]"
+ }
+ ],
+ "name": "marketBuyOrders",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "currentContextAddress",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "VERSION",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "validatorAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "approved",
+ "type": "bool"
+ }
+ ],
+ "name": "SignatureValidatorApproval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "indexed": false,
+ "name": "takerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "indexed": true,
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "indexed": false,
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "Fill",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "orderHash",
+ "type": "bytes32"
+ },
+ {
+ "indexed": false,
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "indexed": false,
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "Cancel",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "orderEpoch",
+ "type": "uint256"
+ }
+ ],
+ "name": "CancelUpTo",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "id",
+ "type": "bytes4"
+ },
+ {
+ "indexed": false,
+ "name": "assetProxy",
+ "type": "address"
+ }
+ ],
+ "name": "AssetProxyRegistered",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040526000805460ff191690553480156200001b57600080fd5b506040805160208101918290526000808252909182916200003f9160019162000333565b5050604080517f454950373132446f6d61696e28000000000000000000000000000000000000006020808301919091527f737472696e67206e616d652c0000000000000000000000000000000000000000602d8301527f737472696e672076657273696f6e2c000000000000000000000000000000000060398301527f6164647265737320766572696679696e67436f6e74726163740000000000000060488301527f2900000000000000000000000000000000000000000000000000000000000000606183015282516042818403018152606290920192839052815191929182918401908083835b60208310620001495780518252601f19909201916020918201910162000128565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208285018552600b8084527f30782050726f746f636f6c000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b60208310620001d35780518252601f199092019160209182019101620001b2565b51815160209384036101000a600019018019909216911617905260408051929094018290038220828501855260018084527f3200000000000000000000000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b602083106200025d5780518252601f1990920191602091820191016200023c565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208282019890985281840196909652606081019690965250306080808701919091528151808703909101815260a09095019081905284519093849350850191508083835b60208310620002e85780518252601f199092019160209182019101620002c7565b5181516000196020949094036101000a939093019283169219169190911790526040519201829003909120600255505060038054600160a060020a0319163317905550620003d89050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200037657805160ff1916838001178555620003a6565b82800160010185558215620003a6579182015b82811115620003a657825182559160200191906001019062000389565b50620003b4929150620003b8565b5090565b620003d591905b80821115620003b45760008155600101620003bf565b90565b615d9780620003e86000396000f3006080604052600436106102195763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631be23901811461021e5780631ea1e3d81461025457806320777f7014610276578063288cdc91146102a3578063297bb70b146102c35780632ac12622146102f05780633683ef8e146103105780633c28d861146103305780633e228bae1461035d5780633fd3c9971461037d5780634ac14782146103aa5780634d0ae546146103ca5780634f9559b1146103ea57806350dde1901461040a578063607041081461042a578063642f2eaf1461045757806364a3bc151461047757806366758d7b14610497578063679d2f9a146104b757806377fcce68146104d75780637b8e3514146104f75780637e1d9808146105175780637e9d74dc1461053757806382c174d0146105645780638da5cb5b146105845780639363470214610599578063a3e20380146105b9578063b4be83d5146105d9578063be7ada1e146105f9578063bfc8bfce14610619578063c585bb9314610639578063c75e0a8114610659578063d46b02c314610686578063d9bfa73e146106a6578063db123b1a146106c6578063dd1c7d18146106e8578063de30200d14610708578063e0acd33d14610728578063e0b701e314610748578063e306f77914610768578063e5fa431b1461077d578063eea086ba1461079d578063f2fde38b146107b2578063ffa1ad74146107d2575b600080fd5b34801561022a57600080fd5b5061023e610239366004614fb4565b6107e7565b60405161024b91906158fb565b60405180910390f35b34801561026057600080fd5b5061027461026f366004614d3e565b6107fe565b005b34801561028257600080fd5b50610296610291366004614fb4565b610812565b60405161024b9190615909565b3480156102af57600080fd5b506102966102be366004614b9c565b61081f565b3480156102cf57600080fd5b506102e36102de366004614abf565b610831565b60405161024b9190615be3565b3480156102fc57600080fd5b5061023e61030b366004614b9c565b61095c565b34801561031c57600080fd5b5061027461032b366004614bd9565b610971565b34801561033c57600080fd5b5061035061034b366004614dcb565b610a5e565b60405161024b9190615bf1565b34801561036957600080fd5b506102e3610378366004614ed2565b610bf5565b34801561038957600080fd5b5061039d610398366004614c9c565b610c4b565b60405161024b91906159c5565b3480156103b657600080fd5b506102746103c5366004614a8a565b610c73565b3480156103d657600080fd5b506102e36103e5366004614abf565b610d40565b3480156103f657600080fd5b50610274610405366004614b9c565b610e30565b34801561041657600080fd5b506102e3610425366004614abf565b610fe5565b34801561043657600080fd5b5061044a610445366004614c9c565b611079565b60405161024b919061581b565b34801561046357600080fd5b5061023e610472366004614b9c565b6110c7565b34801561048357600080fd5b506102e3610492366004614ed2565b6110dc565b3480156104a357600080fd5b506102e36104b2366004614cd8565b611187565b3480156104c357600080fd5b5061023e6104d2366004614fb4565b6111a2565b3480156104e357600080fd5b506102746104f2366004614a5a565b6111af565b34801561050357600080fd5b5061023e610512366004614a20565b6112e9565b34801561052357600080fd5b506102e3610532366004614b53565b611309565b34801561054357600080fd5b50610557610552366004614a8a565b61146d565b60405161024b91906158ea565b34801561057057600080fd5b5061023e61057f366004614bba565b611502565b34801561059057600080fd5b5061044a611522565b3480156105a557600080fd5b5061023e6105b4366004614c41565b61153e565b3480156105c557600080fd5b506102e36105d4366004614b53565b611ac1565b3480156105e557600080fd5b506102e36105f4366004614ed2565b611bd4565b34801561060557600080fd5b50610296610614366004614fb4565b611c4f565b34801561062557600080fd5b50610274610634366004614f1b565b611c5c565b34801561064557600080fd5b506102746106543660046149fa565b611ef5565b34801561066557600080fd5b50610679610674366004614d09565b612120565b60405161024b9190615c00565b34801561069257600080fd5b506102746106a1366004614d09565b61221a565b3480156106b257600080fd5b506102966106c1366004614a20565b6122b6565b3480156106d257600080fd5b506106db6122d3565b60405161024b91906159b4565b3480156106f457600080fd5b506102e3610703366004614b53565b61237e565b34801561071457600080fd5b50610296610723366004614fb4565b612453565b34801561073457600080fd5b50610296610743366004614fb4565b612460565b34801561075457600080fd5b506102e3610763366004614e8b565b61246d565b34801561077457600080fd5b5061029661247f565b34801561078957600080fd5b506102e3610798366004614b53565b612485565b3480156107a957600080fd5b5061044a6125f7565b3480156107be57600080fd5b506102746107cd3660046149fa565b612613565b3480156107de57600080fd5b506106db6126c4565b60006107f48484846126fb565b90505b9392505050565b61080b8585858585612780565b5050505050565b60006107f484848461282c565b60046020526000908152604090205481565b6108396145bd565b6000806108446145bd565b60005460ff161561088a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461092a5761091387838151811015156108d457fe5b9060200190602002015187848151811015156108ec57fe5b90602001906020020151878581518110151561090457fe5b9060200190602002015161288d565b905061091f848261292b565b6001909101906108bc565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509392505050565b60056020526000908152604090205460ff1681565b73ffffffffffffffffffffffffffffffffffffffff83163314610a01576109c9848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375061153e945050505050565b1515610a01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a93565b5050600091825260076020908152604080842073ffffffffffffffffffffffffffffffffffffffff9093168452919052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b610a666145e6565b610a6e614615565b610a76614615565b6000805460ff1615610ab4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561016080890151610140808a019190915289015190880152610b0088612120565b9250610b0b87612120565b9150610b1561298d565b9050610b23888483896129be565b610b2f878383886129be565b610b398888612b56565b610b4d888885604001518560400151612bb6565b805160208101519051919550610b68918a9186918190612d3d565b602080850151908101519051610b849189918591908190612d3d565b610b9d8882856020015186604001518860000151612780565b610bb68782846020015185604001518860200151612780565b610bc288888387612e4f565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550949350505050565b610bfd6145bd565b6060610c0a858585613027565b9050608081825160208401305af48015610c4157815183526020820151602084015260408201516040840152606082015160608401525b505b509392505050565b600b6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60008054819060ff1615610cb3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558151905b808214610d1357610d0b8382815181101515610cfc57fe5b906020019060200201516131f9565b600101610ce4565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b610d486145bd565b600080610d536145bd565b60005460ff1615610d90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461092a57610e198783815181101515610dda57fe5b906020019060200201518784815181101515610df257fe5b906020019060200201518785815181101515610e0a57fe5b90602001906020020151613224565b9050610e25848261292b565b600190910190610dc2565b6000805481908190819060ff1615610e74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610ea761298d565b935073ffffffffffffffffffffffffffffffffffffffff84163314610ecc5733610ecf565b60005b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600660209081526040808320938516835292905220549093506001860192509050808211610f46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b23565b73ffffffffffffffffffffffffffffffffffffffff80851660008181526006602090815260408083209488168084529490915290819020859055517f82af639571738f4ebd4268fb0363d8957ebe1bbb9e78dba5ebd69eed39b154f090610fae908690615909565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055505050565b610fed6145bd565b600080610ff86145bd565b86519250600091505b81831461106f57611058878381518110151561101957fe5b90602001906020020151878481518110151561103157fe5b90602001906020020151878581518110151561104957fe5b90602001906020020151610bf5565b9050611064848261292b565b600190910190611001565b5050509392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600b602052604090205473ffffffffffffffffffffffffffffffffffffffff165b919050565b60096020526000908152604090205460ff1681565b6110e46145bd565b60005460ff1615611121576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055611157848484613224565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055949350505050565b61118f6145bd565b611199838361292b565b50815b92915050565b60006107f4848484613277565b6000805460ff16156111ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561122061298d565b73ffffffffffffffffffffffffffffffffffffffff8181166000818152600860209081526040808320948916808452949091529081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168715151790555192935090917fa8656e308026eeabce8f0bc18048433252318ab80ac79da0b3d3d8697dfba891906112b49086906158fb565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b600860209081526000928352604080842090915290825290205460ff1681565b6113116145bd565b606060008060006113206145bd565b60005460ff161561135d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117815589518a9190811061139557fe5b906020019060200201516101600151945088519350600092505b828414611438578489848151811015156113c557fe5b9060200190602002015161016001819052506113e58887602001516132fc565b915061141189848151811015156113f857fe5b9060200190602002015183898681518110151561090457fe5b905061141d868261292b565b6020860151881161142d57611438565b6001909201916113af565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509195945050505050565b606060006060600084519250826040519080825280602002602001820160405280156114b357816020015b6114a0614615565b8152602001906001900390816114985790505b509150600090505b808314610c43576114e285828151811015156114d357fe5b90602001906020020151612120565b82828151811015156114f057fe5b602090810290910101526001016114bb565b600760209081526000928352604080842090915290825290205460ff1681565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060008060008951111515611587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b13565b6115908961333e565b7f010000000000000000000000000000000000000000000000000000000000000090049650600760ff8816106115f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a33565b8660ff16600781111561160157fe5b9550600086600781111561161157fe5b1415611649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b03565b600186600781111561165757fe5b141561169f57885115611696576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615bd3565b60009750611ab3565b60028660078111156116ad57fe5b14156117e85788516041146116ee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610881906159d3565b8860008151811015156116fd57fe5b01602001517f010000000000000000000000000000000000000000000000000000000000000090819004810204945061173d89600163ffffffff61340216565b935061175089602163ffffffff61340216565b925060018b868686604051600081526020016040526040516117759493929190615964565b60206040516020810390808403906000865af1158015611799573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff8c81169082161499509250611ab39050565b60038660078111156117f657fe5b141561199c578851604114611837576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610881906159d3565b88600081518110151561184657fe5b01602001517f010000000000000000000000000000000000000000000000000000000000000090819004810204945061188689600163ffffffff61340216565b935061189989602163ffffffff61340216565b925060018b60405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b6020831061193a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016118fd565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260408051929094018290038220600083529101928390526117759450925089918991508890615964565b60048660078111156119aa57fe5b14156119c2576119bb8b8b8b61344d565b9750611ab3565b60058660078111156119d057fe5b1415611a33576119df896135a2565b73ffffffffffffffffffffffffffffffffffffffff808c1660009081526008602090815260408083209385168352929052205490915060ff161515611a275760009750611ab3565b6119bb818c8c8c61361b565b6006866007811115611a4157fe5b1415611a815760008b815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290205460ff169750611ab3565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a33565b505050505050509392505050565b611ac96145bd565b6060600080600080611ad96145bd565b896000815181101515611ae857fe5b906020019060200201516101400151955089519450600093505b838514611bc757858a85815181101515611b1857fe5b6020908102909101015161014001528651611b34908a906132fc565b9250611b778a85815181101515611b4757fe5b9060200190602002015160a001518b86815181101515611b6357fe5b906020019060200201516080015185613777565b9150611ba38a85815181101515611b8a57fe5b90602001906020020151838a8781518110151561104957fe5b9050611baf878261292b565b86518911611bbc57611bc7565b600190930192611b02565b5050505050509392505050565b611bdc6145bd565b60005460ff1615611c19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561115784848461288d565b60006107f4848484613777565b600a5460009073ffffffffffffffffffffffffffffffffffffffff1615611caf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b611cf2611ced888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437506137bf945050505050565b613a00565b60008181526009602052604090205490915060ff1615611d3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a83565b73ffffffffffffffffffffffffffffffffffffffff86163314611e0f57611d96818785858080601f0160208091040260200160405190810160405280939291908181526020018383808284375061153e945050505050565b1515611dce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615bc3565b600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555b6000818152600960205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555130908690869080838380828437820191505092505050600060405180830381855af49150501515611ea6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ab3565b73ffffffffffffffffffffffffffffffffffffffff86163314611eec57600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b50505050505050565b6003546000908190819073ffffffffffffffffffffffffffffffffffffffff163314611f4d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b73565b8392508273ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611fb457600080fd5b505af1158015611fc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611fec9190810190614cba565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600b602052604090205490925073ffffffffffffffffffffffffffffffffffffffff1690508015612071576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a13565b7fffffffff0000000000000000000000000000000000000000000000000000000082166000908152600b60205260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c03194906121129084908790615999565b60405180910390a150505050565b612128614615565b61213182613a3d565b60208083018290526000918252600490526040908190205490820152608082015115156121655760015b60ff1681526110c2565b60a0820151151561217757600261215b565b60a082015160408201511061218d57600561215b565b61010082015142106121a057600461215b565b60208082015160009081526005909152604090205460ff16156121c457600661215b565b610120820151825173ffffffffffffffffffffffffffffffffffffffff9081166000908152600660209081526040808320606088015190941683529290522054111561221157600661215b565b60038152919050565b60005460ff1615612257576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561228b816131f9565b50600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600660209081526000928352604080842090915290825290205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156123765780601f1061234b57610100808354040283529160200191612376565b820191906000526020600020905b81548152906001019060200180831161235957829003601f168201915b505050505081565b6123866145bd565b606060008060006123956145bd565b8860008151811015156123a457fe5b906020019060200201516101600151945088519350600092505b828414612447578489848151811015156123d457fe5b9060200190602002015161016001819052506123f48887602001516132fc565b9150612420898481518110151561240757fe5b9060200190602002015183898681518110151561104957fe5b905061242c868261292b565b6020860151881161243c57612447565b6001909201916123be565b50505050509392505050565b60006107f4848484613a4b565b60006107f4848484613ac8565b6124756145bd565b6107f78383613b45565b60025481565b61248d6145bd565b606060008060008061249d6145bd565b60005460ff16156124da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558a518b9190811061251257fe5b906020019060200201516101400151955089519450600093505b8385146125c157858a8581518110151561254257fe5b602090810290910101516101400152865161255e908a906132fc565b92506125718a85815181101515611b4757fe5b915061259d8a8581518110151561258457fe5b90602001906020020151838a8781518110151561090457fe5b90506125a9878261292b565b865189116125b6576125c1565b60019093019261252c565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550929695505050505050565b600a5473ffffffffffffffffffffffffffffffffffffffff1681565b60035473ffffffffffffffffffffffffffffffffffffffff163314612664576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b73565b73ffffffffffffffffffffffffffffffffffffffff8116156126c157600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60408051808201909152600b81527f322e302e312d616c706861000000000000000000000000000000000000000000602082015281565b600080808411612737576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b821580612742575084155b156127505760009150610c43565b8380151561275a57fe5b85840990506127698584613ba6565b6127756103e883613ba6565b101595945050505050565b61278e828260200151613c0c565b600084815260046020908152604091829020929092558681015187518451938501518584015160608701516101408c01516101608d015196518b9873ffffffffffffffffffffffffffffffffffffffff9788169897909616967f0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c3711299661281d968f96339692959194909390615829565b60405180910390a45050505050565b6000808311612867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b6107f46128876128778685613ba6565b6128828660016132fc565b613c0c565b84613c4b565b6128956145bd565b61289d614615565b60008060006128ab88612120565b93506128b561298d565b92506128c3888585896129be565b6128d58860a0015185604001516132fc565b91506128e18783613c62565b90506128f4888589848960000151612d3d565b6128fe8882613b45565b945061291588848660200151876040015189612780565b612920888487613c71565b505050509392505050565b815181516129399190613c0c565b82526020808301519082015161294f9190613c0c565b6020830152604080830151908201516129689190613c0c565b6040830152606080830151908201516129819190613c0c565b60609092019190915250565b600a5460009073ffffffffffffffffffffffffffffffffffffffff168181156129b657816107f7565b339392505050565b825160ff166003146129fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b93565b606084015173ffffffffffffffffffffffffffffffffffffffff1615612a6f57606084015173ffffffffffffffffffffffffffffffffffffffff163314612a6f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ba3565b602084015173ffffffffffffffffffffffffffffffffffffffff1615612afa578173ffffffffffffffffffffffffffffffffffffffff16846020015173ffffffffffffffffffffffffffffffffffffffff16141515612afa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610881906159e3565b60408301511515612b5057612b18836020015185600001518361153e565b1515612b50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a53565b50505050565b612b688260a001518260a00151613ba6565b612b7a83608001518360800151613ba6565b1015612bb2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615bb3565b5050565b612bbe6145e6565b600080600080612bd28960a00151886132fc565b9350612be789608001518a60a0015186613a4b565b9250612bf78860a00151876132fc565b9150612c0c88608001518960a0015184613a4b565b9050808410612c4f5760208086018051839052805182018490525151865182015260808a015160a08b0151875190920151612c479290613a4b565b855152612c8c565b845183905284516020908101859052855181015190860180519190915260a089015160808a0151915151612c839290613ac8565b60208087015101525b8451516020808701510151612ca191906132fc565b604086015284515160808a015160c08b0151612cbe929190613a4b565b85516040015284516020015160a08a015160e08b0151612cdf929190613a4b565b855160600152602085015151608089015160c08a0151612d00929190613a4b565b85602001516040018181525050612d288560200151602001518960a001518a60e00151613a4b565b60208601516060015250505050949350505050565b821515612d76576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ad3565b82821115612db0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ac3565b8460a00151612dc3856040015184613c0c565b1115612dfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610881906159f3565b612e09856080015183613ba6565b612e17828760a00151613ba6565b111561080b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b53565b60018054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008789161502019095169490940493840181900481028201810190925282815260609390929091830182828015612ef85780601f10612ecd57610100808354040283529160200191612ef8565b820191906000526020600020905b815481529060010190602001808311612edb57829003601f168201915b50505050509050612f2085610140015186600001518660000151856020015160200151613d7b565b61014084015184518651845160200151612f3c93929190613d7b565b612f558561014001518660000151858560400151613d7b565b612f718186600001518760400151856000015160400151613d7b565b612f8d8185600001518660400151856020015160400151613d7b565b836040015173ffffffffffffffffffffffffffffffffffffffff16856040015173ffffffffffffffffffffffffffffffffffffffff161415612ff757612ff281848760400151612fed866000015160600151876020015160600151613c0c565b613d7b565b61080b565b61300f81848760400151856000015160600151613d7b565b61080b81848660400151856020015160600151613d7b565b604080517fb4be83d5000000000000000000000000000000000000000000000000000000006020808301919091526060602483018181528751608485019081528884015160a48601529488015160c48501529087015160e4840152608087015161010484015260a087015161012484015260c087015161014484015260e08701516101648401526101008701516101848401526101208701516101a4840152610140870180516101c485019081526101608901516101e4860152610180905251805161020485018190529394919384936044870192849261022489019291820191601f82010460005b8181101561312e578351855260209485019490930192600101613110565b50505050818103610160808401919091528a0151805180835260209283019291820191601f82010460005b81811015613177578351855260209485019490930192600101613159565b50505089845250848103602093840190815288518083529093918201918981019190601f82010460005b818110156131bf5783518552602094850194909301926001016131a1565b5050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08883030188525060405250505050509392505050565b613201614615565b61320a82612120565b90506132168282613f45565b612bb282826020015161405c565b61322c6145bd565b61323784848461288d565b602081015190915083146107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b43565b6000808084116132b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b8215806132be575084155b156132cc5760009150610c43565b838015156132d657fe5b8584099050836132e685836132fc565b8115156132ef57fe5b0690506127698584613ba6565b600082821115613338576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a03565b50900390565b600080825111151561337c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615af3565b815182907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81019081106133ac57fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909252507f0100000000000000000000000000000000000000000000000000000000000000908190040290565b600081602001835110151515613444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a23565b50016020015190565b6040516000906060907f1626ba7e00000000000000000000000000000000000000000000000000000000906134889087908690602401615944565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093178352815191935090829081885afa808015613525576001811461359657612920565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0c57414c4c45545f4552524f5200000000000000000000000000000000604052600060605260646000fd5b50505195945050505050565b600060148251101515156135e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b83565b6135f0826014845103614103565b82517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec019092525090565b6040516000906060907f93634702000000000000000000000000000000000000000000000000000000009061365890879087908790602401615917565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931783528151919350908290818a5afa8080156136f557600181146137665761376b565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f56414c494441544f525f4552524f5200000000000000000000000000604052600060605260646000fd5b825194505b50505050949350505050565b60008083116137b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b6107f46128878584613ba6565b604080517f5a65726f45785472616e73616374696f6e2800000000000000000000000000006020808301919091527f75696e743235362073616c742c0000000000000000000000000000000000000060328301527f61646472657373207369676e6572416464726573732c00000000000000000000603f8301527f627974657320646174610000000000000000000000000000000000000000000060558301527f2900000000000000000000000000000000000000000000000000000000000000605f830152825180830384018152606090920192839052815160009384938493909282918401908083835b602083106138e857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016138ab565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260405191909301819003812089519097508995509093508392850191508083835b6020831061397e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613941565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822097825281019a909a525073ffffffffffffffffffffffffffffffffffffffff97909716968801969096525050606085015250506080909120919050565b600280546040517f190100000000000000000000000000000000000000000000000000000000000081529182015260228101919091526042902090565b600061119c611ced83614164565b6000808311613a86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b613a918484846126fb565b156137b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615aa3565b6000808311613b03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b613b0e848484613277565b15612867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615aa3565b613b4d6145bd565b6020810182905260a08301516080840151613b69918491613a4b565b808252608084015160c0850151613b81929190613a4b565b604082015260a083015160e0840151613b9b918491613a4b565b606082015292915050565b600080831515613bb95760009150613c05565b50828202828482811515613bc957fe5b0414613c01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a73565b8091505b5092915050565b600082820183811015613c01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a73565b6000808284811515613c5957fe5b04949350505050565b600081831061119957816107f7565b60018054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008789161502019095169490940493840181900481028201810190925282815260609390929091830182828015613d1a5780601f10613cef57610100808354040283529160200191613d1a565b820191906000526020600020905b815481529060010190602001808311613cfd57829003601f168201915b50505050509050613d3a8461014001518560000151858560000151613d7b565b613d538461016001518486600001518560200151613d7b565b613d6b81856000015186604001518560400151613d7b565b612b508184866040015185606001515b600080600083118015613dba57508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15613f3d578551600310613dfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b33565b50506020848101517fffffffff00000000000000000000000000000000000000000000000000000000166000818152600b90925260409091205473ffffffffffffffffffffffffffffffffffffffff16801515613e83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ae3565b604051660fffffffffffe0603f885101168060840182017fa85e59e40000000000000000000000000000000000000000000000000000000083526080600484015273ffffffffffffffffffffffffffffffffffffffff8816602484015273ffffffffffffffffffffffffffffffffffffffff87166044840152856064840152608483015b81811015613f1f57895181526020998a019901613f07565b61020084858403866000895af1801515613f37573d85fd5b50505050505b505050505050565b805160009060ff16600314613f86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b93565b606083015173ffffffffffffffffffffffffffffffffffffffff1615613ff957606083015173ffffffffffffffffffffffffffffffffffffffff163314613ff9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ba3565b61400161298d565b835190915073ffffffffffffffffffffffffffffffffffffffff808316911614614057576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a63565b505050565b6000818152600560205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558281015183516101408501516101608601519351859473ffffffffffffffffffffffffffffffffffffffff9485169493909316927fdc47b3613d9fe400085f6dbdc99453462279057e6207385042827ed6b1a62cf7926140f7923392906158ad565b60405180910390a45050565b600081601401835110151515614145576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b83565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b604080517f4f726465722800000000000000000000000000000000000000000000000000006020808301919091527f61646472657373206d616b6572416464726573732c000000000000000000000060268301527f616464726573732074616b6572416464726573732c0000000000000000000000603b8301527f6164647265737320666565526563697069656e74416464726573732c0000000060508301527f616464726573732073656e646572416464726573732c00000000000000000000606c8301527f75696e74323536206d616b65724173736574416d6f756e742c0000000000000060828301527f75696e743235362074616b65724173736574416d6f756e742c00000000000000609b8301527f75696e74323536206d616b65724665652c00000000000000000000000000000060b48301527f75696e743235362074616b65724665652c00000000000000000000000000000060c58301527f75696e743235362065787069726174696f6e54696d655365636f6e64732c000060d68301527f75696e743235362073616c742c0000000000000000000000000000000000000060f48301527f6279746573206d616b65724173736574446174612c00000000000000000000006101018301527f62797465732074616b65724173736574446174610000000000000000000000006101168301527f290000000000000000000000000000000000000000000000000000000000000061012a830152825161010b81840301815261012b90920192839052815160009384938493849391929182918401908083835b602083106143ec57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016143af565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101408b0151805191995095509093508392850191508083835b6020831061448757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161444a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101608b0151805191985095509093508392850191508083835b6020831061452257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016144e5565b5181516020939093036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909116921691909117905260405192018290039091207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0890180516101408b018051610160909c0180519a84529881529288526101a0822091529890525050509190525090919050565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b610120604051908101604052806145fb6145bd565b81526020016146086145bd565b8152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b60006107f78235615ca6565b6000601f8201831361465257600080fd5b813561466561466082615c35565b615c0e565b81815260209384019390925082018360005b838110156146a3578135860161468d88826147f3565b8452506020928301929190910190600101614677565b5050505092915050565b6000601f820183136146be57600080fd5b81356146cc61466082615c35565b81815260209384019390925082018360005b838110156146a357813586016146f488826148b1565b84525060209283019291909101906001016146de565b6000601f8201831361471b57600080fd5b813561472961466082615c35565b9150818183526020840193506020810190508385602084028201111561474e57600080fd5b60005b838110156146a357816147648882614786565b8452506020928301929190910190600101614751565b60006107f78235615cbf565b60006107f78235615cc4565b60006107f78235615cc7565b60006107f78251615cc7565b600080601f830184136147bc57600080fd5b50813567ffffffffffffffff8111156147d457600080fd5b6020830191508360018202830111156147ec57600080fd5b9250929050565b6000601f8201831361480457600080fd5b813561481261466082615c56565b9150808252602083016020830185838301111561482e57600080fd5b614839838284615cfd565b50505092915050565b60006080828403121561485457600080fd5b61485e6080615c0e565b9050600061486c8484614786565b825250602061487d84848301614786565b602083015250604061489184828501614786565b60408301525060606148a584828501614786565b60608301525092915050565b600061018082840312156148c457600080fd5b6148cf610180615c0e565b905060006148dd8484614635565b82525060206148ee84848301614635565b602083015250604061490284828501614635565b604083015250606061491684828501614635565b606083015250608061492a84828501614786565b60808301525060a061493e84828501614786565b60a08301525060c061495284828501614786565b60c08301525060e061496684828501614786565b60e08301525061010061497b84828501614786565b6101008301525061012061499184828501614786565b6101208301525061014082013567ffffffffffffffff8111156149b357600080fd5b6149bf848285016147f3565b6101408301525061016082013567ffffffffffffffff8111156149e157600080fd5b6149ed848285016147f3565b6101608301525092915050565b600060208284031215614a0c57600080fd5b6000614a188484614635565b949350505050565b60008060408385031215614a3357600080fd5b6000614a3f8585614635565b9250506020614a5085828601614635565b9150509250929050565b60008060408385031215614a6d57600080fd5b6000614a798585614635565b9250506020614a508582860161477a565b600060208284031215614a9c57600080fd5b813567ffffffffffffffff811115614ab357600080fd5b614a18848285016146ad565b600080600060608486031215614ad457600080fd5b833567ffffffffffffffff811115614aeb57600080fd5b614af7868287016146ad565b935050602084013567ffffffffffffffff811115614b1457600080fd5b614b208682870161470a565b925050604084013567ffffffffffffffff811115614b3d57600080fd5b614b4986828701614641565b9150509250925092565b600080600060608486031215614b6857600080fd5b833567ffffffffffffffff811115614b7f57600080fd5b614b8b868287016146ad565b9350506020614b2086828701614786565b600060208284031215614bae57600080fd5b6000614a188484614786565b60008060408385031215614bcd57600080fd5b6000614a3f8585614786565b60008060008060608587031215614bef57600080fd5b6000614bfb8787614786565b9450506020614c0c87828801614635565b935050604085013567ffffffffffffffff811115614c2957600080fd5b614c35878288016147aa565b95989497509550505050565b600080600060608486031215614c5657600080fd5b6000614c628686614786565b9350506020614c7386828701614635565b925050604084013567ffffffffffffffff811115614c9057600080fd5b614b49868287016147f3565b600060208284031215614cae57600080fd5b6000614a188484614792565b600060208284031215614ccc57600080fd5b6000614a18848461479e565b6000806101008385031215614cec57600080fd5b6000614cf88585614842565b9250506080614a5085828601614842565b600060208284031215614d1b57600080fd5b813567ffffffffffffffff811115614d3257600080fd5b614a18848285016148b1565b60008060008060006101008688031215614d5757600080fd5b853567ffffffffffffffff811115614d6e57600080fd5b614d7a888289016148b1565b9550506020614d8b88828901614635565b9450506040614d9c88828901614786565b9350506060614dad88828901614786565b9250506080614dbe88828901614842565b9150509295509295909350565b60008060008060808587031215614de157600080fd5b843567ffffffffffffffff811115614df857600080fd5b614e04878288016148b1565b945050602085013567ffffffffffffffff811115614e2157600080fd5b614e2d878288016148b1565b935050604085013567ffffffffffffffff811115614e4a57600080fd5b614e56878288016147f3565b925050606085013567ffffffffffffffff811115614e7357600080fd5b614e7f878288016147f3565b91505092959194509250565b60008060408385031215614e9e57600080fd5b823567ffffffffffffffff811115614eb557600080fd5b614ec1858286016148b1565b9250506020614a5085828601614786565b600080600060608486031215614ee757600080fd5b833567ffffffffffffffff811115614efe57600080fd5b614f0a868287016148b1565b9350506020614c7386828701614786565b60008060008060008060808789031215614f3457600080fd5b6000614f408989614786565b9650506020614f5189828a01614635565b955050604087013567ffffffffffffffff811115614f6e57600080fd5b614f7a89828a016147aa565b9450945050606087013567ffffffffffffffff811115614f9957600080fd5b614fa589828a016147aa565b92509250509295509295509295565b600080600060608486031215614fc957600080fd5b6000614fd58686614786565b9350506020614fe686828701614786565b9250506040614b4986828701614786565b61500081615ca6565b82525050565b600061501182615ca2565b80845260208401935061502383615c9c565b60005b82811015615053576150398683516157db565b61504282615c9c565b606096909601959150600101615026565b5093949350505050565b61500081615cbf565b61500081615cc4565b61500081615cc7565b600061508382615ca2565b808452615097816020860160208601615d09565b6150a081615d35565b9093016020019392505050565b61500081615cf2565b601281527f4c454e4754485f36355f52455155495245440000000000000000000000000000602082015260400190565b600d81527f494e56414c49445f54414b455200000000000000000000000000000000000000602082015260400190565b600e81527f4f524445525f4f56455246494c4c000000000000000000000000000000000000602082015260400190565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f414c52454144595f455849535453000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601581527f5349474e41545552455f554e535550504f525445440000000000000000000000602082015260400190565b601081527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000602082015260400190565b601781527f494e56414c49445f4f524445525f5349474e4154555245000000000000000000602082015260400190565b600d81527f494e56414c49445f4d414b455200000000000000000000000000000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b600f81527f494e56414c49445f54585f484153480000000000000000000000000000000000602082015260400190565b601181527f494e56414c49445f5349474e4154555245000000000000000000000000000000602082015260400190565b600e81527f524f554e44494e475f4552524f52000000000000000000000000000000000000602082015260400190565b601081527f4641494c45445f455845435554494f4e00000000000000000000000000000000602082015260400190565b600d81527f54414b45525f4f56455250415900000000000000000000000000000000000000602082015260400190565b601481527f494e56414c49445f54414b45525f414d4f554e54000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f444f45535f4e4f545f4558495354000000000000602082015260400190565b602181527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560208201527f4400000000000000000000000000000000000000000000000000000000000000604082015260600190565b601181527f5349474e41545552455f494c4c4547414c000000000000000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f305f52455155495245440000602082015260400190565b601781527f494e56414c49445f4e45575f4f524445525f45504f4348000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f335f52455155495245440000602082015260400190565b601481527f434f4d504c4554455f46494c4c5f4641494c4544000000000000000000000000602082015260400190565b601281527f494e56414c49445f46494c4c5f50524943450000000000000000000000000000602082015260400190565b601281527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000602082015260400190565b601381527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601081527f4f524445525f554e46494c4c41424c4500000000000000000000000000000000602082015260400190565b600e81527f494e56414c49445f53454e444552000000000000000000000000000000000000602082015260400190565b601881527f4e454741544956455f5350524541445f52455155495245440000000000000000602082015260400190565b601481527f494e56414c49445f54585f5349474e4154555245000000000000000000000000602082015260400190565b601181527f4c454e4754485f305f5245515549524544000000000000000000000000000000602082015260400190565b805160808301906157698482615066565b50602082015161577c6020850182615066565b50604082015161578f6040850182615066565b506060820151612b506060850182615066565b80516101208301906157b48482615758565b5060208201516157c76080850182615758565b506040820151612b50610100850182615066565b805160608301906157ec8482615812565b5060208201516157ff6020850182615066565b506040820151612b506040850182615066565b61500081615cec565b6020810161119c8284614ff7565b6101008101615838828b614ff7565b615845602083018a614ff7565b6158526040830189615066565b61585f6060830188615066565b61586c6080830187615066565b61587960a0830186615066565b81810360c083015261588b8185615078565b905081810360e083015261589f8184615078565b9a9950505050505050505050565b606081016158bb8286614ff7565b81810360208301526158cd8185615078565b905081810360408301526158e18184615078565b95945050505050565b602080825281016107f78184615006565b6020810161119c828461505d565b6020810161119c8284615066565b606081016159258286615066565b6159326020830185614ff7565b81810360408301526158e18184615078565b604081016159528285615066565b81810360208301526107f48184615078565b608081016159728287615066565b61597f6020830186615812565b61598c6040830185615066565b6158e16060830184615066565b604081016159a7828561506f565b6107f76020830184614ff7565b602080825281016107f78184615078565b6020810161119c82846150ad565b6020808252810161119c816150b6565b6020808252810161119c816150e6565b6020808252810161119c81615116565b6020808252810161119c81615146565b6020808252810161119c81615176565b6020808252810161119c816151a6565b6020808252810161119c816151fc565b6020808252810161119c8161522c565b6020808252810161119c8161525c565b6020808252810161119c8161528c565b6020808252810161119c816152bc565b6020808252810161119c816152ec565b6020808252810161119c8161531c565b6020808252810161119c8161534c565b6020808252810161119c8161537c565b6020808252810161119c816153ac565b6020808252810161119c816153dc565b6020808252810161119c8161540c565b6020808252810161119c8161543c565b6020808252810161119c81615492565b6020808252810161119c816154c2565b6020808252810161119c816154f2565b6020808252810161119c81615522565b6020808252810161119c81615552565b6020808252810161119c81615582565b6020808252810161119c816155b2565b6020808252810161119c816155e2565b6020808252810161119c81615612565b6020808252810161119c81615668565b6020808252810161119c81615698565b6020808252810161119c816156c8565b6020808252810161119c816156f8565b6020808252810161119c81615728565b6080810161119c8284615758565b610120810161119c82846157a2565b6060810161119c82846157db565b60405181810167ffffffffffffffff81118282101715615c2d57600080fd5b604052919050565b600067ffffffffffffffff821115615c4c57600080fd5b5060209081020190565b600067ffffffffffffffff821115615c6d57600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b600061119c82615ca6565b82818337506000910152565b60005b83811015615d24578181015183820152602001615d0c565b83811115612b505750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820a0d8acecb3333dd721a822fb1c86c7714fc5a48327fd1bd94e3356ca224d82826c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF NOT AND SWAP1 SSTORE CALLVALUE DUP1 ISZERO PUSH3 0x1B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP2 ADD SWAP2 DUP3 SWAP1 MSTORE PUSH1 0x0 DUP1 DUP3 MSTORE SWAP1 SWAP2 DUP3 SWAP2 PUSH3 0x3F SWAP2 PUSH1 0x1 SWAP2 PUSH3 0x333 JUMP JUMPDEST POP POP PUSH1 0x40 DUP1 MLOAD PUSH32 0x454950373132446F6D61696E2800000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x737472696E67206E616D652C0000000000000000000000000000000000000000 PUSH1 0x2D DUP4 ADD MSTORE PUSH32 0x737472696E672076657273696F6E2C0000000000000000000000000000000000 PUSH1 0x39 DUP4 ADD MSTORE PUSH32 0x6164647265737320766572696679696E67436F6E747261637400000000000000 PUSH1 0x48 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0x61 DUP4 ADD MSTORE DUP3 MLOAD PUSH1 0x42 DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH1 0x62 SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD SWAP2 SWAP3 SWAP2 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH3 0x149 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH3 0x128 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP6 ADD DUP6 MSTORE PUSH1 0xB DUP1 DUP5 MSTORE PUSH32 0x30782050726F746F636F6C000000000000000000000000000000000000000000 SWAP3 DUP5 ADD SWAP3 DUP4 MSTORE SWAP5 MLOAD SWAP1 SWAP7 POP SWAP2 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH3 0x1D3 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH3 0x1B2 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP6 ADD DUP6 MSTORE PUSH1 0x1 DUP1 DUP5 MSTORE PUSH32 0x3200000000000000000000000000000000000000000000000000000000000000 SWAP3 DUP5 ADD SWAP3 DUP4 MSTORE SWAP5 MLOAD SWAP1 SWAP7 POP SWAP2 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH3 0x25D JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH3 0x23C JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP3 ADD SWAP9 SWAP1 SWAP9 MSTORE DUP2 DUP5 ADD SWAP7 SWAP1 SWAP7 MSTORE PUSH1 0x60 DUP2 ADD SWAP7 SWAP1 SWAP7 MSTORE POP ADDRESS PUSH1 0x80 DUP1 DUP8 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP2 MLOAD DUP1 DUP8 SUB SWAP1 SWAP2 ADD DUP2 MSTORE PUSH1 0xA0 SWAP1 SWAP6 ADD SWAP1 DUP2 SWAP1 MSTORE DUP5 MLOAD SWAP1 SWAP4 DUP5 SWAP4 POP DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH3 0x2E8 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH3 0x2C7 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x0 NOT PUSH1 0x20 SWAP5 SWAP1 SWAP5 SUB PUSH2 0x100 EXP SWAP4 SWAP1 SWAP4 ADD SWAP3 DUP4 AND SWAP3 NOT AND SWAP2 SWAP1 SWAP2 OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP1 SWAP2 KECCAK256 PUSH1 0x2 SSTORE POP POP PUSH1 0x3 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT AND CALLER OR SWAP1 SSTORE POP PUSH3 0x3D8 SWAP1 POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH3 0x376 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH3 0x3A6 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH3 0x3A6 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0x3A6 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH3 0x389 JUMP JUMPDEST POP PUSH3 0x3B4 SWAP3 SWAP2 POP PUSH3 0x3B8 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x3D5 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x3B4 JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x3BF JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x5D97 DUP1 PUSH3 0x3E8 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x219 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x1BE23901 DUP2 EQ PUSH2 0x21E JUMPI DUP1 PUSH4 0x1EA1E3D8 EQ PUSH2 0x254 JUMPI DUP1 PUSH4 0x20777F70 EQ PUSH2 0x276 JUMPI DUP1 PUSH4 0x288CDC91 EQ PUSH2 0x2A3 JUMPI DUP1 PUSH4 0x297BB70B EQ PUSH2 0x2C3 JUMPI DUP1 PUSH4 0x2AC12622 EQ PUSH2 0x2F0 JUMPI DUP1 PUSH4 0x3683EF8E EQ PUSH2 0x310 JUMPI DUP1 PUSH4 0x3C28D861 EQ PUSH2 0x330 JUMPI DUP1 PUSH4 0x3E228BAE EQ PUSH2 0x35D JUMPI DUP1 PUSH4 0x3FD3C997 EQ PUSH2 0x37D JUMPI DUP1 PUSH4 0x4AC14782 EQ PUSH2 0x3AA JUMPI DUP1 PUSH4 0x4D0AE546 EQ PUSH2 0x3CA JUMPI DUP1 PUSH4 0x4F9559B1 EQ PUSH2 0x3EA JUMPI DUP1 PUSH4 0x50DDE190 EQ PUSH2 0x40A JUMPI DUP1 PUSH4 0x60704108 EQ PUSH2 0x42A JUMPI DUP1 PUSH4 0x642F2EAF EQ PUSH2 0x457 JUMPI DUP1 PUSH4 0x64A3BC15 EQ PUSH2 0x477 JUMPI DUP1 PUSH4 0x66758D7B EQ PUSH2 0x497 JUMPI DUP1 PUSH4 0x679D2F9A EQ PUSH2 0x4B7 JUMPI DUP1 PUSH4 0x77FCCE68 EQ PUSH2 0x4D7 JUMPI DUP1 PUSH4 0x7B8E3514 EQ PUSH2 0x4F7 JUMPI DUP1 PUSH4 0x7E1D9808 EQ PUSH2 0x517 JUMPI DUP1 PUSH4 0x7E9D74DC EQ PUSH2 0x537 JUMPI DUP1 PUSH4 0x82C174D0 EQ PUSH2 0x564 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x584 JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0x599 JUMPI DUP1 PUSH4 0xA3E20380 EQ PUSH2 0x5B9 JUMPI DUP1 PUSH4 0xB4BE83D5 EQ PUSH2 0x5D9 JUMPI DUP1 PUSH4 0xBE7ADA1E EQ PUSH2 0x5F9 JUMPI DUP1 PUSH4 0xBFC8BFCE EQ PUSH2 0x619 JUMPI DUP1 PUSH4 0xC585BB93 EQ PUSH2 0x639 JUMPI DUP1 PUSH4 0xC75E0A81 EQ PUSH2 0x659 JUMPI DUP1 PUSH4 0xD46B02C3 EQ PUSH2 0x686 JUMPI DUP1 PUSH4 0xD9BFA73E EQ PUSH2 0x6A6 JUMPI DUP1 PUSH4 0xDB123B1A EQ PUSH2 0x6C6 JUMPI DUP1 PUSH4 0xDD1C7D18 EQ PUSH2 0x6E8 JUMPI DUP1 PUSH4 0xDE30200D EQ PUSH2 0x708 JUMPI DUP1 PUSH4 0xE0ACD33D EQ PUSH2 0x728 JUMPI DUP1 PUSH4 0xE0B701E3 EQ PUSH2 0x748 JUMPI DUP1 PUSH4 0xE306F779 EQ PUSH2 0x768 JUMPI DUP1 PUSH4 0xE5FA431B EQ PUSH2 0x77D JUMPI DUP1 PUSH4 0xEEA086BA EQ PUSH2 0x79D JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x7B2 JUMPI DUP1 PUSH4 0xFFA1AD74 EQ PUSH2 0x7D2 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x22A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x239 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x7E7 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x58FB JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x260 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x26F CALLDATASIZE PUSH1 0x4 PUSH2 0x4D3E JUMP JUMPDEST PUSH2 0x7FE JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x282 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x291 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x812 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x5909 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x2BE CALLDATASIZE PUSH1 0x4 PUSH2 0x4B9C JUMP JUMPDEST PUSH2 0x81F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2CF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x2DE CALLDATASIZE PUSH1 0x4 PUSH2 0x4ABF JUMP JUMPDEST PUSH2 0x831 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x5BE3 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2FC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x30B CALLDATASIZE PUSH1 0x4 PUSH2 0x4B9C JUMP JUMPDEST PUSH2 0x95C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x31C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x32B CALLDATASIZE PUSH1 0x4 PUSH2 0x4BD9 JUMP JUMPDEST PUSH2 0x971 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x33C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x350 PUSH2 0x34B CALLDATASIZE PUSH1 0x4 PUSH2 0x4DCB JUMP JUMPDEST PUSH2 0xA5E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x5BF1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x369 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x378 CALLDATASIZE PUSH1 0x4 PUSH2 0x4ED2 JUMP JUMPDEST PUSH2 0xBF5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x389 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x39D PUSH2 0x398 CALLDATASIZE PUSH1 0x4 PUSH2 0x4C9C JUMP JUMPDEST PUSH2 0xC4B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x59C5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3B6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x3C5 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A8A JUMP JUMPDEST PUSH2 0xC73 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x3E5 CALLDATASIZE PUSH1 0x4 PUSH2 0x4ABF JUMP JUMPDEST PUSH2 0xD40 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3F6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x405 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B9C JUMP JUMPDEST PUSH2 0xE30 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x416 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x425 CALLDATASIZE PUSH1 0x4 PUSH2 0x4ABF JUMP JUMPDEST PUSH2 0xFE5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x436 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x44A PUSH2 0x445 CALLDATASIZE PUSH1 0x4 PUSH2 0x4C9C JUMP JUMPDEST PUSH2 0x1079 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x581B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x463 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x472 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B9C JUMP JUMPDEST PUSH2 0x10C7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x483 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x492 CALLDATASIZE PUSH1 0x4 PUSH2 0x4ED2 JUMP JUMPDEST PUSH2 0x10DC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4A3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x4B2 CALLDATASIZE PUSH1 0x4 PUSH2 0x4CD8 JUMP JUMPDEST PUSH2 0x1187 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x4D2 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x11A2 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4E3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x4F2 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A5A JUMP JUMPDEST PUSH2 0x11AF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x503 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x512 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A20 JUMP JUMPDEST PUSH2 0x12E9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x523 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x532 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B53 JUMP JUMPDEST PUSH2 0x1309 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x543 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x557 PUSH2 0x552 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A8A JUMP JUMPDEST PUSH2 0x146D JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x58EA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x570 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x57F CALLDATASIZE PUSH1 0x4 PUSH2 0x4BBA JUMP JUMPDEST PUSH2 0x1502 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x590 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x44A PUSH2 0x1522 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5A5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x5B4 CALLDATASIZE PUSH1 0x4 PUSH2 0x4C41 JUMP JUMPDEST PUSH2 0x153E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x5D4 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B53 JUMP JUMPDEST PUSH2 0x1AC1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x5F4 CALLDATASIZE PUSH1 0x4 PUSH2 0x4ED2 JUMP JUMPDEST PUSH2 0x1BD4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x605 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x614 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x1C4F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x625 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x634 CALLDATASIZE PUSH1 0x4 PUSH2 0x4F1B JUMP JUMPDEST PUSH2 0x1C5C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x645 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x654 CALLDATASIZE PUSH1 0x4 PUSH2 0x49FA JUMP JUMPDEST PUSH2 0x1EF5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x665 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x679 PUSH2 0x674 CALLDATASIZE PUSH1 0x4 PUSH2 0x4D09 JUMP JUMPDEST PUSH2 0x2120 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x5C00 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x692 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x6A1 CALLDATASIZE PUSH1 0x4 PUSH2 0x4D09 JUMP JUMPDEST PUSH2 0x221A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6B2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x6C1 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A20 JUMP JUMPDEST PUSH2 0x22B6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6D2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x6DB PUSH2 0x22D3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x59B4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6F4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x703 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B53 JUMP JUMPDEST PUSH2 0x237E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x714 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x723 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x2453 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x734 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x743 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x2460 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x754 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x763 CALLDATASIZE PUSH1 0x4 PUSH2 0x4E8B JUMP JUMPDEST PUSH2 0x246D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x774 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x247F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x789 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x798 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B53 JUMP JUMPDEST PUSH2 0x2485 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x44A PUSH2 0x25F7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7BE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x7CD CALLDATASIZE PUSH1 0x4 PUSH2 0x49FA JUMP JUMPDEST PUSH2 0x2613 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7DE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x6DB PUSH2 0x26C4 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x26FB JUMP JUMPDEST SWAP1 POP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x80B DUP6 DUP6 DUP6 DUP6 DUP6 PUSH2 0x2780 JUMP JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x282C JUMP JUMPDEST PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH2 0x839 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x844 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x88A JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP8 MLOAD SWAP4 POP SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0x92A JUMPI PUSH2 0x913 DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x8D4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x8EC JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x904 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x288D JUMP JUMPDEST SWAP1 POP PUSH2 0x91F DUP5 DUP3 PUSH2 0x292B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x8BC JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND CALLER EQ PUSH2 0xA01 JUMPI PUSH2 0x9C9 DUP5 DUP5 DUP5 DUP5 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x153E SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0xA01 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A93 JUMP JUMPDEST POP POP PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND DUP5 MSTORE SWAP2 SWAP1 MSTORE SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE JUMP JUMPDEST PUSH2 0xA66 PUSH2 0x45E6 JUMP JUMPDEST PUSH2 0xA6E PUSH2 0x4615 JUMP JUMPDEST PUSH2 0xA76 PUSH2 0x4615 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xAB4 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x160 DUP1 DUP10 ADD MLOAD PUSH2 0x140 DUP1 DUP11 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP10 ADD MLOAD SWAP1 DUP9 ADD MSTORE PUSH2 0xB00 DUP9 PUSH2 0x2120 JUMP JUMPDEST SWAP3 POP PUSH2 0xB0B DUP8 PUSH2 0x2120 JUMP JUMPDEST SWAP2 POP PUSH2 0xB15 PUSH2 0x298D JUMP JUMPDEST SWAP1 POP PUSH2 0xB23 DUP9 DUP5 DUP4 DUP10 PUSH2 0x29BE JUMP JUMPDEST PUSH2 0xB2F DUP8 DUP4 DUP4 DUP9 PUSH2 0x29BE JUMP JUMPDEST PUSH2 0xB39 DUP9 DUP9 PUSH2 0x2B56 JUMP JUMPDEST PUSH2 0xB4D DUP9 DUP9 DUP6 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x2BB6 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP2 ADD MLOAD SWAP1 MLOAD SWAP2 SWAP6 POP PUSH2 0xB68 SWAP2 DUP11 SWAP2 DUP7 SWAP2 DUP2 SWAP1 PUSH2 0x2D3D JUMP JUMPDEST PUSH1 0x20 DUP1 DUP6 ADD MLOAD SWAP1 DUP2 ADD MLOAD SWAP1 MLOAD PUSH2 0xB84 SWAP2 DUP10 SWAP2 DUP6 SWAP2 SWAP1 DUP2 SWAP1 PUSH2 0x2D3D JUMP JUMPDEST PUSH2 0xB9D DUP9 DUP3 DUP6 PUSH1 0x20 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP9 PUSH1 0x0 ADD MLOAD PUSH2 0x2780 JUMP JUMPDEST PUSH2 0xBB6 DUP8 DUP3 DUP5 PUSH1 0x20 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD DUP9 PUSH1 0x20 ADD MLOAD PUSH2 0x2780 JUMP JUMPDEST PUSH2 0xBC2 DUP9 DUP9 DUP4 DUP8 PUSH2 0x2E4F JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0xBFD PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x60 PUSH2 0xC0A DUP6 DUP6 DUP6 PUSH2 0x3027 JUMP JUMPDEST SWAP1 POP PUSH1 0x80 DUP2 DUP3 MLOAD PUSH1 0x20 DUP5 ADD ADDRESS GAS DELEGATECALL DUP1 ISZERO PUSH2 0xC41 JUMPI DUP2 MLOAD DUP4 MSTORE PUSH1 0x20 DUP3 ADD MLOAD PUSH1 0x20 DUP5 ADD MSTORE PUSH1 0x40 DUP3 ADD MLOAD PUSH1 0x40 DUP5 ADD MSTORE PUSH1 0x60 DUP3 ADD MLOAD PUSH1 0x60 DUP5 ADD MSTORE JUMPDEST POP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xCB3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP2 MLOAD SWAP1 JUMPDEST DUP1 DUP3 EQ PUSH2 0xD13 JUMPI PUSH2 0xD0B DUP4 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xCFC JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x31F9 JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0xCE4 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP JUMP JUMPDEST PUSH2 0xD48 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xD53 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xD90 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP8 MLOAD SWAP4 POP SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0x92A JUMPI PUSH2 0xE19 DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xDDA JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xDF2 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE0A JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x3224 JUMP JUMPDEST SWAP1 POP PUSH2 0xE25 DUP5 DUP3 PUSH2 0x292B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0xDC2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD DUP2 SWAP1 DUP2 SWAP1 DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xE74 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0xEA7 PUSH2 0x298D JUMP JUMPDEST SWAP4 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND CALLER EQ PUSH2 0xECC JUMPI CALLER PUSH2 0xECF JUMP JUMPDEST PUSH1 0x0 JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD SWAP1 SWAP4 POP PUSH1 0x1 DUP7 ADD SWAP3 POP SWAP1 POP DUP1 DUP3 GT PUSH2 0xF46 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B23 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 DUP9 AND DUP1 DUP5 MSTORE SWAP5 SWAP1 SWAP2 MSTORE SWAP1 DUP2 SWAP1 KECCAK256 DUP6 SWAP1 SSTORE MLOAD PUSH32 0x82AF639571738F4EBD4268FB0363D8957EBE1BBB9E78DBA5EBD69EED39B154F0 SWAP1 PUSH2 0xFAE SWAP1 DUP7 SWAP1 PUSH2 0x5909 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP POP POP JUMP JUMPDEST PUSH2 0xFED PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xFF8 PUSH2 0x45BD JUMP JUMPDEST DUP7 MLOAD SWAP3 POP PUSH1 0x0 SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0x106F JUMPI PUSH2 0x1058 DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1019 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1031 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1049 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0xBF5 JUMP JUMPDEST SWAP1 POP PUSH2 0x1064 DUP5 DUP3 PUSH2 0x292B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x1001 JUMP JUMPDEST POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH2 0x10E4 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x1121 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x1157 DUP5 DUP5 DUP5 PUSH2 0x3224 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0x118F PUSH2 0x45BD JUMP JUMPDEST PUSH2 0x1199 DUP4 DUP4 PUSH2 0x292B JUMP JUMPDEST POP DUP2 JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x3277 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x11ED JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x1220 PUSH2 0x298D JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 DUP10 AND DUP1 DUP5 MSTORE SWAP5 SWAP1 SWAP2 MSTORE SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP8 ISZERO ISZERO OR SWAP1 SSTORE MLOAD SWAP3 SWAP4 POP SWAP1 SWAP2 PUSH32 0xA8656E308026EEABCE8F0BC18048433252318AB80AC79DA0B3D3D8697DFBA891 SWAP1 PUSH2 0x12B4 SWAP1 DUP7 SWAP1 PUSH2 0x58FB JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH2 0x1311 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x1320 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x135D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP10 MLOAD DUP11 SWAP2 SWAP1 DUP2 LT PUSH2 0x1395 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD MLOAD SWAP5 POP DUP9 MLOAD SWAP4 POP PUSH1 0x0 SWAP3 POP JUMPDEST DUP3 DUP5 EQ PUSH2 0x1438 JUMPI DUP5 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x13C5 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD DUP2 SWAP1 MSTORE POP PUSH2 0x13E5 DUP9 DUP8 PUSH1 0x20 ADD MLOAD PUSH2 0x32FC JUMP JUMPDEST SWAP2 POP PUSH2 0x1411 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x13F8 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP10 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x904 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x141D DUP7 DUP3 PUSH2 0x292B JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD DUP9 GT PUSH2 0x142D JUMPI PUSH2 0x1438 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x13AF JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP2 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH1 0x60 PUSH1 0x0 DUP5 MLOAD SWAP3 POP DUP3 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x14B3 JUMPI DUP2 PUSH1 0x20 ADD JUMPDEST PUSH2 0x14A0 PUSH2 0x4615 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 SWAP1 SUB SWAP1 DUP2 PUSH2 0x1498 JUMPI SWAP1 POP JUMPDEST POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP1 DUP4 EQ PUSH2 0xC43 JUMPI PUSH2 0x14E2 DUP6 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x14D3 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x2120 JUMP JUMPDEST DUP3 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x14F0 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x14BB JUMP JUMPDEST PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP10 MLOAD GT ISZERO ISZERO PUSH2 0x1587 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B13 JUMP JUMPDEST PUSH2 0x1590 DUP10 PUSH2 0x333E JUMP JUMPDEST PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DIV SWAP7 POP PUSH1 0x7 PUSH1 0xFF DUP9 AND LT PUSH2 0x15F2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A33 JUMP JUMPDEST DUP7 PUSH1 0xFF AND PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1601 JUMPI INVALID JUMPDEST SWAP6 POP PUSH1 0x0 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1611 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1649 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B03 JUMP JUMPDEST PUSH1 0x1 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1657 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x169F JUMPI DUP9 MLOAD ISZERO PUSH2 0x1696 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5BD3 JUMP JUMPDEST PUSH1 0x0 SWAP8 POP PUSH2 0x1AB3 JUMP JUMPDEST PUSH1 0x2 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x16AD JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x17E8 JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0x16EE JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x59D3 JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x16FD JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0x173D DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x3402 AND JUMP JUMPDEST SWAP4 POP PUSH2 0x1750 DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x3402 AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD PUSH2 0x1775 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x5964 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 PUSH1 0x0 DUP7 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1799 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP13 DUP2 AND SWAP1 DUP3 AND EQ SWAP10 POP SWAP3 POP PUSH2 0x1AB3 SWAP1 POP JUMP JUMPDEST PUSH1 0x3 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x17F6 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x199C JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0x1837 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x59D3 JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1846 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0x1886 DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x3402 AND JUMP JUMPDEST SWAP4 POP PUSH2 0x1899 DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x3402 AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 PUSH1 0x40 MLOAD PUSH1 0x20 ADD DUP1 DUP1 PUSH32 0x19457468657265756D205369676E6564204D6573736167653A0A333200000000 DUP2 MSTORE POP PUSH1 0x1C ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x193A JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x18FD JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 PUSH1 0x0 DUP4 MSTORE SWAP2 ADD SWAP3 DUP4 SWAP1 MSTORE PUSH2 0x1775 SWAP5 POP SWAP3 POP DUP10 SWAP2 DUP10 SWAP2 POP DUP9 SWAP1 PUSH2 0x5964 JUMP JUMPDEST PUSH1 0x4 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x19AA JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x19C2 JUMPI PUSH2 0x19BB DUP12 DUP12 DUP12 PUSH2 0x344D JUMP JUMPDEST SWAP8 POP PUSH2 0x1AB3 JUMP JUMPDEST PUSH1 0x5 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x19D0 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1A33 JUMPI PUSH2 0x19DF DUP10 PUSH2 0x35A2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP13 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1A27 JUMPI PUSH1 0x0 SWAP8 POP PUSH2 0x1AB3 JUMP JUMPDEST PUSH2 0x19BB DUP2 DUP13 DUP13 DUP13 PUSH2 0x361B JUMP JUMPDEST PUSH1 0x6 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1A41 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1A81 JUMPI PUSH1 0x0 DUP12 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP15 AND DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND SWAP8 POP PUSH2 0x1AB3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A33 JUMP JUMPDEST POP POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x1AC9 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x1AD9 PUSH2 0x45BD JUMP JUMPDEST DUP10 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1AE8 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x140 ADD MLOAD SWAP6 POP DUP10 MLOAD SWAP5 POP PUSH1 0x0 SWAP4 POP JUMPDEST DUP4 DUP6 EQ PUSH2 0x1BC7 JUMPI DUP6 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1B18 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP7 MLOAD PUSH2 0x1B34 SWAP1 DUP11 SWAP1 PUSH2 0x32FC JUMP JUMPDEST SWAP3 POP PUSH2 0x1B77 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1B47 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0xA0 ADD MLOAD DUP12 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1B63 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x80 ADD MLOAD DUP6 PUSH2 0x3777 JUMP JUMPDEST SWAP2 POP PUSH2 0x1BA3 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1B8A JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP11 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1049 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x1BAF DUP8 DUP3 PUSH2 0x292B JUMP JUMPDEST DUP7 MLOAD DUP10 GT PUSH2 0x1BBC JUMPI PUSH2 0x1BC7 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP4 ADD SWAP3 PUSH2 0x1B02 JUMP JUMPDEST POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x1BDC PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x1C19 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x1157 DUP5 DUP5 DUP5 PUSH2 0x288D JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x3777 JUMP JUMPDEST PUSH1 0xA SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x1CAF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH2 0x1CF2 PUSH2 0x1CED DUP9 DUP9 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x37BF SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x3A00 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO PUSH2 0x1D3E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A83 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x1E0F JUMPI PUSH2 0x1D96 DUP2 DUP8 DUP6 DUP6 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x153E SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0x1DCE JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5BC3 JUMP JUMPDEST PUSH1 0xA DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND OR SWAP1 SSTORE JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE MLOAD ADDRESS SWAP1 DUP7 SWAP1 DUP7 SWAP1 DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 GAS DELEGATECALL SWAP2 POP POP ISZERO ISZERO PUSH2 0x1EA6 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AB3 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x1EEC JUMPI PUSH1 0xA DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x0 SWAP1 DUP2 SWAP1 DUP2 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x1F4D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B73 JUMP JUMPDEST DUP4 SWAP3 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xAE25532E PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1FB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1FC8 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x1FEC SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x4CBA JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP1 ISZERO PUSH2 0x2071 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A13 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND OR SWAP1 SSTORE MLOAD PUSH32 0xD2C6B762299C609BDB96520B58A49BFB80186934D4F71A86A367571A15C03194 SWAP1 PUSH2 0x2112 SWAP1 DUP5 SWAP1 DUP8 SWAP1 PUSH2 0x5999 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 POP POP POP POP JUMP JUMPDEST PUSH2 0x2128 PUSH2 0x4615 JUMP JUMPDEST PUSH2 0x2131 DUP3 PUSH2 0x3A3D JUMP JUMPDEST PUSH1 0x20 DUP1 DUP4 ADD DUP3 SWAP1 MSTORE PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x4 SWAP1 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 SLOAD SWAP1 DUP3 ADD MSTORE PUSH1 0x80 DUP3 ADD MLOAD ISZERO ISZERO PUSH2 0x2165 JUMPI PUSH1 0x1 JUMPDEST PUSH1 0xFF AND DUP2 MSTORE PUSH2 0x10C2 JUMP JUMPDEST PUSH1 0xA0 DUP3 ADD MLOAD ISZERO ISZERO PUSH2 0x2177 JUMPI PUSH1 0x2 PUSH2 0x215B JUMP JUMPDEST PUSH1 0xA0 DUP3 ADD MLOAD PUSH1 0x40 DUP3 ADD MLOAD LT PUSH2 0x218D JUMPI PUSH1 0x5 PUSH2 0x215B JUMP JUMPDEST PUSH2 0x100 DUP3 ADD MLOAD TIMESTAMP LT PUSH2 0x21A0 JUMPI PUSH1 0x4 PUSH2 0x215B JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 ADD MLOAD PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 SWAP1 SWAP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x21C4 JUMPI PUSH1 0x6 PUSH2 0x215B JUMP JUMPDEST PUSH2 0x120 DUP3 ADD MLOAD DUP3 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH1 0x60 DUP9 ADD MLOAD SWAP1 SWAP5 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD GT ISZERO PUSH2 0x2211 JUMPI PUSH1 0x6 PUSH2 0x215B JUMP JUMPDEST PUSH1 0x3 DUP2 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x2257 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x228B DUP2 PUSH2 0x31F9 JUMP JUMPDEST POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 DUP5 DUP7 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x2376 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x234B JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2376 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2359 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST PUSH2 0x2386 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x2395 PUSH2 0x45BD JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x23A4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD MLOAD SWAP5 POP DUP9 MLOAD SWAP4 POP PUSH1 0x0 SWAP3 POP JUMPDEST DUP3 DUP5 EQ PUSH2 0x2447 JUMPI DUP5 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x23D4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD DUP2 SWAP1 MSTORE POP PUSH2 0x23F4 DUP9 DUP8 PUSH1 0x20 ADD MLOAD PUSH2 0x32FC JUMP JUMPDEST SWAP2 POP PUSH2 0x2420 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2407 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP10 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1049 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x242C DUP7 DUP3 PUSH2 0x292B JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD DUP9 GT PUSH2 0x243C JUMPI PUSH2 0x2447 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x23BE JUMP JUMPDEST POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x3A4B JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x3AC8 JUMP JUMPDEST PUSH2 0x2475 PUSH2 0x45BD JUMP JUMPDEST PUSH2 0x7F7 DUP4 DUP4 PUSH2 0x3B45 JUMP JUMPDEST PUSH1 0x2 SLOAD DUP2 JUMP JUMPDEST PUSH2 0x248D PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x249D PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x24DA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP11 MLOAD DUP12 SWAP2 SWAP1 DUP2 LT PUSH2 0x2512 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x140 ADD MLOAD SWAP6 POP DUP10 MLOAD SWAP5 POP PUSH1 0x0 SWAP4 POP JUMPDEST DUP4 DUP6 EQ PUSH2 0x25C1 JUMPI DUP6 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2542 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP7 MLOAD PUSH2 0x255E SWAP1 DUP11 SWAP1 PUSH2 0x32FC JUMP JUMPDEST SWAP3 POP PUSH2 0x2571 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1B47 JUMPI INVALID JUMPDEST SWAP2 POP PUSH2 0x259D DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2584 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP11 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x904 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x25A9 DUP8 DUP3 PUSH2 0x292B JUMP JUMPDEST DUP7 MLOAD DUP10 GT PUSH2 0x25B6 JUMPI PUSH2 0x25C1 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP4 ADD SWAP3 PUSH2 0x252C JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP3 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0xA SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x2664 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B73 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x26C1 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0xB DUP2 MSTORE PUSH32 0x322E302E312D616C706861000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x2737 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x2742 JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x2750 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0xC43 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x275A JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP PUSH2 0x2769 DUP6 DUP5 PUSH2 0x3BA6 JUMP JUMPDEST PUSH2 0x2775 PUSH2 0x3E8 DUP4 PUSH2 0x3BA6 JUMP JUMPDEST LT ISZERO SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x278E DUP3 DUP3 PUSH1 0x20 ADD MLOAD PUSH2 0x3C0C JUMP JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 SWAP3 SWAP1 SWAP3 SSTORE DUP7 DUP2 ADD MLOAD DUP8 MLOAD DUP5 MLOAD SWAP4 DUP6 ADD MLOAD DUP6 DUP5 ADD MLOAD PUSH1 0x60 DUP8 ADD MLOAD PUSH2 0x140 DUP13 ADD MLOAD PUSH2 0x160 DUP14 ADD MLOAD SWAP7 MLOAD DUP12 SWAP9 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP9 AND SWAP9 SWAP8 SWAP1 SWAP7 AND SWAP7 PUSH32 0xBCC4C97732E47D9946F229EDB95F5B6323F601300E4690DE719993F3C371129 SWAP7 PUSH2 0x281D SWAP7 DUP16 SWAP7 CALLER SWAP7 SWAP3 SWAP6 SWAP2 SWAP5 SWAP1 SWAP4 SWAP1 PUSH2 0x5829 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x2867 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST PUSH2 0x7F4 PUSH2 0x2887 PUSH2 0x2877 DUP7 DUP6 PUSH2 0x3BA6 JUMP JUMPDEST PUSH2 0x2882 DUP7 PUSH1 0x1 PUSH2 0x32FC JUMP JUMPDEST PUSH2 0x3C0C JUMP JUMPDEST DUP5 PUSH2 0x3C4B JUMP JUMPDEST PUSH2 0x2895 PUSH2 0x45BD JUMP JUMPDEST PUSH2 0x289D PUSH2 0x4615 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x28AB DUP9 PUSH2 0x2120 JUMP JUMPDEST SWAP4 POP PUSH2 0x28B5 PUSH2 0x298D JUMP JUMPDEST SWAP3 POP PUSH2 0x28C3 DUP9 DUP6 DUP6 DUP10 PUSH2 0x29BE JUMP JUMPDEST PUSH2 0x28D5 DUP9 PUSH1 0xA0 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x32FC JUMP JUMPDEST SWAP2 POP PUSH2 0x28E1 DUP8 DUP4 PUSH2 0x3C62 JUMP JUMPDEST SWAP1 POP PUSH2 0x28F4 DUP9 DUP6 DUP10 DUP5 DUP10 PUSH1 0x0 ADD MLOAD PUSH2 0x2D3D JUMP JUMPDEST PUSH2 0x28FE DUP9 DUP3 PUSH2 0x3B45 JUMP JUMPDEST SWAP5 POP PUSH2 0x2915 DUP9 DUP5 DUP7 PUSH1 0x20 ADD MLOAD DUP8 PUSH1 0x40 ADD MLOAD DUP10 PUSH2 0x2780 JUMP JUMPDEST PUSH2 0x2920 DUP9 DUP5 DUP8 PUSH2 0x3C71 JUMP JUMPDEST POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP2 MLOAD DUP2 MLOAD PUSH2 0x2939 SWAP2 SWAP1 PUSH2 0x3C0C JUMP JUMPDEST DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x294F SWAP2 SWAP1 PUSH2 0x3C0C JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE PUSH1 0x40 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x2968 SWAP2 SWAP1 PUSH2 0x3C0C JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE PUSH1 0x60 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x2981 SWAP2 SWAP1 PUSH2 0x3C0C JUMP JUMPDEST PUSH1 0x60 SWAP1 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP JUMP JUMPDEST PUSH1 0xA SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 DUP2 ISZERO PUSH2 0x29B6 JUMPI DUP2 PUSH2 0x7F7 JUMP JUMPDEST CALLER SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP3 MLOAD PUSH1 0xFF AND PUSH1 0x3 EQ PUSH2 0x29FC JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B93 JUMP JUMPDEST PUSH1 0x60 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x2A6F JUMPI PUSH1 0x60 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x2A6F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5BA3 JUMP JUMPDEST PUSH1 0x20 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x2AFA JUMPI DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH1 0x20 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO ISZERO PUSH2 0x2AFA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x59E3 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MLOAD ISZERO ISZERO PUSH2 0x2B50 JUMPI PUSH2 0x2B18 DUP4 PUSH1 0x20 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD DUP4 PUSH2 0x153E JUMP JUMPDEST ISZERO ISZERO PUSH2 0x2B50 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A53 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH2 0x2B68 DUP3 PUSH1 0xA0 ADD MLOAD DUP3 PUSH1 0xA0 ADD MLOAD PUSH2 0x3BA6 JUMP JUMPDEST PUSH2 0x2B7A DUP4 PUSH1 0x80 ADD MLOAD DUP4 PUSH1 0x80 ADD MLOAD PUSH2 0x3BA6 JUMP JUMPDEST LT ISZERO PUSH2 0x2BB2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5BB3 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH2 0x2BBE PUSH2 0x45E6 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x2BD2 DUP10 PUSH1 0xA0 ADD MLOAD DUP9 PUSH2 0x32FC JUMP JUMPDEST SWAP4 POP PUSH2 0x2BE7 DUP10 PUSH1 0x80 ADD MLOAD DUP11 PUSH1 0xA0 ADD MLOAD DUP7 PUSH2 0x3A4B JUMP JUMPDEST SWAP3 POP PUSH2 0x2BF7 DUP9 PUSH1 0xA0 ADD MLOAD DUP8 PUSH2 0x32FC JUMP JUMPDEST SWAP2 POP PUSH2 0x2C0C DUP9 PUSH1 0x80 ADD MLOAD DUP10 PUSH1 0xA0 ADD MLOAD DUP5 PUSH2 0x3A4B JUMP JUMPDEST SWAP1 POP DUP1 DUP5 LT PUSH2 0x2C4F JUMPI PUSH1 0x20 DUP1 DUP7 ADD DUP1 MLOAD DUP4 SWAP1 MSTORE DUP1 MLOAD DUP3 ADD DUP5 SWAP1 MSTORE MLOAD MLOAD DUP7 MLOAD DUP3 ADD MSTORE PUSH1 0x80 DUP11 ADD MLOAD PUSH1 0xA0 DUP12 ADD MLOAD DUP8 MLOAD SWAP1 SWAP3 ADD MLOAD PUSH2 0x2C47 SWAP3 SWAP1 PUSH2 0x3A4B JUMP JUMPDEST DUP6 MLOAD MSTORE PUSH2 0x2C8C JUMP JUMPDEST DUP5 MLOAD DUP4 SWAP1 MSTORE DUP5 MLOAD PUSH1 0x20 SWAP1 DUP2 ADD DUP6 SWAP1 MSTORE DUP6 MLOAD DUP2 ADD MLOAD SWAP1 DUP7 ADD DUP1 MLOAD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0xA0 DUP10 ADD MLOAD PUSH1 0x80 DUP11 ADD MLOAD SWAP2 MLOAD MLOAD PUSH2 0x2C83 SWAP3 SWAP1 PUSH2 0x3AC8 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP8 ADD MLOAD ADD MSTORE JUMPDEST DUP5 MLOAD MLOAD PUSH1 0x20 DUP1 DUP8 ADD MLOAD ADD MLOAD PUSH2 0x2CA1 SWAP2 SWAP1 PUSH2 0x32FC JUMP JUMPDEST PUSH1 0x40 DUP7 ADD MSTORE DUP5 MLOAD MLOAD PUSH1 0x80 DUP11 ADD MLOAD PUSH1 0xC0 DUP12 ADD MLOAD PUSH2 0x2CBE SWAP3 SWAP2 SWAP1 PUSH2 0x3A4B JUMP JUMPDEST DUP6 MLOAD PUSH1 0x40 ADD MSTORE DUP5 MLOAD PUSH1 0x20 ADD MLOAD PUSH1 0xA0 DUP11 ADD MLOAD PUSH1 0xE0 DUP12 ADD MLOAD PUSH2 0x2CDF SWAP3 SWAP2 SWAP1 PUSH2 0x3A4B JUMP JUMPDEST DUP6 MLOAD PUSH1 0x60 ADD MSTORE PUSH1 0x20 DUP6 ADD MLOAD MLOAD PUSH1 0x80 DUP10 ADD MLOAD PUSH1 0xC0 DUP11 ADD MLOAD PUSH2 0x2D00 SWAP3 SWAP2 SWAP1 PUSH2 0x3A4B JUMP JUMPDEST DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x40 ADD DUP2 DUP2 MSTORE POP POP PUSH2 0x2D28 DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x20 ADD MLOAD DUP10 PUSH1 0xA0 ADD MLOAD DUP11 PUSH1 0xE0 ADD MLOAD PUSH2 0x3A4B JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD PUSH1 0x60 ADD MSTORE POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP3 ISZERO ISZERO PUSH2 0x2D76 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AD3 JUMP JUMPDEST DUP3 DUP3 GT ISZERO PUSH2 0x2DB0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AC3 JUMP JUMPDEST DUP5 PUSH1 0xA0 ADD MLOAD PUSH2 0x2DC3 DUP6 PUSH1 0x40 ADD MLOAD DUP5 PUSH2 0x3C0C JUMP JUMPDEST GT ISZERO PUSH2 0x2DFB JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x59F3 JUMP JUMPDEST PUSH2 0x2E09 DUP6 PUSH1 0x80 ADD MLOAD DUP4 PUSH2 0x3BA6 JUMP JUMPDEST PUSH2 0x2E17 DUP3 DUP8 PUSH1 0xA0 ADD MLOAD PUSH2 0x3BA6 JUMP JUMPDEST GT ISZERO PUSH2 0x80B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B53 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x2EF8 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x2ECD JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2EF8 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2EDB JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x2F20 DUP6 PUSH2 0x140 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x20 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x140 DUP5 ADD MLOAD DUP5 MLOAD DUP7 MLOAD DUP5 MLOAD PUSH1 0x20 ADD MLOAD PUSH2 0x2F3C SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x2F55 DUP6 PUSH2 0x140 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP6 DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x2F71 DUP2 DUP7 PUSH1 0x0 ADD MLOAD DUP8 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD PUSH1 0x40 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x2F8D DUP2 DUP6 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x40 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST DUP4 PUSH1 0x40 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH1 0x40 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x2FF7 JUMPI PUSH2 0x2FF2 DUP2 DUP5 DUP8 PUSH1 0x40 ADD MLOAD PUSH2 0x2FED DUP7 PUSH1 0x0 ADD MLOAD PUSH1 0x60 ADD MLOAD DUP8 PUSH1 0x20 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3C0C JUMP JUMPDEST PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x80B JUMP JUMPDEST PUSH2 0x300F DUP2 DUP5 DUP8 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x80B DUP2 DUP5 DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x60 PUSH1 0x24 DUP4 ADD DUP2 DUP2 MSTORE DUP8 MLOAD PUSH1 0x84 DUP6 ADD SWAP1 DUP2 MSTORE DUP9 DUP5 ADD MLOAD PUSH1 0xA4 DUP7 ADD MSTORE SWAP5 DUP9 ADD MLOAD PUSH1 0xC4 DUP6 ADD MSTORE SWAP1 DUP8 ADD MLOAD PUSH1 0xE4 DUP5 ADD MSTORE PUSH1 0x80 DUP8 ADD MLOAD PUSH2 0x104 DUP5 ADD MSTORE PUSH1 0xA0 DUP8 ADD MLOAD PUSH2 0x124 DUP5 ADD MSTORE PUSH1 0xC0 DUP8 ADD MLOAD PUSH2 0x144 DUP5 ADD MSTORE PUSH1 0xE0 DUP8 ADD MLOAD PUSH2 0x164 DUP5 ADD MSTORE PUSH2 0x100 DUP8 ADD MLOAD PUSH2 0x184 DUP5 ADD MSTORE PUSH2 0x120 DUP8 ADD MLOAD PUSH2 0x1A4 DUP5 ADD MSTORE PUSH2 0x140 DUP8 ADD DUP1 MLOAD PUSH2 0x1C4 DUP6 ADD SWAP1 DUP2 MSTORE PUSH2 0x160 DUP10 ADD MLOAD PUSH2 0x1E4 DUP7 ADD MSTORE PUSH2 0x180 SWAP1 MSTORE MLOAD DUP1 MLOAD PUSH2 0x204 DUP6 ADD DUP2 SWAP1 MSTORE SWAP4 SWAP5 SWAP2 SWAP4 DUP5 SWAP4 PUSH1 0x44 DUP8 ADD SWAP3 DUP5 SWAP3 PUSH2 0x224 DUP10 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x312E JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x3110 JUMP JUMPDEST POP POP POP POP DUP2 DUP2 SUB PUSH2 0x160 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP11 ADD MLOAD DUP1 MLOAD DUP1 DUP4 MSTORE PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x3177 JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x3159 JUMP JUMPDEST POP POP POP DUP10 DUP5 MSTORE POP DUP5 DUP2 SUB PUSH1 0x20 SWAP4 DUP5 ADD SWAP1 DUP2 MSTORE DUP9 MLOAD DUP1 DUP4 MSTORE SWAP1 SWAP4 SWAP2 DUP3 ADD SWAP2 DUP10 DUP2 ADD SWAP2 SWAP1 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x31BF JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x31A1 JUMP JUMPDEST POP POP POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP9 DUP4 SUB ADD DUP9 MSTORE POP PUSH1 0x40 MSTORE POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x3201 PUSH2 0x4615 JUMP JUMPDEST PUSH2 0x320A DUP3 PUSH2 0x2120 JUMP JUMPDEST SWAP1 POP PUSH2 0x3216 DUP3 DUP3 PUSH2 0x3F45 JUMP JUMPDEST PUSH2 0x2BB2 DUP3 DUP3 PUSH1 0x20 ADD MLOAD PUSH2 0x405C JUMP JUMPDEST PUSH2 0x322C PUSH2 0x45BD JUMP JUMPDEST PUSH2 0x3237 DUP5 DUP5 DUP5 PUSH2 0x288D JUMP JUMPDEST PUSH1 0x20 DUP2 ADD MLOAD SWAP1 SWAP2 POP DUP4 EQ PUSH2 0x7F7 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B43 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x32B3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x32BE JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x32CC JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0xC43 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x32D6 JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP DUP4 PUSH2 0x32E6 DUP6 DUP4 PUSH2 0x32FC JUMP JUMPDEST DUP2 ISZERO ISZERO PUSH2 0x32EF JUMPI INVALID JUMPDEST MOD SWAP1 POP PUSH2 0x2769 DUP6 DUP5 PUSH2 0x3BA6 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0x3338 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A03 JUMP JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 MLOAD GT ISZERO ISZERO PUSH2 0x337C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AF3 JUMP JUMPDEST DUP2 MLOAD DUP3 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x33AC JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP3 MSTORE POP PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV MUL SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x3444 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A23 JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x0 SWAP1 PUSH1 0x60 SWAP1 PUSH32 0x1626BA7E00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x3488 SWAP1 DUP8 SWAP1 DUP7 SWAP1 PUSH1 0x24 ADD PUSH2 0x5944 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 MSTORE DUP2 MLOAD SWAP2 SWAP4 POP SWAP1 DUP3 SWAP1 DUP2 DUP9 GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x3525 JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x3596 JUMPI PUSH2 0x2920 JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xC57414C4C45545F4552524F5200000000000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST POP POP MLOAD SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x14 DUP3 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x35E2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B83 JUMP JUMPDEST PUSH2 0x35F0 DUP3 PUSH1 0x14 DUP5 MLOAD SUB PUSH2 0x4103 JUMP JUMPDEST DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC ADD SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x0 SWAP1 PUSH1 0x60 SWAP1 PUSH32 0x9363470200000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x3658 SWAP1 DUP8 SWAP1 DUP8 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x5917 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 MSTORE DUP2 MLOAD SWAP2 SWAP4 POP SWAP1 DUP3 SWAP1 DUP2 DUP11 GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x36F5 JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x3766 JUMPI PUSH2 0x376B JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xF56414C494441544F525F4552524F5200000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD SWAP5 POP JUMPDEST POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x37B2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST PUSH2 0x7F4 PUSH2 0x2887 DUP6 DUP5 PUSH2 0x3BA6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x5A65726F45785472616E73616374696F6E280000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0x32 DUP4 ADD MSTORE PUSH32 0x61646472657373207369676E6572416464726573732C00000000000000000000 PUSH1 0x3F DUP4 ADD MSTORE PUSH32 0x6279746573206461746100000000000000000000000000000000000000000000 PUSH1 0x55 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0x5F DUP4 ADD MSTORE DUP3 MLOAD DUP1 DUP4 SUB DUP5 ADD DUP2 MSTORE PUSH1 0x60 SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP1 SWAP3 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x38E8 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x38AB JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP10 MLOAD SWAP1 SWAP8 POP DUP10 SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x397E JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x3941 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 SWAP8 DUP3 MSTORE DUP2 ADD SWAP11 SWAP1 SWAP11 MSTORE POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 SWAP1 SWAP8 AND SWAP7 DUP9 ADD SWAP7 SWAP1 SWAP7 MSTORE POP POP PUSH1 0x60 DUP6 ADD MSTORE POP POP PUSH1 0x80 SWAP1 SWAP2 KECCAK256 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH32 0x1901000000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP2 DUP3 ADD MSTORE PUSH1 0x22 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x119C PUSH2 0x1CED DUP4 PUSH2 0x4164 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x3A86 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST PUSH2 0x3A91 DUP5 DUP5 DUP5 PUSH2 0x26FB JUMP JUMPDEST ISZERO PUSH2 0x37B2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AA3 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x3B03 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST PUSH2 0x3B0E DUP5 DUP5 DUP5 PUSH2 0x3277 JUMP JUMPDEST ISZERO PUSH2 0x2867 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AA3 JUMP JUMPDEST PUSH2 0x3B4D PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x20 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0xA0 DUP4 ADD MLOAD PUSH1 0x80 DUP5 ADD MLOAD PUSH2 0x3B69 SWAP2 DUP5 SWAP2 PUSH2 0x3A4B JUMP JUMPDEST DUP1 DUP3 MSTORE PUSH1 0x80 DUP5 ADD MLOAD PUSH1 0xC0 DUP6 ADD MLOAD PUSH2 0x3B81 SWAP3 SWAP2 SWAP1 PUSH2 0x3A4B JUMP JUMPDEST PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0xA0 DUP4 ADD MLOAD PUSH1 0xE0 DUP5 ADD MLOAD PUSH2 0x3B9B SWAP2 DUP5 SWAP2 PUSH2 0x3A4B JUMP JUMPDEST PUSH1 0x60 DUP3 ADD MSTORE SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 ISZERO ISZERO PUSH2 0x3BB9 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x3C05 JUMP JUMPDEST POP DUP3 DUP3 MUL DUP3 DUP5 DUP3 DUP2 ISZERO ISZERO PUSH2 0x3BC9 JUMPI INVALID JUMPDEST DIV EQ PUSH2 0x3C01 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A73 JUMP JUMPDEST DUP1 SWAP2 POP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x3C01 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A73 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 DUP5 DUP2 ISZERO ISZERO PUSH2 0x3C59 JUMPI INVALID JUMPDEST DIV SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP4 LT PUSH2 0x1199 JUMPI DUP2 PUSH2 0x7F7 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x3D1A JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x3CEF JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x3D1A JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x3CFD JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x3D3A DUP5 PUSH2 0x140 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD DUP6 DUP6 PUSH1 0x0 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x3D53 DUP5 PUSH2 0x160 ADD MLOAD DUP5 DUP7 PUSH1 0x0 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x3D6B DUP2 DUP6 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x2B50 DUP2 DUP5 DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x60 ADD MLOAD JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP4 GT DUP1 ISZERO PUSH2 0x3DBA JUMPI POP DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO JUMPDEST ISZERO PUSH2 0x3F3D JUMPI DUP6 MLOAD PUSH1 0x3 LT PUSH2 0x3DFA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B33 JUMP JUMPDEST POP POP PUSH1 0x20 DUP5 DUP2 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0xB SWAP1 SWAP3 MSTORE PUSH1 0x40 SWAP1 SWAP2 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO ISZERO PUSH2 0x3E83 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AE3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH7 0xFFFFFFFFFFFE0 PUSH1 0x3F DUP9 MLOAD ADD AND DUP1 PUSH1 0x84 ADD DUP3 ADD PUSH32 0xA85E59E400000000000000000000000000000000000000000000000000000000 DUP4 MSTORE PUSH1 0x80 PUSH1 0x4 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND PUSH1 0x24 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND PUSH1 0x44 DUP5 ADD MSTORE DUP6 PUSH1 0x64 DUP5 ADD MSTORE PUSH1 0x84 DUP4 ADD JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x3F1F JUMPI DUP10 MLOAD DUP2 MSTORE PUSH1 0x20 SWAP10 DUP11 ADD SWAP10 ADD PUSH2 0x3F07 JUMP JUMPDEST PUSH2 0x200 DUP5 DUP6 DUP5 SUB DUP7 PUSH1 0x0 DUP10 GAS CALL DUP1 ISZERO ISZERO PUSH2 0x3F37 JUMPI RETURNDATASIZE DUP6 REVERT JUMPDEST POP POP POP POP POP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH1 0xFF AND PUSH1 0x3 EQ PUSH2 0x3F86 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B93 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x3FF9 JUMPI PUSH1 0x60 DUP4 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x3FF9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5BA3 JUMP JUMPDEST PUSH2 0x4001 PUSH2 0x298D JUMP JUMPDEST DUP4 MLOAD SWAP1 SWAP2 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0x4057 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A63 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE DUP3 DUP2 ADD MLOAD DUP4 MLOAD PUSH2 0x140 DUP6 ADD MLOAD PUSH2 0x160 DUP7 ADD MLOAD SWAP4 MLOAD DUP6 SWAP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP5 DUP6 AND SWAP5 SWAP4 SWAP1 SWAP4 AND SWAP3 PUSH32 0xDC47B3613D9FE400085F6DBDC99453462279057E6207385042827ED6B1A62CF7 SWAP3 PUSH2 0x40F7 SWAP3 CALLER SWAP3 SWAP1 PUSH2 0x58AD JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x4145 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B83 JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4F72646572280000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x61646472657373206D616B6572416464726573732C0000000000000000000000 PUSH1 0x26 DUP4 ADD MSTORE PUSH32 0x616464726573732074616B6572416464726573732C0000000000000000000000 PUSH1 0x3B DUP4 ADD MSTORE PUSH32 0x6164647265737320666565526563697069656E74416464726573732C00000000 PUSH1 0x50 DUP4 ADD MSTORE PUSH32 0x616464726573732073656E646572416464726573732C00000000000000000000 PUSH1 0x6C DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724173736574416D6F756E742C00000000000000 PUSH1 0x82 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724173736574416D6F756E742C00000000000000 PUSH1 0x9B DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724665652C000000000000000000000000000000 PUSH1 0xB4 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724665652C000000000000000000000000000000 PUSH1 0xC5 DUP4 ADD MSTORE PUSH32 0x75696E743235362065787069726174696F6E54696D655365636F6E64732C0000 PUSH1 0xD6 DUP4 ADD MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0xF4 DUP4 ADD MSTORE PUSH32 0x6279746573206D616B65724173736574446174612C0000000000000000000000 PUSH2 0x101 DUP4 ADD MSTORE PUSH32 0x62797465732074616B6572417373657444617461000000000000000000000000 PUSH2 0x116 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH2 0x12A DUP4 ADD MSTORE DUP3 MLOAD PUSH2 0x10B DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH2 0x12B SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP2 SWAP3 SWAP2 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x43EC JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x43AF JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x140 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP10 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x4487 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x444A JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x160 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP9 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x4522 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x44E5 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 SWAP1 SWAP4 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP2 AND SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP1 SWAP2 KECCAK256 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP10 ADD DUP1 MLOAD PUSH2 0x140 DUP12 ADD DUP1 MLOAD PUSH2 0x160 SWAP1 SWAP13 ADD DUP1 MLOAD SWAP11 DUP5 MSTORE SWAP9 DUP2 MSTORE SWAP3 DUP9 MSTORE PUSH2 0x1A0 DUP3 KECCAK256 SWAP2 MSTORE SWAP9 SWAP1 MSTORE POP POP POP SWAP2 SWAP1 MSTORE POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x80 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH2 0x120 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH2 0x45FB PUSH2 0x45BD JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x4608 PUSH2 0x45BD JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x60 DUP2 ADD DUP3 MSTORE PUSH1 0x0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP2 SWAP1 MSTORE SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F7 DUP3 CALLDATALOAD PUSH2 0x5CA6 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x4652 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x4665 PUSH2 0x4660 DUP3 PUSH2 0x5C35 JUMP JUMPDEST PUSH2 0x5C0E JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x46A3 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x468D DUP9 DUP3 PUSH2 0x47F3 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x4677 JUMP JUMPDEST POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x46BE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x46CC PUSH2 0x4660 DUP3 PUSH2 0x5C35 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x46A3 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x46F4 DUP9 DUP3 PUSH2 0x48B1 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x46DE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x471B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x4729 PUSH2 0x4660 DUP3 PUSH2 0x5C35 JUMP JUMPDEST SWAP2 POP DUP2 DUP2 DUP4 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP2 ADD SWAP1 POP DUP4 DUP6 PUSH1 0x20 DUP5 MUL DUP3 ADD GT ISZERO PUSH2 0x474E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x46A3 JUMPI DUP2 PUSH2 0x4764 DUP9 DUP3 PUSH2 0x4786 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x4751 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F7 DUP3 CALLDATALOAD PUSH2 0x5CBF JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F7 DUP3 CALLDATALOAD PUSH2 0x5CC4 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F7 DUP3 CALLDATALOAD PUSH2 0x5CC7 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F7 DUP3 MLOAD PUSH2 0x5CC7 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1F DUP4 ADD DUP5 SGT PUSH2 0x47BC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x47D4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x1 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x47EC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x4804 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x4812 PUSH2 0x4660 DUP3 PUSH2 0x5C56 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x482E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4839 DUP4 DUP3 DUP5 PUSH2 0x5CFD JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4854 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x485E PUSH1 0x80 PUSH2 0x5C0E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x486C DUP5 DUP5 PUSH2 0x4786 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x487D DUP5 DUP5 DUP4 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x4891 DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x48A5 DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x48C4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x48CF PUSH2 0x180 PUSH2 0x5C0E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x48DD DUP5 DUP5 PUSH2 0x4635 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x48EE DUP5 DUP5 DUP4 ADD PUSH2 0x4635 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x4902 DUP5 DUP3 DUP6 ADD PUSH2 0x4635 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x4916 DUP5 DUP3 DUP6 ADD PUSH2 0x4635 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x492A DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x493E DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x4952 DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x4966 DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x497B DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x4991 DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x49B3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x49BF DUP5 DUP3 DUP6 ADD PUSH2 0x47F3 JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x49E1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x49ED DUP5 DUP3 DUP6 ADD PUSH2 0x47F3 JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4A0C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A18 DUP5 DUP5 PUSH2 0x4635 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4A33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A3F DUP6 DUP6 PUSH2 0x4635 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x4A50 DUP6 DUP3 DUP7 ADD PUSH2 0x4635 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4A6D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A79 DUP6 DUP6 PUSH2 0x4635 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x4A50 DUP6 DUP3 DUP7 ADD PUSH2 0x477A JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4A9C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4AB3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4A18 DUP5 DUP3 DUP6 ADD PUSH2 0x46AD JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4AD4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4AEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4AF7 DUP7 DUP3 DUP8 ADD PUSH2 0x46AD JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B14 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B20 DUP7 DUP3 DUP8 ADD PUSH2 0x470A JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B3D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B49 DUP7 DUP3 DUP8 ADD PUSH2 0x4641 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4B68 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B7F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B8B DUP7 DUP3 DUP8 ADD PUSH2 0x46AD JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x4B20 DUP7 DUP3 DUP8 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4BAE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A18 DUP5 DUP5 PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4BCD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A3F DUP6 DUP6 PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x60 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x4BEF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4BFB DUP8 DUP8 PUSH2 0x4786 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x4C0C DUP8 DUP3 DUP9 ADD PUSH2 0x4635 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4C29 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4C35 DUP8 DUP3 DUP9 ADD PUSH2 0x47AA JUMP JUMPDEST SWAP6 SWAP9 SWAP5 SWAP8 POP SWAP6 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4C56 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4C62 DUP7 DUP7 PUSH2 0x4786 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x4C73 DUP7 DUP3 DUP8 ADD PUSH2 0x4635 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4C90 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B49 DUP7 DUP3 DUP8 ADD PUSH2 0x47F3 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4CAE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A18 DUP5 DUP5 PUSH2 0x4792 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4CCC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A18 DUP5 DUP5 PUSH2 0x479E JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x100 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4CEC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4CF8 DUP6 DUP6 PUSH2 0x4842 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x80 PUSH2 0x4A50 DUP6 DUP3 DUP7 ADD PUSH2 0x4842 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4D1B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4D32 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4A18 DUP5 DUP3 DUP6 ADD PUSH2 0x48B1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x100 DUP7 DUP9 SUB SLT ISZERO PUSH2 0x4D57 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP6 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4D6E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4D7A DUP9 DUP3 DUP10 ADD PUSH2 0x48B1 JUMP JUMPDEST SWAP6 POP POP PUSH1 0x20 PUSH2 0x4D8B DUP9 DUP3 DUP10 ADD PUSH2 0x4635 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x40 PUSH2 0x4D9C DUP9 DUP3 DUP10 ADD PUSH2 0x4786 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x60 PUSH2 0x4DAD DUP9 DUP3 DUP10 ADD PUSH2 0x4786 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x80 PUSH2 0x4DBE DUP9 DUP3 DUP10 ADD PUSH2 0x4842 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 SWAP1 SWAP4 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x4DE1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4DF8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E04 DUP8 DUP3 DUP9 ADD PUSH2 0x48B1 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4E21 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E2D DUP8 DUP3 DUP9 ADD PUSH2 0x48B1 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4E4A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E56 DUP8 DUP3 DUP9 ADD PUSH2 0x47F3 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4E73 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E7F DUP8 DUP3 DUP9 ADD PUSH2 0x47F3 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4E9E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4EB5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4EC1 DUP6 DUP3 DUP7 ADD PUSH2 0x48B1 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x4A50 DUP6 DUP3 DUP7 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4EE7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4EFE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4F0A DUP7 DUP3 DUP8 ADD PUSH2 0x48B1 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x4C73 DUP7 DUP3 DUP8 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP8 DUP10 SUB SLT ISZERO PUSH2 0x4F34 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4F40 DUP10 DUP10 PUSH2 0x4786 JUMP JUMPDEST SWAP7 POP POP PUSH1 0x20 PUSH2 0x4F51 DUP10 DUP3 DUP11 ADD PUSH2 0x4635 JUMP JUMPDEST SWAP6 POP POP PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4F6E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4F7A DUP10 DUP3 DUP11 ADD PUSH2 0x47AA JUMP JUMPDEST SWAP5 POP SWAP5 POP POP PUSH1 0x60 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4F99 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4FA5 DUP10 DUP3 DUP11 ADD PUSH2 0x47AA JUMP JUMPDEST SWAP3 POP SWAP3 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 POP SWAP3 SWAP6 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4FC9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4FD5 DUP7 DUP7 PUSH2 0x4786 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x4FE6 DUP7 DUP3 DUP8 ADD PUSH2 0x4786 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0x4B49 DUP7 DUP3 DUP8 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CA6 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x5011 DUP3 PUSH2 0x5CA2 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x5023 DUP4 PUSH2 0x5C9C JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x5053 JUMPI PUSH2 0x5039 DUP7 DUP4 MLOAD PUSH2 0x57DB JUMP JUMPDEST PUSH2 0x5042 DUP3 PUSH2 0x5C9C JUMP JUMPDEST PUSH1 0x60 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x5026 JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CBF JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CC4 JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CC7 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x5083 DUP3 PUSH2 0x5CA2 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x5097 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x5D09 JUMP JUMPDEST PUSH2 0x50A0 DUP2 PUSH2 0x5D35 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CF2 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x4C454E4754485F36355F52455155495245440000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x494E56414C49445F54414B455200000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x4F524445525F4F56455246494C4C000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x41535345545F50524F58595F414C52454144595F455849535453000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x15 DUP2 MSTORE PUSH32 0x5349474E41545552455F554E535550504F525445440000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4449564953494F4E5F42595F5A45524F00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x494E56414C49445F4F524445525F5349474E4154555245000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x494E56414C49445F4D414B455200000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xF DUP2 MSTORE PUSH32 0x494E56414C49445F54585F484153480000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x494E56414C49445F5349474E4154555245000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x524F554E44494E475F4552524F52000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4641494C45445F455845435554494F4E00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x54414B45525F4F56455250415900000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x494E56414C49445F54414B45525F414D4F554E54000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x41535345545F50524F58595F444F45535F4E4F545F4558495354000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x21 DUP2 MSTORE PUSH32 0x475245415445525F5448414E5F5A45524F5F4C454E4754485F52455155495245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x4400000000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x5349474E41545552455F494C4C4547414C000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1E DUP2 MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F305F52455155495245440000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x494E56414C49445F4E45575F4F524445525F45504F4348000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1E DUP2 MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F335F52455155495245440000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x434F4D504C4554455F46494C4C5F4641494C4544000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x494E56414C49445F46494C4C5F50524943450000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x5245454E5452414E43595F494C4C4547414C0000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x13 DUP2 MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4F524445525F554E46494C4C41424C4500000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x494E56414C49445F53454E444552000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x18 DUP2 MSTORE PUSH32 0x4E454741544956455F5350524541445F52455155495245440000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x494E56414C49445F54585F5349474E4154555245000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x4C454E4754485F305F5245515549524544000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x80 DUP4 ADD SWAP1 PUSH2 0x5769 DUP5 DUP3 PUSH2 0x5066 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x577C PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x578F PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x2B50 PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST DUP1 MLOAD PUSH2 0x120 DUP4 ADD SWAP1 PUSH2 0x57B4 DUP5 DUP3 PUSH2 0x5758 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x57C7 PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0x5758 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x2B50 PUSH2 0x100 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x60 DUP4 ADD SWAP1 PUSH2 0x57EC DUP5 DUP3 PUSH2 0x5812 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x57FF PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x2B50 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CEC JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x4FF7 JUMP JUMPDEST PUSH2 0x100 DUP2 ADD PUSH2 0x5838 DUP3 DUP12 PUSH2 0x4FF7 JUMP JUMPDEST PUSH2 0x5845 PUSH1 0x20 DUP4 ADD DUP11 PUSH2 0x4FF7 JUMP JUMPDEST PUSH2 0x5852 PUSH1 0x40 DUP4 ADD DUP10 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x585F PUSH1 0x60 DUP4 ADD DUP9 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x586C PUSH1 0x80 DUP4 ADD DUP8 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x5879 PUSH1 0xA0 DUP4 ADD DUP7 PUSH2 0x5066 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0xC0 DUP4 ADD MSTORE PUSH2 0x588B DUP2 DUP6 PUSH2 0x5078 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0xE0 DUP4 ADD MSTORE PUSH2 0x589F DUP2 DUP5 PUSH2 0x5078 JUMP JUMPDEST SWAP11 SWAP10 POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x58BB DUP3 DUP7 PUSH2 0x4FF7 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x58CD DUP2 DUP6 PUSH2 0x5078 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x58E1 DUP2 DUP5 PUSH2 0x5078 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7F7 DUP2 DUP5 PUSH2 0x5006 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x505D JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x5066 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x5925 DUP3 DUP7 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x5932 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x4FF7 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x58E1 DUP2 DUP5 PUSH2 0x5078 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x5952 DUP3 DUP6 PUSH2 0x5066 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x7F4 DUP2 DUP5 PUSH2 0x5078 JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x5972 DUP3 DUP8 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x597F PUSH1 0x20 DUP4 ADD DUP7 PUSH2 0x5812 JUMP JUMPDEST PUSH2 0x598C PUSH1 0x40 DUP4 ADD DUP6 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x58E1 PUSH1 0x60 DUP4 ADD DUP5 PUSH2 0x5066 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x59A7 DUP3 DUP6 PUSH2 0x506F JUMP JUMPDEST PUSH2 0x7F7 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x4FF7 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7F7 DUP2 DUP5 PUSH2 0x5078 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x50AD JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x50B6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x50E6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5116 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5146 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5176 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x51A6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x51FC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x522C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x525C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x528C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x52BC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x52EC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x531C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x534C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x537C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x53AC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x53DC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x540C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x543C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5492 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x54C2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x54F2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5522 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5552 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5582 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x55B2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x55E2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5612 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5668 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5698 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x56C8 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x56F8 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5728 JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x5758 JUMP JUMPDEST PUSH2 0x120 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x57A2 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x57DB JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x5C2D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x5C4C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 SWAP1 DUP2 MUL ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x5C6D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x119C DUP3 PUSH2 0x5CA6 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x5D24 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x5D0C JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x2B50 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 LOG0 0xd8 0xac 0xec 0xb3 CALLER RETURNDATASIZE 0xd7 0x21 0xa8 0x22 CREATE2 SHR DUP7 0xc7 PUSH18 0x4FC5A48327FD1BD94E3356CA224D82826C65 PUSH25 0x706572696D656E74616CF50037000000000000000000000000 ",
+ "sourceMap": "723:5376:65:-;;;689:5:83;667:27;;-1:-1:-1;;667:27:83;;;776:57:65;5:2:-1;;;;30:1;27;20:12;5:2;-1:-1;1228:316:26;;;;;;;;;;-1:-1:-1;1228:316:26;;;;;;;1919:29:43;;:14;;:29;:::i;:::-;-1:-1:-1;;1045:148:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;1045:148:44;;;;;;;;1035:159;;1045:148;;;;;1035:159;;;;1045:148;1035:159;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1035:159:44;;;;;;;;;;;;1511:18;;;;;;;;;;;;;;;;1495:36;;1035:159;;-1:-1:-1;1035:159:44;;-1:-1:-1;1495:36:44;;;;-1:-1:-1;1511:18:44;1495:36;1511:18;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1495:36:44;;;;;;;;;;;;1561:21;;;;;274:1:-1;1561:21:44;;;;;;;;;;1545:39;;1495:36;;-1:-1:-1;1495:36:44;;-1:-1:-1;1545:39:44;;;;-1:-1:-1;274:1;1545:39:44;1561:21;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1545:39:44;;;;;;;;;;;;1416:214;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1614:4:44;1416:214;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;1416:214:44;;;;;;;;1406:225;;1416:214;;;;-1:-1:-1;1406:225:44;;;-1:-1:-1;1406:225:44;1416:214;1406:225;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;-1:-1;;263:2;259:12;;;;254:3;250:22;246:30;;;;340:21;;;311:9;;295:26;377:20;;;;365:33;;1406:225:44;;;;;;;;;;1385:18;:246;-1:-1:-1;;162:5:82;:18;;-1:-1:-1;;;;;;162:18:82;170:10;162:18;;;-1:-1:-1;723:5376:65;;-1:-1:-1;723:5376:65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;723:5376:65;;;-1:-1:-1;723:5376:65;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106102195763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631be23901811461021e5780631ea1e3d81461025457806320777f7014610276578063288cdc91146102a3578063297bb70b146102c35780632ac12622146102f05780633683ef8e146103105780633c28d861146103305780633e228bae1461035d5780633fd3c9971461037d5780634ac14782146103aa5780634d0ae546146103ca5780634f9559b1146103ea57806350dde1901461040a578063607041081461042a578063642f2eaf1461045757806364a3bc151461047757806366758d7b14610497578063679d2f9a146104b757806377fcce68146104d75780637b8e3514146104f75780637e1d9808146105175780637e9d74dc1461053757806382c174d0146105645780638da5cb5b146105845780639363470214610599578063a3e20380146105b9578063b4be83d5146105d9578063be7ada1e146105f9578063bfc8bfce14610619578063c585bb9314610639578063c75e0a8114610659578063d46b02c314610686578063d9bfa73e146106a6578063db123b1a146106c6578063dd1c7d18146106e8578063de30200d14610708578063e0acd33d14610728578063e0b701e314610748578063e306f77914610768578063e5fa431b1461077d578063eea086ba1461079d578063f2fde38b146107b2578063ffa1ad74146107d2575b600080fd5b34801561022a57600080fd5b5061023e610239366004614fb4565b6107e7565b60405161024b91906158fb565b60405180910390f35b34801561026057600080fd5b5061027461026f366004614d3e565b6107fe565b005b34801561028257600080fd5b50610296610291366004614fb4565b610812565b60405161024b9190615909565b3480156102af57600080fd5b506102966102be366004614b9c565b61081f565b3480156102cf57600080fd5b506102e36102de366004614abf565b610831565b60405161024b9190615be3565b3480156102fc57600080fd5b5061023e61030b366004614b9c565b61095c565b34801561031c57600080fd5b5061027461032b366004614bd9565b610971565b34801561033c57600080fd5b5061035061034b366004614dcb565b610a5e565b60405161024b9190615bf1565b34801561036957600080fd5b506102e3610378366004614ed2565b610bf5565b34801561038957600080fd5b5061039d610398366004614c9c565b610c4b565b60405161024b91906159c5565b3480156103b657600080fd5b506102746103c5366004614a8a565b610c73565b3480156103d657600080fd5b506102e36103e5366004614abf565b610d40565b3480156103f657600080fd5b50610274610405366004614b9c565b610e30565b34801561041657600080fd5b506102e3610425366004614abf565b610fe5565b34801561043657600080fd5b5061044a610445366004614c9c565b611079565b60405161024b919061581b565b34801561046357600080fd5b5061023e610472366004614b9c565b6110c7565b34801561048357600080fd5b506102e3610492366004614ed2565b6110dc565b3480156104a357600080fd5b506102e36104b2366004614cd8565b611187565b3480156104c357600080fd5b5061023e6104d2366004614fb4565b6111a2565b3480156104e357600080fd5b506102746104f2366004614a5a565b6111af565b34801561050357600080fd5b5061023e610512366004614a20565b6112e9565b34801561052357600080fd5b506102e3610532366004614b53565b611309565b34801561054357600080fd5b50610557610552366004614a8a565b61146d565b60405161024b91906158ea565b34801561057057600080fd5b5061023e61057f366004614bba565b611502565b34801561059057600080fd5b5061044a611522565b3480156105a557600080fd5b5061023e6105b4366004614c41565b61153e565b3480156105c557600080fd5b506102e36105d4366004614b53565b611ac1565b3480156105e557600080fd5b506102e36105f4366004614ed2565b611bd4565b34801561060557600080fd5b50610296610614366004614fb4565b611c4f565b34801561062557600080fd5b50610274610634366004614f1b565b611c5c565b34801561064557600080fd5b506102746106543660046149fa565b611ef5565b34801561066557600080fd5b50610679610674366004614d09565b612120565b60405161024b9190615c00565b34801561069257600080fd5b506102746106a1366004614d09565b61221a565b3480156106b257600080fd5b506102966106c1366004614a20565b6122b6565b3480156106d257600080fd5b506106db6122d3565b60405161024b91906159b4565b3480156106f457600080fd5b506102e3610703366004614b53565b61237e565b34801561071457600080fd5b50610296610723366004614fb4565b612453565b34801561073457600080fd5b50610296610743366004614fb4565b612460565b34801561075457600080fd5b506102e3610763366004614e8b565b61246d565b34801561077457600080fd5b5061029661247f565b34801561078957600080fd5b506102e3610798366004614b53565b612485565b3480156107a957600080fd5b5061044a6125f7565b3480156107be57600080fd5b506102746107cd3660046149fa565b612613565b3480156107de57600080fd5b506106db6126c4565b60006107f48484846126fb565b90505b9392505050565b61080b8585858585612780565b5050505050565b60006107f484848461282c565b60046020526000908152604090205481565b6108396145bd565b6000806108446145bd565b60005460ff161561088a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461092a5761091387838151811015156108d457fe5b9060200190602002015187848151811015156108ec57fe5b90602001906020020151878581518110151561090457fe5b9060200190602002015161288d565b905061091f848261292b565b6001909101906108bc565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509392505050565b60056020526000908152604090205460ff1681565b73ffffffffffffffffffffffffffffffffffffffff83163314610a01576109c9848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375061153e945050505050565b1515610a01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a93565b5050600091825260076020908152604080842073ffffffffffffffffffffffffffffffffffffffff9093168452919052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b610a666145e6565b610a6e614615565b610a76614615565b6000805460ff1615610ab4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561016080890151610140808a019190915289015190880152610b0088612120565b9250610b0b87612120565b9150610b1561298d565b9050610b23888483896129be565b610b2f878383886129be565b610b398888612b56565b610b4d888885604001518560400151612bb6565b805160208101519051919550610b68918a9186918190612d3d565b602080850151908101519051610b849189918591908190612d3d565b610b9d8882856020015186604001518860000151612780565b610bb68782846020015185604001518860200151612780565b610bc288888387612e4f565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550949350505050565b610bfd6145bd565b6060610c0a858585613027565b9050608081825160208401305af48015610c4157815183526020820151602084015260408201516040840152606082015160608401525b505b509392505050565b600b6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60008054819060ff1615610cb3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558151905b808214610d1357610d0b8382815181101515610cfc57fe5b906020019060200201516131f9565b600101610ce4565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b610d486145bd565b600080610d536145bd565b60005460ff1615610d90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558751935091505b81831461092a57610e198783815181101515610dda57fe5b906020019060200201518784815181101515610df257fe5b906020019060200201518785815181101515610e0a57fe5b90602001906020020151613224565b9050610e25848261292b565b600190910190610dc2565b6000805481908190819060ff1615610e74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610ea761298d565b935073ffffffffffffffffffffffffffffffffffffffff84163314610ecc5733610ecf565b60005b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600660209081526040808320938516835292905220549093506001860192509050808211610f46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b23565b73ffffffffffffffffffffffffffffffffffffffff80851660008181526006602090815260408083209488168084529490915290819020859055517f82af639571738f4ebd4268fb0363d8957ebe1bbb9e78dba5ebd69eed39b154f090610fae908690615909565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055505050565b610fed6145bd565b600080610ff86145bd565b86519250600091505b81831461106f57611058878381518110151561101957fe5b90602001906020020151878481518110151561103157fe5b90602001906020020151878581518110151561104957fe5b90602001906020020151610bf5565b9050611064848261292b565b600190910190611001565b5050509392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600b602052604090205473ffffffffffffffffffffffffffffffffffffffff165b919050565b60096020526000908152604090205460ff1681565b6110e46145bd565b60005460ff1615611121576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055611157848484613224565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055949350505050565b61118f6145bd565b611199838361292b565b50815b92915050565b60006107f4848484613277565b6000805460ff16156111ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561122061298d565b73ffffffffffffffffffffffffffffffffffffffff8181166000818152600860209081526040808320948916808452949091529081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168715151790555192935090917fa8656e308026eeabce8f0bc18048433252318ab80ac79da0b3d3d8697dfba891906112b49086906158fb565b60405180910390a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b600860209081526000928352604080842090915290825290205460ff1681565b6113116145bd565b606060008060006113206145bd565b60005460ff161561135d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117815589518a9190811061139557fe5b906020019060200201516101600151945088519350600092505b828414611438578489848151811015156113c557fe5b9060200190602002015161016001819052506113e58887602001516132fc565b915061141189848151811015156113f857fe5b9060200190602002015183898681518110151561090457fe5b905061141d868261292b565b6020860151881161142d57611438565b6001909201916113af565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055509195945050505050565b606060006060600084519250826040519080825280602002602001820160405280156114b357816020015b6114a0614615565b8152602001906001900390816114985790505b509150600090505b808314610c43576114e285828151811015156114d357fe5b90602001906020020151612120565b82828151811015156114f057fe5b602090810290910101526001016114bb565b600760209081526000928352604080842090915290825290205460ff1681565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008060008060008060008951111515611587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b13565b6115908961333e565b7f010000000000000000000000000000000000000000000000000000000000000090049650600760ff8816106115f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a33565b8660ff16600781111561160157fe5b9550600086600781111561161157fe5b1415611649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b03565b600186600781111561165757fe5b141561169f57885115611696576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615bd3565b60009750611ab3565b60028660078111156116ad57fe5b14156117e85788516041146116ee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610881906159d3565b8860008151811015156116fd57fe5b01602001517f010000000000000000000000000000000000000000000000000000000000000090819004810204945061173d89600163ffffffff61340216565b935061175089602163ffffffff61340216565b925060018b868686604051600081526020016040526040516117759493929190615964565b60206040516020810390808403906000865af1158015611799573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff8c81169082161499509250611ab39050565b60038660078111156117f657fe5b141561199c578851604114611837576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610881906159d3565b88600081518110151561184657fe5b01602001517f010000000000000000000000000000000000000000000000000000000000000090819004810204945061188689600163ffffffff61340216565b935061189989602163ffffffff61340216565b925060018b60405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b6020831061193a57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016118fd565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260408051929094018290038220600083529101928390526117759450925089918991508890615964565b60048660078111156119aa57fe5b14156119c2576119bb8b8b8b61344d565b9750611ab3565b60058660078111156119d057fe5b1415611a33576119df896135a2565b73ffffffffffffffffffffffffffffffffffffffff808c1660009081526008602090815260408083209385168352929052205490915060ff161515611a275760009750611ab3565b6119bb818c8c8c61361b565b6006866007811115611a4157fe5b1415611a815760008b815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290205460ff169750611ab3565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a33565b505050505050509392505050565b611ac96145bd565b6060600080600080611ad96145bd565b896000815181101515611ae857fe5b906020019060200201516101400151955089519450600093505b838514611bc757858a85815181101515611b1857fe5b6020908102909101015161014001528651611b34908a906132fc565b9250611b778a85815181101515611b4757fe5b9060200190602002015160a001518b86815181101515611b6357fe5b906020019060200201516080015185613777565b9150611ba38a85815181101515611b8a57fe5b90602001906020020151838a8781518110151561104957fe5b9050611baf878261292b565b86518911611bbc57611bc7565b600190930192611b02565b5050505050509392505050565b611bdc6145bd565b60005460ff1615611c19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561115784848461288d565b60006107f4848484613777565b600a5460009073ffffffffffffffffffffffffffffffffffffffff1615611caf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b611cf2611ced888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437506137bf945050505050565b613a00565b60008181526009602052604090205490915060ff1615611d3e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a83565b73ffffffffffffffffffffffffffffffffffffffff86163314611e0f57611d96818785858080601f0160208091040260200160405190810160405280939291908181526020018383808284375061153e945050505050565b1515611dce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615bc3565b600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555b6000818152600960205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555130908690869080838380828437820191505092505050600060405180830381855af49150501515611ea6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ab3565b73ffffffffffffffffffffffffffffffffffffffff86163314611eec57600a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b50505050505050565b6003546000908190819073ffffffffffffffffffffffffffffffffffffffff163314611f4d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b73565b8392508273ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015611fb457600080fd5b505af1158015611fc8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611fec9190810190614cba565b7fffffffff0000000000000000000000000000000000000000000000000000000081166000908152600b602052604090205490925073ffffffffffffffffffffffffffffffffffffffff1690508015612071576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a13565b7fffffffff0000000000000000000000000000000000000000000000000000000082166000908152600b60205260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c03194906121129084908790615999565b60405180910390a150505050565b612128614615565b61213182613a3d565b60208083018290526000918252600490526040908190205490820152608082015115156121655760015b60ff1681526110c2565b60a0820151151561217757600261215b565b60a082015160408201511061218d57600561215b565b61010082015142106121a057600461215b565b60208082015160009081526005909152604090205460ff16156121c457600661215b565b610120820151825173ffffffffffffffffffffffffffffffffffffffff9081166000908152600660209081526040808320606088015190941683529290522054111561221157600661215b565b60038152919050565b60005460ff1615612257576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561228b816131f9565b50600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b600660209081526000928352604080842090915290825290205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156123765780601f1061234b57610100808354040283529160200191612376565b820191906000526020600020905b81548152906001019060200180831161235957829003601f168201915b505050505081565b6123866145bd565b606060008060006123956145bd565b8860008151811015156123a457fe5b906020019060200201516101600151945088519350600092505b828414612447578489848151811015156123d457fe5b9060200190602002015161016001819052506123f48887602001516132fc565b9150612420898481518110151561240757fe5b9060200190602002015183898681518110151561104957fe5b905061242c868261292b565b6020860151881161243c57612447565b6001909201916123be565b50505050509392505050565b60006107f4848484613a4b565b60006107f4848484613ac8565b6124756145bd565b6107f78383613b45565b60025481565b61248d6145bd565b606060008060008061249d6145bd565b60005460ff16156124da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b63565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011781558a518b9190811061251257fe5b906020019060200201516101400151955089519450600093505b8385146125c157858a8581518110151561254257fe5b602090810290910101516101400152865161255e908a906132fc565b92506125718a85815181101515611b4757fe5b915061259d8a8581518110151561258457fe5b90602001906020020151838a8781518110151561090457fe5b90506125a9878261292b565b865189116125b6576125c1565b60019093019261252c565b5050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550929695505050505050565b600a5473ffffffffffffffffffffffffffffffffffffffff1681565b60035473ffffffffffffffffffffffffffffffffffffffff163314612664576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b73565b73ffffffffffffffffffffffffffffffffffffffff8116156126c157600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60408051808201909152600b81527f322e302e312d616c706861000000000000000000000000000000000000000000602082015281565b600080808411612737576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b821580612742575084155b156127505760009150610c43565b8380151561275a57fe5b85840990506127698584613ba6565b6127756103e883613ba6565b101595945050505050565b61278e828260200151613c0c565b600084815260046020908152604091829020929092558681015187518451938501518584015160608701516101408c01516101608d015196518b9873ffffffffffffffffffffffffffffffffffffffff9788169897909616967f0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c3711299661281d968f96339692959194909390615829565b60405180910390a45050505050565b6000808311612867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b6107f46128876128778685613ba6565b6128828660016132fc565b613c0c565b84613c4b565b6128956145bd565b61289d614615565b60008060006128ab88612120565b93506128b561298d565b92506128c3888585896129be565b6128d58860a0015185604001516132fc565b91506128e18783613c62565b90506128f4888589848960000151612d3d565b6128fe8882613b45565b945061291588848660200151876040015189612780565b612920888487613c71565b505050509392505050565b815181516129399190613c0c565b82526020808301519082015161294f9190613c0c565b6020830152604080830151908201516129689190613c0c565b6040830152606080830151908201516129819190613c0c565b60609092019190915250565b600a5460009073ffffffffffffffffffffffffffffffffffffffff168181156129b657816107f7565b339392505050565b825160ff166003146129fc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b93565b606084015173ffffffffffffffffffffffffffffffffffffffff1615612a6f57606084015173ffffffffffffffffffffffffffffffffffffffff163314612a6f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ba3565b602084015173ffffffffffffffffffffffffffffffffffffffff1615612afa578173ffffffffffffffffffffffffffffffffffffffff16846020015173ffffffffffffffffffffffffffffffffffffffff16141515612afa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610881906159e3565b60408301511515612b5057612b18836020015185600001518361153e565b1515612b50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a53565b50505050565b612b688260a001518260a00151613ba6565b612b7a83608001518360800151613ba6565b1015612bb2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615bb3565b5050565b612bbe6145e6565b600080600080612bd28960a00151886132fc565b9350612be789608001518a60a0015186613a4b565b9250612bf78860a00151876132fc565b9150612c0c88608001518960a0015184613a4b565b9050808410612c4f5760208086018051839052805182018490525151865182015260808a015160a08b0151875190920151612c479290613a4b565b855152612c8c565b845183905284516020908101859052855181015190860180519190915260a089015160808a0151915151612c839290613ac8565b60208087015101525b8451516020808701510151612ca191906132fc565b604086015284515160808a015160c08b0151612cbe929190613a4b565b85516040015284516020015160a08a015160e08b0151612cdf929190613a4b565b855160600152602085015151608089015160c08a0151612d00929190613a4b565b85602001516040018181525050612d288560200151602001518960a001518a60e00151613a4b565b60208601516060015250505050949350505050565b821515612d76576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ad3565b82821115612db0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ac3565b8460a00151612dc3856040015184613c0c565b1115612dfb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610881906159f3565b612e09856080015183613ba6565b612e17828760a00151613ba6565b111561080b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b53565b60018054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008789161502019095169490940493840181900481028201810190925282815260609390929091830182828015612ef85780601f10612ecd57610100808354040283529160200191612ef8565b820191906000526020600020905b815481529060010190602001808311612edb57829003601f168201915b50505050509050612f2085610140015186600001518660000151856020015160200151613d7b565b61014084015184518651845160200151612f3c93929190613d7b565b612f558561014001518660000151858560400151613d7b565b612f718186600001518760400151856000015160400151613d7b565b612f8d8185600001518660400151856020015160400151613d7b565b836040015173ffffffffffffffffffffffffffffffffffffffff16856040015173ffffffffffffffffffffffffffffffffffffffff161415612ff757612ff281848760400151612fed866000015160600151876020015160600151613c0c565b613d7b565b61080b565b61300f81848760400151856000015160600151613d7b565b61080b81848660400151856020015160600151613d7b565b604080517fb4be83d5000000000000000000000000000000000000000000000000000000006020808301919091526060602483018181528751608485019081528884015160a48601529488015160c48501529087015160e4840152608087015161010484015260a087015161012484015260c087015161014484015260e08701516101648401526101008701516101848401526101208701516101a4840152610140870180516101c485019081526101608901516101e4860152610180905251805161020485018190529394919384936044870192849261022489019291820191601f82010460005b8181101561312e578351855260209485019490930192600101613110565b50505050818103610160808401919091528a0151805180835260209283019291820191601f82010460005b81811015613177578351855260209485019490930192600101613159565b50505089845250848103602093840190815288518083529093918201918981019190601f82010460005b818110156131bf5783518552602094850194909301926001016131a1565b5050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08883030188525060405250505050509392505050565b613201614615565b61320a82612120565b90506132168282613f45565b612bb282826020015161405c565b61322c6145bd565b61323784848461288d565b602081015190915083146107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b43565b6000808084116132b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b8215806132be575084155b156132cc5760009150610c43565b838015156132d657fe5b8584099050836132e685836132fc565b8115156132ef57fe5b0690506127698584613ba6565b600082821115613338576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a03565b50900390565b600080825111151561337c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615af3565b815182907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81019081106133ac57fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909252507f0100000000000000000000000000000000000000000000000000000000000000908190040290565b600081602001835110151515613444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a23565b50016020015190565b6040516000906060907f1626ba7e00000000000000000000000000000000000000000000000000000000906134889087908690602401615944565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093178352815191935090829081885afa808015613525576001811461359657612920565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0c57414c4c45545f4552524f5200000000000000000000000000000000604052600060605260646000fd5b50505195945050505050565b600060148251101515156135e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b83565b6135f0826014845103614103565b82517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec019092525090565b6040516000906060907f93634702000000000000000000000000000000000000000000000000000000009061365890879087908790602401615917565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931783528151919350908290818a5afa8080156136f557600181146137665761376b565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f56414c494441544f525f4552524f5200000000000000000000000000604052600060605260646000fd5b825194505b50505050949350505050565b60008083116137b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b6107f46128878584613ba6565b604080517f5a65726f45785472616e73616374696f6e2800000000000000000000000000006020808301919091527f75696e743235362073616c742c0000000000000000000000000000000000000060328301527f61646472657373207369676e6572416464726573732c00000000000000000000603f8301527f627974657320646174610000000000000000000000000000000000000000000060558301527f2900000000000000000000000000000000000000000000000000000000000000605f830152825180830384018152606090920192839052815160009384938493909282918401908083835b602083106138e857805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016138ab565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260405191909301819003812089519097508995509093508392850191508083835b6020831061397e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613941565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822097825281019a909a525073ffffffffffffffffffffffffffffffffffffffff97909716968801969096525050606085015250506080909120919050565b600280546040517f190100000000000000000000000000000000000000000000000000000000000081529182015260228101919091526042902090565b600061119c611ced83614164565b6000808311613a86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b613a918484846126fb565b156137b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615aa3565b6000808311613b03576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a43565b613b0e848484613277565b15612867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615aa3565b613b4d6145bd565b6020810182905260a08301516080840151613b69918491613a4b565b808252608084015160c0850151613b81929190613a4b565b604082015260a083015160e0840151613b9b918491613a4b565b606082015292915050565b600080831515613bb95760009150613c05565b50828202828482811515613bc957fe5b0414613c01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a73565b8091505b5092915050565b600082820183811015613c01576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a73565b6000808284811515613c5957fe5b04949350505050565b600081831061119957816107f7565b60018054604080516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008789161502019095169490940493840181900481028201810190925282815260609390929091830182828015613d1a5780601f10613cef57610100808354040283529160200191613d1a565b820191906000526020600020905b815481529060010190602001808311613cfd57829003601f168201915b50505050509050613d3a8461014001518560000151858560000151613d7b565b613d538461016001518486600001518560200151613d7b565b613d6b81856000015186604001518560400151613d7b565b612b508184866040015185606001515b600080600083118015613dba57508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15613f3d578551600310613dfa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b33565b50506020848101517fffffffff00000000000000000000000000000000000000000000000000000000166000818152600b90925260409091205473ffffffffffffffffffffffffffffffffffffffff16801515613e83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ae3565b604051660fffffffffffe0603f885101168060840182017fa85e59e40000000000000000000000000000000000000000000000000000000083526080600484015273ffffffffffffffffffffffffffffffffffffffff8816602484015273ffffffffffffffffffffffffffffffffffffffff87166044840152856064840152608483015b81811015613f1f57895181526020998a019901613f07565b61020084858403866000895af1801515613f37573d85fd5b50505050505b505050505050565b805160009060ff16600314613f86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b93565b606083015173ffffffffffffffffffffffffffffffffffffffff1615613ff957606083015173ffffffffffffffffffffffffffffffffffffffff163314613ff9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615ba3565b61400161298d565b835190915073ffffffffffffffffffffffffffffffffffffffff808316911614614057576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615a63565b505050565b6000818152600560205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558281015183516101408501516101608601519351859473ffffffffffffffffffffffffffffffffffffffff9485169493909316927fdc47b3613d9fe400085f6dbdc99453462279057e6207385042827ed6b1a62cf7926140f7923392906158ad565b60405180910390a45050565b600081601401835110151515614145576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088190615b83565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b604080517f4f726465722800000000000000000000000000000000000000000000000000006020808301919091527f61646472657373206d616b6572416464726573732c000000000000000000000060268301527f616464726573732074616b6572416464726573732c0000000000000000000000603b8301527f6164647265737320666565526563697069656e74416464726573732c0000000060508301527f616464726573732073656e646572416464726573732c00000000000000000000606c8301527f75696e74323536206d616b65724173736574416d6f756e742c0000000000000060828301527f75696e743235362074616b65724173736574416d6f756e742c00000000000000609b8301527f75696e74323536206d616b65724665652c00000000000000000000000000000060b48301527f75696e743235362074616b65724665652c00000000000000000000000000000060c58301527f75696e743235362065787069726174696f6e54696d655365636f6e64732c000060d68301527f75696e743235362073616c742c0000000000000000000000000000000000000060f48301527f6279746573206d616b65724173736574446174612c00000000000000000000006101018301527f62797465732074616b65724173736574446174610000000000000000000000006101168301527f290000000000000000000000000000000000000000000000000000000000000061012a830152825161010b81840301815261012b90920192839052815160009384938493849391929182918401908083835b602083106143ec57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016143af565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101408b0151805191995095509093508392850191508083835b6020831061448757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161444a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101608b0151805191985095509093508392850191508083835b6020831061452257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016144e5565b5181516020939093036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909116921691909117905260405192018290039091207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0890180516101408b018051610160909c0180519a84529881529288526101a0822091529890525050509190525090919050565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b610120604051908101604052806145fb6145bd565b81526020016146086145bd565b8152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b60006107f78235615ca6565b6000601f8201831361465257600080fd5b813561466561466082615c35565b615c0e565b81815260209384019390925082018360005b838110156146a3578135860161468d88826147f3565b8452506020928301929190910190600101614677565b5050505092915050565b6000601f820183136146be57600080fd5b81356146cc61466082615c35565b81815260209384019390925082018360005b838110156146a357813586016146f488826148b1565b84525060209283019291909101906001016146de565b6000601f8201831361471b57600080fd5b813561472961466082615c35565b9150818183526020840193506020810190508385602084028201111561474e57600080fd5b60005b838110156146a357816147648882614786565b8452506020928301929190910190600101614751565b60006107f78235615cbf565b60006107f78235615cc4565b60006107f78235615cc7565b60006107f78251615cc7565b600080601f830184136147bc57600080fd5b50813567ffffffffffffffff8111156147d457600080fd5b6020830191508360018202830111156147ec57600080fd5b9250929050565b6000601f8201831361480457600080fd5b813561481261466082615c56565b9150808252602083016020830185838301111561482e57600080fd5b614839838284615cfd565b50505092915050565b60006080828403121561485457600080fd5b61485e6080615c0e565b9050600061486c8484614786565b825250602061487d84848301614786565b602083015250604061489184828501614786565b60408301525060606148a584828501614786565b60608301525092915050565b600061018082840312156148c457600080fd5b6148cf610180615c0e565b905060006148dd8484614635565b82525060206148ee84848301614635565b602083015250604061490284828501614635565b604083015250606061491684828501614635565b606083015250608061492a84828501614786565b60808301525060a061493e84828501614786565b60a08301525060c061495284828501614786565b60c08301525060e061496684828501614786565b60e08301525061010061497b84828501614786565b6101008301525061012061499184828501614786565b6101208301525061014082013567ffffffffffffffff8111156149b357600080fd5b6149bf848285016147f3565b6101408301525061016082013567ffffffffffffffff8111156149e157600080fd5b6149ed848285016147f3565b6101608301525092915050565b600060208284031215614a0c57600080fd5b6000614a188484614635565b949350505050565b60008060408385031215614a3357600080fd5b6000614a3f8585614635565b9250506020614a5085828601614635565b9150509250929050565b60008060408385031215614a6d57600080fd5b6000614a798585614635565b9250506020614a508582860161477a565b600060208284031215614a9c57600080fd5b813567ffffffffffffffff811115614ab357600080fd5b614a18848285016146ad565b600080600060608486031215614ad457600080fd5b833567ffffffffffffffff811115614aeb57600080fd5b614af7868287016146ad565b935050602084013567ffffffffffffffff811115614b1457600080fd5b614b208682870161470a565b925050604084013567ffffffffffffffff811115614b3d57600080fd5b614b4986828701614641565b9150509250925092565b600080600060608486031215614b6857600080fd5b833567ffffffffffffffff811115614b7f57600080fd5b614b8b868287016146ad565b9350506020614b2086828701614786565b600060208284031215614bae57600080fd5b6000614a188484614786565b60008060408385031215614bcd57600080fd5b6000614a3f8585614786565b60008060008060608587031215614bef57600080fd5b6000614bfb8787614786565b9450506020614c0c87828801614635565b935050604085013567ffffffffffffffff811115614c2957600080fd5b614c35878288016147aa565b95989497509550505050565b600080600060608486031215614c5657600080fd5b6000614c628686614786565b9350506020614c7386828701614635565b925050604084013567ffffffffffffffff811115614c9057600080fd5b614b49868287016147f3565b600060208284031215614cae57600080fd5b6000614a188484614792565b600060208284031215614ccc57600080fd5b6000614a18848461479e565b6000806101008385031215614cec57600080fd5b6000614cf88585614842565b9250506080614a5085828601614842565b600060208284031215614d1b57600080fd5b813567ffffffffffffffff811115614d3257600080fd5b614a18848285016148b1565b60008060008060006101008688031215614d5757600080fd5b853567ffffffffffffffff811115614d6e57600080fd5b614d7a888289016148b1565b9550506020614d8b88828901614635565b9450506040614d9c88828901614786565b9350506060614dad88828901614786565b9250506080614dbe88828901614842565b9150509295509295909350565b60008060008060808587031215614de157600080fd5b843567ffffffffffffffff811115614df857600080fd5b614e04878288016148b1565b945050602085013567ffffffffffffffff811115614e2157600080fd5b614e2d878288016148b1565b935050604085013567ffffffffffffffff811115614e4a57600080fd5b614e56878288016147f3565b925050606085013567ffffffffffffffff811115614e7357600080fd5b614e7f878288016147f3565b91505092959194509250565b60008060408385031215614e9e57600080fd5b823567ffffffffffffffff811115614eb557600080fd5b614ec1858286016148b1565b9250506020614a5085828601614786565b600080600060608486031215614ee757600080fd5b833567ffffffffffffffff811115614efe57600080fd5b614f0a868287016148b1565b9350506020614c7386828701614786565b60008060008060008060808789031215614f3457600080fd5b6000614f408989614786565b9650506020614f5189828a01614635565b955050604087013567ffffffffffffffff811115614f6e57600080fd5b614f7a89828a016147aa565b9450945050606087013567ffffffffffffffff811115614f9957600080fd5b614fa589828a016147aa565b92509250509295509295509295565b600080600060608486031215614fc957600080fd5b6000614fd58686614786565b9350506020614fe686828701614786565b9250506040614b4986828701614786565b61500081615ca6565b82525050565b600061501182615ca2565b80845260208401935061502383615c9c565b60005b82811015615053576150398683516157db565b61504282615c9c565b606096909601959150600101615026565b5093949350505050565b61500081615cbf565b61500081615cc4565b61500081615cc7565b600061508382615ca2565b808452615097816020860160208601615d09565b6150a081615d35565b9093016020019392505050565b61500081615cf2565b601281527f4c454e4754485f36355f52455155495245440000000000000000000000000000602082015260400190565b600d81527f494e56414c49445f54414b455200000000000000000000000000000000000000602082015260400190565b600e81527f4f524445525f4f56455246494c4c000000000000000000000000000000000000602082015260400190565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f414c52454144595f455849535453000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601581527f5349474e41545552455f554e535550504f525445440000000000000000000000602082015260400190565b601081527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000602082015260400190565b601781527f494e56414c49445f4f524445525f5349474e4154555245000000000000000000602082015260400190565b600d81527f494e56414c49445f4d414b455200000000000000000000000000000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b600f81527f494e56414c49445f54585f484153480000000000000000000000000000000000602082015260400190565b601181527f494e56414c49445f5349474e4154555245000000000000000000000000000000602082015260400190565b600e81527f524f554e44494e475f4552524f52000000000000000000000000000000000000602082015260400190565b601081527f4641494c45445f455845435554494f4e00000000000000000000000000000000602082015260400190565b600d81527f54414b45525f4f56455250415900000000000000000000000000000000000000602082015260400190565b601481527f494e56414c49445f54414b45525f414d4f554e54000000000000000000000000602082015260400190565b601a81527f41535345545f50524f58595f444f45535f4e4f545f4558495354000000000000602082015260400190565b602181527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560208201527f4400000000000000000000000000000000000000000000000000000000000000604082015260600190565b601181527f5349474e41545552455f494c4c4547414c000000000000000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f305f52455155495245440000602082015260400190565b601781527f494e56414c49445f4e45575f4f524445525f45504f4348000000000000000000602082015260400190565b601e81527f4c454e4754485f475245415445525f5448414e5f335f52455155495245440000602082015260400190565b601481527f434f4d504c4554455f46494c4c5f4641494c4544000000000000000000000000602082015260400190565b601281527f494e56414c49445f46494c4c5f50524943450000000000000000000000000000602082015260400190565b601281527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000602082015260400190565b601381527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601081527f4f524445525f554e46494c4c41424c4500000000000000000000000000000000602082015260400190565b600e81527f494e56414c49445f53454e444552000000000000000000000000000000000000602082015260400190565b601881527f4e454741544956455f5350524541445f52455155495245440000000000000000602082015260400190565b601481527f494e56414c49445f54585f5349474e4154555245000000000000000000000000602082015260400190565b601181527f4c454e4754485f305f5245515549524544000000000000000000000000000000602082015260400190565b805160808301906157698482615066565b50602082015161577c6020850182615066565b50604082015161578f6040850182615066565b506060820151612b506060850182615066565b80516101208301906157b48482615758565b5060208201516157c76080850182615758565b506040820151612b50610100850182615066565b805160608301906157ec8482615812565b5060208201516157ff6020850182615066565b506040820151612b506040850182615066565b61500081615cec565b6020810161119c8284614ff7565b6101008101615838828b614ff7565b615845602083018a614ff7565b6158526040830189615066565b61585f6060830188615066565b61586c6080830187615066565b61587960a0830186615066565b81810360c083015261588b8185615078565b905081810360e083015261589f8184615078565b9a9950505050505050505050565b606081016158bb8286614ff7565b81810360208301526158cd8185615078565b905081810360408301526158e18184615078565b95945050505050565b602080825281016107f78184615006565b6020810161119c828461505d565b6020810161119c8284615066565b606081016159258286615066565b6159326020830185614ff7565b81810360408301526158e18184615078565b604081016159528285615066565b81810360208301526107f48184615078565b608081016159728287615066565b61597f6020830186615812565b61598c6040830185615066565b6158e16060830184615066565b604081016159a7828561506f565b6107f76020830184614ff7565b602080825281016107f78184615078565b6020810161119c82846150ad565b6020808252810161119c816150b6565b6020808252810161119c816150e6565b6020808252810161119c81615116565b6020808252810161119c81615146565b6020808252810161119c81615176565b6020808252810161119c816151a6565b6020808252810161119c816151fc565b6020808252810161119c8161522c565b6020808252810161119c8161525c565b6020808252810161119c8161528c565b6020808252810161119c816152bc565b6020808252810161119c816152ec565b6020808252810161119c8161531c565b6020808252810161119c8161534c565b6020808252810161119c8161537c565b6020808252810161119c816153ac565b6020808252810161119c816153dc565b6020808252810161119c8161540c565b6020808252810161119c8161543c565b6020808252810161119c81615492565b6020808252810161119c816154c2565b6020808252810161119c816154f2565b6020808252810161119c81615522565b6020808252810161119c81615552565b6020808252810161119c81615582565b6020808252810161119c816155b2565b6020808252810161119c816155e2565b6020808252810161119c81615612565b6020808252810161119c81615668565b6020808252810161119c81615698565b6020808252810161119c816156c8565b6020808252810161119c816156f8565b6020808252810161119c81615728565b6080810161119c8284615758565b610120810161119c82846157a2565b6060810161119c82846157db565b60405181810167ffffffffffffffff81118282101715615c2d57600080fd5b604052919050565b600067ffffffffffffffff821115615c4c57600080fd5b5060209081020190565b600067ffffffffffffffff821115615c6d57600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b600061119c82615ca6565b82818337506000910152565b60005b83811015615d24578181015183820152602001615d0c565b83811115612b505750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820a0d8acecb3333dd721a822fb1c86c7714fc5a48327fd1bd94e3356ca224d82826c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x219 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x1BE23901 DUP2 EQ PUSH2 0x21E JUMPI DUP1 PUSH4 0x1EA1E3D8 EQ PUSH2 0x254 JUMPI DUP1 PUSH4 0x20777F70 EQ PUSH2 0x276 JUMPI DUP1 PUSH4 0x288CDC91 EQ PUSH2 0x2A3 JUMPI DUP1 PUSH4 0x297BB70B EQ PUSH2 0x2C3 JUMPI DUP1 PUSH4 0x2AC12622 EQ PUSH2 0x2F0 JUMPI DUP1 PUSH4 0x3683EF8E EQ PUSH2 0x310 JUMPI DUP1 PUSH4 0x3C28D861 EQ PUSH2 0x330 JUMPI DUP1 PUSH4 0x3E228BAE EQ PUSH2 0x35D JUMPI DUP1 PUSH4 0x3FD3C997 EQ PUSH2 0x37D JUMPI DUP1 PUSH4 0x4AC14782 EQ PUSH2 0x3AA JUMPI DUP1 PUSH4 0x4D0AE546 EQ PUSH2 0x3CA JUMPI DUP1 PUSH4 0x4F9559B1 EQ PUSH2 0x3EA JUMPI DUP1 PUSH4 0x50DDE190 EQ PUSH2 0x40A JUMPI DUP1 PUSH4 0x60704108 EQ PUSH2 0x42A JUMPI DUP1 PUSH4 0x642F2EAF EQ PUSH2 0x457 JUMPI DUP1 PUSH4 0x64A3BC15 EQ PUSH2 0x477 JUMPI DUP1 PUSH4 0x66758D7B EQ PUSH2 0x497 JUMPI DUP1 PUSH4 0x679D2F9A EQ PUSH2 0x4B7 JUMPI DUP1 PUSH4 0x77FCCE68 EQ PUSH2 0x4D7 JUMPI DUP1 PUSH4 0x7B8E3514 EQ PUSH2 0x4F7 JUMPI DUP1 PUSH4 0x7E1D9808 EQ PUSH2 0x517 JUMPI DUP1 PUSH4 0x7E9D74DC EQ PUSH2 0x537 JUMPI DUP1 PUSH4 0x82C174D0 EQ PUSH2 0x564 JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0x584 JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0x599 JUMPI DUP1 PUSH4 0xA3E20380 EQ PUSH2 0x5B9 JUMPI DUP1 PUSH4 0xB4BE83D5 EQ PUSH2 0x5D9 JUMPI DUP1 PUSH4 0xBE7ADA1E EQ PUSH2 0x5F9 JUMPI DUP1 PUSH4 0xBFC8BFCE EQ PUSH2 0x619 JUMPI DUP1 PUSH4 0xC585BB93 EQ PUSH2 0x639 JUMPI DUP1 PUSH4 0xC75E0A81 EQ PUSH2 0x659 JUMPI DUP1 PUSH4 0xD46B02C3 EQ PUSH2 0x686 JUMPI DUP1 PUSH4 0xD9BFA73E EQ PUSH2 0x6A6 JUMPI DUP1 PUSH4 0xDB123B1A EQ PUSH2 0x6C6 JUMPI DUP1 PUSH4 0xDD1C7D18 EQ PUSH2 0x6E8 JUMPI DUP1 PUSH4 0xDE30200D EQ PUSH2 0x708 JUMPI DUP1 PUSH4 0xE0ACD33D EQ PUSH2 0x728 JUMPI DUP1 PUSH4 0xE0B701E3 EQ PUSH2 0x748 JUMPI DUP1 PUSH4 0xE306F779 EQ PUSH2 0x768 JUMPI DUP1 PUSH4 0xE5FA431B EQ PUSH2 0x77D JUMPI DUP1 PUSH4 0xEEA086BA EQ PUSH2 0x79D JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x7B2 JUMPI DUP1 PUSH4 0xFFA1AD74 EQ PUSH2 0x7D2 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x22A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x239 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x7E7 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x58FB JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x260 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x26F CALLDATASIZE PUSH1 0x4 PUSH2 0x4D3E JUMP JUMPDEST PUSH2 0x7FE JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x282 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x291 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x812 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x5909 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2AF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x2BE CALLDATASIZE PUSH1 0x4 PUSH2 0x4B9C JUMP JUMPDEST PUSH2 0x81F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2CF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x2DE CALLDATASIZE PUSH1 0x4 PUSH2 0x4ABF JUMP JUMPDEST PUSH2 0x831 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x5BE3 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2FC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x30B CALLDATASIZE PUSH1 0x4 PUSH2 0x4B9C JUMP JUMPDEST PUSH2 0x95C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x31C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x32B CALLDATASIZE PUSH1 0x4 PUSH2 0x4BD9 JUMP JUMPDEST PUSH2 0x971 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x33C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x350 PUSH2 0x34B CALLDATASIZE PUSH1 0x4 PUSH2 0x4DCB JUMP JUMPDEST PUSH2 0xA5E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x5BF1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x369 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x378 CALLDATASIZE PUSH1 0x4 PUSH2 0x4ED2 JUMP JUMPDEST PUSH2 0xBF5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x389 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x39D PUSH2 0x398 CALLDATASIZE PUSH1 0x4 PUSH2 0x4C9C JUMP JUMPDEST PUSH2 0xC4B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x59C5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3B6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x3C5 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A8A JUMP JUMPDEST PUSH2 0xC73 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x3E5 CALLDATASIZE PUSH1 0x4 PUSH2 0x4ABF JUMP JUMPDEST PUSH2 0xD40 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3F6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x405 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B9C JUMP JUMPDEST PUSH2 0xE30 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x416 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x425 CALLDATASIZE PUSH1 0x4 PUSH2 0x4ABF JUMP JUMPDEST PUSH2 0xFE5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x436 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x44A PUSH2 0x445 CALLDATASIZE PUSH1 0x4 PUSH2 0x4C9C JUMP JUMPDEST PUSH2 0x1079 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x581B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x463 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x472 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B9C JUMP JUMPDEST PUSH2 0x10C7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x483 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x492 CALLDATASIZE PUSH1 0x4 PUSH2 0x4ED2 JUMP JUMPDEST PUSH2 0x10DC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4A3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x4B2 CALLDATASIZE PUSH1 0x4 PUSH2 0x4CD8 JUMP JUMPDEST PUSH2 0x1187 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4C3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x4D2 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x11A2 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4E3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x4F2 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A5A JUMP JUMPDEST PUSH2 0x11AF JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x503 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x512 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A20 JUMP JUMPDEST PUSH2 0x12E9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x523 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x532 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B53 JUMP JUMPDEST PUSH2 0x1309 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x543 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x557 PUSH2 0x552 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A8A JUMP JUMPDEST PUSH2 0x146D JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x58EA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x570 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x57F CALLDATASIZE PUSH1 0x4 PUSH2 0x4BBA JUMP JUMPDEST PUSH2 0x1502 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x590 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x44A PUSH2 0x1522 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5A5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E PUSH2 0x5B4 CALLDATASIZE PUSH1 0x4 PUSH2 0x4C41 JUMP JUMPDEST PUSH2 0x153E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5C5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x5D4 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B53 JUMP JUMPDEST PUSH2 0x1AC1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x5F4 CALLDATASIZE PUSH1 0x4 PUSH2 0x4ED2 JUMP JUMPDEST PUSH2 0x1BD4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x605 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x614 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x1C4F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x625 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x634 CALLDATASIZE PUSH1 0x4 PUSH2 0x4F1B JUMP JUMPDEST PUSH2 0x1C5C JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x645 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x654 CALLDATASIZE PUSH1 0x4 PUSH2 0x49FA JUMP JUMPDEST PUSH2 0x1EF5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x665 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x679 PUSH2 0x674 CALLDATASIZE PUSH1 0x4 PUSH2 0x4D09 JUMP JUMPDEST PUSH2 0x2120 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x5C00 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x692 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x6A1 CALLDATASIZE PUSH1 0x4 PUSH2 0x4D09 JUMP JUMPDEST PUSH2 0x221A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6B2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x6C1 CALLDATASIZE PUSH1 0x4 PUSH2 0x4A20 JUMP JUMPDEST PUSH2 0x22B6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6D2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x6DB PUSH2 0x22D3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x24B SWAP2 SWAP1 PUSH2 0x59B4 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x6F4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x703 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B53 JUMP JUMPDEST PUSH2 0x237E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x714 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x723 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x2453 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x734 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x743 CALLDATASIZE PUSH1 0x4 PUSH2 0x4FB4 JUMP JUMPDEST PUSH2 0x2460 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x754 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x763 CALLDATASIZE PUSH1 0x4 PUSH2 0x4E8B JUMP JUMPDEST PUSH2 0x246D JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x774 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x296 PUSH2 0x247F JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x789 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2E3 PUSH2 0x798 CALLDATASIZE PUSH1 0x4 PUSH2 0x4B53 JUMP JUMPDEST PUSH2 0x2485 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x44A PUSH2 0x25F7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7BE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x274 PUSH2 0x7CD CALLDATASIZE PUSH1 0x4 PUSH2 0x49FA JUMP JUMPDEST PUSH2 0x2613 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7DE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x6DB PUSH2 0x26C4 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x26FB JUMP JUMPDEST SWAP1 POP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x80B DUP6 DUP6 DUP6 DUP6 DUP6 PUSH2 0x2780 JUMP JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x282C JUMP JUMPDEST PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH2 0x839 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x844 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x88A JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP8 MLOAD SWAP4 POP SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0x92A JUMPI PUSH2 0x913 DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x8D4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x8EC JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x904 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x288D JUMP JUMPDEST SWAP1 POP PUSH2 0x91F DUP5 DUP3 PUSH2 0x292B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x8BC JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND CALLER EQ PUSH2 0xA01 JUMPI PUSH2 0x9C9 DUP5 DUP5 DUP5 DUP5 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x153E SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0xA01 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A93 JUMP JUMPDEST POP POP PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND DUP5 MSTORE SWAP2 SWAP1 MSTORE SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE JUMP JUMPDEST PUSH2 0xA66 PUSH2 0x45E6 JUMP JUMPDEST PUSH2 0xA6E PUSH2 0x4615 JUMP JUMPDEST PUSH2 0xA76 PUSH2 0x4615 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xAB4 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x160 DUP1 DUP10 ADD MLOAD PUSH2 0x140 DUP1 DUP11 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP10 ADD MLOAD SWAP1 DUP9 ADD MSTORE PUSH2 0xB00 DUP9 PUSH2 0x2120 JUMP JUMPDEST SWAP3 POP PUSH2 0xB0B DUP8 PUSH2 0x2120 JUMP JUMPDEST SWAP2 POP PUSH2 0xB15 PUSH2 0x298D JUMP JUMPDEST SWAP1 POP PUSH2 0xB23 DUP9 DUP5 DUP4 DUP10 PUSH2 0x29BE JUMP JUMPDEST PUSH2 0xB2F DUP8 DUP4 DUP4 DUP9 PUSH2 0x29BE JUMP JUMPDEST PUSH2 0xB39 DUP9 DUP9 PUSH2 0x2B56 JUMP JUMPDEST PUSH2 0xB4D DUP9 DUP9 DUP6 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x2BB6 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP2 ADD MLOAD SWAP1 MLOAD SWAP2 SWAP6 POP PUSH2 0xB68 SWAP2 DUP11 SWAP2 DUP7 SWAP2 DUP2 SWAP1 PUSH2 0x2D3D JUMP JUMPDEST PUSH1 0x20 DUP1 DUP6 ADD MLOAD SWAP1 DUP2 ADD MLOAD SWAP1 MLOAD PUSH2 0xB84 SWAP2 DUP10 SWAP2 DUP6 SWAP2 SWAP1 DUP2 SWAP1 PUSH2 0x2D3D JUMP JUMPDEST PUSH2 0xB9D DUP9 DUP3 DUP6 PUSH1 0x20 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP9 PUSH1 0x0 ADD MLOAD PUSH2 0x2780 JUMP JUMPDEST PUSH2 0xBB6 DUP8 DUP3 DUP5 PUSH1 0x20 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD DUP9 PUSH1 0x20 ADD MLOAD PUSH2 0x2780 JUMP JUMPDEST PUSH2 0xBC2 DUP9 DUP9 DUP4 DUP8 PUSH2 0x2E4F JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0xBFD PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x60 PUSH2 0xC0A DUP6 DUP6 DUP6 PUSH2 0x3027 JUMP JUMPDEST SWAP1 POP PUSH1 0x80 DUP2 DUP3 MLOAD PUSH1 0x20 DUP5 ADD ADDRESS GAS DELEGATECALL DUP1 ISZERO PUSH2 0xC41 JUMPI DUP2 MLOAD DUP4 MSTORE PUSH1 0x20 DUP3 ADD MLOAD PUSH1 0x20 DUP5 ADD MSTORE PUSH1 0x40 DUP3 ADD MLOAD PUSH1 0x40 DUP5 ADD MSTORE PUSH1 0x60 DUP3 ADD MLOAD PUSH1 0x60 DUP5 ADD MSTORE JUMPDEST POP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xCB3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP2 MLOAD SWAP1 JUMPDEST DUP1 DUP3 EQ PUSH2 0xD13 JUMPI PUSH2 0xD0B DUP4 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xCFC JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x31F9 JUMP JUMPDEST PUSH1 0x1 ADD PUSH2 0xCE4 JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP JUMP JUMPDEST PUSH2 0xD48 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xD53 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0xD90 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP8 MLOAD SWAP4 POP SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0x92A JUMPI PUSH2 0xE19 DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xDDA JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xDF2 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xE0A JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x3224 JUMP JUMPDEST SWAP1 POP PUSH2 0xE25 DUP5 DUP3 PUSH2 0x292B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0xDC2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD DUP2 SWAP1 DUP2 SWAP1 DUP2 SWAP1 PUSH1 0xFF AND ISZERO PUSH2 0xE74 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0xEA7 PUSH2 0x298D JUMP JUMPDEST SWAP4 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND CALLER EQ PUSH2 0xECC JUMPI CALLER PUSH2 0xECF JUMP JUMPDEST PUSH1 0x0 JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD SWAP1 SWAP4 POP PUSH1 0x1 DUP7 ADD SWAP3 POP SWAP1 POP DUP1 DUP3 GT PUSH2 0xF46 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B23 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 DUP9 AND DUP1 DUP5 MSTORE SWAP5 SWAP1 SWAP2 MSTORE SWAP1 DUP2 SWAP1 KECCAK256 DUP6 SWAP1 SSTORE MLOAD PUSH32 0x82AF639571738F4EBD4268FB0363D8957EBE1BBB9E78DBA5EBD69EED39B154F0 SWAP1 PUSH2 0xFAE SWAP1 DUP7 SWAP1 PUSH2 0x5909 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP POP POP JUMP JUMPDEST PUSH2 0xFED PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0xFF8 PUSH2 0x45BD JUMP JUMPDEST DUP7 MLOAD SWAP3 POP PUSH1 0x0 SWAP2 POP JUMPDEST DUP2 DUP4 EQ PUSH2 0x106F JUMPI PUSH2 0x1058 DUP8 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1019 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1031 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP8 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1049 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0xBF5 JUMP JUMPDEST SWAP1 POP PUSH2 0x1064 DUP5 DUP3 PUSH2 0x292B JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x1001 JUMP JUMPDEST POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH2 0x10E4 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x1121 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x1157 DUP5 DUP5 DUP5 PUSH2 0x3224 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0x118F PUSH2 0x45BD JUMP JUMPDEST PUSH2 0x1199 DUP4 DUP4 PUSH2 0x292B JUMP JUMPDEST POP DUP2 JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x3277 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x11ED JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x1220 PUSH2 0x298D JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 DUP10 AND DUP1 DUP5 MSTORE SWAP5 SWAP1 SWAP2 MSTORE SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP8 ISZERO ISZERO OR SWAP1 SSTORE MLOAD SWAP3 SWAP4 POP SWAP1 SWAP2 PUSH32 0xA8656E308026EEABCE8F0BC18048433252318AB80AC79DA0B3D3D8697DFBA891 SWAP1 PUSH2 0x12B4 SWAP1 DUP7 SWAP1 PUSH2 0x58FB JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH2 0x1311 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x1320 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x135D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP10 MLOAD DUP11 SWAP2 SWAP1 DUP2 LT PUSH2 0x1395 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD MLOAD SWAP5 POP DUP9 MLOAD SWAP4 POP PUSH1 0x0 SWAP3 POP JUMPDEST DUP3 DUP5 EQ PUSH2 0x1438 JUMPI DUP5 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x13C5 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD DUP2 SWAP1 MSTORE POP PUSH2 0x13E5 DUP9 DUP8 PUSH1 0x20 ADD MLOAD PUSH2 0x32FC JUMP JUMPDEST SWAP2 POP PUSH2 0x1411 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x13F8 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP10 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x904 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x141D DUP7 DUP3 PUSH2 0x292B JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD DUP9 GT PUSH2 0x142D JUMPI PUSH2 0x1438 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x13AF JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP2 SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH1 0x60 PUSH1 0x0 DUP5 MLOAD SWAP3 POP DUP3 PUSH1 0x40 MLOAD SWAP1 DUP1 DUP3 MSTORE DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD DUP3 ADD PUSH1 0x40 MSTORE DUP1 ISZERO PUSH2 0x14B3 JUMPI DUP2 PUSH1 0x20 ADD JUMPDEST PUSH2 0x14A0 PUSH2 0x4615 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 SWAP1 SUB SWAP1 DUP2 PUSH2 0x1498 JUMPI SWAP1 POP JUMPDEST POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP1 DUP4 EQ PUSH2 0xC43 JUMPI PUSH2 0x14E2 DUP6 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x14D3 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x2120 JUMP JUMPDEST DUP3 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x14F0 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x14BB JUMP JUMPDEST PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP10 MLOAD GT ISZERO ISZERO PUSH2 0x1587 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B13 JUMP JUMPDEST PUSH2 0x1590 DUP10 PUSH2 0x333E JUMP JUMPDEST PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DIV SWAP7 POP PUSH1 0x7 PUSH1 0xFF DUP9 AND LT PUSH2 0x15F2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A33 JUMP JUMPDEST DUP7 PUSH1 0xFF AND PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1601 JUMPI INVALID JUMPDEST SWAP6 POP PUSH1 0x0 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1611 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1649 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B03 JUMP JUMPDEST PUSH1 0x1 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1657 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x169F JUMPI DUP9 MLOAD ISZERO PUSH2 0x1696 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5BD3 JUMP JUMPDEST PUSH1 0x0 SWAP8 POP PUSH2 0x1AB3 JUMP JUMPDEST PUSH1 0x2 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x16AD JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x17E8 JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0x16EE JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x59D3 JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x16FD JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0x173D DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x3402 AND JUMP JUMPDEST SWAP4 POP PUSH2 0x1750 DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x3402 AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD PUSH2 0x1775 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x5964 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 PUSH1 0x0 DUP7 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1799 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP13 DUP2 AND SWAP1 DUP3 AND EQ SWAP10 POP SWAP3 POP PUSH2 0x1AB3 SWAP1 POP JUMP JUMPDEST PUSH1 0x3 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x17F6 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x199C JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0x1837 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x59D3 JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1846 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0x1886 DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x3402 AND JUMP JUMPDEST SWAP4 POP PUSH2 0x1899 DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x3402 AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 PUSH1 0x40 MLOAD PUSH1 0x20 ADD DUP1 DUP1 PUSH32 0x19457468657265756D205369676E6564204D6573736167653A0A333200000000 DUP2 MSTORE POP PUSH1 0x1C ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x193A JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x18FD JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 PUSH1 0x0 DUP4 MSTORE SWAP2 ADD SWAP3 DUP4 SWAP1 MSTORE PUSH2 0x1775 SWAP5 POP SWAP3 POP DUP10 SWAP2 DUP10 SWAP2 POP DUP9 SWAP1 PUSH2 0x5964 JUMP JUMPDEST PUSH1 0x4 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x19AA JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x19C2 JUMPI PUSH2 0x19BB DUP12 DUP12 DUP12 PUSH2 0x344D JUMP JUMPDEST SWAP8 POP PUSH2 0x1AB3 JUMP JUMPDEST PUSH1 0x5 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x19D0 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1A33 JUMPI PUSH2 0x19DF DUP10 PUSH2 0x35A2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP13 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x8 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1A27 JUMPI PUSH1 0x0 SWAP8 POP PUSH2 0x1AB3 JUMP JUMPDEST PUSH2 0x19BB DUP2 DUP13 DUP13 DUP13 PUSH2 0x361B JUMP JUMPDEST PUSH1 0x6 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x1A41 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x1A81 JUMPI PUSH1 0x0 DUP12 DUP2 MSTORE PUSH1 0x7 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP15 AND DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND SWAP8 POP PUSH2 0x1AB3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A33 JUMP JUMPDEST POP POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x1AC9 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x1AD9 PUSH2 0x45BD JUMP JUMPDEST DUP10 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1AE8 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x140 ADD MLOAD SWAP6 POP DUP10 MLOAD SWAP5 POP PUSH1 0x0 SWAP4 POP JUMPDEST DUP4 DUP6 EQ PUSH2 0x1BC7 JUMPI DUP6 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1B18 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP7 MLOAD PUSH2 0x1B34 SWAP1 DUP11 SWAP1 PUSH2 0x32FC JUMP JUMPDEST SWAP3 POP PUSH2 0x1B77 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1B47 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0xA0 ADD MLOAD DUP12 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1B63 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH1 0x80 ADD MLOAD DUP6 PUSH2 0x3777 JUMP JUMPDEST SWAP2 POP PUSH2 0x1BA3 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1B8A JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP11 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1049 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x1BAF DUP8 DUP3 PUSH2 0x292B JUMP JUMPDEST DUP7 MLOAD DUP10 GT PUSH2 0x1BBC JUMPI PUSH2 0x1BC7 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP4 ADD SWAP3 PUSH2 0x1B02 JUMP JUMPDEST POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x1BDC PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x1C19 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x1157 DUP5 DUP5 DUP5 PUSH2 0x288D JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x3777 JUMP JUMPDEST PUSH1 0xA SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x1CAF JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH2 0x1CF2 PUSH2 0x1CED DUP9 DUP9 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x37BF SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x3A00 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO PUSH2 0x1D3E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A83 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x1E0F JUMPI PUSH2 0x1D96 DUP2 DUP8 DUP6 DUP6 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x153E SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0x1DCE JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5BC3 JUMP JUMPDEST PUSH1 0xA DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND OR SWAP1 SSTORE JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x9 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE MLOAD ADDRESS SWAP1 DUP7 SWAP1 DUP7 SWAP1 DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 GAS DELEGATECALL SWAP2 POP POP ISZERO ISZERO PUSH2 0x1EA6 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AB3 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x1EEC JUMPI PUSH1 0xA DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x0 SWAP1 DUP2 SWAP1 DUP2 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x1F4D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B73 JUMP JUMPDEST DUP4 SWAP3 POP DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xAE25532E PUSH1 0x40 MLOAD DUP2 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1FB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1FC8 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP PUSH2 0x1FEC SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x4CBA JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP DUP1 ISZERO PUSH2 0x2071 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A13 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0xB PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND OR SWAP1 SSTORE MLOAD PUSH32 0xD2C6B762299C609BDB96520B58A49BFB80186934D4F71A86A367571A15C03194 SWAP1 PUSH2 0x2112 SWAP1 DUP5 SWAP1 DUP8 SWAP1 PUSH2 0x5999 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 POP POP POP POP JUMP JUMPDEST PUSH2 0x2128 PUSH2 0x4615 JUMP JUMPDEST PUSH2 0x2131 DUP3 PUSH2 0x3A3D JUMP JUMPDEST PUSH1 0x20 DUP1 DUP4 ADD DUP3 SWAP1 MSTORE PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x4 SWAP1 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 SLOAD SWAP1 DUP3 ADD MSTORE PUSH1 0x80 DUP3 ADD MLOAD ISZERO ISZERO PUSH2 0x2165 JUMPI PUSH1 0x1 JUMPDEST PUSH1 0xFF AND DUP2 MSTORE PUSH2 0x10C2 JUMP JUMPDEST PUSH1 0xA0 DUP3 ADD MLOAD ISZERO ISZERO PUSH2 0x2177 JUMPI PUSH1 0x2 PUSH2 0x215B JUMP JUMPDEST PUSH1 0xA0 DUP3 ADD MLOAD PUSH1 0x40 DUP3 ADD MLOAD LT PUSH2 0x218D JUMPI PUSH1 0x5 PUSH2 0x215B JUMP JUMPDEST PUSH2 0x100 DUP3 ADD MLOAD TIMESTAMP LT PUSH2 0x21A0 JUMPI PUSH1 0x4 PUSH2 0x215B JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 ADD MLOAD PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x5 SWAP1 SWAP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x21C4 JUMPI PUSH1 0x6 PUSH2 0x215B JUMP JUMPDEST PUSH2 0x120 DUP3 ADD MLOAD DUP3 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH1 0x60 DUP9 ADD MLOAD SWAP1 SWAP5 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD GT ISZERO PUSH2 0x2211 JUMPI PUSH1 0x6 PUSH2 0x215B JUMP JUMPDEST PUSH1 0x3 DUP2 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x2257 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x228B DUP2 PUSH2 0x31F9 JUMP JUMPDEST POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x6 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 DUP5 DUP7 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x2376 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x234B JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2376 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2359 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST PUSH2 0x2386 PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x2395 PUSH2 0x45BD JUMP JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x23A4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD MLOAD SWAP5 POP DUP9 MLOAD SWAP4 POP PUSH1 0x0 SWAP3 POP JUMPDEST DUP3 DUP5 EQ PUSH2 0x2447 JUMPI DUP5 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x23D4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x160 ADD DUP2 SWAP1 MSTORE POP PUSH2 0x23F4 DUP9 DUP8 PUSH1 0x20 ADD MLOAD PUSH2 0x32FC JUMP JUMPDEST SWAP2 POP PUSH2 0x2420 DUP10 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2407 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP10 DUP7 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1049 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x242C DUP7 DUP3 PUSH2 0x292B JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD DUP9 GT PUSH2 0x243C JUMPI PUSH2 0x2447 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP3 ADD SWAP2 PUSH2 0x23BE JUMP JUMPDEST POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x3A4B JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F4 DUP5 DUP5 DUP5 PUSH2 0x3AC8 JUMP JUMPDEST PUSH2 0x2475 PUSH2 0x45BD JUMP JUMPDEST PUSH2 0x7F7 DUP4 DUP4 PUSH2 0x3B45 JUMP JUMPDEST PUSH1 0x2 SLOAD DUP2 JUMP JUMPDEST PUSH2 0x248D PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x249D PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x24DA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B63 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR DUP2 SSTORE DUP11 MLOAD DUP12 SWAP2 SWAP1 DUP2 LT PUSH2 0x2512 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x140 ADD MLOAD SWAP6 POP DUP10 MLOAD SWAP5 POP PUSH1 0x0 SWAP4 POP JUMPDEST DUP4 DUP6 EQ PUSH2 0x25C1 JUMPI DUP6 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2542 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MLOAD PUSH2 0x140 ADD MSTORE DUP7 MLOAD PUSH2 0x255E SWAP1 DUP11 SWAP1 PUSH2 0x32FC JUMP JUMPDEST SWAP3 POP PUSH2 0x2571 DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1B47 JUMPI INVALID JUMPDEST SWAP2 POP PUSH2 0x259D DUP11 DUP6 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x2584 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP4 DUP11 DUP8 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x904 JUMPI INVALID JUMPDEST SWAP1 POP PUSH2 0x25A9 DUP8 DUP3 PUSH2 0x292B JUMP JUMPDEST DUP7 MLOAD DUP10 GT PUSH2 0x25B6 JUMPI PUSH2 0x25C1 JUMP JUMPDEST PUSH1 0x1 SWAP1 SWAP4 ADD SWAP3 PUSH2 0x252C JUMP JUMPDEST POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP SWAP3 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0xA SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x3 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x2664 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B73 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x26C1 JUMPI PUSH1 0x3 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0xB DUP2 MSTORE PUSH32 0x322E302E312D616C706861000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x2737 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x2742 JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x2750 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0xC43 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x275A JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP PUSH2 0x2769 DUP6 DUP5 PUSH2 0x3BA6 JUMP JUMPDEST PUSH2 0x2775 PUSH2 0x3E8 DUP4 PUSH2 0x3BA6 JUMP JUMPDEST LT ISZERO SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x278E DUP3 DUP3 PUSH1 0x20 ADD MLOAD PUSH2 0x3C0C JUMP JUMPDEST PUSH1 0x0 DUP5 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 SWAP3 SWAP1 SWAP3 SSTORE DUP7 DUP2 ADD MLOAD DUP8 MLOAD DUP5 MLOAD SWAP4 DUP6 ADD MLOAD DUP6 DUP5 ADD MLOAD PUSH1 0x60 DUP8 ADD MLOAD PUSH2 0x140 DUP13 ADD MLOAD PUSH2 0x160 DUP14 ADD MLOAD SWAP7 MLOAD DUP12 SWAP9 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 DUP9 AND SWAP9 SWAP8 SWAP1 SWAP7 AND SWAP7 PUSH32 0xBCC4C97732E47D9946F229EDB95F5B6323F601300E4690DE719993F3C371129 SWAP7 PUSH2 0x281D SWAP7 DUP16 SWAP7 CALLER SWAP7 SWAP3 SWAP6 SWAP2 SWAP5 SWAP1 SWAP4 SWAP1 PUSH2 0x5829 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x2867 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST PUSH2 0x7F4 PUSH2 0x2887 PUSH2 0x2877 DUP7 DUP6 PUSH2 0x3BA6 JUMP JUMPDEST PUSH2 0x2882 DUP7 PUSH1 0x1 PUSH2 0x32FC JUMP JUMPDEST PUSH2 0x3C0C JUMP JUMPDEST DUP5 PUSH2 0x3C4B JUMP JUMPDEST PUSH2 0x2895 PUSH2 0x45BD JUMP JUMPDEST PUSH2 0x289D PUSH2 0x4615 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x28AB DUP9 PUSH2 0x2120 JUMP JUMPDEST SWAP4 POP PUSH2 0x28B5 PUSH2 0x298D JUMP JUMPDEST SWAP3 POP PUSH2 0x28C3 DUP9 DUP6 DUP6 DUP10 PUSH2 0x29BE JUMP JUMPDEST PUSH2 0x28D5 DUP9 PUSH1 0xA0 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x32FC JUMP JUMPDEST SWAP2 POP PUSH2 0x28E1 DUP8 DUP4 PUSH2 0x3C62 JUMP JUMPDEST SWAP1 POP PUSH2 0x28F4 DUP9 DUP6 DUP10 DUP5 DUP10 PUSH1 0x0 ADD MLOAD PUSH2 0x2D3D JUMP JUMPDEST PUSH2 0x28FE DUP9 DUP3 PUSH2 0x3B45 JUMP JUMPDEST SWAP5 POP PUSH2 0x2915 DUP9 DUP5 DUP7 PUSH1 0x20 ADD MLOAD DUP8 PUSH1 0x40 ADD MLOAD DUP10 PUSH2 0x2780 JUMP JUMPDEST PUSH2 0x2920 DUP9 DUP5 DUP8 PUSH2 0x3C71 JUMP JUMPDEST POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP2 MLOAD DUP2 MLOAD PUSH2 0x2939 SWAP2 SWAP1 PUSH2 0x3C0C JUMP JUMPDEST DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x294F SWAP2 SWAP1 PUSH2 0x3C0C JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE PUSH1 0x40 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x2968 SWAP2 SWAP1 PUSH2 0x3C0C JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE PUSH1 0x60 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x2981 SWAP2 SWAP1 PUSH2 0x3C0C JUMP JUMPDEST PUSH1 0x60 SWAP1 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP JUMP JUMPDEST PUSH1 0xA SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 DUP2 ISZERO PUSH2 0x29B6 JUMPI DUP2 PUSH2 0x7F7 JUMP JUMPDEST CALLER SWAP4 SWAP3 POP POP POP JUMP JUMPDEST DUP3 MLOAD PUSH1 0xFF AND PUSH1 0x3 EQ PUSH2 0x29FC JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B93 JUMP JUMPDEST PUSH1 0x60 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x2A6F JUMPI PUSH1 0x60 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x2A6F JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5BA3 JUMP JUMPDEST PUSH1 0x20 DUP5 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x2AFA JUMPI DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP5 PUSH1 0x20 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO ISZERO PUSH2 0x2AFA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x59E3 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MLOAD ISZERO ISZERO PUSH2 0x2B50 JUMPI PUSH2 0x2B18 DUP4 PUSH1 0x20 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD DUP4 PUSH2 0x153E JUMP JUMPDEST ISZERO ISZERO PUSH2 0x2B50 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A53 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH2 0x2B68 DUP3 PUSH1 0xA0 ADD MLOAD DUP3 PUSH1 0xA0 ADD MLOAD PUSH2 0x3BA6 JUMP JUMPDEST PUSH2 0x2B7A DUP4 PUSH1 0x80 ADD MLOAD DUP4 PUSH1 0x80 ADD MLOAD PUSH2 0x3BA6 JUMP JUMPDEST LT ISZERO PUSH2 0x2BB2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5BB3 JUMP JUMPDEST POP POP JUMP JUMPDEST PUSH2 0x2BBE PUSH2 0x45E6 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH2 0x2BD2 DUP10 PUSH1 0xA0 ADD MLOAD DUP9 PUSH2 0x32FC JUMP JUMPDEST SWAP4 POP PUSH2 0x2BE7 DUP10 PUSH1 0x80 ADD MLOAD DUP11 PUSH1 0xA0 ADD MLOAD DUP7 PUSH2 0x3A4B JUMP JUMPDEST SWAP3 POP PUSH2 0x2BF7 DUP9 PUSH1 0xA0 ADD MLOAD DUP8 PUSH2 0x32FC JUMP JUMPDEST SWAP2 POP PUSH2 0x2C0C DUP9 PUSH1 0x80 ADD MLOAD DUP10 PUSH1 0xA0 ADD MLOAD DUP5 PUSH2 0x3A4B JUMP JUMPDEST SWAP1 POP DUP1 DUP5 LT PUSH2 0x2C4F JUMPI PUSH1 0x20 DUP1 DUP7 ADD DUP1 MLOAD DUP4 SWAP1 MSTORE DUP1 MLOAD DUP3 ADD DUP5 SWAP1 MSTORE MLOAD MLOAD DUP7 MLOAD DUP3 ADD MSTORE PUSH1 0x80 DUP11 ADD MLOAD PUSH1 0xA0 DUP12 ADD MLOAD DUP8 MLOAD SWAP1 SWAP3 ADD MLOAD PUSH2 0x2C47 SWAP3 SWAP1 PUSH2 0x3A4B JUMP JUMPDEST DUP6 MLOAD MSTORE PUSH2 0x2C8C JUMP JUMPDEST DUP5 MLOAD DUP4 SWAP1 MSTORE DUP5 MLOAD PUSH1 0x20 SWAP1 DUP2 ADD DUP6 SWAP1 MSTORE DUP6 MLOAD DUP2 ADD MLOAD SWAP1 DUP7 ADD DUP1 MLOAD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0xA0 DUP10 ADD MLOAD PUSH1 0x80 DUP11 ADD MLOAD SWAP2 MLOAD MLOAD PUSH2 0x2C83 SWAP3 SWAP1 PUSH2 0x3AC8 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP8 ADD MLOAD ADD MSTORE JUMPDEST DUP5 MLOAD MLOAD PUSH1 0x20 DUP1 DUP8 ADD MLOAD ADD MLOAD PUSH2 0x2CA1 SWAP2 SWAP1 PUSH2 0x32FC JUMP JUMPDEST PUSH1 0x40 DUP7 ADD MSTORE DUP5 MLOAD MLOAD PUSH1 0x80 DUP11 ADD MLOAD PUSH1 0xC0 DUP12 ADD MLOAD PUSH2 0x2CBE SWAP3 SWAP2 SWAP1 PUSH2 0x3A4B JUMP JUMPDEST DUP6 MLOAD PUSH1 0x40 ADD MSTORE DUP5 MLOAD PUSH1 0x20 ADD MLOAD PUSH1 0xA0 DUP11 ADD MLOAD PUSH1 0xE0 DUP12 ADD MLOAD PUSH2 0x2CDF SWAP3 SWAP2 SWAP1 PUSH2 0x3A4B JUMP JUMPDEST DUP6 MLOAD PUSH1 0x60 ADD MSTORE PUSH1 0x20 DUP6 ADD MLOAD MLOAD PUSH1 0x80 DUP10 ADD MLOAD PUSH1 0xC0 DUP11 ADD MLOAD PUSH2 0x2D00 SWAP3 SWAP2 SWAP1 PUSH2 0x3A4B JUMP JUMPDEST DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x40 ADD DUP2 DUP2 MSTORE POP POP PUSH2 0x2D28 DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x20 ADD MLOAD DUP10 PUSH1 0xA0 ADD MLOAD DUP11 PUSH1 0xE0 ADD MLOAD PUSH2 0x3A4B JUMP JUMPDEST PUSH1 0x20 DUP7 ADD MLOAD PUSH1 0x60 ADD MSTORE POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP3 ISZERO ISZERO PUSH2 0x2D76 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AD3 JUMP JUMPDEST DUP3 DUP3 GT ISZERO PUSH2 0x2DB0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AC3 JUMP JUMPDEST DUP5 PUSH1 0xA0 ADD MLOAD PUSH2 0x2DC3 DUP6 PUSH1 0x40 ADD MLOAD DUP5 PUSH2 0x3C0C JUMP JUMPDEST GT ISZERO PUSH2 0x2DFB JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x59F3 JUMP JUMPDEST PUSH2 0x2E09 DUP6 PUSH1 0x80 ADD MLOAD DUP4 PUSH2 0x3BA6 JUMP JUMPDEST PUSH2 0x2E17 DUP3 DUP8 PUSH1 0xA0 ADD MLOAD PUSH2 0x3BA6 JUMP JUMPDEST GT ISZERO PUSH2 0x80B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B53 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x2EF8 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x2ECD JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x2EF8 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x2EDB JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x2F20 DUP6 PUSH2 0x140 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x20 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x140 DUP5 ADD MLOAD DUP5 MLOAD DUP7 MLOAD DUP5 MLOAD PUSH1 0x20 ADD MLOAD PUSH2 0x2F3C SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x2F55 DUP6 PUSH2 0x140 ADD MLOAD DUP7 PUSH1 0x0 ADD MLOAD DUP6 DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x2F71 DUP2 DUP7 PUSH1 0x0 ADD MLOAD DUP8 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD PUSH1 0x40 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x2F8D DUP2 DUP6 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x40 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST DUP4 PUSH1 0x40 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH1 0x40 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0x2FF7 JUMPI PUSH2 0x2FF2 DUP2 DUP5 DUP8 PUSH1 0x40 ADD MLOAD PUSH2 0x2FED DUP7 PUSH1 0x0 ADD MLOAD PUSH1 0x60 ADD MLOAD DUP8 PUSH1 0x20 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3C0C JUMP JUMPDEST PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x80B JUMP JUMPDEST PUSH2 0x300F DUP2 DUP5 DUP8 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x80B DUP2 DUP5 DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH1 0x60 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x60 PUSH1 0x24 DUP4 ADD DUP2 DUP2 MSTORE DUP8 MLOAD PUSH1 0x84 DUP6 ADD SWAP1 DUP2 MSTORE DUP9 DUP5 ADD MLOAD PUSH1 0xA4 DUP7 ADD MSTORE SWAP5 DUP9 ADD MLOAD PUSH1 0xC4 DUP6 ADD MSTORE SWAP1 DUP8 ADD MLOAD PUSH1 0xE4 DUP5 ADD MSTORE PUSH1 0x80 DUP8 ADD MLOAD PUSH2 0x104 DUP5 ADD MSTORE PUSH1 0xA0 DUP8 ADD MLOAD PUSH2 0x124 DUP5 ADD MSTORE PUSH1 0xC0 DUP8 ADD MLOAD PUSH2 0x144 DUP5 ADD MSTORE PUSH1 0xE0 DUP8 ADD MLOAD PUSH2 0x164 DUP5 ADD MSTORE PUSH2 0x100 DUP8 ADD MLOAD PUSH2 0x184 DUP5 ADD MSTORE PUSH2 0x120 DUP8 ADD MLOAD PUSH2 0x1A4 DUP5 ADD MSTORE PUSH2 0x140 DUP8 ADD DUP1 MLOAD PUSH2 0x1C4 DUP6 ADD SWAP1 DUP2 MSTORE PUSH2 0x160 DUP10 ADD MLOAD PUSH2 0x1E4 DUP7 ADD MSTORE PUSH2 0x180 SWAP1 MSTORE MLOAD DUP1 MLOAD PUSH2 0x204 DUP6 ADD DUP2 SWAP1 MSTORE SWAP4 SWAP5 SWAP2 SWAP4 DUP5 SWAP4 PUSH1 0x44 DUP8 ADD SWAP3 DUP5 SWAP3 PUSH2 0x224 DUP10 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x312E JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x3110 JUMP JUMPDEST POP POP POP POP DUP2 DUP2 SUB PUSH2 0x160 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP11 ADD MLOAD DUP1 MLOAD DUP1 DUP4 MSTORE PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x3177 JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x3159 JUMP JUMPDEST POP POP POP DUP10 DUP5 MSTORE POP DUP5 DUP2 SUB PUSH1 0x20 SWAP4 DUP5 ADD SWAP1 DUP2 MSTORE DUP9 MLOAD DUP1 DUP4 MSTORE SWAP1 SWAP4 SWAP2 DUP3 ADD SWAP2 DUP10 DUP2 ADD SWAP2 SWAP1 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x31BF JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x31A1 JUMP JUMPDEST POP POP POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP9 DUP4 SUB ADD DUP9 MSTORE POP PUSH1 0x40 MSTORE POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x3201 PUSH2 0x4615 JUMP JUMPDEST PUSH2 0x320A DUP3 PUSH2 0x2120 JUMP JUMPDEST SWAP1 POP PUSH2 0x3216 DUP3 DUP3 PUSH2 0x3F45 JUMP JUMPDEST PUSH2 0x2BB2 DUP3 DUP3 PUSH1 0x20 ADD MLOAD PUSH2 0x405C JUMP JUMPDEST PUSH2 0x322C PUSH2 0x45BD JUMP JUMPDEST PUSH2 0x3237 DUP5 DUP5 DUP5 PUSH2 0x288D JUMP JUMPDEST PUSH1 0x20 DUP2 ADD MLOAD SWAP1 SWAP2 POP DUP4 EQ PUSH2 0x7F7 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B43 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x32B3 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x32BE JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x32CC JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0xC43 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x32D6 JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP DUP4 PUSH2 0x32E6 DUP6 DUP4 PUSH2 0x32FC JUMP JUMPDEST DUP2 ISZERO ISZERO PUSH2 0x32EF JUMPI INVALID JUMPDEST MOD SWAP1 POP PUSH2 0x2769 DUP6 DUP5 PUSH2 0x3BA6 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0x3338 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A03 JUMP JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 MLOAD GT ISZERO ISZERO PUSH2 0x337C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AF3 JUMP JUMPDEST DUP2 MLOAD DUP3 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x33AC JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP3 MSTORE POP PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV MUL SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x3444 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A23 JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x0 SWAP1 PUSH1 0x60 SWAP1 PUSH32 0x1626BA7E00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x3488 SWAP1 DUP8 SWAP1 DUP7 SWAP1 PUSH1 0x24 ADD PUSH2 0x5944 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 MSTORE DUP2 MLOAD SWAP2 SWAP4 POP SWAP1 DUP3 SWAP1 DUP2 DUP9 GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x3525 JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x3596 JUMPI PUSH2 0x2920 JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xC57414C4C45545F4552524F5200000000000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST POP POP MLOAD SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x14 DUP3 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x35E2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B83 JUMP JUMPDEST PUSH2 0x35F0 DUP3 PUSH1 0x14 DUP5 MLOAD SUB PUSH2 0x4103 JUMP JUMPDEST DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC ADD SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x0 SWAP1 PUSH1 0x60 SWAP1 PUSH32 0x9363470200000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x3658 SWAP1 DUP8 SWAP1 DUP8 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0x5917 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR DUP4 MSTORE DUP2 MLOAD SWAP2 SWAP4 POP SWAP1 DUP3 SWAP1 DUP2 DUP11 GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x36F5 JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x3766 JUMPI PUSH2 0x376B JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xF56414C494441544F525F4552524F5200000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD SWAP5 POP JUMPDEST POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x37B2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST PUSH2 0x7F4 PUSH2 0x2887 DUP6 DUP5 PUSH2 0x3BA6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x5A65726F45785472616E73616374696F6E280000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0x32 DUP4 ADD MSTORE PUSH32 0x61646472657373207369676E6572416464726573732C00000000000000000000 PUSH1 0x3F DUP4 ADD MSTORE PUSH32 0x6279746573206461746100000000000000000000000000000000000000000000 PUSH1 0x55 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0x5F DUP4 ADD MSTORE DUP3 MLOAD DUP1 DUP4 SUB DUP5 ADD DUP2 MSTORE PUSH1 0x60 SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP1 SWAP3 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x38E8 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x38AB JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP10 MLOAD SWAP1 SWAP8 POP DUP10 SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x397E JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x3941 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 SWAP8 DUP3 MSTORE DUP2 ADD SWAP11 SWAP1 SWAP11 MSTORE POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 SWAP1 SWAP8 AND SWAP7 DUP9 ADD SWAP7 SWAP1 SWAP7 MSTORE POP POP PUSH1 0x60 DUP6 ADD MSTORE POP POP PUSH1 0x80 SWAP1 SWAP2 KECCAK256 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x2 DUP1 SLOAD PUSH1 0x40 MLOAD PUSH32 0x1901000000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP2 DUP3 ADD MSTORE PUSH1 0x22 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x119C PUSH2 0x1CED DUP4 PUSH2 0x4164 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x3A86 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST PUSH2 0x3A91 DUP5 DUP5 DUP5 PUSH2 0x26FB JUMP JUMPDEST ISZERO PUSH2 0x37B2 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AA3 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x3B03 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A43 JUMP JUMPDEST PUSH2 0x3B0E DUP5 DUP5 DUP5 PUSH2 0x3277 JUMP JUMPDEST ISZERO PUSH2 0x2867 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AA3 JUMP JUMPDEST PUSH2 0x3B4D PUSH2 0x45BD JUMP JUMPDEST PUSH1 0x20 DUP2 ADD DUP3 SWAP1 MSTORE PUSH1 0xA0 DUP4 ADD MLOAD PUSH1 0x80 DUP5 ADD MLOAD PUSH2 0x3B69 SWAP2 DUP5 SWAP2 PUSH2 0x3A4B JUMP JUMPDEST DUP1 DUP3 MSTORE PUSH1 0x80 DUP5 ADD MLOAD PUSH1 0xC0 DUP6 ADD MLOAD PUSH2 0x3B81 SWAP3 SWAP2 SWAP1 PUSH2 0x3A4B JUMP JUMPDEST PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0xA0 DUP4 ADD MLOAD PUSH1 0xE0 DUP5 ADD MLOAD PUSH2 0x3B9B SWAP2 DUP5 SWAP2 PUSH2 0x3A4B JUMP JUMPDEST PUSH1 0x60 DUP3 ADD MSTORE SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 ISZERO ISZERO PUSH2 0x3BB9 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x3C05 JUMP JUMPDEST POP DUP3 DUP3 MUL DUP3 DUP5 DUP3 DUP2 ISZERO ISZERO PUSH2 0x3BC9 JUMPI INVALID JUMPDEST DIV EQ PUSH2 0x3C01 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A73 JUMP JUMPDEST DUP1 SWAP2 POP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0x3C01 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A73 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 DUP5 DUP2 ISZERO ISZERO PUSH2 0x3C59 JUMPI INVALID JUMPDEST DIV SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP4 LT PUSH2 0x1199 JUMPI DUP2 PUSH2 0x7F7 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F PUSH1 0x2 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH2 0x100 DUP8 DUP10 AND ISZERO MUL ADD SWAP1 SWAP6 AND SWAP5 SWAP1 SWAP5 DIV SWAP4 DUP5 ADD DUP2 SWAP1 DIV DUP2 MUL DUP3 ADD DUP2 ADD SWAP1 SWAP3 MSTORE DUP3 DUP2 MSTORE PUSH1 0x60 SWAP4 SWAP1 SWAP3 SWAP1 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x3D1A JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x3CEF JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x3D1A JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x3CFD JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0x3D3A DUP5 PUSH2 0x140 ADD MLOAD DUP6 PUSH1 0x0 ADD MLOAD DUP6 DUP6 PUSH1 0x0 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x3D53 DUP5 PUSH2 0x160 ADD MLOAD DUP5 DUP7 PUSH1 0x0 ADD MLOAD DUP6 PUSH1 0x20 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x3D6B DUP2 DUP6 PUSH1 0x0 ADD MLOAD DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x40 ADD MLOAD PUSH2 0x3D7B JUMP JUMPDEST PUSH2 0x2B50 DUP2 DUP5 DUP7 PUSH1 0x40 ADD MLOAD DUP6 PUSH1 0x60 ADD MLOAD JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP4 GT DUP1 ISZERO PUSH2 0x3DBA JUMPI POP DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO JUMPDEST ISZERO PUSH2 0x3F3D JUMPI DUP6 MLOAD PUSH1 0x3 LT PUSH2 0x3DFA JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B33 JUMP JUMPDEST POP POP PUSH1 0x20 DUP5 DUP2 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0xB SWAP1 SWAP3 MSTORE PUSH1 0x40 SWAP1 SWAP2 KECCAK256 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP1 ISZERO ISZERO PUSH2 0x3E83 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5AE3 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH7 0xFFFFFFFFFFFE0 PUSH1 0x3F DUP9 MLOAD ADD AND DUP1 PUSH1 0x84 ADD DUP3 ADD PUSH32 0xA85E59E400000000000000000000000000000000000000000000000000000000 DUP4 MSTORE PUSH1 0x80 PUSH1 0x4 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND PUSH1 0x24 DUP5 ADD MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND PUSH1 0x44 DUP5 ADD MSTORE DUP6 PUSH1 0x64 DUP5 ADD MSTORE PUSH1 0x84 DUP4 ADD JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x3F1F JUMPI DUP10 MLOAD DUP2 MSTORE PUSH1 0x20 SWAP10 DUP11 ADD SWAP10 ADD PUSH2 0x3F07 JUMP JUMPDEST PUSH2 0x200 DUP5 DUP6 DUP5 SUB DUP7 PUSH1 0x0 DUP10 GAS CALL DUP1 ISZERO ISZERO PUSH2 0x3F37 JUMPI RETURNDATASIZE DUP6 REVERT JUMPDEST POP POP POP POP POP JUMPDEST POP POP POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH1 0xFF AND PUSH1 0x3 EQ PUSH2 0x3F86 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B93 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0x3FF9 JUMPI PUSH1 0x60 DUP4 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x3FF9 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5BA3 JUMP JUMPDEST PUSH2 0x4001 PUSH2 0x298D JUMP JUMPDEST DUP4 MLOAD SWAP1 SWAP2 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP4 AND SWAP2 AND EQ PUSH2 0x4057 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5A63 JUMP JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x5 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE DUP3 DUP2 ADD MLOAD DUP4 MLOAD PUSH2 0x140 DUP6 ADD MLOAD PUSH2 0x160 DUP7 ADD MLOAD SWAP4 MLOAD DUP6 SWAP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP5 DUP6 AND SWAP5 SWAP4 SWAP1 SWAP4 AND SWAP3 PUSH32 0xDC47B3613D9FE400085F6DBDC99453462279057E6207385042827ED6B1A62CF7 SWAP3 PUSH2 0x40F7 SWAP3 CALLER SWAP3 SWAP1 PUSH2 0x58AD JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG4 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x4145 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x881 SWAP1 PUSH2 0x5B83 JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4F72646572280000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x61646472657373206D616B6572416464726573732C0000000000000000000000 PUSH1 0x26 DUP4 ADD MSTORE PUSH32 0x616464726573732074616B6572416464726573732C0000000000000000000000 PUSH1 0x3B DUP4 ADD MSTORE PUSH32 0x6164647265737320666565526563697069656E74416464726573732C00000000 PUSH1 0x50 DUP4 ADD MSTORE PUSH32 0x616464726573732073656E646572416464726573732C00000000000000000000 PUSH1 0x6C DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724173736574416D6F756E742C00000000000000 PUSH1 0x82 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724173736574416D6F756E742C00000000000000 PUSH1 0x9B DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724665652C000000000000000000000000000000 PUSH1 0xB4 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724665652C000000000000000000000000000000 PUSH1 0xC5 DUP4 ADD MSTORE PUSH32 0x75696E743235362065787069726174696F6E54696D655365636F6E64732C0000 PUSH1 0xD6 DUP4 ADD MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0xF4 DUP4 ADD MSTORE PUSH32 0x6279746573206D616B65724173736574446174612C0000000000000000000000 PUSH2 0x101 DUP4 ADD MSTORE PUSH32 0x62797465732074616B6572417373657444617461000000000000000000000000 PUSH2 0x116 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH2 0x12A DUP4 ADD MSTORE DUP3 MLOAD PUSH2 0x10B DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH2 0x12B SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP2 SWAP3 SWAP2 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x43EC JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x43AF JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x140 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP10 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x4487 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x444A JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x160 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP9 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x4522 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x44E5 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 SWAP1 SWAP4 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP2 AND SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP1 SWAP2 KECCAK256 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP10 ADD DUP1 MLOAD PUSH2 0x140 DUP12 ADD DUP1 MLOAD PUSH2 0x160 SWAP1 SWAP13 ADD DUP1 MLOAD SWAP11 DUP5 MSTORE SWAP9 DUP2 MSTORE SWAP3 DUP9 MSTORE PUSH2 0x1A0 DUP3 KECCAK256 SWAP2 MSTORE SWAP9 SWAP1 MSTORE POP POP POP SWAP2 SWAP1 MSTORE POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x80 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH2 0x120 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH2 0x45FB PUSH2 0x45BD JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH2 0x4608 PUSH2 0x45BD JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x60 DUP2 ADD DUP3 MSTORE PUSH1 0x0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP3 ADD DUP2 SWAP1 MSTORE SWAP2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F7 DUP3 CALLDATALOAD PUSH2 0x5CA6 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x4652 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x4665 PUSH2 0x4660 DUP3 PUSH2 0x5C35 JUMP JUMPDEST PUSH2 0x5C0E JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x46A3 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x468D DUP9 DUP3 PUSH2 0x47F3 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x4677 JUMP JUMPDEST POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x46BE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x46CC PUSH2 0x4660 DUP3 PUSH2 0x5C35 JUMP JUMPDEST DUP2 DUP2 MSTORE PUSH1 0x20 SWAP4 DUP5 ADD SWAP4 SWAP1 SWAP3 POP DUP3 ADD DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x46A3 JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0x46F4 DUP9 DUP3 PUSH2 0x48B1 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x46DE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x471B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x4729 PUSH2 0x4660 DUP3 PUSH2 0x5C35 JUMP JUMPDEST SWAP2 POP DUP2 DUP2 DUP4 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH1 0x20 DUP2 ADD SWAP1 POP DUP4 DUP6 PUSH1 0x20 DUP5 MUL DUP3 ADD GT ISZERO PUSH2 0x474E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x46A3 JUMPI DUP2 PUSH2 0x4764 DUP9 DUP3 PUSH2 0x4786 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0x4751 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F7 DUP3 CALLDATALOAD PUSH2 0x5CBF JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F7 DUP3 CALLDATALOAD PUSH2 0x5CC4 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F7 DUP3 CALLDATALOAD PUSH2 0x5CC7 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x7F7 DUP3 MLOAD PUSH2 0x5CC7 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1F DUP4 ADD DUP5 SGT PUSH2 0x47BC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x47D4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x1 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x47EC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x4804 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x4812 PUSH2 0x4660 DUP3 PUSH2 0x5C56 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x482E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4839 DUP4 DUP3 DUP5 PUSH2 0x5CFD JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4854 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x485E PUSH1 0x80 PUSH2 0x5C0E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x486C DUP5 DUP5 PUSH2 0x4786 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x487D DUP5 DUP5 DUP4 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x4891 DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x48A5 DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x48C4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x48CF PUSH2 0x180 PUSH2 0x5C0E JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x48DD DUP5 DUP5 PUSH2 0x4635 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x48EE DUP5 DUP5 DUP4 ADD PUSH2 0x4635 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x4902 DUP5 DUP3 DUP6 ADD PUSH2 0x4635 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x4916 DUP5 DUP3 DUP6 ADD PUSH2 0x4635 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x492A DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x493E DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x4952 DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x4966 DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x497B DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x4991 DUP5 DUP3 DUP6 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x49B3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x49BF DUP5 DUP3 DUP6 ADD PUSH2 0x47F3 JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x49E1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x49ED DUP5 DUP3 DUP6 ADD PUSH2 0x47F3 JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4A0C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A18 DUP5 DUP5 PUSH2 0x4635 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4A33 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A3F DUP6 DUP6 PUSH2 0x4635 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x4A50 DUP6 DUP3 DUP7 ADD PUSH2 0x4635 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4A6D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A79 DUP6 DUP6 PUSH2 0x4635 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x4A50 DUP6 DUP3 DUP7 ADD PUSH2 0x477A JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4A9C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4AB3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4A18 DUP5 DUP3 DUP6 ADD PUSH2 0x46AD JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4AD4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4AEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4AF7 DUP7 DUP3 DUP8 ADD PUSH2 0x46AD JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B14 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B20 DUP7 DUP3 DUP8 ADD PUSH2 0x470A JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B3D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B49 DUP7 DUP3 DUP8 ADD PUSH2 0x4641 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4B68 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4B7F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B8B DUP7 DUP3 DUP8 ADD PUSH2 0x46AD JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x4B20 DUP7 DUP3 DUP8 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4BAE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A18 DUP5 DUP5 PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4BCD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A3F DUP6 DUP6 PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x60 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x4BEF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4BFB DUP8 DUP8 PUSH2 0x4786 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x4C0C DUP8 DUP3 DUP9 ADD PUSH2 0x4635 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4C29 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4C35 DUP8 DUP3 DUP9 ADD PUSH2 0x47AA JUMP JUMPDEST SWAP6 SWAP9 SWAP5 SWAP8 POP SWAP6 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4C56 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4C62 DUP7 DUP7 PUSH2 0x4786 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x4C73 DUP7 DUP3 DUP8 ADD PUSH2 0x4635 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4C90 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4B49 DUP7 DUP3 DUP8 ADD PUSH2 0x47F3 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4CAE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A18 DUP5 DUP5 PUSH2 0x4792 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4CCC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4A18 DUP5 DUP5 PUSH2 0x479E JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x100 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4CEC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4CF8 DUP6 DUP6 PUSH2 0x4842 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x80 PUSH2 0x4A50 DUP6 DUP3 DUP7 ADD PUSH2 0x4842 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x4D1B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4D32 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4A18 DUP5 DUP3 DUP6 ADD PUSH2 0x48B1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 PUSH2 0x100 DUP7 DUP9 SUB SLT ISZERO PUSH2 0x4D57 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP6 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4D6E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4D7A DUP9 DUP3 DUP10 ADD PUSH2 0x48B1 JUMP JUMPDEST SWAP6 POP POP PUSH1 0x20 PUSH2 0x4D8B DUP9 DUP3 DUP10 ADD PUSH2 0x4635 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x40 PUSH2 0x4D9C DUP9 DUP3 DUP10 ADD PUSH2 0x4786 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x60 PUSH2 0x4DAD DUP9 DUP3 DUP10 ADD PUSH2 0x4786 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x80 PUSH2 0x4DBE DUP9 DUP3 DUP10 ADD PUSH2 0x4842 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 SWAP1 SWAP4 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x4DE1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4DF8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E04 DUP8 DUP3 DUP9 ADD PUSH2 0x48B1 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4E21 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E2D DUP8 DUP3 DUP9 ADD PUSH2 0x48B1 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4E4A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E56 DUP8 DUP3 DUP9 ADD PUSH2 0x47F3 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4E73 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4E7F DUP8 DUP3 DUP9 ADD PUSH2 0x47F3 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x4E9E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4EB5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4EC1 DUP6 DUP3 DUP7 ADD PUSH2 0x48B1 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x4A50 DUP6 DUP3 DUP7 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4EE7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4EFE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4F0A DUP7 DUP3 DUP8 ADD PUSH2 0x48B1 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x4C73 DUP7 DUP3 DUP8 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP8 DUP10 SUB SLT ISZERO PUSH2 0x4F34 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4F40 DUP10 DUP10 PUSH2 0x4786 JUMP JUMPDEST SWAP7 POP POP PUSH1 0x20 PUSH2 0x4F51 DUP10 DUP3 DUP11 ADD PUSH2 0x4635 JUMP JUMPDEST SWAP6 POP POP PUSH1 0x40 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4F6E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4F7A DUP10 DUP3 DUP11 ADD PUSH2 0x47AA JUMP JUMPDEST SWAP5 POP SWAP5 POP POP PUSH1 0x60 DUP8 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x4F99 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x4FA5 DUP10 DUP3 DUP11 ADD PUSH2 0x47AA JUMP JUMPDEST SWAP3 POP SWAP3 POP POP SWAP3 SWAP6 POP SWAP3 SWAP6 POP SWAP3 SWAP6 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x4FC9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x4FD5 DUP7 DUP7 PUSH2 0x4786 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x4FE6 DUP7 DUP3 DUP8 ADD PUSH2 0x4786 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0x4B49 DUP7 DUP3 DUP8 ADD PUSH2 0x4786 JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CA6 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x5011 DUP3 PUSH2 0x5CA2 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x5023 DUP4 PUSH2 0x5C9C JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x5053 JUMPI PUSH2 0x5039 DUP7 DUP4 MLOAD PUSH2 0x57DB JUMP JUMPDEST PUSH2 0x5042 DUP3 PUSH2 0x5C9C JUMP JUMPDEST PUSH1 0x60 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x5026 JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CBF JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CC4 JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CC7 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x5083 DUP3 PUSH2 0x5CA2 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x5097 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x5D09 JUMP JUMPDEST PUSH2 0x50A0 DUP2 PUSH2 0x5D35 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CF2 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x4C454E4754485F36355F52455155495245440000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x494E56414C49445F54414B455200000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x4F524445525F4F56455246494C4C000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x41535345545F50524F58595F414C52454144595F455849535453000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x15 DUP2 MSTORE PUSH32 0x5349474E41545552455F554E535550504F525445440000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4449564953494F4E5F42595F5A45524F00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x494E56414C49445F4F524445525F5349474E4154555245000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x494E56414C49445F4D414B455200000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xF DUP2 MSTORE PUSH32 0x494E56414C49445F54585F484153480000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x494E56414C49445F5349474E4154555245000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x524F554E44494E475F4552524F52000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4641494C45445F455845435554494F4E00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xD DUP2 MSTORE PUSH32 0x54414B45525F4F56455250415900000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x494E56414C49445F54414B45525F414D4F554E54000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1A DUP2 MSTORE PUSH32 0x41535345545F50524F58595F444F45535F4E4F545F4558495354000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x21 DUP2 MSTORE PUSH32 0x475245415445525F5448414E5F5A45524F5F4C454E4754485F52455155495245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x4400000000000000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x5349474E41545552455F494C4C4547414C000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1E DUP2 MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F305F52455155495245440000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x17 DUP2 MSTORE PUSH32 0x494E56414C49445F4E45575F4F524445525F45504F4348000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x1E DUP2 MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F335F52455155495245440000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x434F4D504C4554455F46494C4C5F4641494C4544000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x494E56414C49445F46494C4C5F50524943450000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x12 DUP2 MSTORE PUSH32 0x5245454E5452414E43595F494C4C4547414C0000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x13 DUP2 MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x26 DUP2 MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x20 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4F524445525F554E46494C4C41424C4500000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x494E56414C49445F53454E444552000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x18 DUP2 MSTORE PUSH32 0x4E454741544956455F5350524541445F52455155495245440000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x14 DUP2 MSTORE PUSH32 0x494E56414C49445F54585F5349474E4154555245000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x4C454E4754485F305F5245515549524544000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x80 DUP4 ADD SWAP1 PUSH2 0x5769 DUP5 DUP3 PUSH2 0x5066 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x577C PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x578F PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x2B50 PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST DUP1 MLOAD PUSH2 0x120 DUP4 ADD SWAP1 PUSH2 0x57B4 DUP5 DUP3 PUSH2 0x5758 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x57C7 PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0x5758 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x2B50 PUSH2 0x100 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x60 DUP4 ADD SWAP1 PUSH2 0x57EC DUP5 DUP3 PUSH2 0x5812 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x57FF PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x2B50 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x5000 DUP2 PUSH2 0x5CEC JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x4FF7 JUMP JUMPDEST PUSH2 0x100 DUP2 ADD PUSH2 0x5838 DUP3 DUP12 PUSH2 0x4FF7 JUMP JUMPDEST PUSH2 0x5845 PUSH1 0x20 DUP4 ADD DUP11 PUSH2 0x4FF7 JUMP JUMPDEST PUSH2 0x5852 PUSH1 0x40 DUP4 ADD DUP10 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x585F PUSH1 0x60 DUP4 ADD DUP9 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x586C PUSH1 0x80 DUP4 ADD DUP8 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x5879 PUSH1 0xA0 DUP4 ADD DUP7 PUSH2 0x5066 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0xC0 DUP4 ADD MSTORE PUSH2 0x588B DUP2 DUP6 PUSH2 0x5078 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0xE0 DUP4 ADD MSTORE PUSH2 0x589F DUP2 DUP5 PUSH2 0x5078 JUMP JUMPDEST SWAP11 SWAP10 POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x58BB DUP3 DUP7 PUSH2 0x4FF7 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x58CD DUP2 DUP6 PUSH2 0x5078 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x58E1 DUP2 DUP5 PUSH2 0x5078 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7F7 DUP2 DUP5 PUSH2 0x5006 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x505D JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x5066 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x5925 DUP3 DUP7 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x5932 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0x4FF7 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0x58E1 DUP2 DUP5 PUSH2 0x5078 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x5952 DUP3 DUP6 PUSH2 0x5066 JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0x7F4 DUP2 DUP5 PUSH2 0x5078 JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x5972 DUP3 DUP8 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x597F PUSH1 0x20 DUP4 ADD DUP7 PUSH2 0x5812 JUMP JUMPDEST PUSH2 0x598C PUSH1 0x40 DUP4 ADD DUP6 PUSH2 0x5066 JUMP JUMPDEST PUSH2 0x58E1 PUSH1 0x60 DUP4 ADD DUP5 PUSH2 0x5066 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x59A7 DUP3 DUP6 PUSH2 0x506F JUMP JUMPDEST PUSH2 0x7F7 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x4FF7 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x7F7 DUP2 DUP5 PUSH2 0x5078 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x50AD JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x50B6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x50E6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5116 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5146 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5176 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x51A6 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x51FC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x522C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x525C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x528C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x52BC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x52EC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x531C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x534C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x537C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x53AC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x53DC JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x540C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x543C JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5492 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x54C2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x54F2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5522 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5552 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5582 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x55B2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x55E2 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5612 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5668 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5698 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x56C8 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x56F8 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x119C DUP2 PUSH2 0x5728 JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x5758 JUMP JUMPDEST PUSH2 0x120 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x57A2 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH2 0x119C DUP3 DUP5 PUSH2 0x57DB JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x5C2D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x5C4C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 SWAP1 DUP2 MUL ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x5C6D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0xFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x119C DUP3 PUSH2 0x5CA6 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x5D24 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x5D0C JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x2B50 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 LOG0 0xd8 0xac 0xec 0xb3 CALLER RETURNDATASIZE 0xd7 0x21 0xa8 0x22 CREATE2 SHR DUP7 0xc7 PUSH18 0x4FC5A48327FD1BD94E3356CA224D82826C65 PUSH25 0x706572696D656E74616CF50037000000000000000000000000 ",
+ "sourceMap": "723:5376:65:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4610:261;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4610:261:65;;;;;;;;;;;;;;;;;;;;;;;;;5691:406;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5691:406:65;;;;;;;;;;;4100:270;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4100:270:65;;;;;;;;;;;;;;;;;1277:42:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1277:42:28;;;;;;;;;4133:647:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4133:647:32;;;;;;;;;;;;;;;;;1367:42:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1367:42:28;;;;;;;;;1572:445:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1572:445:30;;;;;;;;;1870:2891:29;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1870:2891:29;;;;;;;;;;;;;;;;;2139:1515:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2139:1515:32;;;;;;;;;897:51:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;897:51:27;;;;;;;;;;;;;;;;;15747:260:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;15747:260:32;;;;;;;;;5260:659;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5260:659:32;;;;;;;;;2018:1079:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2018:1079:28;;;;;;;;;6478:632:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6478:632:32;;;;;;;;;2013:154:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2013:154:27;;;;;;;;;;;;;;;;;967:45:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;967:45:31;;;;;;;;;1357:395:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1357:395:32;;;;;;;;;1362:275:65;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1362:275:65;;;;;;;;;5111:259;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5111:259:65;;;;;;;;;2254:412:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2254:412:30;;;;;;;;;1166:71;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1166:71:30;;;;;;;;;7498:1507:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7498:1507:32;;;;;;;;;16201:419;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;16201:419:32;;;;;;;;;;;;;;;;;1046:63:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1046:63:30;;;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;3038:4848:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3038:4848:30;;;;;;;;;13713:1899:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;13713:1899:32;;;;;;;;;3414:374:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3414:374:28;;;;;;;;;3579:272:65;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3579:272:65;;;;;;;;;1426:1456:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1426:1456:31;;;;;;;;;1157:666:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1157:666:27;;;;;;;;;4417:2261:28;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4417:2261:28;;;;;;;;;;;;;;;;;4019:124;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4019:124:28;;;;;;;;;1627:67;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1627:67:28;;;;;;;;;1779:27:43;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1779:27:43;;;;;;;;;;;;9462:1488:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;9462:1488:32;;;;;;;;;2473:280:65;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2473:280:65;;;;;;;;;3052:278;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3052:278:65;;;;;;;;;1908:266;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1908:266:65;;;;;;;;;1301:33:44;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1301:33:44;;;;11338:1914:32;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;11338:1914:32;;;;;;;;;1064:36:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1064:36:31;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;;;1112:46:26;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1112:46:26;;;;4610:261:65;4777:12;4812:52;4833:9;4844:11;4857:6;4812:20;:52::i;:::-;4805:59;;4610:261;;;;;;:::o;5691:406::-;5929:161;5960:5;5979:12;6005:9;6028:27;6069:11;5929:17;:161::i;:::-;5691:406;;;;;:::o;4100:270::-;4267:21;4311:52;4332:9;4343:11;4356:6;4311:20;:52::i;1277:42:28:-;;;;;;;;;;;;;:::o;4133:647:32:-;4340:35;;:::i;:::-;4391:20;4442:9;4495:36;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;4414::32;;;-1:-1:-1;1043:6:83;-1:-1:-1;4437:304:32;4457:17;;;4437:304;;4534:131;4569:6;4576:1;4569:9;;;;;;;;;;;;;;;;;;4596:21;4618:1;4596:24;;;;;;;;;;;;;;;;;;4638:10;4649:1;4638:13;;;;;;;;;;;;;;;;;;4534:17;:131::i;:::-;4495:170;;4679:51;4694:16;4712:17;4679:14;:51::i;:::-;4476:3;;;;;4437:304;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;4133:647:32;;-1:-1:-1;;;4133:647:32:o;1367:42:28:-;;;;;;;;;;;;;;;:::o;1572:445:30:-;1708:27;;;1725:10;1708:27;1704:260;;1776:126;1814:4;1840:13;1875:9;;1776:126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1776:16:30;;-1:-1:-1;;;;;1776:126:30:i;:::-;1751:202;;;;;;;;;;;;;;;;-1:-1:-1;;1973:15:30;;;;:9;:15;;;;;;;;:30;;;;;;;;;;;:37;;;;2006:4;1973:37;;;1572:445::o;1870:2891:29:-;2106:59;;:::i;:::-;2571:39;;:::i;:::-;2646:40;;:::i;:::-;2755:20;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;2435:24:29;;;;;2407:25;;;;:52;;;;2497:24;;;2469:25;;;:52;2613:23;2435:9;2613:12;:23::i;:::-;2571:65;;2689:24;2702:10;2689:12;:24::i;:::-;2646:67;;2778:26;:24;:26::i;:::-;2755:49;;2875:132;2908:9;2931:13;2958:12;2984:13;2875:19;:132::i;:::-;3017:135;3050:10;3074:14;3102:12;3128:14;3017:19;:135::i;:::-;3162:39;3179:9;3190:10;3162:16;:39::i;:::-;3278:195;3319:9;3342:10;3366:13;:41;;;3421:14;:42;;;3278:27;:195::i;:::-;3597:23;;:46;;;;3717;;3257:216;;-1:-1:-1;3518:255:29;;3547:9;;3570:13;;3597:46;;3518:15;:255::i;:::-;3864:24;;;;;:47;;;;3986;;3783:260;;3812:10;;3836:14;;3864:47;;;3783:15;:260::i;:::-;4095:205;4126:9;4149:12;4175:13;:23;;;4212:13;:41;;;4267:18;:23;;;4095:17;:205::i;:::-;4310:209;4341:10;4365:12;4391:14;:24;;;4429:14;:42;;;4485:18;:24;;;4310:17;:209::i;:::-;4584:134;4617:9;4640:10;4664:12;4690:18;4584:19;:134::i;:::-;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;1870:2891:29;;-1:-1:-1;;;;1870:2891:29:o;2139:1515:32:-;2310:30;;:::i;:::-;2403;2436:104;2468:5;2487:20;2521:9;2436:18;:104::i;:::-;2403:137;;3116:3;3037:17;2972;2966:24;2870:2;2851:17;2847:26;2762:7;2691:3;2661:532;3209:7;3206:2;;;3261:17;3255:24;3242:11;3235:45;3355:2;3336:17;3332:26;3326:33;3321:2;3308:11;3304:20;3297:63;3435:2;3416:17;3412:26;3406:33;3401:2;3388:11;3384:20;3377:63;3515:2;3496:17;3492:26;3486:33;3481:2;3468:11;3464:20;3457:63;3206:2;-1:-1:-1;2139:1515:32;;;;;;;:::o;897:51:27:-;;;;;;;;;;;;;;;:::o;15747:260:32:-;15856:20;939:6:83;;15856:20:32;;939:6:83;;938:7;917:72;;;;;;;;;;;;;;-1:-1:-1;;1043:6:83;:13;;;;1052:4;1043:13;;;15879::32;;;15902:99;15922:17;;;15902:99;;15960:30;15980:6;15987:1;15980:9;;;;;;;;;;;;;;;;;;15960:19;:30::i;:::-;15941:3;;15902:99;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;15747:260:32:o;5260:659::-;5473:35;;:::i;:::-;5524:20;5575:9;5628:36;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;5547::32;;;-1:-1:-1;1043:6:83;-1:-1:-1;5570:310:32;5590:17;;;5570:310;;5667:137;5708:6;5715:1;5708:9;;;;;;;;;;;;;;;;;;5735:21;5757:1;5735:24;;;;;;;;;;;;;;;;;;5777:10;5788:1;5777:13;;;;;;;;;;;;;;;;;;5667:23;:137::i;:::-;5628:176;;5818:51;5833:16;5851:17;5818:14;:51::i;:::-;5609:3;;;;;5570:310;;2018:1079:28;2122:20;939:6:83;;2122:20:28;;;;;;939:6:83;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;2145:26:28;:24;:26::i;:::-;2122:49;-1:-1:-1;2453:26:28;;;2469:10;2453:26;:52;;2495:10;2453:52;;;2490:1;2453:52;2673:24;;;;;;;;:10;:24;;;;;;;;:39;;;;;;;;;;2429:76;;-1:-1:-1;2636:1:28;2617:20;;;-1:-1:-1;2673:39:28;-1:-1:-1;2801:29:28;;;2780:100;;;;;;;;;;;;;;2920:24;;;;;;;;:10;:24;;;;;;;;:39;;;;;;;;;;;;;;:55;;;2990:100;;;;;2962:13;;2990:100;;;;;;;;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;;;2018:1079:28:o;6478:632:32:-;6671:35;;:::i;:::-;6722:20;6773:9;6826:36;;:::i;:::-;6745:6;:13;6722:36;;6785:1;6773:13;;6768:303;6788:17;;;6768:303;;6865:130;6899:6;6906:1;6899:9;;;;;;;;;;;;;;;;;;6926:21;6948:1;6926:24;;;;;;;;;;;;;;;;;;6968:10;6979:1;6968:13;;;;;;;;;;;;;;;;;;6865:16;:130::i;:::-;6826:169;;7009:51;7024:16;7042:17;7009:14;:51::i;:::-;6807:3;;;;;6768:303;;;6478:632;;;;;;;;:::o;2013:154:27:-;2134:26;;;2104:7;2134:26;;;:12;:26;;;;;;;;2013:154;;;;:::o;967:45:31:-;;;;;;;;;;;;;;;:::o;1357:395:32:-;1548:30;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;1608:109:32;1645:5;1664:20;1698:9;1608:23;:109::i;:::-;1165:5:83;1156:14;;;;;;1594:123:32;1357:395;-1:-1:-1;;;;1357:395:32:o;1362:275:65:-;1512:11;;:::i;:::-;1546:51;1561:16;1579:17;1546:14;:51::i;:::-;-1:-1:-1;1614:16:65;1362:275;;;;;:::o;5111:259::-;5277:12;5312:51;5332:9;5343:11;5356:6;5312:19;:51::i;2254:412:30:-;2408:21;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;2432:26:30;:24;:26::i;:::-;2468:32;;;;;;;;:17;:32;;;;;;;;:50;;;;;;;;;;;;;;:61;;;;;;;;;;2544:115;2468:32;;-1:-1:-1;2468:50:30;;2544:115;;;;2468:61;;2544:115;;;;;;;;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;2254:412:30:o;1166:71::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;7498:1507:32:-;7696:35;;:::i;:::-;7747:27;7816:20;7867:9;8253:37;8444:36;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;7777:9:32;;:6;;1043::83;7777:9:32;;;;;;;;;;;;;;:24;;;7747:54;;7839:6;:13;7816:36;;7879:1;7867:13;;7862:1104;7882:17;;;7862:1104;;8156:14;8129:6;8136:1;8129:9;;;;;;;;;;;;;;;;;;:24;;:41;;;;8293:70;8301:20;8323:16;:39;;;8293:7;:70::i;:::-;8253:110;;8483:136;8518:6;8525:1;8518:9;;;;;;;;;;;;;;;;;;8545:29;8592:10;8603:1;8592:13;;;;;;;;;8483:136;8444:175;;8704:51;8719:16;8737:17;8704:14;:51::i;:::-;8853:39;;;;:63;-1:-1:-1;8849:107:32;;8936:5;;8849:107;7901:3;;;;;7862:1104;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;7498:1507:32;;;-1:-1:-1;;;;;7498:1507:32:o;16201:419::-;16301:20;16344;16390:38;16484:9;16367:6;:13;16344:36;;16456:12;16431:38;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;16390:79;;16496:1;16484:13;;16479:108;16499:17;;;16479:108;;16553:23;16566:6;16573:1;16566:9;;;;;;;;;;;;;;;;;;16553:12;:23::i;:::-;16537:10;16548:1;16537:13;;;;;;;;;;;;;;;;;;:39;16518:3;;16479:108;;1046:63:30;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;91:20:82:-;;;;;;:::o;3038:4848:30:-;3200:12;3390:22;3631:27;3752:7;3769:9;3788;3807:17;6871:24;3268:1;3249:9;:16;:20;3228:97;;;;;;;;;;;;;;;;3421:23;:9;:21;:23::i;:::-;3415:30;;;;-1:-1:-1;3543:29:30;3518:55;;;;3497:123;;;;;;;;;;;;;;3675:16;3661:31;;;;;;;;;;3631:61;-1:-1:-1;4174:21:30;4157:13;:38;;;;;;;;;4153:3383;;;4211:27;;;;;;;;;;;4153:3383;4520:21;4503:13;:38;;;;;;;;;4499:3037;;;4582:16;;:21;4557:97;;;;;;;;;;;;;;4678:5;;-1:-1:-1;4697:14:30;;4499:3037;4784:20;4767:13;:37;;;;;;;;;4763:2773;;;4845:16;;4865:2;4845:22;4820:99;;;;;;;;;;;;;;4943:9;4953:1;4943:12;;;;;;;;;;;;;;;;;;;;;4937:19;;-1:-1:-1;4974:24:30;:9;4996:1;4974:24;:21;:24;:::i;:::-;4970:28;-1:-1:-1;5016:25:30;:9;5038:2;5016:25;:21;:25;:::i;:::-;5012:29;;5067:102;5094:4;5116:1;5135;5154;5067:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;5067:102:30;;;;;5193:26;;;;;;;;;-1:-1:-1;5067:102:30;-1:-1:-1;5233:14:30;;-1:-1:-1;5233:14:30;4763:2773;5324:21;5307:13;:38;;;;;;;;;5303:2233;;;5386:16;;5406:2;5386:22;5361:99;;;;;;;;;;;;;;5484:9;5494:1;5484:12;;;;;;;;;;;;;;;;;;;;;5478:19;;-1:-1:-1;5515:24:30;:9;5537:1;5515:24;:21;:24;:::i;:::-;5511:28;-1:-1:-1;5557:25:30;:9;5579:2;5557:25;:21;:25;:::i;:::-;5553:29;;5608:225;5739:4;5645:116;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;5645:116:30;;;5635:127;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;5635:127:30;;;;;;;;;;;;-1:-1:-1;5608:225:30;;;;;;;;;;-1:-1:-1;5635:127:30;-1:-1:-1;5780:1:30;;5799;;-1:-1:-1;5818:1:30;;5608:225;;5303:2233;6081:20;6064:13;:37;;;;;;;;;6060:1476;;;6127:116;6167:4;6189:13;6220:9;6127:22;:116::i;:::-;6117:126;-1:-1:-1;6257:14:30;;6060:1476;6770:23;6753:13;:40;;;;;;;;;6749:787;;;6898:26;:9;:24;:26::i;:::-;7009:32;;;;;;;;:17;:32;;;;;;;;:50;;;;;;;;;;6871:53;;-1:-1:-1;7009:50:30;;7008:51;7004:102;;;7086:5;7079:12;;;;7004:102;7129:153;7172:16;7206:4;7228:13;7259:9;7129:25;:153::i;6749:787::-;7418:23;7401:13;:40;;;;;;;;;7397:139;;;7467:15;;;;:9;:15;;;;;;;;:30;;;;;;;;;;;;;;-1:-1:-1;7511:14:30;;7397:139;7848:31;;;;;;;;;;;3038:4848;;;;;;;;;;;;;:::o;13713:1899:32:-;13896:35;;:::i;:::-;13947:27;14012:20;14063:9;14453:37;14759;15050:36;;:::i;:::-;13977:6;13984:1;13977:9;;;;;;;;;;;;;;;;;;:24;;;13947:54;;14035:6;:13;14012:36;;14075:1;14063:13;;14058:1515;14078:17;;;14058:1515;;14357:14;14330:6;14337:1;14330:9;;;;;;;;;;;;;;;;;;;:24;;:41;14523:39;;14493:70;;14501:20;;14493:7;:70::i;:::-;14453:110;;14799:170;14838:6;14845:1;14838:9;;;;;;;;;;;;;;;;;;:26;;;14882:6;14889:1;14882:9;;;;;;;;;;;;;;;;;;:26;;;14926:29;14799:21;:170::i;:::-;14759:210;;15089:135;15123:6;15130:1;15123:9;;;;;;;;;;;;;;;;;;15150:29;15197:10;15208:1;15197:13;;;;;;;;;15089:135;15050:174;;15309:51;15324:16;15342:17;15309:14;:51::i;:::-;15460:39;;:63;-1:-1:-1;15456:107:32;;15543:5;;15456:107;14097:3;;;;;14058:1515;;;13713:1899;;;;;;;;;;;:::o;3414:374:28:-;3590:30;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;3650:103:28;3681:5;3700:20;3734:9;3650:17;:103::i;3579:272:65:-;3747:21;3791:53;3813:9;3824:11;3837:6;3791:21;:53::i;1426:1456:31:-;1640:21;;1730:23;;1640:35;:21;:35;1619:100;;;;;;;;;;;;;;1756:113;1774:94;1809:4;1827:13;1854:4;;1774:94;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1774:21:31;;-1:-1:-1;;;;;1774:94:31:i;:::-;1756:17;:113::i;:::-;1956:29;;;;:12;:29;;;;;;1730:139;;-1:-1:-1;1956:29:31;;1955:30;1934:92;;;;;;;;;;;;;;2112:27;;;2129:10;2112:27;2108:410;;2214:137;2252:15;2289:13;2324:9;;2214:137;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2214:16:31;;-1:-1:-1;;;;;2214:137:31:i;:::-;2189:216;;;;;;;;;;;;;;;;2470:21;:37;;;;;;;;;;2108:410;2559:29;;;;:12;:29;;;;;;;:36;;;;2591:4;2559:36;;;2626:32;2634:4;;2653;;;;2626:32;2653:4;;;;2626:32;;;;;;;;;;;;;;;;;;;;;;;;2605:95;;;;;;;;;;;;;;;;2788:27;;;2805:10;2788:27;2784:92;;2831:21;:34;;;;;;2784:92;1426:1456;;;;;;;:::o;1157:666:27:-;259:5:82;;1254:30:27;;;;;;259:5:82;;245:10;:19;224:85;;;;;;;;;;;;;;1299:10:27;1254:56;;1405:18;:29;;;:31;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1405:31:27;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1405:31:27;;;;;;;101:4:-1;97:9;90:4;84;80:15;76:31;69:5;65:43;126:6;120:4;113:20;0:138;1405:31:27;;;;;;;;;1474:26;;;;;;;:12;:26;;;;;;1383:53;;-1:-1:-1;1474:26:27;;;-1:-1:-1;1531:31:27;;1510:104;;;;;;;;;;;;;;1674:26;;;;;;;:12;:26;;;;;;;:47;;;;;;;;;;1736:80;;;;;1674:26;;1796:10;;1736:80;;;;;;;;;;1157:666;;;;:::o;4417:2261:28:-;4504:26;;:::i;:::-;4602:19;4615:5;4602:12;:19::i;:::-;4580;;;;:41;;;;4703:27;;;:6;:27;;;;;;;;4663:37;;;:67;5032:22;;;;:27;5028:157;;;5105:38;5099:45;5075:69;;;;5158:16;;5028:157;5498:22;;;;:27;5494:157;;;5571:38;5565:45;;5494:157;5745:22;;;;5704:37;;;;:63;5700:179;;5813:24;5807:31;;5700:179;6003:27;;;;5984:15;:46;5980:157;;6076:19;6070:26;;5980:157;6206:19;;;;;6196:30;;;;:9;:30;;;;;;;;;6192:143;;;6272:21;6266:28;;6192:143;6402:10;;;;6359:18;;6348:30;;;;;;;;:10;:30;;;;;;;;6379:19;;;;6348:51;;;;;;;;;;:64;6344:177;;;6458:21;6452:28;;6344:177;6624:20;6594:51;;;4417:2261;-1:-1:-1;4417:2261:28:o;4019:124::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;4110:26:28;4130:5;4110:19;:26::i;:::-;-1:-1:-1;1165:5:83;1156:14;;;;;;4019:124:28:o;1627:67::-;;;;;;;;;;;;;;;;;;;;;;;;:::o;1779:27:43:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;9462:1488:32:-;9646:35;;:::i;:::-;9697:27;9762:20;9813:9;10199:37;10390:36;;:::i;:::-;9727:6;9734:1;9727:9;;;;;;;;;;;;;;;;;;:24;;;9697:54;;9785:6;:13;9762:36;;9825:1;9813:13;;9808:1103;9828:17;;;9808:1103;;10102:14;10075:6;10082:1;10075:9;;;;;;;;;;;;;;;;;;:24;;:41;;;;10239:70;10247:20;10269:16;:39;;;10239:7;:70::i;:::-;10199:110;;10429:135;10463:6;10470:1;10463:9;;;;;;;;;;;;;;;;;;10490:29;10537:10;10548:1;10537:13;;;;;;;;;10429:135;10390:174;;10649:51;10664:16;10682:17;10649:14;:51::i;:::-;10798:39;;;;:63;-1:-1:-1;10794:107:32;;10881:5;;10794:107;9847:3;;;;;9808:1103;;;9462:1488;;;;;;;;;;:::o;2473:280:65:-;2645:21;2689:57;2715:9;2726:11;2739:6;2689:25;:57::i;3052:278::-;3223:21;3267:56;3292:9;3303:11;3316:6;3267:24;:56::i;1908:266::-;2063:30;;:::i;:::-;2116:51;2137:5;2144:22;2116:20;:51::i;1301:33:44:-;;;;:::o;11338:1914:32:-;11535:35;;:::i;:::-;11586:27;11651:20;11702:9;12092:37;12398;12689:36;;:::i;:::-;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;11616:9:32;;:6;;1043::83;11616:9:32;;;;;;;;;;;;;;:24;;;11586:54;;11674:6;:13;11651:36;;11714:1;11702:13;;11697:1516;11717:17;;;11697:1516;;11996:14;11969:6;11976:1;11969:9;;;;;;;;;;;;;;;;;;;:24;;:41;12162:39;;12132:70;;12140:20;;12132:7;:70::i;:::-;12092:110;;12438:170;12477:6;12484:1;12477:9;;;;;;;;;12438:170;12398:210;;12728:136;12763:6;12770:1;12763:9;;;;;;;;;;;;;;;;;;12790:29;12837:10;12848:1;12837:13;;;;;;;;;12728:136;12689:175;;12949:51;12964:16;12982:17;12949:14;:51::i;:::-;13100:39;;:63;-1:-1:-1;13096:107:32;;13183:5;;13096:107;11736:3;;;;;11697:1516;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;11338:1914:32;;;-1:-1:-1;;;;;;11338:1914:32:o;1064:36:31:-;;;;;;:::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;425:69;333:167;:::o;1112:46:26:-;;;;;;;;;;;;;;;;;;;:::o;4779:1869:47:-;4942:12;;4991:15;;;4970:78;;;;;;;;;;;;;;5868:11;;;:29;;-1:-1:-1;5883:14:47;;5868:29;5864:72;;;5920:5;5913:12;;;;5864:72;6522:11;6459:84;;;;;;;6499:9;6479:6;6459:84;6439:104;;6591:26;6599:9;6610:6;6591:7;:26::i;:::-;6563:24;6571:4;6577:9;6563:7;:24::i;:::-;:54;;;4779:1869;-1:-1:-1;;;;;4779:1869:47:o;9384:792:28:-;9662:72;9670:27;9699:11;:34;;;9662:7;:72::i;:::-;9642:17;;;;:6;:17;;;;;;;;;:92;;;;9821:25;;;;9789:18;;9910:34;;9958;;;;10006:24;;;;10044;;;;10105:20;;;;10139;;;;9771:398;;9642:17;;9771:398;;;;;;;;;;;;;;9860:12;;9886:10;;9910:34;;9958;;10006:24;;10139:20;9771:398;;;;;;;;;;9384:792;;;;;:::o;3825:691:47:-;3988:21;4046:15;;;4025:78;;;;;;;;;;;;;;4317:162;4338:106;4363:26;4371:9;4382:6;4363:7;:26::i;:::-;4407:23;4415:11;4428:1;4407:7;:23::i;:::-;4338:7;:106::i;:::-;4458:11;4317:7;:162::i;6995:1583:28:-;7160:30;;:::i;:::-;7234:26;;:::i;:::-;7324:20;7629:33;7745:30;7263:19;7276:5;7263:12;:19::i;:::-;7234:48;;7347:26;:24;:26::i;:::-;7324:49;;7446:120;7479:5;7498:9;7521:12;7547:9;7446:19;:120::i;:::-;7665:70;7673:5;:22;;;7697:9;:37;;;7665:7;:70::i;:::-;7629:106;;7778:55;7785:20;7807:25;7778:6;:55::i;:::-;7745:88;;7872:185;7901:5;7920:9;7943:20;7977:22;8013:11;:34;;;7872:15;:185::i;:::-;8127:51;8148:5;8155:22;8127:20;:51::i;:::-;8113:65;;8231:181;8262:5;8281:12;8307:9;:19;;;8340:9;:37;;;8391:11;8231:17;:181::i;:::-;8451:91;8476:5;8495:12;8521:11;8451;:91::i;:::-;6995:1583;;;;;;;;;:::o;1771:648:46:-;1964:39;;2005:40;;1956:90;;1964:39;1956:7;:90::i;:::-;1914:132;;2106:39;;;;;2147:40;;;;2098:90;;2106:39;2098:7;:90::i;:::-;2056:39;;;:132;2238:29;;;;;2269:30;;;;2230:70;;2238:29;2230:7;:70::i;:::-;2198:29;;;:102;2350:29;;;;;2381:30;;;;2342:70;;2350:29;2342:7;:70::i;:::-;2310:29;;;;:102;;;;-1:-1:-1;1771:648:46:o;4841:307:31:-;4980:21;;4924:7;;4980:21;;4924:7;5036:36;;:74;;5088:22;5036:74;;;5075:10;5011:99;4841:307;-1:-1:-1;;;4841:307:31:o;11221:1268:28:-;11513:21;;:52;;11544:20;11513:52;11492:115;;;;;;;;;;;;;;11687:19;;;;:33;;;11683:170;;11761:19;;;;:33;;11784:10;11761:33;11736:106;;;;;;;;;;;;;;11931:18;;;;:32;;;11927:169;;12026:12;12004:34;;:5;:18;;;:34;;;11979:106;;;;;;;;;;;;;;;;12186:37;;;;:42;12182:301;;;12269:146;12307:9;:19;;;12348:5;:18;;;12388:9;12269:16;:146::i;:::-;12244:228;;;;;;;;;;;;;;;;11221:1268;;;;:::o;4931:1075:29:-;5885:64;5893:9;:26;;;5921:10;:27;;;5885:7;:64::i;:::-;5805;5813:9;:26;;;5841:10;:27;;;5805:7;:64::i;:::-;:144;;5784:215;;;;;;;;;;;;;;4931:1075;;:::o;6742:4784::-;7014:59;;:::i;:::-;7185:37;7303;7511:38;7632;7225:68;7233:9;:26;;;7261:31;7225:7;:68::i;:::-;7185:108;;7343:158;7382:9;:26;;;7422:9;:26;;;7462:29;7343:25;:158::i;:::-;7303:198;;7552:70;7560:10;:27;;;7589:32;7552:7;:70::i;:::-;7511:111;;7673:161;7712:10;:27;;;7753:10;:27;;;7794:30;7673:25;:161::i;:::-;7632:202;-1:-1:-1;8592:63:29;;;8588:1672;;8722:24;;;;;;:80;;;8816:24;;:47;;:80;;;8959:24;:47;8910:23;;:46;;:96;9299:26;;;;9343;;;;9387:23;;:46;;;;9256:191;;9343:26;9256:25;:191::i;:::-;9207:23;;:240;8588:1672;;;9528:23;;:78;;;9620:23;;:46;;;;:78;;;9762:23;;:46;;;9712:24;;;;;:96;;;;10098:27;;;;10143;;;;10188:24;;:47;10056:193;;10143:27;10056:24;:193::i;:::-;10006:24;;;;;:47;:243;8588:1672;10382:23;;:46;10442:24;;;;;:47;;10361:138;;10382:46;10361:7;:138::i;:::-;10313:45;;;:186;10627:23;;:46;10687:26;;;;10727:18;;;;10588:167;;10627:46;10687:26;10588:25;:167::i;:::-;10549:23;;:36;;:206;10843:23;;:46;;;10903:26;;;;10943:18;;;;10804:167;;10843:46;10903:26;10804:25;:167::i;:::-;10765:23;;:36;;:206;11101:24;;;;:47;11162:27;;;;11203:19;;;;11062:170;;11101:47;11162:27;11062:25;:170::i;:::-;11022:18;:24;;;:37;;:210;;;;;11282:170;11321:18;:24;;;:47;;;11382:10;:27;;;11423:10;:19;;;11282:25;:170::i;:::-;11242:24;;;;:37;;:210;6742:4784;;;;;;;;;;:::o;12927:2440:28:-;13322:25;;;13301:92;;;;;;;;;;;;;;13621:46;;;;13600:106;;;;;;;;;;;;;;13988:5;:22;;;13914:70;13922:9;:37;;;13961:22;13914:7;:70::i;:::-;:96;;13893:157;;;;;;;;;;;;;;15261:55;15269:5;:22;;;15293;15261:7;:55::i;:::-;15177;15185:22;15209:5;:22;;;15177:7;:55::i;:::-;:139;;15156:204;;;;;;;;;;;;;11972:2233:29;12247:14;12219:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:25;;:42;;12247:14;;12219:42;;12247:14;12219:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12305:202;12339:9;:24;;;12377:9;:22;;;12413:10;:23;;;12450:18;:24;;;:47;;;12305:20;:202::i;:::-;12551:25;;;;12590:23;;12627:22;;12663:23;;:46;;;12517:202;;12551:25;12590:23;12627:22;12517:20;:202::i;:::-;12729:189;12763:9;:24;;;12801:9;:22;;;12837:12;12863:18;:45;;;12729:20;:189::i;:::-;12951:185;12985:12;13011:9;:22;;;13047:9;:29;;;13090:18;:23;;;:36;;;12951:20;:185::i;:::-;13146:188;13180:12;13206:10;:23;;;13243:10;:30;;;13287:18;:24;;;:37;;;13146:20;:188::i;:::-;13404:10;:30;;;13371:63;;:9;:29;;;:63;;;13367:832;;;13450:301;13488:12;13518;13548:9;:29;;;13595:142;13624:18;:23;;;:36;;;13682:18;:24;;;:37;;;13595:7;:142::i;:::-;13450:20;:301::i;:::-;13367:832;;;13782:195;13820:12;13850;13880:9;:29;;;13927:18;:23;;;:36;;;13782:20;:195::i;:::-;13991:197;14029:12;14059;14089:10;:30;;;14137:18;:24;;;:37;;;13991:20;:197::i;1011:10099:42:-;5031:4;5025:11;;5321:66;5314:4;5291:28;;;5284:104;;;;1199:30;5445:4;5422:28;;6444:59;;;6770:19;;5736:26;;;6750:40;;;6883:23;;;6877:30;6853:22;;;6846:62;6979:23;;;6973:30;6949:22;;;6942:62;7082:23;;;7076:30;7052:22;;;7045:62;7197:4;7179:23;;7173:30;7149:22;;;7142:62;7297:4;7279:23;;7273:30;7249:22;;;7242:62;7397:4;7379:23;;7373:30;7349:22;;;7342:62;7495:4;7477:23;;7471:30;7447:22;;;7440:62;7594:5;7576:24;;7570:31;7545:23;;;7538:64;7699:5;7681:24;;7675:31;7650:23;;;7643:64;7787:5;7769:24;;7763:31;;7738:23;;;7731:64;;;7895:5;7877:24;;7871:31;7846:23;;;7839:64;7979:5;8106:74;;8268:24;8340:19;;7962:23;;;8544:34;;;5025:11;;5422:28;;;;6536:27;;;;5736:26;;8606:22;;;;8388:23;;;;8464:4;8445:24;;8441:35;6190:1;8698:237;8721:13;8718:1;8715:20;8698:237;;;8791:19;;8771:40;;8860:4;8843:22;;;;8898:23;;;;8749:1;8742:9;8698:237;;;-1:-1:-1;;;;9045:31:42;;;9029:13;9010:33;;;9003:74;;;;9171:17;;9165:24;9237:19;;9441:34;;;9037:4;9503:22;;;;9285:23;;;;9361:4;9342:24;;9338:35;9610:1;9596:237;9619:13;9616:1;9613:20;9596:237;;;9689:19;;9669:40;;9758:4;9741:22;;;;9796:23;;;;9647:1;9640:9;9596:237;;;-1:-1:-1;;;9902:46:42;;;-1:-1:-1;10133:33:42;;;10003:4;9981:27;;;10108:59;;;10281:19;;10472:34;;;9981:27;;10534:22;;;;10329:23;;;;10281:19;10405:4;10386:24;;10382:35;-1:-1:-1;10613:237:42;10636:13;10633:1;10630:20;10613:237;;;10706:19;;10686:40;;10775:4;10758:22;;;;10813:23;;;;10664:1;10657:9;10613:237;;;-1:-1:-1;;;10928:46:42;;;;;10902:73;;-1:-1:-1;11041:4:42;11034:25;-1:-1:-1;;;;;1011:10099:42;;;;;:::o;8809:332:28:-;8927:26;;:::i;:::-;8956:19;8969:5;8956:12;:19::i;:::-;8927:48;;9014:35;9032:5;9039:9;9014:17;:35::i;:::-;9086:48;9107:5;9114:9;:19;;;9086:20;:48::i;16922:513:32:-;17102:30;;:::i;:::-;17162:103;17193:5;17212:20;17246:9;17162:17;:103::i;:::-;17296:34;;;;17148:117;;-1:-1:-1;17296:58:32;;17275:125;;;;;;;;;;;;;6909:918:47;7071:12;;7120:15;;;7099:78;;;;;;;;;;;;;;7250:11;;;:29;;-1:-1:-1;7265:14:47;;7250:29;7246:257;;;7487:5;7480:12;;;;7246:257;7634:11;7571:84;;;;;;;7611:9;7591:6;7571:84;7551:104;;7711:11;7677:31;7685:11;7698:9;7677:7;:31::i;:::-;:45;;;;;;;;7665:57;;7770:26;7778:9;7789:6;7770:7;:26::i;502:208:84:-;588:7;632:6;;;;611:70;;;;;;;;;;;;;;-1:-1:-1;698:5:84;;;502:208::o;8313:448:80:-;8397:13;8458:1;8447;:8;:12;8426:92;;;;;;;;;;;;;;;;8568:8;;8566:1;;8568:12;;;;8566:15;;;;;;;;;;8680:8;;8676:16;;8705:17;;;-1:-1:-1;8566:15:80;;;;;;;8313:448::o;13290:490::-;13411:14;13474:5;13482:2;13474:10;13462:1;:8;:22;;13441:107;;;;;;;;;;;;;;;;-1:-1:-1;13727:13:80;13629:2;13727:13;13721:20;;13290:490::o;8292:1482:30:-;8507:135;;8455:12;;8483:21;;8543:48;;8507:135;;8605:4;;8623:9;;8507:135;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;8507:135:30;;;49:4:-1;25:18;;;61:17;;8507:135:30;182:15:-1;8507:135:30;;;;179:29:-1;;;;160:49;;8943:15:30;;8507:135;;-1:-1:-1;49:4;25:18;;;8816:13:30;8763:3;8735:380;9136:7;9156:422;;;;9596:1;9591:143;;;;9129:605;;9156:422;9246:66;9243:1;9236:77;9341:66;9337:2;9330:78;9436:66;9432:2;9425:78;9531:1;9527:2;9520:13;9560:3;9557:1;9550:14;9591:143;-1:-1:-1;;9706:14:30;;8292:1482;-1:-1:-1;;;;;8292:1482:30:o;8956:482:80:-;9043:14;9106:2;9094:1;:8;:14;;9073:99;;;;;;;;;;;;;;;;9224:29;9236:1;9250:2;9239:1;:8;:13;9224:11;:29::i;:::-;9356:8;;9352:17;;9382;;;-1:-1:-1;9215:38:80;8956:482::o;10213:1561:30:-;10465:165;;10413:12;;10441:21;;10501:51;;10465:165;;10566:4;;10512:13;;10611:9;;10465:165;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;10465:165:30;;;49:4:-1;25:18;;;61:17;;10465:165:30;182:15:-1;10465:165:30;;;;179:29:-1;;;;160:49;;10937:15:30;;10465:165;;-1:-1:-1;49:4;25:18;;;10805:16:30;10751:3;10723:389;11133:7;11153:425;;;;11596:1;11591:143;;;;11126:608;;11153:425;11246:66;11243:1;11236:77;11341:66;11337:2;11330:78;11436:66;11432:2;11425:78;11531:1;11527:2;11520:13;11560:3;11557:1;11550:14;11591:143;11712:7;11706:14;11695:25;;11126:608;-1:-1:-1;;;10213:1561:30;;;;;;;:::o;3123:425:47:-;3287:21;3345:15;;;3324:78;;;;;;;;;;;;;;3429:82;3450:26;3458:9;3469:6;3450:7;:26::i;3175:1222:31:-;827:146:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;6:49;;827:146:53;;;;;;;;817:157;;3339:14:31;;;;;;827:146:53;;;;817:157;;;;827:146;817:157;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;817:157:53;;;;;;;;;;;3456:15:31;;817:157:53;;-1:-1:-1;3456:15:31;;-1:-1:-1;817:157:53;;-1:-1:-1;817:157:53;;3456:15:31;;;-1:-1:-1;3456:15:31;817:157:53;3456:15:31;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;3456:15:31;;;;;;;;;;;;3834:26;;;3960:15;;3953:29;;;;-1:-1:-1;4105:42:31;4086:62;;;;4069:15;;;4062:87;;;;-1:-1:-1;;4199:2:31;4187:15;;4180:33;-1:-1:-1;;4354:3:31;4336:22;;;;3175:1222;-1:-1:-1;3175:1222:31:o;1834:924:44:-;1985:18;;;2297:2;2291:9;2329:66;2314:82;;2434:14;;;2427:40;2564:2;2552:15;;2545:35;;;;2716:2;2698:21;;;1834:924::o;4211:202:48:-;4300:17;4345:35;4363:16;4373:5;4363:9;:16::i;1012:624:47:-;1180:21;1238:15;;;1217:78;;;;;;;;;;;;;;1328:114;1366:9;1393:11;1422:6;1328:20;:114::i;:::-;1327:115;1306:176;;;;;;;;;;;;;1959:889;2126:21;2184:15;;;2163:78;;;;;;;;;;;;;;2274:113;2311:9;2338:11;2367:6;2274:19;:113::i;:::-;2273:114;2252:175;;;;;;;;;;;;;16651:887:28;16802:30;;:::i;:::-;16897:34;;;:59;;;17078:22;;;;17114;;;;17003:143;;16934:22;;17003:25;:143::i;:::-;16966:180;;;17270:22;;;;17306:14;;;;17183:147;;16966:180;17270:22;17183:25;:147::i;:::-;17156:24;;;:174;17442:22;;;;17478:14;;;;17367:135;;17406:22;;17367:25;:135::i;:::-;17340:24;;;:162;16651:887;;;;:::o;51:288:84:-;137:7;;164:6;;160:45;;;193:1;186:8;;;;160:45;-1:-1:-1;226:5:84;;;230:1;226;:5;262;;;;;;;;:10;241:73;;;;;;;;;;;;;;331:1;324:8;;51:288;;;;;;:::o;716:230::-;802:7;837:5;;;873:6;;;;852:69;;;;;;;;;;;;;345:151;431:7;454:9;470:1;466;:5;;;;;;;;;345:151;-1:-1:-1;;;;345:151:84:o;1371:135::-;1456:7;1490:1;1486;:5;:13;;1498:1;1486:13;;17848:932:28;18055:14;18027:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:25;;:42;;18055:14;;18027:42;;18055:14;18027:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18079:170;18113:5;:20;;;18147:5;:18;;;18179:12;18205:11;:34;;;18079:20;:170::i;:::-;18259;18293:5;:20;;;18327:12;18353:5;:18;;;18385:11;:34;;;18259:20;:170::i;:::-;18439:165;18473:12;18499:5;:18;;;18531:5;:25;;;18570:11;:24;;;18439:20;:165::i;:::-;18614:159;18648:12;18674;18700:5;:25;;;18739:11;:24;;;2482:5147:27;3031:19;3290:18;2718:1;2709:6;:10;:24;;;;;2731:2;2723:10;;:4;:10;;;;2709:24;2705:4918;;;2822:16;;2841:1;-1:-1:-1;2797:109:27;;;;;;;;;;;;;;-1:-1:-1;;3153:2:27;3138:18;;;3111:46;3179:66;3107:156;3311:26;;;;:12;:26;;;;;;;;;;3422:24;;;3397:109;;;;;;;;;;;;;;4923:2;4917:9;5239:15;5234:2;5222:9;5216:16;5212:25;5208:47;5392:14;5387:3;5383:24;5374:7;5370:38;5676:66;5667:7;5660:83;6160:3;6156:1;6147:7;6143:15;6136:28;6216:42;6210:4;6206:53;6201:2;6192:7;6188:16;6181:79;6310:42;6306:2;6302:51;6297:2;6288:7;6284:16;6277:77;6397:6;6391:3;6382:7;6378:17;6371:33;6563:3;6554:7;6550:17;6645:206;6665:5;6655:8;6652:19;6645:206;;;6714:16;;6697:34;;6778:2;6815:18;;;;6764:17;6645:206;;;7417:3;7346:7;7292;7285:5;7281:19;7208:7;7142:1;7067:10;7004:3;6978:512;7517:7;7510:15;7507:2;;;7564:16;7555:7;7548:33;7507:2;4724:2889;;;;;;2482:5147;;;;;;:::o;15564:816:28:-;15828:21;;16220:20;;15828:52;;15859:20;15828:52;15807:115;;;;;;;;;;;;;;15996:19;;;;:33;;;15992:170;;16070:19;;;;:33;;16093:10;16070:33;16045:106;;;;;;;;;;;;;;16243:26;:24;:26::i;:::-;16300:18;;16220:49;;-1:-1:-1;16300:34:28;;;;;;;16279:94;;;;;;;;;;;;;;15564:816;;;:::o;10478:422::-;10626:20;;;;:9;:20;;;;;;;:27;;;;10649:4;10626:27;;;10743:25;;;;10711:18;;10829:20;;;;10863;;;;10691:202;;10636:9;;10691:202;;;;;;;;;;;;;;10782:10;;10863:20;10691:202;;;;;;;;;;10478:422;;:::o;10268:886:80:-;10389:14;10452:5;10460:2;10452:10;10440:1;:8;:22;;10419:135;;;;;;;;;;;;;;;;-1:-1:-1;11056:13:80;10801:2;11056:13;11050:20;11072:42;11046:69;;10268:886::o;4553:1678:48:-;777:457;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;777:457:48;;;;;;;;767:468;;4639:14;;;;;;;;777:457;;;;;767:468;;;;777:457;767:468;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;767:468:48;;;;;;;;;;;4763:20;;;;4753:31;;767:468;;-1:-1:-1;4763:20:48;-1:-1:-1;767:468:48;;-1:-1:-1;767:468:48;;4753:31;;;-1:-1:-1;4753:31:48;767:468;4753:31;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;4753:31:48;;;;;;;;;;;4833:20;;;;4823:31;;4753;;-1:-1:-1;4833:20:48;-1:-1:-1;4753:31:48;;-1:-1:-1;4753:31:48;;4823;;;-1:-1:-1;4823:31:48;4753;4823;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;;;;365:33;;4823:31:48;;;;;;;;;;5620:14;;;5763:11;;5670:3;5659:15;;5800:11;;5710:3;5699:15;;;5837:11;;5903:24;;;5940:32;;;5985;;;6056:3;6040:20;;6109:19;;6141;;;-1:-1:-1;;;6173:19:48;;;-1:-1:-1;6040:20:48;;4553:1678;-1:-1:-1;4553:1678:48:o;723:5376:65:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;;;:::o;:::-;;;;;;;;;-1:-1:-1;723:5376:65;;;;;;;;;;;;;;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;146:693;;261:4;249:17;;245:27;-1:-1;235:2;;286:1;283;276:12;235:2;323:6;310:20;345:85;360:69;422:6;360:69;;;345:85;;;458:21;;;502:4;490:17;;;;336:94;;-1:-1;515:14;;490:17;610:1;595:238;620:6;617:1;614:13;595:238;;;703:3;690:17;682:6;678:30;727:42;765:3;753:10;727:42;;;715:55;;-1:-1;793:4;784:14;;;;812;;;;;642:1;635:9;595:238;;;599:14;228:611;;;;;;;;879:735;;1008:4;996:17;;992:27;-1:-1;982:2;;1033:1;1030;1023:12;982:2;1070:6;1057:20;1092:99;1107:83;1183:6;1107:83;;1092:99;1219:21;;;1263:4;1251:17;;;;1083:108;;-1:-1;1276:14;;1251:17;1371:1;1356:252;1381:6;1378:1;1375:13;1356:252;;;1464:3;1451:17;1443:6;1439:30;1488:56;1540:3;1528:10;1488:56;;;1476:69;;-1:-1;1568:4;1559:14;;;;1587;;;;;1403:1;1396:9;1356:252;;1640:707;;1750:4;1738:17;;1734:27;-1:-1;1724:2;;1775:1;1772;1765:12;1724:2;1812:6;1799:20;1834:80;1849:64;1906:6;1849:64;;1834:80;1825:89;;1931:5;1956:6;1949:5;1942:21;1986:4;1978:6;1974:17;1964:27;;2008:4;2003:3;1999:14;1992:21;;2061:6;2108:3;2100:4;2092:6;2088:17;2083:3;2079:27;2076:36;2073:2;;;2125:1;2122;2115:12;2073:2;2150:1;2135:206;2160:6;2157:1;2154:13;2135:206;;;2218:3;2240:37;2273:3;2261:10;2240:37;;;2228:50;;-1:-1;2301:4;2292:14;;;;2320;;;;;2182:1;2175:9;2135:206;;2355:112;;2419:43;2454:6;2441:20;2419:43;;2474:118;;2541:46;2579:6;2566:20;2541:46;;2599:116;;2665:45;2702:6;2689:20;2665:45;;2722:120;;2799:38;2829:6;2823:13;2799:38;;2863:335;;;2970:4;2958:17;;2954:27;-1:-1;2944:2;;2995:1;2992;2985:12;2944:2;-1:-1;3015:20;;3055:18;3044:30;;3041:2;;;3087:1;3084;3077:12;3041:2;3121:4;3113:6;3109:17;3097:29;;3171:3;3164;3156:6;3152:16;3142:8;3138:31;3135:40;3132:2;;;3188:1;3185;3178:12;3132:2;2937:261;;;;;;3207:432;;3297:4;3285:17;;3281:27;-1:-1;3271:2;;3322:1;3319;3312:12;3271:2;3359:6;3346:20;3381:60;3396:44;3433:6;3396:44;;3381:60;3372:69;;3461:6;3454:5;3447:21;3497:4;3489:6;3485:17;3530:4;3523:5;3519:16;3565:3;3556:6;3551:3;3547:16;3544:25;3541:2;;;3582:1;3579;3572:12;3541:2;3592:41;3626:6;3621:3;3616;3592:41;;;3264:375;;;;;;;;4136:811;;4255:4;4243:9;4238:3;4234:19;4230:30;4227:2;;;4273:1;4270;4263:12;4227:2;4291:20;4306:4;4291:20;;;4282:29;-1:-1;4379:1;4410:49;4455:3;4435:9;4410:49;;;4386:74;;-1:-1;4539:2;4572:49;4617:3;4593:22;;;4572:49;;;4565:4;4558:5;4554:16;4547:75;4481:152;4691:2;4724:49;4769:3;4760:6;4749:9;4745:22;4724:49;;;4717:4;4710:5;4706:16;4699:75;4643:142;4843:2;4876:49;4921:3;4912:6;4901:9;4897:22;4876:49;;;4869:4;4862:5;4858:16;4851:75;4795:142;4221:726;;;;;4982:2205;;5090:5;5078:9;5073:3;5069:19;5065:31;5062:2;;;5109:1;5106;5099:12;5062:2;5127:21;5142:5;5127:21;;;5118:30;-1:-1;5206:1;5237:49;5282:3;5262:9;5237:49;;;5213:74;;-1:-1;5356:2;5389:49;5434:3;5410:22;;;5389:49;;;5382:4;5375:5;5371:16;5364:75;5308:142;5515:2;5548:49;5593:3;5584:6;5573:9;5569:22;5548:49;;;5541:4;5534:5;5530:16;5523:75;5460:149;5668:2;5701:49;5746:3;5737:6;5726:9;5722:22;5701:49;;;5694:4;5687:5;5683:16;5676:75;5619:143;5824:3;5858:49;5903:3;5894:6;5883:9;5879:22;5858:49;;;5851:4;5844:5;5840:16;5833:75;5772:147;5981:3;6015:49;6060:3;6051:6;6040:9;6036:22;6015:49;;;6008:4;6001:5;5997:16;5990:75;5929:147;6130:3;6164:49;6209:3;6200:6;6189:9;6185:22;6164:49;;;6157:4;6150:5;6146:16;6139:75;6086:139;6279:3;6313:49;6358:3;6349:6;6338:9;6334:22;6313:49;;;6306:4;6299:5;6295:16;6288:75;6235:139;6441:3;6476:49;6521:3;6512:6;6501:9;6497:22;6476:49;;;6468:5;6461;6457:17;6450:76;6384:153;6587:3;6622:49;6667:3;6658:6;6647:9;6643:22;6622:49;;;6614:5;6607;6603:17;6596:76;6547:136;6771:3;6760:9;6756:19;6743:33;6796:18;6788:6;6785:30;6782:2;;;6828:1;6825;6818:12;6782:2;6864:54;6914:3;6905:6;6894:9;6890:22;6864:54;;;6856:5;6849;6845:17;6838:81;6693:237;7018:3;7007:9;7003:19;6990:33;7043:18;7035:6;7032:30;7029:2;;;7075:1;7072;7065:12;7029:2;7111:54;7161:3;7152:6;7141:9;7137:22;7111:54;;;7103:5;7096;7092:17;7085:81;6940:237;5056:2131;;;;;9563:241;;9667:2;9655:9;9646:7;9642:23;9638:32;9635:2;;;9683:1;9680;9673:12;9635:2;9718:1;9735:53;9780:7;9760:9;9735:53;;;9725:63;9629:175;-1:-1;;;;9629:175;9811:366;;;9932:2;9920:9;9911:7;9907:23;9903:32;9900:2;;;9948:1;9945;9938:12;9900:2;9983:1;10000:53;10045:7;10025:9;10000:53;;;9990:63;;9962:97;10090:2;10108:53;10153:7;10144:6;10133:9;10129:22;10108:53;;;10098:63;;10069:98;9894:283;;;;;;10184:360;;;10302:2;10290:9;10281:7;10277:23;10273:32;10270:2;;;10318:1;10315;10308:12;10270:2;10353:1;10370:53;10415:7;10395:9;10370:53;;;10360:63;;10332:97;10460:2;10478:50;10520:7;10511:6;10500:9;10496:22;10478:50;;10551:415;;10699:2;10687:9;10678:7;10674:23;10670:32;10667:2;;;10715:1;10712;10705:12;10667:2;10750:31;;10801:18;10790:30;;10787:2;;;10833:1;10830;10823:12;10787:2;10853:97;10942:7;10933:6;10922:9;10918:22;10853:97;;10973:947;;;;11210:2;11198:9;11189:7;11185:23;11181:32;11178:2;;;11226:1;11223;11216:12;11178:2;11261:31;;11312:18;11301:30;;11298:2;;;11344:1;11341;11334:12;11298:2;11364:97;11453:7;11444:6;11433:9;11429:22;11364:97;;;11354:107;;11240:227;11526:2;11515:9;11511:18;11498:32;11550:18;11542:6;11539:30;11536:2;;;11582:1;11579;11572:12;11536:2;11602:78;11672:7;11663:6;11652:9;11648:22;11602:78;;;11592:88;;11477:209;11745:2;11734:9;11730:18;11717:32;11769:18;11761:6;11758:30;11755:2;;;11801:1;11798;11791:12;11755:2;11821:83;11896:7;11887:6;11876:9;11872:22;11821:83;;;11811:93;;11696:214;11172:748;;;;;;11927:811;;;;12139:2;12127:9;12118:7;12114:23;12110:32;12107:2;;;12155:1;12152;12145:12;12107:2;12190:31;;12241:18;12230:30;;12227:2;;;12273:1;12270;12263:12;12227:2;12293:97;12382:7;12373:6;12362:9;12358:22;12293:97;;;12283:107;;12169:227;12427:2;12445:53;12490:7;12481:6;12470:9;12466:22;12445:53;;12745:241;;12849:2;12837:9;12828:7;12824:23;12820:32;12817:2;;;12865:1;12862;12855:12;12817:2;12900:1;12917:53;12962:7;12942:9;12917:53;;12993:366;;;13114:2;13102:9;13093:7;13089:23;13085:32;13082:2;;;13130:1;13127;13120:12;13082:2;13165:1;13182:53;13227:7;13207:9;13182:53;;13366:615;;;;;13523:2;13511:9;13502:7;13498:23;13494:32;13491:2;;;13539:1;13536;13529:12;13491:2;13574:1;13591:53;13636:7;13616:9;13591:53;;;13581:63;;13553:97;13681:2;13699:53;13744:7;13735:6;13724:9;13720:22;13699:53;;;13689:63;;13660:98;13817:2;13806:9;13802:18;13789:32;13841:18;13833:6;13830:30;13827:2;;;13873:1;13870;13863:12;13827:2;13901:64;13957:7;13948:6;13937:9;13933:22;13901:64;;;13485:496;;;;-1:-1;13883:82;-1:-1;;;;13485:496;13988:595;;;;14135:2;14123:9;14114:7;14110:23;14106:32;14103:2;;;14151:1;14148;14141:12;14103:2;14186:1;14203:53;14248:7;14228:9;14203:53;;;14193:63;;14165:97;14293:2;14311:53;14356:7;14347:6;14336:9;14332:22;14311:53;;;14301:63;;14272:98;14429:2;14418:9;14414:18;14401:32;14453:18;14445:6;14442:30;14439:2;;;14485:1;14482;14475:12;14439:2;14505:62;14559:7;14550:6;14539:9;14535:22;14505:62;;14590:239;;14693:2;14681:9;14672:7;14668:23;14664:32;14661:2;;;14709:1;14706;14699:12;14661:2;14744:1;14761:52;14805:7;14785:9;14761:52;;14836:261;;14950:2;14938:9;14929:7;14925:23;14921:32;14918:2;;;14966:1;14963;14956:12;14918:2;15001:1;15018:63;15073:7;15053:9;15018:63;;15104:488;;;15285:3;15273:9;15264:7;15260:23;15256:33;15253:2;;;15302:1;15299;15292:12;15253:2;15337:1;15354:83;15429:7;15409:9;15354:83;;;15344:93;;15316:127;15474:3;15493:83;15568:7;15559:6;15548:9;15544:22;15493:83;;15599:373;;15726:2;15714:9;15705:7;15701:23;15697:32;15694:2;;;15742:1;15739;15732:12;15694:2;15777:31;;15828:18;15817:30;;15814:2;;;15860:1;15857;15850:12;15814:2;15880:76;15948:7;15939:6;15928:9;15924:22;15880:76;;15979:935;;;;;;16204:3;16192:9;16183:7;16179:23;16175:33;16172:2;;;16221:1;16218;16211:12;16172:2;16256:31;;16307:18;16296:30;;16293:2;;;16339:1;16336;16329:12;16293:2;16359:76;16427:7;16418:6;16407:9;16403:22;16359:76;;;16349:86;;16235:206;16472:2;16490:53;16535:7;16526:6;16515:9;16511:22;16490:53;;;16480:63;;16451:98;16580:2;16598:53;16643:7;16634:6;16623:9;16619:22;16598:53;;;16588:63;;16559:98;16688:2;16706:53;16751:7;16742:6;16731:9;16727:22;16706:53;;;16696:63;;16667:98;16796:3;16815:83;16890:7;16881:6;16870:9;16866:22;16815:83;;;16805:93;;16775:129;16166:748;;;;;;;;;16921:1089;;;;;17140:3;17128:9;17119:7;17115:23;17111:33;17108:2;;;17157:1;17154;17147:12;17108:2;17192:31;;17243:18;17232:30;;17229:2;;;17275:1;17272;17265:12;17229:2;17295:76;17363:7;17354:6;17343:9;17339:22;17295:76;;;17285:86;;17171:206;17436:2;17425:9;17421:18;17408:32;17460:18;17452:6;17449:30;17446:2;;;17492:1;17489;17482:12;17446:2;17512:76;17580:7;17571:6;17560:9;17556:22;17512:76;;;17502:86;;17387:207;17653:2;17642:9;17638:18;17625:32;17677:18;17669:6;17666:30;17663:2;;;17709:1;17706;17699:12;17663:2;17729:62;17783:7;17774:6;17763:9;17759:22;17729:62;;;17719:72;;17604:193;17856:2;17845:9;17841:18;17828:32;17880:18;17872:6;17869:30;17866:2;;;17912:1;17909;17902:12;17866:2;17932:62;17986:7;17977:6;17966:9;17962:22;17932:62;;;17922:72;;17807:193;17102:908;;;;;;;;18017:498;;;18161:2;18149:9;18140:7;18136:23;18132:32;18129:2;;;18177:1;18174;18167:12;18129:2;18212:31;;18263:18;18252:30;;18249:2;;;18295:1;18292;18285:12;18249:2;18315:76;18383:7;18374:6;18363:9;18359:22;18315:76;;;18305:86;;18191:206;18428:2;18446:53;18491:7;18482:6;18471:9;18467:22;18446:53;;18522:727;;;;18692:2;18680:9;18671:7;18667:23;18663:32;18660:2;;;18708:1;18705;18698:12;18660:2;18743:31;;18794:18;18783:30;;18780:2;;;18826:1;18823;18816:12;18780:2;18846:76;18914:7;18905:6;18894:9;18890:22;18846:76;;;18836:86;;18722:206;18959:2;18977:53;19022:7;19013:6;19002:9;18998:22;18977:53;;19504:865;;;;;;;19697:3;19685:9;19676:7;19672:23;19668:33;19665:2;;;19714:1;19711;19704:12;19665:2;19749:1;19766:53;19811:7;19791:9;19766:53;;;19756:63;;19728:97;19856:2;19874:53;19919:7;19910:6;19899:9;19895:22;19874:53;;;19864:63;;19835:98;19992:2;19981:9;19977:18;19964:32;20016:18;20008:6;20005:30;20002:2;;;20048:1;20045;20038:12;20002:2;20076:64;20132:7;20123:6;20112:9;20108:22;20076:64;;;20058:82;;;;19943:203;20205:2;20194:9;20190:18;20177:32;20229:18;20221:6;20218:30;20215:2;;;20261:1;20258;20251:12;20215:2;20289:64;20345:7;20336:6;20325:9;20321:22;20289:64;;;20271:82;;;;20156:203;19659:710;;;;;;;;;20376:491;;;;20514:2;20502:9;20493:7;20489:23;20485:32;20482:2;;;20530:1;20527;20520:12;20482:2;20565:1;20582:53;20627:7;20607:9;20582:53;;;20572:63;;20544:97;20672:2;20690:53;20735:7;20726:6;20715:9;20711:22;20690:53;;;20680:63;;20651:98;20780:2;20798:53;20843:7;20834:6;20823:9;20819:22;20798:53;;20874:110;20947:31;20972:5;20947:31;;;20942:3;20935:44;20929:55;;;21058:755;;21239:77;21310:5;21239:77;;;21334:6;21329:3;21322:19;21358:4;21353:3;21349:14;21342:21;;21403:79;21476:5;21403:79;;;21503:1;21488:303;21513:6;21510:1;21507:13;21488:303;;;21553:103;21652:3;21643:6;21637:13;21553:103;;;21673:83;21749:6;21673:83;;;21779:4;21770:14;;;;;21663:93;-1:-1;21535:1;21528:9;21488:303;;;-1:-1;21804:3;;21218:595;-1:-1;;;;21218:595;21821:101;21888:28;21910:5;21888:28;;21929:110;22002:31;22027:5;22002:31;;22046:107;22117:30;22141:5;22117:30;;22160:297;;22260:38;22292:5;22260:38;;;22315:6;22310:3;22303:19;22327:63;22383:6;22376:4;22371:3;22367:14;22360:4;22353:5;22349:16;22327:63;;;22422:29;22444:6;22422:29;;;22402:50;;;22415:4;22402:50;;22240:217;-1:-1;;;22240:217;22760:156;22853:57;22904:5;22853:57;;23223:296;23378:2;23366:15;;23415:66;23410:2;23401:12;;23394:88;23510:2;23501:12;;23359:160;23528:296;23683:2;23671:15;;23720:66;23715:2;23706:12;;23699:88;23815:2;23806:12;;23664:160;23833:296;23988:2;23976:15;;24025:66;24020:2;24011:12;;24004:88;24120:2;24111:12;;23969:160;24138:296;24293:2;24281:15;;24330:66;24325:2;24316:12;;24309:88;24425:2;24416:12;;24274:160;24443:296;24598:2;24586:15;;24635:66;24630:2;24621:12;;24614:88;24730:2;24721:12;;24579:160;24748:397;24903:2;24891:15;;24940:66;24935:2;24926:12;;24919:88;25041:66;25036:2;25027:12;;25020:88;25136:2;25127:12;;24884:261;25154:296;25309:2;25297:15;;25346:66;25341:2;25332:12;;25325:88;25441:2;25432:12;;25290:160;25459:296;25614:2;25602:15;;25651:66;25646:2;25637:12;;25630:88;25746:2;25737:12;;25595:160;25764:296;25919:2;25907:15;;25956:66;25951:2;25942:12;;25935:88;26051:2;26042:12;;25900:160;26069:296;26224:2;26212:15;;26261:66;26256:2;26247:12;;26240:88;26356:2;26347:12;;26205:160;26374:296;26529:2;26517:15;;26566:66;26561:2;26552:12;;26545:88;26661:2;26652:12;;26510:160;26679:296;26834:2;26822:15;;26871:66;26866:2;26857:12;;26850:88;26966:2;26957:12;;26815:160;26984:296;27139:2;27127:15;;27176:66;27171:2;27162:12;;27155:88;27271:2;27262:12;;27120:160;27289:296;27444:2;27432:15;;27481:66;27476:2;27467:12;;27460:88;27576:2;27567:12;;27425:160;27594:296;27749:2;27737:15;;27786:66;27781:2;27772:12;;27765:88;27881:2;27872:12;;27730:160;27899:296;28054:2;28042:15;;28091:66;28086:2;28077:12;;28070:88;28186:2;28177:12;;28035:160;28204:296;28359:2;28347:15;;28396:66;28391:2;28382:12;;28375:88;28491:2;28482:12;;28340:160;28509:296;28664:2;28652:15;;28701:66;28696:2;28687:12;;28680:88;28796:2;28787:12;;28645:160;28814:397;28969:2;28957:15;;29006:66;29001:2;28992:12;;28985:88;29107:66;29102:2;29093:12;;29086:88;29202:2;29193:12;;28950:261;29220:296;29375:2;29363:15;;29412:66;29407:2;29398:12;;29391:88;29507:2;29498:12;;29356:160;29525:296;29680:2;29668:15;;29717:66;29712:2;29703:12;;29696:88;29812:2;29803:12;;29661:160;29830:296;29985:2;29973:15;;30022:66;30017:2;30008:12;;30001:88;30117:2;30108:12;;29966:160;30135:296;30290:2;30278:15;;30327:66;30322:2;30313:12;;30306:88;30422:2;30413:12;;30271:160;30440:296;30595:2;30583:15;;30632:66;30627:2;30618:12;;30611:88;30727:2;30718:12;;30576:160;30745:296;30900:2;30888:15;;30937:66;30932:2;30923:12;;30916:88;31032:2;31023:12;;30881:160;31050:296;31205:2;31193:15;;31242:66;31237:2;31228:12;;31221:88;31337:2;31328:12;;31186:160;31355:296;31510:2;31498:15;;31547:66;31542:2;31533:12;;31526:88;31642:2;31633:12;;31491:160;31660:397;31815:2;31803:15;;31852:66;31847:2;31838:12;;31831:88;31953:66;31948:2;31939:12;;31932:88;32048:2;32039:12;;31796:261;32066:296;32221:2;32209:15;;32258:66;32253:2;32244:12;;32237:88;32353:2;32344:12;;32202:160;32371:296;32526:2;32514:15;;32563:66;32558:2;32549:12;;32542:88;32658:2;32649:12;;32507:160;32676:296;32831:2;32819:15;;32868:66;32863:2;32854:12;;32847:88;32963:2;32954:12;;32812:160;32981:296;33136:2;33124:15;;33173:66;33168:2;33159:12;;33152:88;33268:2;33259:12;;33117:160;33286:296;33441:2;33429:15;;33478:66;33473:2;33464:12;;33457:88;33573:2;33564:12;;33422:160;33667:890;33897:22;;33810:4;33801:14;;;33931:61;33805:3;33897:22;33931:61;;;33830:174;34098:4;34091:5;34087:16;34081:23;34116:62;34172:4;34167:3;34163:14;34150:11;34116:62;;;34014:176;34274:4;34267:5;34263:16;34257:23;34292:62;34348:4;34343:3;34339:14;34326:11;34292:62;;;34200:166;34450:4;34443:5;34439:16;34433:23;34468:62;34524:4;34519:3;34515:14;34502:11;34468:62;;35625:821;35852:22;;35782:5;35773:15;;;35886:117;35777:3;35852:22;35886:117;;;35803:212;36092:4;36085:5;36081:16;36075:23;36110:118;36222:4;36217:3;36213:14;36200:11;36110:118;;;36025:215;36338:4;36331:5;36327:16;36321:23;36356:63;36412:5;36407:3;36403:15;36390:11;36356:63;;36514:695;36727:22;;36651:4;36642:14;;;36761:57;36646:3;36727:22;36761:57;;;36671:159;36911:4;36904:5;36900:16;36894:23;36929:62;36985:4;36980:3;36976:14;36963:11;36929:62;;;36840:163;37102:4;37095:5;37091:16;37085:23;37120:62;37176:4;37171:3;37167:14;37154:11;37120:62;;38092:104;38161:29;38184:5;38161:29;;38203:193;38311:2;38296:18;;38325:61;38300:9;38359:6;38325:61;;38403:1057;38735:3;38720:19;;38750:61;38724:9;38784:6;38750:61;;;38822:62;38880:2;38869:9;38865:18;38856:6;38822:62;;;38895;38953:2;38942:9;38938:18;38929:6;38895:62;;;38968;39026:2;39015:9;39011:18;39002:6;38968:62;;;39041:63;39099:3;39088:9;39084:19;39075:6;39041:63;;;39115;39173:3;39162:9;39158:19;39149:6;39115:63;;;39227:9;39221:4;39217:20;39211:3;39200:9;39196:19;39189:49;39252:62;39309:4;39300:6;39252:62;;;39244:70;;39363:9;39357:4;39353:20;39347:3;39336:9;39332:19;39325:49;39388:62;39445:4;39436:6;39388:62;;;39380:70;38706:754;-1:-1;;;;;;;;;;38706:754;39467:547;39659:2;39644:18;;39673:61;39648:9;39707:6;39673:61;;;39782:9;39776:4;39772:20;39767:2;39756:9;39752:18;39745:48;39807:62;39864:4;39855:6;39807:62;;;39799:70;;39917:9;39911:4;39907:20;39902:2;39891:9;39887:18;39880:48;39942:62;39999:4;39990:6;39942:62;;;39934:70;39630:384;-1:-1;;;;;39630:384;40021:433;40225:2;40239:47;;;40210:18;;40300:144;40210:18;40430:6;40300:144;;40461:181;40563:2;40548:18;;40577:55;40552:9;40605:6;40577:55;;40649:193;40757:2;40742:18;;40771:61;40746:9;40805:6;40771:61;;40849:479;41031:2;41016:18;;41045:61;41020:9;41079:6;41045:61;;;41117:62;41175:2;41164:9;41160:18;41151:6;41117:62;;;41227:9;41221:4;41217:20;41212:2;41201:9;41197:18;41190:48;41252:66;41313:4;41304:6;41252:66;;41335:378;41489:2;41474:18;;41503:61;41478:9;41537:6;41503:61;;;41612:9;41606:4;41602:20;41597:2;41586:9;41582:18;41575:48;41637:66;41698:4;41689:6;41637:66;;41720:489;41908:3;41893:19;;41923:61;41897:9;41957:6;41923:61;;;41995:58;42049:2;42038:9;42034:18;42025:6;41995:58;;;42064:62;42122:2;42111:9;42107:18;42098:6;42064:62;;;42137;42195:2;42184:9;42180:18;42171:6;42137:62;;42216:290;42350:2;42335:18;;42364:59;42339:9;42396:6;42364:59;;;42434:62;42492:2;42481:9;42477:18;42468:6;42434:62;;42513:269;42635:2;42649:47;;;42620:18;;42710:62;42620:18;42758:6;42710:62;;42789:233;42917:2;42902:18;;42931:81;42906:9;42985:6;42931:81;;43309:387;43490:2;43504:47;;;43475:18;;43565:121;43475:18;43565:121;;43703:387;43884:2;43898:47;;;43869:18;;43959:121;43869:18;43959:121;;44097:387;44278:2;44292:47;;;44263:18;;44353:121;44263:18;44353:121;;44491:387;44672:2;44686:47;;;44657:18;;44747:121;44657:18;44747:121;;44885:387;45066:2;45080:47;;;45051:18;;45141:121;45051:18;45141:121;;45279:387;45460:2;45474:47;;;45445:18;;45535:121;45445:18;45535:121;;45673:387;45854:2;45868:47;;;45839:18;;45929:121;45839:18;45929:121;;46067:387;46248:2;46262:47;;;46233:18;;46323:121;46233:18;46323:121;;46461:387;46642:2;46656:47;;;46627:18;;46717:121;46627:18;46717:121;;46855:387;47036:2;47050:47;;;47021:18;;47111:121;47021:18;47111:121;;47249:387;47430:2;47444:47;;;47415:18;;47505:121;47415:18;47505:121;;47643:387;47824:2;47838:47;;;47809:18;;47899:121;47809:18;47899:121;;48037:387;48218:2;48232:47;;;48203:18;;48293:121;48203:18;48293:121;;48431:387;48612:2;48626:47;;;48597:18;;48687:121;48597:18;48687:121;;48825:387;49006:2;49020:47;;;48991:18;;49081:121;48991:18;49081:121;;49219:387;49400:2;49414:47;;;49385:18;;49475:121;49385:18;49475:121;;49613:387;49794:2;49808:47;;;49779:18;;49869:121;49779:18;49869:121;;50007:387;50188:2;50202:47;;;50173:18;;50263:121;50173:18;50263:121;;50401:387;50582:2;50596:47;;;50567:18;;50657:121;50567:18;50657:121;;50795:387;50976:2;50990:47;;;50961:18;;51051:121;50961:18;51051:121;;51189:387;51370:2;51384:47;;;51355:18;;51445:121;51355:18;51445:121;;51583:387;51764:2;51778:47;;;51749:18;;51839:121;51749:18;51839:121;;51977:387;52158:2;52172:47;;;52143:18;;52233:121;52143:18;52233:121;;52371:387;52552:2;52566:47;;;52537:18;;52627:121;52537:18;52627:121;;52765:387;52946:2;52960:47;;;52931:18;;53021:121;52931:18;53021:121;;53159:387;53340:2;53354:47;;;53325:18;;53415:121;53325:18;53415:121;;53553:387;53734:2;53748:47;;;53719:18;;53809:121;53719:18;53809:121;;53947:387;54128:2;54142:47;;;54113:18;;54203:121;54113:18;54203:121;;54341:387;54522:2;54536:47;;;54507:18;;54597:121;54507:18;54597:121;;54735:387;54916:2;54930:47;;;54901:18;;54991:121;54901:18;54991:121;;55129:387;55310:2;55324:47;;;55295:18;;55385:121;55295:18;55385:121;;55523:387;55704:2;55718:47;;;55689:18;;55779:121;55689:18;55779:121;;55917:387;56098:2;56112:47;;;56083:18;;56173:121;56083:18;56173:121;;56311:314;56479:3;56464:19;;56494:121;56468:9;56588:6;56494:121;;56632:342;56814:3;56799:19;;56829:135;56803:9;56937:6;56829:135;;56981:301;57143:2;57128:18;;57157:115;57132:9;57245:6;57157:115;;57489:256;57551:2;57545:9;57577:17;;;57652:18;57637:34;;57673:22;;;57634:62;57631:2;;;57709:1;57706;57699:12;57631:2;57725;57718:22;57529:216;;-1:-1;57529:216;57752:263;;57916:18;57908:6;57905:30;57902:2;;;57948:1;57945;57938:12;57902:2;-1:-1;57977:4;57965:17;;;57995:15;;57839:176;58571:254;;58710:18;58702:6;58699:30;58696:2;;;58742:1;58739;58732:12;58696:2;-1:-1;58815:4;58786;58763:17;;;;58782:9;58759:33;58805:15;;58633:192;59099:144;59231:4;59219:17;;59200:43;59252:130;59365:12;;59349:33;59830:128;59910:42;59899:54;;59882:76;59965:92;60038:13;60031:21;;60014:43;60064:79;60133:5;60116:27;60150:151;60229:66;60218:78;;60201:100;60394:88;60472:4;60461:16;;60444:38;61053:135;;61152:31;61177:5;61152:31;;61196:145;61277:6;61272:3;61267;61254:30;-1:-1;61333:1;61315:16;;61308:27;61247:94;61350:268;61415:1;61422:101;61436:6;61433:1;61430:13;61422:101;;;61503:11;;;61497:18;61484:11;;;61477:39;61458:2;61451:10;61422:101;;;61538:6;61535:1;61532:13;61529:2;;;-1:-1;;61603:1;61585:16;;61578:27;61399:219;61626:97;61714:2;61694:14;61710:7;61690:28;;61674:49"
+ }
+ }
+ },
+ "sources": {
+ "test/TestExchangeInternals/TestExchangeInternals.sol": {
+ "id": 65
+ },
+ "protocol/Exchange/Exchange.sol": {
+ "id": 26
+ },
+ "protocol/Exchange/libs/LibConstants.sol": {
+ "id": 43
+ },
+ "protocol/Exchange/MixinExchangeCore.sol": {
+ "id": 28
+ },
+ "utils/ReentrancyGuard/ReentrancyGuard.sol": {
+ "id": 83
+ },
+ "protocol/Exchange/libs/LibFillResults.sol": {
+ "id": 46
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "protocol/Exchange/libs/LibOrder.sol": {
+ "id": 48
+ },
+ "protocol/Exchange/libs/LibEIP712.sol": {
+ "id": 44
+ },
+ "protocol/Exchange/libs/LibMath.sol": {
+ "id": 47
+ },
+ "protocol/Exchange/mixins/MExchangeCore.sol": {
+ "id": 50
+ },
+ "protocol/Exchange/interfaces/IExchangeCore.sol": {
+ "id": 35
+ },
+ "protocol/Exchange/mixins/MSignatureValidator.sol": {
+ "id": 52
+ },
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": {
+ "id": 37
+ },
+ "protocol/Exchange/mixins/MTransactions.sol": {
+ "id": 53
+ },
+ "protocol/Exchange/interfaces/ITransactions.sol": {
+ "id": 38
+ },
+ "protocol/Exchange/mixins/MAssetProxyDispatcher.sol": {
+ "id": 49
+ },
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": {
+ "id": 33
+ },
+ "protocol/Exchange/MixinSignatureValidator.sol": {
+ "id": 30
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ },
+ "protocol/Exchange/interfaces/IWallet.sol": {
+ "id": 40
+ },
+ "protocol/Exchange/interfaces/IValidator.sol": {
+ "id": 39
+ },
+ "protocol/Exchange/MixinWrapperFunctions.sol": {
+ "id": 32
+ },
+ "protocol/Exchange/libs/LibAbiEncoder.sol": {
+ "id": 42
+ },
+ "protocol/Exchange/mixins/MWrapperFunctions.sol": {
+ "id": 54
+ },
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": {
+ "id": 41
+ },
+ "protocol/Exchange/MixinAssetProxyDispatcher.sol": {
+ "id": 27
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ },
+ "protocol/AssetProxy/interfaces/IAssetProxy.sol": {
+ "id": 22
+ },
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": {
+ "id": 23
+ },
+ "protocol/Exchange/MixinTransactions.sol": {
+ "id": 31
+ },
+ "protocol/Exchange/libs/LibExchangeErrors.sol": {
+ "id": 45
+ },
+ "protocol/Exchange/MixinMatchOrders.sol": {
+ "id": 29
+ },
+ "protocol/Exchange/mixins/MMatchOrders.sol": {
+ "id": 51
+ },
+ "protocol/Exchange/interfaces/IMatchOrders.sol": {
+ "id": 36
+ }
+ },
+ "sourceCodes": {
+ "test/TestExchangeInternals/TestExchangeInternals.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../protocol/Exchange/Exchange.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract TestExchangeInternals is\n Exchange\n{\n constructor ()\n public\n Exchange(\"\")\n {}\n\n /// @dev Adds properties of both FillResults instances.\n /// Modifies the first FillResults instance specified.\n /// Note that this function has been modified from the original\n // internal version to return the FillResults.\n /// @param totalFillResults Fill results instance that will be added onto.\n /// @param singleFillResults Fill results instance that will be added to totalFillResults.\n /// @return newTotalFillResults The result of adding singleFillResults to totalFilResults.\n function publicAddFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)\n public\n pure\n returns (FillResults memory)\n {\n addFillResults(totalFillResults, singleFillResults);\n return totalFillResults;\n }\n\n /// @dev Calculates amounts filled and fees paid by maker and taker.\n /// @param order to be filled.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @return fillResults Amounts filled and fees paid by maker and taker.\n function publicCalculateFillResults(\n Order memory order,\n uint256 takerAssetFilledAmount\n )\n public\n pure\n returns (FillResults memory fillResults)\n {\n return calculateFillResults(order, takerAssetFilledAmount);\n }\n\n /// @dev Calculates partial value given a numerator and denominator.\n /// Reverts if rounding error is >= 0.1%\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target.\n function publicSafeGetPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n public\n pure\n returns (uint256 partialAmount)\n {\n return safeGetPartialAmountFloor(numerator, denominator, target);\n }\n\n /// @dev Calculates partial value given a numerator and denominator.\n /// Reverts if rounding error is >= 0.1%\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target.\n function publicSafeGetPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n public\n pure\n returns (uint256 partialAmount)\n {\n return safeGetPartialAmountCeil(numerator, denominator, target);\n }\n\n /// @dev Calculates partial value given a numerator and denominator.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target.\n function publicGetPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n public\n pure\n returns (uint256 partialAmount)\n {\n return getPartialAmountFloor(numerator, denominator, target);\n }\n\n /// @dev Calculates partial value given a numerator and denominator.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target.\n function publicGetPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n public\n pure\n returns (uint256 partialAmount)\n {\n return getPartialAmountCeil(numerator, denominator, target);\n }\n\n /// @dev Checks if rounding error >= 0.1%.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to multiply with numerator/denominator.\n /// @return Rounding error is present.\n function publicIsRoundingErrorFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n public\n pure\n returns (bool isError)\n {\n return isRoundingErrorFloor(numerator, denominator, target);\n }\n\n /// @dev Checks if rounding error >= 0.1%.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to multiply with numerator/denominator.\n /// @return Rounding error is present.\n function publicIsRoundingErrorCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n public\n pure\n returns (bool isError)\n {\n return isRoundingErrorCeil(numerator, denominator, target);\n }\n \n /// @dev Updates state with results of a fill order.\n /// @param order that was filled.\n /// @param takerAddress Address of taker who filled the order.\n /// @param orderTakerAssetFilledAmount Amount of order already filled.\n /// @return fillResults Amounts filled and fees paid by maker and taker.\n function publicUpdateFilledState(\n Order memory order,\n address takerAddress,\n bytes32 orderHash,\n uint256 orderTakerAssetFilledAmount,\n FillResults memory fillResults\n )\n public\n {\n updateFilledState(\n order,\n takerAddress,\n orderHash,\n orderTakerAssetFilledAmount,\n fillResults\n );\n }\n}\n",
+ "protocol/Exchange/Exchange.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./libs/LibConstants.sol\";\nimport \"./MixinExchangeCore.sol\";\nimport \"./MixinSignatureValidator.sol\";\nimport \"./MixinWrapperFunctions.sol\";\nimport \"./MixinAssetProxyDispatcher.sol\";\nimport \"./MixinTransactions.sol\";\nimport \"./MixinMatchOrders.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract Exchange is\n MixinExchangeCore,\n MixinMatchOrders,\n MixinSignatureValidator,\n MixinTransactions,\n MixinAssetProxyDispatcher,\n MixinWrapperFunctions\n{\n string constant public VERSION = \"2.0.1-alpha\";\n\n // Mixins are instantiated in the order they are inherited\n constructor (bytes memory _zrxAssetData)\n public\n LibConstants(_zrxAssetData) // @TODO: Remove when we deploy.\n MixinExchangeCore()\n MixinMatchOrders()\n MixinSignatureValidator()\n MixinTransactions()\n MixinAssetProxyDispatcher()\n MixinWrapperFunctions()\n {}\n}\n",
+ "protocol/Exchange/libs/LibConstants.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\n// solhint-disable max-line-length\ncontract LibConstants {\n \n // Asset data for ZRX token. Used for fee transfers.\n // @TODO: Hardcode constant when we deploy. Currently \n // not constant to make testing easier.\n\n // The proxyId for ZRX_ASSET_DATA is bytes4(keccak256(\"ERC20Token(address)\")) = 0xf47261b0\n \n // Kovan ZRX address is 0x6ff6c0ff1d68b964901f986d4c9fa3ac68346570.\n // The ABI encoded proxyId and address is 0xf47261b00000000000000000000000006ff6c0ff1d68b964901f986d4c9fa3ac68346570\n // bytes constant public ZRX_ASSET_DATA = \"\\xf4\\x72\\x61\\xb0\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x6f\\xf6\\xc0\\xff\\x1d\\x68\\xb9\\x64\\x90\\x1f\\x98\\x6d\\x4c\\x9f\\xa3\\xac\\x68\\x34\\x65\\x70\";\n \n // Mainnet ZRX address is 0xe41d2489571d322189246dafa5ebde1f4699f498.\n // The ABI encoded proxyId and address is 0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498\n // bytes constant public ZRX_ASSET_DATA = \"\\xf4\\x72\\x61\\xb0\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\xe4\\x1d\\x24\\x89\\x57\\x1d\\x32\\x21\\x89\\x24\\x6d\\xaf\\xa5\\xeb\\xde\\x1f\\x46\\x99\\xf4\\x98\";\n \n // solhint-disable-next-line var-name-mixedcase\n bytes public ZRX_ASSET_DATA;\n\n // @TODO: Remove when we deploy.\n constructor (bytes memory zrxAssetData)\n public\n {\n ZRX_ASSET_DATA = zrxAssetData;\n }\n}\n// solhint-enable max-line-length\n",
+ "protocol/Exchange/MixinExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../utils/ReentrancyGuard/ReentrancyGuard.sol\";\nimport \"./libs/LibConstants.sol\";\nimport \"./libs/LibFillResults.sol\";\nimport \"./libs/LibOrder.sol\";\nimport \"./libs/LibMath.sol\";\nimport \"./mixins/MExchangeCore.sol\";\nimport \"./mixins/MSignatureValidator.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./mixins/MAssetProxyDispatcher.sol\";\n\n\ncontract MixinExchangeCore is\n ReentrancyGuard,\n LibConstants,\n LibMath,\n LibOrder,\n LibFillResults,\n MAssetProxyDispatcher,\n MExchangeCore,\n MSignatureValidator,\n MTransactions\n{\n // Mapping of orderHash => amount of takerAsset already bought by maker\n mapping (bytes32 => uint256) public filled;\n\n // Mapping of orderHash => cancelled\n mapping (bytes32 => bool) public cancelled;\n\n // Mapping of makerAddress => senderAddress => lowest salt an order can have in order to be fillable\n // Orders with specified senderAddress and with a salt less than their epoch are considered cancelled\n mapping (address => mapping (address => uint256)) public orderEpoch;\n\n /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch\n /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).\n /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.\n function cancelOrdersUpTo(uint256 targetOrderEpoch)\n external\n nonReentrant\n {\n address makerAddress = getCurrentContextAddress();\n // If this function is called via `executeTransaction`, we only update the orderEpoch for the makerAddress/msg.sender combination.\n // This allows external filter contracts to add rules to how orders are cancelled via this function.\n address senderAddress = makerAddress == msg.sender ? address(0) : msg.sender;\n\n // orderEpoch is initialized to 0, so to cancelUpTo we need salt + 1\n uint256 newOrderEpoch = targetOrderEpoch + 1; \n uint256 oldOrderEpoch = orderEpoch[makerAddress][senderAddress];\n\n // Ensure orderEpoch is monotonically increasing\n require(\n newOrderEpoch > oldOrderEpoch, \n \"INVALID_NEW_ORDER_EPOCH\"\n );\n\n // Update orderEpoch\n orderEpoch[makerAddress][senderAddress] = newOrderEpoch;\n emit CancelUpTo(\n makerAddress,\n senderAddress,\n newOrderEpoch\n );\n }\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrder(\n Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n nonReentrant\n returns (FillResults memory fillResults)\n {\n fillResults = fillOrderInternal(\n order,\n takerAssetFillAmount,\n signature\n );\n return fillResults;\n }\n\n /// @dev After calling, the order can not be filled anymore.\n /// Throws if order is invalid or sender does not have permission to cancel.\n /// @param order Order to cancel. Order must be OrderStatus.FILLABLE.\n function cancelOrder(Order memory order)\n public\n nonReentrant\n {\n cancelOrderInternal(order);\n }\n\n /// @dev Gets information about an order: status, hash, and amount filled.\n /// @param order Order to gather information on.\n /// @return OrderInfo Information about the order and its state.\n /// See LibOrder.OrderInfo for a complete description.\n function getOrderInfo(Order memory order)\n public\n view\n returns (OrderInfo memory orderInfo)\n {\n // Compute the order hash\n orderInfo.orderHash = getOrderHash(order);\n\n // Fetch filled amount\n orderInfo.orderTakerAssetFilledAmount = filled[orderInfo.orderHash];\n\n // If order.makerAssetAmount is zero, we also reject the order.\n // While the Exchange contract handles them correctly, they create\n // edge cases in the supporting infrastructure because they have\n // an 'infinite' price when computed by a simple division.\n if (order.makerAssetAmount == 0) {\n orderInfo.orderStatus = uint8(OrderStatus.INVALID_MAKER_ASSET_AMOUNT);\n return orderInfo;\n }\n\n // If order.takerAssetAmount is zero, then the order will always\n // be considered filled because 0 == takerAssetAmount == orderTakerAssetFilledAmount\n // Instead of distinguishing between unfilled and filled zero taker\n // amount orders, we choose not to support them.\n if (order.takerAssetAmount == 0) {\n orderInfo.orderStatus = uint8(OrderStatus.INVALID_TAKER_ASSET_AMOUNT);\n return orderInfo;\n }\n\n // Validate order availability\n if (orderInfo.orderTakerAssetFilledAmount >= order.takerAssetAmount) {\n orderInfo.orderStatus = uint8(OrderStatus.FULLY_FILLED);\n return orderInfo;\n }\n\n // Validate order expiration\n // solhint-disable-next-line not-rely-on-time\n if (block.timestamp >= order.expirationTimeSeconds) {\n orderInfo.orderStatus = uint8(OrderStatus.EXPIRED);\n return orderInfo;\n }\n\n // Check if order has been cancelled\n if (cancelled[orderInfo.orderHash]) {\n orderInfo.orderStatus = uint8(OrderStatus.CANCELLED);\n return orderInfo;\n }\n if (orderEpoch[order.makerAddress][order.senderAddress] > order.salt) {\n orderInfo.orderStatus = uint8(OrderStatus.CANCELLED);\n return orderInfo;\n }\n\n // All other statuses are ruled out: order is Fillable\n orderInfo.orderStatus = uint8(OrderStatus.FILLABLE);\n return orderInfo;\n }\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderInternal(\n Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n returns (FillResults memory fillResults)\n {\n // Fetch order info\n OrderInfo memory orderInfo = getOrderInfo(order);\n\n // Fetch taker address\n address takerAddress = getCurrentContextAddress();\n \n // Assert that the order is fillable by taker\n assertFillableOrder(\n order,\n orderInfo,\n takerAddress,\n signature\n );\n \n // Get amount of takerAsset to fill\n uint256 remainingTakerAssetAmount = safeSub(order.takerAssetAmount, orderInfo.orderTakerAssetFilledAmount);\n uint256 takerAssetFilledAmount = min256(takerAssetFillAmount, remainingTakerAssetAmount);\n\n // Validate context\n assertValidFill(\n order,\n orderInfo,\n takerAssetFillAmount,\n takerAssetFilledAmount,\n fillResults.makerAssetFilledAmount\n );\n\n // Compute proportional fill amounts\n fillResults = calculateFillResults(order, takerAssetFilledAmount);\n\n // Update exchange internal state\n updateFilledState(\n order,\n takerAddress,\n orderInfo.orderHash,\n orderInfo.orderTakerAssetFilledAmount,\n fillResults\n );\n \n // Settle order\n settleOrder(\n order,\n takerAddress,\n fillResults\n );\n\n return fillResults;\n }\n\n /// @dev After calling, the order can not be filled anymore.\n /// Throws if order is invalid or sender does not have permission to cancel.\n /// @param order Order to cancel. Order must be OrderStatus.FILLABLE.\n function cancelOrderInternal(Order memory order)\n internal\n {\n // Fetch current order status\n OrderInfo memory orderInfo = getOrderInfo(order);\n\n // Validate context\n assertValidCancel(order, orderInfo);\n\n // Perform cancel\n updateCancelledState(order, orderInfo.orderHash);\n }\n\n /// @dev Updates state with results of a fill order.\n /// @param order that was filled.\n /// @param takerAddress Address of taker who filled the order.\n /// @param orderTakerAssetFilledAmount Amount of order already filled.\n function updateFilledState(\n Order memory order,\n address takerAddress,\n bytes32 orderHash,\n uint256 orderTakerAssetFilledAmount,\n FillResults memory fillResults\n )\n internal\n {\n // Update state\n filled[orderHash] = safeAdd(orderTakerAssetFilledAmount, fillResults.takerAssetFilledAmount);\n\n // Log order\n emit Fill(\n order.makerAddress,\n order.feeRecipientAddress,\n takerAddress,\n msg.sender,\n fillResults.makerAssetFilledAmount,\n fillResults.takerAssetFilledAmount,\n fillResults.makerFeePaid,\n fillResults.takerFeePaid,\n orderHash,\n order.makerAssetData,\n order.takerAssetData\n );\n }\n\n /// @dev Updates state with results of cancelling an order.\n /// State is only updated if the order is currently fillable.\n /// Otherwise, updating state would have no effect.\n /// @param order that was cancelled.\n /// @param orderHash Hash of order that was cancelled.\n function updateCancelledState(\n Order memory order,\n bytes32 orderHash\n )\n internal\n {\n // Perform cancel\n cancelled[orderHash] = true;\n\n // Log cancel\n emit Cancel(\n order.makerAddress,\n order.feeRecipientAddress,\n msg.sender,\n orderHash,\n order.makerAssetData,\n order.takerAssetData\n );\n }\n \n /// @dev Validates context for fillOrder. Succeeds or throws.\n /// @param order to be filled.\n /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.\n /// @param takerAddress Address of order taker.\n /// @param signature Proof that the orders was created by its maker.\n function assertFillableOrder(\n Order memory order,\n OrderInfo memory orderInfo,\n address takerAddress,\n bytes memory signature\n )\n internal\n view\n {\n // An order can only be filled if its status is FILLABLE.\n require(\n orderInfo.orderStatus == uint8(OrderStatus.FILLABLE),\n \"ORDER_UNFILLABLE\"\n );\n \n // Validate sender is allowed to fill this order\n if (order.senderAddress != address(0)) {\n require(\n order.senderAddress == msg.sender,\n \"INVALID_SENDER\"\n );\n }\n \n // Validate taker is allowed to fill this order\n if (order.takerAddress != address(0)) {\n require(\n order.takerAddress == takerAddress,\n \"INVALID_TAKER\"\n );\n }\n \n // Validate Maker signature (check only if first time seen)\n if (orderInfo.orderTakerAssetFilledAmount == 0) {\n require(\n isValidSignature(\n orderInfo.orderHash,\n order.makerAddress,\n signature\n ),\n \"INVALID_ORDER_SIGNATURE\"\n );\n }\n }\n \n /// @dev Validates context for fillOrder. Succeeds or throws.\n /// @param order to be filled.\n /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.\n /// @param takerAssetFillAmount Desired amount of order to fill by taker.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @param makerAssetFilledAmount Amount of makerAsset that will be transfered.\n function assertValidFill(\n Order memory order,\n OrderInfo memory orderInfo,\n uint256 takerAssetFillAmount, // TODO: use FillResults\n uint256 takerAssetFilledAmount,\n uint256 makerAssetFilledAmount\n )\n internal\n view\n {\n // Revert if fill amount is invalid\n // TODO: reconsider necessity for v2.1\n require(\n takerAssetFillAmount != 0,\n \"INVALID_TAKER_AMOUNT\"\n );\n \n // Make sure taker does not pay more than desired amount\n // NOTE: This assertion should never fail, it is here\n // as an extra defence against potential bugs.\n require(\n takerAssetFilledAmount <= takerAssetFillAmount,\n \"TAKER_OVERPAY\"\n );\n \n // Make sure order is not overfilled\n // NOTE: This assertion should never fail, it is here\n // as an extra defence against potential bugs.\n require(\n safeAdd(orderInfo.orderTakerAssetFilledAmount, takerAssetFilledAmount) <= order.takerAssetAmount,\n \"ORDER_OVERFILL\"\n );\n \n // Make sure order is filled at acceptable price.\n // The order has an implied price from the makers perspective:\n // order price = order.makerAssetAmount / order.takerAssetAmount\n // i.e. the number of makerAsset maker is paying per takerAsset. The\n // maker is guaranteed to get this price or a better (lower) one. The\n // actual price maker is getting in this fill is:\n // fill price = makerAssetFilledAmount / takerAssetFilledAmount\n // We need `fill price <= order price` for the fill to be fair to maker.\n // This amounts to:\n // makerAssetFilledAmount order.makerAssetAmount\n // ------------------------ <= -----------------------\n // takerAssetFilledAmount order.takerAssetAmount\n // or, equivalently:\n // makerAssetFilledAmount * order.takerAssetAmount <=\n // order.makerAssetAmount * takerAssetFilledAmount\n // NOTE: This assertion should never fail, it is here\n // as an extra defence against potential bugs.\n require(\n safeMul(makerAssetFilledAmount, order.takerAssetAmount)\n <= \n safeMul(order.makerAssetAmount, takerAssetFilledAmount),\n \"INVALID_FILL_PRICE\"\n );\n }\n\n /// @dev Validates context for cancelOrder. Succeeds or throws.\n /// @param order to be cancelled.\n /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.\n function assertValidCancel(\n Order memory order,\n OrderInfo memory orderInfo\n )\n internal\n view\n {\n // Ensure order is valid\n // An order can only be cancelled if its status is FILLABLE.\n require(\n orderInfo.orderStatus == uint8(OrderStatus.FILLABLE),\n \"ORDER_UNFILLABLE\"\n );\n\n // Validate sender is allowed to cancel this order\n if (order.senderAddress != address(0)) {\n require(\n order.senderAddress == msg.sender,\n \"INVALID_SENDER\"\n );\n }\n\n // Validate transaction signed by maker\n address makerAddress = getCurrentContextAddress();\n require(\n order.makerAddress == makerAddress,\n \"INVALID_MAKER\"\n );\n }\n\n /// @dev Calculates amounts filled and fees paid by maker and taker.\n /// @param order to be filled.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @return fillResults Amounts filled and fees paid by maker and taker.\n function calculateFillResults(\n Order memory order,\n uint256 takerAssetFilledAmount\n )\n internal\n pure\n returns (FillResults memory fillResults)\n {\n // Compute proportional transfer amounts\n fillResults.takerAssetFilledAmount = takerAssetFilledAmount;\n fillResults.makerAssetFilledAmount = safeGetPartialAmountFloor(\n takerAssetFilledAmount,\n order.takerAssetAmount,\n order.makerAssetAmount\n );\n fillResults.makerFeePaid = safeGetPartialAmountFloor(\n fillResults.makerAssetFilledAmount,\n order.makerAssetAmount,\n order.makerFee\n );\n fillResults.takerFeePaid = safeGetPartialAmountFloor(\n takerAssetFilledAmount,\n order.takerAssetAmount,\n order.takerFee\n );\n\n return fillResults;\n }\n\n /// @dev Settles an order by transferring assets between counterparties.\n /// @param order Order struct containing order specifications.\n /// @param takerAddress Address selling takerAsset and buying makerAsset.\n /// @param fillResults Amounts to be filled and fees paid by maker and taker.\n function settleOrder(\n LibOrder.Order memory order,\n address takerAddress,\n LibFillResults.FillResults memory fillResults\n )\n private\n {\n bytes memory zrxAssetData = ZRX_ASSET_DATA;\n dispatchTransferFrom(\n order.makerAssetData,\n order.makerAddress,\n takerAddress,\n fillResults.makerAssetFilledAmount\n );\n dispatchTransferFrom(\n order.takerAssetData,\n takerAddress,\n order.makerAddress,\n fillResults.takerAssetFilledAmount\n );\n dispatchTransferFrom(\n zrxAssetData,\n order.makerAddress,\n order.feeRecipientAddress,\n fillResults.makerFeePaid\n );\n dispatchTransferFrom(\n zrxAssetData,\n takerAddress,\n order.feeRecipientAddress,\n fillResults.takerFeePaid\n );\n }\n}\n",
+ "utils/ReentrancyGuard/ReentrancyGuard.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ReentrancyGuard {\n\n // Locked state of mutex\n bool private locked = false;\n\n /// @dev Functions with this modifer cannot be reentered. The mutex will be locked\n /// before function execution and unlocked after.\n modifier nonReentrant() {\n // Ensure mutex is unlocked\n require(\n !locked,\n \"REENTRANCY_ILLEGAL\"\n );\n\n // Lock mutex before function call\n locked = true;\n\n // Perform function call\n _;\n\n // Unlock mutex after function call\n locked = false;\n }\n}\n",
+ "protocol/Exchange/libs/LibFillResults.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibFillResults is\n SafeMath\n{\n struct FillResults {\n uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.\n uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.\n uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).\n uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).\n }\n\n struct MatchedFillResults {\n FillResults left; // Amounts filled and fees paid of left order.\n FillResults right; // Amounts filled and fees paid of right order.\n uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker.\n }\n\n /// @dev Adds properties of both FillResults instances.\n /// Modifies the first FillResults instance specified.\n /// @param totalFillResults Fill results instance that will be added onto.\n /// @param singleFillResults Fill results instance that will be added to totalFillResults.\n function addFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)\n internal\n pure\n {\n totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);\n totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);\n totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);\n totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "protocol/Exchange/libs/LibOrder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./LibEIP712.sol\";\n\n\ncontract LibOrder is\n LibEIP712\n{\n // Hash for the EIP712 Order Schema\n bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"Order(\",\n \"address makerAddress,\",\n \"address takerAddress,\",\n \"address feeRecipientAddress,\",\n \"address senderAddress,\",\n \"uint256 makerAssetAmount,\",\n \"uint256 takerAssetAmount,\",\n \"uint256 makerFee,\",\n \"uint256 takerFee,\",\n \"uint256 expirationTimeSeconds,\",\n \"uint256 salt,\",\n \"bytes makerAssetData,\",\n \"bytes takerAssetData\",\n \")\"\n ));\n\n // A valid order remains fillable until it is expired, fully filled, or cancelled.\n // An order's state is unaffected by external factors, like account balances.\n enum OrderStatus {\n INVALID, // Default value\n INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount\n INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount\n FILLABLE, // Order is fillable\n EXPIRED, // Order has already expired\n FULLY_FILLED, // Order is fully filled\n CANCELLED // Order has been cancelled\n }\n\n // solhint-disable max-line-length\n struct Order {\n address makerAddress; // Address that created the order. \n address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. \n address feeRecipientAddress; // Address that will recieve fees when order is filled. \n address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.\n uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. \n uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. \n uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.\n uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.\n uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. \n uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. \n bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.\n bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.\n }\n // solhint-enable max-line-length\n\n struct OrderInfo {\n uint8 orderStatus; // Status that describes order's validity and fillability.\n bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash).\n uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled.\n }\n\n /// @dev Calculates Keccak-256 hash of the order.\n /// @param order The order structure.\n /// @return Keccak-256 EIP712 hash of the order.\n function getOrderHash(Order memory order)\n internal\n view\n returns (bytes32 orderHash)\n {\n orderHash = hashEIP712Message(hashOrder(order));\n return orderHash;\n }\n\n /// @dev Calculates EIP712 hash of the order.\n /// @param order The order structure.\n /// @return EIP712 hash of the order.\n function hashOrder(Order memory order)\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;\n bytes32 makerAssetDataHash = keccak256(order.makerAssetData);\n bytes32 takerAssetDataHash = keccak256(order.takerAssetData);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ORDER_SCHEMA_HASH,\n // bytes32(order.makerAddress),\n // bytes32(order.takerAddress),\n // bytes32(order.feeRecipientAddress),\n // bytes32(order.senderAddress),\n // order.makerAssetAmount,\n // order.takerAssetAmount,\n // order.makerFee,\n // order.takerFee,\n // order.expirationTimeSeconds,\n // order.salt,\n // keccak256(order.makerAssetData),\n // keccak256(order.takerAssetData)\n // ));\n\n assembly {\n // Calculate memory addresses that will be swapped out before hashing\n let pos1 := sub(order, 32)\n let pos2 := add(order, 320)\n let pos3 := add(order, 352)\n\n // Backup\n let temp1 := mload(pos1)\n let temp2 := mload(pos2)\n let temp3 := mload(pos3)\n \n // Hash in place\n mstore(pos1, schemaHash)\n mstore(pos2, makerAssetDataHash)\n mstore(pos3, takerAssetDataHash)\n result := keccak256(pos1, 416)\n \n // Restore\n mstore(pos1, temp1)\n mstore(pos2, temp2)\n mstore(pos3, temp3)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibEIP712.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract LibEIP712 {\n\n // EIP191 header for EIP712 prefix\n string constant internal EIP191_HEADER = \"\\x19\\x01\";\n\n // EIP712 Domain Name value\n string constant internal EIP712_DOMAIN_NAME = \"0x Protocol\";\n\n // EIP712 Domain Version value\n string constant internal EIP712_DOMAIN_VERSION = \"2\";\n\n // Hash of the EIP712 Domain Separator Schema\n bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"address verifyingContract\",\n \")\"\n ));\n\n // Hash of the EIP712 Domain Separator data\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public EIP712_DOMAIN_HASH;\n\n constructor ()\n public\n {\n EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(\n EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,\n keccak256(bytes(EIP712_DOMAIN_NAME)),\n keccak256(bytes(EIP712_DOMAIN_VERSION)),\n bytes32(address(this))\n ));\n }\n\n /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.\n /// @param hashStruct The EIP712 hash struct.\n /// @return EIP712 hash applied to this EIP712 Domain.\n function hashEIP712Message(bytes32 hashStruct)\n internal\n view\n returns (bytes32 result)\n {\n bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;\n\n // Assembly for more efficient computing:\n // keccak256(abi.encodePacked(\n // EIP191_HEADER,\n // EIP712_DOMAIN_HASH,\n // hashStruct \n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header\n mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash\n mstore(add(memPtr, 34), hashStruct) // Hash of struct\n\n // Compute hash\n result := keccak256(memPtr, 66)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibMath.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibMath is\n SafeMath\n{\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// Reverts if rounding error is >= 0.1%\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded down.\n function safeGetPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n require(\n !isRoundingErrorFloor(\n numerator,\n denominator,\n target\n ),\n \"ROUNDING_ERROR\"\n );\n \n partialAmount = safeDiv(\n safeMul(numerator, target),\n denominator\n );\n return partialAmount;\n }\n\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// Reverts if rounding error is >= 0.1%\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded up.\n function safeGetPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n require(\n !isRoundingErrorCeil(\n numerator,\n denominator,\n target\n ),\n \"ROUNDING_ERROR\"\n );\n \n // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):\n // ceil(a / b) = floor((a + b - 1) / b)\n // To implement `ceil(a / b)` using safeDiv.\n partialAmount = safeDiv(\n safeAdd(\n safeMul(numerator, target),\n safeSub(denominator, 1)\n ),\n denominator\n );\n return partialAmount;\n }\n\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded down.\n function getPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n partialAmount = safeDiv(\n safeMul(numerator, target),\n denominator\n );\n return partialAmount;\n }\n \n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded up.\n function getPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):\n // ceil(a / b) = floor((a + b - 1) / b)\n // To implement `ceil(a / b)` using safeDiv.\n partialAmount = safeDiv(\n safeAdd(\n safeMul(numerator, target),\n safeSub(denominator, 1)\n ),\n denominator\n );\n return partialAmount;\n }\n \n /// @dev Checks if rounding error >= 0.1% when rounding down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to multiply with numerator/denominator.\n /// @return Rounding error is present.\n function isRoundingErrorFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (bool isError)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n \n // The absolute rounding error is the difference between the rounded\n // value and the ideal value. The relative rounding error is the\n // absolute rounding error divided by the absolute value of the\n // ideal value. This is undefined when the ideal value is zero.\n //\n // The ideal value is `numerator * target / denominator`.\n // Let's call `numerator * target % denominator` the remainder.\n // The absolute error is `remainder / denominator`.\n //\n // When the ideal value is zero, we require the absolute error to\n // be zero. Fortunately, this is always the case. The ideal value is\n // zero iff `numerator == 0` and/or `target == 0`. In this case the\n // remainder and absolute error are also zero. \n if (target == 0 || numerator == 0) {\n return false;\n }\n \n // Otherwise, we want the relative rounding error to be strictly\n // less than 0.1%.\n // The relative error is `remainder / (numerator * target)`.\n // We want the relative error less than 1 / 1000:\n // remainder / (numerator * denominator) < 1 / 1000\n // or equivalently:\n // 1000 * remainder < numerator * target\n // so we have a rounding error iff:\n // 1000 * remainder >= numerator * target\n uint256 remainder = mulmod(\n target,\n numerator,\n denominator\n );\n isError = safeMul(1000, remainder) >= safeMul(numerator, target);\n return isError;\n }\n \n /// @dev Checks if rounding error >= 0.1% when rounding up.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to multiply with numerator/denominator.\n /// @return Rounding error is present.\n function isRoundingErrorCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (bool isError)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n \n // See the comments in `isRoundingError`.\n if (target == 0 || numerator == 0) {\n // When either is zero, the ideal value and rounded value are zero\n // and there is no rounding error. (Although the relative error\n // is undefined.)\n return false;\n }\n // Compute remainder as before\n uint256 remainder = mulmod(\n target,\n numerator,\n denominator\n );\n remainder = safeSub(denominator, remainder) % denominator;\n isError = safeMul(1000, remainder) >= safeMul(numerator, target);\n return isError;\n }\n}\n",
+ "protocol/Exchange/mixins/MExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\nimport \"../interfaces/IExchangeCore.sol\";\n\n\ncontract MExchangeCore is\n IExchangeCore\n{\n // Fill event is emitted whenever an order is filled.\n event Fill(\n address indexed makerAddress, // Address that created the order. \n address indexed feeRecipientAddress, // Address that received fees.\n address takerAddress, // Address that filled the order.\n address senderAddress, // Address that called the Exchange contract (msg.sender).\n uint256 makerAssetFilledAmount, // Amount of makerAsset sold by maker and bought by taker. \n uint256 takerAssetFilledAmount, // Amount of takerAsset sold by taker and bought by maker.\n uint256 makerFeePaid, // Amount of ZRX paid to feeRecipient by maker.\n uint256 takerFeePaid, // Amount of ZRX paid to feeRecipient by taker.\n bytes32 indexed orderHash, // EIP712 hash of order (see LibOrder.getOrderHash).\n bytes makerAssetData, // Encoded data specific to makerAsset. \n bytes takerAssetData // Encoded data specific to takerAsset.\n );\n\n // Cancel event is emitted whenever an individual order is cancelled.\n event Cancel(\n address indexed makerAddress, // Address that created the order. \n address indexed feeRecipientAddress, // Address that would have recieved fees if order was filled. \n address senderAddress, // Address that called the Exchange contract (msg.sender).\n bytes32 indexed orderHash, // EIP712 hash of order (see LibOrder.getOrderHash).\n bytes makerAssetData, // Encoded data specific to makerAsset. \n bytes takerAssetData // Encoded data specific to takerAsset.\n );\n\n // CancelUpTo event is emitted whenever `cancelOrdersUpTo` is executed succesfully.\n event CancelUpTo(\n address indexed makerAddress, // Orders cancelled must have been created by this address.\n address indexed senderAddress, // Orders cancelled must have a `senderAddress` equal to this address.\n uint256 orderEpoch // Orders with specified makerAddress and senderAddress with a salt less than this value are considered cancelled.\n );\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderInternal(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev After calling, the order can not be filled anymore.\n /// @param order Order struct containing order specifications.\n function cancelOrderInternal(LibOrder.Order memory order)\n internal;\n\n /// @dev Updates state with results of a fill order.\n /// @param order that was filled.\n /// @param takerAddress Address of taker who filled the order.\n /// @param orderTakerAssetFilledAmount Amount of order already filled.\n /// @return fillResults Amounts filled and fees paid by maker and taker.\n function updateFilledState(\n LibOrder.Order memory order,\n address takerAddress,\n bytes32 orderHash,\n uint256 orderTakerAssetFilledAmount,\n LibFillResults.FillResults memory fillResults\n )\n internal;\n\n /// @dev Updates state with results of cancelling an order.\n /// State is only updated if the order is currently fillable.\n /// Otherwise, updating state would have no effect.\n /// @param order that was cancelled.\n /// @param orderHash Hash of order that was cancelled.\n function updateCancelledState(\n LibOrder.Order memory order,\n bytes32 orderHash\n )\n internal;\n \n /// @dev Validates context for fillOrder. Succeeds or throws.\n /// @param order to be filled.\n /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.\n /// @param takerAddress Address of order taker.\n /// @param signature Proof that the orders was created by its maker.\n function assertFillableOrder(\n LibOrder.Order memory order,\n LibOrder.OrderInfo memory orderInfo,\n address takerAddress,\n bytes memory signature\n )\n internal\n view;\n \n /// @dev Validates context for fillOrder. Succeeds or throws.\n /// @param order to be filled.\n /// @param orderInfo Status, orderHash, and amount already filled of order.\n /// @param takerAssetFillAmount Desired amount of order to fill by taker.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @param makerAssetFilledAmount Amount of makerAsset that will be transfered.\n function assertValidFill(\n LibOrder.Order memory order,\n LibOrder.OrderInfo memory orderInfo,\n uint256 takerAssetFillAmount,\n uint256 takerAssetFilledAmount,\n uint256 makerAssetFilledAmount\n )\n internal\n view;\n\n /// @dev Validates context for cancelOrder. Succeeds or throws.\n /// @param order to be cancelled.\n /// @param orderInfo OrderStatus, orderHash, and amount already filled of order.\n function assertValidCancel(\n LibOrder.Order memory order,\n LibOrder.OrderInfo memory orderInfo\n )\n internal\n view;\n\n /// @dev Calculates amounts filled and fees paid by maker and taker.\n /// @param order to be filled.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @return fillResults Amounts filled and fees paid by maker and taker.\n function calculateFillResults(\n LibOrder.Order memory order,\n uint256 takerAssetFilledAmount\n )\n internal\n pure\n returns (LibFillResults.FillResults memory fillResults);\n\n}\n",
+ "protocol/Exchange/interfaces/IExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IExchangeCore {\n\n /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch\n /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).\n /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.\n function cancelOrdersUpTo(uint256 targetOrderEpoch)\n external;\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev After calling, the order can not be filled anymore.\n /// @param order Order struct containing order specifications.\n function cancelOrder(LibOrder.Order memory order)\n public;\n\n /// @dev Gets information about an order: status, hash, and amount filled.\n /// @param order Order to gather information on.\n /// @return OrderInfo Information about the order and its state.\n /// See LibOrder.OrderInfo for a complete description.\n function getOrderInfo(LibOrder.Order memory order)\n public\n view\n returns (LibOrder.OrderInfo memory orderInfo);\n}\n",
+ "protocol/Exchange/mixins/MSignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../interfaces/ISignatureValidator.sol\";\n\n\ncontract MSignatureValidator is\n ISignatureValidator\n{\n event SignatureValidatorApproval(\n address indexed signerAddress, // Address that approves or disapproves a contract to verify signatures.\n address indexed validatorAddress, // Address of signature validator contract.\n bool approved // Approval or disapproval of validator contract.\n );\n\n // Allowed signature types.\n enum SignatureType {\n Illegal, // 0x00, default value\n Invalid, // 0x01\n EIP712, // 0x02\n EthSign, // 0x03\n Wallet, // 0x04\n Validator, // 0x05\n PreSigned, // 0x06\n NSignatureTypes // 0x07, number of signature types. Always leave at end.\n }\n\n /// @dev Verifies signature using logic defined by Wallet contract.\n /// @param hash Any 32 byte hash.\n /// @param walletAddress Address that should have signed the given hash\n /// and defines its own signature verification method.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidWalletSignature(\n bytes32 hash,\n address walletAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid);\n\n /// @dev Verifies signature using logic defined by Validator contract.\n /// @param validatorAddress Address of validator contract.\n /// @param hash Any 32 byte hash.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidValidatorSignature(\n address validatorAddress,\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ISignatureValidator {\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external;\n \n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external;\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address of signer.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/mixins/MTransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\nimport \"../interfaces/ITransactions.sol\";\n\n\ncontract MTransactions is\n ITransactions\n{\n // Hash for the EIP712 ZeroEx Transaction Schema\n bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"ZeroExTransaction(\",\n \"uint256 salt,\",\n \"address signerAddress,\",\n \"bytes data\",\n \")\"\n ));\n\n /// @dev Calculates EIP712 hash of the Transaction.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @return EIP712 hash of the Transaction.\n function hashZeroExTransaction(\n uint256 salt,\n address signerAddress,\n bytes memory data\n )\n internal\n pure\n returns (bytes32 result);\n\n /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).\n /// If calling a fill function, this address will represent the taker.\n /// If calling a cancel function, this address will represent the maker.\n /// @return Signer of 0x transaction if entry point is `executeTransaction`.\n /// `msg.sender` if entry point is any other function.\n function getCurrentContextAddress()\n internal\n view\n returns (address);\n}\n",
+ "protocol/Exchange/interfaces/ITransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\n\ncontract ITransactions {\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external;\n}\n",
+ "protocol/Exchange/mixins/MAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../interfaces/IAssetProxyDispatcher.sol\";\n\n\ncontract MAssetProxyDispatcher is\n IAssetProxyDispatcher\n{\n // Logs registration of new asset proxy\n event AssetProxyRegistered(\n bytes4 id, // Id of new registered AssetProxy.\n address assetProxy // Address of new registered AssetProxy.\n );\n\n /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.\n /// @param assetData Byte array encoded for the asset.\n /// @param from Address to transfer token from.\n /// @param to Address to transfer token to.\n /// @param amount Amount of token to transfer.\n function dispatchTransferFrom(\n bytes memory assetData,\n address from,\n address to,\n uint256 amount\n )\n internal;\n}\n",
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IAssetProxyDispatcher {\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external;\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address);\n}\n",
+ "protocol/Exchange/MixinSignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/LibBytes/LibBytes.sol\";\nimport \"../../utils/ReentrancyGuard/ReentrancyGuard.sol\";\nimport \"./mixins/MSignatureValidator.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./interfaces/IWallet.sol\";\nimport \"./interfaces/IValidator.sol\";\n\n\ncontract MixinSignatureValidator is\n ReentrancyGuard,\n MSignatureValidator,\n MTransactions\n{\n using LibBytes for bytes;\n \n // Mapping of hash => signer => signed\n mapping (bytes32 => mapping (address => bool)) public preSigned;\n\n // Mapping of signer => validator => approved\n mapping (address => mapping (address => bool)) public allowedValidators;\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n {\n if (signerAddress != msg.sender) {\n require(\n isValidSignature(\n hash,\n signerAddress,\n signature\n ),\n \"INVALID_SIGNATURE\"\n );\n }\n preSigned[hash][signerAddress] = true;\n }\n\n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external\n nonReentrant\n {\n address signerAddress = getCurrentContextAddress();\n allowedValidators[signerAddress][validatorAddress] = approval;\n emit SignatureValidatorApproval(\n signerAddress,\n validatorAddress,\n approval\n );\n }\n\n /// @dev Verifies that a hash has been signed by the given signer.\n /// @param hash Any 32 byte hash.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid)\n {\n require(\n signature.length > 0,\n \"LENGTH_GREATER_THAN_0_REQUIRED\"\n );\n\n // Pop last byte off of signature byte array.\n uint8 signatureTypeRaw = uint8(signature.popLastByte());\n\n // Ensure signature is supported\n require(\n signatureTypeRaw < uint8(SignatureType.NSignatureTypes),\n \"SIGNATURE_UNSUPPORTED\"\n );\n\n SignatureType signatureType = SignatureType(signatureTypeRaw);\n\n // Variables are not scoped in Solidity.\n uint8 v;\n bytes32 r;\n bytes32 s;\n address recovered;\n\n // Always illegal signature.\n // This is always an implicit option since a signer can create a\n // signature array with invalid type or length. We may as well make\n // it an explicit option. This aids testing and analysis. It is\n // also the initialization value for the enum type.\n if (signatureType == SignatureType.Illegal) {\n revert(\"SIGNATURE_ILLEGAL\");\n\n // Always invalid signature.\n // Like Illegal, this is always implicitly available and therefore\n // offered explicitly. It can be implicitly created by providing\n // a correctly formatted but incorrect signature.\n } else if (signatureType == SignatureType.Invalid) {\n require(\n signature.length == 0,\n \"LENGTH_0_REQUIRED\"\n );\n isValid = false;\n return isValid;\n\n // Signature using EIP712\n } else if (signatureType == SignatureType.EIP712) {\n require(\n signature.length == 65,\n \"LENGTH_65_REQUIRED\"\n );\n v = uint8(signature[0]);\n r = signature.readBytes32(1);\n s = signature.readBytes32(33);\n recovered = ecrecover(\n hash,\n v,\n r,\n s\n );\n isValid = signerAddress == recovered;\n return isValid;\n\n // Signed using web3.eth_sign\n } else if (signatureType == SignatureType.EthSign) {\n require(\n signature.length == 65,\n \"LENGTH_65_REQUIRED\"\n );\n v = uint8(signature[0]);\n r = signature.readBytes32(1);\n s = signature.readBytes32(33);\n recovered = ecrecover(\n keccak256(abi.encodePacked(\n \"\\x19Ethereum Signed Message:\\n32\",\n hash\n )),\n v,\n r,\n s\n );\n isValid = signerAddress == recovered;\n return isValid;\n\n // Signature verified by wallet contract.\n // If used with an order, the maker of the order is the wallet contract.\n } else if (signatureType == SignatureType.Wallet) {\n isValid = isValidWalletSignature(\n hash,\n signerAddress,\n signature\n );\n return isValid;\n\n // Signature verified by validator contract.\n // If used with an order, the maker of the order can still be an EOA.\n // A signature using this type should be encoded as:\n // | Offset | Length | Contents |\n // | 0x00 | x | Signature to validate |\n // | 0x00 + x | 20 | Address of validator contract |\n // | 0x14 + x | 1 | Signature type is always \"\\x06\" |\n } else if (signatureType == SignatureType.Validator) {\n // Pop last 20 bytes off of signature byte array.\n address validatorAddress = signature.popLast20Bytes();\n \n // Ensure signer has approved validator.\n if (!allowedValidators[signerAddress][validatorAddress]) {\n return false;\n }\n isValid = isValidValidatorSignature(\n validatorAddress,\n hash,\n signerAddress,\n signature\n );\n return isValid;\n\n // Signer signed hash previously using the preSign function.\n } else if (signatureType == SignatureType.PreSigned) {\n isValid = preSigned[hash][signerAddress];\n return isValid;\n }\n\n // Anything else is illegal (We do not return false because\n // the signature may actually be valid, just not in a format\n // that we currently support. In this case returning false\n // may lead the caller to incorrectly believe that the\n // signature was invalid.)\n revert(\"SIGNATURE_UNSUPPORTED\");\n }\n\n /// @dev Verifies signature using logic defined by Wallet contract.\n /// @param hash Any 32 byte hash.\n /// @param walletAddress Address that should have signed the given hash\n /// and defines its own signature verification method.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if signature is valid for given wallet..\n function isValidWalletSignature(\n bytes32 hash,\n address walletAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid)\n {\n bytes memory calldata = abi.encodeWithSelector(\n IWallet(walletAddress).isValidSignature.selector,\n hash,\n signature\n );\n assembly {\n let cdStart := add(calldata, 32)\n let success := staticcall(\n gas, // forward all gas\n walletAddress, // address of Wallet contract\n cdStart, // pointer to start of input\n mload(calldata), // length of input\n cdStart, // write output over input\n 32 // output size is 32 bytes\n )\n\n switch success\n case 0 {\n // Revert with `Error(\"WALLET_ERROR\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000000c57414c4c45545f4552524f5200000000000000000000000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n case 1 {\n // Signature is valid if call did not revert and returned true\n isValid := mload(cdStart)\n }\n }\n return isValid;\n }\n\n /// @dev Verifies signature using logic defined by Validator contract.\n /// @param validatorAddress Address of validator contract.\n /// @param hash Any 32 byte hash.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidValidatorSignature(\n address validatorAddress,\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid)\n {\n bytes memory calldata = abi.encodeWithSelector(\n IValidator(signerAddress).isValidSignature.selector,\n hash,\n signerAddress,\n signature\n );\n assembly {\n let cdStart := add(calldata, 32)\n let success := staticcall(\n gas, // forward all gas\n validatorAddress, // address of Validator contract\n cdStart, // pointer to start of input\n mload(calldata), // length of input\n cdStart, // write output over input\n 32 // output size is 32 bytes\n )\n\n switch success\n case 0 {\n // Revert with `Error(\"VALIDATOR_ERROR\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000000f56414c494441544f525f4552524f5200000000000000000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n case 1 {\n // Signature is valid if call did not revert and returned true\n isValid := mload(cdStart)\n }\n }\n return isValid;\n }\n}\n",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n",
+ "protocol/Exchange/interfaces/IWallet.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IWallet {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/IValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IValidator {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/MixinWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../utils/ReentrancyGuard/ReentrancyGuard.sol\";\nimport \"./libs/LibMath.sol\";\nimport \"./libs/LibOrder.sol\";\nimport \"./libs/LibFillResults.sol\";\nimport \"./libs/LibAbiEncoder.sol\";\nimport \"./mixins/MExchangeCore.sol\";\nimport \"./mixins/MWrapperFunctions.sol\";\n\n\ncontract MixinWrapperFunctions is\n ReentrancyGuard,\n LibMath,\n LibFillResults,\n LibAbiEncoder,\n MExchangeCore,\n MWrapperFunctions\n{\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n nonReentrant\n returns (FillResults memory fillResults)\n {\n fillResults = fillOrKillOrderInternal(\n order,\n takerAssetFillAmount,\n signature\n );\n return fillResults;\n }\n\n /// @dev Fills the input order.\n /// Returns false if the transaction would otherwise revert.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (FillResults memory fillResults)\n {\n // ABI encode calldata for `fillOrder`\n bytes memory fillOrderCalldata = abiEncodeFillOrder(\n order,\n takerAssetFillAmount,\n signature\n );\n\n // Delegate to `fillOrder` and handle any exceptions gracefully\n assembly {\n let success := delegatecall(\n gas, // forward all gas\n address, // call address of this contract\n add(fillOrderCalldata, 32), // pointer to start of input (skip array length in first 32 bytes)\n mload(fillOrderCalldata), // length of input\n fillOrderCalldata, // write output over input\n 128 // output size is 128 bytes\n )\n if success {\n mstore(fillResults, mload(fillOrderCalldata))\n mstore(add(fillResults, 32), mload(add(fillOrderCalldata, 32)))\n mstore(add(fillResults, 64), mload(add(fillOrderCalldata, 64)))\n mstore(add(fillResults, 96), mload(add(fillOrderCalldata, 96)))\n }\n }\n // fillResults values will be 0 by default if call was unsuccessful\n return fillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrder.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.\n function batchFillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n nonReentrant\n returns (FillResults memory totalFillResults)\n {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n FillResults memory singleFillResults = fillOrderInternal(\n orders[i],\n takerAssetFillAmounts[i],\n signatures[i]\n );\n addFillResults(totalFillResults, singleFillResults);\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrKill.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.\n function batchFillOrKillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n nonReentrant\n returns (FillResults memory totalFillResults)\n {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n FillResults memory singleFillResults = fillOrKillOrderInternal(\n orders[i],\n takerAssetFillAmounts[i],\n signatures[i]\n );\n addFillResults(totalFillResults, singleFillResults);\n }\n return totalFillResults;\n }\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n /// NOTE: makerAssetFilledAmount and takerAssetFilledAmount may include amounts filled of different assets.\n function batchFillOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (FillResults memory totalFillResults)\n {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n FillResults memory singleFillResults = fillOrderNoThrow(\n orders[i],\n takerAssetFillAmounts[i],\n signatures[i]\n );\n addFillResults(totalFillResults, singleFillResults);\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrders(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n nonReentrant\n returns (FillResults memory totalFillResults)\n {\n bytes memory takerAssetData = orders[0].takerAssetData;\n \n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // We assume that asset being sold by taker is the same for each order.\n // Rather than passing this in as calldata, we use the takerAssetData from the first order in all later orders.\n orders[i].takerAssetData = takerAssetData;\n\n // Calculate the remaining amount of takerAsset to sell\n uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);\n\n // Attempt to sell the remaining amount of takerAsset\n FillResults memory singleFillResults = fillOrderInternal(\n orders[i],\n remainingTakerAssetFillAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker\n addFillResults(totalFillResults, singleFillResults);\n\n // Stop execution if the entire amount of takerAsset has been sold\n if (totalFillResults.takerAssetFilledAmount >= takerAssetFillAmount) {\n break;\n }\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (FillResults memory totalFillResults)\n {\n bytes memory takerAssetData = orders[0].takerAssetData;\n\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // We assume that asset being sold by taker is the same for each order.\n // Rather than passing this in as calldata, we use the takerAssetData from the first order in all later orders.\n orders[i].takerAssetData = takerAssetData;\n\n // Calculate the remaining amount of takerAsset to sell\n uint256 remainingTakerAssetFillAmount = safeSub(takerAssetFillAmount, totalFillResults.takerAssetFilledAmount);\n\n // Attempt to sell the remaining amount of takerAsset\n FillResults memory singleFillResults = fillOrderNoThrow(\n orders[i],\n remainingTakerAssetFillAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker\n addFillResults(totalFillResults, singleFillResults);\n\n // Stop execution if the entire amount of takerAsset has been sold\n if (totalFillResults.takerAssetFilledAmount >= takerAssetFillAmount) {\n break;\n }\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrders(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n nonReentrant\n returns (FillResults memory totalFillResults)\n {\n bytes memory makerAssetData = orders[0].makerAssetData;\n\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // We assume that asset being bought by taker is the same for each order.\n // Rather than passing this in as calldata, we copy the makerAssetData from the first order onto all later orders.\n orders[i].makerAssetData = makerAssetData;\n\n // Calculate the remaining amount of makerAsset to buy\n uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);\n\n // Convert the remaining amount of makerAsset to buy into remaining amount\n // of takerAsset to sell, assuming entire amount can be sold in the current order\n uint256 remainingTakerAssetFillAmount = getPartialAmountFloor(\n orders[i].takerAssetAmount,\n orders[i].makerAssetAmount,\n remainingMakerAssetFillAmount\n );\n\n // Attempt to sell the remaining amount of takerAsset\n FillResults memory singleFillResults = fillOrderInternal(\n orders[i],\n remainingTakerAssetFillAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker\n addFillResults(totalFillResults, singleFillResults);\n\n // Stop execution if the entire amount of makerAsset has been bought\n if (totalFillResults.makerAssetFilledAmount >= makerAssetFillAmount) {\n break;\n }\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (FillResults memory totalFillResults)\n {\n bytes memory makerAssetData = orders[0].makerAssetData;\n\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n\n // We assume that asset being bought by taker is the same for each order.\n // Rather than passing this in as calldata, we copy the makerAssetData from the first order onto all later orders.\n orders[i].makerAssetData = makerAssetData;\n\n // Calculate the remaining amount of makerAsset to buy\n uint256 remainingMakerAssetFillAmount = safeSub(makerAssetFillAmount, totalFillResults.makerAssetFilledAmount);\n\n // Convert the remaining amount of makerAsset to buy into remaining amount\n // of takerAsset to sell, assuming entire amount can be sold in the current order\n uint256 remainingTakerAssetFillAmount = getPartialAmountFloor(\n orders[i].takerAssetAmount,\n orders[i].makerAssetAmount,\n remainingMakerAssetFillAmount\n );\n\n // Attempt to sell the remaining amount of takerAsset\n FillResults memory singleFillResults = fillOrderNoThrow(\n orders[i],\n remainingTakerAssetFillAmount,\n signatures[i]\n );\n\n // Update amounts filled and fees paid by maker and taker\n addFillResults(totalFillResults, singleFillResults);\n\n // Stop execution if the entire amount of makerAsset has been bought\n if (totalFillResults.makerAssetFilledAmount >= makerAssetFillAmount) {\n break;\n }\n }\n return totalFillResults;\n }\n\n /// @dev Synchronously cancels multiple orders in a single transaction.\n /// @param orders Array of order specifications.\n function batchCancelOrders(LibOrder.Order[] memory orders)\n public\n nonReentrant\n {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n cancelOrderInternal(orders[i]);\n }\n }\n\n /// @dev Fetches information for all passed in orders.\n /// @param orders Array of order specifications.\n /// @return Array of OrderInfo instances that correspond to each order.\n function getOrdersInfo(LibOrder.Order[] memory orders)\n public\n view\n returns (LibOrder.OrderInfo[] memory)\n {\n uint256 ordersLength = orders.length;\n LibOrder.OrderInfo[] memory ordersInfo = new LibOrder.OrderInfo[](ordersLength);\n for (uint256 i = 0; i != ordersLength; i++) {\n ordersInfo[i] = getOrderInfo(orders[i]);\n }\n return ordersInfo;\n }\n\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrderInternal(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n returns (FillResults memory fillResults)\n {\n fillResults = fillOrderInternal(\n order,\n takerAssetFillAmount,\n signature\n );\n require(\n fillResults.takerAssetFilledAmount == takerAssetFillAmount,\n \"COMPLETE_FILL_FAILED\"\n );\n return fillResults;\n }\n}\n",
+ "protocol/Exchange/libs/LibAbiEncoder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./LibOrder.sol\";\n\n\ncontract LibAbiEncoder {\n\n /// @dev ABI encodes calldata for `fillOrder`.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return ABI encoded calldata for `fillOrder`.\n function abiEncodeFillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n pure\n returns (bytes memory fillOrderCalldata)\n {\n // We need to call MExchangeCore.fillOrder using a delegatecall in\n // assembly so that we can intercept a call that throws. For this, we\n // need the input encoded in memory in the Ethereum ABIv2 format [1].\n\n // | Area | Offset | Length | Contents |\n // | -------- |--------|---------|-------------------------------------------- |\n // | Header | 0x00 | 4 | function selector |\n // | Params | | 3 * 32 | function parameters: |\n // | | 0x00 | | 1. offset to order (*) |\n // | | 0x20 | | 2. takerAssetFillAmount |\n // | | 0x40 | | 3. offset to signature (*) |\n // | Data | | 12 * 32 | order: |\n // | | 0x000 | | 1. senderAddress |\n // | | 0x020 | | 2. makerAddress |\n // | | 0x040 | | 3. takerAddress |\n // | | 0x060 | | 4. feeRecipientAddress |\n // | | 0x080 | | 5. makerAssetAmount |\n // | | 0x0A0 | | 6. takerAssetAmount |\n // | | 0x0C0 | | 7. makerFeeAmount |\n // | | 0x0E0 | | 8. takerFeeAmount |\n // | | 0x100 | | 9. expirationTimeSeconds |\n // | | 0x120 | | 10. salt |\n // | | 0x140 | | 11. Offset to makerAssetData (*) |\n // | | 0x160 | | 12. Offset to takerAssetData (*) |\n // | | 0x180 | 32 | makerAssetData Length |\n // | | 0x1A0 | ** | makerAssetData Contents |\n // | | 0x1C0 | 32 | takerAssetData Length |\n // | | 0x1E0 | ** | takerAssetData Contents |\n // | | 0x200 | 32 | signature Length |\n // | | 0x220 | ** | signature Contents |\n\n // * Offsets are calculated from the beginning of the current area: Header, Params, Data:\n // An offset stored in the Params area is calculated from the beginning of the Params section.\n // An offset stored in the Data area is calculated from the beginning of the Data section.\n\n // ** The length of dynamic array contents are stored in the field immediately preceeding the contents.\n\n // [1]: https://solidity.readthedocs.io/en/develop/abi-spec.html\n\n assembly {\n\n // Areas below may use the following variables:\n // 1. <area>Start -- Start of this area in memory\n // 2. <area>End -- End of this area in memory. This value may\n // be precomputed (before writing contents),\n // or it may be computed as contents are written.\n // 3. <area>Offset -- Current offset into area. If an area's End\n // is precomputed, this variable tracks the\n // offsets of contents as they are written.\n\n /////// Setup Header Area ///////\n // Load free memory pointer\n fillOrderCalldata := mload(0x40)\n // bytes4(keccak256(\"fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)\"))\n // = 0xb4be83d5\n // Leave 0x20 bytes to store the length\n mstore(add(fillOrderCalldata, 0x20), 0xb4be83d500000000000000000000000000000000000000000000000000000000)\n let headerAreaEnd := add(fillOrderCalldata, 0x24)\n\n /////// Setup Params Area ///////\n // This area is preallocated and written to later.\n // This is because we need to fill in offsets that have not yet been calculated.\n let paramsAreaStart := headerAreaEnd\n let paramsAreaEnd := add(paramsAreaStart, 0x60)\n let paramsAreaOffset := paramsAreaStart\n\n /////// Setup Data Area ///////\n let dataAreaStart := paramsAreaEnd\n let dataAreaEnd := dataAreaStart\n\n // Offset from the source data we're reading from\n let sourceOffset := order\n // arrayLenBytes and arrayLenWords track the length of a dynamically-allocated bytes array.\n let arrayLenBytes := 0\n let arrayLenWords := 0\n\n /////// Write order Struct ///////\n // Write memory location of Order, relative to the start of the\n // parameter list, then increment the paramsAreaOffset respectively.\n mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))\n paramsAreaOffset := add(paramsAreaOffset, 0x20)\n\n // Write values for each field in the order\n // It would be nice to use a loop, but we save on gas by writing\n // the stores sequentially.\n mstore(dataAreaEnd, mload(sourceOffset)) // makerAddress\n mstore(add(dataAreaEnd, 0x20), mload(add(sourceOffset, 0x20))) // takerAddress\n mstore(add(dataAreaEnd, 0x40), mload(add(sourceOffset, 0x40))) // feeRecipientAddress\n mstore(add(dataAreaEnd, 0x60), mload(add(sourceOffset, 0x60))) // senderAddress\n mstore(add(dataAreaEnd, 0x80), mload(add(sourceOffset, 0x80))) // makerAssetAmount\n mstore(add(dataAreaEnd, 0xA0), mload(add(sourceOffset, 0xA0))) // takerAssetAmount\n mstore(add(dataAreaEnd, 0xC0), mload(add(sourceOffset, 0xC0))) // makerFeeAmount\n mstore(add(dataAreaEnd, 0xE0), mload(add(sourceOffset, 0xE0))) // takerFeeAmount\n mstore(add(dataAreaEnd, 0x100), mload(add(sourceOffset, 0x100))) // expirationTimeSeconds\n mstore(add(dataAreaEnd, 0x120), mload(add(sourceOffset, 0x120))) // salt\n mstore(add(dataAreaEnd, 0x140), mload(add(sourceOffset, 0x140))) // Offset to makerAssetData\n mstore(add(dataAreaEnd, 0x160), mload(add(sourceOffset, 0x160))) // Offset to takerAssetData\n dataAreaEnd := add(dataAreaEnd, 0x180)\n sourceOffset := add(sourceOffset, 0x180)\n\n // Write offset to <order.makerAssetData>\n mstore(add(dataAreaStart, mul(10, 0x20)), sub(dataAreaEnd, dataAreaStart))\n\n // Calculate length of <order.makerAssetData>\n sourceOffset := mload(add(order, 0x140)) // makerAssetData\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of <order.makerAssetData>\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of <order.makerAssetData>\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n // Write offset to <order.takerAssetData>\n mstore(add(dataAreaStart, mul(11, 0x20)), sub(dataAreaEnd, dataAreaStart))\n\n // Calculate length of <order.takerAssetData>\n sourceOffset := mload(add(order, 0x160)) // takerAssetData\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of <order.takerAssetData>\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of <order.takerAssetData>\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n /////// Write takerAssetFillAmount ///////\n mstore(paramsAreaOffset, takerAssetFillAmount)\n paramsAreaOffset := add(paramsAreaOffset, 0x20)\n\n /////// Write signature ///////\n // Write offset to paramsArea\n mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))\n\n // Calculate length of signature\n sourceOffset := signature\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of signature\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of signature\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n // Set length of calldata\n mstore(fillOrderCalldata, sub(dataAreaEnd, add(fillOrderCalldata, 0x20)))\n\n // Increment free memory pointer\n mstore(0x40, dataAreaEnd)\n }\n\n return fillOrderCalldata;\n }\n}\n",
+ "protocol/Exchange/mixins/MWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\nimport \"../interfaces/IWrapperFunctions.sol\";\n\n\ncontract MWrapperFunctions is \n IWrapperFunctions\n{\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrderInternal(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n returns (LibFillResults.FillResults memory fillResults);\n}\n",
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IWrapperFunctions {\n\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrKill.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrKillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrders(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrders(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously cancels multiple orders in a single transaction.\n /// @param orders Array of order specifications.\n function batchCancelOrders(LibOrder.Order[] memory orders)\n public;\n\n /// @dev Fetches information for all passed in orders\n /// @param orders Array of order specifications.\n /// @return Array of OrderInfo instances that correspond to each order.\n function getOrdersInfo(LibOrder.Order[] memory orders)\n public\n view\n returns (LibOrder.OrderInfo[] memory);\n}\n",
+ "protocol/Exchange/MixinAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/Ownable/Ownable.sol\";\nimport \"./mixins/MAssetProxyDispatcher.sol\";\nimport \"../AssetProxy/interfaces/IAssetProxy.sol\";\n\n\ncontract MixinAssetProxyDispatcher is\n Ownable,\n MAssetProxyDispatcher\n{\n // Mapping from Asset Proxy Id's to their respective Asset Proxy\n mapping (bytes4 => IAssetProxy) public assetProxies;\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external\n onlyOwner\n {\n IAssetProxy assetProxyContract = IAssetProxy(assetProxy);\n\n // Ensure that no asset proxy exists with current id.\n bytes4 assetProxyId = assetProxyContract.getProxyId();\n address currentAssetProxy = assetProxies[assetProxyId];\n require(\n currentAssetProxy == address(0),\n \"ASSET_PROXY_ALREADY_EXISTS\"\n );\n\n // Add asset proxy and log registration.\n assetProxies[assetProxyId] = assetProxyContract;\n emit AssetProxyRegistered(\n assetProxyId,\n assetProxy\n );\n }\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address)\n {\n return assetProxies[assetProxyId];\n }\n\n /// @dev Forwards arguments to assetProxy and calls `transferFrom`. Either succeeds or throws.\n /// @param assetData Byte array encoded for the asset.\n /// @param from Address to transfer token from.\n /// @param to Address to transfer token to.\n /// @param amount Amount of token to transfer.\n function dispatchTransferFrom(\n bytes memory assetData,\n address from,\n address to,\n uint256 amount\n )\n internal\n {\n // Do nothing if no amount should be transferred.\n if (amount > 0 && from != to) {\n // Ensure assetData length is valid\n require(\n assetData.length > 3,\n \"LENGTH_GREATER_THAN_3_REQUIRED\"\n );\n \n // Lookup assetProxy. We do not use `LibBytes.readBytes4` for gas efficiency reasons.\n bytes4 assetProxyId;\n assembly {\n assetProxyId := and(mload(\n add(assetData, 32)),\n 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000\n )\n }\n address assetProxy = assetProxies[assetProxyId];\n\n // Ensure that assetProxy exists\n require(\n assetProxy != address(0),\n \"ASSET_PROXY_DOES_NOT_EXIST\"\n );\n \n // We construct calldata for the `assetProxy.transferFrom` ABI.\n // The layout of this calldata is in the table below.\n // \n // | Area | Offset | Length | Contents |\n // | -------- |--------|---------|-------------------------------------------- |\n // | Header | 0 | 4 | function selector |\n // | Params | | 4 * 32 | function parameters: |\n // | | 4 | | 1. offset to assetData (*) |\n // | | 36 | | 2. from |\n // | | 68 | | 3. to |\n // | | 100 | | 4. amount |\n // | Data | | | assetData: |\n // | | 132 | 32 | assetData Length |\n // | | 164 | ** | assetData Contents |\n\n assembly {\n /////// Setup State ///////\n // `cdStart` is the start of the calldata for `assetProxy.transferFrom` (equal to free memory ptr).\n let cdStart := mload(64)\n // `dataAreaLength` is the total number of words needed to store `assetData`\n // As-per the ABI spec, this value is padded up to the nearest multiple of 32,\n // and includes 32-bytes for length.\n let dataAreaLength := and(add(mload(assetData), 63), 0xFFFFFFFFFFFE0)\n // `cdEnd` is the end of the calldata for `assetProxy.transferFrom`.\n let cdEnd := add(cdStart, add(132, dataAreaLength))\n\n \n /////// Setup Header Area ///////\n // This area holds the 4-byte `transferFromSelector`.\n // bytes4(keccak256(\"transferFrom(bytes,address,address,uint256)\")) = 0xa85e59e4\n mstore(cdStart, 0xa85e59e400000000000000000000000000000000000000000000000000000000)\n \n /////// Setup Params Area ///////\n // Each parameter is padded to 32-bytes. The entire Params Area is 128 bytes.\n // Notes:\n // 1. The offset to `assetData` is the length of the Params Area (128 bytes).\n // 2. A 20-byte mask is applied to addresses to zero-out the unused bytes.\n mstore(add(cdStart, 4), 128)\n mstore(add(cdStart, 36), and(from, 0xffffffffffffffffffffffffffffffffffffffff))\n mstore(add(cdStart, 68), and(to, 0xffffffffffffffffffffffffffffffffffffffff))\n mstore(add(cdStart, 100), amount)\n \n /////// Setup Data Area ///////\n // This area holds `assetData`.\n let dataArea := add(cdStart, 132)\n // solhint-disable-next-line no-empty-blocks\n for {} lt(dataArea, cdEnd) {} {\n mstore(dataArea, mload(assetData))\n dataArea := add(dataArea, 32)\n assetData := add(assetData, 32)\n }\n\n /////// Call `assetProxy.transferFrom` using the constructed calldata ///////\n let success := call(\n gas, // forward all gas\n assetProxy, // call address of asset proxy\n 0, // don't send any ETH\n cdStart, // pointer to start of input\n sub(cdEnd, cdStart), // length of input \n cdStart, // write output over input\n 512 // reserve 512 bytes for output\n )\n if iszero(success) {\n revert(cdStart, returndatasize())\n }\n }\n }\n }\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n",
+ "protocol/AssetProxy/interfaces/IAssetProxy.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./IAuthorizable.sol\";\n\n\ncontract IAssetProxy is\n IAuthorizable\n{\n /// @dev Transfers assets. Either succeeds or throws.\n /// @param assetData Byte array encoded for the respective asset proxy.\n /// @param from Address to transfer asset from.\n /// @param to Address to transfer asset to.\n /// @param amount Amount of asset to transfer.\n function transferFrom(\n bytes assetData,\n address from,\n address to,\n uint256 amount\n )\n external;\n \n /// @dev Gets the proxy id associated with the proxy address.\n /// @return Proxy id.\n function getProxyId()\n external\n pure\n returns (bytes4);\n}\n",
+ "protocol/AssetProxy/interfaces/IAuthorizable.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/Ownable/IOwnable.sol\";\n\n\ncontract IAuthorizable is\n IOwnable\n{\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n \n /// @dev Gets all authorized addresses.\n /// @return Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory);\n}\n",
+ "protocol/Exchange/MixinTransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\nimport \"./libs/LibExchangeErrors.sol\";\nimport \"./mixins/MSignatureValidator.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./libs/LibEIP712.sol\";\n\n\ncontract MixinTransactions is\n LibEIP712,\n MSignatureValidator,\n MTransactions\n{\n // Mapping of transaction hash => executed\n // This prevents transactions from being executed more than once.\n mapping (bytes32 => bool) public transactions;\n\n // Address of current transaction signer\n address public currentContextAddress;\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external\n {\n // Prevent reentrancy\n require(\n currentContextAddress == address(0),\n \"REENTRANCY_ILLEGAL\"\n );\n\n bytes32 transactionHash = hashEIP712Message(hashZeroExTransaction(\n salt,\n signerAddress,\n data\n ));\n\n // Validate transaction has not been executed\n require(\n !transactions[transactionHash],\n \"INVALID_TX_HASH\"\n );\n\n // Transaction always valid if signer is sender of transaction\n if (signerAddress != msg.sender) {\n // Validate signature\n require(\n isValidSignature(\n transactionHash,\n signerAddress,\n signature\n ),\n \"INVALID_TX_SIGNATURE\"\n );\n\n // Set the current transaction signer\n currentContextAddress = signerAddress;\n }\n\n // Execute transaction\n transactions[transactionHash] = true;\n require(\n address(this).delegatecall(data),\n \"FAILED_EXECUTION\"\n );\n\n // Reset current transaction signer if it was previously updated\n if (signerAddress != msg.sender) {\n currentContextAddress = address(0);\n }\n }\n\n /// @dev Calculates EIP712 hash of the Transaction.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @return EIP712 hash of the Transaction.\n function hashZeroExTransaction(\n uint256 salt,\n address signerAddress,\n bytes memory data\n )\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH;\n bytes32 dataHash = keccak256(data);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH,\n // salt,\n // bytes32(signerAddress),\n // keccak256(data)\n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, schemaHash) // hash of schema\n mstore(add(memPtr, 32), salt) // salt\n mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) // signerAddress\n mstore(add(memPtr, 96), dataHash) // hash of data\n\n // Compute hash\n result := keccak256(memPtr, 128)\n }\n return result;\n }\n\n /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).\n /// If calling a fill function, this address will represent the taker.\n /// If calling a cancel function, this address will represent the maker.\n /// @return Signer of 0x transaction if entry point is `executeTransaction`.\n /// `msg.sender` if entry point is any other function.\n function getCurrentContextAddress()\n internal\n view\n returns (address)\n {\n address currentContextAddress_ = currentContextAddress;\n address contextAddress = currentContextAddress_ == address(0) ? msg.sender : currentContextAddress_;\n return contextAddress;\n }\n}\n",
+ "protocol/Exchange/libs/LibExchangeErrors.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\n// solhint-disable\npragma solidity 0.4.24;\n\n\n/// @dev This contract documents the revert reasons used in the Exchange contract.\n/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.\ncontract LibExchangeErrors {\n\n /// Order validation errors ///\n string constant ORDER_UNFILLABLE = \"ORDER_UNFILLABLE\"; // Order cannot be filled.\n string constant INVALID_MAKER = \"INVALID_MAKER\"; // Invalid makerAddress.\n string constant INVALID_TAKER = \"INVALID_TAKER\"; // Invalid takerAddress.\n string constant INVALID_SENDER = \"INVALID_SENDER\"; // Invalid `msg.sender`.\n string constant INVALID_ORDER_SIGNATURE = \"INVALID_ORDER_SIGNATURE\"; // Signature validation failed. \n \n /// fillOrder validation errors ///\n string constant INVALID_TAKER_AMOUNT = \"INVALID_TAKER_AMOUNT\"; // takerAssetFillAmount cannot equal 0.\n string constant ROUNDING_ERROR = \"ROUNDING_ERROR\"; // Rounding error greater than 0.1% of takerAssetFillAmount. \n \n /// Signature validation errors ///\n string constant INVALID_SIGNATURE = \"INVALID_SIGNATURE\"; // Signature validation failed. \n string constant SIGNATURE_ILLEGAL = \"SIGNATURE_ILLEGAL\"; // Signature type is illegal.\n string constant SIGNATURE_UNSUPPORTED = \"SIGNATURE_UNSUPPORTED\"; // Signature type unsupported.\n \n /// cancelOrdersUptTo errors ///\n string constant INVALID_NEW_ORDER_EPOCH = \"INVALID_NEW_ORDER_EPOCH\"; // Specified salt must be greater than or equal to existing orderEpoch.\n\n /// fillOrKillOrder errors ///\n string constant COMPLETE_FILL_FAILED = \"COMPLETE_FILL_FAILED\"; // Desired takerAssetFillAmount could not be completely filled. \n\n /// matchOrders errors ///\n string constant NEGATIVE_SPREAD_REQUIRED = \"NEGATIVE_SPREAD_REQUIRED\"; // Matched orders must have a negative spread.\n\n /// Transaction errors ///\n string constant REENTRANCY_ILLEGAL = \"REENTRANCY_ILLEGAL\"; // Recursive reentrancy is not allowed. \n string constant INVALID_TX_HASH = \"INVALID_TX_HASH\"; // Transaction has already been executed. \n string constant INVALID_TX_SIGNATURE = \"INVALID_TX_SIGNATURE\"; // Signature validation failed. \n string constant FAILED_EXECUTION = \"FAILED_EXECUTION\"; // Transaction execution failed. \n \n /// registerAssetProxy errors ///\n string constant ASSET_PROXY_ALREADY_EXISTS = \"ASSET_PROXY_ALREADY_EXISTS\"; // AssetProxy with same id already exists.\n\n /// dispatchTransferFrom errors ///\n string constant ASSET_PROXY_DOES_NOT_EXIST = \"ASSET_PROXY_DOES_NOT_EXIST\"; // No assetProxy registered at given id.\n string constant TRANSFER_FAILED = \"TRANSFER_FAILED\"; // Asset transfer unsuccesful.\n\n /// Length validation errors ///\n string constant LENGTH_GREATER_THAN_0_REQUIRED = \"LENGTH_GREATER_THAN_0_REQUIRED\"; // Byte array must have a length greater than 0.\n string constant LENGTH_GREATER_THAN_3_REQUIRED = \"LENGTH_GREATER_THAN_3_REQUIRED\"; // Byte array must have a length greater than 3.\n string constant LENGTH_0_REQUIRED = \"LENGTH_0_REQUIRED\"; // Byte array must have a length of 0.\n string constant LENGTH_65_REQUIRED = \"LENGTH_65_REQUIRED\"; // Byte array must have a length of 65.\n}\n",
+ "protocol/Exchange/MixinMatchOrders.sol": "/*\n Copyright 2018 ZeroEx Intl.\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n http://www.apache.org/licenses/LICENSE-2.0\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../utils/ReentrancyGuard/ReentrancyGuard.sol\";\nimport \"./libs/LibConstants.sol\";\nimport \"./libs/LibMath.sol\";\nimport \"./libs/LibOrder.sol\";\nimport \"./libs/LibFillResults.sol\";\nimport \"./mixins/MExchangeCore.sol\";\nimport \"./mixins/MMatchOrders.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./mixins/MAssetProxyDispatcher.sol\";\n\n\ncontract MixinMatchOrders is\n ReentrancyGuard,\n LibConstants,\n LibMath,\n MAssetProxyDispatcher,\n MExchangeCore,\n MMatchOrders,\n MTransactions\n{\n /// @dev Match two complementary orders that have a profitable spread.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the left order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftSignature Proof that order was created by the left maker.\n /// @param rightSignature Proof that order was created by the right maker.\n /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.\n function matchOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n bytes memory leftSignature,\n bytes memory rightSignature\n )\n public\n nonReentrant\n returns (LibFillResults.MatchedFillResults memory matchedFillResults)\n {\n // We assume that rightOrder.takerAssetData == leftOrder.makerAssetData and rightOrder.makerAssetData == leftOrder.takerAssetData.\n // If this assumption isn't true, the match will fail at signature validation.\n rightOrder.makerAssetData = leftOrder.takerAssetData;\n rightOrder.takerAssetData = leftOrder.makerAssetData;\n\n // Get left & right order info\n LibOrder.OrderInfo memory leftOrderInfo = getOrderInfo(leftOrder);\n LibOrder.OrderInfo memory rightOrderInfo = getOrderInfo(rightOrder);\n\n // Fetch taker address\n address takerAddress = getCurrentContextAddress();\n \n // Either our context is valid or we revert\n assertFillableOrder(\n leftOrder,\n leftOrderInfo,\n takerAddress,\n leftSignature\n );\n assertFillableOrder(\n rightOrder,\n rightOrderInfo,\n takerAddress,\n rightSignature\n );\n assertValidMatch(leftOrder, rightOrder);\n\n // Compute proportional fill amounts\n matchedFillResults = calculateMatchedFillResults(\n leftOrder,\n rightOrder,\n leftOrderInfo.orderTakerAssetFilledAmount,\n rightOrderInfo.orderTakerAssetFilledAmount\n );\n\n // Validate fill contexts\n assertValidFill(\n leftOrder,\n leftOrderInfo,\n matchedFillResults.left.takerAssetFilledAmount,\n matchedFillResults.left.takerAssetFilledAmount,\n matchedFillResults.left.makerAssetFilledAmount\n );\n assertValidFill(\n rightOrder,\n rightOrderInfo,\n matchedFillResults.right.takerAssetFilledAmount,\n matchedFillResults.right.takerAssetFilledAmount,\n matchedFillResults.right.makerAssetFilledAmount\n );\n \n // Update exchange state\n updateFilledState(\n leftOrder,\n takerAddress,\n leftOrderInfo.orderHash,\n leftOrderInfo.orderTakerAssetFilledAmount,\n matchedFillResults.left\n );\n updateFilledState(\n rightOrder,\n takerAddress,\n rightOrderInfo.orderHash,\n rightOrderInfo.orderTakerAssetFilledAmount,\n matchedFillResults.right\n );\n\n // Settle matched orders. Succeeds or throws.\n settleMatchedOrders(\n leftOrder,\n rightOrder,\n takerAddress,\n matchedFillResults\n );\n\n return matchedFillResults;\n }\n\n /// @dev Validates context for matchOrders. Succeeds or throws.\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n function assertValidMatch(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder\n )\n internal\n pure\n {\n // Make sure there is a profitable spread.\n // There is a profitable spread iff the cost per unit bought (OrderA.MakerAmount/OrderA.TakerAmount) for each order is greater\n // than the profit per unit sold of the matched order (OrderB.TakerAmount/OrderB.MakerAmount).\n // This is satisfied by the equations below:\n // <leftOrder.makerAssetAmount> / <leftOrder.takerAssetAmount> >= <rightOrder.takerAssetAmount> / <rightOrder.makerAssetAmount>\n // AND\n // <rightOrder.makerAssetAmount> / <rightOrder.takerAssetAmount> >= <leftOrder.takerAssetAmount> / <leftOrder.makerAssetAmount>\n // These equations can be combined to get the following:\n require(\n safeMul(leftOrder.makerAssetAmount, rightOrder.makerAssetAmount) >=\n safeMul(leftOrder.takerAssetAmount, rightOrder.takerAssetAmount),\n \"NEGATIVE_SPREAD_REQUIRED\"\n );\n }\n\n /// @dev Calculates fill amounts for the matched orders.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the leftOrder order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftOrderTakerAssetFilledAmount Amount of left order already filled.\n /// @param rightOrderTakerAssetFilledAmount Amount of right order already filled.\n /// @param matchedFillResults Amounts to fill and fees to pay by maker and taker of matched orders.\n function calculateMatchedFillResults(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n uint256 leftOrderTakerAssetFilledAmount,\n uint256 rightOrderTakerAssetFilledAmount\n )\n internal\n pure\n returns (LibFillResults.MatchedFillResults memory matchedFillResults)\n {\n // Derive maker asset amounts for left & right orders, given store taker assert amounts\n uint256 leftTakerAssetAmountRemaining = safeSub(leftOrder.takerAssetAmount, leftOrderTakerAssetFilledAmount);\n uint256 leftMakerAssetAmountRemaining = safeGetPartialAmountFloor(\n leftOrder.makerAssetAmount,\n leftOrder.takerAssetAmount,\n leftTakerAssetAmountRemaining\n );\n uint256 rightTakerAssetAmountRemaining = safeSub(rightOrder.takerAssetAmount, rightOrderTakerAssetFilledAmount);\n uint256 rightMakerAssetAmountRemaining = safeGetPartialAmountFloor(\n rightOrder.makerAssetAmount,\n rightOrder.takerAssetAmount,\n rightTakerAssetAmountRemaining\n );\n\n // Calculate fill results for maker and taker assets: at least one order will be fully filled.\n // The maximum amount the left maker can buy is `leftTakerAssetAmountRemaining`\n // The maximum amount the right maker can sell is `rightMakerAssetAmountRemaining`\n // We have two distinct cases for calculating the fill results:\n // Case 1.\n // If the left maker can buy more than the right maker can sell, then only the right order is fully filled.\n // If the left maker can buy exactly what the right maker can sell, then both orders are fully filled.\n // Case 2.\n // If the left maker cannot buy more than the right maker can sell, then only the left order is fully filled.\n if (leftTakerAssetAmountRemaining >= rightMakerAssetAmountRemaining) {\n // Case 1: Right order is fully filled\n matchedFillResults.right.makerAssetFilledAmount = rightMakerAssetAmountRemaining;\n matchedFillResults.right.takerAssetFilledAmount = rightTakerAssetAmountRemaining;\n matchedFillResults.left.takerAssetFilledAmount = matchedFillResults.right.makerAssetFilledAmount;\n // Round down to ensure the maker's exchange rate does not exceed the price specified by the order. \n // We favor the maker when the exchange rate must be rounded.\n matchedFillResults.left.makerAssetFilledAmount = safeGetPartialAmountFloor(\n leftOrder.makerAssetAmount,\n leftOrder.takerAssetAmount,\n matchedFillResults.left.takerAssetFilledAmount\n );\n } else {\n // Case 2: Left order is fully filled\n matchedFillResults.left.makerAssetFilledAmount = leftMakerAssetAmountRemaining;\n matchedFillResults.left.takerAssetFilledAmount = leftTakerAssetAmountRemaining;\n matchedFillResults.right.makerAssetFilledAmount = matchedFillResults.left.takerAssetFilledAmount;\n // Round up to ensure the maker's exchange rate does not exceed the price specified by the order.\n // We favor the maker when the exchange rate must be rounded.\n matchedFillResults.right.takerAssetFilledAmount = safeGetPartialAmountCeil(\n rightOrder.takerAssetAmount,\n rightOrder.makerAssetAmount,\n matchedFillResults.right.makerAssetFilledAmount\n );\n }\n\n // Calculate amount given to taker\n matchedFillResults.leftMakerAssetSpreadAmount = safeSub(\n matchedFillResults.left.makerAssetFilledAmount,\n matchedFillResults.right.takerAssetFilledAmount\n );\n\n // Compute fees for left order\n matchedFillResults.left.makerFeePaid = safeGetPartialAmountFloor(\n matchedFillResults.left.makerAssetFilledAmount,\n leftOrder.makerAssetAmount,\n leftOrder.makerFee\n );\n matchedFillResults.left.takerFeePaid = safeGetPartialAmountFloor(\n matchedFillResults.left.takerAssetFilledAmount,\n leftOrder.takerAssetAmount,\n leftOrder.takerFee\n );\n\n // Compute fees for right order\n matchedFillResults.right.makerFeePaid = safeGetPartialAmountFloor(\n matchedFillResults.right.makerAssetFilledAmount,\n rightOrder.makerAssetAmount,\n rightOrder.makerFee\n );\n matchedFillResults.right.takerFeePaid = safeGetPartialAmountFloor(\n matchedFillResults.right.takerAssetFilledAmount,\n rightOrder.takerAssetAmount,\n rightOrder.takerFee\n );\n\n // Return fill results\n return matchedFillResults;\n }\n\n /// @dev Settles matched order by transferring appropriate funds between order makers, taker, and fee recipient.\n /// @param leftOrder First matched order.\n /// @param rightOrder Second matched order.\n /// @param takerAddress Address that matched the orders. The taker receives the spread between orders as profit.\n /// @param matchedFillResults Struct holding amounts to transfer between makers, taker, and fee recipients.\n function settleMatchedOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n address takerAddress,\n LibFillResults.MatchedFillResults memory matchedFillResults\n )\n private\n {\n bytes memory zrxAssetData = ZRX_ASSET_DATA;\n // Order makers and taker\n dispatchTransferFrom(\n leftOrder.makerAssetData,\n leftOrder.makerAddress,\n rightOrder.makerAddress,\n matchedFillResults.right.takerAssetFilledAmount\n );\n dispatchTransferFrom(\n rightOrder.makerAssetData,\n rightOrder.makerAddress,\n leftOrder.makerAddress,\n matchedFillResults.left.takerAssetFilledAmount\n );\n dispatchTransferFrom(\n leftOrder.makerAssetData,\n leftOrder.makerAddress,\n takerAddress,\n matchedFillResults.leftMakerAssetSpreadAmount\n );\n\n // Maker fees\n dispatchTransferFrom(\n zrxAssetData,\n leftOrder.makerAddress,\n leftOrder.feeRecipientAddress,\n matchedFillResults.left.makerFeePaid\n );\n dispatchTransferFrom(\n zrxAssetData,\n rightOrder.makerAddress,\n rightOrder.feeRecipientAddress,\n matchedFillResults.right.makerFeePaid\n );\n\n // Taker fees\n if (leftOrder.feeRecipientAddress == rightOrder.feeRecipientAddress) {\n dispatchTransferFrom(\n zrxAssetData,\n takerAddress,\n leftOrder.feeRecipientAddress,\n safeAdd(\n matchedFillResults.left.takerFeePaid,\n matchedFillResults.right.takerFeePaid\n )\n );\n } else {\n dispatchTransferFrom(\n zrxAssetData,\n takerAddress,\n leftOrder.feeRecipientAddress,\n matchedFillResults.left.takerFeePaid\n );\n dispatchTransferFrom(\n zrxAssetData,\n takerAddress,\n rightOrder.feeRecipientAddress,\n matchedFillResults.right.takerFeePaid\n );\n }\n }\n}\n",
+ "protocol/Exchange/mixins/MMatchOrders.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\nimport \"../interfaces/IMatchOrders.sol\";\n\n\ncontract MMatchOrders is\n IMatchOrders\n{\n /// @dev Validates context for matchOrders. Succeeds or throws.\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n function assertValidMatch(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder\n )\n internal\n pure;\n\n /// @dev Calculates fill amounts for the matched orders.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the leftOrder order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftOrderTakerAssetFilledAmount Amount of left order already filled.\n /// @param rightOrderTakerAssetFilledAmount Amount of right order already filled.\n /// @param matchedFillResults Amounts to fill and fees to pay by maker and taker of matched orders.\n function calculateMatchedFillResults(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n uint256 leftOrderTakerAssetFilledAmount,\n uint256 rightOrderTakerAssetFilledAmount\n )\n internal\n pure\n returns (LibFillResults.MatchedFillResults memory matchedFillResults);\n\n}\n",
+ "protocol/Exchange/interfaces/IMatchOrders.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IMatchOrders {\n\n /// @dev Match two complementary orders that have a profitable spread.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the left order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftSignature Proof that order was created by the left maker.\n /// @param rightSignature Proof that order was created by the right maker.\n /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.\n function matchOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n bytes memory leftSignature,\n bytes memory rightSignature\n )\n public\n returns (LibFillResults.MatchedFillResults memory matchedFillResults);\n}\n"
+ },
+ "sourceTreeHashHex": "0x55d90debff62d359a25a4c00432a80752a3d625620569a2e0330a038b333d10b",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/TestLibBytes.json b/packages/contracts/generated-artifacts/TestLibBytes.json
new file mode 100644
index 000000000..0f73d05e5
--- /dev/null
+++ b/packages/contracts/generated-artifacts/TestLibBytes.json
@@ -0,0 +1,426 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "TestLibBytes",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ }
+ ],
+ "name": "publicPopLastByte",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ },
+ {
+ "name": "result",
+ "type": "bytes1"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicReadBytesWithLength",
+ "outputs": [
+ {
+ "name": "result",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "dest",
+ "type": "bytes"
+ },
+ {
+ "name": "source",
+ "type": "bytes"
+ }
+ ],
+ "name": "publicDeepCopyBytes",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "name": "input",
+ "type": "address"
+ }
+ ],
+ "name": "publicWriteAddress",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "name": "input",
+ "type": "bytes"
+ }
+ ],
+ "name": "publicWriteBytesWithLength",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "mem",
+ "type": "bytes"
+ },
+ {
+ "name": "dest",
+ "type": "uint256"
+ },
+ {
+ "name": "source",
+ "type": "uint256"
+ },
+ {
+ "name": "length",
+ "type": "uint256"
+ }
+ ],
+ "name": "testMemcpy",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicReadAddress",
+ "outputs": [
+ {
+ "name": "result",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "name": "input",
+ "type": "bytes32"
+ }
+ ],
+ "name": "publicWriteBytes32",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ }
+ ],
+ "name": "publicPopLast20Bytes",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ },
+ {
+ "name": "result",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "lhs",
+ "type": "bytes"
+ },
+ {
+ "name": "rhs",
+ "type": "bytes"
+ }
+ ],
+ "name": "publicEqualsPop1",
+ "outputs": [
+ {
+ "name": "equal",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ },
+ {
+ "name": "input",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicWriteUint256",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicReadBytes32",
+ "outputs": [
+ {
+ "name": "result",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicReadBytes4",
+ "outputs": [
+ {
+ "name": "result",
+ "type": "bytes4"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "b",
+ "type": "bytes"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicReadUint256",
+ "outputs": [
+ {
+ "name": "result",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "lhs",
+ "type": "bytes"
+ },
+ {
+ "name": "rhs",
+ "type": "bytes"
+ }
+ ],
+ "name": "publicEquals",
+ "outputs": [
+ {
+ "name": "equal",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b506114f8806100206000396000f3006080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630301d5e181146100df578063076eec08146101fb57806318c535d9146102cb5780633f2a25ec146103625780634b368768146103d957806378bbae9b1461047657806382e2fa24146104dc57806384f8775814610560578063a4b19654146105c2578063b1840e8d14610689578063b79650a414610734578063be766f1b14610796578063cc12cb2814610803578063e3a85ce414610893578063f06f300d146108ee575b600080fd5b3480156100eb57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101389436949293602493928401919081908401838280828437509497506109859650505050505050565b6040518080602001837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001828103825284818151815260200191508051906020019080838360005b838110156101bf5781810151838201526020016101a7565b50505050905090810190601f1680156101ec5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34801561020757600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261025694369492936024939284019190819084018382808284375094975050933594506109999350505050565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610290578181015183820152602001610278565b50505050905090810190601f1680156102bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102d757600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261025694369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506109b29650505050505050565b34801561036e57600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610256943694929360249392840191908190840183828082843750949750508435955050505060209091013573ffffffffffffffffffffffffffffffffffffffff1690506109c5565b3480156103e557600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261025694369492936024939284019190819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b8a359b909a9099940197509195509182019350915081908401838280828437509497506109e09650505050505050565b34801561048257600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610256943694929360249392840191908190840183828082843750949750508435955050506020830135926040013591506109f39050565b3480156104e857600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526105379436949293602493928401919081908401838280828437509497505093359450610a3d9350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561056c57600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610256943694929360249392840191908190840183828082843750949750508435955050506020909201359150610a4f9050565b3480156105ce57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261061b943694929360249392840191908190840183828082843750949750610a629650505050505050565b60405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182810382528481815181526020019150805190602001908083836000838110156101bf5781810151838201526020016101a7565b34801561069557600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261072094369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610a6f9650505050505050565b604080519115158252519081900360200190f35b34801561074057600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610256943694929360249392840191908190840183828082843750949750508435955050506020909201359150610a959050565b3480156107a257600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526107f19436949293602493928401919081908401838280828437509497505093359450610aa89350505050565b60408051918252519081900360200190f35b34801561080f57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261085e9436949293602493928401919081908401838280828437509497505093359450610aba9350505050565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b34801561089f57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526107f19436949293602493928401919081908401838280828437509497505093359450610acc9350505050565b3480156108fa57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261072094369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610ade9650505050505050565b6060600061099283610af0565b9293915050565b60606109ab838363ffffffff610c0f16565b9392505050565b60606109be8383610cc5565b5090919050565b60606109d884848463ffffffff610d7d16565b509192915050565b60606109d884848463ffffffff610e6116565b60606000855183850111151515610a0957600080fd5b85518584011115610a1957600080fd5b610a2286610f20565b9050610a3385820185830185610f26565b5093949350505050565b60006109ab838363ffffffff610fe916565b60606109d884848463ffffffff6110a516565b6060600061099283611146565b6000610a7a83610af0565b50610a8482610af0565b506109ab838363ffffffff61121a16565b60606109d884848463ffffffff61134416565b60006109ab838363ffffffff61134f16565b60006109ab838363ffffffff6113f516565b60006109ab838363ffffffff6114bd16565b60006109ab838363ffffffff61121a16565b6000808251111515610b8957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560448201527f4400000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b815182907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610bb957fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909252507f0100000000000000000000000000000000000000000000000000000000000000908190040290565b60606000610c1d84846114bd565b9050602083019250808301845110151515610cbf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f475245415445525f4f525f455155414c5f544f5f4e45535445445f425954455360448201527f5f4c454e4754485f524551554952454400000000000000000000000000000000606482015290519081900360840190fd5b50500190565b80518251811115610d5d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f475245415445525f4f525f455155414c5f544f5f534f555243455f425954455360448201527f5f4c454e4754485f524551554952454400000000000000000000000000000000606482015290519081900360840190fd5b610d78610d6984610f20565b610d7284610f20565b83610f26565b505050565b8251601483011115610e1657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6014919092010180517fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091189052565b80518260200101835110151515610eff57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f475245415445525f4f525f455155414c5f544f5f4e45535445445f425954455360448201527f5f4c454e4754485f524551554952454400000000000000000000000000000000606482015290519081900360840190fd5b610d7882610f0c85610f20565b01610f16836114c9565b8351602001610f26565b60200190565b6020811015610f50576001816020036101000a038019835116818551168082178652505050610d78565b82821415610f5d57610d78565b82821115610f975760208103905080820181840181515b82851015610f8f578451865260209586019590940193610f74565b905250610d78565b60208103905080820181840183515b81861215610fe057825182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09283019290910190610fa6565b85525050505050565b60008160140183511015151561108657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b825160208301111561113e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b910160200152565b600060148251101515156111e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6111ef826014845103610fe9565b82517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec019092525090565b6000815183511480156109ab5750816040518082805190602001908083835b6020831061127657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611239565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052604051919093018190038120885190955088945090928392508401908083835b6020831061130b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016112ce565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916149392505050565b610d788383836110a5565b6000816020018351101515156113ec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b50016020015190565b60008160040183511015151561149257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160448201527f5549524544000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b60006109ab838361134f565b905600a165627a7a723058201ecd3ec73f2eae8a5fea91f6d0bf1184dcfcd3a64ad8108a1ca36f7029734f250029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x14F8 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xDA JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x301D5E1 DUP2 EQ PUSH2 0xDF JUMPI DUP1 PUSH4 0x76EEC08 EQ PUSH2 0x1FB JUMPI DUP1 PUSH4 0x18C535D9 EQ PUSH2 0x2CB JUMPI DUP1 PUSH4 0x3F2A25EC EQ PUSH2 0x362 JUMPI DUP1 PUSH4 0x4B368768 EQ PUSH2 0x3D9 JUMPI DUP1 PUSH4 0x78BBAE9B EQ PUSH2 0x476 JUMPI DUP1 PUSH4 0x82E2FA24 EQ PUSH2 0x4DC JUMPI DUP1 PUSH4 0x84F87758 EQ PUSH2 0x560 JUMPI DUP1 PUSH4 0xA4B19654 EQ PUSH2 0x5C2 JUMPI DUP1 PUSH4 0xB1840E8D EQ PUSH2 0x689 JUMPI DUP1 PUSH4 0xB79650A4 EQ PUSH2 0x734 JUMPI DUP1 PUSH4 0xBE766F1B EQ PUSH2 0x796 JUMPI DUP1 PUSH4 0xCC12CB28 EQ PUSH2 0x803 JUMPI DUP1 PUSH4 0xE3A85CE4 EQ PUSH2 0x893 JUMPI DUP1 PUSH4 0xF06F300D EQ PUSH2 0x8EE JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x138 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x985 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP1 PUSH1 0x20 ADD DUP4 PUSH31 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH31 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1BF JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1A7 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x1EC JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP4 POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x207 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP SWAP4 CALLDATALOAD SWAP5 POP PUSH2 0x999 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x290 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x278 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x2BD JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2D7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F DUP10 CALLDATALOAD DUP12 ADD DUP1 CALLDATALOAD SWAP2 DUP3 ADD DUP4 SWAP1 DIV DUP4 MUL DUP5 ADD DUP4 ADD SWAP1 SWAP5 MSTORE DUP1 DUP4 MSTORE SWAP8 SWAP11 SWAP10 SWAP9 DUP2 ADD SWAP8 SWAP2 SWAP7 POP SWAP2 DUP3 ADD SWAP5 POP SWAP3 POP DUP3 SWAP2 POP DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x9B2 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x36E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP DUP5 CALLDATALOAD SWAP6 POP POP POP POP PUSH1 0x20 SWAP1 SWAP2 ADD CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP PUSH2 0x9C5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F DUP2 DUP11 ADD CALLDATALOAD DUP12 ADD DUP1 CALLDATALOAD SWAP2 DUP3 ADD DUP4 SWAP1 DIV DUP4 MUL DUP5 ADD DUP4 ADD DUP6 MSTORE DUP2 DUP5 MSTORE SWAP9 SWAP12 DUP11 CALLDATALOAD SWAP12 SWAP1 SWAP11 SWAP1 SWAP10 SWAP5 ADD SWAP8 POP SWAP2 SWAP6 POP SWAP2 DUP3 ADD SWAP4 POP SWAP2 POP DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x9E0 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x482 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP DUP5 CALLDATALOAD SWAP6 POP POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD SWAP3 PUSH1 0x40 ADD CALLDATALOAD SWAP2 POP PUSH2 0x9F3 SWAP1 POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4E8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x537 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP SWAP4 CALLDATALOAD SWAP5 POP PUSH2 0xA3D SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x56C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP DUP5 CALLDATALOAD SWAP6 POP POP POP PUSH1 0x20 SWAP1 SWAP3 ADD CALLDATALOAD SWAP2 POP PUSH2 0xA4F SWAP1 POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5CE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x61B SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0xA62 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP1 PUSH1 0x20 ADD DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 DUP4 DUP2 LT ISZERO PUSH2 0x1BF JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1A7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x695 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x720 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F DUP10 CALLDATALOAD DUP12 ADD DUP1 CALLDATALOAD SWAP2 DUP3 ADD DUP4 SWAP1 DIV DUP4 MUL DUP5 ADD DUP4 ADD SWAP1 SWAP5 MSTORE DUP1 DUP4 MSTORE SWAP8 SWAP11 SWAP10 SWAP9 DUP2 ADD SWAP8 SWAP2 SWAP7 POP SWAP2 DUP3 ADD SWAP5 POP SWAP3 POP DUP3 SWAP2 POP DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0xA6F SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x740 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP DUP5 CALLDATALOAD SWAP6 POP POP POP PUSH1 0x20 SWAP1 SWAP3 ADD CALLDATALOAD SWAP2 POP PUSH2 0xA95 SWAP1 POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7A2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x7F1 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP SWAP4 CALLDATALOAD SWAP5 POP PUSH2 0xAA8 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x80F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x85E SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP SWAP4 CALLDATALOAD SWAP5 POP PUSH2 0xABA SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x89F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x7F1 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP SWAP4 CALLDATALOAD SWAP5 POP PUSH2 0xACC SWAP4 POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x8FA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x720 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F DUP10 CALLDATALOAD DUP12 ADD DUP1 CALLDATALOAD SWAP2 DUP3 ADD DUP4 SWAP1 DIV DUP4 MUL DUP5 ADD DUP4 ADD SWAP1 SWAP5 MSTORE DUP1 DUP4 MSTORE SWAP8 SWAP11 SWAP10 SWAP9 DUP2 ADD SWAP8 SWAP2 SWAP7 POP SWAP2 DUP3 ADD SWAP5 POP SWAP3 POP DUP3 SWAP2 POP DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0xADE SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH2 0x992 DUP4 PUSH2 0xAF0 JUMP JUMPDEST SWAP3 SWAP4 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0xC0F AND JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9BE DUP4 DUP4 PUSH2 0xCC5 JUMP JUMPDEST POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9D8 DUP5 DUP5 DUP5 PUSH4 0xFFFFFFFF PUSH2 0xD7D AND JUMP JUMPDEST POP SWAP2 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9D8 DUP5 DUP5 DUP5 PUSH4 0xFFFFFFFF PUSH2 0xE61 AND JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP6 MLOAD DUP4 DUP6 ADD GT ISZERO ISZERO ISZERO PUSH2 0xA09 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP6 MLOAD DUP6 DUP5 ADD GT ISZERO PUSH2 0xA19 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xA22 DUP7 PUSH2 0xF20 JUMP JUMPDEST SWAP1 POP PUSH2 0xA33 DUP6 DUP3 ADD DUP6 DUP4 ADD DUP6 PUSH2 0xF26 JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0xFE9 AND JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9D8 DUP5 DUP5 DUP5 PUSH4 0xFFFFFFFF PUSH2 0x10A5 AND JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH2 0x992 DUP4 PUSH2 0x1146 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xA7A DUP4 PUSH2 0xAF0 JUMP JUMPDEST POP PUSH2 0xA84 DUP3 PUSH2 0xAF0 JUMP JUMPDEST POP PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x121A AND JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9D8 DUP5 DUP5 DUP5 PUSH4 0xFFFFFFFF PUSH2 0x1344 AND JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x134F AND JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x13F5 AND JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x14BD AND JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x121A AND JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 MLOAD GT ISZERO ISZERO PUSH2 0xB89 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x21 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F5448414E5F5A45524F5F4C454E4754485F52455155495245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x4400000000000000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST DUP2 MLOAD DUP3 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0xBB9 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP3 MSTORE POP PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV MUL SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH2 0xC1D DUP5 DUP5 PUSH2 0x14BD JUMP JUMPDEST SWAP1 POP PUSH1 0x20 DUP4 ADD SWAP3 POP DUP1 DUP4 ADD DUP5 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xCBF JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x30 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F4E45535445445F4259544553 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5F4C454E4754485F524551554952454400000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP POP ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD DUP3 MLOAD DUP2 GT ISZERO PUSH2 0xD5D JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x30 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F534F555243455F4259544553 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5F4C454E4754485F524551554952454400000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST PUSH2 0xD78 PUSH2 0xD69 DUP5 PUSH2 0xF20 JUMP JUMPDEST PUSH2 0xD72 DUP5 PUSH2 0xF20 JUMP JUMPDEST DUP4 PUSH2 0xF26 JUMP JUMPDEST POP POP POP JUMP JUMPDEST DUP3 MLOAD PUSH1 0x14 DUP4 ADD GT ISZERO PUSH2 0xE16 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST PUSH1 0x14 SWAP2 SWAP1 SWAP3 ADD ADD DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 XOR SWAP1 MSTORE JUMP JUMPDEST DUP1 MLOAD DUP3 PUSH1 0x20 ADD ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xEFF JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x30 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F4E45535445445F4259544553 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5F4C454E4754485F524551554952454400000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST PUSH2 0xD78 DUP3 PUSH2 0xF0C DUP6 PUSH2 0xF20 JUMP JUMPDEST ADD PUSH2 0xF16 DUP4 PUSH2 0x14C9 JUMP JUMPDEST DUP4 MLOAD PUSH1 0x20 ADD PUSH2 0xF26 JUMP JUMPDEST PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xF50 JUMPI PUSH1 0x1 DUP2 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP4 MLOAD AND DUP2 DUP6 MLOAD AND DUP1 DUP3 OR DUP7 MSTORE POP POP POP PUSH2 0xD78 JUMP JUMPDEST DUP3 DUP3 EQ ISZERO PUSH2 0xF5D JUMPI PUSH2 0xD78 JUMP JUMPDEST DUP3 DUP3 GT ISZERO PUSH2 0xF97 JUMPI PUSH1 0x20 DUP2 SUB SWAP1 POP DUP1 DUP3 ADD DUP2 DUP5 ADD DUP2 MLOAD JUMPDEST DUP3 DUP6 LT ISZERO PUSH2 0xF8F JUMPI DUP5 MLOAD DUP7 MSTORE PUSH1 0x20 SWAP6 DUP7 ADD SWAP6 SWAP1 SWAP5 ADD SWAP4 PUSH2 0xF74 JUMP JUMPDEST SWAP1 MSTORE POP PUSH2 0xD78 JUMP JUMPDEST PUSH1 0x20 DUP2 SUB SWAP1 POP DUP1 DUP3 ADD DUP2 DUP5 ADD DUP4 MLOAD JUMPDEST DUP2 DUP7 SLT ISZERO PUSH2 0xFE0 JUMPI DUP3 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP3 DUP4 ADD SWAP3 SWAP1 SWAP2 ADD SWAP1 PUSH2 0xFA6 JUMP JUMPDEST DUP6 MSTORE POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1086 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST DUP3 MLOAD PUSH1 0x20 DUP4 ADD GT ISZERO PUSH2 0x113E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST SWAP2 ADD PUSH1 0x20 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x14 DUP3 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x11E1 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST PUSH2 0x11EF DUP3 PUSH1 0x14 DUP5 MLOAD SUB PUSH2 0xFE9 JUMP JUMPDEST DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC ADD SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD DUP4 MLOAD EQ DUP1 ISZERO PUSH2 0x9AB JUMPI POP DUP2 PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x1276 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x1239 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP9 MLOAD SWAP1 SWAP6 POP DUP9 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x130B JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x12CE JUMP JUMPDEST PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP3 MLOAD AND DUP2 DUP5 MLOAD AND DUP1 DUP3 OR DUP6 MSTORE POP POP POP POP POP POP SWAP1 POP ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 PUSH1 0x0 NOT AND EQ SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0xD78 DUP4 DUP4 DUP4 PUSH2 0x10A5 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x13EC JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x4 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1492 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x25 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F345F4C454E4754485F524551 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5549524544000000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH2 0x134F JUMP JUMPDEST SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0x1e 0xcd RETURNDATACOPY 0xc7 0x3f 0x2e 0xae DUP11 0x5f 0xea SWAP2 0xf6 0xd0 0xbf GT DUP5 0xdc 0xfc 0xd3 0xa6 0x4a 0xd8 LT DUP11 SHR LOG3 PUSH16 0x7029734F250029000000000000000000 ",
+ "sourceMap": "651:7079:66:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;651:7079:66;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630301d5e181146100df578063076eec08146101fb57806318c535d9146102cb5780633f2a25ec146103625780634b368768146103d957806378bbae9b1461047657806382e2fa24146104dc57806384f8775814610560578063a4b19654146105c2578063b1840e8d14610689578063b79650a414610734578063be766f1b14610796578063cc12cb2814610803578063e3a85ce414610893578063f06f300d146108ee575b600080fd5b3480156100eb57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101389436949293602493928401919081908401838280828437509497506109859650505050505050565b6040518080602001837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168152602001828103825284818151815260200191508051906020019080838360005b838110156101bf5781810151838201526020016101a7565b50505050905090810190601f1680156101ec5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34801561020757600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261025694369492936024939284019190819084018382808284375094975050933594506109999350505050565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610290578181015183820152602001610278565b50505050905090810190601f1680156102bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102d757600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261025694369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506109b29650505050505050565b34801561036e57600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610256943694929360249392840191908190840183828082843750949750508435955050505060209091013573ffffffffffffffffffffffffffffffffffffffff1690506109c5565b3480156103e557600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261025694369492936024939284019190819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b8a359b909a9099940197509195509182019350915081908401838280828437509497506109e09650505050505050565b34801561048257600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610256943694929360249392840191908190840183828082843750949750508435955050506020830135926040013591506109f39050565b3480156104e857600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526105379436949293602493928401919081908401838280828437509497505093359450610a3d9350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561056c57600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610256943694929360249392840191908190840183828082843750949750508435955050506020909201359150610a4f9050565b3480156105ce57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261061b943694929360249392840191908190840183828082843750949750610a629650505050505050565b60405180806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182810382528481815181526020019150805190602001908083836000838110156101bf5781810151838201526020016101a7565b34801561069557600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261072094369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610a6f9650505050505050565b604080519115158252519081900360200190f35b34801561074057600080fd5b506040805160206004803580820135601f8101849004840285018401909552848452610256943694929360249392840191908190840183828082843750949750508435955050506020909201359150610a959050565b3480156107a257600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526107f19436949293602493928401919081908401838280828437509497505093359450610aa89350505050565b60408051918252519081900360200190f35b34801561080f57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261085e9436949293602493928401919081908401838280828437509497505093359450610aba9350505050565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b34801561089f57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526107f19436949293602493928401919081908401838280828437509497505093359450610acc9350505050565b3480156108fa57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261072094369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610ade9650505050505050565b6060600061099283610af0565b9293915050565b60606109ab838363ffffffff610c0f16565b9392505050565b60606109be8383610cc5565b5090919050565b60606109d884848463ffffffff610d7d16565b509192915050565b60606109d884848463ffffffff610e6116565b60606000855183850111151515610a0957600080fd5b85518584011115610a1957600080fd5b610a2286610f20565b9050610a3385820185830185610f26565b5093949350505050565b60006109ab838363ffffffff610fe916565b60606109d884848463ffffffff6110a516565b6060600061099283611146565b6000610a7a83610af0565b50610a8482610af0565b506109ab838363ffffffff61121a16565b60606109d884848463ffffffff61134416565b60006109ab838363ffffffff61134f16565b60006109ab838363ffffffff6113f516565b60006109ab838363ffffffff6114bd16565b60006109ab838363ffffffff61121a16565b6000808251111515610b8957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560448201527f4400000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b815182907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610bb957fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909252507f0100000000000000000000000000000000000000000000000000000000000000908190040290565b60606000610c1d84846114bd565b9050602083019250808301845110151515610cbf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f475245415445525f4f525f455155414c5f544f5f4e45535445445f425954455360448201527f5f4c454e4754485f524551554952454400000000000000000000000000000000606482015290519081900360840190fd5b50500190565b80518251811115610d5d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f475245415445525f4f525f455155414c5f544f5f534f555243455f425954455360448201527f5f4c454e4754485f524551554952454400000000000000000000000000000000606482015290519081900360840190fd5b610d78610d6984610f20565b610d7284610f20565b83610f26565b505050565b8251601483011115610e1657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6014919092010180517fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909216919091189052565b80518260200101835110151515610eff57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f475245415445525f4f525f455155414c5f544f5f4e45535445445f425954455360448201527f5f4c454e4754485f524551554952454400000000000000000000000000000000606482015290519081900360840190fd5b610d7882610f0c85610f20565b01610f16836114c9565b8351602001610f26565b60200190565b6020811015610f50576001816020036101000a038019835116818551168082178652505050610d78565b82821415610f5d57610d78565b82821115610f975760208103905080820181840181515b82851015610f8f578451865260209586019590940193610f74565b905250610d78565b60208103905080820181840183515b81861215610fe057825182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09283019290910190610fa6565b85525050505050565b60008160140183511015151561108657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b825160208301111561113e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b910160200152565b600060148251101515156111e157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6111ef826014845103610fe9565b82517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec019092525090565b6000815183511480156109ab5750816040518082805190602001908083835b6020831061127657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611239565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0180199092169116179052604051919093018190038120885190955088945090928392508401908083835b6020831061130b57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016112ce565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916149392505050565b610d788383836110a5565b6000816020018351101515156113ec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b50016020015190565b60008160040183511015151561149257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160448201527f5549524544000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b60006109ab838361134f565b905600a165627a7a723058201ecd3ec73f2eae8a5fea91f6d0bf1184dcfcd3a64ad8108a1ca36f7029734f250029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xDA JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x301D5E1 DUP2 EQ PUSH2 0xDF JUMPI DUP1 PUSH4 0x76EEC08 EQ PUSH2 0x1FB JUMPI DUP1 PUSH4 0x18C535D9 EQ PUSH2 0x2CB JUMPI DUP1 PUSH4 0x3F2A25EC EQ PUSH2 0x362 JUMPI DUP1 PUSH4 0x4B368768 EQ PUSH2 0x3D9 JUMPI DUP1 PUSH4 0x78BBAE9B EQ PUSH2 0x476 JUMPI DUP1 PUSH4 0x82E2FA24 EQ PUSH2 0x4DC JUMPI DUP1 PUSH4 0x84F87758 EQ PUSH2 0x560 JUMPI DUP1 PUSH4 0xA4B19654 EQ PUSH2 0x5C2 JUMPI DUP1 PUSH4 0xB1840E8D EQ PUSH2 0x689 JUMPI DUP1 PUSH4 0xB79650A4 EQ PUSH2 0x734 JUMPI DUP1 PUSH4 0xBE766F1B EQ PUSH2 0x796 JUMPI DUP1 PUSH4 0xCC12CB28 EQ PUSH2 0x803 JUMPI DUP1 PUSH4 0xE3A85CE4 EQ PUSH2 0x893 JUMPI DUP1 PUSH4 0xF06F300D EQ PUSH2 0x8EE JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x138 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x985 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP1 PUSH1 0x20 ADD DUP4 PUSH31 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH31 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1BF JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1A7 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x1EC JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP4 POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x207 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP SWAP4 CALLDATALOAD SWAP5 POP PUSH2 0x999 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x290 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x278 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x2BD JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2D7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F DUP10 CALLDATALOAD DUP12 ADD DUP1 CALLDATALOAD SWAP2 DUP3 ADD DUP4 SWAP1 DIV DUP4 MUL DUP5 ADD DUP4 ADD SWAP1 SWAP5 MSTORE DUP1 DUP4 MSTORE SWAP8 SWAP11 SWAP10 SWAP9 DUP2 ADD SWAP8 SWAP2 SWAP7 POP SWAP2 DUP3 ADD SWAP5 POP SWAP3 POP DUP3 SWAP2 POP DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x9B2 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x36E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP DUP5 CALLDATALOAD SWAP6 POP POP POP POP PUSH1 0x20 SWAP1 SWAP2 ADD CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP PUSH2 0x9C5 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x3E5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F DUP2 DUP11 ADD CALLDATALOAD DUP12 ADD DUP1 CALLDATALOAD SWAP2 DUP3 ADD DUP4 SWAP1 DIV DUP4 MUL DUP5 ADD DUP4 ADD DUP6 MSTORE DUP2 DUP5 MSTORE SWAP9 SWAP12 DUP11 CALLDATALOAD SWAP12 SWAP1 SWAP11 SWAP1 SWAP10 SWAP5 ADD SWAP8 POP SWAP2 SWAP6 POP SWAP2 DUP3 ADD SWAP4 POP SWAP2 POP DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x9E0 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x482 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP DUP5 CALLDATALOAD SWAP6 POP POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD SWAP3 PUSH1 0x40 ADD CALLDATALOAD SWAP2 POP PUSH2 0x9F3 SWAP1 POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x4E8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x537 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP SWAP4 CALLDATALOAD SWAP5 POP PUSH2 0xA3D SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x56C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP DUP5 CALLDATALOAD SWAP6 POP POP POP PUSH1 0x20 SWAP1 SWAP3 ADD CALLDATALOAD SWAP2 POP PUSH2 0xA4F SWAP1 POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x5CE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x61B SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0xA62 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP1 PUSH1 0x20 ADD DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 MLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 DUP4 DUP2 LT ISZERO PUSH2 0x1BF JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1A7 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x695 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x720 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F DUP10 CALLDATALOAD DUP12 ADD DUP1 CALLDATALOAD SWAP2 DUP3 ADD DUP4 SWAP1 DIV DUP4 MUL DUP5 ADD DUP4 ADD SWAP1 SWAP5 MSTORE DUP1 DUP4 MSTORE SWAP8 SWAP11 SWAP10 SWAP9 DUP2 ADD SWAP8 SWAP2 SWAP7 POP SWAP2 DUP3 ADD SWAP5 POP SWAP3 POP DUP3 SWAP2 POP DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0xA6F SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x740 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x256 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP DUP5 CALLDATALOAD SWAP6 POP POP POP PUSH1 0x20 SWAP1 SWAP3 ADD CALLDATALOAD SWAP2 POP PUSH2 0xA95 SWAP1 POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x7A2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x7F1 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP SWAP4 CALLDATALOAD SWAP5 POP PUSH2 0xAA8 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x80F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x85E SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP SWAP4 CALLDATALOAD SWAP5 POP PUSH2 0xABA SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x89F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x7F1 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP POP SWAP4 CALLDATALOAD SWAP5 POP PUSH2 0xACC SWAP4 POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x8FA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 DUP1 CALLDATALOAD DUP1 DUP3 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x720 SWAP5 CALLDATASIZE SWAP5 SWAP3 SWAP4 PUSH1 0x24 SWAP4 SWAP3 DUP5 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x1F DUP10 CALLDATALOAD DUP12 ADD DUP1 CALLDATALOAD SWAP2 DUP3 ADD DUP4 SWAP1 DIV DUP4 MUL DUP5 ADD DUP4 ADD SWAP1 SWAP5 MSTORE DUP1 DUP4 MSTORE SWAP8 SWAP11 SWAP10 SWAP9 DUP2 ADD SWAP8 SWAP2 SWAP7 POP SWAP2 DUP3 ADD SWAP5 POP SWAP3 POP DUP3 SWAP2 POP DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0xADE SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH2 0x992 DUP4 PUSH2 0xAF0 JUMP JUMPDEST SWAP3 SWAP4 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0xC0F AND JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9BE DUP4 DUP4 PUSH2 0xCC5 JUMP JUMPDEST POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9D8 DUP5 DUP5 DUP5 PUSH4 0xFFFFFFFF PUSH2 0xD7D AND JUMP JUMPDEST POP SWAP2 SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9D8 DUP5 DUP5 DUP5 PUSH4 0xFFFFFFFF PUSH2 0xE61 AND JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 DUP6 MLOAD DUP4 DUP6 ADD GT ISZERO ISZERO ISZERO PUSH2 0xA09 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP6 MLOAD DUP6 DUP5 ADD GT ISZERO PUSH2 0xA19 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xA22 DUP7 PUSH2 0xF20 JUMP JUMPDEST SWAP1 POP PUSH2 0xA33 DUP6 DUP3 ADD DUP6 DUP4 ADD DUP6 PUSH2 0xF26 JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0xFE9 AND JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9D8 DUP5 DUP5 DUP5 PUSH4 0xFFFFFFFF PUSH2 0x10A5 AND JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH2 0x992 DUP4 PUSH2 0x1146 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xA7A DUP4 PUSH2 0xAF0 JUMP JUMPDEST POP PUSH2 0xA84 DUP3 PUSH2 0xAF0 JUMP JUMPDEST POP PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x121A AND JUMP JUMPDEST PUSH1 0x60 PUSH2 0x9D8 DUP5 DUP5 DUP5 PUSH4 0xFFFFFFFF PUSH2 0x1344 AND JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x134F AND JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x13F5 AND JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x14BD AND JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH4 0xFFFFFFFF PUSH2 0x121A AND JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 MLOAD GT ISZERO ISZERO PUSH2 0xB89 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x21 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F5448414E5F5A45524F5F4C454E4754485F52455155495245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x4400000000000000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST DUP2 MLOAD DUP3 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0xBB9 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP3 MSTORE POP PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV MUL SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH1 0x0 PUSH2 0xC1D DUP5 DUP5 PUSH2 0x14BD JUMP JUMPDEST SWAP1 POP PUSH1 0x20 DUP4 ADD SWAP3 POP DUP1 DUP4 ADD DUP5 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xCBF JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x30 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F4E45535445445F4259544553 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5F4C454E4754485F524551554952454400000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP POP ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD DUP3 MLOAD DUP2 GT ISZERO PUSH2 0xD5D JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x30 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F534F555243455F4259544553 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5F4C454E4754485F524551554952454400000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST PUSH2 0xD78 PUSH2 0xD69 DUP5 PUSH2 0xF20 JUMP JUMPDEST PUSH2 0xD72 DUP5 PUSH2 0xF20 JUMP JUMPDEST DUP4 PUSH2 0xF26 JUMP JUMPDEST POP POP POP JUMP JUMPDEST DUP3 MLOAD PUSH1 0x14 DUP4 ADD GT ISZERO PUSH2 0xE16 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST PUSH1 0x14 SWAP2 SWAP1 SWAP3 ADD ADD DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 XOR SWAP1 MSTORE JUMP JUMPDEST DUP1 MLOAD DUP3 PUSH1 0x20 ADD ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xEFF JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x30 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F4E45535445445F4259544553 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5F4C454E4754485F524551554952454400000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST PUSH2 0xD78 DUP3 PUSH2 0xF0C DUP6 PUSH2 0xF20 JUMP JUMPDEST ADD PUSH2 0xF16 DUP4 PUSH2 0x14C9 JUMP JUMPDEST DUP4 MLOAD PUSH1 0x20 ADD PUSH2 0xF26 JUMP JUMPDEST PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x20 DUP2 LT ISZERO PUSH2 0xF50 JUMPI PUSH1 0x1 DUP2 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP4 MLOAD AND DUP2 DUP6 MLOAD AND DUP1 DUP3 OR DUP7 MSTORE POP POP POP PUSH2 0xD78 JUMP JUMPDEST DUP3 DUP3 EQ ISZERO PUSH2 0xF5D JUMPI PUSH2 0xD78 JUMP JUMPDEST DUP3 DUP3 GT ISZERO PUSH2 0xF97 JUMPI PUSH1 0x20 DUP2 SUB SWAP1 POP DUP1 DUP3 ADD DUP2 DUP5 ADD DUP2 MLOAD JUMPDEST DUP3 DUP6 LT ISZERO PUSH2 0xF8F JUMPI DUP5 MLOAD DUP7 MSTORE PUSH1 0x20 SWAP6 DUP7 ADD SWAP6 SWAP1 SWAP5 ADD SWAP4 PUSH2 0xF74 JUMP JUMPDEST SWAP1 MSTORE POP PUSH2 0xD78 JUMP JUMPDEST PUSH1 0x20 DUP2 SUB SWAP1 POP DUP1 DUP3 ADD DUP2 DUP5 ADD DUP4 MLOAD JUMPDEST DUP2 DUP7 SLT ISZERO PUSH2 0xFE0 JUMPI DUP3 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP3 DUP4 ADD SWAP3 SWAP1 SWAP2 ADD SWAP1 PUSH2 0xFA6 JUMP JUMPDEST DUP6 MSTORE POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1086 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST DUP3 MLOAD PUSH1 0x20 DUP4 ADD GT ISZERO PUSH2 0x113E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST SWAP2 ADD PUSH1 0x20 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x14 DUP3 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x11E1 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST PUSH2 0x11EF DUP3 PUSH1 0x14 DUP5 MLOAD SUB PUSH2 0xFE9 JUMP JUMPDEST DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC ADD SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD DUP4 MLOAD EQ DUP1 ISZERO PUSH2 0x9AB JUMPI POP DUP2 PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x1276 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x1239 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP9 MLOAD SWAP1 SWAP6 POP DUP9 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x130B JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x12CE JUMP JUMPDEST PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP3 MLOAD AND DUP2 DUP5 MLOAD AND DUP1 DUP3 OR DUP6 MSTORE POP POP POP POP POP POP SWAP1 POP ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 PUSH1 0x0 NOT AND EQ SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH2 0xD78 DUP4 DUP4 DUP4 PUSH2 0x10A5 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x13EC JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x4 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1492 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x25 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F345F4C454E4754485F524551 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5549524544000000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x9AB DUP4 DUP4 PUSH2 0x134F JUMP JUMPDEST SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0x1e 0xcd RETURNDATACOPY 0xc7 0x3f 0x2e 0xae DUP11 0x5f 0xea SWAP2 0xf6 0xd0 0xbf GT DUP5 0xdc 0xfc 0xd3 0xa6 0x4a 0xd8 LT DUP11 SHR LOG3 PUSH16 0x7029734F250029000000000000000000 ",
+ "sourceMap": "651:7079:66:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;889:190;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;889:190:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;889:190:66;;-1:-1:-1;889:190:66;;-1:-1:-1;;;;;;;889:190:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;889:190:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5966:235;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5966:235:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5966:235:66;;-1:-1:-1;;5966:235:66;;;-1:-1:-1;5966:235:66;;-1:-1:-1;;;;5966:235:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;5966:235:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2360:228;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2360:228:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;2360:228:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2360:228:66;;;;-1:-1:-1;2360:228:66;-1:-1:-1;2360:228:66;;-1:-1:-1;2360:228:66;;;;;;;;-1:-1:-1;2360:228:66;;-1:-1:-1;2360:228:66;;-1:-1:-1;;;;;;;2360:228:66;3253:230;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3253:230:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3253:230:66;;-1:-1:-1;;3253:230:66;;;-1:-1:-1;;;;3253:230:66;;;;;;;;-1:-1:-1;3253:230:66;;6460:251;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;6460:251:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;6460:251:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6460:251:66;;-1:-1:-1;6460:251:66;;;;-1:-1:-1;6460:251:66;-1:-1:-1;6460:251:66;;;;;;;;;;-1:-1:-1;6460:251:66;;-1:-1:-1;6460:251:66;;-1:-1:-1;;;;;;;6460:251:66;7080:648;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7080:648:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7080:648:66;;-1:-1:-1;;7080:648:66;;;-1:-1:-1;;;7080:648:66;;;;;;;;;-1:-1:-1;7080:648:66;;-1:-1:-1;7080:648:66;2802:214;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2802:214:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2802:214:66;;-1:-1:-1;;2802:214:66;;;-1:-1:-1;2802:214:66;;-1:-1:-1;;;;2802:214:66;;;;;;;;;;;;;;;;;;;;4169:230;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4169:230:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4169:230:66;;-1:-1:-1;;4169:230:66;;;-1:-1:-1;;;4169:230:66;;;;;;-1:-1:-1;4169:230:66;;-1:-1:-1;4169:230:66;1274:197;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1274:197:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1274:197:66;;-1:-1:-1;1274:197:66;;-1:-1:-1;;;;;;;1274:197:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;1875:239:66;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1875:239:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1875:239:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1875:239:66;;;;-1:-1:-1;1875:239:66;-1:-1:-1;1875:239:66;;-1:-1:-1;1875:239:66;;;;;;;;-1:-1:-1;1875:239:66;;-1:-1:-1;1875:239:66;;-1:-1:-1;;;;;;;1875:239:66;;;;;;;;;;;;;;;;;;;5085:230;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5085:230:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5085:230:66;;-1:-1:-1;;5085:230:66;;;-1:-1:-1;;;5085:230:66;;;;;;-1:-1:-1;5085:230:66;;-1:-1:-1;5085:230:66;3719:214;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3719:214:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3719:214:66;;-1:-1:-1;;3719:214:66;;;-1:-1:-1;3719:214:66;;-1:-1:-1;;;;3719:214:66;;;;;;;;;;;;;;;;;5557:211;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5557:211:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5557:211:66;;-1:-1:-1;;5557:211:66;;;-1:-1:-1;5557:211:66;;-1:-1:-1;;;;5557:211:66;;;;;;;;;;;;;;;;;;;;4635:214;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4635:214:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4635:214:66;;-1:-1:-1;;4635:214:66;;;-1:-1:-1;4635:214:66;;-1:-1:-1;;;;4635:214:66;1684:181;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1684:181:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1684:181:66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1684:181:66;;;;-1:-1:-1;1684:181:66;-1:-1:-1;1684:181:66;;-1:-1:-1;1684:181:66;;;;;;;;-1:-1:-1;1684:181:66;;-1:-1:-1;1684:181:66;;-1:-1:-1;;;;;;;1684:181:66;889:190;977:5;991:13;1029:15;:1;:13;:15::i;:::-;1062:1;;889:190;-1:-1:-1;;889:190:66:o;5966:235::-;6099:19;6143:28;:1;6165:5;6143:28;:21;:28;:::i;:::-;6134:37;5966:235;-1:-1:-1;;;5966:235:66:o;2360:228::-;2496:5;2524:36;2547:4;2553:6;2524:22;:36::i;:::-;-1:-1:-1;2577:4:66;;2360:228;-1:-1:-1;2360:228:66:o;3253:230::-;3402:5;3430:28;:1;3445:5;3452;3430:28;:14;:28;:::i;:::-;-1:-1:-1;3475:1:66;;3253:230;-1:-1:-1;;3253:230:66:o;6460:251::-;6622:5;6650:36;:1;6673:5;6680;6650:36;:22;:36;:::i;7080:648::-;7281:5;7491:14;7381:3;:10;7371:6;7362;:15;:29;;7354:38;;;;;;;;7427:10;;7410:13;;;:27;;7402:36;;;;;;7508:20;:3;:18;:20::i;:::-;7491:37;;7601:56;7627:4;7618:6;:13;7642:6;7633;:15;7650:6;7601:16;:56::i;:::-;-1:-1:-1;7718:3:66;;7080:648;-1:-1:-1;;;;7080:648:66:o;2802:214::-;2927:14;2966:20;:1;2980:5;2966:20;:13;:20;:::i;4169:230::-;4318:5;4346:28;:1;4361:5;4368;4346:28;:14;:28;:::i;1274:197::-;1365:5;1379:14;1418:18;:1;:16;:18::i;1875:239::-;1982:10;2008:17;:3;:15;:17::i;:::-;;2035;:3;:15;:17::i;:::-;-1:-1:-1;2070:15:66;:3;2081;2070:15;:10;:15;:::i;5085:230::-;5234:5;5262:28;:1;5277:5;5284;5262:28;:14;:28;:::i;3719:214::-;3844:14;3883:20;:1;3897:5;3883:20;:13;:20;:::i;5557:211::-;5681:13;5719:19;:1;5732:5;5719:19;:12;:19;:::i;4635:214::-;4760:14;4799:20;:1;4813:5;4799:20;:13;:20;:::i;1684:181::-;1787:10;1821:15;:3;1832;1821:15;:10;:15;:::i;8313:448:80:-;8397:13;8458:1;8447;:8;:12;8426:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8568:8;;8566:1;;8568:12;;;;8566:15;;;;;;;;;;8680:8;;8676:16;;8705:17;;;-1:-1:-1;8566:15:80;;;;;;;8313:448::o;16603:672::-;16732:19;16806:25;16834:21;16846:1;16849:5;16834:11;:21::i;:::-;16806:49;;16874:2;16865:11;;;;17010:17;17002:5;:25;16990:1;:8;:37;;16969:132;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;17223:13:80;;16603:672::o;18368:504::-;18517:13;;18645:11;;:24;-1:-1:-1;18645:24:80;18624:119;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18753:112;18774:21;:4;:19;:21::i;:::-;18809:23;:6;:21;:23::i;:::-;18846:9;18753:7;:112::i;:::-;18368:504;;;:::o;11391:1663::-;11554:8;;11574:2;11566:10;;-1:-1:-1;11554:22:80;11533:135;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11915:2;12621:13;;;;;12615:20;;12653:66;12594:139;12878:42;12867:54;;;13016:21;;;;12994:44;;11980:1068::o;17491:631::-;17767:5;:12;17754:5;17762:2;17754:10;:25;17742:1;:8;:37;;17721:161;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;17926:189;17968:5;17947:18;:1;:16;:18::i;:::-;:26;17987:18;:5;:16;:18::i;:::-;18049:5;:12;18064:2;18049:17;17926:7;:189::i;1341:228::-;1520:2;1509:14;;1341:228::o;1808:4337::-;1958:2;1949:6;:11;1945:4194;;;2247:1;2237:6;2233:2;2229:15;2224:3;2220:25;2216:33;2298:4;2294:9;2285:6;2279:13;2275:29;2347:4;2340;2334:11;2330:22;2388:1;2385;2382:8;2376:4;2369:22;2186:219;;;;;;2509:4;2499:6;:14;2495:59;;;2533:7;;2495:59;3243:4;3234:6;:13;3230:2899;;;3569:2;3561:6;3557:15;3547:25;;3617:6;3609;3605:19;3667:6;3661:4;3657:17;3974:4;3968:11;4242:198;4260:4;4252:6;4249:16;4242:198;;;4308:13;;4295:27;;4369:2;4405:13;;;;4357:15;;;;4242:198;;;4529:18;;-1:-1:-1;3276:1289:80;;;4810:2;4802:6;4798:15;4788:25;;4858:6;4850;4846:19;4908:6;4902:4;4898:17;5218:6;5212:13;5797:191;5814:4;5808;5804:15;5797:191;;;5862:11;;5849:25;;5907:13;;;;;5953;;;;5797:191;;;6078:19;;-1:-1:-1;;1808:4337:80;;;:::o;10268:886::-;10389:14;10452:5;10460:2;10452:10;10440:1;:8;:22;;10419:135;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;11056:13:80;10801:2;11056:13;11050:20;11072:42;11046:69;;10268:886::o;14016:456::-;14179:8;;14199:2;14191:10;;-1:-1:-1;14179:22:80;14158:107;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14435:13;;14346:2;14435:13;14428:28;14414:52::o;8956:482::-;9043:14;9106:2;9094:1;:8;:14;;9073:99;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9224:29;9236:1;9250:2;9239:1;:8;:13;9224:11;:29::i;:::-;9356:8;;9352:17;;9382;;;-1:-1:-1;9215:38:80;8956:482::o;9651:403::-;9772:10;10001:3;:10;9987:3;:10;:24;:60;;;;;10043:3;10033:14;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;10033:14:80;;;;;;;;;;;10015;;10033;;-1:-1:-1;10015:14:80;;-1:-1:-1;10033:14:80;;;;-1:-1:-1;10015:14:80;;;;10033;10015;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;10015:14:80;;;;;;;;;;;;;;;;:32;;;;9980:67;9651:403;-1:-1:-1;;;9651:403:80:o;15164:187::-;15306:38;15319:1;15322:5;15337;15306:12;:38::i;13290:490::-;13411:14;13474:5;13482:2;13474:10;13462:1;:8;:22;;13441:107;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;13727:13:80;13629:2;13727:13;13721:20;;13290:490::o;15593:687::-;15713:13;15775:5;15783:1;15775:9;15763:1;:8;:21;;15742:105;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;16021:13:80;15924:2;16021:13;16015:20;16174:66;16162:79;;15593:687::o;14708:220::-;14829:14;14876:21;14888:1;14891:5;14876:11;:21::i;922:215::-;1086:5;922:215::o"
+ }
+ }
+ },
+ "sources": {
+ "test/TestLibBytes/TestLibBytes.sol": {
+ "id": 66
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ }
+ },
+ "sourceCodes": {
+ "test/TestLibBytes/TestLibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/LibBytes/LibBytes.sol\";\n\n\ncontract TestLibBytes {\n \n using LibBytes for bytes;\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function publicPopLastByte(bytes memory b)\n public\n pure\n returns (bytes memory, bytes1 result)\n {\n result = b.popLastByte();\n return (b, result);\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function publicPopLast20Bytes(bytes memory b)\n public\n pure\n returns (bytes memory, address result)\n {\n result = b.popLast20Bytes();\n return (b, result);\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function publicEquals(bytes memory lhs, bytes memory rhs)\n public\n pure\n returns (bool equal)\n {\n equal = lhs.equals(rhs);\n return equal;\n }\n \n function publicEqualsPop1(bytes memory lhs, bytes memory rhs)\n public\n pure\n returns (bool equal)\n {\n lhs.popLastByte();\n rhs.popLastByte();\n equal = lhs.equals(rhs);\n return equal;\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function publicDeepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n public\n pure\n returns (bytes memory)\n {\n LibBytes.deepCopyBytes(dest, source);\n return dest;\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function publicReadAddress(\n bytes memory b,\n uint256 index\n )\n public\n pure\n returns (address result)\n {\n result = b.readAddress(index);\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function publicWriteAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n public\n pure\n returns (bytes memory)\n {\n b.writeAddress(index, input);\n return b;\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function publicReadBytes32(\n bytes memory b,\n uint256 index\n )\n public\n pure\n returns (bytes32 result)\n {\n result = b.readBytes32(index);\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function publicWriteBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n public\n pure\n returns (bytes memory)\n {\n b.writeBytes32(index, input);\n return b;\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function publicReadUint256(\n bytes memory b,\n uint256 index\n )\n public\n pure\n returns (uint256 result)\n {\n result = b.readUint256(index);\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function publicWriteUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n public\n pure\n returns (bytes memory)\n {\n b.writeUint256(index, input);\n return b;\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function publicReadBytes4(\n bytes memory b,\n uint256 index\n )\n public\n pure\n returns (bytes4 result)\n {\n result = b.readBytes4(index);\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function publicReadBytesWithLength(\n bytes memory b,\n uint256 index\n )\n public\n pure\n returns (bytes memory result)\n {\n result = b.readBytesWithLength(index);\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n /// @return b Updated input byte array\n function publicWriteBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n public\n pure\n returns (bytes memory)\n {\n b.writeBytesWithLength(index, input);\n return b;\n }\n \n /// @dev Copies a block of memory from one location to another.\n /// @param mem Memory contents we want to apply memCopy to\n /// @param dest Destination offset into <mem>.\n /// @param source Source offset into <mem>.\n /// @param length Length of bytes to copy from <source> to <dest>\n /// @return mem Memory contents after calling memCopy.\n function testMemcpy(\n bytes mem,\n uint256 dest,\n uint256 source,\n uint256 length\n )\n public // not external, we need input in memory\n pure\n returns (bytes)\n {\n // Sanity check. Overflows are not checked.\n require(source + length <= mem.length);\n require(dest + length <= mem.length);\n\n // Get pointer to memory contents\n uint256 offset = mem.contentAddress();\n\n // Execute memCopy adjusted for memory array location\n LibBytes.memCopy(offset + dest, offset + source, length);\n\n // Return modified memory contents\n return mem;\n }\n}\n",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0xeae199fe6645351443dcf1120ab1b29278d961bf61633b1b57eb1f9b4d21fade",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/TestLibs.json b/packages/contracts/generated-artifacts/TestLibs.json
new file mode 100644
index 000000000..c14689c0b
--- /dev/null
+++ b/packages/contracts/generated-artifacts/TestLibs.json
@@ -0,0 +1,450 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "TestLibs",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicIsRoundingErrorFloor",
+ "outputs": [
+ {
+ "name": "isError",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicGetPartialAmountCeil",
+ "outputs": [
+ {
+ "name": "partialAmount",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getDomainSeparatorSchemaHash",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "totalFillResults",
+ "type": "tuple"
+ },
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "singleFillResults",
+ "type": "tuple"
+ }
+ ],
+ "name": "publicAddFillResults",
+ "outputs": [
+ {
+ "components": [
+ {
+ "name": "makerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetFilledAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFeePaid",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFeePaid",
+ "type": "uint256"
+ }
+ ],
+ "name": "",
+ "type": "tuple"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicIsRoundingErrorCeil",
+ "outputs": [
+ {
+ "name": "isError",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getOrderSchemaHash",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "numerator",
+ "type": "uint256"
+ },
+ {
+ "name": "denominator",
+ "type": "uint256"
+ },
+ {
+ "name": "target",
+ "type": "uint256"
+ }
+ ],
+ "name": "publicGetPartialAmountFloor",
+ "outputs": [
+ {
+ "name": "partialAmount",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ }
+ ],
+ "name": "publicGetOrderHash",
+ "outputs": [
+ {
+ "name": "orderHash",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "EIP712_DOMAIN_HASH",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "publicAbiEncodeFillOrder",
+ "outputs": [
+ {
+ "name": "fillOrderCalldata",
+ "type": "bytes"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x7f454950373132446f6d61696e280000000000000000000000000000000000000060a09081527f737472696e67206e616d652c000000000000000000000000000000000000000060ad527f737472696e672076657273696f6e2c000000000000000000000000000000000060b9527f6164647265737320766572696679696e67436f6e74726163740000000000000060c8527f290000000000000000000000000000000000000000000000000000000000000060e1526042608081815260e26040819052909290918291908083835b602083106100ed5780518252601f1990920191602091820191016100ce565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208285018552600b8084527f30782050726f746f636f6c000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b602083106101755780518252601f199092019160209182019101610156565b51815160209384036101000a600019018019909216911617905260408051929094018290038220828501855260018084527f3200000000000000000000000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b602083106101fd5780518252601f1990920191602091820191016101de565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208282019890985281840196909652606081019690965250306080808701919091528151808703909101815260a09095019081905284519093849350850191508083835b602083106102865780518252601f199092019160209182019101610267565b5181516000196020949094036101000a939093019283169219169190911790526040519201829003909120600055505050611634806102c66000396000f3006080604052600436106100a35763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631be2390181146100a857806320777f70146100de578063494d92971461010b57806366758d7b14610120578063679d2f9a1461014d5780637d33c6ee1461016d578063be7ada1e14610182578063d9802088146101a2578063e306f779146101c2578063e9c7aa1a146101d7575b600080fd5b3480156100b457600080fd5b506100c86100c336600461132d565b610204565b6040516100d5919061149d565b60405180910390f35b3480156100ea57600080fd5b506100fe6100f936600461132d565b610219565b6040516100d591906114ab565b34801561011757600080fd5b506100fe610226565b34801561012c57600080fd5b5061014061013b366004611241565b61037e565b6040516100d591906114fa565b34801561015957600080fd5b506100c861016836600461132d565b610399565b34801561017957600080fd5b506100fe6103a6565b34801561018e57600080fd5b506100fe61019d36600461132d565b610626565b3480156101ae57600080fd5b506100fe6101bd36600461127c565b610633565b3480156101ce57600080fd5b506100fe61063e565b3480156101e357600080fd5b506101f76101f23660046112b1565b610644565b6040516100d591906114b9565b6000610211848484610651565b949350505050565b60006102118484846106e1565b604080517f454950373132446f6d61696e28000000000000000000000000000000000000006020808301919091527f737472696e67206e616d652c0000000000000000000000000000000000000000602d8301527f737472696e672076657273696f6e2c000000000000000000000000000000000060398301527f6164647265737320766572696679696e67436f6e74726163740000000000000060488301527f29000000000000000000000000000000000000000000000000000000000000006061830152825160428184030181526062909201928390528151600093918291908401908083835b6020831061034c57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161030f565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020905090565b610386610fed565b6103908383610742565b50815b92915050565b60006102118484846107a4565b604080517f4f726465722800000000000000000000000000000000000000000000000000006020808301919091527f61646472657373206d616b6572416464726573732c000000000000000000000060268301527f616464726573732074616b6572416464726573732c0000000000000000000000603b8301527f6164647265737320666565526563697069656e74416464726573732c0000000060508301527f616464726573732073656e646572416464726573732c00000000000000000000606c8301527f75696e74323536206d616b65724173736574416d6f756e742c0000000000000060828301527f75696e743235362074616b65724173736574416d6f756e742c00000000000000609b8301527f75696e74323536206d616b65724665652c00000000000000000000000000000060b48301527f75696e743235362074616b65724665652c00000000000000000000000000000060c58301527f75696e743235362065787069726174696f6e54696d655365636f6e64732c000060d68301527f75696e743235362073616c742c0000000000000000000000000000000000000060f48301527f6279746573206d616b65724173736574446174612c00000000000000000000006101018301527f62797465732074616b65724173736574446174610000000000000000000000006101168301527f290000000000000000000000000000000000000000000000000000000000000061012a830152825161010b81840301815261012b909201928390528151600093918291908401908083836020831061034c57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161030f565b6000610211848484610829565b600061039382610871565b60005481565b6060610211848484610884565b600080808411610696576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114da565b60405180910390fd5b8215806106a1575084155b156106af57600091506106d9565b838015156106b957fe5b85840990506106c88584610a56565b6106d46103e883610a56565b101591505b509392505050565b600080831161071c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114da565b61021161073c61072c8685610a56565b610737866001610abc565b610afe565b84610b3d565b815181516107509190610afe565b8252602080830151908201516107669190610afe565b60208301526040808301519082015161077f9190610afe565b6040830152606080830151908201516107989190610afe565b60609092019190915250565b6000808084116107e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114da565b8215806107eb575084155b156107f957600091506106d9565b8380151561080357fe5b8584099050836108138583610abc565b81151561081c57fe5b0690506106c88584610a56565b6000808311610864576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114da565b61021161073c8584610a56565b600061039361087f83610b54565b610fad565b604080517fb4be83d5000000000000000000000000000000000000000000000000000000006020808301919091526060602483018181528751608485019081528884015160a48601529488015160c48501529087015160e4840152608087015161010484015260a087015161012484015260c087015161014484015260e08701516101648401526101008701516101848401526101208701516101a4840152610140870180516101c485019081526101608901516101e4860152610180905251805161020485018190529394919384936044870192849261022489019291820191601f82010460005b8181101561098b57835185526020948501949093019260010161096d565b50505050818103610160808401919091528a0151805180835260209283019291820191601f82010460005b818110156109d45783518552602094850194909301926001016109b6565b50505089845250848103602093840190815288518083529093918201918981019190601f82010460005b81811015610a1c5783518552602094850194909301926001016109fe565b5050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08883030188525060405250505050509392505050565b600080831515610a695760009150610ab5565b50828202828482811515610a7957fe5b0414610ab1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114ea565b8091505b5092915050565b600082821115610af8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114ca565b50900390565b600082820183811015610ab1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114ea565b6000808284811515610b4b57fe5b04949350505050565b604080517f4f726465722800000000000000000000000000000000000000000000000000006020808301919091527f61646472657373206d616b6572416464726573732c000000000000000000000060268301527f616464726573732074616b6572416464726573732c0000000000000000000000603b8301527f6164647265737320666565526563697069656e74416464726573732c0000000060508301527f616464726573732073656e646572416464726573732c00000000000000000000606c8301527f75696e74323536206d616b65724173736574416d6f756e742c0000000000000060828301527f75696e743235362074616b65724173736574416d6f756e742c00000000000000609b8301527f75696e74323536206d616b65724665652c00000000000000000000000000000060b48301527f75696e743235362074616b65724665652c00000000000000000000000000000060c58301527f75696e743235362065787069726174696f6e54696d655365636f6e64732c000060d68301527f75696e743235362073616c742c0000000000000000000000000000000000000060f48301527f6279746573206d616b65724173736574446174612c00000000000000000000006101018301527f62797465732074616b65724173736574446174610000000000000000000000006101168301527f290000000000000000000000000000000000000000000000000000000000000061012a830152825161010b81840301815261012b90920192839052815160009384938493849391929182918401908083835b60208310610ddc57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610d9f565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101408b0151805191995095509093508392850191508083835b60208310610e7757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610e3a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101608b0151805191985095509093508392850191508083835b60208310610f1257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610ed5565b5181516020939093036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909116921691909117905260405192018290039091207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0890180516101408b018051610160909c0180519a84529881529288526101a0822091529890525050509190525090919050565b6000546040517f19010000000000000000000000000000000000000000000000000000000000008152600281019190915260228101919091526042902090565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b60006110228235611581565b9392505050565b6000601f8201831361103a57600080fd5b813561104d6110488261152f565b611508565b9150808252602083016020830185838301111561106957600080fd5b61107483828461159a565b50505092915050565b60006080828403121561108f57600080fd5b6110996080611508565b905060006110a78484611235565b82525060206110b884848301611235565b60208301525060406110cc84828501611235565b60408301525060606110e084828501611235565b60608301525092915050565b600061018082840312156110ff57600080fd5b61110a610180611508565b905060006111188484611016565b825250602061112984848301611016565b602083015250604061113d84828501611016565b604083015250606061115184828501611016565b606083015250608061116584828501611235565b60808301525060a061117984828501611235565b60a08301525060c061118d84828501611235565b60c08301525060e06111a184828501611235565b60e0830152506101006111b684828501611235565b610100830152506101206111cc84828501611235565b6101208301525061014082013567ffffffffffffffff8111156111ee57600080fd5b6111fa84828501611029565b6101408301525061016082013567ffffffffffffffff81111561121c57600080fd5b61122884828501611029565b6101608301525092915050565b6000611022823561157e565b600080610100838503121561125557600080fd5b6000611261858561107d565b92505060806112728582860161107d565b9150509250929050565b60006020828403121561128e57600080fd5b813567ffffffffffffffff8111156112a557600080fd5b610211848285016110ec565b6000806000606084860312156112c657600080fd5b833567ffffffffffffffff8111156112dd57600080fd5b6112e9868287016110ec565b93505060206112fa86828701611235565b925050604084013567ffffffffffffffff81111561131757600080fd5b61132386828701611029565b9150509250925092565b60008060006060848603121561134257600080fd5b600061134e8686611235565b935050602061135f86828701611235565b925050604061132386828701611235565b61137981611579565b82525050565b6113798161157e565b600061139382611575565b8084526113a78160208601602086016115a6565b6113b0816115d2565b9093016020019392505050565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b601081527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b8051608083019061145e848261137f565b506020820151611471602085018261137f565b506040820151611484604085018261137f565b506060820151611497606085018261137f565b50505050565b602081016103938284611370565b60208101610393828461137f565b602080825281016110228184611388565b60208082528101610393816113bd565b60208082528101610393816113ed565b602080825281016103938161141d565b60808101610393828461144d565b60405181810167ffffffffffffffff8111828210171561152757600080fd5b604052919050565b600067ffffffffffffffff82111561154657600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b5190565b151590565b90565b73ffffffffffffffffffffffffffffffffffffffff1690565b82818337506000910152565b60005b838110156115c15781810151838201526020016115a9565b838111156114975750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a7230582054bf246f11dbed15e52bfe7f20ff4b47b9f6d2d020efc54b73bb8fd1cd94115f6c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH32 0x454950373132446F6D61696E2800000000000000000000000000000000000000 PUSH1 0xA0 SWAP1 DUP2 MSTORE PUSH32 0x737472696E67206E616D652C0000000000000000000000000000000000000000 PUSH1 0xAD MSTORE PUSH32 0x737472696E672076657273696F6E2C0000000000000000000000000000000000 PUSH1 0xB9 MSTORE PUSH32 0x6164647265737320766572696679696E67436F6E747261637400000000000000 PUSH1 0xC8 MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0xE1 MSTORE PUSH1 0x42 PUSH1 0x80 DUP2 DUP2 MSTORE PUSH1 0xE2 PUSH1 0x40 DUP2 SWAP1 MSTORE SWAP1 SWAP3 SWAP1 SWAP2 DUP3 SWAP2 SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xED JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xCE JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP6 ADD DUP6 MSTORE PUSH1 0xB DUP1 DUP5 MSTORE PUSH32 0x30782050726F746F636F6C000000000000000000000000000000000000000000 SWAP3 DUP5 ADD SWAP3 DUP4 MSTORE SWAP5 MLOAD SWAP1 SWAP7 POP SWAP2 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x175 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x156 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP6 ADD DUP6 MSTORE PUSH1 0x1 DUP1 DUP5 MSTORE PUSH32 0x3200000000000000000000000000000000000000000000000000000000000000 SWAP3 DUP5 ADD SWAP3 DUP4 MSTORE SWAP5 MLOAD SWAP1 SWAP7 POP SWAP2 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x1FD JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x1DE JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP3 ADD SWAP9 SWAP1 SWAP9 MSTORE DUP2 DUP5 ADD SWAP7 SWAP1 SWAP7 MSTORE PUSH1 0x60 DUP2 ADD SWAP7 SWAP1 SWAP7 MSTORE POP ADDRESS PUSH1 0x80 DUP1 DUP8 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP2 MLOAD DUP1 DUP8 SUB SWAP1 SWAP2 ADD DUP2 MSTORE PUSH1 0xA0 SWAP1 SWAP6 ADD SWAP1 DUP2 SWAP1 MSTORE DUP5 MLOAD SWAP1 SWAP4 DUP5 SWAP4 POP DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x286 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x267 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x0 NOT PUSH1 0x20 SWAP5 SWAP1 SWAP5 SUB PUSH2 0x100 EXP SWAP4 SWAP1 SWAP4 ADD SWAP3 DUP4 AND SWAP3 NOT AND SWAP2 SWAP1 SWAP2 OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP1 SWAP2 KECCAK256 PUSH1 0x0 SSTORE POP POP POP PUSH2 0x1634 DUP1 PUSH2 0x2C6 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xA3 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x1BE23901 DUP2 EQ PUSH2 0xA8 JUMPI DUP1 PUSH4 0x20777F70 EQ PUSH2 0xDE JUMPI DUP1 PUSH4 0x494D9297 EQ PUSH2 0x10B JUMPI DUP1 PUSH4 0x66758D7B EQ PUSH2 0x120 JUMPI DUP1 PUSH4 0x679D2F9A EQ PUSH2 0x14D JUMPI DUP1 PUSH4 0x7D33C6EE EQ PUSH2 0x16D JUMPI DUP1 PUSH4 0xBE7ADA1E EQ PUSH2 0x182 JUMPI DUP1 PUSH4 0xD9802088 EQ PUSH2 0x1A2 JUMPI DUP1 PUSH4 0xE306F779 EQ PUSH2 0x1C2 JUMPI DUP1 PUSH4 0xE9C7AA1A EQ PUSH2 0x1D7 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC8 PUSH2 0xC3 CALLDATASIZE PUSH1 0x4 PUSH2 0x132D JUMP JUMPDEST PUSH2 0x204 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xD5 SWAP2 SWAP1 PUSH2 0x149D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0xF9 CALLDATASIZE PUSH1 0x4 PUSH2 0x132D JUMP JUMPDEST PUSH2 0x219 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xD5 SWAP2 SWAP1 PUSH2 0x14AB JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x117 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0x226 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x12C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x140 PUSH2 0x13B CALLDATASIZE PUSH1 0x4 PUSH2 0x1241 JUMP JUMPDEST PUSH2 0x37E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xD5 SWAP2 SWAP1 PUSH2 0x14FA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x159 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC8 PUSH2 0x168 CALLDATASIZE PUSH1 0x4 PUSH2 0x132D JUMP JUMPDEST PUSH2 0x399 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x179 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0x3A6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x18E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0x19D CALLDATASIZE PUSH1 0x4 PUSH2 0x132D JUMP JUMPDEST PUSH2 0x626 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0x1BD CALLDATASIZE PUSH1 0x4 PUSH2 0x127C JUMP JUMPDEST PUSH2 0x633 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0x63E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1E3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1F7 PUSH2 0x1F2 CALLDATASIZE PUSH1 0x4 PUSH2 0x12B1 JUMP JUMPDEST PUSH2 0x644 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xD5 SWAP2 SWAP1 PUSH2 0x14B9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x211 DUP5 DUP5 DUP5 PUSH2 0x651 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x211 DUP5 DUP5 DUP5 PUSH2 0x6E1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x454950373132446F6D61696E2800000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x737472696E67206E616D652C0000000000000000000000000000000000000000 PUSH1 0x2D DUP4 ADD MSTORE PUSH32 0x737472696E672076657273696F6E2C0000000000000000000000000000000000 PUSH1 0x39 DUP4 ADD MSTORE PUSH32 0x6164647265737320766572696679696E67436F6E747261637400000000000000 PUSH1 0x48 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0x61 DUP4 ADD MSTORE DUP3 MLOAD PUSH1 0x42 DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH1 0x62 SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 SWAP2 DUP3 SWAP2 SWAP1 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x34C JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x30F JUMP JUMPDEST PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP3 MLOAD AND DUP2 DUP5 MLOAD AND DUP1 DUP3 OR DUP6 MSTORE POP POP POP POP POP POP SWAP1 POP ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH2 0x386 PUSH2 0xFED JUMP JUMPDEST PUSH2 0x390 DUP4 DUP4 PUSH2 0x742 JUMP JUMPDEST POP DUP2 JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x211 DUP5 DUP5 DUP5 PUSH2 0x7A4 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4F72646572280000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x61646472657373206D616B6572416464726573732C0000000000000000000000 PUSH1 0x26 DUP4 ADD MSTORE PUSH32 0x616464726573732074616B6572416464726573732C0000000000000000000000 PUSH1 0x3B DUP4 ADD MSTORE PUSH32 0x6164647265737320666565526563697069656E74416464726573732C00000000 PUSH1 0x50 DUP4 ADD MSTORE PUSH32 0x616464726573732073656E646572416464726573732C00000000000000000000 PUSH1 0x6C DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724173736574416D6F756E742C00000000000000 PUSH1 0x82 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724173736574416D6F756E742C00000000000000 PUSH1 0x9B DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724665652C000000000000000000000000000000 PUSH1 0xB4 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724665652C000000000000000000000000000000 PUSH1 0xC5 DUP4 ADD MSTORE PUSH32 0x75696E743235362065787069726174696F6E54696D655365636F6E64732C0000 PUSH1 0xD6 DUP4 ADD MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0xF4 DUP4 ADD MSTORE PUSH32 0x6279746573206D616B65724173736574446174612C0000000000000000000000 PUSH2 0x101 DUP4 ADD MSTORE PUSH32 0x62797465732074616B6572417373657444617461000000000000000000000000 PUSH2 0x116 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH2 0x12A DUP4 ADD MSTORE DUP3 MLOAD PUSH2 0x10B DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH2 0x12B SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 SWAP2 DUP3 SWAP2 SWAP1 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x20 DUP4 LT PUSH2 0x34C JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x30F JUMP JUMPDEST PUSH1 0x0 PUSH2 0x211 DUP5 DUP5 DUP5 PUSH2 0x829 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x393 DUP3 PUSH2 0x871 JUMP JUMPDEST PUSH1 0x0 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH2 0x211 DUP5 DUP5 DUP5 PUSH2 0x884 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x696 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14DA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x6A1 JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x6AF JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x6D9 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x6B9 JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP PUSH2 0x6C8 DUP6 DUP5 PUSH2 0xA56 JUMP JUMPDEST PUSH2 0x6D4 PUSH2 0x3E8 DUP4 PUSH2 0xA56 JUMP JUMPDEST LT ISZERO SWAP2 POP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x71C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14DA JUMP JUMPDEST PUSH2 0x211 PUSH2 0x73C PUSH2 0x72C DUP7 DUP6 PUSH2 0xA56 JUMP JUMPDEST PUSH2 0x737 DUP7 PUSH1 0x1 PUSH2 0xABC JUMP JUMPDEST PUSH2 0xAFE JUMP JUMPDEST DUP5 PUSH2 0xB3D JUMP JUMPDEST DUP2 MLOAD DUP2 MLOAD PUSH2 0x750 SWAP2 SWAP1 PUSH2 0xAFE JUMP JUMPDEST DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x766 SWAP2 SWAP1 PUSH2 0xAFE JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE PUSH1 0x40 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x77F SWAP2 SWAP1 PUSH2 0xAFE JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE PUSH1 0x60 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x798 SWAP2 SWAP1 PUSH2 0xAFE JUMP JUMPDEST PUSH1 0x60 SWAP1 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x7E0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14DA JUMP JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x7EB JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x7F9 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x6D9 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x803 JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP DUP4 PUSH2 0x813 DUP6 DUP4 PUSH2 0xABC JUMP JUMPDEST DUP2 ISZERO ISZERO PUSH2 0x81C JUMPI INVALID JUMPDEST MOD SWAP1 POP PUSH2 0x6C8 DUP6 DUP5 PUSH2 0xA56 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x864 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14DA JUMP JUMPDEST PUSH2 0x211 PUSH2 0x73C DUP6 DUP5 PUSH2 0xA56 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x393 PUSH2 0x87F DUP4 PUSH2 0xB54 JUMP JUMPDEST PUSH2 0xFAD JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x60 PUSH1 0x24 DUP4 ADD DUP2 DUP2 MSTORE DUP8 MLOAD PUSH1 0x84 DUP6 ADD SWAP1 DUP2 MSTORE DUP9 DUP5 ADD MLOAD PUSH1 0xA4 DUP7 ADD MSTORE SWAP5 DUP9 ADD MLOAD PUSH1 0xC4 DUP6 ADD MSTORE SWAP1 DUP8 ADD MLOAD PUSH1 0xE4 DUP5 ADD MSTORE PUSH1 0x80 DUP8 ADD MLOAD PUSH2 0x104 DUP5 ADD MSTORE PUSH1 0xA0 DUP8 ADD MLOAD PUSH2 0x124 DUP5 ADD MSTORE PUSH1 0xC0 DUP8 ADD MLOAD PUSH2 0x144 DUP5 ADD MSTORE PUSH1 0xE0 DUP8 ADD MLOAD PUSH2 0x164 DUP5 ADD MSTORE PUSH2 0x100 DUP8 ADD MLOAD PUSH2 0x184 DUP5 ADD MSTORE PUSH2 0x120 DUP8 ADD MLOAD PUSH2 0x1A4 DUP5 ADD MSTORE PUSH2 0x140 DUP8 ADD DUP1 MLOAD PUSH2 0x1C4 DUP6 ADD SWAP1 DUP2 MSTORE PUSH2 0x160 DUP10 ADD MLOAD PUSH2 0x1E4 DUP7 ADD MSTORE PUSH2 0x180 SWAP1 MSTORE MLOAD DUP1 MLOAD PUSH2 0x204 DUP6 ADD DUP2 SWAP1 MSTORE SWAP4 SWAP5 SWAP2 SWAP4 DUP5 SWAP4 PUSH1 0x44 DUP8 ADD SWAP3 DUP5 SWAP3 PUSH2 0x224 DUP10 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x98B JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x96D JUMP JUMPDEST POP POP POP POP DUP2 DUP2 SUB PUSH2 0x160 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP11 ADD MLOAD DUP1 MLOAD DUP1 DUP4 MSTORE PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x9D4 JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x9B6 JUMP JUMPDEST POP POP POP DUP10 DUP5 MSTORE POP DUP5 DUP2 SUB PUSH1 0x20 SWAP4 DUP5 ADD SWAP1 DUP2 MSTORE DUP9 MLOAD DUP1 DUP4 MSTORE SWAP1 SWAP4 SWAP2 DUP3 ADD SWAP2 DUP10 DUP2 ADD SWAP2 SWAP1 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0xA1C JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x9FE JUMP JUMPDEST POP POP POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP9 DUP4 SUB ADD DUP9 MSTORE POP PUSH1 0x40 MSTORE POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 ISZERO ISZERO PUSH2 0xA69 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0xAB5 JUMP JUMPDEST POP DUP3 DUP3 MUL DUP3 DUP5 DUP3 DUP2 ISZERO ISZERO PUSH2 0xA79 JUMPI INVALID JUMPDEST DIV EQ PUSH2 0xAB1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14EA JUMP JUMPDEST DUP1 SWAP2 POP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xAF8 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14CA JUMP JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xAB1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14EA JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 DUP5 DUP2 ISZERO ISZERO PUSH2 0xB4B JUMPI INVALID JUMPDEST DIV SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4F72646572280000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x61646472657373206D616B6572416464726573732C0000000000000000000000 PUSH1 0x26 DUP4 ADD MSTORE PUSH32 0x616464726573732074616B6572416464726573732C0000000000000000000000 PUSH1 0x3B DUP4 ADD MSTORE PUSH32 0x6164647265737320666565526563697069656E74416464726573732C00000000 PUSH1 0x50 DUP4 ADD MSTORE PUSH32 0x616464726573732073656E646572416464726573732C00000000000000000000 PUSH1 0x6C DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724173736574416D6F756E742C00000000000000 PUSH1 0x82 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724173736574416D6F756E742C00000000000000 PUSH1 0x9B DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724665652C000000000000000000000000000000 PUSH1 0xB4 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724665652C000000000000000000000000000000 PUSH1 0xC5 DUP4 ADD MSTORE PUSH32 0x75696E743235362065787069726174696F6E54696D655365636F6E64732C0000 PUSH1 0xD6 DUP4 ADD MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0xF4 DUP4 ADD MSTORE PUSH32 0x6279746573206D616B65724173736574446174612C0000000000000000000000 PUSH2 0x101 DUP4 ADD MSTORE PUSH32 0x62797465732074616B6572417373657444617461000000000000000000000000 PUSH2 0x116 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH2 0x12A DUP4 ADD MSTORE DUP3 MLOAD PUSH2 0x10B DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH2 0x12B SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP2 SWAP3 SWAP2 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xDDC JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xD9F JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x140 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP10 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xE77 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xE3A JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x160 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP9 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xF12 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xED5 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 SWAP1 SWAP4 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP2 AND SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP1 SWAP2 KECCAK256 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP10 ADD DUP1 MLOAD PUSH2 0x140 DUP12 ADD DUP1 MLOAD PUSH2 0x160 SWAP1 SWAP13 ADD DUP1 MLOAD SWAP11 DUP5 MSTORE SWAP9 DUP2 MSTORE SWAP3 DUP9 MSTORE PUSH2 0x1A0 DUP3 KECCAK256 SWAP2 MSTORE SWAP9 SWAP1 MSTORE POP POP POP SWAP2 SWAP1 MSTORE POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0x1901000000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x22 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH1 0x80 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1022 DUP3 CALLDATALOAD PUSH2 0x1581 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x103A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x104D PUSH2 0x1048 DUP3 PUSH2 0x152F JUMP JUMPDEST PUSH2 0x1508 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x1069 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1074 DUP4 DUP3 DUP5 PUSH2 0x159A JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x108F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1099 PUSH1 0x80 PUSH2 0x1508 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x10A7 DUP5 DUP5 PUSH2 0x1235 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x10B8 DUP5 DUP5 DUP4 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x10CC DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x10E0 DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x10FF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x110A PUSH2 0x180 PUSH2 0x1508 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x1118 DUP5 DUP5 PUSH2 0x1016 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x1129 DUP5 DUP5 DUP4 ADD PUSH2 0x1016 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x113D DUP5 DUP3 DUP6 ADD PUSH2 0x1016 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x1151 DUP5 DUP3 DUP6 ADD PUSH2 0x1016 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x1165 DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x1179 DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x118D DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x11A1 DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x11B6 DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x11CC DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x11EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x11FA DUP5 DUP3 DUP6 ADD PUSH2 0x1029 JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x121C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1228 DUP5 DUP3 DUP6 ADD PUSH2 0x1029 JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1022 DUP3 CALLDATALOAD PUSH2 0x157E JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x100 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x1255 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1261 DUP6 DUP6 PUSH2 0x107D JUMP JUMPDEST SWAP3 POP POP PUSH1 0x80 PUSH2 0x1272 DUP6 DUP3 DUP7 ADD PUSH2 0x107D JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x128E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x12A5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x211 DUP5 DUP3 DUP6 ADD PUSH2 0x10EC JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x12C6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x12DD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x12E9 DUP7 DUP3 DUP8 ADD PUSH2 0x10EC JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x12FA DUP7 DUP3 DUP8 ADD PUSH2 0x1235 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1317 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1323 DUP7 DUP3 DUP8 ADD PUSH2 0x1029 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x1342 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x134E DUP7 DUP7 PUSH2 0x1235 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x135F DUP7 DUP3 DUP8 ADD PUSH2 0x1235 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0x1323 DUP7 DUP3 DUP8 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH2 0x1379 DUP2 PUSH2 0x1579 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0x1379 DUP2 PUSH2 0x157E JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1393 DUP3 PUSH2 0x1575 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x13A7 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x15A6 JUMP JUMPDEST PUSH2 0x13B0 DUP2 PUSH2 0x15D2 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4449564953494F4E5F42595F5A45524F00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x80 DUP4 ADD SWAP1 PUSH2 0x145E DUP5 DUP3 PUSH2 0x137F JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x1471 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x137F JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x1484 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x137F JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x1497 PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x137F JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x393 DUP3 DUP5 PUSH2 0x1370 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x393 DUP3 DUP5 PUSH2 0x137F JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1022 DUP2 DUP5 PUSH2 0x1388 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x393 DUP2 PUSH2 0x13BD JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x393 DUP2 PUSH2 0x13ED JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x393 DUP2 PUSH2 0x141D JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x393 DUP3 DUP5 PUSH2 0x144D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x1527 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1546 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x15C1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x15A9 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x1497 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 SLOAD 0xbf 0x24 PUSH16 0x11DBED15E52BFE7F20FF4B47B9F6D2D0 KECCAK256 0xef 0xc5 0x4b PUSH20 0xBB8FD1CD94115F6C6578706572696D656E74616C 0xf5 STOP CALLDATACOPY ",
+ "sourceMap": "1045:148:44:-;;;;;;;;;;;;;;;;;22:32:-1;859:2673:67;6:49:-1;;;1045:148:44;859:2673:67;1045:148:44;;;859:2673:67;;1045:148:44;;;;;22:32:-1;1045:148:44;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1035:159:44;;;;;;;;;;;;1511:18;;;;;;;;;;;;;;;;1495:36;;1035:159;;-1:-1:-1;1035:159:44;;-1:-1:-1;1495:36:44;;;;-1:-1:-1;1511:18:44;1495:36;1511:18;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1495:36:44;;;;;;;;;;;;1561:21;;;;;274:1:-1;1561:21:44;;;;;;;;;;1545:39;;1495:36;;-1:-1:-1;1495:36:44;;-1:-1:-1;1545:39:44;;;;-1:-1:-1;274:1;1545:39:44;1561:21;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1545:39:44;;;;;;;;;;;;1416:214;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1614:4:44;1416:214;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;1416:214:44;;;;;;;;1406:225;;1416:214;;;;-1:-1:-1;1406:225:44;;;-1:-1:-1;1406:225:44;1416:214;1406:225;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;-1:-1;;263:2;259:12;;;;254:3;250:22;246:30;;;;340:21;;;311:9;;295:26;377:20;;;;365:33;;1406:225:44;;;;;;;;;;-1:-1:-1;1385:246:44;-1:-1:-1;;;859:2673:67;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100a35763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631be2390181146100a857806320777f70146100de578063494d92971461010b57806366758d7b14610120578063679d2f9a1461014d5780637d33c6ee1461016d578063be7ada1e14610182578063d9802088146101a2578063e306f779146101c2578063e9c7aa1a146101d7575b600080fd5b3480156100b457600080fd5b506100c86100c336600461132d565b610204565b6040516100d5919061149d565b60405180910390f35b3480156100ea57600080fd5b506100fe6100f936600461132d565b610219565b6040516100d591906114ab565b34801561011757600080fd5b506100fe610226565b34801561012c57600080fd5b5061014061013b366004611241565b61037e565b6040516100d591906114fa565b34801561015957600080fd5b506100c861016836600461132d565b610399565b34801561017957600080fd5b506100fe6103a6565b34801561018e57600080fd5b506100fe61019d36600461132d565b610626565b3480156101ae57600080fd5b506100fe6101bd36600461127c565b610633565b3480156101ce57600080fd5b506100fe61063e565b3480156101e357600080fd5b506101f76101f23660046112b1565b610644565b6040516100d591906114b9565b6000610211848484610651565b949350505050565b60006102118484846106e1565b604080517f454950373132446f6d61696e28000000000000000000000000000000000000006020808301919091527f737472696e67206e616d652c0000000000000000000000000000000000000000602d8301527f737472696e672076657273696f6e2c000000000000000000000000000000000060398301527f6164647265737320766572696679696e67436f6e74726163740000000000000060488301527f29000000000000000000000000000000000000000000000000000000000000006061830152825160428184030181526062909201928390528151600093918291908401908083835b6020831061034c57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161030f565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020905090565b610386610fed565b6103908383610742565b50815b92915050565b60006102118484846107a4565b604080517f4f726465722800000000000000000000000000000000000000000000000000006020808301919091527f61646472657373206d616b6572416464726573732c000000000000000000000060268301527f616464726573732074616b6572416464726573732c0000000000000000000000603b8301527f6164647265737320666565526563697069656e74416464726573732c0000000060508301527f616464726573732073656e646572416464726573732c00000000000000000000606c8301527f75696e74323536206d616b65724173736574416d6f756e742c0000000000000060828301527f75696e743235362074616b65724173736574416d6f756e742c00000000000000609b8301527f75696e74323536206d616b65724665652c00000000000000000000000000000060b48301527f75696e743235362074616b65724665652c00000000000000000000000000000060c58301527f75696e743235362065787069726174696f6e54696d655365636f6e64732c000060d68301527f75696e743235362073616c742c0000000000000000000000000000000000000060f48301527f6279746573206d616b65724173736574446174612c00000000000000000000006101018301527f62797465732074616b65724173736574446174610000000000000000000000006101168301527f290000000000000000000000000000000000000000000000000000000000000061012a830152825161010b81840301815261012b909201928390528151600093918291908401908083836020831061034c57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161030f565b6000610211848484610829565b600061039382610871565b60005481565b6060610211848484610884565b600080808411610696576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114da565b60405180910390fd5b8215806106a1575084155b156106af57600091506106d9565b838015156106b957fe5b85840990506106c88584610a56565b6106d46103e883610a56565b101591505b509392505050565b600080831161071c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114da565b61021161073c61072c8685610a56565b610737866001610abc565b610afe565b84610b3d565b815181516107509190610afe565b8252602080830151908201516107669190610afe565b60208301526040808301519082015161077f9190610afe565b6040830152606080830151908201516107989190610afe565b60609092019190915250565b6000808084116107e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114da565b8215806107eb575084155b156107f957600091506106d9565b8380151561080357fe5b8584099050836108138583610abc565b81151561081c57fe5b0690506106c88584610a56565b6000808311610864576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114da565b61021161073c8584610a56565b600061039361087f83610b54565b610fad565b604080517fb4be83d5000000000000000000000000000000000000000000000000000000006020808301919091526060602483018181528751608485019081528884015160a48601529488015160c48501529087015160e4840152608087015161010484015260a087015161012484015260c087015161014484015260e08701516101648401526101008701516101848401526101208701516101a4840152610140870180516101c485019081526101608901516101e4860152610180905251805161020485018190529394919384936044870192849261022489019291820191601f82010460005b8181101561098b57835185526020948501949093019260010161096d565b50505050818103610160808401919091528a0151805180835260209283019291820191601f82010460005b818110156109d45783518552602094850194909301926001016109b6565b50505089845250848103602093840190815288518083529093918201918981019190601f82010460005b81811015610a1c5783518552602094850194909301926001016109fe565b5050507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08883030188525060405250505050509392505050565b600080831515610a695760009150610ab5565b50828202828482811515610a7957fe5b0414610ab1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114ea565b8091505b5092915050565b600082821115610af8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114ca565b50900390565b600082820183811015610ab1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068d906114ea565b6000808284811515610b4b57fe5b04949350505050565b604080517f4f726465722800000000000000000000000000000000000000000000000000006020808301919091527f61646472657373206d616b6572416464726573732c000000000000000000000060268301527f616464726573732074616b6572416464726573732c0000000000000000000000603b8301527f6164647265737320666565526563697069656e74416464726573732c0000000060508301527f616464726573732073656e646572416464726573732c00000000000000000000606c8301527f75696e74323536206d616b65724173736574416d6f756e742c0000000000000060828301527f75696e743235362074616b65724173736574416d6f756e742c00000000000000609b8301527f75696e74323536206d616b65724665652c00000000000000000000000000000060b48301527f75696e743235362074616b65724665652c00000000000000000000000000000060c58301527f75696e743235362065787069726174696f6e54696d655365636f6e64732c000060d68301527f75696e743235362073616c742c0000000000000000000000000000000000000060f48301527f6279746573206d616b65724173736574446174612c00000000000000000000006101018301527f62797465732074616b65724173736574446174610000000000000000000000006101168301527f290000000000000000000000000000000000000000000000000000000000000061012a830152825161010b81840301815261012b90920192839052815160009384938493849391929182918401908083835b60208310610ddc57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610d9f565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101408b0151805191995095509093508392850191508083835b60208310610e7757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610e3a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040519190930181900381206101608b0151805191985095509093508392850191508083835b60208310610f1257805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610ed5565b5181516020939093036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909116921691909117905260405192018290039091207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0890180516101408b018051610160909c0180519a84529881529288526101a0822091529890525050509190525090919050565b6000546040517f19010000000000000000000000000000000000000000000000000000000000008152600281019190915260228101919091526042902090565b608060405190810160405280600081526020016000815260200160008152602001600081525090565b60006110228235611581565b9392505050565b6000601f8201831361103a57600080fd5b813561104d6110488261152f565b611508565b9150808252602083016020830185838301111561106957600080fd5b61107483828461159a565b50505092915050565b60006080828403121561108f57600080fd5b6110996080611508565b905060006110a78484611235565b82525060206110b884848301611235565b60208301525060406110cc84828501611235565b60408301525060606110e084828501611235565b60608301525092915050565b600061018082840312156110ff57600080fd5b61110a610180611508565b905060006111188484611016565b825250602061112984848301611016565b602083015250604061113d84828501611016565b604083015250606061115184828501611016565b606083015250608061116584828501611235565b60808301525060a061117984828501611235565b60a08301525060c061118d84828501611235565b60c08301525060e06111a184828501611235565b60e0830152506101006111b684828501611235565b610100830152506101206111cc84828501611235565b6101208301525061014082013567ffffffffffffffff8111156111ee57600080fd5b6111fa84828501611029565b6101408301525061016082013567ffffffffffffffff81111561121c57600080fd5b61122884828501611029565b6101608301525092915050565b6000611022823561157e565b600080610100838503121561125557600080fd5b6000611261858561107d565b92505060806112728582860161107d565b9150509250929050565b60006020828403121561128e57600080fd5b813567ffffffffffffffff8111156112a557600080fd5b610211848285016110ec565b6000806000606084860312156112c657600080fd5b833567ffffffffffffffff8111156112dd57600080fd5b6112e9868287016110ec565b93505060206112fa86828701611235565b925050604084013567ffffffffffffffff81111561131757600080fd5b61132386828701611029565b9150509250925092565b60008060006060848603121561134257600080fd5b600061134e8686611235565b935050602061135f86828701611235565b925050604061132386828701611235565b61137981611579565b82525050565b6113798161157e565b600061139382611575565b8084526113a78160208601602086016115a6565b6113b0816115d2565b9093016020019392505050565b601181527f55494e543235365f554e444552464c4f57000000000000000000000000000000602082015260400190565b601081527f4449564953494f4e5f42595f5a45524f00000000000000000000000000000000602082015260400190565b601081527f55494e543235365f4f564552464c4f5700000000000000000000000000000000602082015260400190565b8051608083019061145e848261137f565b506020820151611471602085018261137f565b506040820151611484604085018261137f565b506060820151611497606085018261137f565b50505050565b602081016103938284611370565b60208101610393828461137f565b602080825281016110228184611388565b60208082528101610393816113bd565b60208082528101610393816113ed565b602080825281016103938161141d565b60808101610393828461144d565b60405181810167ffffffffffffffff8111828210171561152757600080fd5b604052919050565b600067ffffffffffffffff82111561154657600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b5190565b151590565b90565b73ffffffffffffffffffffffffffffffffffffffff1690565b82818337506000910152565b60005b838110156115c15781810151838201526020016115a9565b838111156114975750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a7230582054bf246f11dbed15e52bfe7f20ff4b47b9f6d2d020efc54b73bb8fd1cd94115f6c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xA3 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x1BE23901 DUP2 EQ PUSH2 0xA8 JUMPI DUP1 PUSH4 0x20777F70 EQ PUSH2 0xDE JUMPI DUP1 PUSH4 0x494D9297 EQ PUSH2 0x10B JUMPI DUP1 PUSH4 0x66758D7B EQ PUSH2 0x120 JUMPI DUP1 PUSH4 0x679D2F9A EQ PUSH2 0x14D JUMPI DUP1 PUSH4 0x7D33C6EE EQ PUSH2 0x16D JUMPI DUP1 PUSH4 0xBE7ADA1E EQ PUSH2 0x182 JUMPI DUP1 PUSH4 0xD9802088 EQ PUSH2 0x1A2 JUMPI DUP1 PUSH4 0xE306F779 EQ PUSH2 0x1C2 JUMPI DUP1 PUSH4 0xE9C7AA1A EQ PUSH2 0x1D7 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC8 PUSH2 0xC3 CALLDATASIZE PUSH1 0x4 PUSH2 0x132D JUMP JUMPDEST PUSH2 0x204 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xD5 SWAP2 SWAP1 PUSH2 0x149D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xEA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0xF9 CALLDATASIZE PUSH1 0x4 PUSH2 0x132D JUMP JUMPDEST PUSH2 0x219 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xD5 SWAP2 SWAP1 PUSH2 0x14AB JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x117 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0x226 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x12C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x140 PUSH2 0x13B CALLDATASIZE PUSH1 0x4 PUSH2 0x1241 JUMP JUMPDEST PUSH2 0x37E JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xD5 SWAP2 SWAP1 PUSH2 0x14FA JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x159 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xC8 PUSH2 0x168 CALLDATASIZE PUSH1 0x4 PUSH2 0x132D JUMP JUMPDEST PUSH2 0x399 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x179 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0x3A6 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x18E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0x19D CALLDATASIZE PUSH1 0x4 PUSH2 0x132D JUMP JUMPDEST PUSH2 0x626 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1AE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0x1BD CALLDATASIZE PUSH1 0x4 PUSH2 0x127C JUMP JUMPDEST PUSH2 0x633 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1CE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xFE PUSH2 0x63E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1E3 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x1F7 PUSH2 0x1F2 CALLDATASIZE PUSH1 0x4 PUSH2 0x12B1 JUMP JUMPDEST PUSH2 0x644 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xD5 SWAP2 SWAP1 PUSH2 0x14B9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x211 DUP5 DUP5 DUP5 PUSH2 0x651 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x211 DUP5 DUP5 DUP5 PUSH2 0x6E1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x454950373132446F6D61696E2800000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x737472696E67206E616D652C0000000000000000000000000000000000000000 PUSH1 0x2D DUP4 ADD MSTORE PUSH32 0x737472696E672076657273696F6E2C0000000000000000000000000000000000 PUSH1 0x39 DUP4 ADD MSTORE PUSH32 0x6164647265737320766572696679696E67436F6E747261637400000000000000 PUSH1 0x48 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0x61 DUP4 ADD MSTORE DUP3 MLOAD PUSH1 0x42 DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH1 0x62 SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 SWAP2 DUP3 SWAP2 SWAP1 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x34C JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x30F JUMP JUMPDEST PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB DUP1 NOT DUP3 MLOAD AND DUP2 DUP5 MLOAD AND DUP1 DUP3 OR DUP6 MSTORE POP POP POP POP POP POP SWAP1 POP ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 KECCAK256 SWAP1 POP SWAP1 JUMP JUMPDEST PUSH2 0x386 PUSH2 0xFED JUMP JUMPDEST PUSH2 0x390 DUP4 DUP4 PUSH2 0x742 JUMP JUMPDEST POP DUP2 JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x211 DUP5 DUP5 DUP5 PUSH2 0x7A4 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4F72646572280000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x61646472657373206D616B6572416464726573732C0000000000000000000000 PUSH1 0x26 DUP4 ADD MSTORE PUSH32 0x616464726573732074616B6572416464726573732C0000000000000000000000 PUSH1 0x3B DUP4 ADD MSTORE PUSH32 0x6164647265737320666565526563697069656E74416464726573732C00000000 PUSH1 0x50 DUP4 ADD MSTORE PUSH32 0x616464726573732073656E646572416464726573732C00000000000000000000 PUSH1 0x6C DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724173736574416D6F756E742C00000000000000 PUSH1 0x82 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724173736574416D6F756E742C00000000000000 PUSH1 0x9B DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724665652C000000000000000000000000000000 PUSH1 0xB4 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724665652C000000000000000000000000000000 PUSH1 0xC5 DUP4 ADD MSTORE PUSH32 0x75696E743235362065787069726174696F6E54696D655365636F6E64732C0000 PUSH1 0xD6 DUP4 ADD MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0xF4 DUP4 ADD MSTORE PUSH32 0x6279746573206D616B65724173736574446174612C0000000000000000000000 PUSH2 0x101 DUP4 ADD MSTORE PUSH32 0x62797465732074616B6572417373657444617461000000000000000000000000 PUSH2 0x116 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH2 0x12A DUP4 ADD MSTORE DUP3 MLOAD PUSH2 0x10B DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH2 0x12B SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 SWAP2 DUP3 SWAP2 SWAP1 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x20 DUP4 LT PUSH2 0x34C JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x30F JUMP JUMPDEST PUSH1 0x0 PUSH2 0x211 DUP5 DUP5 DUP5 PUSH2 0x829 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x393 DUP3 PUSH2 0x871 JUMP JUMPDEST PUSH1 0x0 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x60 PUSH2 0x211 DUP5 DUP5 DUP5 PUSH2 0x884 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x696 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14DA JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x6A1 JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x6AF JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x6D9 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x6B9 JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP PUSH2 0x6C8 DUP6 DUP5 PUSH2 0xA56 JUMP JUMPDEST PUSH2 0x6D4 PUSH2 0x3E8 DUP4 PUSH2 0xA56 JUMP JUMPDEST LT ISZERO SWAP2 POP JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x71C JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14DA JUMP JUMPDEST PUSH2 0x211 PUSH2 0x73C PUSH2 0x72C DUP7 DUP6 PUSH2 0xA56 JUMP JUMPDEST PUSH2 0x737 DUP7 PUSH1 0x1 PUSH2 0xABC JUMP JUMPDEST PUSH2 0xAFE JUMP JUMPDEST DUP5 PUSH2 0xB3D JUMP JUMPDEST DUP2 MLOAD DUP2 MLOAD PUSH2 0x750 SWAP2 SWAP1 PUSH2 0xAFE JUMP JUMPDEST DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x766 SWAP2 SWAP1 PUSH2 0xAFE JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE PUSH1 0x40 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x77F SWAP2 SWAP1 PUSH2 0xAFE JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE PUSH1 0x60 DUP1 DUP4 ADD MLOAD SWAP1 DUP3 ADD MLOAD PUSH2 0x798 SWAP2 SWAP1 PUSH2 0xAFE JUMP JUMPDEST PUSH1 0x60 SWAP1 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP5 GT PUSH2 0x7E0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14DA JUMP JUMPDEST DUP3 ISZERO DUP1 PUSH2 0x7EB JUMPI POP DUP5 ISZERO JUMPDEST ISZERO PUSH2 0x7F9 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0x6D9 JUMP JUMPDEST DUP4 DUP1 ISZERO ISZERO PUSH2 0x803 JUMPI INVALID JUMPDEST DUP6 DUP5 MULMOD SWAP1 POP DUP4 PUSH2 0x813 DUP6 DUP4 PUSH2 0xABC JUMP JUMPDEST DUP2 ISZERO ISZERO PUSH2 0x81C JUMPI INVALID JUMPDEST MOD SWAP1 POP PUSH2 0x6C8 DUP6 DUP5 PUSH2 0xA56 JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 GT PUSH2 0x864 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14DA JUMP JUMPDEST PUSH2 0x211 PUSH2 0x73C DUP6 DUP5 PUSH2 0xA56 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x393 PUSH2 0x87F DUP4 PUSH2 0xB54 JUMP JUMPDEST PUSH2 0xFAD JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x60 PUSH1 0x24 DUP4 ADD DUP2 DUP2 MSTORE DUP8 MLOAD PUSH1 0x84 DUP6 ADD SWAP1 DUP2 MSTORE DUP9 DUP5 ADD MLOAD PUSH1 0xA4 DUP7 ADD MSTORE SWAP5 DUP9 ADD MLOAD PUSH1 0xC4 DUP6 ADD MSTORE SWAP1 DUP8 ADD MLOAD PUSH1 0xE4 DUP5 ADD MSTORE PUSH1 0x80 DUP8 ADD MLOAD PUSH2 0x104 DUP5 ADD MSTORE PUSH1 0xA0 DUP8 ADD MLOAD PUSH2 0x124 DUP5 ADD MSTORE PUSH1 0xC0 DUP8 ADD MLOAD PUSH2 0x144 DUP5 ADD MSTORE PUSH1 0xE0 DUP8 ADD MLOAD PUSH2 0x164 DUP5 ADD MSTORE PUSH2 0x100 DUP8 ADD MLOAD PUSH2 0x184 DUP5 ADD MSTORE PUSH2 0x120 DUP8 ADD MLOAD PUSH2 0x1A4 DUP5 ADD MSTORE PUSH2 0x140 DUP8 ADD DUP1 MLOAD PUSH2 0x1C4 DUP6 ADD SWAP1 DUP2 MSTORE PUSH2 0x160 DUP10 ADD MLOAD PUSH2 0x1E4 DUP7 ADD MSTORE PUSH2 0x180 SWAP1 MSTORE MLOAD DUP1 MLOAD PUSH2 0x204 DUP6 ADD DUP2 SWAP1 MSTORE SWAP4 SWAP5 SWAP2 SWAP4 DUP5 SWAP4 PUSH1 0x44 DUP8 ADD SWAP3 DUP5 SWAP3 PUSH2 0x224 DUP10 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x98B JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x96D JUMP JUMPDEST POP POP POP POP DUP2 DUP2 SUB PUSH2 0x160 DUP1 DUP5 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP11 ADD MLOAD DUP1 MLOAD DUP1 DUP4 MSTORE PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 DUP3 ADD SWAP2 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x9D4 JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x9B6 JUMP JUMPDEST POP POP POP DUP10 DUP5 MSTORE POP DUP5 DUP2 SUB PUSH1 0x20 SWAP4 DUP5 ADD SWAP1 DUP2 MSTORE DUP9 MLOAD DUP1 DUP4 MSTORE SWAP1 SWAP4 SWAP2 DUP3 ADD SWAP2 DUP10 DUP2 ADD SWAP2 SWAP1 PUSH1 0x1F DUP3 ADD DIV PUSH1 0x0 JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0xA1C JUMPI DUP4 MLOAD DUP6 MSTORE PUSH1 0x20 SWAP5 DUP6 ADD SWAP5 SWAP1 SWAP4 ADD SWAP3 PUSH1 0x1 ADD PUSH2 0x9FE JUMP JUMPDEST POP POP POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP9 DUP4 SUB ADD DUP9 MSTORE POP PUSH1 0x40 MSTORE POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP4 ISZERO ISZERO PUSH2 0xA69 JUMPI PUSH1 0x0 SWAP2 POP PUSH2 0xAB5 JUMP JUMPDEST POP DUP3 DUP3 MUL DUP3 DUP5 DUP3 DUP2 ISZERO ISZERO PUSH2 0xA79 JUMPI INVALID JUMPDEST DIV EQ PUSH2 0xAB1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14EA JUMP JUMPDEST DUP1 SWAP2 POP JUMPDEST POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 GT ISZERO PUSH2 0xAF8 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14CA JUMP JUMPDEST POP SWAP1 SUB SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP3 DUP3 ADD DUP4 DUP2 LT ISZERO PUSH2 0xAB1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x68D SWAP1 PUSH2 0x14EA JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 DUP5 DUP2 ISZERO ISZERO PUSH2 0xB4B JUMPI INVALID JUMPDEST DIV SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x4F72646572280000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x61646472657373206D616B6572416464726573732C0000000000000000000000 PUSH1 0x26 DUP4 ADD MSTORE PUSH32 0x616464726573732074616B6572416464726573732C0000000000000000000000 PUSH1 0x3B DUP4 ADD MSTORE PUSH32 0x6164647265737320666565526563697069656E74416464726573732C00000000 PUSH1 0x50 DUP4 ADD MSTORE PUSH32 0x616464726573732073656E646572416464726573732C00000000000000000000 PUSH1 0x6C DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724173736574416D6F756E742C00000000000000 PUSH1 0x82 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724173736574416D6F756E742C00000000000000 PUSH1 0x9B DUP4 ADD MSTORE PUSH32 0x75696E74323536206D616B65724665652C000000000000000000000000000000 PUSH1 0xB4 DUP4 ADD MSTORE PUSH32 0x75696E743235362074616B65724665652C000000000000000000000000000000 PUSH1 0xC5 DUP4 ADD MSTORE PUSH32 0x75696E743235362065787069726174696F6E54696D655365636F6E64732C0000 PUSH1 0xD6 DUP4 ADD MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0xF4 DUP4 ADD MSTORE PUSH32 0x6279746573206D616B65724173736574446174612C0000000000000000000000 PUSH2 0x101 DUP4 ADD MSTORE PUSH32 0x62797465732074616B6572417373657444617461000000000000000000000000 PUSH2 0x116 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH2 0x12A DUP4 ADD MSTORE DUP3 MLOAD PUSH2 0x10B DUP2 DUP5 SUB ADD DUP2 MSTORE PUSH2 0x12B SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP2 SWAP3 SWAP2 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xDDC JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xD9F JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x140 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP10 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xE77 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xE3A JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 PUSH2 0x160 DUP12 ADD MLOAD DUP1 MLOAD SWAP2 SWAP9 POP SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xF12 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xED5 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 SWAP1 SWAP4 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP2 AND SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP1 SWAP2 KECCAK256 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP10 ADD DUP1 MLOAD PUSH2 0x140 DUP12 ADD DUP1 MLOAD PUSH2 0x160 SWAP1 SWAP13 ADD DUP1 MLOAD SWAP11 DUP5 MSTORE SWAP9 DUP2 MSTORE SWAP3 DUP9 MSTORE PUSH2 0x1A0 DUP3 KECCAK256 SWAP2 MSTORE SWAP9 SWAP1 MSTORE POP POP POP SWAP2 SWAP1 MSTORE POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0x1901000000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x22 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH1 0x80 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1022 DUP3 CALLDATALOAD PUSH2 0x1581 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x103A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x104D PUSH2 0x1048 DUP3 PUSH2 0x152F JUMP JUMPDEST PUSH2 0x1508 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x1069 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1074 DUP4 DUP3 DUP5 PUSH2 0x159A JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x108F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1099 PUSH1 0x80 PUSH2 0x1508 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x10A7 DUP5 DUP5 PUSH2 0x1235 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x10B8 DUP5 DUP5 DUP4 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x10CC DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x10E0 DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x10FF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x110A PUSH2 0x180 PUSH2 0x1508 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x1118 DUP5 DUP5 PUSH2 0x1016 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x1129 DUP5 DUP5 DUP4 ADD PUSH2 0x1016 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x113D DUP5 DUP3 DUP6 ADD PUSH2 0x1016 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x1151 DUP5 DUP3 DUP6 ADD PUSH2 0x1016 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x1165 DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x1179 DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x118D DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x11A1 DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x11B6 DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x11CC DUP5 DUP3 DUP6 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x11EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x11FA DUP5 DUP3 DUP6 ADD PUSH2 0x1029 JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x121C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1228 DUP5 DUP3 DUP6 ADD PUSH2 0x1029 JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1022 DUP3 CALLDATALOAD PUSH2 0x157E JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x100 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x1255 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1261 DUP6 DUP6 PUSH2 0x107D JUMP JUMPDEST SWAP3 POP POP PUSH1 0x80 PUSH2 0x1272 DUP6 DUP3 DUP7 ADD PUSH2 0x107D JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x128E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x12A5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x211 DUP5 DUP3 DUP6 ADD PUSH2 0x10EC JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x12C6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x12DD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x12E9 DUP7 DUP3 DUP8 ADD PUSH2 0x10EC JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x12FA DUP7 DUP3 DUP8 ADD PUSH2 0x1235 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 DUP5 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1317 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x1323 DUP7 DUP3 DUP8 ADD PUSH2 0x1029 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x60 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x1342 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x134E DUP7 DUP7 PUSH2 0x1235 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x20 PUSH2 0x135F DUP7 DUP3 DUP8 ADD PUSH2 0x1235 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x40 PUSH2 0x1323 DUP7 DUP3 DUP8 ADD PUSH2 0x1235 JUMP JUMPDEST PUSH2 0x1379 DUP2 PUSH2 0x1579 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0x1379 DUP2 PUSH2 0x157E JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1393 DUP3 PUSH2 0x1575 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x13A7 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x15A6 JUMP JUMPDEST PUSH2 0x13B0 DUP2 PUSH2 0x15D2 JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x11 DUP2 MSTORE PUSH32 0x55494E543235365F554E444552464C4F57000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x4449564953494F4E5F42595F5A45524F00000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x10 DUP2 MSTORE PUSH32 0x55494E543235365F4F564552464C4F5700000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x80 DUP4 ADD SWAP1 PUSH2 0x145E DUP5 DUP3 PUSH2 0x137F JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x1471 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x137F JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x1484 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x137F JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x1497 PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x137F JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x393 DUP3 DUP5 PUSH2 0x1370 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x393 DUP3 DUP5 PUSH2 0x137F JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x1022 DUP2 DUP5 PUSH2 0x1388 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x393 DUP2 PUSH2 0x13BD JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x393 DUP2 PUSH2 0x13ED JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x393 DUP2 PUSH2 0x141D JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0x393 DUP3 DUP5 PUSH2 0x144D JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x1527 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1546 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x15C1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x15A9 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x1497 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 SLOAD 0xbf 0x24 PUSH16 0x11DBED15E52BFE7F20FF4B47B9F6D2D0 KECCAK256 0xef 0xc5 0x4b PUSH20 0xBB8FD1CD94115F6C6578706572696D656E74616C 0xf5 STOP CALLDATACOPY ",
+ "sourceMap": "859:2673:67:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2076:334;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2076:334:67;;;;;;;;;;;;;;;;;;;;;;;;;1715:355;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1715:355:67;;;;;;;;;;;;;;;;;3092:157;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3092:157:67;;;;3255:275;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3255:275:67;;;;;;;;;;;;;;;;;2416:332;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2416:332:67;;;;;;;;;2950:136;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2950:136:67;;;;1352:357;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1352:357:67;;;;;;;;;2754:190;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2754:190:67;;;;;;;;;1301:33:44;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1301:33:44;;;;952:394:67;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;952:394:67;;;;;;;;;;;;;;;;;2076:334;2243:12;2281:98;2315:9;2338:11;2363:6;2281:20;:98::i;:::-;2271:108;2076:334;-1:-1:-1;;;;2076:334:67:o;1715:355::-;1882:21;1935:98;1969:9;1992:11;2017:6;1935:20;:98::i;3092:157::-;1045:148:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;1045:148:44;;;;;;;;1035:159;;3177:7:67;;1045:148:44;;;1035:159;;;;;1045:148;1035:159;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;1035:159:44;;;;;;;;;;;;;;;;3200:42:67;;3092:157;:::o;3255:275::-;3405:11;;:::i;:::-;3439:51;3454:16;3472:17;3439:14;:51::i;:::-;-1:-1:-1;3507:16:67;3255:275;;;;;:::o;2416:332::-;2582:12;2620:97;2653:9;2676:11;2701:6;2620:19;:97::i;2950:136::-;777:457:48;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;777:457:48;;;;;;;;767:468;;3025:7:67;;777:457:48;;;767:468;;;;;777:457;767:468;66:2:-1;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;1352:357:67;1520:21;1573:99;1608:9;1631:11;1656:6;1573:21;:99::i;2754:190::-;2847:17;2892:19;2905:5;2892:12;:19::i;1301:33:44:-;;;;:::o;952:394:67:-;1135:30;1201:104;1233:5;1252:20;1286:9;1201:18;:104::i;4779:1869:47:-;4942:12;;4991:15;;;4970:78;;;;;;;;;;;;;;;;;;;;;;5868:11;;;:29;;-1:-1:-1;5883:14:47;;5868:29;5864:72;;;5920:5;5913:12;;;;5864:72;6522:11;6459:84;;;;;;;6499:9;6479:6;6459:84;6439:104;;6591:26;6599:9;6610:6;6591:7;:26::i;:::-;6563:24;6571:4;6577:9;6563:7;:24::i;:::-;:54;;;-1:-1:-1;4779:1869:47;;;;;;;:::o;3825:691::-;3988:21;4046:15;;;4025:78;;;;;;;;;;;;;;4317:162;4338:106;4363:26;4371:9;4382:6;4363:7;:26::i;:::-;4407:23;4415:11;4428:1;4407:7;:23::i;:::-;4338:7;:106::i;:::-;4458:11;4317:7;:162::i;1771:648:46:-;1964:39;;2005:40;;1956:90;;1964:39;1956:7;:90::i;:::-;1914:132;;2106:39;;;;;2147:40;;;;2098:90;;2106:39;2098:7;:90::i;:::-;2056:39;;;:132;2238:29;;;;;2269:30;;;;2230:70;;2238:29;2230:7;:70::i;:::-;2198:29;;;:102;2350:29;;;;;2381:30;;;;2342:70;;2350:29;2342:7;:70::i;:::-;2310:29;;;;:102;;;;-1:-1:-1;1771:648:46:o;6909:918:47:-;7071:12;;7120:15;;;7099:78;;;;;;;;;;;;;;7250:11;;;:29;;-1:-1:-1;7265:14:47;;7250:29;7246:257;;;7487:5;7480:12;;;;7246:257;7634:11;7571:84;;;;;;;7611:9;7591:6;7571:84;7551:104;;7711:11;7677:31;7685:11;7698:9;7677:7;:31::i;:::-;:45;;;;;;;;7665:57;;7770:26;7778:9;7789:6;7770:7;:26::i;3123:425::-;3287:21;3345:15;;;3324:78;;;;;;;;;;;;;;3429:82;3450:26;3458:9;3469:6;3450:7;:26::i;4211:202:48:-;4300:17;4345:35;4363:16;4373:5;4363:9;:16::i;:::-;4345:17;:35::i;1011:10099:42:-;5031:4;5025:11;;5321:66;5314:4;5291:28;;;5284:104;;;;1199:30;5445:4;5422:28;;6444:59;;;6770:19;;5736:26;;;6750:40;;;6883:23;;;6877:30;6853:22;;;6846:62;6979:23;;;6973:30;6949:22;;;6942:62;7082:23;;;7076:30;7052:22;;;7045:62;7197:4;7179:23;;7173:30;7149:22;;;7142:62;7297:4;7279:23;;7273:30;7249:22;;;7242:62;7397:4;7379:23;;7373:30;7349:22;;;7342:62;7495:4;7477:23;;7471:30;7447:22;;;7440:62;7594:5;7576:24;;7570:31;7545:23;;;7538:64;7699:5;7681:24;;7675:31;7650:23;;;7643:64;7787:5;7769:24;;7763:31;;7738:23;;;7731:64;;;7895:5;7877:24;;7871:31;7846:23;;;7839:64;7979:5;8106:74;;8268:24;8340:19;;7962:23;;;8544:34;;;5025:11;;5422:28;;;;6536:27;;;;5736:26;;8606:22;;;;8388:23;;;;8464:4;8445:24;;8441:35;6190:1;8698:237;8721:13;8718:1;8715:20;8698:237;;;8791:19;;8771:40;;8860:4;8843:22;;;;8898:23;;;;8749:1;8742:9;8698:237;;;-1:-1:-1;;;;9045:31:42;;;9029:13;9010:33;;;9003:74;;;;9171:17;;9165:24;9237:19;;9441:34;;;9037:4;9503:22;;;;9285:23;;;;9361:4;9342:24;;9338:35;9610:1;9596:237;9619:13;9616:1;9613:20;9596:237;;;9689:19;;9669:40;;9758:4;9741:22;;;;9796:23;;;;9647:1;9640:9;9596:237;;;-1:-1:-1;;;9902:46:42;;;-1:-1:-1;10133:33:42;;;10003:4;9981:27;;;10108:59;;;10281:19;;10472:34;;;9981:27;;10534:22;;;;10329:23;;;;10281:19;10405:4;10386:24;;10382:35;-1:-1:-1;10613:237:42;10636:13;10633:1;10630:20;10613:237;;;10706:19;;10686:40;;10775:4;10758:22;;;;10813:23;;;;10664:1;10657:9;10613:237;;;-1:-1:-1;;;10928:46:42;;;;;10902:73;;-1:-1:-1;11041:4:42;11034:25;-1:-1:-1;;;;;1011:10099:42;;;;;:::o;51:288:84:-;137:7;;164:6;;160:45;;;193:1;186:8;;;;160:45;-1:-1:-1;226:5:84;;;230:1;226;:5;262;;;;;;;;:10;241:73;;;;;;;;;;;;;;331:1;324:8;;51:288;;;;;;:::o;502:208::-;588:7;632:6;;;;611:70;;;;;;;;;;;;;;-1:-1:-1;698:5:84;;;502:208::o;716:230::-;802:7;837:5;;;873:6;;;;852:69;;;;;;;;;;;;;345:151;431:7;454:9;470:1;466;:5;;;;;;;;;345:151;-1:-1:-1;;;;345:151:84:o;4553:1678:48:-;777:457;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;777:457:48;;;;;;;;767:468;;4639:14;;;;;;;;777:457;;;;;767:468;;;;777:457;767:468;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;767:468:48;;;;;;;;;;;4763:20;;;;4753:31;;767:468;;-1:-1:-1;4763:20:48;-1:-1:-1;767:468:48;;-1:-1:-1;767:468:48;;4753:31;;;-1:-1:-1;4753:31:48;767:468;4753:31;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;4753:31:48;;;;;;;;;;;4833:20;;;;4823:31;;4753;;-1:-1:-1;4833:20:48;-1:-1:-1;4753:31:48;;-1:-1:-1;4753:31:48;;4823;;;-1:-1:-1;4823:31:48;4753;4823;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;;;;365:33;;4823:31:48;;;;;;;;;;5620:14;;;5763:11;;5670:3;5659:15;;5800:11;;5710:3;5699:15;;;5837:11;;5903:24;;;5940:32;;;5985;;;6056:3;6040:20;;6109:19;;6141;;;-1:-1:-1;;;6173:19:48;;;-1:-1:-1;6040:20:48;;4553:1678;-1:-1:-1;4553:1678:48:o;1834:924:44:-;1928:14;1985:18;2297:2;2291:9;2329:66;2314:82;;2446:1;2434:14;;2427:40;;;;2564:2;2552:15;;2545:35;;;;2716:2;2698:21;;;1834:924::o;859:2673:67:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;;63:55;57:66;-1:-1;;;57:66;131:432;;221:4;209:17;;205:27;-1:-1;195:2;;246:1;243;236:12;195:2;283:6;270:20;305:60;320:44;357:6;320:44;;;305:60;;;296:69;;385:6;378:5;371:21;421:4;413:6;409:17;454:4;447:5;443:16;489:3;480:6;475:3;471:16;468:25;465:2;;;506:1;503;496:12;465:2;516:41;550:6;545:3;540;516:41;;;188:375;;;;;;;;1060:811;;1179:4;1167:9;1162:3;1158:19;1154:30;1151:2;;;1197:1;1194;1187:12;1151:2;1215:20;1230:4;1215:20;;;1206:29;-1:-1;1303:1;1334:49;1379:3;1359:9;1334:49;;;1310:74;;-1:-1;1463:2;1496:49;1541:3;1517:22;;;1496:49;;;1489:4;1482:5;1478:16;1471:75;1405:152;1615:2;1648:49;1693:3;1684:6;1673:9;1669:22;1648:49;;;1641:4;1634:5;1630:16;1623:75;1567:142;1767:2;1800:49;1845:3;1836:6;1825:9;1821:22;1800:49;;;1793:4;1786:5;1782:16;1775:75;1719:142;1145:726;;;;;1906:2209;;2018:5;2006:9;2001:3;1997:19;1993:31;1990:2;;;2037:1;2034;2027:12;1990:2;2055:21;2070:5;2055:21;;;2046:30;-1:-1;2134:1;2165:49;2210:3;2190:9;2165:49;;;2141:74;;-1:-1;2284:2;2317:49;2362:3;2338:22;;;2317:49;;;2310:4;2303:5;2299:16;2292:75;2236:142;2443:2;2476:49;2521:3;2512:6;2501:9;2497:22;2476:49;;;2469:4;2462:5;2458:16;2451:75;2388:149;2596:2;2629:49;2674:3;2665:6;2654:9;2650:22;2629:49;;;2622:4;2615:5;2611:16;2604:75;2547:143;2752:3;2786:49;2831:3;2822:6;2811:9;2807:22;2786:49;;;2779:4;2772:5;2768:16;2761:75;2700:147;2909:3;2943:49;2988:3;2979:6;2968:9;2964:22;2943:49;;;2936:4;2929:5;2925:16;2918:75;2857:147;3058:3;3092:49;3137:3;3128:6;3117:9;3113:22;3092:49;;;3085:4;3078:5;3074:16;3067:75;3014:139;3207:3;3241:49;3286:3;3277:6;3266:9;3262:22;3241:49;;;3234:4;3227:5;3223:16;3216:75;3163:139;3369:3;3404:49;3449:3;3440:6;3429:9;3425:22;3404:49;;;3396:5;3389;3385:17;3378:76;3312:153;3515:3;3550:49;3595:3;3586:6;3575:9;3571:22;3550:49;;;3542:5;3535;3531:17;3524:76;3475:136;3699:3;3688:9;3684:19;3671:33;3724:18;3716:6;3713:30;3710:2;;;3756:1;3753;3746:12;3710:2;3792:54;3842:3;3833:6;3822:9;3818:22;3792:54;;;3784:5;3777;3773:17;3766:81;3621:237;3946:3;3935:9;3931:19;3918:33;3971:18;3963:6;3960:30;3957:2;;;4003:1;4000;3993:12;3957:2;4039:54;4089:3;4080:6;4069:9;4065:22;4039:54;;;4031:5;4024;4020:17;4013:81;3868:237;1984:2131;;;;;4122:118;;4189:46;4227:6;4214:20;4189:46;;4247:488;;;4428:3;4416:9;4407:7;4403:23;4399:33;4396:2;;;4445:1;4442;4435:12;4396:2;4480:1;4497:83;4572:7;4552:9;4497:83;;;4487:93;;4459:127;4617:3;4636:83;4711:7;4702:6;4691:9;4687:22;4636:83;;;4626:93;;4596:129;4390:345;;;;;;4742:373;;4869:2;4857:9;4848:7;4844:23;4840:32;4837:2;;;4885:1;4882;4875:12;4837:2;4920:31;;4971:18;4960:30;;4957:2;;;5003:1;5000;4993:12;4957:2;5023:76;5091:7;5082:6;5071:9;5067:22;5023:76;;5122:727;;;;5292:2;5280:9;5271:7;5267:23;5263:32;5260:2;;;5308:1;5305;5298:12;5260:2;5343:31;;5394:18;5383:30;;5380:2;;;5426:1;5423;5416:12;5380:2;5446:76;5514:7;5505:6;5494:9;5490:22;5446:76;;;5436:86;;5322:206;5559:2;5577:53;5622:7;5613:6;5602:9;5598:22;5577:53;;;5567:63;;5538:98;5695:2;5684:9;5680:18;5667:32;5719:18;5711:6;5708:30;5705:2;;;5751:1;5748;5741:12;5705:2;5771:62;5825:7;5816:6;5805:9;5801:22;5771:62;;;5761:72;;5646:193;5254:595;;;;;;5856:491;;;;5994:2;5982:9;5973:7;5969:23;5965:32;5962:2;;;6010:1;6007;6000:12;5962:2;6045:1;6062:53;6107:7;6087:9;6062:53;;;6052:63;;6024:97;6152:2;6170:53;6215:7;6206:6;6195:9;6191:22;6170:53;;;6160:63;;6131:98;6260:2;6278:53;6323:7;6314:6;6303:9;6299:22;6278:53;;6354:101;6421:28;6443:5;6421:28;;;6416:3;6409:41;6403:52;;;6462:110;6535:31;6560:5;6535:31;;6579:297;;6679:38;6711:5;6679:38;;;6734:6;6729:3;6722:19;6746:63;6802:6;6795:4;6790:3;6786:14;6779:4;6772:5;6768:16;6746:63;;;6841:29;6863:6;6841:29;;;6821:50;;;6834:4;6821:50;;6659:217;-1:-1;;;6659:217;6884:296;7039:2;7027:15;;7076:66;7071:2;7062:12;;7055:88;7171:2;7162:12;;7020:160;7189:296;7344:2;7332:15;;7381:66;7376:2;7367:12;;7360:88;7476:2;7467:12;;7325:160;7494:296;7649:2;7637:15;;7686:66;7681:2;7672:12;;7665:88;7781:2;7772:12;;7630:160;7875:890;8105:22;;8018:4;8009:14;;;8139:61;8013:3;8105:22;8139:61;;;8038:174;8306:4;8299:5;8295:16;8289:23;8324:62;8380:4;8375:3;8371:14;8358:11;8324:62;;;8222:176;8482:4;8475:5;8471:16;8465:23;8500:62;8556:4;8551:3;8547:14;8534:11;8500:62;;;8408:166;8658:4;8651:5;8647:16;8641:23;8676:62;8732:4;8727:3;8723:14;8710:11;8676:62;;;8584:166;7991:774;;;;8889:181;8991:2;8976:18;;9005:55;8980:9;9033:6;9005:55;;9077:193;9185:2;9170:18;;9199:61;9174:9;9233:6;9199:61;;9277:277;9403:2;9417:47;;;9388:18;;9478:66;9388:18;9530:6;9478:66;;9561:387;9742:2;9756:47;;;9727:18;;9817:121;9727:18;9817:121;;9955:387;10136:2;10150:47;;;10121:18;;10211:121;10121:18;10211:121;;10349:387;10530:2;10544:47;;;10515:18;;10605:121;10515:18;10605:121;;10743:314;10911:3;10896:19;;10926:121;10900:9;11020:6;10926:121;;11264:256;11326:2;11320:9;11352:17;;;11427:18;11412:34;;11448:22;;;11409:62;11406:2;;;11484:1;11481;11474:12;11406:2;11500;11493:22;11304:216;;-1:-1;11304:216;11527:254;;11666:18;11658:6;11655:30;11652:2;;;11698:1;11695;11688:12;11652:2;-1:-1;11771:4;11742;11719:17;;;;11738:9;11715:33;11761:15;;11589:192;12053:91;12127:12;;12111:33;12151:92;12224:13;12217:21;;12200:43;12250:79;12319:5;12302:27;12422:128;12502:42;12491:54;;12474:76;12644:145;12725:6;12720:3;12715;12702:30;-1:-1;12781:1;12763:16;;12756:27;12695:94;12798:268;12863:1;12870:101;12884:6;12881:1;12878:13;12870:101;;;12951:11;;;12945:18;12932:11;;;12925:39;12906:2;12899:10;12870:101;;;12986:6;12983:1;12980:13;12977:2;;;-1:-1;;13051:1;13033:16;;13026:27;12847:219;13074:97;13162:2;13142:14;13158:7;13138:28;;13122:49"
+ }
+ }
+ },
+ "sources": {
+ "test/TestLibs/TestLibs.sol": {
+ "id": 67
+ },
+ "protocol/Exchange/libs/LibMath.sol": {
+ "id": 47
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "protocol/Exchange/libs/LibOrder.sol": {
+ "id": 48
+ },
+ "protocol/Exchange/libs/LibEIP712.sol": {
+ "id": 44
+ },
+ "protocol/Exchange/libs/LibFillResults.sol": {
+ "id": 46
+ },
+ "protocol/Exchange/libs/LibAbiEncoder.sol": {
+ "id": 42
+ }
+ },
+ "sourceCodes": {
+ "test/TestLibs/TestLibs.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../protocol/Exchange/libs/LibMath.sol\";\nimport \"../../protocol/Exchange/libs/LibOrder.sol\";\nimport \"../../protocol/Exchange/libs/LibFillResults.sol\";\nimport \"../../protocol/Exchange/libs/LibAbiEncoder.sol\";\n\n\ncontract TestLibs is \n LibMath,\n LibOrder,\n LibFillResults,\n LibAbiEncoder\n{\n function publicAbiEncodeFillOrder(\n Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n pure\n returns (bytes memory fillOrderCalldata)\n {\n fillOrderCalldata = abiEncodeFillOrder(\n order,\n takerAssetFillAmount,\n signature\n );\n return fillOrderCalldata;\n }\n\n function publicGetPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n public\n pure\n returns (uint256 partialAmount)\n {\n partialAmount = getPartialAmountFloor(\n numerator,\n denominator,\n target\n );\n return partialAmount;\n }\n\n function publicGetPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n public\n pure\n returns (uint256 partialAmount)\n {\n partialAmount = getPartialAmountCeil(\n numerator,\n denominator,\n target\n );\n return partialAmount;\n }\n\n function publicIsRoundingErrorFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n public\n pure\n returns (bool isError)\n {\n isError = isRoundingErrorFloor(\n numerator,\n denominator,\n target\n );\n return isError;\n }\n\n function publicIsRoundingErrorCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n public\n pure\n returns (bool isError)\n {\n isError = isRoundingErrorCeil(\n numerator,\n denominator,\n target\n );\n return isError;\n }\n\n function publicGetOrderHash(Order memory order)\n public\n view\n returns (bytes32 orderHash)\n {\n orderHash = getOrderHash(order);\n return orderHash;\n }\n\n function getOrderSchemaHash()\n public\n pure\n returns (bytes32)\n {\n return EIP712_ORDER_SCHEMA_HASH;\n }\n\n function getDomainSeparatorSchemaHash()\n public\n pure\n returns (bytes32)\n {\n return EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH;\n }\n\n function publicAddFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)\n public\n pure\n returns (FillResults memory)\n {\n addFillResults(totalFillResults, singleFillResults);\n return totalFillResults;\n }\n}\n",
+ "protocol/Exchange/libs/LibMath.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibMath is\n SafeMath\n{\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// Reverts if rounding error is >= 0.1%\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded down.\n function safeGetPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n require(\n !isRoundingErrorFloor(\n numerator,\n denominator,\n target\n ),\n \"ROUNDING_ERROR\"\n );\n \n partialAmount = safeDiv(\n safeMul(numerator, target),\n denominator\n );\n return partialAmount;\n }\n\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// Reverts if rounding error is >= 0.1%\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded up.\n function safeGetPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n require(\n !isRoundingErrorCeil(\n numerator,\n denominator,\n target\n ),\n \"ROUNDING_ERROR\"\n );\n \n // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):\n // ceil(a / b) = floor((a + b - 1) / b)\n // To implement `ceil(a / b)` using safeDiv.\n partialAmount = safeDiv(\n safeAdd(\n safeMul(numerator, target),\n safeSub(denominator, 1)\n ),\n denominator\n );\n return partialAmount;\n }\n\n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded down.\n function getPartialAmountFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n partialAmount = safeDiv(\n safeMul(numerator, target),\n denominator\n );\n return partialAmount;\n }\n \n /// @dev Calculates partial value given a numerator and denominator rounded down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to calculate partial of.\n /// @return Partial value of target rounded up.\n function getPartialAmountCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n\n // safeDiv computes `floor(a / b)`. We use the identity (a, b integer):\n // ceil(a / b) = floor((a + b - 1) / b)\n // To implement `ceil(a / b)` using safeDiv.\n partialAmount = safeDiv(\n safeAdd(\n safeMul(numerator, target),\n safeSub(denominator, 1)\n ),\n denominator\n );\n return partialAmount;\n }\n \n /// @dev Checks if rounding error >= 0.1% when rounding down.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to multiply with numerator/denominator.\n /// @return Rounding error is present.\n function isRoundingErrorFloor(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (bool isError)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n \n // The absolute rounding error is the difference between the rounded\n // value and the ideal value. The relative rounding error is the\n // absolute rounding error divided by the absolute value of the\n // ideal value. This is undefined when the ideal value is zero.\n //\n // The ideal value is `numerator * target / denominator`.\n // Let's call `numerator * target % denominator` the remainder.\n // The absolute error is `remainder / denominator`.\n //\n // When the ideal value is zero, we require the absolute error to\n // be zero. Fortunately, this is always the case. The ideal value is\n // zero iff `numerator == 0` and/or `target == 0`. In this case the\n // remainder and absolute error are also zero. \n if (target == 0 || numerator == 0) {\n return false;\n }\n \n // Otherwise, we want the relative rounding error to be strictly\n // less than 0.1%.\n // The relative error is `remainder / (numerator * target)`.\n // We want the relative error less than 1 / 1000:\n // remainder / (numerator * denominator) < 1 / 1000\n // or equivalently:\n // 1000 * remainder < numerator * target\n // so we have a rounding error iff:\n // 1000 * remainder >= numerator * target\n uint256 remainder = mulmod(\n target,\n numerator,\n denominator\n );\n isError = safeMul(1000, remainder) >= safeMul(numerator, target);\n return isError;\n }\n \n /// @dev Checks if rounding error >= 0.1% when rounding up.\n /// @param numerator Numerator.\n /// @param denominator Denominator.\n /// @param target Value to multiply with numerator/denominator.\n /// @return Rounding error is present.\n function isRoundingErrorCeil(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (bool isError)\n {\n require(\n denominator > 0,\n \"DIVISION_BY_ZERO\"\n );\n \n // See the comments in `isRoundingError`.\n if (target == 0 || numerator == 0) {\n // When either is zero, the ideal value and rounded value are zero\n // and there is no rounding error. (Although the relative error\n // is undefined.)\n return false;\n }\n // Compute remainder as before\n uint256 remainder = mulmod(\n target,\n numerator,\n denominator\n );\n remainder = safeSub(denominator, remainder) % denominator;\n isError = safeMul(1000, remainder) >= safeMul(numerator, target);\n return isError;\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "protocol/Exchange/libs/LibOrder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./LibEIP712.sol\";\n\n\ncontract LibOrder is\n LibEIP712\n{\n // Hash for the EIP712 Order Schema\n bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"Order(\",\n \"address makerAddress,\",\n \"address takerAddress,\",\n \"address feeRecipientAddress,\",\n \"address senderAddress,\",\n \"uint256 makerAssetAmount,\",\n \"uint256 takerAssetAmount,\",\n \"uint256 makerFee,\",\n \"uint256 takerFee,\",\n \"uint256 expirationTimeSeconds,\",\n \"uint256 salt,\",\n \"bytes makerAssetData,\",\n \"bytes takerAssetData\",\n \")\"\n ));\n\n // A valid order remains fillable until it is expired, fully filled, or cancelled.\n // An order's state is unaffected by external factors, like account balances.\n enum OrderStatus {\n INVALID, // Default value\n INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount\n INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount\n FILLABLE, // Order is fillable\n EXPIRED, // Order has already expired\n FULLY_FILLED, // Order is fully filled\n CANCELLED // Order has been cancelled\n }\n\n // solhint-disable max-line-length\n struct Order {\n address makerAddress; // Address that created the order. \n address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. \n address feeRecipientAddress; // Address that will recieve fees when order is filled. \n address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.\n uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. \n uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. \n uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.\n uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.\n uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. \n uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. \n bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.\n bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.\n }\n // solhint-enable max-line-length\n\n struct OrderInfo {\n uint8 orderStatus; // Status that describes order's validity and fillability.\n bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash).\n uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled.\n }\n\n /// @dev Calculates Keccak-256 hash of the order.\n /// @param order The order structure.\n /// @return Keccak-256 EIP712 hash of the order.\n function getOrderHash(Order memory order)\n internal\n view\n returns (bytes32 orderHash)\n {\n orderHash = hashEIP712Message(hashOrder(order));\n return orderHash;\n }\n\n /// @dev Calculates EIP712 hash of the order.\n /// @param order The order structure.\n /// @return EIP712 hash of the order.\n function hashOrder(Order memory order)\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;\n bytes32 makerAssetDataHash = keccak256(order.makerAssetData);\n bytes32 takerAssetDataHash = keccak256(order.takerAssetData);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ORDER_SCHEMA_HASH,\n // bytes32(order.makerAddress),\n // bytes32(order.takerAddress),\n // bytes32(order.feeRecipientAddress),\n // bytes32(order.senderAddress),\n // order.makerAssetAmount,\n // order.takerAssetAmount,\n // order.makerFee,\n // order.takerFee,\n // order.expirationTimeSeconds,\n // order.salt,\n // keccak256(order.makerAssetData),\n // keccak256(order.takerAssetData)\n // ));\n\n assembly {\n // Calculate memory addresses that will be swapped out before hashing\n let pos1 := sub(order, 32)\n let pos2 := add(order, 320)\n let pos3 := add(order, 352)\n\n // Backup\n let temp1 := mload(pos1)\n let temp2 := mload(pos2)\n let temp3 := mload(pos3)\n \n // Hash in place\n mstore(pos1, schemaHash)\n mstore(pos2, makerAssetDataHash)\n mstore(pos3, takerAssetDataHash)\n result := keccak256(pos1, 416)\n \n // Restore\n mstore(pos1, temp1)\n mstore(pos2, temp2)\n mstore(pos3, temp3)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibEIP712.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract LibEIP712 {\n\n // EIP191 header for EIP712 prefix\n string constant internal EIP191_HEADER = \"\\x19\\x01\";\n\n // EIP712 Domain Name value\n string constant internal EIP712_DOMAIN_NAME = \"0x Protocol\";\n\n // EIP712 Domain Version value\n string constant internal EIP712_DOMAIN_VERSION = \"2\";\n\n // Hash of the EIP712 Domain Separator Schema\n bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"address verifyingContract\",\n \")\"\n ));\n\n // Hash of the EIP712 Domain Separator data\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public EIP712_DOMAIN_HASH;\n\n constructor ()\n public\n {\n EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(\n EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,\n keccak256(bytes(EIP712_DOMAIN_NAME)),\n keccak256(bytes(EIP712_DOMAIN_VERSION)),\n bytes32(address(this))\n ));\n }\n\n /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.\n /// @param hashStruct The EIP712 hash struct.\n /// @return EIP712 hash applied to this EIP712 Domain.\n function hashEIP712Message(bytes32 hashStruct)\n internal\n view\n returns (bytes32 result)\n {\n bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;\n\n // Assembly for more efficient computing:\n // keccak256(abi.encodePacked(\n // EIP191_HEADER,\n // EIP712_DOMAIN_HASH,\n // hashStruct \n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header\n mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash\n mstore(add(memPtr, 34), hashStruct) // Hash of struct\n\n // Compute hash\n result := keccak256(memPtr, 66)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibFillResults.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibFillResults is\n SafeMath\n{\n struct FillResults {\n uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.\n uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.\n uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).\n uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).\n }\n\n struct MatchedFillResults {\n FillResults left; // Amounts filled and fees paid of left order.\n FillResults right; // Amounts filled and fees paid of right order.\n uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker.\n }\n\n /// @dev Adds properties of both FillResults instances.\n /// Modifies the first FillResults instance specified.\n /// @param totalFillResults Fill results instance that will be added onto.\n /// @param singleFillResults Fill results instance that will be added to totalFillResults.\n function addFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)\n internal\n pure\n {\n totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);\n totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);\n totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);\n totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);\n }\n}\n",
+ "protocol/Exchange/libs/LibAbiEncoder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./LibOrder.sol\";\n\n\ncontract LibAbiEncoder {\n\n /// @dev ABI encodes calldata for `fillOrder`.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return ABI encoded calldata for `fillOrder`.\n function abiEncodeFillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n internal\n pure\n returns (bytes memory fillOrderCalldata)\n {\n // We need to call MExchangeCore.fillOrder using a delegatecall in\n // assembly so that we can intercept a call that throws. For this, we\n // need the input encoded in memory in the Ethereum ABIv2 format [1].\n\n // | Area | Offset | Length | Contents |\n // | -------- |--------|---------|-------------------------------------------- |\n // | Header | 0x00 | 4 | function selector |\n // | Params | | 3 * 32 | function parameters: |\n // | | 0x00 | | 1. offset to order (*) |\n // | | 0x20 | | 2. takerAssetFillAmount |\n // | | 0x40 | | 3. offset to signature (*) |\n // | Data | | 12 * 32 | order: |\n // | | 0x000 | | 1. senderAddress |\n // | | 0x020 | | 2. makerAddress |\n // | | 0x040 | | 3. takerAddress |\n // | | 0x060 | | 4. feeRecipientAddress |\n // | | 0x080 | | 5. makerAssetAmount |\n // | | 0x0A0 | | 6. takerAssetAmount |\n // | | 0x0C0 | | 7. makerFeeAmount |\n // | | 0x0E0 | | 8. takerFeeAmount |\n // | | 0x100 | | 9. expirationTimeSeconds |\n // | | 0x120 | | 10. salt |\n // | | 0x140 | | 11. Offset to makerAssetData (*) |\n // | | 0x160 | | 12. Offset to takerAssetData (*) |\n // | | 0x180 | 32 | makerAssetData Length |\n // | | 0x1A0 | ** | makerAssetData Contents |\n // | | 0x1C0 | 32 | takerAssetData Length |\n // | | 0x1E0 | ** | takerAssetData Contents |\n // | | 0x200 | 32 | signature Length |\n // | | 0x220 | ** | signature Contents |\n\n // * Offsets are calculated from the beginning of the current area: Header, Params, Data:\n // An offset stored in the Params area is calculated from the beginning of the Params section.\n // An offset stored in the Data area is calculated from the beginning of the Data section.\n\n // ** The length of dynamic array contents are stored in the field immediately preceeding the contents.\n\n // [1]: https://solidity.readthedocs.io/en/develop/abi-spec.html\n\n assembly {\n\n // Areas below may use the following variables:\n // 1. <area>Start -- Start of this area in memory\n // 2. <area>End -- End of this area in memory. This value may\n // be precomputed (before writing contents),\n // or it may be computed as contents are written.\n // 3. <area>Offset -- Current offset into area. If an area's End\n // is precomputed, this variable tracks the\n // offsets of contents as they are written.\n\n /////// Setup Header Area ///////\n // Load free memory pointer\n fillOrderCalldata := mload(0x40)\n // bytes4(keccak256(\"fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)\"))\n // = 0xb4be83d5\n // Leave 0x20 bytes to store the length\n mstore(add(fillOrderCalldata, 0x20), 0xb4be83d500000000000000000000000000000000000000000000000000000000)\n let headerAreaEnd := add(fillOrderCalldata, 0x24)\n\n /////// Setup Params Area ///////\n // This area is preallocated and written to later.\n // This is because we need to fill in offsets that have not yet been calculated.\n let paramsAreaStart := headerAreaEnd\n let paramsAreaEnd := add(paramsAreaStart, 0x60)\n let paramsAreaOffset := paramsAreaStart\n\n /////// Setup Data Area ///////\n let dataAreaStart := paramsAreaEnd\n let dataAreaEnd := dataAreaStart\n\n // Offset from the source data we're reading from\n let sourceOffset := order\n // arrayLenBytes and arrayLenWords track the length of a dynamically-allocated bytes array.\n let arrayLenBytes := 0\n let arrayLenWords := 0\n\n /////// Write order Struct ///////\n // Write memory location of Order, relative to the start of the\n // parameter list, then increment the paramsAreaOffset respectively.\n mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))\n paramsAreaOffset := add(paramsAreaOffset, 0x20)\n\n // Write values for each field in the order\n // It would be nice to use a loop, but we save on gas by writing\n // the stores sequentially.\n mstore(dataAreaEnd, mload(sourceOffset)) // makerAddress\n mstore(add(dataAreaEnd, 0x20), mload(add(sourceOffset, 0x20))) // takerAddress\n mstore(add(dataAreaEnd, 0x40), mload(add(sourceOffset, 0x40))) // feeRecipientAddress\n mstore(add(dataAreaEnd, 0x60), mload(add(sourceOffset, 0x60))) // senderAddress\n mstore(add(dataAreaEnd, 0x80), mload(add(sourceOffset, 0x80))) // makerAssetAmount\n mstore(add(dataAreaEnd, 0xA0), mload(add(sourceOffset, 0xA0))) // takerAssetAmount\n mstore(add(dataAreaEnd, 0xC0), mload(add(sourceOffset, 0xC0))) // makerFeeAmount\n mstore(add(dataAreaEnd, 0xE0), mload(add(sourceOffset, 0xE0))) // takerFeeAmount\n mstore(add(dataAreaEnd, 0x100), mload(add(sourceOffset, 0x100))) // expirationTimeSeconds\n mstore(add(dataAreaEnd, 0x120), mload(add(sourceOffset, 0x120))) // salt\n mstore(add(dataAreaEnd, 0x140), mload(add(sourceOffset, 0x140))) // Offset to makerAssetData\n mstore(add(dataAreaEnd, 0x160), mload(add(sourceOffset, 0x160))) // Offset to takerAssetData\n dataAreaEnd := add(dataAreaEnd, 0x180)\n sourceOffset := add(sourceOffset, 0x180)\n\n // Write offset to <order.makerAssetData>\n mstore(add(dataAreaStart, mul(10, 0x20)), sub(dataAreaEnd, dataAreaStart))\n\n // Calculate length of <order.makerAssetData>\n sourceOffset := mload(add(order, 0x140)) // makerAssetData\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of <order.makerAssetData>\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of <order.makerAssetData>\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n // Write offset to <order.takerAssetData>\n mstore(add(dataAreaStart, mul(11, 0x20)), sub(dataAreaEnd, dataAreaStart))\n\n // Calculate length of <order.takerAssetData>\n sourceOffset := mload(add(order, 0x160)) // takerAssetData\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of <order.takerAssetData>\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of <order.takerAssetData>\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n /////// Write takerAssetFillAmount ///////\n mstore(paramsAreaOffset, takerAssetFillAmount)\n paramsAreaOffset := add(paramsAreaOffset, 0x20)\n\n /////// Write signature ///////\n // Write offset to paramsArea\n mstore(paramsAreaOffset, sub(dataAreaEnd, paramsAreaStart))\n\n // Calculate length of signature\n sourceOffset := signature\n arrayLenBytes := mload(sourceOffset)\n sourceOffset := add(sourceOffset, 0x20)\n arrayLenWords := div(add(arrayLenBytes, 0x1F), 0x20)\n\n // Write length of signature\n mstore(dataAreaEnd, arrayLenBytes)\n dataAreaEnd := add(dataAreaEnd, 0x20)\n\n // Write contents of signature\n for {let i := 0} lt(i, arrayLenWords) {i := add(i, 1)} {\n mstore(dataAreaEnd, mload(sourceOffset))\n dataAreaEnd := add(dataAreaEnd, 0x20)\n sourceOffset := add(sourceOffset, 0x20)\n }\n\n // Set length of calldata\n mstore(fillOrderCalldata, sub(dataAreaEnd, add(fillOrderCalldata, 0x20)))\n\n // Increment free memory pointer\n mstore(0x40, dataAreaEnd)\n }\n\n return fillOrderCalldata;\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0xa2e6ced6e8fad38f3b25688799aa4500fc942b7cb81f73860acffb06bbb5f763",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/TestSignatureValidator.json b/packages/contracts/generated-artifacts/TestSignatureValidator.json
new file mode 100644
index 000000000..e86e9f530
--- /dev/null
+++ b/packages/contracts/generated-artifacts/TestSignatureValidator.json
@@ -0,0 +1,336 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "TestSignatureValidator",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "preSign",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "transactions",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "validatorAddress",
+ "type": "address"
+ },
+ {
+ "name": "approval",
+ "type": "bool"
+ }
+ ],
+ "name": "setSignatureValidatorApproval",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "allowedValidators",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "preSigned",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signer",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "publicIsValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "data",
+ "type": "bytes"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "executeTransaction",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "EIP712_DOMAIN_HASH",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "currentContextAddress",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "validatorAddress",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "approved",
+ "type": "bool"
+ }
+ ],
+ "name": "SignatureValidatorApproval",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x6000805460ff191690557f454950373132446f6d61696e280000000000000000000000000000000000000060a09081527f737472696e67206e616d652c000000000000000000000000000000000000000060ad527f737472696e672076657273696f6e2c000000000000000000000000000000000060b9527f6164647265737320766572696679696e67436f6e74726163740000000000000060c8527f290000000000000000000000000000000000000000000000000000000000000060e1526042608081815260e26040819052909290918291908083835b602083106100f75780518252601f1990920191602091820191016100d8565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208285018552600b8084527f30782050726f746f636f6c000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b6020831061017f5780518252601f199092019160209182019101610160565b51815160209384036101000a600019018019909216911617905260408051929094018290038220828501855260018084527f3200000000000000000000000000000000000000000000000000000000000000928401928352945190965091945090928392508083835b602083106102075780518252601f1990920191602091820191016101e8565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208282019890985281840196909652606081019690965250306080808701919091528151808703909101815260a09095019081905284519093849350850191508083835b602083106102905780518252601f199092019160209182019101610271565b5181516000196020949094036101000a939093019283169219169190911790526040519201829003909120600155505050611b2180620002d16000396000f3006080604052600436106100a35763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633683ef8e81146100a8578063642f2eaf146100e857806377fcce68146101145780637b8e35141461014757806382c174d01461017b57806393634702146101ac578063abba41cc14610222578063bfc8bfce14610298578063e306f779146102e2578063eea086ba14610309575b600080fd5b3480156100b457600080fd5b506100e660048035906024803573ffffffffffffffffffffffffffffffffffffffff1691604435918201910135610347565b005b3480156100f457600080fd5b50610100600435610469565b604080519115158252519081900360200190f35b34801561012057600080fd5b506100e673ffffffffffffffffffffffffffffffffffffffff60043516602435151561047e565b34801561015357600080fd5b5061010073ffffffffffffffffffffffffffffffffffffffff600435811690602435166105eb565b34801561018757600080fd5b5061010060043573ffffffffffffffffffffffffffffffffffffffff6024351661060b565b3480156101b857600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610100948235946024803573ffffffffffffffffffffffffffffffffffffffff169536959460649492019190819084018382808284375094975061062b9650505050505050565b34801561022e57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610100948235946024803573ffffffffffffffffffffffffffffffffffffffff1695369594606494920191908190840183828082843750949750610da79650505050505050565b3480156102a457600080fd5b506100e660048035906024803573ffffffffffffffffffffffffffffffffffffffff1691604435808301929082013591606435918201910135610dbc565b3480156102ee57600080fd5b506102f7611129565b60408051918252519081900360200190f35b34801561031557600080fd5b5061031e61112f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b73ffffffffffffffffffffffffffffffffffffffff8316331461040c5761039f848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375061062b945050505050565b151561040c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f494e56414c49445f5349474e4154555245000000000000000000000000000000604482015290519081900360640190fd5b5050600091825260026020908152604080842073ffffffffffffffffffffffffffffffffffffffff9093168452919052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b60046020526000908152604090205460ff1681565b6000805460ff16156104f157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000604482015290519081900360640190fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561052461114b565b73ffffffffffffffffffffffffffffffffffffffff81811660008181526003602090815260408083209489168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001688151590811790915582519081529151949550929391927fa8656e308026eeabce8f0bc18048433252318ab80ac79da0b3d3d8697dfba89192918290030190a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b600360209081526000928352604080842090915290825290205460ff1681565b600260209081526000928352604080842090915290825290205460ff1681565b600080600080600080600080600089511115156106a957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4c454e4754485f475245415445525f5448414e5f305f52455155495245440000604482015290519081900360640190fd5b6106b28961117d565b7f010000000000000000000000000000000000000000000000000000000000000090049650600760ff88161061074957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5349474e41545552455f554e535550504f525445440000000000000000000000604482015290519081900360640190fd5b8660ff16600781111561075857fe5b9550600086600781111561076857fe5b14156107d557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f5349474e41545552455f494c4c4547414c000000000000000000000000000000604482015290519081900360640190fd5b60018660078111156107e357fe5b14156108605788511561085757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4c454e4754485f305f5245515549524544000000000000000000000000000000604482015290519081900360640190fd5b60009750610d99565b600286600781111561086e57fe5b1415610a0e5788516041146108e457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c454e4754485f36355f52455155495245440000000000000000000000000000604482015290519081900360640190fd5b8860008151811015156108f357fe5b01602001517f010000000000000000000000000000000000000000000000000000000000000090819004810204945061093389600163ffffffff61129c16565b935061094689602163ffffffff61129c16565b925060018b868686604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af11580156109bf573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff8c81169082161499509250610d999050565b6003866007811115610a1c57fe5b1415610c4d578851604114610a9257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c454e4754485f36355f52455155495245440000000000000000000000000000604482015290519081900360640190fd5b886000815181101515610aa157fe5b01602001517f0100000000000000000000000000000000000000000000000000000000000000908190048102049450610ae189600163ffffffff61129c16565b9350610af489602163ffffffff61129c16565b925060018b60405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b60208310610b9557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b58565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822060008084528383018087529190915260ff8d1683860152606083018c9052608083018b9052935160a080840197509195507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019492819003909101925090865af11580156109bf573d6000803e3d6000fd5b6004866007811115610c5b57fe5b1415610c7357610c6c8b8b8b611342565b9750610d99565b6005866007811115610c8157fe5b1415610ce457610c9089611503565b73ffffffffffffffffffffffffffffffffffffffff808c1660009081526003602090815260408083209385168352929052205490915060ff161515610cd85760009750610d99565b610c6c818c8c8c6115d7565b6006866007811115610cf257fe5b1415610d325760008b815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290205460ff169750610d99565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5349474e41545552455f554e535550504f525445440000000000000000000000604482015290519081900360640190fd5b505050505050509392505050565b6000610db484848461062b565b949350505050565b60055460009073ffffffffffffffffffffffffffffffffffffffff1615610e4457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000604482015290519081900360640190fd5b610e87610e82888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437506117b8945050505050565b6119f9565b60008181526004602052604090205490915060ff1615610f0857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f494e56414c49445f54585f484153480000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8616331461100e57610f60818785858080601f0160208091040260200160405190810160405280939291908181526020018383808284375061062b945050505050565b1515610fcd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f494e56414c49445f54585f5349474e4154555245000000000000000000000000604482015290519081900360640190fd5b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555b6000818152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555130908690869080838380828437820191505092505050600060405180830381855af491505015156110da57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4641494c45445f455845435554494f4e00000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8616331461112057600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b50505050505050565b60015481565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60055460009073ffffffffffffffffffffffffffffffffffffffff168181156111745781611176565b335b9392505050565b600080825111151561121657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560448201527f4400000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b815182907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061124657fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909252507f0100000000000000000000000000000000000000000000000000000000000000908190040290565b60008160200183511015151561133957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b50016020015190565b6040805160248101858152604482019283528351606483015283516000936060937f1626ba7e00000000000000000000000000000000000000000000000000000000938993889391926084019060208501908083838c5b838110156113b1578181015183820152602001611399565b50505050905090810190601f1680156113de5780820380516001836020036101000a031916815260200191505b50604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909816979097178752815191975094508593509150829050885afa80801561148257600181146114f3576114f8565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0c57414c4c45545f4552524f5200000000000000000000000000000000604052600060605260646000fd5b825194505b505050509392505050565b6000601482511015151561159e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6115ac826014845103611a39565b82517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec019092525090565b6040516024810184815273ffffffffffffffffffffffffffffffffffffffff8416604483015260606064830181815284516084850152845160009492937f9363470200000000000000000000000000000000000000000000000000000000938993899389939260a4019060208501908083838d5b8381101561166357818101518382015260200161164b565b50505050905090810190601f1680156116905780820380516001836020036101000a031916815260200191505b50604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009099169890981788528151919850955086945092508391508b90505afa80801561173657600181146117a7576117ac565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f56414c494441544f525f4552524f5200000000000000000000000000604052600060605260646000fd5b825194505b50505050949350505050565b604080517f5a65726f45785472616e73616374696f6e2800000000000000000000000000006020808301919091527f75696e743235362073616c742c0000000000000000000000000000000000000060328301527f61646472657373207369676e6572416464726573732c00000000000000000000603f8301527f627974657320646174610000000000000000000000000000000000000000000060558301527f2900000000000000000000000000000000000000000000000000000000000000605f830152825180830384018152606090920192839052815160009384938493909282918401908083835b602083106118e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016118a4565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260405191909301819003812089519097508995509093508392850191508083835b6020831061197757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161193a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822097825281019a909a525073ffffffffffffffffffffffffffffffffffffffff97909716968801969096525050606085015250506080909120919050565b6001546040517f19010000000000000000000000000000000000000000000000000000000000008152600281019190915260228101919091526042902090565b600081601401835110151515611ad657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b50016014015173ffffffffffffffffffffffffffffffffffffffff16905600a165627a7a72305820caa772a34bd4c3cb836c56e53a4af55503e52942cdc02bc88d26889f2d7434510029",
+ "opcodes": "PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF NOT AND SWAP1 SSTORE PUSH32 0x454950373132446F6D61696E2800000000000000000000000000000000000000 PUSH1 0xA0 SWAP1 DUP2 MSTORE PUSH32 0x737472696E67206E616D652C0000000000000000000000000000000000000000 PUSH1 0xAD MSTORE PUSH32 0x737472696E672076657273696F6E2C0000000000000000000000000000000000 PUSH1 0xB9 MSTORE PUSH32 0x6164647265737320766572696679696E67436F6E747261637400000000000000 PUSH1 0xC8 MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0xE1 MSTORE PUSH1 0x42 PUSH1 0x80 DUP2 DUP2 MSTORE PUSH1 0xE2 PUSH1 0x40 DUP2 SWAP1 MSTORE SWAP1 SWAP3 SWAP1 SWAP2 DUP3 SWAP2 SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xF7 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xD8 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP6 ADD DUP6 MSTORE PUSH1 0xB DUP1 DUP5 MSTORE PUSH32 0x30782050726F746F636F6C000000000000000000000000000000000000000000 SWAP3 DUP5 ADD SWAP3 DUP4 MSTORE SWAP5 MLOAD SWAP1 SWAP7 POP SWAP2 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x17F JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x160 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP6 ADD DUP6 MSTORE PUSH1 0x1 DUP1 DUP5 MSTORE PUSH32 0x3200000000000000000000000000000000000000000000000000000000000000 SWAP3 DUP5 ADD SWAP3 DUP4 MSTORE SWAP5 MLOAD SWAP1 SWAP7 POP SWAP2 SWAP5 POP SWAP1 SWAP3 DUP4 SWAP3 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x207 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x1E8 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH1 0x0 NOT ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 DUP3 DUP3 ADD SWAP9 SWAP1 SWAP9 MSTORE DUP2 DUP5 ADD SWAP7 SWAP1 SWAP7 MSTORE PUSH1 0x60 DUP2 ADD SWAP7 SWAP1 SWAP7 MSTORE POP ADDRESS PUSH1 0x80 DUP1 DUP8 ADD SWAP2 SWAP1 SWAP2 MSTORE DUP2 MLOAD DUP1 DUP8 SUB SWAP1 SWAP2 ADD DUP2 MSTORE PUSH1 0xA0 SWAP1 SWAP6 ADD SWAP1 DUP2 SWAP1 MSTORE DUP5 MLOAD SWAP1 SWAP4 DUP5 SWAP4 POP DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x290 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH1 0x1F NOT SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x271 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x0 NOT PUSH1 0x20 SWAP5 SWAP1 SWAP5 SUB PUSH2 0x100 EXP SWAP4 SWAP1 SWAP4 ADD SWAP3 DUP4 AND SWAP3 NOT AND SWAP2 SWAP1 SWAP2 OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP3 ADD DUP3 SWAP1 SUB SWAP1 SWAP2 KECCAK256 PUSH1 0x1 SSTORE POP POP POP PUSH2 0x1B21 DUP1 PUSH3 0x2D1 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xA3 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x3683EF8E DUP2 EQ PUSH2 0xA8 JUMPI DUP1 PUSH4 0x642F2EAF EQ PUSH2 0xE8 JUMPI DUP1 PUSH4 0x77FCCE68 EQ PUSH2 0x114 JUMPI DUP1 PUSH4 0x7B8E3514 EQ PUSH2 0x147 JUMPI DUP1 PUSH4 0x82C174D0 EQ PUSH2 0x17B JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0x1AC JUMPI DUP1 PUSH4 0xABBA41CC EQ PUSH2 0x222 JUMPI DUP1 PUSH4 0xBFC8BFCE EQ PUSH2 0x298 JUMPI DUP1 PUSH4 0xE306F779 EQ PUSH2 0x2E2 JUMPI DUP1 PUSH4 0xEEA086BA EQ PUSH2 0x309 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE6 PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x347 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xF4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x100 PUSH1 0x4 CALLDATALOAD PUSH2 0x469 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x120 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0x47E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x153 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x100 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x5EB JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x187 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x100 PUSH1 0x4 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x24 CALLDATALOAD AND PUSH2 0x60B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1B8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x100 SWAP5 DUP3 CALLDATALOAD SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x62B SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x22E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x100 SWAP5 DUP3 CALLDATALOAD SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0xDA7 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE6 PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD DUP1 DUP4 ADD SWAP3 SWAP1 DUP3 ADD CALLDATALOAD SWAP2 PUSH1 0x64 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH2 0xDBC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2F7 PUSH2 0x1129 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x315 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x31E PUSH2 0x112F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND CALLER EQ PUSH2 0x40C JUMPI PUSH2 0x39F DUP5 DUP5 DUP5 DUP5 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x62B SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0x40C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F5349474E4154555245000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND DUP5 MSTORE SWAP2 SWAP1 MSTORE SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x4F1 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5245454E5452414E43595F494C4C4547414C0000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x524 PUSH2 0x114B JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 DUP10 AND DUP1 DUP5 MSTORE SWAP5 DUP3 MSTORE SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP9 ISZERO ISZERO SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP3 MLOAD SWAP1 DUP2 MSTORE SWAP2 MLOAD SWAP5 SWAP6 POP SWAP3 SWAP4 SWAP2 SWAP3 PUSH32 0xA8656E308026EEABCE8F0BC18048433252318AB80AC79DA0B3D3D8697DFBA891 SWAP3 SWAP2 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP10 MLOAD GT ISZERO ISZERO PUSH2 0x6A9 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1E PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F305F52455155495245440000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x6B2 DUP10 PUSH2 0x117D JUMP JUMPDEST PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DIV SWAP7 POP PUSH1 0x7 PUSH1 0xFF DUP9 AND LT PUSH2 0x749 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5349474E41545552455F554E535550504F525445440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP7 PUSH1 0xFF AND PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x758 JUMPI INVALID JUMPDEST SWAP6 POP PUSH1 0x0 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x768 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x7D5 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5349474E41545552455F494C4C4547414C000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x7E3 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x860 JUMPI DUP9 MLOAD ISZERO PUSH2 0x857 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F305F5245515549524544000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 SWAP8 POP PUSH2 0xD99 JUMP JUMPDEST PUSH1 0x2 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x86E JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0xA0E JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0x8E4 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F36355F52455155495245440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x8F3 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0x933 DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x129C AND JUMP JUMPDEST SWAP4 POP PUSH2 0x946 DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x129C AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD DUP1 DUP6 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 PUSH1 0xFF AND PUSH1 0xFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP4 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP5 POP POP POP POP POP PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 PUSH1 0x0 DUP7 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x9BF JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP13 DUP2 AND SWAP1 DUP3 AND EQ SWAP10 POP SWAP3 POP PUSH2 0xD99 SWAP1 POP JUMP JUMPDEST PUSH1 0x3 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0xA1C JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0xC4D JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0xA92 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F36355F52455155495245440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xAA1 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0xAE1 DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x129C AND JUMP JUMPDEST SWAP4 POP PUSH2 0xAF4 DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x129C AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 PUSH1 0x40 MLOAD PUSH1 0x20 ADD DUP1 DUP1 PUSH32 0x19457468657265756D205369676E6564204D6573736167653A0A333200000000 DUP2 MSTORE POP PUSH1 0x1C ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xB95 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xB58 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 PUSH1 0x0 DUP1 DUP5 MSTORE DUP4 DUP4 ADD DUP1 DUP8 MSTORE SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0xFF DUP14 AND DUP4 DUP7 ADD MSTORE PUSH1 0x60 DUP4 ADD DUP13 SWAP1 MSTORE PUSH1 0x80 DUP4 ADD DUP12 SWAP1 MSTORE SWAP4 MLOAD PUSH1 0xA0 DUP1 DUP5 ADD SWAP8 POP SWAP2 SWAP6 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 ADD SWAP5 SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP3 POP SWAP1 DUP7 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x9BF JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST PUSH1 0x4 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0xC5B JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0xC73 JUMPI PUSH2 0xC6C DUP12 DUP12 DUP12 PUSH2 0x1342 JUMP JUMPDEST SWAP8 POP PUSH2 0xD99 JUMP JUMPDEST PUSH1 0x5 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0xC81 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0xCE4 JUMPI PUSH2 0xC90 DUP10 PUSH2 0x1503 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP13 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO ISZERO PUSH2 0xCD8 JUMPI PUSH1 0x0 SWAP8 POP PUSH2 0xD99 JUMP JUMPDEST PUSH2 0xC6C DUP2 DUP13 DUP13 DUP13 PUSH2 0x15D7 JUMP JUMPDEST PUSH1 0x6 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0xCF2 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0xD32 JUMPI PUSH1 0x0 DUP12 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP15 AND DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND SWAP8 POP PUSH2 0xD99 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5349474E41545552455F554E535550504F525445440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xDB4 DUP5 DUP5 DUP5 PUSH2 0x62B JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0xE44 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5245454E5452414E43595F494C4C4547414C0000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0xE87 PUSH2 0xE82 DUP9 DUP9 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x17B8 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x19F9 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO PUSH2 0xF08 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F54585F484153480000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x100E JUMPI PUSH2 0xF60 DUP2 DUP8 DUP6 DUP6 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x62B SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0xFCD JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x14 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F54585F5349474E4154555245000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x5 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND OR SWAP1 SSTORE JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE MLOAD ADDRESS SWAP1 DUP7 SWAP1 DUP7 SWAP1 DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 GAS DELEGATECALL SWAP2 POP POP ISZERO ISZERO PUSH2 0x10DA JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4641494C45445F455845435554494F4E00000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x1120 JUMPI PUSH1 0x5 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x5 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 DUP2 ISZERO PUSH2 0x1174 JUMPI DUP2 PUSH2 0x1176 JUMP JUMPDEST CALLER JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 MLOAD GT ISZERO ISZERO PUSH2 0x1216 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x21 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F5448414E5F5A45524F5F4C454E4754485F52455155495245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x4400000000000000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST DUP2 MLOAD DUP3 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x1246 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP3 MSTORE POP PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV MUL SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1339 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x24 DUP2 ADD DUP6 DUP2 MSTORE PUSH1 0x44 DUP3 ADD SWAP3 DUP4 MSTORE DUP4 MLOAD PUSH1 0x64 DUP4 ADD MSTORE DUP4 MLOAD PUSH1 0x0 SWAP4 PUSH1 0x60 SWAP4 PUSH32 0x1626BA7E00000000000000000000000000000000000000000000000000000000 SWAP4 DUP10 SWAP4 DUP9 SWAP4 SWAP2 SWAP3 PUSH1 0x84 ADD SWAP1 PUSH1 0x20 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP13 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x13B1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1399 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x13DE JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP9 AND SWAP8 SWAP1 SWAP8 OR DUP8 MSTORE DUP2 MLOAD SWAP2 SWAP8 POP SWAP5 POP DUP6 SWAP4 POP SWAP2 POP DUP3 SWAP1 POP DUP9 GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x1482 JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x14F3 JUMPI PUSH2 0x14F8 JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xC57414C4C45545F4552524F5200000000000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD SWAP5 POP JUMPDEST POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x14 DUP3 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x159E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST PUSH2 0x15AC DUP3 PUSH1 0x14 DUP5 MLOAD SUB PUSH2 0x1A39 JUMP JUMPDEST DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC ADD SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x24 DUP2 ADD DUP5 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x44 DUP4 ADD MSTORE PUSH1 0x60 PUSH1 0x64 DUP4 ADD DUP2 DUP2 MSTORE DUP5 MLOAD PUSH1 0x84 DUP6 ADD MSTORE DUP5 MLOAD PUSH1 0x0 SWAP5 SWAP3 SWAP4 PUSH32 0x9363470200000000000000000000000000000000000000000000000000000000 SWAP4 DUP10 SWAP4 DUP10 SWAP4 DUP10 SWAP4 SWAP3 PUSH1 0xA4 ADD SWAP1 PUSH1 0x20 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP14 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1663 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x164B JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x1690 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP10 AND SWAP9 SWAP1 SWAP9 OR DUP9 MSTORE DUP2 MLOAD SWAP2 SWAP9 POP SWAP6 POP DUP7 SWAP5 POP SWAP3 POP DUP4 SWAP2 POP DUP12 SWAP1 POP GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x1736 JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x17A7 JUMPI PUSH2 0x17AC JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xF56414C494441544F525F4552524F5200000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD SWAP5 POP JUMPDEST POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x5A65726F45785472616E73616374696F6E280000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0x32 DUP4 ADD MSTORE PUSH32 0x61646472657373207369676E6572416464726573732C00000000000000000000 PUSH1 0x3F DUP4 ADD MSTORE PUSH32 0x6279746573206461746100000000000000000000000000000000000000000000 PUSH1 0x55 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0x5F DUP4 ADD MSTORE DUP3 MLOAD DUP1 DUP4 SUB DUP5 ADD DUP2 MSTORE PUSH1 0x60 SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP1 SWAP3 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x18E1 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x18A4 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP10 MLOAD SWAP1 SWAP8 POP DUP10 SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x1977 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x193A JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 SWAP8 DUP3 MSTORE DUP2 ADD SWAP11 SWAP1 SWAP11 MSTORE POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 SWAP1 SWAP8 AND SWAP7 DUP9 ADD SWAP7 SWAP1 SWAP7 MSTORE POP POP PUSH1 0x60 DUP6 ADD MSTORE POP POP PUSH1 0x80 SWAP1 SWAP2 KECCAK256 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x1 SLOAD PUSH1 0x40 MLOAD PUSH32 0x1901000000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x22 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1AD6 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xca 0xa7 PUSH19 0xA34BD4C3CB836C56E53A4AF55503E52942CDC0 0x2b 0xc8 DUP14 0x26 DUP9 SWAP16 0x2d PUSH21 0x345100290000000000000000000000000000000000 ",
+ "sourceMap": "689:5:83:-;667:27;;-1:-1:-1;;667:27:83;;;1045:148:44;;;;;;;;;;;;;;;;;22:32:-1;725:411:68;6:49:-1;;;1045:148:44;725:411:68;1045:148:44;;;725:411:68;;1045:148:44;;;;;22:32:-1;1045:148:44;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1035:159:44;;;;;;;;;;;;1511:18;;;;;;;;;;;;;;;;1495:36;;1035:159;;-1:-1:-1;1035:159:44;;-1:-1:-1;1495:36:44;;;;-1:-1:-1;1511:18:44;1495:36;1511:18;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1495:36:44;;;;;;;;;;;;1561:21;;;;;274:1:-1;1561:21:44;;;;;;;;;;1545:39;;1495:36;;-1:-1:-1;1495:36:44;;-1:-1:-1;1545:39:44;;;;-1:-1:-1;274:1;1545:39:44;1561:21;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1545:39:44;;;;;;;;;;;;1416:214;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1614:4:44;1416:214;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;1416:214:44;;;;;;;;1406:225;;1416:214;;;;-1:-1:-1;1406:225:44;;;-1:-1:-1;1406:225:44;1416:214;1406:225;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;-1:-1;;263:2;259:12;;;;254:3;250:22;246:30;;;;340:21;;;311:9;;295:26;377:20;;;;365:33;;1406:225:44;;;;;;;;;;274:1:-1;1385:246:44;-1:-1:-1;;;725:411:68;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100a35763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633683ef8e81146100a8578063642f2eaf146100e857806377fcce68146101145780637b8e35141461014757806382c174d01461017b57806393634702146101ac578063abba41cc14610222578063bfc8bfce14610298578063e306f779146102e2578063eea086ba14610309575b600080fd5b3480156100b457600080fd5b506100e660048035906024803573ffffffffffffffffffffffffffffffffffffffff1691604435918201910135610347565b005b3480156100f457600080fd5b50610100600435610469565b604080519115158252519081900360200190f35b34801561012057600080fd5b506100e673ffffffffffffffffffffffffffffffffffffffff60043516602435151561047e565b34801561015357600080fd5b5061010073ffffffffffffffffffffffffffffffffffffffff600435811690602435166105eb565b34801561018757600080fd5b5061010060043573ffffffffffffffffffffffffffffffffffffffff6024351661060b565b3480156101b857600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610100948235946024803573ffffffffffffffffffffffffffffffffffffffff169536959460649492019190819084018382808284375094975061062b9650505050505050565b34801561022e57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610100948235946024803573ffffffffffffffffffffffffffffffffffffffff1695369594606494920191908190840183828082843750949750610da79650505050505050565b3480156102a457600080fd5b506100e660048035906024803573ffffffffffffffffffffffffffffffffffffffff1691604435808301929082013591606435918201910135610dbc565b3480156102ee57600080fd5b506102f7611129565b60408051918252519081900360200190f35b34801561031557600080fd5b5061031e61112f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b73ffffffffffffffffffffffffffffffffffffffff8316331461040c5761039f848484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375061062b945050505050565b151561040c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f494e56414c49445f5349474e4154555245000000000000000000000000000000604482015290519081900360640190fd5b5050600091825260026020908152604080842073ffffffffffffffffffffffffffffffffffffffff9093168452919052902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b60046020526000908152604090205460ff1681565b6000805460ff16156104f157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000604482015290519081900360640190fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561052461114b565b73ffffffffffffffffffffffffffffffffffffffff81811660008181526003602090815260408083209489168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001688151590811790915582519081529151949550929391927fa8656e308026eeabce8f0bc18048433252318ab80ac79da0b3d3d8697dfba89192918290030190a35050600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905550565b600360209081526000928352604080842090915290825290205460ff1681565b600260209081526000928352604080842090915290825290205460ff1681565b600080600080600080600080600089511115156106a957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4c454e4754485f475245415445525f5448414e5f305f52455155495245440000604482015290519081900360640190fd5b6106b28961117d565b7f010000000000000000000000000000000000000000000000000000000000000090049650600760ff88161061074957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5349474e41545552455f554e535550504f525445440000000000000000000000604482015290519081900360640190fd5b8660ff16600781111561075857fe5b9550600086600781111561076857fe5b14156107d557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f5349474e41545552455f494c4c4547414c000000000000000000000000000000604482015290519081900360640190fd5b60018660078111156107e357fe5b14156108605788511561085757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4c454e4754485f305f5245515549524544000000000000000000000000000000604482015290519081900360640190fd5b60009750610d99565b600286600781111561086e57fe5b1415610a0e5788516041146108e457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c454e4754485f36355f52455155495245440000000000000000000000000000604482015290519081900360640190fd5b8860008151811015156108f357fe5b01602001517f010000000000000000000000000000000000000000000000000000000000000090819004810204945061093389600163ffffffff61129c16565b935061094689602163ffffffff61129c16565b925060018b868686604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af11580156109bf573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff8c81169082161499509250610d999050565b6003866007811115610a1c57fe5b1415610c4d578851604114610a9257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c454e4754485f36355f52455155495245440000000000000000000000000000604482015290519081900360640190fd5b886000815181101515610aa157fe5b01602001517f0100000000000000000000000000000000000000000000000000000000000000908190048102049450610ae189600163ffffffff61129c16565b9350610af489602163ffffffff61129c16565b925060018b60405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b60208310610b9557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b58565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822060008084528383018087529190915260ff8d1683860152606083018c9052608083018b9052935160a080840197509195507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081019492819003909101925090865af11580156109bf573d6000803e3d6000fd5b6004866007811115610c5b57fe5b1415610c7357610c6c8b8b8b611342565b9750610d99565b6005866007811115610c8157fe5b1415610ce457610c9089611503565b73ffffffffffffffffffffffffffffffffffffffff808c1660009081526003602090815260408083209385168352929052205490915060ff161515610cd85760009750610d99565b610c6c818c8c8c6115d7565b6006866007811115610cf257fe5b1415610d325760008b815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8e16845290915290205460ff169750610d99565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5349474e41545552455f554e535550504f525445440000000000000000000000604482015290519081900360640190fd5b505050505050509392505050565b6000610db484848461062b565b949350505050565b60055460009073ffffffffffffffffffffffffffffffffffffffff1615610e4457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f5245454e5452414e43595f494c4c4547414c0000000000000000000000000000604482015290519081900360640190fd5b610e87610e82888888888080601f016020809104026020016040519081016040528093929190818152602001838380828437506117b8945050505050565b6119f9565b60008181526004602052604090205490915060ff1615610f0857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f494e56414c49445f54585f484153480000000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8616331461100e57610f60818785858080601f0160208091040260200160405190810160405280939291908181526020018383808284375061062b945050505050565b1515610fcd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f494e56414c49445f54585f5349474e4154555245000000000000000000000000604482015290519081900360640190fd5b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555b6000818152600460205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555130908690869080838380828437820191505092505050600060405180830381855af491505015156110da57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4641494c45445f455845435554494f4e00000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8616331461112057600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b50505050505050565b60015481565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60055460009073ffffffffffffffffffffffffffffffffffffffff168181156111745781611176565b335b9392505050565b600080825111151561121657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f475245415445525f5448414e5f5a45524f5f4c454e4754485f5245515549524560448201527f4400000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b815182907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061124657fe5b016020015182517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01909252507f0100000000000000000000000000000000000000000000000000000000000000908190040290565b60008160200183511015151561133957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b50016020015190565b6040805160248101858152604482019283528351606483015283516000936060937f1626ba7e00000000000000000000000000000000000000000000000000000000938993889391926084019060208501908083838c5b838110156113b1578181015183820152602001611399565b50505050905090810190601f1680156113de5780820380516001836020036101000a031916815260200191505b50604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909816979097178752815191975094508593509150829050885afa80801561148257600181146114f3576114f8565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0c57414c4c45545f4552524f5200000000000000000000000000000000604052600060605260646000fd5b825194505b505050509392505050565b6000601482511015151561159e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6115ac826014845103611a39565b82517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec019092525090565b6040516024810184815273ffffffffffffffffffffffffffffffffffffffff8416604483015260606064830181815284516084850152845160009492937f9363470200000000000000000000000000000000000000000000000000000000938993899389939260a4019060208501908083838d5b8381101561166357818101518382015260200161164b565b50505050905090810190601f1680156116905780820380516001836020036101000a031916815260200191505b50604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009099169890981788528151919850955086945092508391508b90505afa80801561173657600181146117a7576117ac565b7f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f56414c494441544f525f4552524f5200000000000000000000000000604052600060605260646000fd5b825194505b50505050949350505050565b604080517f5a65726f45785472616e73616374696f6e2800000000000000000000000000006020808301919091527f75696e743235362073616c742c0000000000000000000000000000000000000060328301527f61646472657373207369676e6572416464726573732c00000000000000000000603f8301527f627974657320646174610000000000000000000000000000000000000000000060558301527f2900000000000000000000000000000000000000000000000000000000000000605f830152825180830384018152606090920192839052815160009384938493909282918401908083835b602083106118e157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016118a4565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260405191909301819003812089519097508995509093508392850191508083835b6020831061197757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161193a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790526040805192909401829003822097825281019a909a525073ffffffffffffffffffffffffffffffffffffffff97909716968801969096525050606085015250506080909120919050565b6001546040517f19010000000000000000000000000000000000000000000000000000000000008152600281019190915260228101919091526042902090565b600081601401835110151515611ad657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b50016014015173ffffffffffffffffffffffffffffffffffffffff16905600a165627a7a72305820caa772a34bd4c3cb836c56e53a4af55503e52942cdc02bc88d26889f2d7434510029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xA3 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x3683EF8E DUP2 EQ PUSH2 0xA8 JUMPI DUP1 PUSH4 0x642F2EAF EQ PUSH2 0xE8 JUMPI DUP1 PUSH4 0x77FCCE68 EQ PUSH2 0x114 JUMPI DUP1 PUSH4 0x7B8E3514 EQ PUSH2 0x147 JUMPI DUP1 PUSH4 0x82C174D0 EQ PUSH2 0x17B JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0x1AC JUMPI DUP1 PUSH4 0xABBA41CC EQ PUSH2 0x222 JUMPI DUP1 PUSH4 0xBFC8BFCE EQ PUSH2 0x298 JUMPI DUP1 PUSH4 0xE306F779 EQ PUSH2 0x2E2 JUMPI DUP1 PUSH4 0xEEA086BA EQ PUSH2 0x309 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xB4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE6 PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x347 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xF4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x100 PUSH1 0x4 CALLDATALOAD PUSH2 0x469 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x120 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD ISZERO ISZERO PUSH2 0x47E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x153 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x100 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x5EB JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x187 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x100 PUSH1 0x4 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x24 CALLDATALOAD AND PUSH2 0x60B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1B8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x100 SWAP5 DUP3 CALLDATALOAD SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0x62B SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x22E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x4 PUSH1 0x44 CALLDATALOAD DUP2 DUP2 ADD CALLDATALOAD PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP6 ADD DUP5 ADD SWAP1 SWAP6 MSTORE DUP5 DUP5 MSTORE PUSH2 0x100 SWAP5 DUP3 CALLDATALOAD SWAP5 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP6 CALLDATASIZE SWAP6 SWAP5 PUSH1 0x64 SWAP5 SWAP3 ADD SWAP2 SWAP1 DUP2 SWAP1 DUP5 ADD DUP4 DUP3 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP8 POP PUSH2 0xDA7 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE6 PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD DUP1 DUP4 ADD SWAP3 SWAP1 DUP3 ADD CALLDATALOAD SWAP2 PUSH1 0x64 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH2 0xDBC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x2F7 PUSH2 0x1129 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x315 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x31E PUSH2 0x112F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND CALLER EQ PUSH2 0x40C JUMPI PUSH2 0x39F DUP5 DUP5 DUP5 DUP5 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x62B SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0x40C JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F5349474E4154555245000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP PUSH1 0x0 SWAP2 DUP3 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP4 AND DUP5 MSTORE SWAP2 SWAP1 MSTORE SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0xFF AND ISZERO PUSH2 0x4F1 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5245454E5452414E43595F494C4C4547414C0000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE PUSH2 0x524 PUSH2 0x114B JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP5 DUP10 AND DUP1 DUP5 MSTORE SWAP5 DUP3 MSTORE SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND DUP9 ISZERO ISZERO SWAP1 DUP2 OR SWAP1 SWAP2 SSTORE DUP3 MLOAD SWAP1 DUP2 MSTORE SWAP2 MLOAD SWAP5 SWAP6 POP SWAP3 SWAP4 SWAP2 SWAP3 PUSH32 0xA8656E308026EEABCE8F0BC18048433252318AB80AC79DA0B3D3D8697DFBA891 SWAP3 SWAP2 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP POP PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP1 SSTORE POP JUMP JUMPDEST PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x0 DUP10 MLOAD GT ISZERO ISZERO PUSH2 0x6A9 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x1E PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F475245415445525F5448414E5F305F52455155495245440000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0x6B2 DUP10 PUSH2 0x117D JUMP JUMPDEST PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DIV SWAP7 POP PUSH1 0x7 PUSH1 0xFF DUP9 AND LT PUSH2 0x749 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5349474E41545552455F554E535550504F525445440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP7 PUSH1 0xFF AND PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x758 JUMPI INVALID JUMPDEST SWAP6 POP PUSH1 0x0 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x768 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x7D5 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5349474E41545552455F494C4C4547414C000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x1 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x7E3 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0x860 JUMPI DUP9 MLOAD ISZERO PUSH2 0x857 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x11 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F305F5245515549524544000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x0 SWAP8 POP PUSH2 0xD99 JUMP JUMPDEST PUSH1 0x2 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x86E JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0xA0E JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0x8E4 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F36355F52455155495245440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x8F3 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0x933 DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x129C AND JUMP JUMPDEST SWAP4 POP PUSH2 0x946 DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x129C AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD PUSH1 0x0 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD DUP1 DUP6 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD DUP5 PUSH1 0xFF AND PUSH1 0xFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP4 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP5 POP POP POP POP POP PUSH1 0x20 PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 SUB SWAP1 DUP1 DUP5 SUB SWAP1 PUSH1 0x0 DUP7 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x9BF JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP13 DUP2 AND SWAP1 DUP3 AND EQ SWAP10 POP SWAP3 POP PUSH2 0xD99 SWAP1 POP JUMP JUMPDEST PUSH1 0x3 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0xA1C JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0xC4D JUMPI DUP9 MLOAD PUSH1 0x41 EQ PUSH2 0xA92 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F36355F52455155495245440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP9 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0xAA1 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV DUP2 MUL DIV SWAP5 POP PUSH2 0xAE1 DUP10 PUSH1 0x1 PUSH4 0xFFFFFFFF PUSH2 0x129C AND JUMP JUMPDEST SWAP4 POP PUSH2 0xAF4 DUP10 PUSH1 0x21 PUSH4 0xFFFFFFFF PUSH2 0x129C AND JUMP JUMPDEST SWAP3 POP PUSH1 0x1 DUP12 PUSH1 0x40 MLOAD PUSH1 0x20 ADD DUP1 DUP1 PUSH32 0x19457468657265756D205369676E6564204D6573736167653A0A333200000000 DUP2 MSTORE POP PUSH1 0x1C ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP2 DUP4 SUB SUB DUP2 MSTORE SWAP1 PUSH1 0x40 MSTORE PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 MLOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0xB95 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xB58 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 PUSH1 0x0 DUP1 DUP5 MSTORE DUP4 DUP4 ADD DUP1 DUP8 MSTORE SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0xFF DUP14 AND DUP4 DUP7 ADD MSTORE PUSH1 0x60 DUP4 ADD DUP13 SWAP1 MSTORE PUSH1 0x80 DUP4 ADD DUP12 SWAP1 MSTORE SWAP4 MLOAD PUSH1 0xA0 DUP1 DUP5 ADD SWAP8 POP SWAP2 SWAP6 POP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 ADD SWAP5 SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP3 POP SWAP1 DUP7 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x9BF JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST PUSH1 0x4 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0xC5B JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0xC73 JUMPI PUSH2 0xC6C DUP12 DUP12 DUP12 PUSH2 0x1342 JUMP JUMPDEST SWAP8 POP PUSH2 0xD99 JUMP JUMPDEST PUSH1 0x5 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0xC81 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0xCE4 JUMPI PUSH2 0xC90 DUP10 PUSH2 0x1503 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP13 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO ISZERO PUSH2 0xCD8 JUMPI PUSH1 0x0 SWAP8 POP PUSH2 0xD99 JUMP JUMPDEST PUSH2 0xC6C DUP2 DUP13 DUP13 DUP13 PUSH2 0x15D7 JUMP JUMPDEST PUSH1 0x6 DUP7 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0xCF2 JUMPI INVALID JUMPDEST EQ ISZERO PUSH2 0xD32 JUMPI PUSH1 0x0 DUP12 DUP2 MSTORE PUSH1 0x2 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP15 AND DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND SWAP8 POP PUSH2 0xD99 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x15 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5349474E41545552455F554E535550504F525445440000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST POP POP POP POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xDB4 DUP5 DUP5 DUP5 PUSH2 0x62B JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND ISZERO PUSH2 0xE44 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x5245454E5452414E43595F494C4C4547414C0000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH2 0xE87 PUSH2 0xE82 DUP9 DUP9 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x17B8 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x19F9 JUMP JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD SWAP1 SWAP2 POP PUSH1 0xFF AND ISZERO PUSH2 0xF08 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0xF PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F54585F484153480000000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x100E JUMPI PUSH2 0xF60 DUP2 DUP8 DUP6 DUP6 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP PUSH2 0x62B SWAP5 POP POP POP POP POP JUMP JUMPDEST ISZERO ISZERO PUSH2 0xFCD JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x14 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x494E56414C49445F54585F5349474E4154555245000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH1 0x5 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP9 AND OR SWAP1 SSTORE JUMPDEST PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 DUP2 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND PUSH1 0x1 OR SWAP1 SSTORE MLOAD ADDRESS SWAP1 DUP7 SWAP1 DUP7 SWAP1 DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 GAS DELEGATECALL SWAP2 POP POP ISZERO ISZERO PUSH2 0x10DA JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x10 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4641494C45445F455845435554494F4E00000000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND CALLER EQ PUSH2 0x1120 JUMPI PUSH1 0x5 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND SWAP1 SSTORE JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x5 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH1 0x5 SLOAD PUSH1 0x0 SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 DUP2 ISZERO PUSH2 0x1174 JUMPI DUP2 PUSH2 0x1176 JUMP JUMPDEST CALLER JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP3 MLOAD GT ISZERO ISZERO PUSH2 0x1216 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x21 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F5448414E5F5A45524F5F4C454E4754485F52455155495245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x4400000000000000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST DUP2 MLOAD DUP3 SWAP1 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 ADD SWAP1 DUP2 LT PUSH2 0x1246 JUMPI INVALID JUMPDEST ADD PUSH1 0x20 ADD MLOAD DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP3 MSTORE POP PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DUP2 SWAP1 DIV MUL SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1339 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x24 DUP2 ADD DUP6 DUP2 MSTORE PUSH1 0x44 DUP3 ADD SWAP3 DUP4 MSTORE DUP4 MLOAD PUSH1 0x64 DUP4 ADD MSTORE DUP4 MLOAD PUSH1 0x0 SWAP4 PUSH1 0x60 SWAP4 PUSH32 0x1626BA7E00000000000000000000000000000000000000000000000000000000 SWAP4 DUP10 SWAP4 DUP9 SWAP4 SWAP2 SWAP3 PUSH1 0x84 ADD SWAP1 PUSH1 0x20 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP13 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x13B1 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1399 JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x13DE JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP9 AND SWAP8 SWAP1 SWAP8 OR DUP8 MSTORE DUP2 MLOAD SWAP2 SWAP8 POP SWAP5 POP DUP6 SWAP4 POP SWAP2 POP DUP3 SWAP1 POP DUP9 GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x1482 JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x14F3 JUMPI PUSH2 0x14F8 JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xC57414C4C45545F4552524F5200000000000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD SWAP5 POP JUMPDEST POP POP POP POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x14 DUP3 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x159E JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST PUSH2 0x15AC DUP3 PUSH1 0x14 DUP5 MLOAD SUB PUSH2 0x1A39 JUMP JUMPDEST DUP3 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC ADD SWAP1 SWAP3 MSTORE POP SWAP1 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x24 DUP2 ADD DUP5 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x44 DUP4 ADD MSTORE PUSH1 0x60 PUSH1 0x64 DUP4 ADD DUP2 DUP2 MSTORE DUP5 MLOAD PUSH1 0x84 DUP6 ADD MSTORE DUP5 MLOAD PUSH1 0x0 SWAP5 SWAP3 SWAP4 PUSH32 0x9363470200000000000000000000000000000000000000000000000000000000 SWAP4 DUP10 SWAP4 DUP10 SWAP4 DUP10 SWAP4 SWAP3 PUSH1 0xA4 ADD SWAP1 PUSH1 0x20 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP14 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x1663 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x164B JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x1690 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP10 AND SWAP9 SWAP1 SWAP9 OR DUP9 MSTORE DUP2 MLOAD SWAP2 SWAP9 POP SWAP6 POP DUP7 SWAP5 POP SWAP3 POP DUP4 SWAP2 POP DUP12 SWAP1 POP GAS STATICCALL DUP1 DUP1 ISZERO PUSH2 0x1736 JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x17A7 JUMPI PUSH2 0x17AC JUMP JUMPDEST PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 PUSH1 0x0 MSTORE PUSH29 0x2000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 MSTORE PUSH29 0xF56414C494441544F525F4552524F5200000000000000000000000000 PUSH1 0x40 MSTORE PUSH1 0x0 PUSH1 0x60 MSTORE PUSH1 0x64 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD SWAP5 POP JUMPDEST POP POP POP POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0x5A65726F45785472616E73616374696F6E280000000000000000000000000000 PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x75696E743235362073616C742C00000000000000000000000000000000000000 PUSH1 0x32 DUP4 ADD MSTORE PUSH32 0x61646472657373207369676E6572416464726573732C00000000000000000000 PUSH1 0x3F DUP4 ADD MSTORE PUSH32 0x6279746573206461746100000000000000000000000000000000000000000000 PUSH1 0x55 DUP4 ADD MSTORE PUSH32 0x2900000000000000000000000000000000000000000000000000000000000000 PUSH1 0x5F DUP4 ADD MSTORE DUP3 MLOAD DUP1 DUP4 SUB DUP5 ADD DUP2 MSTORE PUSH1 0x60 SWAP1 SWAP3 ADD SWAP3 DUP4 SWAP1 MSTORE DUP2 MLOAD PUSH1 0x0 SWAP4 DUP5 SWAP4 DUP5 SWAP4 SWAP1 SWAP3 DUP3 SWAP2 DUP5 ADD SWAP1 DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x18E1 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x18A4 JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 MLOAD SWAP2 SWAP1 SWAP4 ADD DUP2 SWAP1 SUB DUP2 KECCAK256 DUP10 MLOAD SWAP1 SWAP8 POP DUP10 SWAP6 POP SWAP1 SWAP4 POP DUP4 SWAP3 DUP6 ADD SWAP2 POP DUP1 DUP4 DUP4 JUMPDEST PUSH1 0x20 DUP4 LT PUSH2 0x1977 JUMPI DUP1 MLOAD DUP3 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x193A JUMP JUMPDEST MLOAD DUP2 MLOAD PUSH1 0x20 SWAP4 DUP5 SUB PUSH2 0x100 EXP PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD DUP1 NOT SWAP1 SWAP3 AND SWAP2 AND OR SWAP1 MSTORE PUSH1 0x40 DUP1 MLOAD SWAP3 SWAP1 SWAP5 ADD DUP3 SWAP1 SUB DUP3 KECCAK256 SWAP8 DUP3 MSTORE DUP2 ADD SWAP11 SWAP1 SWAP11 MSTORE POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP8 SWAP1 SWAP8 AND SWAP7 DUP9 ADD SWAP7 SWAP1 SWAP7 MSTORE POP POP PUSH1 0x60 DUP6 ADD MSTORE POP POP PUSH1 0x80 SWAP1 SWAP2 KECCAK256 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x1 SLOAD PUSH1 0x40 MLOAD PUSH32 0x1901000000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x2 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x22 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x42 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1AD6 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F32305F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xca 0xa7 PUSH19 0xA34BD4C3CB836C56E53A4AF55503E52942CDC0 0x2b 0xc8 DUP14 0x26 DUP9 SWAP16 0x2d PUSH21 0x345100290000000000000000000000000000000000 ",
+ "sourceMap": "725:411:68:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1572:445:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1572:445:30;;;;;;;;;;;;;;;;;;;;;;;967:45:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;967:45:31;;;;;;;;;;;;;;;;;;;;;;;2254:412:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2254:412:30;;;;;;;;;;;1166:71;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1166:71:30;;;;;;;;;;;;1046:63;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1046:63:30;;;;;;;;;3038:4848;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3038:4848:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3038:4848:30;;-1:-1:-1;3038:4848:30;;-1:-1:-1;;;;;;;3038:4848:30;817:317:68;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;817:317:68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;817:317:68;;-1:-1:-1;817:317:68;;-1:-1:-1;;;;;;;817:317:68;1426:1456:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1426:1456:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1301:33:44;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1301:33:44;;;;;;;;;;;;;;;;;;;;1064:36:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1064:36:31;;;;;;;;;;;;;;;;;;;;;;;1572:445:30;1708:27;;;1725:10;1708:27;1704:260;;1776:126;1814:4;1840:13;1875:9;;1776:126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1776:16:30;;-1:-1:-1;;;;;1776:126:30:i;:::-;1751:202;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1973:15:30;;;;:9;:15;;;;;;;;:30;;;;;;;;;;;:37;;;;2006:4;1973:37;;;1572:445::o;967:45:31:-;;;;;;;;;;;;;;;:::o;2254:412:30:-;2408:21;939:6:83;;;;938:7;917:72;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1043:6;:13;;;;1052:4;1043:13;;;2432:26:30;:24;:26::i;:::-;2468:32;;;;;;;;:17;:32;;;;;;;;:50;;;;;;;;;;;;;:61;;;;;;;;;;;;;2544:115;;;;;;;2468:32;;-1:-1:-1;2468:50:30;;:32;;2544:115;;;;;;;;;-1:-1:-1;;1165:5:83;1156:14;;;;;;-1:-1:-1;2254:412:30:o;1166:71::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1046:63::-;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;3038:4848::-;3200:12;3390:22;3631:27;3752:7;3769:9;3788;3807:17;6871:24;3268:1;3249:9;:16;:20;3228:97;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3421:23;:9;:21;:23::i;:::-;3415:30;;;;-1:-1:-1;3543:29:30;3518:55;;;;3497:123;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3675:16;3661:31;;;;;;;;;;3631:61;-1:-1:-1;4174:21:30;4157:13;:38;;;;;;;;;4153:3383;;;4211:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4153:3383;4520:21;4503:13;:38;;;;;;;;;4499:3037;;;4582:16;;:21;4557:97;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4678:5;;-1:-1:-1;4697:14:30;;4499:3037;4784:20;4767:13;:37;;;;;;;;;4763:2773;;;4845:16;;4865:2;4845:22;4820:99;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4943:9;4953:1;4943:12;;;;;;;;;;;;;;;;;;;;;4937:19;;-1:-1:-1;4974:24:30;:9;4996:1;4974:24;:21;:24;:::i;:::-;4970:28;-1:-1:-1;5016:25:30;:9;5038:2;5016:25;:21;:25;:::i;:::-;5012:29;;5067:102;5094:4;5116:1;5135;5154;5067:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;5067:102:30;;;;;5193:26;;;;;;;;;-1:-1:-1;5067:102:30;-1:-1:-1;5233:14:30;;-1:-1:-1;5233:14:30;4763:2773;5324:21;5307:13;:38;;;;;;;;;5303:2233;;;5386:16;;5406:2;5386:22;5361:99;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5484:9;5494:1;5484:12;;;;;;;;;;;;;;;;;;;;;5478:19;;-1:-1:-1;5515:24:30;:9;5537:1;5515:24;:21;:24;:::i;:::-;5511:28;-1:-1:-1;5557:25:30;:9;5579:2;5557:25;:21;:25;:::i;:::-;5553:29;;5608:225;5739:4;5645:116;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;5645:116:30;;;5635:127;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;5635:127:30;;;;;;;;;;;;-1:-1:-1;5608:225:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;263:2;;-1:-1;;5608:225:30;;;;;;;;;;;-1:-1:-1;5608:225:30;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5303:2233:30;6081:20;6064:13;:37;;;;;;;;;6060:1476;;;6127:116;6167:4;6189:13;6220:9;6127:22;:116::i;:::-;6117:126;-1:-1:-1;6257:14:30;;6060:1476;6770:23;6753:13;:40;;;;;;;;;6749:787;;;6898:26;:9;:24;:26::i;:::-;7009:32;;;;;;;;:17;:32;;;;;;;;:50;;;;;;;;;;6871:53;;-1:-1:-1;7009:50:30;;7008:51;7004:102;;;7086:5;7079:12;;;;7004:102;7129:153;7172:16;7206:4;7228:13;7259:9;7129:25;:153::i;6749:787::-;7418:23;7401:13;:40;;;;;;;;;7397:139;;;7467:15;;;;:9;:15;;;;;;;;:30;;;;;;;;;;;;;;-1:-1:-1;7511:14:30;;7397:139;7848:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3038:4848;;;;;;;;;;;;;:::o;817:317:68:-;978:12;1016:87;1046:4;1064:6;1084:9;1016:16;:87::i;:::-;1006:97;817:317;-1:-1:-1;;;;817:317:68:o;1426:1456:31:-;1640:21;;1730:23;;1640:35;:21;:35;1619:100;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1756:113;1774:94;1809:4;1827:13;1854:4;;1774:94;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1774:21:31;;-1:-1:-1;;;;;1774:94:31:i;:::-;1756:17;:113::i;:::-;1956:29;;;;:12;:29;;;;;;1730:139;;-1:-1:-1;1956:29:31;;1955:30;1934:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2112:27;;;2129:10;2112:27;2108:410;;2214:137;2252:15;2289:13;2324:9;;2214:137;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2214:16:31;;-1:-1:-1;;;;;2214:137:31:i;:::-;2189:216;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2470:21;:37;;;;;;;;;;2108:410;2559:29;;;;:12;:29;;;;;;;:36;;;;2591:4;2559:36;;;2626:32;2634:4;;2653;;;;2626:32;2653:4;;;;2626:32;;;;;;;;;;;;;;;;;;;;;;;;2605:95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2788:27;;;2805:10;2788:27;2784:92;;2831:21;:34;;;;;;2784:92;1426:1456;;;;;;;:::o;1301:33:44:-;;;;:::o;1064:36:31:-;;;;;;:::o;4841:307::-;4980:21;;4924:7;;4980:21;;4924:7;5036:36;;:74;;5088:22;5036:74;;;5075:10;5036:74;5011:99;4841:307;-1:-1:-1;;;4841:307:31:o;8313:448:80:-;8397:13;8458:1;8447;:8;:12;8426:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8568:8;;8566:1;;8568:12;;;;8566:15;;;;;;;;;;8680:8;;8676:16;;8705:17;;;-1:-1:-1;8566:15:80;;;;;;;8313:448::o;13290:490::-;13411:14;13474:5;13482:2;13474:10;13462:1;:8;:22;;13441:107;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;13727:13:80;13629:2;13727:13;13721:20;;13290:490::o;8292:1482:30:-;8507:135;;;;;;;;;;;;;;;;;;;;;;;8455:12;;8483:21;;8543:48;;8605:4;;8623:9;;8507:135;;;;;;;;;;;;8455:12;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;8507:135:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8507:135:30;;;22:32:-1;26:21;;;22:32;6:49;;8507:135:30;;;49:4:-1;25:18;;;61:17;;8507:135:30;182:15:-1;8507:135:30;;;;179:29:-1;;;;160:49;;8943:15:30;;8507:135;;-1:-1:-1;49:4;-1:-1;25:18;;-1:-1;8943:15:30;-1:-1:-1;25:18;;-1:-1;8816:13:30;8763:3;8735:380;9136:7;9156:422;;;;9596:1;9591:143;;;;9129:605;;9156:422;9246:66;9243:1;9236:77;9341:66;9337:2;9330:78;9436:66;9432:2;9425:78;9531:1;9527:2;9520:13;9560:3;9557:1;9550:14;9591:143;9712:7;9706:14;9695:25;;9129:605;-1:-1:-1;;;8292:1482:30;;;;;;:::o;8956:482:80:-;9043:14;9106:2;9094:1;:8;:14;;9073:99;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9224:29;9236:1;9250:2;9239:1;:8;:13;9224:11;:29::i;:::-;9356:8;;9352:17;;9382;;;-1:-1:-1;9215:38:80;8956:482::o;10213:1561:30:-;10465:165;;;;;;;;10501:42;;;10465:165;;;;10441:21;10465:165;;;;;;;;;;;;;;10413:12;;10441:21;;10501:51;;10566:4;;10512:13;;10611:9;;10465:165;;;;;;;;;;;10413:12;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;10465:165:30;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;10465:165:30;;;22:32:-1;26:21;;;22:32;6:49;;10465:165:30;;;49:4:-1;25:18;;;61:17;;10465:165:30;182:15:-1;10465:165:30;;;;179:29:-1;;;;160:49;;10937:15:30;;10465:165;;-1:-1:-1;49:4;-1:-1;25:18;;-1:-1;10937:15:30;-1:-1:-1;25:18;;-1:-1;10805:16:30;;-1:-1:-1;10751:3:30;10723:389;11133:7;11153:425;;;;11596:1;11591:143;;;;11126:608;;11153:425;11246:66;11243:1;11236:77;11341:66;11337:2;11330:78;11436:66;11432:2;11425:78;11531:1;11527:2;11520:13;11560:3;11557:1;11550:14;11591:143;11712:7;11706:14;11695:25;;11126:608;-1:-1:-1;;;10213:1561:30;;;;;;;:::o;3175:1222:31:-;827:146:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;6:49;;827:146:53;;;;;;;;817:157;;3339:14:31;;;;;;827:146:53;;;;817:157;;;;827:146;817:157;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;817:157:53;;;;;;;;;;;3456:15:31;;817:157:53;;-1:-1:-1;3456:15:31;;-1:-1:-1;817:157:53;;-1:-1:-1;817:157:53;;3456:15:31;;;-1:-1:-1;3456:15:31;817:157:53;3456:15:31;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;139:12;;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;246:30;;311:9;;295:26;;;340:21;;377:20;365:33;;3456:15:31;;;;;;;;;;;;3834:26;;;3960:15;;3953:29;;;;-1:-1:-1;4105:42:31;4086:62;;;;4069:15;;;4062:87;;;;-1:-1:-1;;4199:2:31;4187:15;;4180:33;-1:-1:-1;;4354:3:31;4336:22;;;;3175:1222;-1:-1:-1;3175:1222:31:o;1834:924:44:-;1985:18;;2297:2;2291:9;2329:66;2314:82;;2446:1;2434:14;;2427:40;;;;2564:2;2552:15;;2545:35;;;;2716:2;2698:21;;;1834:924::o;10268:886:80:-;10389:14;10452:5;10460:2;10452:10;10440:1;:8;:22;;10419:135;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;11056:13:80;10801:2;11056:13;11050:20;11072:42;11046:69;;10268:886::o"
+ }
+ }
+ },
+ "sources": {
+ "test/TestSignatureValidator/TestSignatureValidator.sol": {
+ "id": 68
+ },
+ "protocol/Exchange/MixinSignatureValidator.sol": {
+ "id": 30
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ },
+ "utils/ReentrancyGuard/ReentrancyGuard.sol": {
+ "id": 83
+ },
+ "protocol/Exchange/mixins/MSignatureValidator.sol": {
+ "id": 52
+ },
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": {
+ "id": 37
+ },
+ "protocol/Exchange/mixins/MTransactions.sol": {
+ "id": 53
+ },
+ "protocol/Exchange/interfaces/ITransactions.sol": {
+ "id": 38
+ },
+ "protocol/Exchange/interfaces/IWallet.sol": {
+ "id": 40
+ },
+ "protocol/Exchange/interfaces/IValidator.sol": {
+ "id": 39
+ },
+ "protocol/Exchange/MixinTransactions.sol": {
+ "id": 31
+ },
+ "protocol/Exchange/libs/LibExchangeErrors.sol": {
+ "id": 45
+ },
+ "protocol/Exchange/libs/LibEIP712.sol": {
+ "id": 44
+ }
+ },
+ "sourceCodes": {
+ "test/TestSignatureValidator/TestSignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../protocol/Exchange/MixinSignatureValidator.sol\";\nimport \"../../protocol/Exchange/MixinTransactions.sol\";\n\n\ncontract TestSignatureValidator is\n MixinSignatureValidator,\n MixinTransactions\n{\n function publicIsValidSignature(\n bytes32 hash,\n address signer,\n bytes memory signature\n )\n public\n view\n returns (bool isValid)\n {\n isValid = isValidSignature(\n hash,\n signer,\n signature\n );\n return isValid;\n }\n}\n",
+ "protocol/Exchange/MixinSignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../utils/LibBytes/LibBytes.sol\";\nimport \"../../utils/ReentrancyGuard/ReentrancyGuard.sol\";\nimport \"./mixins/MSignatureValidator.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./interfaces/IWallet.sol\";\nimport \"./interfaces/IValidator.sol\";\n\n\ncontract MixinSignatureValidator is\n ReentrancyGuard,\n MSignatureValidator,\n MTransactions\n{\n using LibBytes for bytes;\n \n // Mapping of hash => signer => signed\n mapping (bytes32 => mapping (address => bool)) public preSigned;\n\n // Mapping of signer => validator => approved\n mapping (address => mapping (address => bool)) public allowedValidators;\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n {\n if (signerAddress != msg.sender) {\n require(\n isValidSignature(\n hash,\n signerAddress,\n signature\n ),\n \"INVALID_SIGNATURE\"\n );\n }\n preSigned[hash][signerAddress] = true;\n }\n\n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external\n nonReentrant\n {\n address signerAddress = getCurrentContextAddress();\n allowedValidators[signerAddress][validatorAddress] = approval;\n emit SignatureValidatorApproval(\n signerAddress,\n validatorAddress,\n approval\n );\n }\n\n /// @dev Verifies that a hash has been signed by the given signer.\n /// @param hash Any 32 byte hash.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid)\n {\n require(\n signature.length > 0,\n \"LENGTH_GREATER_THAN_0_REQUIRED\"\n );\n\n // Pop last byte off of signature byte array.\n uint8 signatureTypeRaw = uint8(signature.popLastByte());\n\n // Ensure signature is supported\n require(\n signatureTypeRaw < uint8(SignatureType.NSignatureTypes),\n \"SIGNATURE_UNSUPPORTED\"\n );\n\n SignatureType signatureType = SignatureType(signatureTypeRaw);\n\n // Variables are not scoped in Solidity.\n uint8 v;\n bytes32 r;\n bytes32 s;\n address recovered;\n\n // Always illegal signature.\n // This is always an implicit option since a signer can create a\n // signature array with invalid type or length. We may as well make\n // it an explicit option. This aids testing and analysis. It is\n // also the initialization value for the enum type.\n if (signatureType == SignatureType.Illegal) {\n revert(\"SIGNATURE_ILLEGAL\");\n\n // Always invalid signature.\n // Like Illegal, this is always implicitly available and therefore\n // offered explicitly. It can be implicitly created by providing\n // a correctly formatted but incorrect signature.\n } else if (signatureType == SignatureType.Invalid) {\n require(\n signature.length == 0,\n \"LENGTH_0_REQUIRED\"\n );\n isValid = false;\n return isValid;\n\n // Signature using EIP712\n } else if (signatureType == SignatureType.EIP712) {\n require(\n signature.length == 65,\n \"LENGTH_65_REQUIRED\"\n );\n v = uint8(signature[0]);\n r = signature.readBytes32(1);\n s = signature.readBytes32(33);\n recovered = ecrecover(\n hash,\n v,\n r,\n s\n );\n isValid = signerAddress == recovered;\n return isValid;\n\n // Signed using web3.eth_sign\n } else if (signatureType == SignatureType.EthSign) {\n require(\n signature.length == 65,\n \"LENGTH_65_REQUIRED\"\n );\n v = uint8(signature[0]);\n r = signature.readBytes32(1);\n s = signature.readBytes32(33);\n recovered = ecrecover(\n keccak256(abi.encodePacked(\n \"\\x19Ethereum Signed Message:\\n32\",\n hash\n )),\n v,\n r,\n s\n );\n isValid = signerAddress == recovered;\n return isValid;\n\n // Signature verified by wallet contract.\n // If used with an order, the maker of the order is the wallet contract.\n } else if (signatureType == SignatureType.Wallet) {\n isValid = isValidWalletSignature(\n hash,\n signerAddress,\n signature\n );\n return isValid;\n\n // Signature verified by validator contract.\n // If used with an order, the maker of the order can still be an EOA.\n // A signature using this type should be encoded as:\n // | Offset | Length | Contents |\n // | 0x00 | x | Signature to validate |\n // | 0x00 + x | 20 | Address of validator contract |\n // | 0x14 + x | 1 | Signature type is always \"\\x06\" |\n } else if (signatureType == SignatureType.Validator) {\n // Pop last 20 bytes off of signature byte array.\n address validatorAddress = signature.popLast20Bytes();\n \n // Ensure signer has approved validator.\n if (!allowedValidators[signerAddress][validatorAddress]) {\n return false;\n }\n isValid = isValidValidatorSignature(\n validatorAddress,\n hash,\n signerAddress,\n signature\n );\n return isValid;\n\n // Signer signed hash previously using the preSign function.\n } else if (signatureType == SignatureType.PreSigned) {\n isValid = preSigned[hash][signerAddress];\n return isValid;\n }\n\n // Anything else is illegal (We do not return false because\n // the signature may actually be valid, just not in a format\n // that we currently support. In this case returning false\n // may lead the caller to incorrectly believe that the\n // signature was invalid.)\n revert(\"SIGNATURE_UNSUPPORTED\");\n }\n\n /// @dev Verifies signature using logic defined by Wallet contract.\n /// @param hash Any 32 byte hash.\n /// @param walletAddress Address that should have signed the given hash\n /// and defines its own signature verification method.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if signature is valid for given wallet..\n function isValidWalletSignature(\n bytes32 hash,\n address walletAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid)\n {\n bytes memory calldata = abi.encodeWithSelector(\n IWallet(walletAddress).isValidSignature.selector,\n hash,\n signature\n );\n assembly {\n let cdStart := add(calldata, 32)\n let success := staticcall(\n gas, // forward all gas\n walletAddress, // address of Wallet contract\n cdStart, // pointer to start of input\n mload(calldata), // length of input\n cdStart, // write output over input\n 32 // output size is 32 bytes\n )\n\n switch success\n case 0 {\n // Revert with `Error(\"WALLET_ERROR\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000000c57414c4c45545f4552524f5200000000000000000000000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n case 1 {\n // Signature is valid if call did not revert and returned true\n isValid := mload(cdStart)\n }\n }\n return isValid;\n }\n\n /// @dev Verifies signature using logic defined by Validator contract.\n /// @param validatorAddress Address of validator contract.\n /// @param hash Any 32 byte hash.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidValidatorSignature(\n address validatorAddress,\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid)\n {\n bytes memory calldata = abi.encodeWithSelector(\n IValidator(signerAddress).isValidSignature.selector,\n hash,\n signerAddress,\n signature\n );\n assembly {\n let cdStart := add(calldata, 32)\n let success := staticcall(\n gas, // forward all gas\n validatorAddress, // address of Validator contract\n cdStart, // pointer to start of input\n mload(calldata), // length of input\n cdStart, // write output over input\n 32 // output size is 32 bytes\n )\n\n switch success\n case 0 {\n // Revert with `Error(\"VALIDATOR_ERROR\")`\n mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)\n mstore(64, 0x0000000f56414c494441544f525f4552524f5200000000000000000000000000)\n mstore(96, 0)\n revert(0, 100)\n }\n case 1 {\n // Signature is valid if call did not revert and returned true\n isValid := mload(cdStart)\n }\n }\n return isValid;\n }\n}\n",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n",
+ "utils/ReentrancyGuard/ReentrancyGuard.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ReentrancyGuard {\n\n // Locked state of mutex\n bool private locked = false;\n\n /// @dev Functions with this modifer cannot be reentered. The mutex will be locked\n /// before function execution and unlocked after.\n modifier nonReentrant() {\n // Ensure mutex is unlocked\n require(\n !locked,\n \"REENTRANCY_ILLEGAL\"\n );\n\n // Lock mutex before function call\n locked = true;\n\n // Perform function call\n _;\n\n // Unlock mutex after function call\n locked = false;\n }\n}\n",
+ "protocol/Exchange/mixins/MSignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../interfaces/ISignatureValidator.sol\";\n\n\ncontract MSignatureValidator is\n ISignatureValidator\n{\n event SignatureValidatorApproval(\n address indexed signerAddress, // Address that approves or disapproves a contract to verify signatures.\n address indexed validatorAddress, // Address of signature validator contract.\n bool approved // Approval or disapproval of validator contract.\n );\n\n // Allowed signature types.\n enum SignatureType {\n Illegal, // 0x00, default value\n Invalid, // 0x01\n EIP712, // 0x02\n EthSign, // 0x03\n Wallet, // 0x04\n Validator, // 0x05\n PreSigned, // 0x06\n NSignatureTypes // 0x07, number of signature types. Always leave at end.\n }\n\n /// @dev Verifies signature using logic defined by Wallet contract.\n /// @param hash Any 32 byte hash.\n /// @param walletAddress Address that should have signed the given hash\n /// and defines its own signature verification method.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidWalletSignature(\n bytes32 hash,\n address walletAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid);\n\n /// @dev Verifies signature using logic defined by Validator contract.\n /// @param validatorAddress Address of validator contract.\n /// @param hash Any 32 byte hash.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n /// @return True if the address recovered from the provided signature matches the input signer address.\n function isValidValidatorSignature(\n address validatorAddress,\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n internal\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ISignatureValidator {\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external;\n \n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external;\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address of signer.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/mixins/MTransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\nimport \"../interfaces/ITransactions.sol\";\n\n\ncontract MTransactions is\n ITransactions\n{\n // Hash for the EIP712 ZeroEx Transaction Schema\n bytes32 constant internal EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"ZeroExTransaction(\",\n \"uint256 salt,\",\n \"address signerAddress,\",\n \"bytes data\",\n \")\"\n ));\n\n /// @dev Calculates EIP712 hash of the Transaction.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @return EIP712 hash of the Transaction.\n function hashZeroExTransaction(\n uint256 salt,\n address signerAddress,\n bytes memory data\n )\n internal\n pure\n returns (bytes32 result);\n\n /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).\n /// If calling a fill function, this address will represent the taker.\n /// If calling a cancel function, this address will represent the maker.\n /// @return Signer of 0x transaction if entry point is `executeTransaction`.\n /// `msg.sender` if entry point is any other function.\n function getCurrentContextAddress()\n internal\n view\n returns (address);\n}\n",
+ "protocol/Exchange/interfaces/ITransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\n\ncontract ITransactions {\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external;\n}\n",
+ "protocol/Exchange/interfaces/IWallet.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IWallet {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/IValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IValidator {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/MixinTransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\nimport \"./libs/LibExchangeErrors.sol\";\nimport \"./mixins/MSignatureValidator.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./libs/LibEIP712.sol\";\n\n\ncontract MixinTransactions is\n LibEIP712,\n MSignatureValidator,\n MTransactions\n{\n // Mapping of transaction hash => executed\n // This prevents transactions from being executed more than once.\n mapping (bytes32 => bool) public transactions;\n\n // Address of current transaction signer\n address public currentContextAddress;\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external\n {\n // Prevent reentrancy\n require(\n currentContextAddress == address(0),\n \"REENTRANCY_ILLEGAL\"\n );\n\n bytes32 transactionHash = hashEIP712Message(hashZeroExTransaction(\n salt,\n signerAddress,\n data\n ));\n\n // Validate transaction has not been executed\n require(\n !transactions[transactionHash],\n \"INVALID_TX_HASH\"\n );\n\n // Transaction always valid if signer is sender of transaction\n if (signerAddress != msg.sender) {\n // Validate signature\n require(\n isValidSignature(\n transactionHash,\n signerAddress,\n signature\n ),\n \"INVALID_TX_SIGNATURE\"\n );\n\n // Set the current transaction signer\n currentContextAddress = signerAddress;\n }\n\n // Execute transaction\n transactions[transactionHash] = true;\n require(\n address(this).delegatecall(data),\n \"FAILED_EXECUTION\"\n );\n\n // Reset current transaction signer if it was previously updated\n if (signerAddress != msg.sender) {\n currentContextAddress = address(0);\n }\n }\n\n /// @dev Calculates EIP712 hash of the Transaction.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @return EIP712 hash of the Transaction.\n function hashZeroExTransaction(\n uint256 salt,\n address signerAddress,\n bytes memory data\n )\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH;\n bytes32 dataHash = keccak256(data);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ZEROEX_TRANSACTION_SCHEMA_HASH,\n // salt,\n // bytes32(signerAddress),\n // keccak256(data)\n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, schemaHash) // hash of schema\n mstore(add(memPtr, 32), salt) // salt\n mstore(add(memPtr, 64), and(signerAddress, 0xffffffffffffffffffffffffffffffffffffffff)) // signerAddress\n mstore(add(memPtr, 96), dataHash) // hash of data\n\n // Compute hash\n result := keccak256(memPtr, 128)\n }\n return result;\n }\n\n /// @dev The current function will be called in the context of this address (either 0x transaction signer or `msg.sender`).\n /// If calling a fill function, this address will represent the taker.\n /// If calling a cancel function, this address will represent the maker.\n /// @return Signer of 0x transaction if entry point is `executeTransaction`.\n /// `msg.sender` if entry point is any other function.\n function getCurrentContextAddress()\n internal\n view\n returns (address)\n {\n address currentContextAddress_ = currentContextAddress;\n address contextAddress = currentContextAddress_ == address(0) ? msg.sender : currentContextAddress_;\n return contextAddress;\n }\n}\n",
+ "protocol/Exchange/libs/LibExchangeErrors.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\n// solhint-disable\npragma solidity 0.4.24;\n\n\n/// @dev This contract documents the revert reasons used in the Exchange contract.\n/// This contract is intended to serve as a reference, but is not actually used for efficiency reasons.\ncontract LibExchangeErrors {\n\n /// Order validation errors ///\n string constant ORDER_UNFILLABLE = \"ORDER_UNFILLABLE\"; // Order cannot be filled.\n string constant INVALID_MAKER = \"INVALID_MAKER\"; // Invalid makerAddress.\n string constant INVALID_TAKER = \"INVALID_TAKER\"; // Invalid takerAddress.\n string constant INVALID_SENDER = \"INVALID_SENDER\"; // Invalid `msg.sender`.\n string constant INVALID_ORDER_SIGNATURE = \"INVALID_ORDER_SIGNATURE\"; // Signature validation failed. \n \n /// fillOrder validation errors ///\n string constant INVALID_TAKER_AMOUNT = \"INVALID_TAKER_AMOUNT\"; // takerAssetFillAmount cannot equal 0.\n string constant ROUNDING_ERROR = \"ROUNDING_ERROR\"; // Rounding error greater than 0.1% of takerAssetFillAmount. \n \n /// Signature validation errors ///\n string constant INVALID_SIGNATURE = \"INVALID_SIGNATURE\"; // Signature validation failed. \n string constant SIGNATURE_ILLEGAL = \"SIGNATURE_ILLEGAL\"; // Signature type is illegal.\n string constant SIGNATURE_UNSUPPORTED = \"SIGNATURE_UNSUPPORTED\"; // Signature type unsupported.\n \n /// cancelOrdersUptTo errors ///\n string constant INVALID_NEW_ORDER_EPOCH = \"INVALID_NEW_ORDER_EPOCH\"; // Specified salt must be greater than or equal to existing orderEpoch.\n\n /// fillOrKillOrder errors ///\n string constant COMPLETE_FILL_FAILED = \"COMPLETE_FILL_FAILED\"; // Desired takerAssetFillAmount could not be completely filled. \n\n /// matchOrders errors ///\n string constant NEGATIVE_SPREAD_REQUIRED = \"NEGATIVE_SPREAD_REQUIRED\"; // Matched orders must have a negative spread.\n\n /// Transaction errors ///\n string constant REENTRANCY_ILLEGAL = \"REENTRANCY_ILLEGAL\"; // Recursive reentrancy is not allowed. \n string constant INVALID_TX_HASH = \"INVALID_TX_HASH\"; // Transaction has already been executed. \n string constant INVALID_TX_SIGNATURE = \"INVALID_TX_SIGNATURE\"; // Signature validation failed. \n string constant FAILED_EXECUTION = \"FAILED_EXECUTION\"; // Transaction execution failed. \n \n /// registerAssetProxy errors ///\n string constant ASSET_PROXY_ALREADY_EXISTS = \"ASSET_PROXY_ALREADY_EXISTS\"; // AssetProxy with same id already exists.\n\n /// dispatchTransferFrom errors ///\n string constant ASSET_PROXY_DOES_NOT_EXIST = \"ASSET_PROXY_DOES_NOT_EXIST\"; // No assetProxy registered at given id.\n string constant TRANSFER_FAILED = \"TRANSFER_FAILED\"; // Asset transfer unsuccesful.\n\n /// Length validation errors ///\n string constant LENGTH_GREATER_THAN_0_REQUIRED = \"LENGTH_GREATER_THAN_0_REQUIRED\"; // Byte array must have a length greater than 0.\n string constant LENGTH_GREATER_THAN_3_REQUIRED = \"LENGTH_GREATER_THAN_3_REQUIRED\"; // Byte array must have a length greater than 3.\n string constant LENGTH_0_REQUIRED = \"LENGTH_0_REQUIRED\"; // Byte array must have a length of 0.\n string constant LENGTH_65_REQUIRED = \"LENGTH_65_REQUIRED\"; // Byte array must have a length of 65.\n}\n",
+ "protocol/Exchange/libs/LibEIP712.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract LibEIP712 {\n\n // EIP191 header for EIP712 prefix\n string constant internal EIP191_HEADER = \"\\x19\\x01\";\n\n // EIP712 Domain Name value\n string constant internal EIP712_DOMAIN_NAME = \"0x Protocol\";\n\n // EIP712 Domain Version value\n string constant internal EIP712_DOMAIN_VERSION = \"2\";\n\n // Hash of the EIP712 Domain Separator Schema\n bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"address verifyingContract\",\n \")\"\n ));\n\n // Hash of the EIP712 Domain Separator data\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public EIP712_DOMAIN_HASH;\n\n constructor ()\n public\n {\n EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(\n EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,\n keccak256(bytes(EIP712_DOMAIN_NAME)),\n keccak256(bytes(EIP712_DOMAIN_VERSION)),\n bytes32(address(this))\n ));\n }\n\n /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.\n /// @param hashStruct The EIP712 hash struct.\n /// @return EIP712 hash applied to this EIP712 Domain.\n function hashEIP712Message(bytes32 hashStruct)\n internal\n view\n returns (bytes32 result)\n {\n bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;\n\n // Assembly for more efficient computing:\n // keccak256(abi.encodePacked(\n // EIP191_HEADER,\n // EIP712_DOMAIN_HASH,\n // hashStruct \n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header\n mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash\n mstore(add(memPtr, 34), hashStruct) // Hash of struct\n\n // Compute hash\n result := keccak256(memPtr, 66)\n }\n return result;\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0xa7c9a0f284feca474842a5925941b1fd347e8edd40958d21efe3ebc8eff25447",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/TestStaticCallReceiver.json b/packages/contracts/generated-artifacts/TestStaticCallReceiver.json
new file mode 100644
index 000000000..6d89e7bf0
--- /dev/null
+++ b/packages/contracts/generated-artifacts/TestStaticCallReceiver.json
@@ -0,0 +1,129 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "TestStaticCallReceiver",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "token",
+ "type": "address"
+ },
+ {
+ "name": "spender",
+ "type": "address"
+ },
+ {
+ "name": "value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approveERC20",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600160005534801561001557600080fd5b5061023e806100256000396000f3006080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631626ba7e811461005b5780639363470214610093578063a8e5e4aa146100d1575b600080fd5b34801561006757600080fd5b5061007f60048035906024803590810191013561010a565b604080519115158252519081900360200190f35b34801561009f57600080fd5b5061007f60048035906024803573ffffffffffffffffffffffffffffffffffffffff169160443591820191013561011e565b3480156100dd57600080fd5b5061010873ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610133565b005b6000610114610207565b5060019392505050565b6000610128610207565b506001949350505050565b8273ffffffffffffffffffffffffffffffffffffffff1663095ea7b383836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156101d657600080fd5b505af11580156101ea573d6000803e3d6000fd5b505050506040513d602081101561020057600080fd5b5050505050565b6000805460010190555600a165627a7a72305820a77e99a4c4b6cc720049a5a6d04a124680567ce3437d66c81a6ba2bae68c41880029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x1 PUSH1 0x0 SSTORE CALLVALUE DUP1 ISZERO PUSH2 0x15 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x23E DUP1 PUSH2 0x25 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x1626BA7E DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0x93 JUMPI DUP1 PUSH4 0xA8E5E4AA EQ PUSH2 0xD1 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x7F PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x10A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x9F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x7F PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x11E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xDD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x108 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x133 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 PUSH2 0x114 PUSH2 0x207 JUMP JUMPDEST POP PUSH1 0x1 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x128 PUSH2 0x207 JUMP JUMPDEST POP PUSH1 0x1 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x95EA7B3 DUP4 DUP4 PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1EA JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x200 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xa7 PUSH31 0x99A4C4B6CC720049A5A6D04A124680567CE3437D66C81A6BA2BAE68C418800 0x29 ",
+ "sourceMap": "691:1558:69:-;;;755:1;730:26;;691:1558;8:9:-1;5:2;;;30:1;27;20:12;5:2;691:1558:69;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631626ba7e811461005b5780639363470214610093578063a8e5e4aa146100d1575b600080fd5b34801561006757600080fd5b5061007f60048035906024803590810191013561010a565b604080519115158252519081900360200190f35b34801561009f57600080fd5b5061007f60048035906024803573ffffffffffffffffffffffffffffffffffffffff169160443591820191013561011e565b3480156100dd57600080fd5b5061010873ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610133565b005b6000610114610207565b5060019392505050565b6000610128610207565b506001949350505050565b8273ffffffffffffffffffffffffffffffffffffffff1663095ea7b383836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156101d657600080fd5b505af11580156101ea573d6000803e3d6000fd5b505050506040513d602081101561020057600080fd5b5050505050565b6000805460010190555600a165627a7a72305820a77e99a4c4b6cc720049a5a6d04a124680567ce3437d66c81a6ba2bae68c41880029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x56 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x1626BA7E DUP2 EQ PUSH2 0x5B JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0x93 JUMPI DUP1 PUSH4 0xA8E5E4AA EQ PUSH2 0xD1 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x67 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x7F PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x10A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x9F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x7F PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x11E JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xDD JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x108 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x133 JUMP JUMPDEST STOP JUMPDEST PUSH1 0x0 PUSH2 0x114 PUSH2 0x207 JUMP JUMPDEST POP PUSH1 0x1 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x128 PUSH2 0x207 JUMP JUMPDEST POP PUSH1 0x1 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x95EA7B3 DUP4 DUP4 PUSH1 0x40 MLOAD DUP4 PUSH4 0xFFFFFFFF AND PUSH29 0x100000000000000000000000000000000000000000000000000000000 MUL DUP2 MSTORE PUSH1 0x4 ADD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1D6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x1EA JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x20 DUP2 LT ISZERO PUSH2 0x200 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 ADD SWAP1 SSTORE JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xa7 PUSH31 0x99A4C4B6CC720049A5A6D04A124680567CE3437D66C81A6BA2BAE68C418800 0x29 ",
+ "sourceMap": "691:1558:69:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1526:182;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1526:182:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1075:213;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1075:213:69;;;;;;;;;;;;;;;;;;;;;1954:179;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1954:179:69;;;;;;;;;;;;;;;;1526:182;1639:12;1667:13;:11;:13::i;:::-;-1:-1:-1;1697:4:69;1526:182;;;;;:::o;1075:213::-;1219:12;1247:13;:11;:13::i;:::-;-1:-1:-1;1277:4:69;1075:213;;;;;;:::o;1954:179::-;2096:5;2084:26;;;2111:7;2120:5;2084:42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2084:42:69;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2084:42:69;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;1954:179:69:o;2179:68::-;2233:5;:7;;;;;;2179:68::o"
+ }
+ }
+ },
+ "sources": {
+ "test/TestStaticCallReceiver/TestStaticCallReceiver.sol": {
+ "id": 69
+ },
+ "tokens/ERC20Token/IERC20Token.sol": {
+ "id": 71
+ }
+ },
+ "sourceCodes": {
+ "test/TestStaticCallReceiver/TestStaticCallReceiver.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../tokens/ERC20Token/IERC20Token.sol\";\n\n\n// solhint-disable no-unused-vars\ncontract TestStaticCallReceiver {\n\n uint256 internal state = 1;\n\n /// @dev Updates state and returns true. Intended to be used with `Validator` signature type.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n returns (bool isValid)\n {\n updateState();\n return true;\n }\n\n /// @dev Updates state and returns true. Intended to be used with `Wallet` signature type.\n /// @param hash Message hash that is signed.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n bytes signature\n )\n external\n returns (bool isValid)\n {\n updateState();\n return true;\n }\n\n /// @dev Approves an ERC20 token to spend tokens from this address.\n /// @param token Address of ERC20 token.\n /// @param spender Address that will spend tokens.\n /// @param value Amount of tokens spender is approved to spend.\n function approveERC20(\n address token,\n address spender,\n uint256 value\n )\n external\n {\n IERC20Token(token).approve(spender, value);\n }\n\n /// @dev Increments state variable.\n function updateState()\n internal\n {\n state++;\n }\n}\n",
+ "tokens/ERC20Token/IERC20Token.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IERC20Token {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed _from,\n address indexed _to,\n uint256 _value\n );\n\n event Approval(\n address indexed _owner,\n address indexed _spender,\n uint256 _value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address _to, uint256 _value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address _from,\n address _to,\n uint256 _value\n )\n external\n returns (bool);\n \n /// @dev `msg.sender` approves `_spender` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address _spender, uint256 _value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n \n /// @param _owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address _owner)\n external\n view\n returns (uint256);\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender)\n external\n view\n returns (uint256);\n}\n"
+ },
+ "sourceTreeHashHex": "0x1e929310f534ee574efade2723ead09e51a6bc306a0c05a61661a36d0ad0b361",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/Validator.json b/packages/contracts/generated-artifacts/Validator.json
new file mode 100644
index 000000000..04ea79132
--- /dev/null
+++ b/packages/contracts/generated-artifacts/Validator.json
@@ -0,0 +1,95 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "Validator",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "validSigner",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b50604051602080610134833981016040525160008054600160a060020a03909216600160a060020a031990921691909117905560e3806100516000396000f300608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416639363470281146043575b600080fd5b348015604e57600080fd5b50607e60048035906024803573ffffffffffffffffffffffffffffffffffffffff16916044359182019101356092565b604080519115158252519081900360200190f35b505060005473ffffffffffffffffffffffffffffffffffffffff9081169116149190505600a165627a7a72305820ccd061468ee729d0c5da456395b6335c9d3dccbc32a7a35437fac2ec5f5e64a60029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP1 PUSH2 0x134 DUP4 CODECOPY DUP2 ADD PUSH1 0x40 MSTORE MLOAD PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH1 0xE3 DUP1 PUSH2 0x51 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x3E JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x93634702 DUP2 EQ PUSH1 0x43 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x4E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x7E PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH1 0x92 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST POP POP PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 DUP2 AND SWAP2 AND EQ SWAP2 SWAP1 POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xcc 0xd0 PUSH2 0x468E 0xe7 0x29 0xd0 0xc5 0xda GASLIMIT PUSH4 0x95B6335C SWAP14 RETURNDATASIZE 0xcc 0xbc ORIGIN 0xa7 LOG3 SLOAD CALLDATACOPY STATICCALL 0xc2 0xec 0x5f 0x5e PUSH5 0xA600290000 ",
+ "sourceMap": "667:992:1:-;;;969:84;8:9:-1;5:2;;;30:1;27;20:12;5:2;969:84:1;;;;;;;;;;;;;1020:12;:26;;-1:-1:-1;;;;;1020:26:1;;;-1:-1:-1;;;;;;1020:26:1;;;;;;;;;667:992;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x608060405260043610603e5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416639363470281146043575b600080fd5b348015604e57600080fd5b50607e60048035906024803573ffffffffffffffffffffffffffffffffffffffff16916044359182019101356092565b604080519115158252519081900360200190f35b505060005473ffffffffffffffffffffffffffffffffffffffff9081169116149190505600a165627a7a72305820ccd061468ee729d0c5da456395b6335c9d3dccbc32a7a35437fac2ec5f5e64a60029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x3E JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x93634702 DUP2 EQ PUSH1 0x43 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH1 0x4E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x7E PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP2 PUSH1 0x44 CALLDATALOAD SWAP2 DUP3 ADD SWAP2 ADD CALLDATALOAD PUSH1 0x92 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST POP POP PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 DUP2 AND SWAP2 AND EQ SWAP2 SWAP1 POP JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0xcc 0xd0 PUSH2 0x468E 0xe7 0x29 0xd0 0xc5 0xda GASLIMIT PUSH4 0x95B6335C SWAP14 RETURNDATASIZE 0xcc 0xbc ORIGIN 0xa7 LOG3 SLOAD CALLDATACOPY STATICCALL 0xc2 0xec 0x5f 0x5e PUSH5 0xA600290000 ",
+ "sourceMap": "667:992:1:-;;;;;;;;;;;;;;;;;;;;;;;1390:230;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1390:230:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1547:12:1;1600;;;;;1583:29;;;;1390:230;-1:-1:-1;1390:230:1:o"
+ }
+ }
+ },
+ "sources": {
+ "examples/Validator/Validator.sol": {
+ "id": 1
+ },
+ "protocol/Exchange/interfaces/IValidator.sol": {
+ "id": 39
+ }
+ },
+ "sourceCodes": {
+ "examples/Validator/Validator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../protocol/Exchange/interfaces/IValidator.sol\";\n\n\ncontract Validator is \n IValidator\n{\n\n // The single valid signer for this wallet.\n // solhint-disable-next-line var-name-mixedcase\n address internal VALID_SIGNER;\n\n /// @dev constructs a new `Validator` with a single valid signer.\n /// @param validSigner The sole, valid signer.\n constructor (address validSigner) public {\n VALID_SIGNER = validSigner;\n }\n\n /// @dev Verifies that a signature is valid. `signer` must match `VALID_SIGNER`.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of signature.\n // solhint-disable no-unused-vars\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n view\n returns (bool isValid)\n {\n return (signerAddress == VALID_SIGNER);\n }\n // solhint-enable no-unused-vars\n}\n",
+ "protocol/Exchange/interfaces/IValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IValidator {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n"
+ },
+ "sourceTreeHashHex": "0x0c2638dd4422383a85743676a5dee23af676beaaf84b534c400a24be6594572e",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/WETH9.json b/packages/contracts/generated-artifacts/WETH9.json
new file mode 100644
index 000000000..026e4915a
--- /dev/null
+++ b/packages/contracts/generated-artifacts/WETH9.json
@@ -0,0 +1,330 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "WETH9",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "guy",
+ "type": "address"
+ },
+ {
+ "name": "wad",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "src",
+ "type": "address"
+ },
+ {
+ "name": "dst",
+ "type": "address"
+ },
+ {
+ "name": "wad",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "wad",
+ "type": "uint256"
+ }
+ ],
+ "name": "withdraw",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint8"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "dst",
+ "type": "address"
+ },
+ {
+ "name": "wad",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [],
+ "name": "deposit",
+ "outputs": [],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ },
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "fallback"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Deposit",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Withdrawal",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60c0604052600d60808190527f577261707065642045746865720000000000000000000000000000000000000060a090815261003e91600091906100a3565b506040805180820190915260048082527f57455448000000000000000000000000000000000000000000000000000000006020909201918252610083916001916100a3565b506002805460ff1916601217905534801561009d57600080fd5b5061013e565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100e457805160ff1916838001178555610111565b82800160010185558215610111579182015b828111156101115782518255916020019190600101906100f6565b5061011d929150610121565b5090565b61013b91905b8082111561011d5760008155600101610127565b90565b6107688061014d6000396000f3006080604052600436106100ae5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100b8578063095ea7b31461014257806318160ddd1461018757806323b872dd146101ae5780632e1a7d4d146101e5578063313ce567146101fd57806370a082311461022857806395d89b4114610256578063a9059cbb1461026b578063d0e30db0146100ae578063dd62ed3e1461029c575b6100b66102d0565b005b3480156100c457600080fd5b506100cd61031f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101075781810151838201526020016100ef565b50505050905090810190601f1680156101345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014e57600080fd5b5061017373ffffffffffffffffffffffffffffffffffffffff600435166024356103cb565b604080519115158252519081900360200190f35b34801561019357600080fd5b5061019c61043e565b60408051918252519081900360200190f35b3480156101ba57600080fd5b5061017373ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610443565b3480156101f157600080fd5b506100b66004356105e3565b34801561020957600080fd5b50610212610678565b6040805160ff9092168252519081900360200190f35b34801561023457600080fd5b5061019c73ffffffffffffffffffffffffffffffffffffffff60043516610681565b34801561026257600080fd5b506100cd610693565b34801561027757600080fd5b5061017373ffffffffffffffffffffffffffffffffffffffff6004351660243561070b565b3480156102a857600080fd5b5061019c73ffffffffffffffffffffffffffffffffffffffff6004358116906024351661071f565b33600081815260036020908152604091829020805434908101909155825190815291517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9281900390910190a2565b6000805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156103c35780601f10610398576101008083540402835291602001916103c3565b820191906000526020600020905b8154815290600101906020018083116103a657829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b303190565b73ffffffffffffffffffffffffffffffffffffffff831660009081526003602052604081205482111561047557600080fd5b73ffffffffffffffffffffffffffffffffffffffff841633148015906104eb575073ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14155b156105655773ffffffffffffffffffffffffffffffffffffffff8416600090815260046020908152604080832033845290915290205482111561052d57600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020805483900390555b73ffffffffffffffffffffffffffffffffffffffff808516600081815260036020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b336000908152600360205260409020548111156105ff57600080fd5b33600081815260036020526040808220805485900390555183156108fc0291849190818181858888f1935050505015801561063e573d6000803e3d6000fd5b5060408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a250565b60025460ff1681565b60036020526000908152604090205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156103c35780601f10610398576101008083540402835291602001916103c3565b6000610718338484610443565b9392505050565b6004602090815260009283526040808420909152908252902054815600a165627a7a72305820211181bc9ae9d9b272db8254602d72bb9ba1747ca2555792826a3a4e4fc11a6e0029",
+ "opcodes": "PUSH1 0xC0 PUSH1 0x40 MSTORE PUSH1 0xD PUSH1 0x80 DUP2 SWAP1 MSTORE PUSH32 0x5772617070656420457468657200000000000000000000000000000000000000 PUSH1 0xA0 SWAP1 DUP2 MSTORE PUSH2 0x3E SWAP2 PUSH1 0x0 SWAP2 SWAP1 PUSH2 0xA3 JUMP JUMPDEST POP PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x4 DUP1 DUP3 MSTORE PUSH32 0x5745544800000000000000000000000000000000000000000000000000000000 PUSH1 0x20 SWAP1 SWAP3 ADD SWAP2 DUP3 MSTORE PUSH2 0x83 SWAP2 PUSH1 0x1 SWAP2 PUSH2 0xA3 JUMP JUMPDEST POP PUSH1 0x2 DUP1 SLOAD PUSH1 0xFF NOT AND PUSH1 0x12 OR SWAP1 SSTORE CALLVALUE DUP1 ISZERO PUSH2 0x9D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x13E JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0xE4 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x111 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x111 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x111 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0xF6 JUMP JUMPDEST POP PUSH2 0x11D SWAP3 SWAP2 POP PUSH2 0x121 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x13B SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x11D JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x127 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x768 DUP1 PUSH2 0x14D PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xAE JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xB8 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x142 JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x187 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1AE JUMPI DUP1 PUSH4 0x2E1A7D4D EQ PUSH2 0x1E5 JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x1FD JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x228 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x256 JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x26B JUMPI DUP1 PUSH4 0xD0E30DB0 EQ PUSH2 0xAE JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x29C JUMPI JUMPDEST PUSH2 0xB6 PUSH2 0x2D0 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xC4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xCD PUSH2 0x31F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x107 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xEF JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x134 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x14E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x173 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x3CB JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x193 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19C PUSH2 0x43E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1BA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x173 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x443 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1F1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB6 PUSH1 0x4 CALLDATALOAD PUSH2 0x5E3 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x209 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x212 PUSH2 0x678 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0xFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x234 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19C PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x681 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x262 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xCD PUSH2 0x693 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x277 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x173 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x70B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19C PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x71F JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD CALLVALUE SWAP1 DUP2 ADD SWAP1 SWAP2 SSTORE DUP3 MLOAD SWAP1 DUP2 MSTORE SWAP2 MLOAD PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x3C3 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x398 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x3C3 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x3A6 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE DUP2 DUP5 KECCAK256 DUP7 SWAP1 SSTORE DUP2 MLOAD DUP7 DUP2 MSTORE SWAP2 MLOAD SWAP4 SWAP5 SWAP1 SWAP4 SWAP1 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST ADDRESS BALANCE SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x475 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND CALLER EQ DUP1 ISZERO SWAP1 PUSH2 0x4EB JUMPI POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF EQ ISZERO JUMPDEST ISZERO PUSH2 0x565 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x52D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 DUP1 SLOAD DUP4 SWAP1 SUB SWAP1 SSTORE JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP9 SWAP1 SUB SWAP1 SSTORE SWAP4 DUP8 AND DUP1 DUP4 MSTORE SWAP2 DUP5 SWAP1 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP4 MLOAD DUP7 DUP2 MSTORE SWAP4 MLOAD SWAP2 SWAP4 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP1 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 GT ISZERO PUSH2 0x5FF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD DUP6 SWAP1 SUB SWAP1 SSTORE MLOAD DUP4 ISZERO PUSH2 0x8FC MUL SWAP2 DUP5 SWAP2 SWAP1 DUP2 DUP2 DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x63E JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD CALLER SWAP2 PUSH32 0x7FCF532C15F0A6DB0BD6D0E038BEA71D30D808C7D98CB3BF7268A95BF5081B65 SWAP2 SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x2 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 DUP5 DUP7 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x3C3 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x398 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x3C3 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x718 CALLER DUP5 DUP5 PUSH2 0x443 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD DUP2 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0x21 GT DUP2 0xbc SWAP11 0xe9 0xd9 0xb2 PUSH19 0xDB8254602D72BB9BA1747CA2555792826A3A4E 0x4f 0xc1 BYTE PUSH15 0x2900000000000000000000000000 ",
+ "sourceMap": "753:40:79:-;732:1806;753:40;;732:1806;753:40;;;;;;;;;;-1:-1:-1;;753:40:79;;:::i;:::-;-1:-1:-1;799:31:79;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;836:27:79;;;-1:-1:-1;;836:27:79;861:2;836:27;;;732:1806;5:2:-1;;;;30:1;27;20:12;5:2;732:1806:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;732:1806:79;;;-1:-1:-1;732:1806:79;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100ae5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100b8578063095ea7b31461014257806318160ddd1461018757806323b872dd146101ae5780632e1a7d4d146101e5578063313ce567146101fd57806370a082311461022857806395d89b4114610256578063a9059cbb1461026b578063d0e30db0146100ae578063dd62ed3e1461029c575b6100b66102d0565b005b3480156100c457600080fd5b506100cd61031f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101075781810151838201526020016100ef565b50505050905090810190601f1680156101345780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014e57600080fd5b5061017373ffffffffffffffffffffffffffffffffffffffff600435166024356103cb565b604080519115158252519081900360200190f35b34801561019357600080fd5b5061019c61043e565b60408051918252519081900360200190f35b3480156101ba57600080fd5b5061017373ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610443565b3480156101f157600080fd5b506100b66004356105e3565b34801561020957600080fd5b50610212610678565b6040805160ff9092168252519081900360200190f35b34801561023457600080fd5b5061019c73ffffffffffffffffffffffffffffffffffffffff60043516610681565b34801561026257600080fd5b506100cd610693565b34801561027757600080fd5b5061017373ffffffffffffffffffffffffffffffffffffffff6004351660243561070b565b3480156102a857600080fd5b5061019c73ffffffffffffffffffffffffffffffffffffffff6004358116906024351661071f565b33600081815260036020908152604091829020805434908101909155825190815291517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9281900390910190a2565b6000805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156103c35780601f10610398576101008083540402835291602001916103c3565b820191906000526020600020905b8154815290600101906020018083116103a657829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b303190565b73ffffffffffffffffffffffffffffffffffffffff831660009081526003602052604081205482111561047557600080fd5b73ffffffffffffffffffffffffffffffffffffffff841633148015906104eb575073ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14155b156105655773ffffffffffffffffffffffffffffffffffffffff8416600090815260046020908152604080832033845290915290205482111561052d57600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020805483900390555b73ffffffffffffffffffffffffffffffffffffffff808516600081815260036020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b336000908152600360205260409020548111156105ff57600080fd5b33600081815260036020526040808220805485900390555183156108fc0291849190818181858888f1935050505015801561063e573d6000803e3d6000fd5b5060408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a250565b60025460ff1681565b60036020526000908152604090205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156103c35780601f10610398576101008083540402835291602001916103c3565b6000610718338484610443565b9392505050565b6004602090815260009283526040808420909152908252902054815600a165627a7a72305820211181bc9ae9d9b272db8254602d72bb9ba1747ca2555792826a3a4e4fc11a6e0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0xAE JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0xB8 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x142 JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x187 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1AE JUMPI DUP1 PUSH4 0x2E1A7D4D EQ PUSH2 0x1E5 JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x1FD JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x228 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x256 JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x26B JUMPI DUP1 PUSH4 0xD0E30DB0 EQ PUSH2 0xAE JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x29C JUMPI JUMPDEST PUSH2 0xB6 PUSH2 0x2D0 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xC4 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xCD PUSH2 0x31F JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x107 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xEF JUMP JUMPDEST POP POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x134 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x14E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x173 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x3CB JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x193 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19C PUSH2 0x43E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1BA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x173 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x443 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x1F1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xB6 PUSH1 0x4 CALLDATALOAD PUSH2 0x5E3 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x209 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x212 PUSH2 0x678 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0xFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x234 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19C PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x681 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x262 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xCD PUSH2 0x693 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x277 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x173 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x70B JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x2A8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x19C PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x71F JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP2 DUP3 SWAP1 KECCAK256 DUP1 SLOAD CALLVALUE SWAP1 DUP2 ADD SWAP1 SWAP2 SSTORE DUP3 MLOAD SWAP1 DUP2 MSTORE SWAP2 MLOAD PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C SWAP3 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG2 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 PUSH1 0x1 DUP6 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x3C3 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x398 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x3C3 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0x3A6 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP DUP2 JUMP JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP8 AND DUP1 DUP6 MSTORE SWAP1 DUP4 MSTORE DUP2 DUP5 KECCAK256 DUP7 SWAP1 SSTORE DUP2 MLOAD DUP7 DUP2 MSTORE SWAP2 MLOAD SWAP4 SWAP5 SWAP1 SWAP4 SWAP1 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 DUP3 SWAP1 SUB ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP3 SWAP2 POP POP JUMP JUMPDEST ADDRESS BALANCE SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP2 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x475 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND CALLER EQ DUP1 ISZERO SWAP1 PUSH2 0x4EB JUMPI POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF EQ ISZERO JUMPDEST ISZERO PUSH2 0x565 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 SLOAD DUP3 GT ISZERO PUSH2 0x52D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 CALLER DUP5 MSTORE SWAP1 SWAP2 MSTORE SWAP1 KECCAK256 DUP1 SLOAD DUP4 SWAP1 SUB SWAP1 SSTORE JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 KECCAK256 DUP1 SLOAD DUP9 SWAP1 SUB SWAP1 SSTORE SWAP4 DUP8 AND DUP1 DUP4 MSTORE SWAP2 DUP5 SWAP1 KECCAK256 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP4 MLOAD DUP7 DUP2 MSTORE SWAP4 MLOAD SWAP2 SWAP4 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP1 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 SWAP4 SWAP3 POP POP POP JUMP JUMPDEST CALLER PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 GT ISZERO PUSH2 0x5FF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST CALLER PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x40 DUP1 DUP3 KECCAK256 DUP1 SLOAD DUP6 SWAP1 SUB SWAP1 SSTORE MLOAD DUP4 ISZERO PUSH2 0x8FC MUL SWAP2 DUP5 SWAP2 SWAP1 DUP2 DUP2 DUP2 DUP6 DUP9 DUP9 CALL SWAP4 POP POP POP POP ISZERO DUP1 ISZERO PUSH2 0x63E JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP PUSH1 0x40 DUP1 MLOAD DUP3 DUP2 MSTORE SWAP1 MLOAD CALLER SWAP2 PUSH32 0x7FCF532C15F0A6DB0BD6D0E038BEA71D30D808C7D98CB3BF7268A95BF5081B65 SWAP2 SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 LOG2 POP JUMP JUMPDEST PUSH1 0x2 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x3 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x1 DUP1 SLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 PUSH1 0x2 DUP5 DUP7 AND ISZERO PUSH2 0x100 MUL PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ADD SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 DIV PUSH1 0x1F DUP2 ADD DUP5 SWAP1 DIV DUP5 MUL DUP3 ADD DUP5 ADD SWAP1 SWAP3 MSTORE DUP2 DUP2 MSTORE SWAP3 SWAP2 DUP4 ADD DUP3 DUP3 DUP1 ISZERO PUSH2 0x3C3 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0x398 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0x3C3 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x718 CALLER DUP5 DUP5 PUSH2 0x443 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x4 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x0 SWAP3 DUP4 MSTORE PUSH1 0x40 DUP1 DUP5 KECCAK256 SWAP1 SWAP2 MSTORE SWAP1 DUP3 MSTORE SWAP1 KECCAK256 SLOAD DUP2 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 0x21 GT DUP2 0xbc SWAP11 0xe9 0xd9 0xb2 PUSH19 0xDB8254602D72BB9BA1747CA2555792826A3A4E 0x4f 0xc1 BYTE PUSH15 0x2900000000000000000000000000 ",
+ "sourceMap": "732:1806:79:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1329:9;:7;:9::i;:::-;732:1806;753:40;;8:9:-1;5:2;;;30:1;27;20:12;5:2;753:40:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;753:40:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1776:172;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1776:172:79;;;;;;;;;;;;;;;;;;;;;;;;;;;1684:86;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1684:86:79;;;;;;;;;;;;;;;;;;;;2081:455;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2081:455:79;;;;;;;;;;;;;;1480:198;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1480:198:79;;;;;836:27;;8:9:-1;5:2;;;30:1;27;20:12;5:2;836:27:79;;;;;;;;;;;;;;;;;;;;;;;1150:65;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1150:65:79;;;;;;;799:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;799:31:79;;;;1954:121;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1954:121:79;;;;;;;;;1221:65;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1221:65:79;;;;;;;;;;;;1350:125;1404:10;1394:21;;;;:9;:21;;;;;;;;;:34;;1419:9;1394:34;;;;;;1438:30;;;;;;;;;;;;;;;;;1350:125::o;753:40::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1776:172::-;1858:10;1832:4;1848:21;;;:9;:21;;;;;;;;;:26;;;;;;;;;;;:32;;;1890:30;;;;;;;1832:4;;1848:26;;1858:10;;1890:30;;;;;;;;-1:-1:-1;1937:4:79;1776:172;;;;:::o;1684:86::-;1751:4;:12;1684:86;:::o;2081:455::-;2199:14;;;2171:4;2199:14;;;:9;:14;;;;;;:21;-1:-1:-1;2199:21:79;2191:30;;;;;;2236:17;;;2243:10;2236:17;;;;:59;;-1:-1:-1;2257:14:79;;;;;;;:9;:14;;;;;;;;2272:10;2257:26;;;;;;;;2292:2;2257:38;;2236:59;2232:179;;;2319:14;;;;;;;:9;:14;;;;;;;;2334:10;2319:26;;;;;;;;:33;-1:-1:-1;2319:33:79;2311:42;;;;;;2367:14;;;;;;;:9;:14;;;;;;;;2382:10;2367:26;;;;;;;:33;;;;;;;2232:179;2421:14;;;;;;;;:9;:14;;;;;;;;:21;;;;;;;2452:14;;;;;;;;;;:21;;;;;;2484:23;;;;;;;2452:14;;2484:23;;;;;;;;;;;-1:-1:-1;2525:4:79;2081:455;;;;;:::o;1480:198::-;1543:10;1533:21;;;;:9;:21;;;;;;:28;-1:-1:-1;1533:28:79;1525:37;;;;;;1582:10;1572:21;;;;:9;:21;;;;;;:28;;;;;;;1610:24;;;;;;1597:3;;1610:24;;1572:21;1610:24;1597:3;1582:10;1610:24;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;1644:27:79;;;;;;;;1655:10;;1644:27;;;;;;;;;;1480:198;:::o;836:27::-;;;;;;:::o;1150:65::-;;;;;;;;;;;;;:::o;799:31::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1954:121;2011:4;2034:34;2047:10;2059:3;2064;2034:12;:34::i;:::-;2027:41;1954:121;-1:-1:-1;;;1954:121:79:o;1221:65::-;;;;;;;;;;;;;;;;;;;;;;;;:::o"
+ }
+ }
+ },
+ "sources": {
+ "tokens/EtherToken/WETH9.sol": {
+ "id": 79
+ }
+ },
+ "sourceCodes": {
+ "tokens/EtherToken/WETH9.sol": "// Copyright (C) 2015, 2016, 2017 Dapphub\n\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n// solhint-disable\npragma solidity ^0.4.18;\n\n\ncontract WETH9 {\n string public name = \"Wrapped Ether\";\n string public symbol = \"WETH\";\n uint8 public decimals = 18;\n\n event Approval(address indexed _owner, address indexed _spender, uint _value);\n event Transfer(address indexed _from, address indexed _to, uint _value);\n event Deposit(address indexed _owner, uint _value);\n event Withdrawal(address indexed _owner, uint _value);\n\n mapping (address => uint) public balanceOf;\n mapping (address => mapping (address => uint)) public allowance;\n\n function() public payable {\n deposit();\n }\n function deposit() public payable {\n balanceOf[msg.sender] += msg.value;\n Deposit(msg.sender, msg.value);\n }\n function withdraw(uint wad) public {\n require(balanceOf[msg.sender] >= wad);\n balanceOf[msg.sender] -= wad;\n msg.sender.transfer(wad);\n Withdrawal(msg.sender, wad);\n }\n\n function totalSupply() public view returns (uint) {\n return this.balance;\n }\n\n function approve(address guy, uint wad) public returns (bool) {\n allowance[msg.sender][guy] = wad;\n Approval(msg.sender, guy, wad);\n return true;\n }\n\n function transfer(address dst, uint wad) public returns (bool) {\n return transferFrom(msg.sender, dst, wad);\n }\n\n function transferFrom(address src, address dst, uint wad)\n public\n returns (bool)\n {\n require(balanceOf[src] >= wad);\n\n if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {\n require(allowance[src][msg.sender] >= wad);\n allowance[src][msg.sender] -= wad;\n }\n\n balanceOf[src] -= wad;\n balanceOf[dst] += wad;\n\n Transfer(src, dst, wad);\n\n return true;\n }\n}\n\n\n/*\n GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n Preamble\n\n The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works. By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users. We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors. You can apply it to\nyour programs, too.\n\n When we speak of free software, we are referring to freedom, not\nprice. Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights. Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received. You must make sure that they, too, receive\nor can get the source code. And you must show them these terms so they\nknow their rights.\n\n Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software. For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so. This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software. The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable. Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts. If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary. To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n The precise terms and conditions for copying, distribution and\nmodification follow.\n\n TERMS AND CONDITIONS\n\n 0. Definitions.\n\n \"This License\" refers to version 3 of the GNU General Public License.\n\n \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n \"The Program\" refers to any copyrightable work licensed under this\nLicense. Each licensee is addressed as \"you\". \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy. The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy. Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies. Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License. If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n 1. Source Code.\n\n The \"source code\" for a work means the preferred form of the work\nfor making modifications to it. \"Object code\" means any non-source\nform of a work.\n\n A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form. A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities. However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work. For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n The Corresponding Source for a work in source code form is that\nsame work.\n\n 2. Basic Permissions.\n\n All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met. This License explicitly affirms your unlimited\npermission to run the unmodified Program. The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work. This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force. You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright. Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n Conveying under any other circumstances is permitted solely under\nthe conditions stated below. Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n 4. Conveying Verbatim Copies.\n\n You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n 5. Conveying Modified Source Versions.\n\n You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n a) The work must carry prominent notices stating that you modified\n it, and giving a relevant date.\n\n b) The work must carry prominent notices stating that it is\n released under this License and any conditions added under section\n 7. This requirement modifies the requirement in section 4 to\n \"keep intact all notices\".\n\n c) You must license the entire work, as a whole, under this\n License to anyone who comes into possession of a copy. This\n License will therefore apply, along with any applicable section 7\n additional terms, to the whole of the work, and all its parts,\n regardless of how they are packaged. This License gives no\n permission to license the work in any other way, but it does not\n invalidate such permission if you have separately received it.\n\n d) If the work has interactive user interfaces, each must display\n Appropriate Legal Notices; however, if the Program has interactive\n interfaces that do not display Appropriate Legal Notices, your\n work need not make them do so.\n\n A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit. Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n 6. Conveying Non-Source Forms.\n\n You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n a) Convey the object code in, or embodied in, a physical product\n (including a physical distribution medium), accompanied by the\n Corresponding Source fixed on a durable physical medium\n customarily used for software interchange.\n\n b) Convey the object code in, or embodied in, a physical product\n (including a physical distribution medium), accompanied by a\n written offer, valid for at least three years and valid for as\n long as you offer spare parts or customer support for that product\n model, to give anyone who possesses the object code either (1) a\n copy of the Corresponding Source for all the software in the\n product that is covered by this License, on a durable physical\n medium customarily used for software interchange, for a price no\n more than your reasonable cost of physically performing this\n conveying of source, or (2) access to copy the\n Corresponding Source from a network server at no charge.\n\n c) Convey individual copies of the object code with a copy of the\n written offer to provide the Corresponding Source. This\n alternative is allowed only occasionally and noncommercially, and\n only if you received the object code with such an offer, in accord\n with subsection 6b.\n\n d) Convey the object code by offering access from a designated\n place (gratis or for a charge), and offer equivalent access to the\n Corresponding Source in the same way through the same place at no\n further charge. You need not require recipients to copy the\n Corresponding Source along with the object code. If the place to\n copy the object code is a network server, the Corresponding Source\n may be on a different server (operated by you or a third party)\n that supports equivalent copying facilities, provided you maintain\n clear directions next to the object code saying where to find the\n Corresponding Source. Regardless of what server hosts the\n Corresponding Source, you remain obligated to ensure that it is\n available for as long as needed to satisfy these requirements.\n\n e) Convey the object code using peer-to-peer transmission, provided\n you inform other peers where the object code and Corresponding\n Source of the work are being offered to the general public at no\n charge under subsection 6d.\n\n A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling. In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage. For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product. A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source. The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information. But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed. Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n 7. Additional Terms.\n\n \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law. If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit. (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.) You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n a) Disclaiming warranty or limiting liability differently from the\n terms of sections 15 and 16 of this License; or\n\n b) Requiring preservation of specified reasonable legal notices or\n author attributions in that material or in the Appropriate Legal\n Notices displayed by works containing it; or\n\n c) Prohibiting misrepresentation of the origin of that material, or\n requiring that modified versions of such material be marked in\n reasonable ways as different from the original version; or\n\n d) Limiting the use for publicity purposes of names of licensors or\n authors of the material; or\n\n e) Declining to grant rights under trademark law for use of some\n trade names, trademarks, or service marks; or\n\n f) Requiring indemnification of licensors and authors of that\n material by anyone who conveys the material (or modified versions of\n it) with contractual assumptions of liability to the recipient, for\n any liability that these contractual assumptions directly impose on\n those licensors and authors.\n\n All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10. If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term. If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n 8. Termination.\n\n You may not propagate or modify a covered work except as expressly\nprovided under this License. Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License. If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n 9. Acceptance Not Required for Having Copies.\n\n You are not required to accept this License in order to receive or\nrun a copy of the Program. Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance. However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work. These actions infringe copyright if you do\nnot accept this License. Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n 10. Automatic Licensing of Downstream Recipients.\n\n Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License. You are not responsible\nfor enforcing compliance by third parties with this License.\n\n An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations. If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License. For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n 11. Patents.\n\n A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based. The\nwork thus licensed is called the contributor's \"contributor version\".\n\n A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version. For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement). To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients. \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License. You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n 12. No Surrender of Others' Freedom.\n\n If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License. If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all. For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n 13. Use with the GNU Affero General Public License.\n\n Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work. The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n 14. Revised Versions of this License.\n\n The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time. Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n Each version is given a distinguishing version number. If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation. If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n Later license versions may give you additional or different\npermissions. However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n 15. Disclaimer of Warranty.\n\n THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n 16. Limitation of Liability.\n\n IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n 17. Interpretation of Sections 15 and 16.\n\n If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n END OF TERMS AND CONDITIONS\n\n How to Apply These Terms to Your New Programs\n\n If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n To do so, attach the following notices to the program. It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n <one line to give the program's name and a brief idea of what it does.>\n Copyright (C) <year> <name of author>\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n <program> Copyright (C) <year> <name of author>\n This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n This is free software, and you are welcome to redistribute it\n under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License. Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n The GNU General Public License does not permit incorporating your program\ninto proprietary programs. If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library. If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License. But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n\n*/\n"
+ },
+ "sourceTreeHashHex": "0x08a4125fbc1137215308db8e8f4c0774b2adbec12342172c17216bcaa6e596c6",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/Wallet.json b/packages/contracts/generated-artifacts/Wallet.json
new file mode 100644
index 000000000..e671ba462
--- /dev/null
+++ b/packages/contracts/generated-artifacts/Wallet.json
@@ -0,0 +1,95 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "Wallet",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "eip712Signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "walletOwner",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405234801561001057600080fd5b5060405160208061040a833981016040525160008054600160a060020a03909216600160a060020a03199092169190911790556103b8806100526000396000f3006080604052600436106100405763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631626ba7e8114610045575b600080fd5b34801561005157600080fd5b5061006960048035906024803590810191013561007d565b604080519115158252519081900360200190f35b600080808080604186146100f257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c454e4754485f36355f52455155495245440000000000000000000000000000604482015290519081900360640190fd5b868660008181106100ff57fe5b905001357f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167f0100000000000000000000000000000000000000000000000000000000000000900493506101d3600188888080601f01602080910402602001604051908101604052809392919081815260200183838082843750949594505063ffffffff6102e61692505050565b9250610219602188888080601f01602080910402602001604051908101604052809392919081815260200183838082843750949594505063ffffffff6102e61692505050565b60408051600080825260208083018085528d905260ff8916838501526060830188905260808301859052925193955060019360a080840194937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0830193908390039091019190865af1158015610293573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015160005473ffffffffffffffffffffffffffffffffffffffff9182169116149998505050505050505050565b60008160200183511015151561038357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b500160200151905600a165627a7a723058206cc3bab711fb154f2faaa5905176e2c0ad78cc41d58804f6353e37072fe7b92c0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP1 PUSH2 0x40A DUP4 CODECOPY DUP2 ADD PUSH1 0x40 MSTORE MLOAD PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB SWAP1 SWAP3 AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH2 0x3B8 DUP1 PUSH2 0x52 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x40 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x1626BA7E DUP2 EQ PUSH2 0x45 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x51 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x69 PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x7D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP1 DUP1 PUSH1 0x41 DUP7 EQ PUSH2 0xF2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F36355F52455155495245440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP7 DUP7 PUSH1 0x0 DUP2 DUP2 LT PUSH2 0xFF JUMPI INVALID JUMPDEST SWAP1 POP ADD CALLDATALOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DIV PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 MUL PUSH31 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DIV SWAP4 POP PUSH2 0x1D3 PUSH1 0x1 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP6 SWAP5 POP POP PUSH4 0xFFFFFFFF PUSH2 0x2E6 AND SWAP3 POP POP POP JUMP JUMPDEST SWAP3 POP PUSH2 0x219 PUSH1 0x21 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP6 SWAP5 POP POP PUSH4 0xFFFFFFFF PUSH2 0x2E6 AND SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD DUP1 DUP6 MSTORE DUP14 SWAP1 MSTORE PUSH1 0xFF DUP10 AND DUP4 DUP6 ADD MSTORE PUSH1 0x60 DUP4 ADD DUP9 SWAP1 MSTORE PUSH1 0x80 DUP4 ADD DUP6 SWAP1 MSTORE SWAP3 MLOAD SWAP4 SWAP6 POP PUSH1 0x1 SWAP4 PUSH1 0xA0 DUP1 DUP5 ADD SWAP5 SWAP4 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP4 ADD SWAP4 SWAP1 DUP4 SWAP1 SUB SWAP1 SWAP2 ADD SWAP2 SWAP1 DUP7 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x293 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND SWAP2 AND EQ SWAP10 SWAP9 POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x383 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH13 0xC3BAB711FB154F2FAAA5905176 0xe2 0xc0 0xad PUSH25 0xCC41D58804F6353E37072FE7B92C0029000000000000000000 ",
+ "sourceMap": "708:1185:2:-;;;1011:84;8:9:-1;5:2;;;30:1;27;20:12;5:2;1011:84:2;;;;;;;;;;;;;1062:12;:26;;-1:-1:-1;;;;;1062:26:2;;;-1:-1:-1;;;;;;1062:26:2;;;;;;;;;708:1185;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100405763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631626ba7e8114610045575b600080fd5b34801561005157600080fd5b5061006960048035906024803590810191013561007d565b604080519115158252519081900360200190f35b600080808080604186146100f257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c454e4754485f36355f52455155495245440000000000000000000000000000604482015290519081900360640190fd5b868660008181106100ff57fe5b905001357f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167f0100000000000000000000000000000000000000000000000000000000000000900493506101d3600188888080601f01602080910402602001604051908101604052809392919081815260200183838082843750949594505063ffffffff6102e61692505050565b9250610219602188888080601f01602080910402602001604051908101604052809392919081815260200183838082843750949594505063ffffffff6102e61692505050565b60408051600080825260208083018085528d905260ff8916838501526060830188905260808301859052925193955060019360a080840194937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0830193908390039091019190865af1158015610293573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015160005473ffffffffffffffffffffffffffffffffffffffff9182169116149998505050505050505050565b60008160200183511015151561038357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560448201527f5155495245440000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b500160200151905600a165627a7a723058206cc3bab711fb154f2faaa5905176e2c0ad78cc41d58804f6353e37072fe7b92c0029",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x40 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x1626BA7E DUP2 EQ PUSH2 0x45 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x51 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x69 PUSH1 0x4 DUP1 CALLDATALOAD SWAP1 PUSH1 0x24 DUP1 CALLDATALOAD SWAP1 DUP2 ADD SWAP2 ADD CALLDATALOAD PUSH2 0x7D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP1 DUP1 PUSH1 0x41 DUP7 EQ PUSH2 0xF2 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x12 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x4C454E4754485F36355F52455155495245440000000000000000000000000000 PUSH1 0x44 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x64 ADD SWAP1 REVERT JUMPDEST DUP7 DUP7 PUSH1 0x0 DUP2 DUP2 LT PUSH2 0xFF JUMPI INVALID JUMPDEST SWAP1 POP ADD CALLDATALOAD PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DIV PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 MUL PUSH31 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NOT AND PUSH32 0x100000000000000000000000000000000000000000000000000000000000000 SWAP1 DIV SWAP4 POP PUSH2 0x1D3 PUSH1 0x1 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP6 SWAP5 POP POP PUSH4 0xFFFFFFFF PUSH2 0x2E6 AND SWAP3 POP POP POP JUMP JUMPDEST SWAP3 POP PUSH2 0x219 PUSH1 0x21 DUP9 DUP9 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY POP SWAP5 SWAP6 SWAP5 POP POP PUSH4 0xFFFFFFFF PUSH2 0x2E6 AND SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x0 DUP1 DUP3 MSTORE PUSH1 0x20 DUP1 DUP4 ADD DUP1 DUP6 MSTORE DUP14 SWAP1 MSTORE PUSH1 0xFF DUP10 AND DUP4 DUP6 ADD MSTORE PUSH1 0x60 DUP4 ADD DUP9 SWAP1 MSTORE PUSH1 0x80 DUP4 ADD DUP6 SWAP1 MSTORE SWAP3 MLOAD SWAP4 SWAP6 POP PUSH1 0x1 SWAP4 PUSH1 0xA0 DUP1 DUP5 ADD SWAP5 SWAP4 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP4 ADD SWAP4 SWAP1 DUP4 SWAP1 SUB SWAP1 SWAP2 ADD SWAP2 SWAP1 DUP7 GAS CALL ISZERO DUP1 ISZERO PUSH2 0x293 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 ADD MLOAD PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 DUP3 AND SWAP2 AND EQ SWAP10 SWAP9 POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x383 JUMPI PUSH1 0x40 DUP1 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x20 PUSH1 0x4 DUP3 ADD MSTORE PUSH1 0x26 PUSH1 0x24 DUP3 ADD MSTORE PUSH32 0x475245415445525F4F525F455155414C5F544F5F33325F4C454E4754485F5245 PUSH1 0x44 DUP3 ADD MSTORE PUSH32 0x5155495245440000000000000000000000000000000000000000000000000000 PUSH1 0x64 DUP3 ADD MSTORE SWAP1 MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x84 ADD SWAP1 REVERT JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP STOP LOG1 PUSH6 0x627A7A723058 KECCAK256 PUSH13 0xC3BAB711FB154F2FAAA5905176 0xe2 0xc0 0xad PUSH25 0xCC41D58804F6353E37072FE7B92C0029000000000000000000 ",
+ "sourceMap": "708:1185:2:-;;;;;;;;;;;;;;;;;;;;;;;1343:548;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1343:548:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1475:12;;;;;1550:2;1524:28;;1503:93;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1623:15;;1639:1;1623:18;;;;;;;;;;;;;;;;;;;1617:25;;;1607:35;;1664:30;1692:1;1664:15;;:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1664:27:2;;:30;-1:-1:-1;;1664:30:2;:27;:30;;-1:-1:-1;;;1664:30:2:i;:::-;1652:42;;1716:31;1744:2;1716:15;;:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1716:27:2;;:31;-1:-1:-1;;1716:31:2;:27;:31;;-1:-1:-1;;;1716:31:2:i;:::-;1784:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1704:43;;-1:-1:-1;1784:24:2;;;;;;;;-1:-1:-1;1784:24:2;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;1784:24:2;;;;;1828:12;;:32;;;;:12;;:32;;1343:548;-1:-1:-1;;;;;;;;;1343:548:2:o;13290:490:80:-;13411:14;13474:5;13482:2;13474:10;13462:1;:8;:22;;13441:107;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;13727:13:80;13629:2;13727:13;13721:20;;13290:490::o"
+ }
+ }
+ },
+ "sources": {
+ "examples/Wallet/Wallet.sol": {
+ "id": 2
+ },
+ "protocol/Exchange/interfaces/IWallet.sol": {
+ "id": 40
+ },
+ "utils/LibBytes/LibBytes.sol": {
+ "id": 80
+ }
+ },
+ "sourceCodes": {
+ "examples/Wallet/Wallet.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../protocol/Exchange/interfaces/IWallet.sol\";\nimport \"../../utils/LibBytes/LibBytes.sol\";\n\n\ncontract Wallet is \n IWallet\n{\n using LibBytes for bytes;\n\n // The owner of this wallet.\n // solhint-disable-next-line var-name-mixedcase\n address internal WALLET_OWNER;\n\n /// @dev constructs a new `Wallet` with a single owner.\n /// @param walletOwner The owner of this wallet.\n constructor (address walletOwner) public {\n WALLET_OWNER = walletOwner;\n }\n\n /// @dev Validates an EIP712 signature.\n /// The signer must match the owner of this wallet.\n /// @param hash Message hash that is signed.\n /// @param eip712Signature Proof of signing.\n /// @return Validity of signature.\n function isValidSignature(\n bytes32 hash,\n bytes eip712Signature\n )\n external\n view\n returns (bool isValid)\n {\n require(\n eip712Signature.length == 65,\n \"LENGTH_65_REQUIRED\"\n );\n\n uint8 v = uint8(eip712Signature[0]);\n bytes32 r = eip712Signature.readBytes32(1);\n bytes32 s = eip712Signature.readBytes32(33);\n address recoveredAddress = ecrecover(hash, v, r, s);\n isValid = WALLET_OWNER == recoveredAddress;\n return isValid;\n }\n}\n",
+ "protocol/Exchange/interfaces/IWallet.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IWallet {\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n bytes signature\n )\n external\n view\n returns (bool isValid);\n}\n",
+ "utils/LibBytes/LibBytes.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\nlibrary LibBytes {\n\n using LibBytes for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n \n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n \n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n \n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n \n /// @dev Returns a slice from a byte array without preserving the input.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n /// @dev When `from == 0`, the original array will match the slice. In other cases its state will be corrupted.\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n require(\n from <= to,\n \"FROM_LESS_THAN_TO_REQUIRED\"\n );\n require(\n to < b.length,\n \"TO_LESS_THAN_LENGTH_REQUIRED\"\n );\n \n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n require(\n b.length > 0,\n \"GREATER_THAN_ZERO_LENGTH_REQUIRED\"\n );\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Pops the last 20 bytes off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return The 20 byte address that was popped off.\n function popLast20Bytes(bytes memory b)\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= 20,\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Store last 20 bytes.\n result = readAddress(b, b.length - 20);\n\n assembly {\n // Subtract 20 from byte array length.\n let newLen := sub(mload(b), 20)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n require(\n b.length >= index + 20, // 20 is length of address\n \"GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED\"\n );\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n \n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n require(\n b.length >= index + 32,\n \"GREATER_OR_EQUAL_TO_32_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n require(\n b.length >= index + 4,\n \"GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED\"\n );\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Reads nested bytes from a specific position.\n /// @dev NOTE: the returned value overlaps with the input value.\n /// Both should be treated as immutable.\n /// @param b Byte array containing nested bytes.\n /// @param index Index of nested bytes.\n /// @return result Nested bytes.\n function readBytesWithLength(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Read length of nested bytes\n uint256 nestedBytesLength = readUint256(b, index);\n index += 32;\n\n // Assert length of <b> is valid, given\n // length of nested bytes\n require(\n b.length >= index + nestedBytesLength,\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n \n // Return a pointer to the byte array as it exists inside `b`\n assembly {\n result := add(b, index)\n }\n return result;\n }\n\n /// @dev Inserts bytes at a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes to insert.\n function writeBytesWithLength(\n bytes memory b,\n uint256 index,\n bytes memory input\n )\n internal\n pure\n {\n // Assert length of <b> is valid, given\n // length of input\n require(\n b.length >= index + 32 + input.length, // 32 bytes to store length\n \"GREATER_OR_EQUAL_TO_NESTED_BYTES_LENGTH_REQUIRED\"\n );\n\n // Copy <input> into <b>\n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of <input>\n input.length + 32 // +32 bytes to store <input> length\n );\n }\n\n /// @dev Performs a deep copy of a byte array onto another byte array of greater than or equal length.\n /// @param dest Byte array that will be overwritten with source bytes.\n /// @param source Byte array to copy onto dest bytes.\n function deepCopyBytes(\n bytes memory dest,\n bytes memory source\n )\n internal\n pure\n {\n uint256 sourceLen = source.length;\n // Dest length must be >= source length, or some bytes would not be copied.\n require(\n dest.length >= sourceLen,\n \"GREATER_OR_EQUAL_TO_SOURCE_BYTES_LENGTH_REQUIRED\"\n );\n memCopy(\n dest.contentAddress(),\n source.contentAddress(),\n sourceLen\n );\n }\n}\n"
+ },
+ "sourceTreeHashHex": "0xd3b783d1341fdf2b975faa0365f4c659b60ad4c8168276ab60c4f9d274c54f67",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/Whitelist.json b/packages/contracts/generated-artifacts/Whitelist.json
new file mode 100644
index 000000000..8a1755c62
--- /dev/null
+++ b/packages/contracts/generated-artifacts/Whitelist.json
@@ -0,0 +1,284 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "Whitelist",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "components": [
+ {
+ "name": "makerAddress",
+ "type": "address"
+ },
+ {
+ "name": "takerAddress",
+ "type": "address"
+ },
+ {
+ "name": "feeRecipientAddress",
+ "type": "address"
+ },
+ {
+ "name": "senderAddress",
+ "type": "address"
+ },
+ {
+ "name": "makerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "takerAssetAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "makerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "takerFee",
+ "type": "uint256"
+ },
+ {
+ "name": "expirationTimeSeconds",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "makerAssetData",
+ "type": "bytes"
+ },
+ {
+ "name": "takerAssetData",
+ "type": "bytes"
+ }
+ ],
+ "name": "order",
+ "type": "tuple"
+ },
+ {
+ "name": "takerAssetFillAmount",
+ "type": "uint256"
+ },
+ {
+ "name": "salt",
+ "type": "uint256"
+ },
+ {
+ "name": "orderSignature",
+ "type": "bytes"
+ }
+ ],
+ "name": "fillOrderIfWhitelisted",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "isWhitelisted",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "hash",
+ "type": "bytes32"
+ },
+ {
+ "name": "signerAddress",
+ "type": "address"
+ },
+ {
+ "name": "signature",
+ "type": "bytes"
+ }
+ ],
+ "name": "isValidSignature",
+ "outputs": [
+ {
+ "name": "isValid",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "name": "isApproved",
+ "type": "bool"
+ }
+ ],
+ "name": "updateWhitelistStatus",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "name": "_exchange",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60806040523480156200001157600080fd5b5060405160208062000f59833981018060405262000033919081019062000185565b6000805433600160a060020a03199182161790915560028054909116600160a060020a03831617905560408051306c01000000000000000000000000026020808301919091527f050000000000000000000000000000000000000000000000000000000000000060348301528251808303601501815260359092019092528051620000c3926003920190620000cb565b5050620001ba565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200010e57805160ff19168380011785556200013e565b828001600101855582156200013e579182015b828111156200013e57825182559160200191906001019062000121565b506200014c92915062000150565b5090565b6200016d91905b808211156200014c576000815560010162000157565b90565b60006200017e8251620001ae565b9392505050565b6000602082840312156200019857600080fd5b6000620001a6848462000170565b949350505050565b600160a060020a031690565b610d8f80620001ca6000396000f3006080604052600436106100775763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663141da876811461007c5780633af32abf1461009e5780638da5cb5b146100d457806393634702146100f6578063c07732a314610116578063f2fde38b14610136575b600080fd5b34801561008857600080fd5b5061009c61009736600461082e565b610156565b005b3480156100aa57600080fd5b506100be6100b9366004610766565b6103ab565b6040516100cb9190610b88565b60405180910390f35b3480156100e057600080fd5b506100e96103c0565b6040516100cb9190610b74565b34801561010257600080fd5b506100be6101113660046107c6565b6103dc565b34801561012257600080fd5b5061009c61013136600461078c565b6103fd565b34801561014257600080fd5b5061009c610151366004610766565b6104a4565b33606032821461019b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019290610bc6565b60405180910390fd5b855173ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205460ff1615156101fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019290610bb6565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16151561025e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019290610b96565b6040517fb4be83d5000000000000000000000000000000000000000000000000000000009061029590889088908790602401610bd6565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925260025491517fbfc8bfce00000000000000000000000000000000000000000000000000000000815290925073ffffffffffffffffffffffffffffffffffffffff9091169063bfc8bfce9061037190879086908690600390600401610c08565b600060405180830381600087803b15801561038b57600080fd5b505af115801561039f573d6000803e3d6000fd5b50505050505050505050565b60016020526000908152604090205460ff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff83163214949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461044e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019290610ba6565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019290610ba6565b73ffffffffffffffffffffffffffffffffffffffff81161561055257600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60006105618235610cd0565b9392505050565b60006105618235610ce9565b60006105618235610cee565b600080601f8301841361059257600080fd5b50813567ffffffffffffffff8111156105aa57600080fd5b6020830191508360018202830111156105c257600080fd5b9250929050565b6000601f820183136105da57600080fd5b81356105ed6105e882610c7a565b610c53565b9150808252602083016020830185838301111561060957600080fd5b610614838284610cf1565b50505092915050565b6000610180828403121561063057600080fd5b61063b610180610c53565b905060006106498484610555565b825250602061065a84848301610555565b602083015250604061066e84828501610555565b604083015250606061068284828501610555565b606083015250608061069684828501610574565b60808301525060a06106aa84828501610574565b60a08301525060c06106be84828501610574565b60c08301525060e06106d284828501610574565b60e0830152506101006106e784828501610574565b610100830152506101206106fd84828501610574565b6101208301525061014082013567ffffffffffffffff81111561071f57600080fd5b61072b848285016105c9565b6101408301525061016082013567ffffffffffffffff81111561074d57600080fd5b610759848285016105c9565b6101608301525092915050565b60006020828403121561077857600080fd5b60006107848484610555565b949350505050565b6000806040838503121561079f57600080fd5b60006107ab8585610555565b92505060206107bc85828601610568565b9150509250929050565b600080600080606085870312156107dc57600080fd5b60006107e88787610574565b94505060206107f987828801610555565b935050604085013567ffffffffffffffff81111561081657600080fd5b61082287828801610580565b95989497509550505050565b6000806000806080858703121561084457600080fd5b843567ffffffffffffffff81111561085b57600080fd5b6108678782880161061d565b945050602061087887828801610574565b935050604061088987828801610574565b925050606085013567ffffffffffffffff8111156108a657600080fd5b6108b2878288016105c9565b91505092959194509250565b6108c781610cd0565b82525050565b6108c781610ce9565b60006108e182610ccc565b8084526108f5816020860160208601610cfd565b6108fe81610d2d565b9093016020019392505050565b6000815460018116600081146109285760018114610964576109a0565b60028204607f1685527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00821660208601526040850192506109a0565b6002820480865260208601955061097a85610cc0565b60005b828110156109995781548882015260019091019060200161097d565b8701945050505b505092915050565b601581527f54414b45525f4e4f545f57484954454c49535445440000000000000000000000602082015260400190565b601381527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000602082015260400190565b601581527f4d414b45525f4e4f545f57484954454c49535445440000000000000000000000602082015260400190565b600e81527f494e56414c49445f53454e444552000000000000000000000000000000000000602082015260400190565b8051600090610180840190610a7d85826108be565b506020830151610a9060208601826108be565b506040830151610aa360408601826108be565b506060830151610ab660608601826108be565b506080830151610ac96080860182610b6b565b5060a0830151610adc60a0860182610b6b565b5060c0830151610aef60c0860182610b6b565b5060e0830151610b0260e0860182610b6b565b50610100830151610b17610100860182610b6b565b50610120830151610b2c610120860182610b6b565b50610140830151848203610140860152610b4682826108d6565b915050610160830151848203610160860152610b6282826108d6565b95945050505050565b6108c781610cee565b60208101610b8282846108be565b92915050565b60208101610b8282846108cd565b60208082528101610b82816109a8565b60208082528101610b82816109d8565b60208082528101610b8281610a08565b60208082528101610b8281610a38565b60608082528101610be78186610a68565b9050610bf66020830185610b6b565b8181036040830152610b6281846108d6565b60808101610c168287610b6b565b610c2360208301866108be565b8181036040830152610c3581856108d6565b90508181036060830152610c49818461090b565b9695505050505050565b60405181810167ffffffffffffffff81118282101715610c7257600080fd5b604052919050565b600067ffffffffffffffff821115610c9157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60009081526020902090565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b82818337506000910152565b60005b83811015610d18578181015183820152602001610d00565b83811115610d27576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820432f44199730f0d14e441adde2fff9d964ab11f1e3c797bb84816b1814e21d3d6c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH1 0x20 DUP1 PUSH3 0xF59 DUP4 CODECOPY DUP2 ADD DUP1 PUSH1 0x40 MSTORE PUSH3 0x33 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH3 0x185 JUMP JUMPDEST PUSH1 0x0 DUP1 SLOAD CALLER PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB NOT SWAP2 DUP3 AND OR SWAP1 SWAP2 SSTORE PUSH1 0x2 DUP1 SLOAD SWAP1 SWAP2 AND PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB DUP4 AND OR SWAP1 SSTORE PUSH1 0x40 DUP1 MLOAD ADDRESS PUSH13 0x1000000000000000000000000 MUL PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH32 0x500000000000000000000000000000000000000000000000000000000000000 PUSH1 0x34 DUP4 ADD MSTORE DUP3 MLOAD DUP1 DUP4 SUB PUSH1 0x15 ADD DUP2 MSTORE PUSH1 0x35 SWAP1 SWAP3 ADD SWAP1 SWAP3 MSTORE DUP1 MLOAD PUSH3 0xC3 SWAP3 PUSH1 0x3 SWAP3 ADD SWAP1 PUSH3 0xCB JUMP JUMPDEST POP POP PUSH3 0x1BA JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH3 0x10E JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH3 0x13E JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH3 0x13E JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH3 0x13E JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH3 0x121 JUMP JUMPDEST POP PUSH3 0x14C SWAP3 SWAP2 POP PUSH3 0x150 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH3 0x16D SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x14C JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH3 0x157 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH3 0x17E DUP3 MLOAD PUSH3 0x1AE JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH3 0x198 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH3 0x1A6 DUP5 DUP5 PUSH3 0x170 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB AND SWAP1 JUMP JUMPDEST PUSH2 0xD8F DUP1 PUSH3 0x1CA PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x77 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x141DA876 DUP2 EQ PUSH2 0x7C JUMPI DUP1 PUSH4 0x3AF32ABF EQ PUSH2 0x9E JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0xD4 JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0xF6 JUMPI DUP1 PUSH4 0xC07732A3 EQ PUSH2 0x116 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x136 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x88 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x9C PUSH2 0x97 CALLDATASIZE PUSH1 0x4 PUSH2 0x82E JUMP JUMPDEST PUSH2 0x156 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xAA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xBE PUSH2 0xB9 CALLDATASIZE PUSH1 0x4 PUSH2 0x766 JUMP JUMPDEST PUSH2 0x3AB JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xCB SWAP2 SWAP1 PUSH2 0xB88 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xE0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x3C0 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xCB SWAP2 SWAP1 PUSH2 0xB74 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x102 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xBE PUSH2 0x111 CALLDATASIZE PUSH1 0x4 PUSH2 0x7C6 JUMP JUMPDEST PUSH2 0x3DC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x122 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x9C PUSH2 0x131 CALLDATASIZE PUSH1 0x4 PUSH2 0x78C JUMP JUMPDEST PUSH2 0x3FD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x142 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x9C PUSH2 0x151 CALLDATASIZE PUSH1 0x4 PUSH2 0x766 JUMP JUMPDEST PUSH2 0x4A4 JUMP JUMPDEST CALLER PUSH1 0x60 ORIGIN DUP3 EQ PUSH2 0x19B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x192 SWAP1 PUSH2 0xBC6 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP6 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1FD JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x192 SWAP1 PUSH2 0xBB6 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x25E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x192 SWAP1 PUSH2 0xB96 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x295 SWAP1 DUP9 SWAP1 DUP9 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0xBD6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE PUSH1 0x2 SLOAD SWAP2 MLOAD PUSH32 0xBFC8BFCE00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0xBFC8BFCE SWAP1 PUSH2 0x371 SWAP1 DUP8 SWAP1 DUP7 SWAP1 DUP7 SWAP1 PUSH1 0x3 SWAP1 PUSH1 0x4 ADD PUSH2 0xC08 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x38B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x39F JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND ORIGIN EQ SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x44E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x192 SWAP1 PUSH2 0xBA6 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 SWAP1 SWAP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x4F5 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x192 SWAP1 PUSH2 0xBA6 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x552 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x561 DUP3 CALLDATALOAD PUSH2 0xCD0 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x561 DUP3 CALLDATALOAD PUSH2 0xCE9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x561 DUP3 CALLDATALOAD PUSH2 0xCEE JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1F DUP4 ADD DUP5 SGT PUSH2 0x592 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x5AA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x1 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x5C2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x5DA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x5ED PUSH2 0x5E8 DUP3 PUSH2 0xC7A JUMP JUMPDEST PUSH2 0xC53 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x609 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x614 DUP4 DUP3 DUP5 PUSH2 0xCF1 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x630 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x63B PUSH2 0x180 PUSH2 0xC53 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x649 DUP5 DUP5 PUSH2 0x555 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x65A DUP5 DUP5 DUP4 ADD PUSH2 0x555 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x66E DUP5 DUP3 DUP6 ADD PUSH2 0x555 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x682 DUP5 DUP3 DUP6 ADD PUSH2 0x555 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x696 DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x6AA DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x6BE DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x6D2 DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x6E7 DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x6FD DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x71F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x72B DUP5 DUP3 DUP6 ADD PUSH2 0x5C9 JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x74D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x759 DUP5 DUP3 DUP6 ADD PUSH2 0x5C9 JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x778 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x784 DUP5 DUP5 PUSH2 0x555 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x79F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x7AB DUP6 DUP6 PUSH2 0x555 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x7BC DUP6 DUP3 DUP7 ADD PUSH2 0x568 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x60 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x7DC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x7E8 DUP8 DUP8 PUSH2 0x574 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x7F9 DUP8 DUP3 DUP9 ADD PUSH2 0x555 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x816 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x822 DUP8 DUP3 DUP9 ADD PUSH2 0x580 JUMP JUMPDEST SWAP6 SWAP9 SWAP5 SWAP8 POP SWAP6 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x844 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x85B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x867 DUP8 DUP3 DUP9 ADD PUSH2 0x61D JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x878 DUP8 DUP3 DUP9 ADD PUSH2 0x574 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 PUSH2 0x889 DUP8 DUP3 DUP9 ADD PUSH2 0x574 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x8A6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x8B2 DUP8 DUP3 DUP9 ADD PUSH2 0x5C9 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH2 0x8C7 DUP2 PUSH2 0xCD0 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0x8C7 DUP2 PUSH2 0xCE9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x8E1 DUP3 PUSH2 0xCCC JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x8F5 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0xCFD JUMP JUMPDEST PUSH2 0x8FE DUP2 PUSH2 0xD2D JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SLOAD PUSH1 0x1 DUP2 AND PUSH1 0x0 DUP2 EQ PUSH2 0x928 JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x964 JUMPI PUSH2 0x9A0 JUMP JUMPDEST PUSH1 0x2 DUP3 DIV PUSH1 0x7F AND DUP6 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 DUP3 AND PUSH1 0x20 DUP7 ADD MSTORE PUSH1 0x40 DUP6 ADD SWAP3 POP PUSH2 0x9A0 JUMP JUMPDEST PUSH1 0x2 DUP3 DIV DUP1 DUP7 MSTORE PUSH1 0x20 DUP7 ADD SWAP6 POP PUSH2 0x97A DUP6 PUSH2 0xCC0 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x999 JUMPI DUP2 SLOAD DUP9 DUP3 ADD MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD PUSH2 0x97D JUMP JUMPDEST DUP8 ADD SWAP5 POP POP POP JUMPDEST POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x15 DUP2 MSTORE PUSH32 0x54414B45525F4E4F545F57484954454C49535445440000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x13 DUP2 MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x15 DUP2 MSTORE PUSH32 0x4D414B45525F4E4F545F57484954454C49535445440000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x494E56414C49445F53454E444552000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0xA7D DUP6 DUP3 PUSH2 0x8BE JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0xA90 PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0x8BE JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0xAA3 PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0x8BE JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0xAB6 PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x8BE JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0xAC9 PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0xADC PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0xAEF PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0xB02 PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0xB17 PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0xB2C PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0xB46 DUP3 DUP3 PUSH2 0x8D6 JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0xB62 DUP3 DUP3 PUSH2 0x8D6 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x8C7 DUP2 PUSH2 0xCEE JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0xB82 DUP3 DUP5 PUSH2 0x8BE JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0xB82 DUP3 DUP5 PUSH2 0x8CD JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB82 DUP2 PUSH2 0x9A8 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB82 DUP2 PUSH2 0x9D8 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB82 DUP2 PUSH2 0xA08 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB82 DUP2 PUSH2 0xA38 JUMP JUMPDEST PUSH1 0x60 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xBE7 DUP2 DUP7 PUSH2 0xA68 JUMP JUMPDEST SWAP1 POP PUSH2 0xBF6 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0xB6B JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0xB62 DUP2 DUP5 PUSH2 0x8D6 JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0xC16 DUP3 DUP8 PUSH2 0xB6B JUMP JUMPDEST PUSH2 0xC23 PUSH1 0x20 DUP4 ADD DUP7 PUSH2 0x8BE JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0xC35 DUP2 DUP6 PUSH2 0x8D6 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0xC49 DUP2 DUP5 PUSH2 0x90B JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0xC72 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0xC91 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xD18 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xD00 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0xD27 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 NUMBER 0x2f DIFFICULTY NOT SWAP8 ADDRESS CREATE 0xd1 0x4e DIFFICULTY BYTE 0xdd 0xe2 SELFDESTRUCT 0xf9 0xd9 PUSH5 0xAB11F1E3C7 SWAP8 0xbb DUP5 DUP2 PUSH12 0x1814E21D3D6C657870657269 PUSH14 0x656E74616CF50037000000000000 ",
+ "sourceMap": "794:3556:3:-;;;1181:188;8:9:-1;5:2;;;30:1;27;20:12;5:2;1181:188:3;;;;;;;;;;;;;;;;;;;;;;162:5:82;:18;;170:10;-1:-1:-1;;;;;;162:18:82;;;;;;;1242:8:3;:31;;;;;-1:-1:-1;;;;;1242:31:3;;;;;1305:57;;;1330:4;1305:57;;;;;;;;;;1337:24;1305:57;;;;;;26:21:-1;;;22:32;;6:49;;1305:57:3;;;;;;;1283:79;;;;:19;;:79;;;:::i;:::-;;1181:188;794:3556;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;794:3556:3;;;-1:-1:-1;794:3556:3;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;:::o;5:122:-1:-;;83:39;114:6;108:13;83:39;;;74:48;68:59;-1:-1;;;68:59;134:263;;249:2;237:9;228:7;224:23;220:32;217:2;;;265:1;262;255:12;217:2;300:1;317:64;373:7;353:9;317:64;;;307:74;211:186;-1:-1;;;;211:186;404:128;-1:-1;;;;;473:54;;456:76;;794:3556:3;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x6080604052600436106100775763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663141da876811461007c5780633af32abf1461009e5780638da5cb5b146100d457806393634702146100f6578063c07732a314610116578063f2fde38b14610136575b600080fd5b34801561008857600080fd5b5061009c61009736600461082e565b610156565b005b3480156100aa57600080fd5b506100be6100b9366004610766565b6103ab565b6040516100cb9190610b88565b60405180910390f35b3480156100e057600080fd5b506100e96103c0565b6040516100cb9190610b74565b34801561010257600080fd5b506100be6101113660046107c6565b6103dc565b34801561012257600080fd5b5061009c61013136600461078c565b6103fd565b34801561014257600080fd5b5061009c610151366004610766565b6104a4565b33606032821461019b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019290610bc6565b60405180910390fd5b855173ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205460ff1615156101fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019290610bb6565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16151561025e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019290610b96565b6040517fb4be83d5000000000000000000000000000000000000000000000000000000009061029590889088908790602401610bd6565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925260025491517fbfc8bfce00000000000000000000000000000000000000000000000000000000815290925073ffffffffffffffffffffffffffffffffffffffff9091169063bfc8bfce9061037190879086908690600390600401610c08565b600060405180830381600087803b15801561038b57600080fd5b505af115801561039f573d6000803e3d6000fd5b50505050505050505050565b60016020526000908152604090205460ff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff83163214949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461044e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019290610ba6565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104f5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161019290610ba6565b73ffffffffffffffffffffffffffffffffffffffff81161561055257600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60006105618235610cd0565b9392505050565b60006105618235610ce9565b60006105618235610cee565b600080601f8301841361059257600080fd5b50813567ffffffffffffffff8111156105aa57600080fd5b6020830191508360018202830111156105c257600080fd5b9250929050565b6000601f820183136105da57600080fd5b81356105ed6105e882610c7a565b610c53565b9150808252602083016020830185838301111561060957600080fd5b610614838284610cf1565b50505092915050565b6000610180828403121561063057600080fd5b61063b610180610c53565b905060006106498484610555565b825250602061065a84848301610555565b602083015250604061066e84828501610555565b604083015250606061068284828501610555565b606083015250608061069684828501610574565b60808301525060a06106aa84828501610574565b60a08301525060c06106be84828501610574565b60c08301525060e06106d284828501610574565b60e0830152506101006106e784828501610574565b610100830152506101206106fd84828501610574565b6101208301525061014082013567ffffffffffffffff81111561071f57600080fd5b61072b848285016105c9565b6101408301525061016082013567ffffffffffffffff81111561074d57600080fd5b610759848285016105c9565b6101608301525092915050565b60006020828403121561077857600080fd5b60006107848484610555565b949350505050565b6000806040838503121561079f57600080fd5b60006107ab8585610555565b92505060206107bc85828601610568565b9150509250929050565b600080600080606085870312156107dc57600080fd5b60006107e88787610574565b94505060206107f987828801610555565b935050604085013567ffffffffffffffff81111561081657600080fd5b61082287828801610580565b95989497509550505050565b6000806000806080858703121561084457600080fd5b843567ffffffffffffffff81111561085b57600080fd5b6108678782880161061d565b945050602061087887828801610574565b935050604061088987828801610574565b925050606085013567ffffffffffffffff8111156108a657600080fd5b6108b2878288016105c9565b91505092959194509250565b6108c781610cd0565b82525050565b6108c781610ce9565b60006108e182610ccc565b8084526108f5816020860160208601610cfd565b6108fe81610d2d565b9093016020019392505050565b6000815460018116600081146109285760018114610964576109a0565b60028204607f1685527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00821660208601526040850192506109a0565b6002820480865260208601955061097a85610cc0565b60005b828110156109995781548882015260019091019060200161097d565b8701945050505b505092915050565b601581527f54414b45525f4e4f545f57484954454c49535445440000000000000000000000602082015260400190565b601381527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000602082015260400190565b601581527f4d414b45525f4e4f545f57484954454c49535445440000000000000000000000602082015260400190565b600e81527f494e56414c49445f53454e444552000000000000000000000000000000000000602082015260400190565b8051600090610180840190610a7d85826108be565b506020830151610a9060208601826108be565b506040830151610aa360408601826108be565b506060830151610ab660608601826108be565b506080830151610ac96080860182610b6b565b5060a0830151610adc60a0860182610b6b565b5060c0830151610aef60c0860182610b6b565b5060e0830151610b0260e0860182610b6b565b50610100830151610b17610100860182610b6b565b50610120830151610b2c610120860182610b6b565b50610140830151848203610140860152610b4682826108d6565b915050610160830151848203610160860152610b6282826108d6565b95945050505050565b6108c781610cee565b60208101610b8282846108be565b92915050565b60208101610b8282846108cd565b60208082528101610b82816109a8565b60208082528101610b82816109d8565b60208082528101610b8281610a08565b60208082528101610b8281610a38565b60608082528101610be78186610a68565b9050610bf66020830185610b6b565b8181036040830152610b6281846108d6565b60808101610c168287610b6b565b610c2360208301866108be565b8181036040830152610c3581856108d6565b90508181036060830152610c49818461090b565b9695505050505050565b60405181810167ffffffffffffffff81118282101715610c7257600080fd5b604052919050565b600067ffffffffffffffff821115610c9157600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60009081526020902090565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b90565b82818337506000910152565b60005b83811015610d18578181015183820152602001610d00565b83811115610d27576000848401525b50505050565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820432f44199730f0d14e441adde2fff9d964ab11f1e3c797bb84816b1814e21d3d6c6578706572696d656e74616cf50037",
+ "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x77 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x141DA876 DUP2 EQ PUSH2 0x7C JUMPI DUP1 PUSH4 0x3AF32ABF EQ PUSH2 0x9E JUMPI DUP1 PUSH4 0x8DA5CB5B EQ PUSH2 0xD4 JUMPI DUP1 PUSH4 0x93634702 EQ PUSH2 0xF6 JUMPI DUP1 PUSH4 0xC07732A3 EQ PUSH2 0x116 JUMPI DUP1 PUSH4 0xF2FDE38B EQ PUSH2 0x136 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x88 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x9C PUSH2 0x97 CALLDATASIZE PUSH1 0x4 PUSH2 0x82E JUMP JUMPDEST PUSH2 0x156 JUMP JUMPDEST STOP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xAA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xBE PUSH2 0xB9 CALLDATASIZE PUSH1 0x4 PUSH2 0x766 JUMP JUMPDEST PUSH2 0x3AB JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xCB SWAP2 SWAP1 PUSH2 0xB88 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xE0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xE9 PUSH2 0x3C0 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xCB SWAP2 SWAP1 PUSH2 0xB74 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x102 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xBE PUSH2 0x111 CALLDATASIZE PUSH1 0x4 PUSH2 0x7C6 JUMP JUMPDEST PUSH2 0x3DC JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x122 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x9C PUSH2 0x131 CALLDATASIZE PUSH1 0x4 PUSH2 0x78C JUMP JUMPDEST PUSH2 0x3FD JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x142 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x9C PUSH2 0x151 CALLDATASIZE PUSH1 0x4 PUSH2 0x766 JUMP JUMPDEST PUSH2 0x4A4 JUMP JUMPDEST CALLER PUSH1 0x60 ORIGIN DUP3 EQ PUSH2 0x19B JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x192 SWAP1 PUSH2 0xBC6 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP6 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x1FD JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x192 SWAP1 PUSH2 0xBB6 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP3 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND ISZERO ISZERO PUSH2 0x25E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x192 SWAP1 PUSH2 0xB96 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xB4BE83D500000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x295 SWAP1 DUP9 SWAP1 DUP9 SWAP1 DUP8 SWAP1 PUSH1 0x24 ADD PUSH2 0xBD6 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE PUSH1 0x2 SLOAD SWAP2 MLOAD PUSH32 0xBFC8BFCE00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP3 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0xBFC8BFCE SWAP1 PUSH2 0x371 SWAP1 DUP8 SWAP1 DUP7 SWAP1 DUP7 SWAP1 PUSH1 0x3 SWAP1 PUSH1 0x4 ADD PUSH2 0xC08 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x38B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x39F JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x40 SWAP1 KECCAK256 SLOAD PUSH1 0xFF AND DUP2 JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND ORIGIN EQ SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x44E JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x192 SWAP1 PUSH2 0xBA6 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 SWAP1 SWAP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 MSTORE PUSH1 0x40 SWAP1 KECCAK256 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 AND SWAP2 ISZERO ISZERO SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND CALLER EQ PUSH2 0x4F5 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x192 SWAP1 PUSH2 0xBA6 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND ISZERO PUSH2 0x552 JUMPI PUSH1 0x0 DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND OR SWAP1 SSTORE JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x561 DUP3 CALLDATALOAD PUSH2 0xCD0 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x561 DUP3 CALLDATALOAD PUSH2 0xCE9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x561 DUP3 CALLDATALOAD PUSH2 0xCEE JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x1F DUP4 ADD DUP5 SGT PUSH2 0x592 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP DUP2 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x5AA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x20 DUP4 ADD SWAP2 POP DUP4 PUSH1 0x1 DUP3 MUL DUP4 ADD GT ISZERO PUSH2 0x5C2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0x5DA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x5ED PUSH2 0x5E8 DUP3 PUSH2 0xC7A JUMP JUMPDEST PUSH2 0xC53 JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0x609 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x614 DUP4 DUP3 DUP5 PUSH2 0xCF1 JUMP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x630 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x63B PUSH2 0x180 PUSH2 0xC53 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0x649 DUP5 DUP5 PUSH2 0x555 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0x65A DUP5 DUP5 DUP4 ADD PUSH2 0x555 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0x66E DUP5 DUP3 DUP6 ADD PUSH2 0x555 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0x682 DUP5 DUP3 DUP6 ADD PUSH2 0x555 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0x696 DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0x6AA DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0x6BE DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0x6D2 DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0x6E7 DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0x6FD DUP5 DUP3 DUP6 ADD PUSH2 0x574 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x71F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x72B DUP5 DUP3 DUP6 ADD PUSH2 0x5C9 JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x74D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x759 DUP5 DUP3 DUP6 ADD PUSH2 0x5C9 JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x778 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x784 DUP5 DUP5 PUSH2 0x555 JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x79F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x7AB DUP6 DUP6 PUSH2 0x555 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x7BC DUP6 DUP3 DUP7 ADD PUSH2 0x568 JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x60 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x7DC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x7E8 DUP8 DUP8 PUSH2 0x574 JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x7F9 DUP8 DUP3 DUP9 ADD PUSH2 0x555 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x816 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x822 DUP8 DUP3 DUP9 ADD PUSH2 0x580 JUMP JUMPDEST SWAP6 SWAP9 SWAP5 SWAP8 POP SWAP6 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0x844 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x85B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x867 DUP8 DUP3 DUP9 ADD PUSH2 0x61D JUMP JUMPDEST SWAP5 POP POP PUSH1 0x20 PUSH2 0x878 DUP8 DUP3 DUP9 ADD PUSH2 0x574 JUMP JUMPDEST SWAP4 POP POP PUSH1 0x40 PUSH2 0x889 DUP8 DUP3 DUP9 ADD PUSH2 0x574 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x60 DUP6 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x8A6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x8B2 DUP8 DUP3 DUP9 ADD PUSH2 0x5C9 JUMP JUMPDEST SWAP2 POP POP SWAP3 SWAP6 SWAP2 SWAP5 POP SWAP3 POP JUMP JUMPDEST PUSH2 0x8C7 DUP2 PUSH2 0xCD0 JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH2 0x8C7 DUP2 PUSH2 0xCE9 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x8E1 DUP3 PUSH2 0xCCC JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x8F5 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0xCFD JUMP JUMPDEST PUSH2 0x8FE DUP2 PUSH2 0xD2D JUMP JUMPDEST SWAP1 SWAP4 ADD PUSH1 0x20 ADD SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 SLOAD PUSH1 0x1 DUP2 AND PUSH1 0x0 DUP2 EQ PUSH2 0x928 JUMPI PUSH1 0x1 DUP2 EQ PUSH2 0x964 JUMPI PUSH2 0x9A0 JUMP JUMPDEST PUSH1 0x2 DUP3 DIV PUSH1 0x7F AND DUP6 MSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 DUP3 AND PUSH1 0x20 DUP7 ADD MSTORE PUSH1 0x40 DUP6 ADD SWAP3 POP PUSH2 0x9A0 JUMP JUMPDEST PUSH1 0x2 DUP3 DIV DUP1 DUP7 MSTORE PUSH1 0x20 DUP7 ADD SWAP6 POP PUSH2 0x97A DUP6 PUSH2 0xCC0 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x999 JUMPI DUP2 SLOAD DUP9 DUP3 ADD MSTORE PUSH1 0x1 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x20 ADD PUSH2 0x97D JUMP JUMPDEST DUP8 ADD SWAP5 POP POP POP JUMPDEST POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x15 DUP2 MSTORE PUSH32 0x54414B45525F4E4F545F57484954454C49535445440000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x13 DUP2 MSTORE PUSH32 0x4F4E4C595F434F4E54524143545F4F574E455200000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x15 DUP2 MSTORE PUSH32 0x4D414B45525F4E4F545F57484954454C49535445440000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0xE DUP2 MSTORE PUSH32 0x494E56414C49445F53454E444552000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0xA7D DUP6 DUP3 PUSH2 0x8BE JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0xA90 PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0x8BE JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0xAA3 PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0x8BE JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0xAB6 PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x8BE JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0xAC9 PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0xADC PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0xAEF PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0xB02 PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0xB17 PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0xB2C PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0xB6B JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0xB46 DUP3 DUP3 PUSH2 0x8D6 JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0xB62 DUP3 DUP3 PUSH2 0x8D6 JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH2 0x8C7 DUP2 PUSH2 0xCEE JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0xB82 DUP3 DUP5 PUSH2 0x8BE JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0xB82 DUP3 DUP5 PUSH2 0x8CD JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB82 DUP2 PUSH2 0x9A8 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB82 DUP2 PUSH2 0x9D8 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB82 DUP2 PUSH2 0xA08 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB82 DUP2 PUSH2 0xA38 JUMP JUMPDEST PUSH1 0x60 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xBE7 DUP2 DUP7 PUSH2 0xA68 JUMP JUMPDEST SWAP1 POP PUSH2 0xBF6 PUSH1 0x20 DUP4 ADD DUP6 PUSH2 0xB6B JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0xB62 DUP2 DUP5 PUSH2 0x8D6 JUMP JUMPDEST PUSH1 0x80 DUP2 ADD PUSH2 0xC16 DUP3 DUP8 PUSH2 0xB6B JUMP JUMPDEST PUSH2 0xC23 PUSH1 0x20 DUP4 ADD DUP7 PUSH2 0x8BE JUMP JUMPDEST DUP2 DUP2 SUB PUSH1 0x40 DUP4 ADD MSTORE PUSH2 0xC35 DUP2 DUP6 PUSH2 0x8D6 JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x60 DUP4 ADD MSTORE PUSH2 0xC49 DUP2 DUP5 PUSH2 0x90B JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0xC72 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0xC91 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 PUSH1 0x1F SWAP2 SWAP1 SWAP2 ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 SWAP1 KECCAK256 SWAP1 JUMP JUMPDEST MLOAD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST ISZERO ISZERO SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST DUP3 DUP2 DUP4 CALLDATACOPY POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xD18 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xD00 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0xD27 JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 NUMBER 0x2f DIFFICULTY NOT SWAP8 ADDRESS CREATE 0xd1 0x4e DIFFICULTY BYTE 0xdd 0xe2 SELFDESTRUCT 0xf9 0xd9 PUSH5 0xAB11F1E3C7 SWAP8 0xbb DUP5 DUP2 PUSH12 0x1814E21D3D6C657870657269 PUSH14 0x656E74616CF50037000000000000 ",
+ "sourceMap": "794:3556:3:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3144:1204;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3144:1204:3;;;;;;;;;;;882:46;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;882:46:3;;;;;;;;;;;;;;;;;;;;;;;;;91:20:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;91:20:82;;;;;;;;;;;;2217:278:3;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2217:278:3;;;;;;;;;1563:176;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1563:176:3;;;;;;;;;333:167:82;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:167:82;;;;;;;;;3144:1204:3;3368:10;3970:17;3553:9;3537:25;;3459:143;;;;;;;;;;;;;;;;;;;;;;3695:18;;3681:33;;;;;;:13;:33;;;;;;;;3660:101;;;;;;;;;;;;;;;;3840:27;;;;;;;:13;:27;;;;;;;;3819:95;;;;;;;;;;;;;;;;3990:154;;4026:27;;3990:154;;4067:5;;4086:20;;4120:14;;3990:154;;;;;;;;22:32:-1;26:21;;;22:32;6:49;;3990:154:3;;;49:4:-1;25:18;;61:17;;3990:154:3;182:15:-1;3990:154:3;;;;179:29:-1;;;;160:49;;;4209:8:3;;:132;;;;;3990:154;;-1:-1:-1;4209:8:3;;;;;:27;;:132;;4250:4;;4268:12;;3990:154;;4312:19;;4209:132;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;4209:132:3;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;4209:132:3;;;;3144:1204;;;;;;:::o;882:46::-;;;;;;;;;;;;;;;:::o;91:20:82:-;;;;;;:::o;2217:278:3:-;2462:26;;;2479:9;2462:26;2217:278;;;;;;:::o;1563:176::-;259:5:82;;;;245:10;:19;224:85;;;;;;;;;;;;;;1698:21:3;;;;;;;;;:13;:21;;;;;:34;;;;;;;;;;;;;1563:176::o;333:167:82:-;259:5;;;;245:10;:19;224:85;;;;;;;;;;;;;;429:22;;;;425:69;;467:5;:16;;;;;;;;;;425:69;333:167;:::o;5:118:-1:-;;72:46;110:6;97:20;72:46;;;63:55;57:66;-1:-1;;;57:66;130:112;;194:43;229:6;216:20;194:43;;249:118;;316:46;354:6;341:20;316:46;;388:335;;;495:4;483:17;;479:27;-1:-1;469:2;;520:1;517;510:12;469:2;-1:-1;540:20;;580:18;569:30;;566:2;;;612:1;609;602:12;566:2;646:4;638:6;634:17;622:29;;696:3;689;681:6;677:16;667:8;663:31;660:40;657:2;;;713:1;710;703:12;657:2;462:261;;;;;;732:432;;822:4;810:17;;806:27;-1:-1;796:2;;847:1;844;837:12;796:2;884:6;871:20;906:60;921:44;958:6;921:44;;;906:60;;;897:69;;986:6;979:5;972:21;1022:4;1014:6;1010:17;1055:4;1048:5;1044:16;1090:3;1081:6;1076:3;1072:16;1069:25;1066:2;;;1107:1;1104;1097:12;1066:2;1117:41;1151:6;1146:3;1141;1117:41;;;789:375;;;;;;;;1649:2209;;1761:5;1749:9;1744:3;1740:19;1736:31;1733:2;;;1780:1;1777;1770:12;1733:2;1798:21;1813:5;1798:21;;;1789:30;-1:-1;1877:1;1908:49;1953:3;1933:9;1908:49;;;1884:74;;-1:-1;2027:2;2060:49;2105:3;2081:22;;;2060:49;;;2053:4;2046:5;2042:16;2035:75;1979:142;2186:2;2219:49;2264:3;2255:6;2244:9;2240:22;2219:49;;;2212:4;2205:5;2201:16;2194:75;2131:149;2339:2;2372:49;2417:3;2408:6;2397:9;2393:22;2372:49;;;2365:4;2358:5;2354:16;2347:75;2290:143;2495:3;2529:49;2574:3;2565:6;2554:9;2550:22;2529:49;;;2522:4;2515:5;2511:16;2504:75;2443:147;2652:3;2686:49;2731:3;2722:6;2711:9;2707:22;2686:49;;;2679:4;2672:5;2668:16;2661:75;2600:147;2801:3;2835:49;2880:3;2871:6;2860:9;2856:22;2835:49;;;2828:4;2821:5;2817:16;2810:75;2757:139;2950:3;2984:49;3029:3;3020:6;3009:9;3005:22;2984:49;;;2977:4;2970:5;2966:16;2959:75;2906:139;3112:3;3147:49;3192:3;3183:6;3172:9;3168:22;3147:49;;;3139:5;3132;3128:17;3121:76;3055:153;3258:3;3293:49;3338:3;3329:6;3318:9;3314:22;3293:49;;;3285:5;3278;3274:17;3267:76;3218:136;3442:3;3431:9;3427:19;3414:33;3467:18;3459:6;3456:30;3453:2;;;3499:1;3496;3489:12;3453:2;3535:54;3585:3;3576:6;3565:9;3561:22;3535:54;;;3527:5;3520;3516:17;3509:81;3364:237;3689:3;3678:9;3674:19;3661:33;3714:18;3706:6;3703:30;3700:2;;;3746:1;3743;3736:12;3700:2;3782:54;3832:3;3823:6;3812:9;3808:22;3782:54;;;3774:5;3767;3763:17;3756:81;3611:237;1727:2131;;;;;3990:241;;4094:2;4082:9;4073:7;4069:23;4065:32;4062:2;;;4110:1;4107;4100:12;4062:2;4145:1;4162:53;4207:7;4187:9;4162:53;;;4152:63;4056:175;-1:-1;;;;4056:175;4238:360;;;4356:2;4344:9;4335:7;4331:23;4327:32;4324:2;;;4372:1;4369;4362:12;4324:2;4407:1;4424:53;4469:7;4449:9;4424:53;;;4414:63;;4386:97;4514:2;4532:50;4574:7;4565:6;4554:9;4550:22;4532:50;;;4522:60;;4493:95;4318:280;;;;;;4605:615;;;;;4762:2;4750:9;4741:7;4737:23;4733:32;4730:2;;;4778:1;4775;4768:12;4730:2;4813:1;4830:53;4875:7;4855:9;4830:53;;;4820:63;;4792:97;4920:2;4938:53;4983:7;4974:6;4963:9;4959:22;4938:53;;;4928:63;;4899:98;5056:2;5045:9;5041:18;5028:32;5080:18;5072:6;5069:30;5066:2;;;5112:1;5109;5102:12;5066:2;5140:64;5196:7;5187:6;5176:9;5172:22;5140:64;;;4724:496;;;;-1:-1;5122:82;-1:-1;;;;4724:496;5227:853;;;;;5414:3;5402:9;5393:7;5389:23;5385:33;5382:2;;;5431:1;5428;5421:12;5382:2;5466:31;;5517:18;5506:30;;5503:2;;;5549:1;5546;5539:12;5503:2;5569:76;5637:7;5628:6;5617:9;5613:22;5569:76;;;5559:86;;5445:206;5682:2;5700:53;5745:7;5736:6;5725:9;5721:22;5700:53;;;5690:63;;5661:98;5790:2;5808:53;5853:7;5844:6;5833:9;5829:22;5808:53;;;5798:63;;5769:98;5926:2;5915:9;5911:18;5898:32;5950:18;5942:6;5939:30;5936:2;;;5982:1;5979;5972:12;5936:2;6002:62;6056:7;6047:6;6036:9;6032:22;6002:62;;;5992:72;;5877:193;5376:704;;;;;;;;6087:110;6160:31;6185:5;6160:31;;;6155:3;6148:44;6142:55;;;6204:101;6271:28;6293:5;6271:28;;6312:297;;6412:38;6444:5;6412:38;;;6467:6;6462:3;6455:19;6479:63;6535:6;6528:4;6523:3;6519:14;6512:4;6505:5;6501:16;6479:63;;;6574:29;6596:6;6574:29;;;6554:50;;;6567:4;6554:50;;6392:217;-1:-1;;;6392:217;6935:731;;7042:5;7036:12;7076:1;7065:9;7061:17;7089:1;7084:200;;;;7295:1;7290:370;;;;7054:606;;7084:200;7158:1;7143:17;;7162:4;7139:28;7174:19;;7238:9;7223:25;;7216:4;7207:14;;7200:49;7272:4;7263:14;;;-1:-1;7084:200;;7290:370;7359:1;7348:9;7344:17;7380:6;7375:3;7368:19;7410:4;7405:3;7401:14;7394:21;;7437:37;7468:5;7437:37;;;7490:1;7498:130;7512:6;7509:1;7506:13;7498:130;;;7571:14;;7558:11;;;7551:35;7618:1;7605:15;;;;7534:4;7527:12;7498:130;;;7642:11;;;-1:-1;;;7054:606;;7012:654;;;;;;7675:296;7830:2;7818:15;;7867:66;7862:2;7853:12;;7846:88;7962:2;7953:12;;7811:160;7980:296;8135:2;8123:15;;8172:66;8167:2;8158:12;;8151:88;8267:2;8258:12;;8116:160;8285:296;8440:2;8428:15;;8477:66;8472:2;8463:12;;8456:88;8572:2;8563:12;;8421:160;8590:296;8745:2;8733:15;;8782:66;8777:2;8768:12;;8761:88;8877:2;8868:12;;8726:160;8947:2419;9162:22;;8947:2419;;9084:5;9075:15;;;9196:61;9079:3;9162:22;9196:61;;;9105:164;9353:4;9346:5;9342:16;9336:23;9371:62;9427:4;9422:3;9418:14;9405:11;9371:62;;;9279:166;9536:4;9529:5;9525:16;9519:23;9554:62;9610:4;9605:3;9601:14;9588:11;9554:62;;;9455:173;9713:4;9706:5;9702:16;9696:23;9731:62;9787:4;9782:3;9778:14;9765:11;9731:62;;;9638:167;9893:4;9886:5;9882:16;9876:23;9911:62;9967:4;9962:3;9958:14;9945:11;9911:62;;;9815:170;10073:4;10066:5;10062:16;10056:23;10091:62;10147:4;10142:3;10138:14;10125:11;10091:62;;;9995:170;10245:4;10238:5;10234:16;10228:23;10263:62;10319:4;10314:3;10310:14;10297:11;10263:62;;;10175:162;10417:4;10410:5;10406:16;10400:23;10435:62;10491:4;10486:3;10482:14;10469:11;10435:62;;;10347:162;10602:5;10595;10591:17;10585:24;10621:63;10677:5;10672:3;10668:15;10655:11;10621:63;;;10519:177;10772:5;10765;10761:17;10755:24;10791:63;10847:5;10842:3;10838:15;10825:11;10791:63;;;10706:160;10952:5;10945;10941:17;10935:24;11005:3;10999:4;10995:14;10987:5;10982:3;10978:15;10971:39;11025:66;11086:4;11073:11;11025:66;;;11017:74;;10876:227;11189:5;11182;11178:17;11172:24;11242:3;11236:4;11232:14;11224:5;11219:3;11215:15;11208:39;11262:66;11323:4;11310:11;11262:66;;;11254:74;9057:2309;-1:-1;;;;;9057:2309;11373:110;11446:31;11471:5;11446:31;;11490:193;11598:2;11583:18;;11612:61;11587:9;11646:6;11612:61;;;11569:114;;;;;11690:181;11792:2;11777:18;;11806:55;11781:9;11834:6;11806:55;;11878:387;12059:2;12073:47;;;12044:18;;12134:121;12044:18;12134:121;;12272:387;12453:2;12467:47;;;12438:18;;12528:121;12438:18;12528:121;;12666:387;12847:2;12861:47;;;12832:18;;12922:121;12832:18;12922:121;;13060:387;13241:2;13255:47;;;13226:18;;13316:121;13226:18;13316:121;;13454:619;13682:2;13696:47;;;13667:18;;13757:94;13667:18;13837:6;13757:94;;;13749:102;;13862:62;13920:2;13909:9;13905:18;13896:6;13862:62;;;13972:9;13966:4;13962:20;13957:2;13946:9;13942:18;13935:48;13997:66;14058:4;14049:6;13997:66;;14080:659;14305:3;14290:19;;14320:61;14294:9;14354:6;14320:61;;;14392:62;14450:2;14439:9;14435:18;14426:6;14392:62;;;14502:9;14496:4;14492:20;14487:2;14476:9;14472:18;14465:48;14527:66;14588:4;14579:6;14527:66;;;14519:74;;14641:9;14635:4;14631:20;14626:2;14615:9;14611:18;14604:48;14666:63;14724:4;14715:6;14666:63;;;14658:71;14276:463;-1:-1;;;;;;14276:463;14746:256;14808:2;14802:9;14834:17;;;14909:18;14894:34;;14930:22;;;14891:62;14888:2;;;14966:1;14963;14956:12;14888:2;14982;14975:22;14786:216;;-1:-1;14786:216;15009:254;;15148:18;15140:6;15137:30;15134:2;;;15180:1;15177;15170:12;15134:2;-1:-1;15253:4;15224;15201:17;;;;15220:9;15197:33;15243:15;;15071:192;15537:125;;15603:15;;;15650:4;15637:18;;;15595:67;15671:87;15741:12;;15725:33;15863:128;15943:42;15932:54;;15915:76;15998:92;16071:13;16064:21;;16047:43;16097:79;16166:5;16149:27;16590:145;16671:6;16666:3;16661;16648:30;-1:-1;16727:1;16709:16;;16702:27;16641:94;16744:268;16809:1;16816:101;16830:6;16827:1;16824:13;16816:101;;;16897:11;;;16891:18;16878:11;;;16871:39;16852:2;16845:10;16816:101;;;16932:6;16929:1;16926:13;16923:2;;;16997:1;16988:6;16983:3;16979:16;16972:27;16923:2;16793:219;;;;;17020:97;17108:2;17088:14;17104:7;17084:28;;17068:49"
+ }
+ }
+ },
+ "sources": {
+ "examples/Whitelist/Whitelist.sol": {
+ "id": 3
+ },
+ "protocol/Exchange/interfaces/IExchange.sol": {
+ "id": 34
+ },
+ "protocol/Exchange/interfaces/IExchangeCore.sol": {
+ "id": 35
+ },
+ "protocol/Exchange/libs/LibOrder.sol": {
+ "id": 48
+ },
+ "protocol/Exchange/libs/LibEIP712.sol": {
+ "id": 44
+ },
+ "protocol/Exchange/libs/LibFillResults.sol": {
+ "id": 46
+ },
+ "utils/SafeMath/SafeMath.sol": {
+ "id": 84
+ },
+ "protocol/Exchange/interfaces/IMatchOrders.sol": {
+ "id": 36
+ },
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": {
+ "id": 37
+ },
+ "protocol/Exchange/interfaces/ITransactions.sol": {
+ "id": 38
+ },
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": {
+ "id": 33
+ },
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": {
+ "id": 41
+ },
+ "utils/Ownable/Ownable.sol": {
+ "id": 82
+ },
+ "utils/Ownable/IOwnable.sol": {
+ "id": 81
+ }
+ },
+ "sourceCodes": {
+ "examples/Whitelist/Whitelist.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../../protocol/Exchange/interfaces/IExchange.sol\";\nimport \"../../protocol/Exchange/libs/LibOrder.sol\";\nimport \"../../utils/Ownable/Ownable.sol\";\n\n\ncontract Whitelist is\n Ownable\n{\n\n // Mapping of address => whitelist status.\n mapping (address => bool) public isWhitelisted;\n\n // Exchange contract.\n // solhint-disable var-name-mixedcase\n IExchange internal EXCHANGE;\n bytes internal TX_ORIGIN_SIGNATURE;\n // solhint-enable var-name-mixedcase\n\n byte constant internal VALIDATOR_SIGNATURE_BYTE = \"\\x05\";\n\n constructor (address _exchange)\n public\n {\n EXCHANGE = IExchange(_exchange);\n TX_ORIGIN_SIGNATURE = abi.encodePacked(address(this), VALIDATOR_SIGNATURE_BYTE);\n }\n\n /// @dev Adds or removes an address from the whitelist.\n /// @param target Address to add or remove from whitelist.\n /// @param isApproved Whitelist status to assign to address.\n function updateWhitelistStatus(\n address target,\n bool isApproved\n )\n external\n onlyOwner\n {\n isWhitelisted[target] = isApproved;\n }\n\n /// @dev Verifies signer is same as signer of current Ethereum transaction.\n /// NOTE: This function can currently be used to validate signatures coming from outside of this contract.\n /// Extra safety checks can be added for a production contract.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n // solhint-disable no-unused-vars\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external\n view\n returns (bool isValid)\n {\n // solhint-disable-next-line avoid-tx-origin\n return signerAddress == tx.origin;\n }\n // solhint-enable no-unused-vars\n\n /// @dev Fills an order using `msg.sender` as the taker.\n /// The transaction will revert if both the maker and taker are not whitelisted.\n /// Orders should specify this contract as the `senderAddress` in order to gaurantee\n /// that both maker and taker have been whitelisted.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param salt Arbitrary value to gaurantee uniqueness of 0x transaction hash.\n /// @param orderSignature Proof that order has been created by maker.\n function fillOrderIfWhitelisted(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n uint256 salt,\n bytes memory orderSignature\n )\n public\n {\n address takerAddress = msg.sender;\n\n // This contract must be the entry point for the transaction.\n require(\n // solhint-disable-next-line avoid-tx-origin\n takerAddress == tx.origin,\n \"INVALID_SENDER\"\n );\n\n // Check if maker is on the whitelist.\n require(\n isWhitelisted[order.makerAddress],\n \"MAKER_NOT_WHITELISTED\"\n );\n\n // Check if taker is on the whitelist.\n require(\n isWhitelisted[takerAddress],\n \"TAKER_NOT_WHITELISTED\"\n );\n\n // Encode arguments into byte array.\n bytes memory data = abi.encodeWithSelector(\n EXCHANGE.fillOrder.selector,\n order,\n takerAssetFillAmount,\n orderSignature\n );\n\n // Call `fillOrder` via `executeTransaction`.\n EXCHANGE.executeTransaction(\n salt,\n takerAddress,\n data,\n TX_ORIGIN_SIGNATURE\n );\n }\n}\n",
+ "protocol/Exchange/interfaces/IExchange.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"./IExchangeCore.sol\";\nimport \"./IMatchOrders.sol\";\nimport \"./ISignatureValidator.sol\";\nimport \"./ITransactions.sol\";\nimport \"./IAssetProxyDispatcher.sol\";\nimport \"./IWrapperFunctions.sol\";\n\n\n// solhint-disable no-empty-blocks\ncontract IExchange is\n IExchangeCore,\n IMatchOrders,\n ISignatureValidator,\n ITransactions,\n IAssetProxyDispatcher,\n IWrapperFunctions\n{}\n",
+ "protocol/Exchange/interfaces/IExchangeCore.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IExchangeCore {\n\n /// @dev Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch\n /// and senderAddress equal to msg.sender (or null address if msg.sender == makerAddress).\n /// @param targetOrderEpoch Orders created with a salt less or equal to this value will be cancelled.\n function cancelOrdersUpTo(uint256 targetOrderEpoch)\n external;\n\n /// @dev Fills the input order.\n /// @param order Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev After calling, the order can not be filled anymore.\n /// @param order Order struct containing order specifications.\n function cancelOrder(LibOrder.Order memory order)\n public;\n\n /// @dev Gets information about an order: status, hash, and amount filled.\n /// @param order Order to gather information on.\n /// @return OrderInfo Information about the order and its state.\n /// See LibOrder.OrderInfo for a complete description.\n function getOrderInfo(LibOrder.Order memory order)\n public\n view\n returns (LibOrder.OrderInfo memory orderInfo);\n}\n",
+ "protocol/Exchange/libs/LibOrder.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"./LibEIP712.sol\";\n\n\ncontract LibOrder is\n LibEIP712\n{\n // Hash for the EIP712 Order Schema\n bytes32 constant internal EIP712_ORDER_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"Order(\",\n \"address makerAddress,\",\n \"address takerAddress,\",\n \"address feeRecipientAddress,\",\n \"address senderAddress,\",\n \"uint256 makerAssetAmount,\",\n \"uint256 takerAssetAmount,\",\n \"uint256 makerFee,\",\n \"uint256 takerFee,\",\n \"uint256 expirationTimeSeconds,\",\n \"uint256 salt,\",\n \"bytes makerAssetData,\",\n \"bytes takerAssetData\",\n \")\"\n ));\n\n // A valid order remains fillable until it is expired, fully filled, or cancelled.\n // An order's state is unaffected by external factors, like account balances.\n enum OrderStatus {\n INVALID, // Default value\n INVALID_MAKER_ASSET_AMOUNT, // Order does not have a valid maker asset amount\n INVALID_TAKER_ASSET_AMOUNT, // Order does not have a valid taker asset amount\n FILLABLE, // Order is fillable\n EXPIRED, // Order has already expired\n FULLY_FILLED, // Order is fully filled\n CANCELLED // Order has been cancelled\n }\n\n // solhint-disable max-line-length\n struct Order {\n address makerAddress; // Address that created the order. \n address takerAddress; // Address that is allowed to fill the order. If set to 0, any address is allowed to fill the order. \n address feeRecipientAddress; // Address that will recieve fees when order is filled. \n address senderAddress; // Address that is allowed to call Exchange contract methods that affect this order. If set to 0, any address is allowed to call these methods.\n uint256 makerAssetAmount; // Amount of makerAsset being offered by maker. Must be greater than 0. \n uint256 takerAssetAmount; // Amount of takerAsset being bid on by maker. Must be greater than 0. \n uint256 makerFee; // Amount of ZRX paid to feeRecipient by maker when order is filled. If set to 0, no transfer of ZRX from maker to feeRecipient will be attempted.\n uint256 takerFee; // Amount of ZRX paid to feeRecipient by taker when order is filled. If set to 0, no transfer of ZRX from taker to feeRecipient will be attempted.\n uint256 expirationTimeSeconds; // Timestamp in seconds at which order expires. \n uint256 salt; // Arbitrary number to facilitate uniqueness of the order's hash. \n bytes makerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring makerAsset. The last byte references the id of this proxy.\n bytes takerAssetData; // Encoded data that can be decoded by a specified proxy contract when transferring takerAsset. The last byte references the id of this proxy.\n }\n // solhint-enable max-line-length\n\n struct OrderInfo {\n uint8 orderStatus; // Status that describes order's validity and fillability.\n bytes32 orderHash; // EIP712 hash of the order (see LibOrder.getOrderHash).\n uint256 orderTakerAssetFilledAmount; // Amount of order that has already been filled.\n }\n\n /// @dev Calculates Keccak-256 hash of the order.\n /// @param order The order structure.\n /// @return Keccak-256 EIP712 hash of the order.\n function getOrderHash(Order memory order)\n internal\n view\n returns (bytes32 orderHash)\n {\n orderHash = hashEIP712Message(hashOrder(order));\n return orderHash;\n }\n\n /// @dev Calculates EIP712 hash of the order.\n /// @param order The order structure.\n /// @return EIP712 hash of the order.\n function hashOrder(Order memory order)\n internal\n pure\n returns (bytes32 result)\n {\n bytes32 schemaHash = EIP712_ORDER_SCHEMA_HASH;\n bytes32 makerAssetDataHash = keccak256(order.makerAssetData);\n bytes32 takerAssetDataHash = keccak256(order.takerAssetData);\n\n // Assembly for more efficiently computing:\n // keccak256(abi.encodePacked(\n // EIP712_ORDER_SCHEMA_HASH,\n // bytes32(order.makerAddress),\n // bytes32(order.takerAddress),\n // bytes32(order.feeRecipientAddress),\n // bytes32(order.senderAddress),\n // order.makerAssetAmount,\n // order.takerAssetAmount,\n // order.makerFee,\n // order.takerFee,\n // order.expirationTimeSeconds,\n // order.salt,\n // keccak256(order.makerAssetData),\n // keccak256(order.takerAssetData)\n // ));\n\n assembly {\n // Calculate memory addresses that will be swapped out before hashing\n let pos1 := sub(order, 32)\n let pos2 := add(order, 320)\n let pos3 := add(order, 352)\n\n // Backup\n let temp1 := mload(pos1)\n let temp2 := mload(pos2)\n let temp3 := mload(pos3)\n \n // Hash in place\n mstore(pos1, schemaHash)\n mstore(pos2, makerAssetDataHash)\n mstore(pos3, takerAssetDataHash)\n result := keccak256(pos1, 416)\n \n // Restore\n mstore(pos1, temp1)\n mstore(pos2, temp2)\n mstore(pos3, temp3)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibEIP712.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract LibEIP712 {\n\n // EIP191 header for EIP712 prefix\n string constant internal EIP191_HEADER = \"\\x19\\x01\";\n\n // EIP712 Domain Name value\n string constant internal EIP712_DOMAIN_NAME = \"0x Protocol\";\n\n // EIP712 Domain Version value\n string constant internal EIP712_DOMAIN_VERSION = \"2\";\n\n // Hash of the EIP712 Domain Separator Schema\n bytes32 constant internal EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH = keccak256(abi.encodePacked(\n \"EIP712Domain(\",\n \"string name,\",\n \"string version,\",\n \"address verifyingContract\",\n \")\"\n ));\n\n // Hash of the EIP712 Domain Separator data\n // solhint-disable-next-line var-name-mixedcase\n bytes32 public EIP712_DOMAIN_HASH;\n\n constructor ()\n public\n {\n EIP712_DOMAIN_HASH = keccak256(abi.encodePacked(\n EIP712_DOMAIN_SEPARATOR_SCHEMA_HASH,\n keccak256(bytes(EIP712_DOMAIN_NAME)),\n keccak256(bytes(EIP712_DOMAIN_VERSION)),\n bytes32(address(this))\n ));\n }\n\n /// @dev Calculates EIP712 encoding for a hash struct in this EIP712 Domain.\n /// @param hashStruct The EIP712 hash struct.\n /// @return EIP712 hash applied to this EIP712 Domain.\n function hashEIP712Message(bytes32 hashStruct)\n internal\n view\n returns (bytes32 result)\n {\n bytes32 eip712DomainHash = EIP712_DOMAIN_HASH;\n\n // Assembly for more efficient computing:\n // keccak256(abi.encodePacked(\n // EIP191_HEADER,\n // EIP712_DOMAIN_HASH,\n // hashStruct \n // ));\n\n assembly {\n // Load free memory pointer\n let memPtr := mload(64)\n\n mstore(memPtr, 0x1901000000000000000000000000000000000000000000000000000000000000) // EIP191 header\n mstore(add(memPtr, 2), eip712DomainHash) // EIP712 domain hash\n mstore(add(memPtr, 34), hashStruct) // Hash of struct\n\n // Compute hash\n result := keccak256(memPtr, 66)\n }\n return result;\n }\n}\n",
+ "protocol/Exchange/libs/LibFillResults.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\nimport \"../../../utils/SafeMath/SafeMath.sol\";\n\n\ncontract LibFillResults is\n SafeMath\n{\n struct FillResults {\n uint256 makerAssetFilledAmount; // Total amount of makerAsset(s) filled.\n uint256 takerAssetFilledAmount; // Total amount of takerAsset(s) filled.\n uint256 makerFeePaid; // Total amount of ZRX paid by maker(s) to feeRecipient(s).\n uint256 takerFeePaid; // Total amount of ZRX paid by taker to feeRecipients(s).\n }\n\n struct MatchedFillResults {\n FillResults left; // Amounts filled and fees paid of left order.\n FillResults right; // Amounts filled and fees paid of right order.\n uint256 leftMakerAssetSpreadAmount; // Spread between price of left and right order, denominated in the left order's makerAsset, paid to taker.\n }\n\n /// @dev Adds properties of both FillResults instances.\n /// Modifies the first FillResults instance specified.\n /// @param totalFillResults Fill results instance that will be added onto.\n /// @param singleFillResults Fill results instance that will be added to totalFillResults.\n function addFillResults(FillResults memory totalFillResults, FillResults memory singleFillResults)\n internal\n pure\n {\n totalFillResults.makerAssetFilledAmount = safeAdd(totalFillResults.makerAssetFilledAmount, singleFillResults.makerAssetFilledAmount);\n totalFillResults.takerAssetFilledAmount = safeAdd(totalFillResults.takerAssetFilledAmount, singleFillResults.takerAssetFilledAmount);\n totalFillResults.makerFeePaid = safeAdd(totalFillResults.makerFeePaid, singleFillResults.makerFeePaid);\n totalFillResults.takerFeePaid = safeAdd(totalFillResults.takerFeePaid, singleFillResults.takerFeePaid);\n }\n}\n",
+ "utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n require(\n c / a == b,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n require(\n b <= a,\n \"UINT256_UNDERFLOW\"\n );\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n require(\n c >= a,\n \"UINT256_OVERFLOW\"\n );\n return c;\n }\n\n function max64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min64(uint64 a, uint64 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n}\n",
+ "protocol/Exchange/interfaces/IMatchOrders.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IMatchOrders {\n\n /// @dev Match two complementary orders that have a profitable spread.\n /// Each order is filled at their respective price point. However, the calculations are\n /// carried out as though the orders are both being filled at the right order's price point.\n /// The profit made by the left order goes to the taker (who matched the two orders).\n /// @param leftOrder First order to match.\n /// @param rightOrder Second order to match.\n /// @param leftSignature Proof that order was created by the left maker.\n /// @param rightSignature Proof that order was created by the right maker.\n /// @return matchedFillResults Amounts filled and fees paid by maker and taker of matched orders.\n function matchOrders(\n LibOrder.Order memory leftOrder,\n LibOrder.Order memory rightOrder,\n bytes memory leftSignature,\n bytes memory rightSignature\n )\n public\n returns (LibFillResults.MatchedFillResults memory matchedFillResults);\n}\n",
+ "protocol/Exchange/interfaces/ISignatureValidator.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract ISignatureValidator {\n\n /// @dev Approves a hash on-chain using any valid signature type.\n /// After presigning a hash, the preSign signature type will become valid for that hash and signer.\n /// @param signerAddress Address that should have signed the given hash.\n /// @param signature Proof that the hash has been signed by signer.\n function preSign(\n bytes32 hash,\n address signerAddress,\n bytes signature\n )\n external;\n \n /// @dev Approves/unnapproves a Validator contract to verify signatures on signer's behalf.\n /// @param validatorAddress Address of Validator contract.\n /// @param approval Approval or disapproval of Validator contract.\n function setSignatureValidatorApproval(\n address validatorAddress,\n bool approval\n )\n external;\n\n /// @dev Verifies that a signature is valid.\n /// @param hash Message hash that is signed.\n /// @param signerAddress Address of signer.\n /// @param signature Proof of signing.\n /// @return Validity of order signature.\n function isValidSignature(\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n public\n view\n returns (bool isValid);\n}\n",
+ "protocol/Exchange/interfaces/ITransactions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\npragma solidity 0.4.24;\n\n\ncontract ITransactions {\n\n /// @dev Executes an exchange method call in the context of signer.\n /// @param salt Arbitrary number to ensure uniqueness of transaction hash.\n /// @param signerAddress Address of transaction signer.\n /// @param data AbiV2 encoded calldata.\n /// @param signature Proof of signer transaction by signer.\n function executeTransaction(\n uint256 salt,\n address signerAddress,\n bytes data,\n bytes signature\n )\n external;\n}\n",
+ "protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\n\n\ncontract IAssetProxyDispatcher {\n\n /// @dev Registers an asset proxy to its asset proxy id.\n /// Once an asset proxy is registered, it cannot be unregistered.\n /// @param assetProxy Address of new asset proxy to register.\n function registerAssetProxy(address assetProxy)\n external;\n\n /// @dev Gets an asset proxy.\n /// @param assetProxyId Id of the asset proxy.\n /// @return The asset proxy registered to assetProxyId. Returns 0x0 if no proxy is registered.\n function getAssetProxy(bytes4 assetProxyId)\n external\n view\n returns (address);\n}\n",
+ "protocol/Exchange/interfaces/IWrapperFunctions.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.24;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibOrder.sol\";\nimport \"../libs/LibFillResults.sol\";\n\n\ncontract IWrapperFunctions {\n\n /// @dev Fills the input order. Reverts if exact takerAssetFillAmount not filled.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n function fillOrKillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param order LibOrder.Order struct containing order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signature Proof that order has been created by maker.\n /// @return Amounts filled and fees paid by maker and taker.\n function fillOrderNoThrow(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (LibFillResults.FillResults memory fillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrKill.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrKillOrders(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Fills an order with specified parameters and ECDSA signature.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell in orders.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function batchFillOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256[] memory takerAssetFillAmounts,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been created by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrders(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of takerAsset is sold by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param takerAssetFillAmount Desired amount of takerAsset to sell.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketSellOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 takerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple calls of fillOrder until total amount of makerAsset is bought by taker.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrders(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously executes multiple fill orders in a single transaction until total amount is bought by taker.\n /// Returns false if the transaction would otherwise revert.\n /// @param orders Array of order specifications.\n /// @param makerAssetFillAmount Desired amount of makerAsset to buy.\n /// @param signatures Proofs that orders have been signed by makers.\n /// @return Amounts filled and fees paid by makers and taker.\n function marketBuyOrdersNoThrow(\n LibOrder.Order[] memory orders,\n uint256 makerAssetFillAmount,\n bytes[] memory signatures\n )\n public\n returns (LibFillResults.FillResults memory totalFillResults);\n\n /// @dev Synchronously cancels multiple orders in a single transaction.\n /// @param orders Array of order specifications.\n function batchCancelOrders(LibOrder.Order[] memory orders)\n public;\n\n /// @dev Fetches information for all passed in orders\n /// @param orders Array of order specifications.\n /// @return Array of OrderInfo instances that correspond to each order.\n function getOrdersInfo(LibOrder.Order[] memory orders)\n public\n view\n returns (LibOrder.OrderInfo[] memory);\n}\n",
+ "utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is\n IOwnable\n{\n address public owner;\n\n constructor ()\n public\n {\n owner = msg.sender;\n }\n\n modifier onlyOwner() {\n require(\n msg.sender == owner,\n \"ONLY_CONTRACT_OWNER\"\n );\n _;\n }\n\n function transferOwnership(address newOwner)\n public\n onlyOwner\n {\n if (newOwner != address(0)) {\n owner = newOwner;\n }\n }\n}\n",
+ "utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n\ncontract IOwnable {\n\n function transferOwnership(address newOwner)\n public;\n}\n"
+ },
+ "sourceTreeHashHex": "0xd24784ad0067227ddd0326b14d378436c1c68d56b5fdbed6a3c543e455560d74",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.24+commit.e67f0147.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-artifacts/ZRXToken.json b/packages/contracts/generated-artifacts/ZRXToken.json
new file mode 100644
index 000000000..b09df4cd5
--- /dev/null
+++ b/packages/contracts/generated-artifacts/ZRXToken.json
@@ -0,0 +1,6201 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "ZRXToken",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "name",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "approve",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "totalSupply",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transferFrom",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "decimals",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint8"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ }
+ ],
+ "name": "balanceOf",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "symbol",
+ "outputs": [
+ {
+ "name": "",
+ "type": "string"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "transfer",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "name": "_spender",
+ "type": "address"
+ }
+ ],
+ "name": "allowance",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "payable": false,
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_from",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Transfer",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "_owner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "_spender",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "_value",
+ "type": "uint256"
+ }
+ ],
+ "name": "Approval",
+ "type": "event"
+ }
+ ],
+ "devdoc": {
+ "methods": {
+ "transferFrom(address,address,uint256)": {
+ "details": "ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.",
+ "params": {
+ "_from": "Address to transfer from.",
+ "_to": "Address to transfer to.",
+ "_value": "Amount to transfer."
+ },
+ "return": "Success of transfer."
+ }
+ }
+ },
+ "evm": {
+ "assembly": " /* \"tokens/ZRXToken/ZRXToken.sol\":758:1213 contract ZRXToken is ... */\n mstore(0x40, 0x60)\n /* \"tokens/ZRXToken/ZRXToken.sol\":929:935 10**27 */\n 0x33b2e3c9fd0803ce8000000\n /* \"tokens/ZRXToken/ZRXToken.sol\":900:935 uint256 public totalSupply = 10**27 */\n 0x3\n sstore\n /* \"tokens/ZRXToken/ZRXToken.sol\":1121:1211 function ZRXToken()... */\n jumpi(tag_1, iszero(callvalue))\n invalid\ntag_1:\ntag_2:\n /* \"tokens/ZRXToken/ZRXToken.sol\":1193:1204 totalSupply */\n sload(0x3)\n sub(exp(0x2, 0xa0), 0x1)\n /* \"tokens/ZRXToken/ZRXToken.sol\":1179:1189 msg.sender */\n caller\n /* \"tokens/ZRXToken/ZRXToken.sol\":1170:1190 balances[msg.sender] */\n and\n /* \"tokens/ZRXToken/ZRXToken.sol\":1170:1178 balances */\n 0x0\n /* \"tokens/ZRXToken/ZRXToken.sol\":1170:1190 balances[msg.sender] */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n swap1\n sha3\n /* \"tokens/ZRXToken/ZRXToken.sol\":1170:1204 balances[msg.sender] = totalSupply */\n sstore\n /* \"tokens/ZRXToken/ZRXToken.sol\":1121:1211 function ZRXToken()... */\ntag_3:\n /* \"tokens/ZRXToken/ZRXToken.sol\":758:1213 contract ZRXToken is ... */\ntag_4:\n dataSize(sub_0)\n dup1\n dataOffset(sub_0)\n 0x0\n codecopy\n 0x0\n return\nstop\n\nsub_0: assembly {\n /* \"tokens/ZRXToken/ZRXToken.sol\":758:1213 contract ZRXToken is ... */\n mstore(0x40, 0x60)\n jumpi(tag_1, iszero(calldatasize))\n and(div(calldataload(0x0), 0x100000000000000000000000000000000000000000000000000000000), 0xffffffff)\n 0x6fdde03\n dup2\n eq\n tag_2\n jumpi\n dup1\n 0x95ea7b3\n eq\n tag_3\n jumpi\n dup1\n 0x18160ddd\n eq\n tag_4\n jumpi\n dup1\n 0x23b872dd\n eq\n tag_5\n jumpi\n dup1\n 0x313ce567\n eq\n tag_6\n jumpi\n dup1\n 0x70a08231\n eq\n tag_7\n jumpi\n dup1\n 0x95d89b41\n eq\n tag_8\n jumpi\n dup1\n 0xa9059cbb\n eq\n tag_9\n jumpi\n dup1\n 0xdd62ed3e\n eq\n tag_10\n jumpi\n tag_1:\n invalid\n /* \"tokens/ZRXToken/ZRXToken.sol\":980:1029 string constant public name = \"0x Protocol Token\" */\n tag_2:\n jumpi(tag_11, iszero(callvalue))\n invalid\n tag_11:\n tag_12\n jump(tag_13)\n tag_12:\n 0x40\n dup1\n mload\n 0x20\n dup1\n dup3\n mstore\n dup4\n mload\n dup2\n dup4\n add\n mstore\n dup4\n mload\n swap2\n swap3\n dup4\n swap3\n swap1\n dup4\n add\n swap2\n dup6\n add\n swap1\n dup1\n dup4\n dup4\n /* \"--CODEGEN--\":18:20 */\n dup3\n iszero\n /* \"--CODEGEN--\":13:16 */\n tag_14\n /* \"--CODEGEN--\":7:12 */\n jumpi\n /* \"--CODEGEN--\":32:37 */\n tag_15:\n /* \"--CODEGEN--\":59:62 */\n dup1\n /* \"--CODEGEN--\":53:58 */\n mload\n /* \"--CODEGEN--\":48:51 */\n dup3\n /* \"--CODEGEN--\":41:47 */\n mstore\n /* \"--CODEGEN--\":93:95 */\n 0x20\n /* \"--CODEGEN--\":88:91 */\n dup4\n /* \"--CODEGEN--\":85:87 */\n gt\n /* \"--CODEGEN--\":78:84 */\n iszero\n /* \"--CODEGEN--\":73:76 */\n tag_14\n /* \"--CODEGEN--\":67:72 */\n jumpi\n /* \"--CODEGEN--\":152:155 */\n 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0\n swap1\n swap3\n add\n swap2\n /* \"--CODEGEN--\":117:119 */\n 0x20\n /* \"--CODEGEN--\":108:111 */\n swap2\n dup3\n add\n swap2\n /* \"--CODEGEN--\":130:133 */\n add\n /* \"--CODEGEN--\":172:177 */\n tag_15\n /* \"--CODEGEN--\":167:171 */\n jump\n /* \"--CODEGEN--\":181:184 */\n tag_14:\n /* \"--CODEGEN--\":3:189 */\n pop\n pop\n pop\n swap1\n pop\n swap1\n dup2\n add\n swap1\n 0x1f\n and\n dup1\n iszero\n tag_16\n jumpi\n dup1\n dup3\n sub\n dup1\n mload\n 0x1\n dup4\n 0x20\n sub\n 0x100\n exp\n sub\n not\n and\n dup2\n mstore\n 0x20\n add\n swap2\n pop\n tag_16:\n pop\n swap3\n pop\n pop\n pop\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n return\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1080:1267 */\n tag_3:\n jumpi(tag_17, iszero(callvalue))\n invalid\n tag_17:\n tag_18\n and(calldataload(0x4), 0xffffffffffffffffffffffffffffffffffffffff)\n calldataload(0x24)\n jump(tag_19)\n tag_18:\n 0x40\n dup1\n mload\n swap2\n iszero\n iszero\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"tokens/ZRXToken/ZRXToken.sol\":900:935 uint256 public totalSupply = 10**27 */\n tag_4:\n jumpi(tag_20, iszero(callvalue))\n invalid\n tag_20:\n tag_21\n jump(tag_22)\n tag_21:\n 0x40\n dup1\n mload\n swap2\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1054:1663 */\n tag_5:\n jumpi(tag_23, iszero(callvalue))\n invalid\n tag_23:\n tag_18\n 0xffffffffffffffffffffffffffffffffffffffff\n calldataload(0x4)\n dup2\n and\n swap1\n calldataload(0x24)\n and\n calldataload(0x44)\n jump(tag_25)\n tag_24:\n 0x40\n dup1\n mload\n swap2\n iszero\n iszero\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"tokens/ZRXToken/ZRXToken.sol\":859:894 uint8 constant public decimals = 18 */\n tag_6:\n jumpi(tag_26, iszero(callvalue))\n invalid\n tag_26:\n tag_27\n jump(tag_28)\n tag_27:\n 0x40\n dup1\n mload\n 0xff\n swap1\n swap3\n and\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":975:1074 */\n tag_7:\n jumpi(tag_29, iszero(callvalue))\n invalid\n tag_29:\n tag_21\n and(calldataload(0x4), 0xffffffffffffffffffffffffffffffffffffffff)\n jump(tag_31)\n tag_30:\n 0x40\n dup1\n mload\n swap2\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"tokens/ZRXToken/ZRXToken.sol\":1035:1072 string constant public symbol = \"ZRX\" */\n tag_8:\n jumpi(tag_32, iszero(callvalue))\n invalid\n tag_32:\n tag_12\n jump(tag_34)\n tag_33:\n 0x40\n dup1\n mload\n 0x20\n dup1\n dup3\n mstore\n dup4\n mload\n dup2\n dup4\n add\n mstore\n dup4\n mload\n swap2\n swap3\n dup4\n swap3\n swap1\n dup4\n add\n swap2\n dup6\n add\n swap1\n dup1\n dup4\n dup4\n /* \"--CODEGEN--\":18:20 */\n dup3\n iszero\n /* \"--CODEGEN--\":13:16 */\n tag_14\n /* \"--CODEGEN--\":7:12 */\n jumpi\n /* \"--CODEGEN--\":32:37 */\n tag_36:\n /* \"--CODEGEN--\":59:62 */\n dup1\n /* \"--CODEGEN--\":53:58 */\n mload\n /* \"--CODEGEN--\":48:51 */\n dup3\n /* \"--CODEGEN--\":41:47 */\n mstore\n /* \"--CODEGEN--\":93:95 */\n 0x20\n /* \"--CODEGEN--\":88:91 */\n dup4\n /* \"--CODEGEN--\":85:87 */\n gt\n /* \"--CODEGEN--\":78:84 */\n iszero\n /* \"--CODEGEN--\":73:76 */\n tag_14\n /* \"--CODEGEN--\":67:72 */\n jumpi\n /* \"--CODEGEN--\":152:155 */\n 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0\n swap1\n swap3\n add\n swap2\n /* \"--CODEGEN--\":117:119 */\n 0x20\n /* \"--CODEGEN--\":108:111 */\n swap2\n dup3\n add\n swap2\n /* \"--CODEGEN--\":130:133 */\n add\n /* \"--CODEGEN--\":172:177 */\n tag_15\n /* \"--CODEGEN--\":167:171 */\n jump\n /* \"--CODEGEN--\":181:184 */\n tag_35:\n /* \"--CODEGEN--\":3:189 */\n pop\n pop\n pop\n swap1\n pop\n swap1\n dup2\n add\n swap1\n 0x1f\n and\n dup1\n iszero\n tag_16\n jumpi\n dup1\n dup3\n sub\n dup1\n mload\n 0x1\n dup4\n 0x20\n sub\n 0x100\n exp\n sub\n not\n and\n dup2\n mstore\n 0x20\n add\n swap2\n pop\n tag_37:\n pop\n swap3\n pop\n pop\n pop\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n return\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":118:528 */\n tag_9:\n jumpi(tag_38, iszero(callvalue))\n invalid\n tag_38:\n tag_18\n and(calldataload(0x4), 0xffffffffffffffffffffffffffffffffffffffff)\n calldataload(0x24)\n jump(tag_40)\n tag_39:\n 0x40\n dup1\n mload\n swap2\n iszero\n iszero\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1273:1399 */\n tag_10:\n jumpi(tag_41, iszero(callvalue))\n invalid\n tag_41:\n tag_21\n 0xffffffffffffffffffffffffffffffffffffffff\n calldataload(0x4)\n dup2\n and\n swap1\n calldataload(0x24)\n and\n jump(tag_43)\n tag_42:\n 0x40\n dup1\n mload\n swap2\n dup3\n mstore\n mload\n swap1\n dup2\n swap1\n sub\n 0x20\n add\n swap1\n return\n /* \"tokens/ZRXToken/ZRXToken.sol\":980:1029 string constant public name = \"0x Protocol Token\" */\n tag_13:\n 0x40\n dup1\n mload\n dup1\n dup3\n add\n swap1\n swap2\n mstore\n 0x11\n dup2\n mstore\n 0x30782050726f746f636f6c20546f6b656e000000000000000000000000000000\n 0x20\n dup3\n add\n mstore\n dup2\n jump\t// out\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1080:1267 */\n tag_19:\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1153:1172 */\n 0xffffffffffffffffffffffffffffffffffffffff\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1161:1171 */\n caller\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1153:1172 */\n dup2\n and\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1137:1141 */\n 0x0\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1153:1172 */\n dup2\n dup2\n mstore\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1153:1160 */\n 0x1\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1153:1172 */\n 0x20\n swap1\n dup2\n mstore\n 0x40\n dup1\n dup4\n sha3\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1153:1182 */\n swap5\n dup8\n and\n dup1\n dup5\n mstore\n swap5\n dup3\n mstore\n dup1\n dup4\n sha3\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1153:1191 */\n dup7\n swap1\n sstore\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1201:1239 */\n dup1\n mload\n dup7\n dup2\n mstore\n swap1\n mload\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1137:1141 */\n swap3\n swap5\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1153:1182 */\n swap4\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1153:1172 */\n swap3\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1201:1239 */\n 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925\n swap3\n swap2\n dup2\n swap1\n sub\n swap1\n swap2\n add\n swap1\n log3\n pop\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1256:1260 */\n 0x1\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1080:1267 */\n tag_44:\n swap3\n swap2\n pop\n pop\n jump\t// out\n /* \"tokens/ZRXToken/ZRXToken.sol\":900:935 uint256 public totalSupply = 10**27 */\n tag_22:\n sload(0x3)\n dup2\n jump\t// out\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1054:1663 */\n tag_25:\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1186:1200 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup1\n dup5\n and\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1149:1153 */\n 0x0\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1186:1200 */\n dup2\n dup2\n mstore\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1186:1193 */\n 0x1\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1186:1200 */\n 0x20\n swap1\n dup2\n mstore\n 0x40\n dup1\n dup4\n sha3\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1201:1211 */\n caller\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1186:1212 */\n swap1\n swap6\n and\n dup4\n mstore\n swap4\n dup2\n mstore\n dup4\n dup3\n sha3\n sload\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1226:1241 */\n swap3\n dup3\n mstore\n dup2\n swap1\n mstore\n swap2\n dup3\n sha3\n sload\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1226:1251 */\n dup4\n swap1\n lt\n dup1\n iszero\n swap1\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1226:1286 */\n tag_46\n jumpi\n pop\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1280:1286 */\n dup3\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1267:1276 */\n dup2\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1267:1286 */\n lt\n iszero\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1226:1286 */\n tag_46:\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1226:1341 */\n dup1\n iszero\n tag_47\n jumpi\n pop\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1328:1341 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup5\n and\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1328:1336 */\n 0x0\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1328:1341 */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n swap1\n sha3\n sload\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1302:1324 */\n dup4\n dup2\n add\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1302:1341 */\n lt\n iszero\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1226:1341 */\n tag_47:\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1222:1657 */\n iszero\n tag_48\n jumpi\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1366:1379 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup1\n dup6\n and\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1366:1374 */\n 0x0\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1366:1379 */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n dup1\n dup3\n sha3\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1366:1389 */\n dup1\n sload\n dup8\n add\n swap1\n sstore\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1403:1418 */\n swap2\n dup8\n and\n dup2\n mstore\n sha3\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1403:1428 */\n dup1\n sload\n dup5\n swap1\n sub\n swap1\n sstore\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":756:766 */\n 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1446:1466 */\n dup2\n lt\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1442:1537 */\n iszero\n tag_49\n jumpi\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1486:1500 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup1\n dup7\n and\n 0x0\n swap1\n dup2\n mstore\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1486:1493 */\n 0x1\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1486:1500 */\n 0x20\n swap1\n dup2\n mstore\n 0x40\n dup1\n dup4\n sha3\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1501:1511 */\n caller\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1486:1512 */\n swap1\n swap5\n and\n dup4\n mstore\n swap3\n swap1\n mstore\n sha3\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1486:1522 */\n dup1\n sload\n dup5\n swap1\n sub\n swap1\n sstore\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1442:1537 */\n tag_49:\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1566:1569 */\n dup4\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1550:1578 */\n 0xffffffffffffffffffffffffffffffffffffffff\n and\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1559:1564 */\n dup6\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1550:1578 */\n 0xffffffffffffffffffffffffffffffffffffffff\n and\n 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1571:1577 */\n dup6\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1550:1578 */\n mload(0x40)\n dup1\n dup3\n dup2\n mstore\n 0x20\n add\n swap2\n pop\n pop\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n log3\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1599:1603 */\n 0x1\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1592:1603 */\n swap2\n pop\n jump(tag_50)\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1222:1657 */\n tag_48:\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1641:1646 */\n 0x0\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1634:1646 */\n swap2\n pop\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1222:1657 */\n tag_50:\n /* \"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":1054:1663 */\n tag_45:\n pop\n swap4\n swap3\n pop\n pop\n pop\n jump\t// out\n /* \"tokens/ZRXToken/ZRXToken.sol\":859:894 uint8 constant public decimals = 18 */\n tag_28:\n /* \"tokens/ZRXToken/ZRXToken.sol\":892:894 18 */\n 0x12\n /* \"tokens/ZRXToken/ZRXToken.sol\":859:894 uint8 constant public decimals = 18 */\n dup2\n jump\t// out\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":975:1074 */\n tag_31:\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1051:1067 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup2\n and\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1028:1032 */\n 0x0\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1051:1067 */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n swap1\n sha3\n sload\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":975:1074 */\n tag_51:\n swap2\n swap1\n pop\n jump\t// out\n /* \"tokens/ZRXToken/ZRXToken.sol\":1035:1072 string constant public symbol = \"ZRX\" */\n tag_34:\n 0x40\n dup1\n mload\n dup1\n dup3\n add\n swap1\n swap2\n mstore\n 0x3\n dup2\n mstore\n 0x5a52580000000000000000000000000000000000000000000000000000000000\n 0x20\n dup3\n add\n mstore\n dup2\n jump\t// out\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":118:528 */\n tag_40:\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":260:280 */\n 0xffffffffffffffffffffffffffffffffffffffff\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":269:279 */\n caller\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":260:280 */\n and\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":171:175 */\n 0x0\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":260:280 */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n dup2\n sha3\n sload\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":260:290 */\n dup3\n swap1\n lt\n dup1\n iszero\n swap1\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":260:333 */\n tag_53\n jumpi\n pop\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":320:333 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup4\n and\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":320:328 */\n 0x0\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":320:333 */\n swap1\n dup2\n mstore\n 0x20\n dup2\n swap1\n mstore\n 0x40\n swap1\n sha3\n sload\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":294:316 */\n dup3\n dup2\n add\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":294:333 */\n lt\n iszero\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":260:333 */\n tag_53:\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":256:522 */\n iszero\n tag_54\n jumpi\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":349:369 */\n 0xffffffffffffffffffffffffffffffffffffffff\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":358:368 */\n caller\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":349:369 */\n dup2\n and\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":349:357 */\n 0x0\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":349:369 */\n dup2\n dup2\n mstore\n 0x20\n dup2\n dup2\n mstore\n 0x40\n dup1\n dup4\n sha3\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":349:379 */\n dup1\n sload\n dup9\n swap1\n sub\n swap1\n sstore\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":393:406 */\n swap4\n dup8\n and\n dup1\n dup4\n mstore\n swap2\n dup5\n swap1\n sha3\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":393:416 */\n dup1\n sload\n dup8\n add\n swap1\n sstore\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":430:463 */\n dup4\n mload\n dup7\n dup2\n mstore\n swap4\n mload\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":393:406 */\n swap2\n swap4\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":430:463 */\n 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\n swap3\n swap1\n dup2\n swap1\n sub\n swap1\n swap2\n add\n swap1\n log3\n pop\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":484:488 */\n 0x1\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":477:488 */\n jump(tag_44)\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":256:522 */\n tag_54:\n pop\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":514:519 */\n 0x0\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":507:519 */\n jump(tag_44)\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":256:522 */\n tag_55:\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":118:528 */\n tag_52:\n swap3\n swap2\n pop\n pop\n jump\t// out\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1273:1399 */\n tag_43:\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1367:1382 */\n 0xffffffffffffffffffffffffffffffffffffffff\n dup1\n dup4\n and\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1344:1348 */\n 0x0\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1367:1382 */\n swap1\n dup2\n mstore\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1367:1374 */\n 0x1\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1367:1382 */\n 0x20\n swap1\n dup2\n mstore\n 0x40\n dup1\n dup4\n sha3\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1367:1392 */\n swap4\n dup6\n and\n dup4\n mstore\n swap3\n swap1\n mstore\n sha3\n sload\n /* \"tokens/ZRXToken/ERC20Token_v1.sol\":1273:1399 */\n tag_56:\n swap3\n swap2\n pop\n pop\n jump\t// out\n}\n",
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x60606040526b033b2e3c9fd0803ce8000000600355341561001c57fe5b5b600354600160a060020a0333166000908152602081905260409020555b5b61078d8061004a6000396000f300606060405236156100965763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610098578063095ea7b31461014657806318160ddd1461018657806323b872dd146101a8578063313ce567146101ee57806370a082311461021457806395d89b411461024f578063a9059cbb146102fd578063dd62ed3e1461033d575bfe5b34156100a057fe5b6100a861037e565b60408051602080825283518183015283519192839290830191850190808383821561010c575b80518252602083111561010c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100ce565b505050905090810190601f1680156101385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014e57fe5b61017273ffffffffffffffffffffffffffffffffffffffff600435166024356103b5565b604080519115158252519081900360200190f35b341561018e57fe5b61019661042d565b60408051918252519081900360200190f35b34156101b057fe5b61017273ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610433565b604080519115158252519081900360200190f35b34156101f657fe5b6101fe6105d4565b6040805160ff9092168252519081900360200190f35b341561021c57fe5b61019673ffffffffffffffffffffffffffffffffffffffff600435166105d9565b60408051918252519081900360200190f35b341561025757fe5b6100a8610605565b60408051602080825283518183015283519192839290830191850190808383821561010c575b80518252602083111561010c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100ce565b505050905090810190601f1680156101385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561030557fe5b61017273ffffffffffffffffffffffffffffffffffffffff6004351660243561063c565b604080519115158252519081900360200190f35b341561034557fe5b61019673ffffffffffffffffffffffffffffffffffffffff60043581169060243516610727565b60408051918252519081900360200190f35b60408051808201909152601181527f30782050726f746f636f6c20546f6b656e000000000000000000000000000000602082015281565b73ffffffffffffffffffffffffffffffffffffffff338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60035481565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260016020908152604080832033909516835293815283822054928252819052918220548390108015906104835750828110155b80156104b6575073ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090205483810110155b156105c65773ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220805487019055918716815220805484900390557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156105585773ffffffffffffffffffffffffffffffffffffffff808616600090815260016020908152604080832033909416835292905220805484900390555b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191506105cb565b600091505b5b509392505050565b601281565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b60408051808201909152600381527f5a52580000000000000000000000000000000000000000000000000000000000602082015281565b73ffffffffffffffffffffffffffffffffffffffff3316600090815260208190526040812054829010801590610699575073ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205482810110155b156107185773ffffffffffffffffffffffffffffffffffffffff33811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3506001610427565b506000610427565b5b92915050565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600160209081526040808320938516835292905220545b929150505600a165627a7a723058200bc9d5738ec95c497f7758571dca1e2fc068d911c7178e661303c1021b14d8f90029",
+ "opcodes": "PUSH1 0x60 PUSH1 0x40 MSTORE PUSH12 0x33B2E3C9FD0803CE8000000 PUSH1 0x3 SSTORE CALLVALUE ISZERO PUSH2 0x1C JUMPI INVALID JUMPDEST JUMPDEST PUSH1 0x3 SLOAD PUSH1 0x1 PUSH1 0xA0 PUSH1 0x2 EXP SUB CALLER AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SSTORE JUMPDEST JUMPDEST PUSH2 0x78D DUP1 PUSH2 0x4A PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x60 PUSH1 0x40 MSTORE CALLDATASIZE ISZERO PUSH2 0x96 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0x98 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x146 JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x186 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1A8 JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x1EE JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x214 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x24F JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x2FD JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x33D JUMPI JUMPDEST INVALID JUMPDEST CALLVALUE ISZERO PUSH2 0xA0 JUMPI INVALID JUMPDEST PUSH2 0xA8 PUSH2 0x37E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP3 ISZERO PUSH2 0x10C JUMPI JUMPDEST DUP1 MLOAD DUP3 MSTORE PUSH1 0x20 DUP4 GT ISZERO PUSH2 0x10C JUMPI PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xCE JUMP JUMPDEST POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x138 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x14E JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x3B5 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x18E JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH2 0x42D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x1B0 JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x433 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x1F6 JUMPI INVALID JUMPDEST PUSH2 0x1FE PUSH2 0x5D4 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0xFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x21C JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x5D9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x257 JUMPI INVALID JUMPDEST PUSH2 0xA8 PUSH2 0x605 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP3 ISZERO PUSH2 0x10C JUMPI JUMPDEST DUP1 MLOAD DUP3 MSTORE PUSH1 0x20 DUP4 GT ISZERO PUSH2 0x10C JUMPI PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xCE JUMP JUMPDEST POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x138 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x305 JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x63C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x345 JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x727 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x11 DUP2 MSTORE PUSH32 0x30782050726F746F636F6C20546F6B656E000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 SWAP5 DUP8 AND DUP1 DUP5 MSTORE SWAP5 DUP3 MSTORE DUP1 DUP4 SHA3 DUP7 SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP5 SWAP4 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 CALLER SWAP1 SWAP6 AND DUP4 MSTORE SWAP4 DUP2 MSTORE DUP4 DUP3 SHA3 SLOAD SWAP3 DUP3 MSTORE DUP2 SWAP1 MSTORE SWAP2 DUP3 SHA3 SLOAD DUP4 SWAP1 LT DUP1 ISZERO SWAP1 PUSH2 0x483 JUMPI POP DUP3 DUP2 LT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x4B6 JUMPI POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD DUP4 DUP2 ADD LT ISZERO JUMPDEST ISZERO PUSH2 0x5C6 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP3 SHA3 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE SWAP2 DUP8 AND DUP2 MSTORE SHA3 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 LT ISZERO PUSH2 0x558 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 CALLER SWAP1 SWAP5 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE SHA3 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP6 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 PUSH1 0x1 SWAP2 POP PUSH2 0x5CB JUMP JUMPDEST PUSH1 0x0 SWAP2 POP JUMPDEST JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x12 DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x3 DUP2 MSTORE PUSH32 0x5A52580000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 SHA3 SLOAD DUP3 SWAP1 LT DUP1 ISZERO SWAP1 PUSH2 0x699 JUMPI POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD DUP3 DUP2 ADD LT ISZERO JUMPDEST ISZERO PUSH2 0x718 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 DUP1 SLOAD DUP9 SWAP1 SUB SWAP1 SSTORE SWAP4 DUP8 AND DUP1 DUP4 MSTORE SWAP2 DUP5 SWAP1 SHA3 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP4 MLOAD DUP7 DUP2 MSTORE SWAP4 MLOAD SWAP2 SWAP4 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP1 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 PUSH2 0x427 JUMP JUMPDEST POP PUSH1 0x0 PUSH2 0x427 JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE SHA3 SLOAD JUMPDEST SWAP3 SWAP2 POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 SHA3 SIGNEXTEND 0xc9 0xd5 PUSH20 0x8EC95C497F7758571DCA1E2FC068D911C7178E66 SGT SUB 0xc1 MUL 0x1b EQ 0xd8 0xf9 STOP 0x29 ",
+ "sourceMap": "758:455:3:-;;;929:6;900:35;;1121:90;;;;;;;1193:11;;-1:-1:-1;;;;;1179:10:3;1170:20;:8;:20;;;;;;;;;;:34;1121:90;758:455;;;;;;;"
+ },
+ "deployedBytecode": {
+ "linkReferences": {},
+ "object": "0x606060405236156100965763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610098578063095ea7b31461014657806318160ddd1461018657806323b872dd146101a8578063313ce567146101ee57806370a082311461021457806395d89b411461024f578063a9059cbb146102fd578063dd62ed3e1461033d575bfe5b34156100a057fe5b6100a861037e565b60408051602080825283518183015283519192839290830191850190808383821561010c575b80518252602083111561010c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100ce565b505050905090810190601f1680156101385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014e57fe5b61017273ffffffffffffffffffffffffffffffffffffffff600435166024356103b5565b604080519115158252519081900360200190f35b341561018e57fe5b61019661042d565b60408051918252519081900360200190f35b34156101b057fe5b61017273ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610433565b604080519115158252519081900360200190f35b34156101f657fe5b6101fe6105d4565b6040805160ff9092168252519081900360200190f35b341561021c57fe5b61019673ffffffffffffffffffffffffffffffffffffffff600435166105d9565b60408051918252519081900360200190f35b341561025757fe5b6100a8610605565b60408051602080825283518183015283519192839290830191850190808383821561010c575b80518252602083111561010c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100ce565b505050905090810190601f1680156101385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561030557fe5b61017273ffffffffffffffffffffffffffffffffffffffff6004351660243561063c565b604080519115158252519081900360200190f35b341561034557fe5b61019673ffffffffffffffffffffffffffffffffffffffff60043581169060243516610727565b60408051918252519081900360200190f35b60408051808201909152601181527f30782050726f746f636f6c20546f6b656e000000000000000000000000000000602082015281565b73ffffffffffffffffffffffffffffffffffffffff338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60035481565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260016020908152604080832033909516835293815283822054928252819052918220548390108015906104835750828110155b80156104b6575073ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090205483810110155b156105c65773ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220805487019055918716815220805484900390557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156105585773ffffffffffffffffffffffffffffffffffffffff808616600090815260016020908152604080832033909416835292905220805484900390555b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191506105cb565b600091505b5b509392505050565b601281565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b60408051808201909152600381527f5a52580000000000000000000000000000000000000000000000000000000000602082015281565b73ffffffffffffffffffffffffffffffffffffffff3316600090815260208190526040812054829010801590610699575073ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205482810110155b156107185773ffffffffffffffffffffffffffffffffffffffff33811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3506001610427565b506000610427565b5b92915050565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600160209081526040808320938516835292905220545b929150505600a165627a7a723058200bc9d5738ec95c497f7758571dca1e2fc068d911c7178e661303c1021b14d8f90029",
+ "opcodes": "PUSH1 0x60 PUSH1 0x40 MSTORE CALLDATASIZE ISZERO PUSH2 0x96 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x6FDDE03 DUP2 EQ PUSH2 0x98 JUMPI DUP1 PUSH4 0x95EA7B3 EQ PUSH2 0x146 JUMPI DUP1 PUSH4 0x18160DDD EQ PUSH2 0x186 JUMPI DUP1 PUSH4 0x23B872DD EQ PUSH2 0x1A8 JUMPI DUP1 PUSH4 0x313CE567 EQ PUSH2 0x1EE JUMPI DUP1 PUSH4 0x70A08231 EQ PUSH2 0x214 JUMPI DUP1 PUSH4 0x95D89B41 EQ PUSH2 0x24F JUMPI DUP1 PUSH4 0xA9059CBB EQ PUSH2 0x2FD JUMPI DUP1 PUSH4 0xDD62ED3E EQ PUSH2 0x33D JUMPI JUMPDEST INVALID JUMPDEST CALLVALUE ISZERO PUSH2 0xA0 JUMPI INVALID JUMPDEST PUSH2 0xA8 PUSH2 0x37E JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP3 ISZERO PUSH2 0x10C JUMPI JUMPDEST DUP1 MLOAD DUP3 MSTORE PUSH1 0x20 DUP4 GT ISZERO PUSH2 0x10C JUMPI PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xCE JUMP JUMPDEST POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x138 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x14E JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x3B5 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x18E JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH2 0x42D JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x1B0 JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH1 0x44 CALLDATALOAD PUSH2 0x433 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x1F6 JUMPI INVALID JUMPDEST PUSH2 0x1FE PUSH2 0x5D4 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0xFF SWAP1 SWAP3 AND DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x21C JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH2 0x5D9 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x257 JUMPI INVALID JUMPDEST PUSH2 0xA8 PUSH2 0x605 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 ADD SWAP1 DUP1 DUP4 DUP4 DUP3 ISZERO PUSH2 0x10C JUMPI JUMPDEST DUP1 MLOAD DUP3 MSTORE PUSH1 0x20 DUP4 GT ISZERO PUSH2 0x10C JUMPI PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x20 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0xCE JUMP JUMPDEST POP POP POP SWAP1 POP SWAP1 DUP2 ADD SWAP1 PUSH1 0x1F AND DUP1 ISZERO PUSH2 0x138 JUMPI DUP1 DUP3 SUB DUP1 MLOAD PUSH1 0x1 DUP4 PUSH1 0x20 SUB PUSH2 0x100 EXP SUB NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP JUMPDEST POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x305 JUMPI INVALID JUMPDEST PUSH2 0x172 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD AND PUSH1 0x24 CALLDATALOAD PUSH2 0x63C JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 ISZERO ISZERO DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x345 JUMPI INVALID JUMPDEST PUSH2 0x196 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH1 0x4 CALLDATALOAD DUP2 AND SWAP1 PUSH1 0x24 CALLDATALOAD AND PUSH2 0x727 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD SWAP2 DUP3 MSTORE MLOAD SWAP1 DUP2 SWAP1 SUB PUSH1 0x20 ADD SWAP1 RETURN JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x11 DUP2 MSTORE PUSH32 0x30782050726F746F636F6C20546F6B656E000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 SWAP5 DUP8 AND DUP1 DUP5 MSTORE SWAP5 DUP3 MSTORE DUP1 DUP4 SHA3 DUP7 SWAP1 SSTORE DUP1 MLOAD DUP7 DUP2 MSTORE SWAP1 MLOAD SWAP3 SWAP5 SWAP4 SWAP3 PUSH32 0x8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925 SWAP3 SWAP2 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x3 SLOAD DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP5 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 CALLER SWAP1 SWAP6 AND DUP4 MSTORE SWAP4 DUP2 MSTORE DUP4 DUP3 SHA3 SLOAD SWAP3 DUP3 MSTORE DUP2 SWAP1 MSTORE SWAP2 DUP3 SHA3 SLOAD DUP4 SWAP1 LT DUP1 ISZERO SWAP1 PUSH2 0x483 JUMPI POP DUP3 DUP2 LT ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x4B6 JUMPI POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD DUP4 DUP2 ADD LT ISZERO JUMPDEST ISZERO PUSH2 0x5C6 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP6 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP1 DUP3 SHA3 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE SWAP2 DUP8 AND DUP2 MSTORE SHA3 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 LT ISZERO PUSH2 0x558 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP7 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 CALLER SWAP1 SWAP5 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE SHA3 DUP1 SLOAD DUP5 SWAP1 SUB SWAP1 SSTORE JUMPDEST DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF DUP6 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG3 PUSH1 0x1 SWAP2 POP PUSH2 0x5CB JUMP JUMPDEST PUSH1 0x0 SWAP2 POP JUMPDEST JUMPDEST POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x12 DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD DUP1 DUP3 ADD SWAP1 SWAP2 MSTORE PUSH1 0x3 DUP2 MSTORE PUSH32 0x5A52580000000000000000000000000000000000000000000000000000000000 PUSH1 0x20 DUP3 ADD MSTORE DUP2 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 DUP2 SHA3 SLOAD DUP3 SWAP1 LT DUP1 ISZERO SWAP1 PUSH2 0x699 JUMPI POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x20 DUP2 SWAP1 MSTORE PUSH1 0x40 SWAP1 SHA3 SLOAD DUP3 DUP2 ADD LT ISZERO JUMPDEST ISZERO PUSH2 0x718 JUMPI PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF CALLER DUP2 AND PUSH1 0x0 DUP2 DUP2 MSTORE PUSH1 0x20 DUP2 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 DUP1 SLOAD DUP9 SWAP1 SUB SWAP1 SSTORE SWAP4 DUP8 AND DUP1 DUP4 MSTORE SWAP2 DUP5 SWAP1 SHA3 DUP1 SLOAD DUP8 ADD SWAP1 SSTORE DUP4 MLOAD DUP7 DUP2 MSTORE SWAP4 MLOAD SWAP2 SWAP4 PUSH32 0xDDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF SWAP3 SWAP1 DUP2 SWAP1 SUB SWAP1 SWAP2 ADD SWAP1 LOG3 POP PUSH1 0x1 PUSH2 0x427 JUMP JUMPDEST POP PUSH1 0x0 PUSH2 0x427 JUMP JUMPDEST JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP4 AND PUSH1 0x0 SWAP1 DUP2 MSTORE PUSH1 0x1 PUSH1 0x20 SWAP1 DUP2 MSTORE PUSH1 0x40 DUP1 DUP4 SHA3 SWAP4 DUP6 AND DUP4 MSTORE SWAP3 SWAP1 MSTORE SHA3 SLOAD JUMPDEST SWAP3 SWAP2 POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 SHA3 SIGNEXTEND 0xc9 0xd5 PUSH20 0x8EC95C497F7758571DCA1E2FC068D911C7178E66 SGT SUB 0xc1 MUL 0x1b EQ 0xd8 0xf9 STOP 0x29 ",
+ "sourceMap": "758:455:3:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;980:49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18:2:-1;;13:3;7:5;32;59:3;53:5;48:3;41:6;93:2;88:3;85:2;78:6;73:3;67:5;152:3;;;;;117:2;108:3;;;;130;172:5;167:4;181:3;3:186;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1080:187:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;900:35:3;;;;;;;;;;;;;;;;;;;;;;;;;;1054:609:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;859:35:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;975:99:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1035:37:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;18:2:-1;;13:3;7:5;32;59:3;53:5;48:3;41:6;93:2;88:3;85:2;78:6;73:3;67:5;152:3;;;;;117:2;108:3;;;;130;172:5;167:4;181:3;3:186;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;118:410:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1273:126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;980:49:3;;;;;;;;;;;;;;;;;;;:::o;1080:187:0:-;1153:19;1161:10;1153:19;;1137:4;1153:19;;;:7;:19;;;;;;;;:29;;;;;;;;;;;;:38;;;1201;;;;;;;1137:4;;1153:29;:19;1201:38;;;;;;;;;;;-1:-1:-1;1256:4:0;1080:187;;;;;:::o;900:35:3:-;;;;:::o;1054:609:2:-;1186:14;;;;1149:4;1186:14;;;:7;:14;;;;;;;;1201:10;1186:26;;;;;;;;;;;;1226:15;;;;;;;;;;:25;;;;;;:60;;;1280:6;1267:9;:19;;1226:60;:115;;;;-1:-1:-1;1328:13:2;;;:8;:13;;;;;;;;;;;1302:22;;;:39;;1226:115;1222:435;;;1366:13;;;;:8;:13;;;;;;;;;;;:23;;;;;;1403:15;;;;;;:25;;;;;;;756:10;1446:20;;1442:95;;;1486:14;;;;;;;;:7;:14;;;;;;;;1501:10;1486:26;;;;;;;;;:36;;;;;;;1442:95;1566:3;1550:28;;1559:5;1550:28;;;1571:6;1550:28;;;;;;;;;;;;;;;;;;1599:4;1592:11;;;;1222:435;1641:5;1634:12;;1222:435;1054:609;;;;;;;:::o;859:35:3:-;892:2;859:35;:::o;975:99:0:-;1051:16;;;1028:4;1051:16;;;;;;;;;;;975:99;;;;:::o;1035:37:3:-;;;;;;;;;;;;;;;;;;;:::o;118:410:0:-;260:20;269:10;260:20;171:4;260:20;;;;;;;;;;;:30;;;;;;:73;;-1:-1:-1;320:13:0;;;:8;:13;;;;;;;;;;;294:22;;;:39;;260:73;256:266;;;349:20;358:10;349:20;;:8;:20;;;;;;;;;;;:30;;;;;;;393:13;;;;;;;;;;:23;;;;;;430:33;;;;;;;393:13;;430:33;;;;;;;;;;;-1:-1:-1;484:4:0;477:11;;256:266;-1:-1:-1;514:5:0;507:12;;256:266;118:410;;;;;:::o;1273:126::-;1367:15;;;;1344:4;1367:15;;;:7;:15;;;;;;;;:25;;;;;;;;;;1273:126;;;;;:::o"
+ },
+ "gasEstimates": {
+ "creation": {
+ "codeDepositCost": "386600",
+ "executionCost": "40780",
+ "totalCost": "427380"
+ },
+ "external": {
+ "allowance(address,address)": "737",
+ "approve(address,uint256)": "22218",
+ "balanceOf(address)": "579",
+ "decimals()": "270",
+ "name()": "530",
+ "symbol()": "662",
+ "totalSupply()": "417",
+ "transfer(address,uint256)": "43393",
+ "transferFrom(address,address,uint256)": "64116"
+ }
+ },
+ "legacyAssembly": {
+ ".code": [
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "60"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 929,
+ "end": 935,
+ "name": "PUSH",
+ "value": "33B2E3C9FD0803CE8000000"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "PUSH",
+ "value": "3"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "SSTORE"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "CALLVALUE"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "PUSH [tag]",
+ "value": "1"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "INVALID"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "tag",
+ "value": "1"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "tag",
+ "value": "2"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1193,
+ "end": 1204,
+ "name": "PUSH",
+ "value": "3"
+ },
+ {
+ "begin": 1193,
+ "end": 1204,
+ "name": "SLOAD"
+ },
+ {
+ "begin": -1,
+ "end": -1,
+ "name": "PUSH",
+ "value": "1"
+ },
+ {
+ "begin": -1,
+ "end": -1,
+ "name": "PUSH",
+ "value": "A0"
+ },
+ {
+ "begin": -1,
+ "end": -1,
+ "name": "PUSH",
+ "value": "2"
+ },
+ {
+ "begin": -1,
+ "end": -1,
+ "name": "EXP"
+ },
+ {
+ "begin": -1,
+ "end": -1,
+ "name": "SUB"
+ },
+ {
+ "begin": 1179,
+ "end": 1189,
+ "name": "CALLER"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "AND"
+ },
+ {
+ "begin": 1170,
+ "end": 1178,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1170,
+ "end": 1190,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1170,
+ "end": 1204,
+ "name": "SSTORE"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "tag",
+ "value": "3"
+ },
+ {
+ "begin": 1121,
+ "end": 1211,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "tag",
+ "value": "4"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH #[$]",
+ "value": "0000000000000000000000000000000000000000000000000000000000000000"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DUP1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [$]",
+ "value": "0000000000000000000000000000000000000000000000000000000000000000"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "CODECOPY"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "RETURN"
+ }
+ ],
+ ".data": {
+ "0": {
+ ".code": [
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "60"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "CALLDATASIZE"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [tag]",
+ "value": "1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "FFFFFFFF"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "100000000000000000000000000000000000000000000000000000000"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DIV"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "AND"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "6FDDE03"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DUP2"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "EQ"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [tag]",
+ "value": "2"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DUP1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "95EA7B3"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "EQ"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [tag]",
+ "value": "3"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DUP1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "18160DDD"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "EQ"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [tag]",
+ "value": "4"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DUP1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "23B872DD"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "EQ"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [tag]",
+ "value": "5"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DUP1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "313CE567"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "EQ"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [tag]",
+ "value": "6"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DUP1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "70A08231"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "EQ"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [tag]",
+ "value": "7"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DUP1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "95D89B41"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "EQ"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [tag]",
+ "value": "8"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DUP1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "A9059CBB"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "EQ"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [tag]",
+ "value": "9"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "DUP1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH",
+ "value": "DD62ED3E"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "EQ"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "PUSH [tag]",
+ "value": "10"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "tag",
+ "value": "1"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 758,
+ "end": 1213,
+ "name": "INVALID"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "tag",
+ "value": "2"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "CALLVALUE"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "PUSH [tag]",
+ "value": "11"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "INVALID"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "tag",
+ "value": "11"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "PUSH [tag]",
+ "value": "12"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "PUSH [tag]",
+ "value": "13"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "JUMP"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "tag",
+ "value": "12"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP1"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP1"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP3"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP4"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP2"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP4"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "ADD"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP4"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP4"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP4"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "ADD"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP6"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "ADD"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP1"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP4"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP4"
+ },
+ {
+ "begin": 18,
+ "end": 20,
+ "name": "DUP3"
+ },
+ {
+ "begin": 18,
+ "end": 20,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 13,
+ "end": 16,
+ "name": "PUSH [tag]",
+ "value": "14"
+ },
+ {
+ "begin": 7,
+ "end": 12,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 32,
+ "end": 37,
+ "name": "tag",
+ "value": "15"
+ },
+ {
+ "begin": 32,
+ "end": 37,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 59,
+ "end": 62,
+ "name": "DUP1"
+ },
+ {
+ "begin": 53,
+ "end": 58,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 48,
+ "end": 51,
+ "name": "DUP3"
+ },
+ {
+ "begin": 41,
+ "end": 47,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 93,
+ "end": 95,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 88,
+ "end": 91,
+ "name": "DUP4"
+ },
+ {
+ "begin": 85,
+ "end": 87,
+ "name": "GT"
+ },
+ {
+ "begin": 78,
+ "end": 84,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 73,
+ "end": 76,
+ "name": "PUSH [tag]",
+ "value": "14"
+ },
+ {
+ "begin": 67,
+ "end": 72,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 152,
+ "end": 155,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0"
+ },
+ {
+ "begin": 152,
+ "end": 155,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 152,
+ "end": 155,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 152,
+ "end": 155,
+ "name": "ADD"
+ },
+ {
+ "begin": 152,
+ "end": 155,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 117,
+ "end": 119,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 108,
+ "end": 111,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 108,
+ "end": 111,
+ "name": "DUP3"
+ },
+ {
+ "begin": 108,
+ "end": 111,
+ "name": "ADD"
+ },
+ {
+ "begin": 108,
+ "end": 111,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 130,
+ "end": 133,
+ "name": "ADD"
+ },
+ {
+ "begin": 172,
+ "end": 177,
+ "name": "PUSH [tag]",
+ "value": "15"
+ },
+ {
+ "begin": 167,
+ "end": 171,
+ "name": "JUMP"
+ },
+ {
+ "begin": 181,
+ "end": 184,
+ "name": "tag",
+ "value": "14"
+ },
+ {
+ "begin": 181,
+ "end": 184,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP2"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "ADD"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "1F"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "AND"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH [tag]",
+ "value": "16"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP3"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SUB"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP4"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SUB"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "100"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "EXP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SUB"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "NOT"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "AND"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP2"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "ADD"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "tag",
+ "value": "16"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SUB"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "RETURN"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "tag",
+ "value": "3"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "CALLVALUE"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "PUSH [tag]",
+ "value": "17"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "INVALID"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "tag",
+ "value": "17"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "PUSH [tag]",
+ "value": "18"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "PUSH",
+ "value": "4"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "AND"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "PUSH",
+ "value": "24"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "PUSH [tag]",
+ "value": "19"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "JUMP"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "tag",
+ "value": "18"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "SUB"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "ADD"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "RETURN"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "tag",
+ "value": "4"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "CALLVALUE"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "PUSH [tag]",
+ "value": "20"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "INVALID"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "tag",
+ "value": "20"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "PUSH [tag]",
+ "value": "21"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "PUSH [tag]",
+ "value": "22"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "JUMP"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "tag",
+ "value": "21"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "DUP1"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "DUP3"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "DUP2"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "SUB"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "ADD"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "RETURN"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "tag",
+ "value": "5"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "CALLVALUE"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "PUSH [tag]",
+ "value": "23"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "INVALID"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "tag",
+ "value": "23"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "PUSH [tag]",
+ "value": "18"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "PUSH",
+ "value": "4"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "AND"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "PUSH",
+ "value": "24"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "AND"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "PUSH",
+ "value": "44"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "PUSH [tag]",
+ "value": "25"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "JUMP"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "tag",
+ "value": "24"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "SUB"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "ADD"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "RETURN"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "tag",
+ "value": "6"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "CALLVALUE"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "PUSH [tag]",
+ "value": "26"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "INVALID"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "tag",
+ "value": "26"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "PUSH [tag]",
+ "value": "27"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "PUSH [tag]",
+ "value": "28"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "JUMP"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "tag",
+ "value": "27"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "DUP1"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "PUSH",
+ "value": "FF"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "AND"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "DUP3"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "DUP2"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "SUB"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "ADD"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "RETURN"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "tag",
+ "value": "7"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "CALLVALUE"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "PUSH [tag]",
+ "value": "29"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "INVALID"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "tag",
+ "value": "29"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "PUSH [tag]",
+ "value": "21"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "PUSH",
+ "value": "4"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "AND"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "PUSH [tag]",
+ "value": "31"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "JUMP"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "tag",
+ "value": "30"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "DUP1"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "DUP3"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "DUP2"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "SUB"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "ADD"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "RETURN"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "tag",
+ "value": "8"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "CALLVALUE"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "PUSH [tag]",
+ "value": "32"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "INVALID"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "tag",
+ "value": "32"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "PUSH [tag]",
+ "value": "12"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "PUSH [tag]",
+ "value": "34"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "JUMP"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "tag",
+ "value": "33"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "ADD"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "ADD"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP6"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "ADD"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP4"
+ },
+ {
+ "begin": 18,
+ "end": 20,
+ "name": "DUP3"
+ },
+ {
+ "begin": 18,
+ "end": 20,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 13,
+ "end": 16,
+ "name": "PUSH [tag]",
+ "value": "14"
+ },
+ {
+ "begin": 7,
+ "end": 12,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 32,
+ "end": 37,
+ "name": "tag",
+ "value": "36"
+ },
+ {
+ "begin": 32,
+ "end": 37,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 59,
+ "end": 62,
+ "name": "DUP1"
+ },
+ {
+ "begin": 53,
+ "end": 58,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 48,
+ "end": 51,
+ "name": "DUP3"
+ },
+ {
+ "begin": 41,
+ "end": 47,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 93,
+ "end": 95,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 88,
+ "end": 91,
+ "name": "DUP4"
+ },
+ {
+ "begin": 85,
+ "end": 87,
+ "name": "GT"
+ },
+ {
+ "begin": 78,
+ "end": 84,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 73,
+ "end": 76,
+ "name": "PUSH [tag]",
+ "value": "14"
+ },
+ {
+ "begin": 67,
+ "end": 72,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 152,
+ "end": 155,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0"
+ },
+ {
+ "begin": 152,
+ "end": 155,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 152,
+ "end": 155,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 152,
+ "end": 155,
+ "name": "ADD"
+ },
+ {
+ "begin": 152,
+ "end": 155,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 117,
+ "end": 119,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 108,
+ "end": 111,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 108,
+ "end": 111,
+ "name": "DUP3"
+ },
+ {
+ "begin": 108,
+ "end": 111,
+ "name": "ADD"
+ },
+ {
+ "begin": 108,
+ "end": 111,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 130,
+ "end": 133,
+ "name": "ADD"
+ },
+ {
+ "begin": 172,
+ "end": 177,
+ "name": "PUSH [tag]",
+ "value": "15"
+ },
+ {
+ "begin": 167,
+ "end": 171,
+ "name": "JUMP"
+ },
+ {
+ "begin": 181,
+ "end": 184,
+ "name": "tag",
+ "value": "35"
+ },
+ {
+ "begin": 181,
+ "end": 184,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP2"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "ADD"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "1F"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "AND"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH [tag]",
+ "value": "16"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP3"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SUB"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP4"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SUB"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "100"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "EXP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SUB"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "NOT"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "AND"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP2"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "ADD"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "tag",
+ "value": "37"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "POP"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "DUP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SUB"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 3,
+ "end": 189,
+ "name": "RETURN"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "tag",
+ "value": "9"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "CALLVALUE"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "PUSH [tag]",
+ "value": "38"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "INVALID"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "tag",
+ "value": "38"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "PUSH [tag]",
+ "value": "18"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "PUSH",
+ "value": "4"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "AND"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "PUSH",
+ "value": "24"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "PUSH [tag]",
+ "value": "40"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "JUMP"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "tag",
+ "value": "39"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "DUP1"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "DUP3"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "DUP2"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "SUB"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "ADD"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "RETURN"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "tag",
+ "value": "10"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "CALLVALUE"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "PUSH [tag]",
+ "value": "41"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "INVALID"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "tag",
+ "value": "41"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "PUSH [tag]",
+ "value": "21"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "PUSH",
+ "value": "4"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "AND"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "PUSH",
+ "value": "24"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "CALLDATALOAD"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "AND"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "PUSH [tag]",
+ "value": "43"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "JUMP"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "tag",
+ "value": "42"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "SUB"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "ADD"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "RETURN"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "tag",
+ "value": "13"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP1"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP1"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP3"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "ADD"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "PUSH",
+ "value": "11"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP2"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "PUSH",
+ "value": "30782050726F746F636F6C20546F6B656E000000000000000000000000000000"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP3"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "ADD"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "DUP2"
+ },
+ {
+ "begin": 980,
+ "end": 1029,
+ "name": "JUMP",
+ "value": "[out]"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "tag",
+ "value": "19"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1161,
+ "end": 1171,
+ "name": "CALLER"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "AND"
+ },
+ {
+ "begin": 1137,
+ "end": 1141,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1153,
+ "end": 1160,
+ "name": "PUSH",
+ "value": "1"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "SWAP5"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "DUP8"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "AND"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "DUP5"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "SWAP5"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1153,
+ "end": 1191,
+ "name": "DUP7"
+ },
+ {
+ "begin": 1153,
+ "end": 1191,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1153,
+ "end": 1191,
+ "name": "SSTORE"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "DUP7"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1137,
+ "end": 1141,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1137,
+ "end": 1141,
+ "name": "SWAP5"
+ },
+ {
+ "begin": 1153,
+ "end": 1182,
+ "name": "SWAP4"
+ },
+ {
+ "begin": 1153,
+ "end": 1172,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "PUSH",
+ "value": "8C5BE1E5EBEC7D5BD14F71427D1E84F3DD0314C0F7B2291E5B200AC8C7C3B925"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "SUB"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "ADD"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1201,
+ "end": 1239,
+ "name": "LOG3"
+ },
+ {
+ "begin": -1,
+ "end": -1,
+ "name": "POP"
+ },
+ {
+ "begin": 1256,
+ "end": 1260,
+ "name": "PUSH",
+ "value": "1"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "tag",
+ "value": "44"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "POP"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "POP"
+ },
+ {
+ "begin": 1080,
+ "end": 1267,
+ "name": "JUMP",
+ "value": "[out]"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "tag",
+ "value": "22"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "PUSH",
+ "value": "3"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "DUP2"
+ },
+ {
+ "begin": 900,
+ "end": 935,
+ "name": "JUMP",
+ "value": "[out]"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "tag",
+ "value": "25"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "DUP5"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "AND"
+ },
+ {
+ "begin": 1149,
+ "end": 1153,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1186,
+ "end": 1193,
+ "name": "PUSH",
+ "value": "1"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1186,
+ "end": 1200,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1201,
+ "end": 1211,
+ "name": "CALLER"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "SWAP6"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "AND"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "SWAP4"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1186,
+ "end": 1212,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 1226,
+ "end": 1241,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1226,
+ "end": 1241,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1226,
+ "end": 1241,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1226,
+ "end": 1241,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1226,
+ "end": 1241,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1226,
+ "end": 1241,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1226,
+ "end": 1241,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1226,
+ "end": 1241,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1226,
+ "end": 1241,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1226,
+ "end": 1241,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 1226,
+ "end": 1251,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1226,
+ "end": 1251,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1226,
+ "end": 1251,
+ "name": "LT"
+ },
+ {
+ "begin": 1226,
+ "end": 1251,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1226,
+ "end": 1251,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1226,
+ "end": 1251,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1226,
+ "end": 1286,
+ "name": "PUSH [tag]",
+ "value": "46"
+ },
+ {
+ "begin": 1226,
+ "end": 1286,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 1226,
+ "end": 1286,
+ "name": "POP"
+ },
+ {
+ "begin": 1280,
+ "end": 1286,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1267,
+ "end": 1276,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1267,
+ "end": 1286,
+ "name": "LT"
+ },
+ {
+ "begin": 1267,
+ "end": 1286,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1226,
+ "end": 1286,
+ "name": "tag",
+ "value": "46"
+ },
+ {
+ "begin": 1226,
+ "end": 1286,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1226,
+ "end": 1341,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1226,
+ "end": 1341,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1226,
+ "end": 1341,
+ "name": "PUSH [tag]",
+ "value": "47"
+ },
+ {
+ "begin": 1226,
+ "end": 1341,
+ "name": "JUMPI"
+ },
+ {
+ "begin": -1,
+ "end": -1,
+ "name": "POP"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "DUP5"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "AND"
+ },
+ {
+ "begin": 1328,
+ "end": 1336,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1328,
+ "end": 1341,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 1302,
+ "end": 1324,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1302,
+ "end": 1324,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1302,
+ "end": 1324,
+ "name": "ADD"
+ },
+ {
+ "begin": 1302,
+ "end": 1341,
+ "name": "LT"
+ },
+ {
+ "begin": 1302,
+ "end": 1341,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1226,
+ "end": 1341,
+ "name": "tag",
+ "value": "47"
+ },
+ {
+ "begin": 1226,
+ "end": 1341,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1222,
+ "end": 1657,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1222,
+ "end": 1657,
+ "name": "PUSH [tag]",
+ "value": "48"
+ },
+ {
+ "begin": 1222,
+ "end": 1657,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "DUP6"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "AND"
+ },
+ {
+ "begin": 1366,
+ "end": 1374,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1366,
+ "end": 1379,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1366,
+ "end": 1389,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1366,
+ "end": 1389,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 1366,
+ "end": 1389,
+ "name": "DUP8"
+ },
+ {
+ "begin": 1366,
+ "end": 1389,
+ "name": "ADD"
+ },
+ {
+ "begin": 1366,
+ "end": 1389,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1366,
+ "end": 1389,
+ "name": "SSTORE"
+ },
+ {
+ "begin": 1403,
+ "end": 1418,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1403,
+ "end": 1418,
+ "name": "DUP8"
+ },
+ {
+ "begin": 1403,
+ "end": 1418,
+ "name": "AND"
+ },
+ {
+ "begin": 1403,
+ "end": 1418,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1403,
+ "end": 1418,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1403,
+ "end": 1418,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1403,
+ "end": 1428,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1403,
+ "end": 1428,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 1403,
+ "end": 1428,
+ "name": "DUP5"
+ },
+ {
+ "begin": 1403,
+ "end": 1428,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1403,
+ "end": 1428,
+ "name": "SUB"
+ },
+ {
+ "begin": 1403,
+ "end": 1428,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1403,
+ "end": 1428,
+ "name": "SSTORE"
+ },
+ {
+ "begin": 756,
+ "end": 766,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1446,
+ "end": 1466,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1446,
+ "end": 1466,
+ "name": "LT"
+ },
+ {
+ "begin": 1442,
+ "end": 1537,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 1442,
+ "end": 1537,
+ "name": "PUSH [tag]",
+ "value": "49"
+ },
+ {
+ "begin": 1442,
+ "end": 1537,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "DUP7"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "AND"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1486,
+ "end": 1493,
+ "name": "PUSH",
+ "value": "1"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1486,
+ "end": 1500,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1501,
+ "end": 1511,
+ "name": "CALLER"
+ },
+ {
+ "begin": 1486,
+ "end": 1512,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1486,
+ "end": 1512,
+ "name": "SWAP5"
+ },
+ {
+ "begin": 1486,
+ "end": 1512,
+ "name": "AND"
+ },
+ {
+ "begin": 1486,
+ "end": 1512,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1486,
+ "end": 1512,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1486,
+ "end": 1512,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1486,
+ "end": 1512,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1486,
+ "end": 1512,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1486,
+ "end": 1512,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1486,
+ "end": 1522,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1486,
+ "end": 1522,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 1486,
+ "end": 1522,
+ "name": "DUP5"
+ },
+ {
+ "begin": 1486,
+ "end": 1522,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1486,
+ "end": 1522,
+ "name": "SUB"
+ },
+ {
+ "begin": 1486,
+ "end": 1522,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1486,
+ "end": 1522,
+ "name": "SSTORE"
+ },
+ {
+ "begin": 1442,
+ "end": 1537,
+ "name": "tag",
+ "value": "49"
+ },
+ {
+ "begin": 1442,
+ "end": 1537,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1566,
+ "end": 1569,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "AND"
+ },
+ {
+ "begin": 1559,
+ "end": 1564,
+ "name": "DUP6"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "AND"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "PUSH",
+ "value": "DDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF"
+ },
+ {
+ "begin": 1571,
+ "end": 1577,
+ "name": "DUP6"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "ADD"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "POP"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "POP"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "SUB"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1550,
+ "end": 1578,
+ "name": "LOG3"
+ },
+ {
+ "begin": 1599,
+ "end": 1603,
+ "name": "PUSH",
+ "value": "1"
+ },
+ {
+ "begin": 1592,
+ "end": 1603,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1592,
+ "end": 1603,
+ "name": "POP"
+ },
+ {
+ "begin": 1592,
+ "end": 1603,
+ "name": "PUSH [tag]",
+ "value": "50"
+ },
+ {
+ "begin": 1592,
+ "end": 1603,
+ "name": "JUMP"
+ },
+ {
+ "begin": 1222,
+ "end": 1657,
+ "name": "tag",
+ "value": "48"
+ },
+ {
+ "begin": 1222,
+ "end": 1657,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1641,
+ "end": 1646,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 1634,
+ "end": 1646,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1634,
+ "end": 1646,
+ "name": "POP"
+ },
+ {
+ "begin": 1222,
+ "end": 1657,
+ "name": "tag",
+ "value": "50"
+ },
+ {
+ "begin": 1222,
+ "end": 1657,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "tag",
+ "value": "45"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "POP"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "SWAP4"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "POP"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "POP"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "POP"
+ },
+ {
+ "begin": 1054,
+ "end": 1663,
+ "name": "JUMP",
+ "value": "[out]"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "tag",
+ "value": "28"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 892,
+ "end": 894,
+ "name": "PUSH",
+ "value": "12"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "DUP2"
+ },
+ {
+ "begin": 859,
+ "end": 894,
+ "name": "JUMP",
+ "value": "[out]"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "tag",
+ "value": "31"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "AND"
+ },
+ {
+ "begin": 1028,
+ "end": 1032,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1051,
+ "end": 1067,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "tag",
+ "value": "51"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "POP"
+ },
+ {
+ "begin": 975,
+ "end": 1074,
+ "name": "JUMP",
+ "value": "[out]"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "tag",
+ "value": "34"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "ADD"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "PUSH",
+ "value": "3"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "PUSH",
+ "value": "5A52580000000000000000000000000000000000000000000000000000000000"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP3"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "ADD"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1035,
+ "end": 1072,
+ "name": "JUMP",
+ "value": "[out]"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "tag",
+ "value": "40"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 269,
+ "end": 279,
+ "name": "CALLER"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "AND"
+ },
+ {
+ "begin": 171,
+ "end": 175,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "DUP2"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "DUP2"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "DUP2"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "SHA3"
+ },
+ {
+ "begin": 260,
+ "end": 280,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 260,
+ "end": 290,
+ "name": "DUP3"
+ },
+ {
+ "begin": 260,
+ "end": 290,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 260,
+ "end": 290,
+ "name": "LT"
+ },
+ {
+ "begin": 260,
+ "end": 290,
+ "name": "DUP1"
+ },
+ {
+ "begin": 260,
+ "end": 290,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 260,
+ "end": 290,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 260,
+ "end": 333,
+ "name": "PUSH [tag]",
+ "value": "53"
+ },
+ {
+ "begin": 260,
+ "end": 333,
+ "name": "JUMPI"
+ },
+ {
+ "begin": -1,
+ "end": -1,
+ "name": "POP"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "DUP4"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "AND"
+ },
+ {
+ "begin": 320,
+ "end": 328,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "DUP2"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "DUP2"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "SHA3"
+ },
+ {
+ "begin": 320,
+ "end": 333,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 294,
+ "end": 316,
+ "name": "DUP3"
+ },
+ {
+ "begin": 294,
+ "end": 316,
+ "name": "DUP2"
+ },
+ {
+ "begin": 294,
+ "end": 316,
+ "name": "ADD"
+ },
+ {
+ "begin": 294,
+ "end": 333,
+ "name": "LT"
+ },
+ {
+ "begin": 294,
+ "end": 333,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 260,
+ "end": 333,
+ "name": "tag",
+ "value": "53"
+ },
+ {
+ "begin": 260,
+ "end": 333,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 256,
+ "end": 522,
+ "name": "ISZERO"
+ },
+ {
+ "begin": 256,
+ "end": 522,
+ "name": "PUSH [tag]",
+ "value": "54"
+ },
+ {
+ "begin": 256,
+ "end": 522,
+ "name": "JUMPI"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 358,
+ "end": 368,
+ "name": "CALLER"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "DUP2"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "AND"
+ },
+ {
+ "begin": 349,
+ "end": 357,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "DUP2"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "DUP2"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "DUP2"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "DUP2"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "DUP1"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "DUP4"
+ },
+ {
+ "begin": 349,
+ "end": 369,
+ "name": "SHA3"
+ },
+ {
+ "begin": 349,
+ "end": 379,
+ "name": "DUP1"
+ },
+ {
+ "begin": 349,
+ "end": 379,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 349,
+ "end": 379,
+ "name": "DUP9"
+ },
+ {
+ "begin": 349,
+ "end": 379,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 349,
+ "end": 379,
+ "name": "SUB"
+ },
+ {
+ "begin": 349,
+ "end": 379,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 349,
+ "end": 379,
+ "name": "SSTORE"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "SWAP4"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "DUP8"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "AND"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "DUP1"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "DUP4"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "DUP5"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "SHA3"
+ },
+ {
+ "begin": 393,
+ "end": 416,
+ "name": "DUP1"
+ },
+ {
+ "begin": 393,
+ "end": 416,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 393,
+ "end": 416,
+ "name": "DUP8"
+ },
+ {
+ "begin": 393,
+ "end": 416,
+ "name": "ADD"
+ },
+ {
+ "begin": 393,
+ "end": 416,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 393,
+ "end": 416,
+ "name": "SSTORE"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "DUP4"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "DUP7"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "DUP2"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "SWAP4"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "MLOAD"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 393,
+ "end": 406,
+ "name": "SWAP4"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "PUSH",
+ "value": "DDF252AD1BE2C89B69C2B068FC378DAA952BA7F163C4A11628F55A4DF523B3EF"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "DUP2"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "SUB"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "ADD"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 430,
+ "end": 463,
+ "name": "LOG3"
+ },
+ {
+ "begin": -1,
+ "end": -1,
+ "name": "POP"
+ },
+ {
+ "begin": 484,
+ "end": 488,
+ "name": "PUSH",
+ "value": "1"
+ },
+ {
+ "begin": 477,
+ "end": 488,
+ "name": "PUSH [tag]",
+ "value": "44"
+ },
+ {
+ "begin": 477,
+ "end": 488,
+ "name": "JUMP"
+ },
+ {
+ "begin": 256,
+ "end": 522,
+ "name": "tag",
+ "value": "54"
+ },
+ {
+ "begin": 256,
+ "end": 522,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": -1,
+ "end": -1,
+ "name": "POP"
+ },
+ {
+ "begin": 514,
+ "end": 519,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 507,
+ "end": 519,
+ "name": "PUSH [tag]",
+ "value": "44"
+ },
+ {
+ "begin": 507,
+ "end": 519,
+ "name": "JUMP"
+ },
+ {
+ "begin": 256,
+ "end": 522,
+ "name": "tag",
+ "value": "55"
+ },
+ {
+ "begin": 256,
+ "end": 522,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "tag",
+ "value": "52"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "POP"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "POP"
+ },
+ {
+ "begin": 118,
+ "end": 528,
+ "name": "JUMP",
+ "value": "[out]"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "tag",
+ "value": "43"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "PUSH",
+ "value": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "AND"
+ },
+ {
+ "begin": 1344,
+ "end": 1348,
+ "name": "PUSH",
+ "value": "0"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1367,
+ "end": 1374,
+ "name": "PUSH",
+ "value": "1"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "PUSH",
+ "value": "20"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "DUP2"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "PUSH",
+ "value": "40"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "DUP1"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1367,
+ "end": 1382,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1367,
+ "end": 1392,
+ "name": "SWAP4"
+ },
+ {
+ "begin": 1367,
+ "end": 1392,
+ "name": "DUP6"
+ },
+ {
+ "begin": 1367,
+ "end": 1392,
+ "name": "AND"
+ },
+ {
+ "begin": 1367,
+ "end": 1392,
+ "name": "DUP4"
+ },
+ {
+ "begin": 1367,
+ "end": 1392,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1367,
+ "end": 1392,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1367,
+ "end": 1392,
+ "name": "SWAP1"
+ },
+ {
+ "begin": 1367,
+ "end": 1392,
+ "name": "MSTORE"
+ },
+ {
+ "begin": 1367,
+ "end": 1392,
+ "name": "SHA3"
+ },
+ {
+ "begin": 1367,
+ "end": 1392,
+ "name": "SLOAD"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "tag",
+ "value": "56"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "JUMPDEST"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "SWAP3"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "SWAP2"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "POP"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "POP"
+ },
+ {
+ "begin": 1273,
+ "end": 1399,
+ "name": "JUMP",
+ "value": "[out]"
+ }
+ ]
+ }
+ }
+ },
+ "methodIdentifiers": {
+ "allowance(address,address)": "dd62ed3e",
+ "approve(address,uint256)": "095ea7b3",
+ "balanceOf(address)": "70a08231",
+ "decimals()": "313ce567",
+ "name()": "06fdde03",
+ "symbol()": "95d89b41",
+ "totalSupply()": "18160ddd",
+ "transfer(address,uint256)": "a9059cbb",
+ "transferFrom(address,address,uint256)": "23b872dd"
+ }
+ },
+ "metadata": "{\"compiler\":{\"version\":\"0.4.11+commit.68ef5810\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"_owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"_spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{\"transferFrom(address,address,uint256)\":{\"details\":\"ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.\",\"params\":{\"_from\":\"Address to transfer from.\",\"_to\":\"Address to transfer to.\",\"_value\":\"Amount to transfer.\"},\"return\":\"Success of transfer.\"}}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"tokens/ZRXToken/ZRXToken.sol\":\"ZRXToken\"},\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"tokens/ZRXToken/ERC20Token_v1.sol\":{\"keccak256\":\"0xb37e1b31fcb212e2f302f964e4d201f6bfb3edba352e2692d190318e0bbe6ef3\",\"urls\":[\"bzzr://a583a8d755ace618c390a195bdc5a41b31acacc557d700b9e6dda25b8b2bbd86\"]},\"tokens/ZRXToken/Token_v1.sol\":{\"keccak256\":\"0x35a82bc7bc0994caa97f8ea44660b9b5e796acfe72705b5ff7ed8f2a3c47ff37\",\"urls\":[\"bzzr://a62ae857a4cf2e8948e36d02470c612ac1a5ac20ebe1c1b553ad1ed8becb634e\"]},\"tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol\":{\"keccak256\":\"0x88407c04524146871b886fa2c61c7f43fc3348496ac7397a8a833abbc4d4771e\",\"urls\":[\"bzzr://461c05bcba1047c6d9c4e79219175bd1ceb13e2cdf1898359b869b665ea9433b\"]},\"tokens/ZRXToken/ZRXToken.sol\":{\"keccak256\":\"0x2b0b47552c70488cb373f260877a1553ed93509fbfd7629b251f85875a686c5f\",\"urls\":[\"bzzr://2af318e212d5b51b20a27c74ee302e5345752b5d6aaf79a7d3e07230aed8819c\"]}},\"version\":1}",
+ "userdoc": {
+ "methods": {}
+ }
+ },
+ "sources": {
+ "tokens/ZRXToken/ZRXToken.sol": {
+ "id": 3
+ },
+ "tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol": {
+ "id": 2
+ },
+ "tokens/ZRXToken/ERC20Token_v1.sol": {
+ "id": 0
+ },
+ "tokens/ZRXToken/Token_v1.sol": {
+ "id": 1
+ }
+ },
+ "sourceCodes": {
+ "tokens/ZRXToken/ZRXToken.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity 0.4.11;\n\n// solhint-disable-next-line max-line-length\nimport { UnlimitedAllowanceToken_v1 as UnlimitedAllowanceToken } from \"./UnlimitedAllowanceToken_v1.sol\";\n\n\ncontract ZRXToken is \n UnlimitedAllowanceToken\n{\n\n // solhint-disable const-name-snakecase\n uint8 constant public decimals = 18;\n uint256 public totalSupply = 10**27; // 1 billion tokens, 18 decimal places\n string constant public name = \"0x Protocol Token\";\n string constant public symbol = \"ZRX\";\n // solhint-enableconst-name-snakecase\n\n function ZRXToken()\n public\n {\n balances[msg.sender] = totalSupply;\n }\n}\n",
+ "tokens/ZRXToken/UnlimitedAllowanceToken_v1.sol": "/*\n\n Copyright 2018 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.4.11;\n\nimport { ERC20Token_v1 as ERC20Token } from \"./ERC20Token_v1.sol\";\n\ncontract UnlimitedAllowanceToken_v1 is ERC20Token {\n\n uint constant MAX_UINT = 2**256 - 1;\n\n /// @dev ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance.\n /// @param _from Address to transfer from.\n /// @param _to Address to transfer to.\n /// @param _value Amount to transfer.\n /// @return Success of transfer.\n function transferFrom(address _from, address _to, uint _value)\n public\n returns (bool)\n {\n uint allowance = allowed[_from][msg.sender];\n if (balances[_from] >= _value\n && allowance >= _value\n && balances[_to] + _value >= balances[_to]\n ) {\n balances[_to] += _value;\n balances[_from] -= _value;\n if (allowance < MAX_UINT) {\n allowed[_from][msg.sender] -= _value;\n }\n Transfer(_from, _to, _value);\n return true;\n } else {\n return false;\n }\n }\n}\n",
+ "tokens/ZRXToken/ERC20Token_v1.sol": "pragma solidity ^0.4.11;\n\nimport { Token_v1 as Token } from \"./Token_v1.sol\";\n\ncontract ERC20Token_v1 is Token {\n\n function transfer(address _to, uint _value) returns (bool) {\n //Default assumes totalSupply can't be over max (2^256 - 1).\n if (balances[msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {\n balances[msg.sender] -= _value;\n balances[_to] += _value;\n Transfer(msg.sender, _to, _value);\n return true;\n } else { return false; }\n }\n\n function transferFrom(address _from, address _to, uint _value) returns (bool) {\n if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value >= balances[_to]) {\n balances[_to] += _value;\n balances[_from] -= _value;\n allowed[_from][msg.sender] -= _value;\n Transfer(_from, _to, _value);\n return true;\n } else { return false; }\n }\n\n function balanceOf(address _owner) constant returns (uint) {\n return balances[_owner];\n }\n\n function approve(address _spender, uint _value) returns (bool) {\n allowed[msg.sender][_spender] = _value;\n Approval(msg.sender, _spender, _value);\n return true;\n }\n\n function allowance(address _owner, address _spender) constant returns (uint) {\n return allowed[_owner][_spender];\n }\n\n mapping (address => uint) balances;\n mapping (address => mapping (address => uint)) allowed;\n uint public totalSupply;\n}\n",
+ "tokens/ZRXToken/Token_v1.sol": "pragma solidity ^0.4.11;\n\ncontract Token_v1 {\n\n /// @return total amount of tokens\n function totalSupply() constant returns (uint supply) {}\n\n /// @param _owner The address from which the balance will be retrieved\n /// @return The balance\n function balanceOf(address _owner) constant returns (uint balance) {}\n\n /// @notice send `_value` token to `_to` from `msg.sender`\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return Whether the transfer was successful or not\n function transfer(address _to, uint _value) returns (bool success) {}\n\n /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`\n /// @param _from The address of the sender\n /// @param _to The address of the recipient\n /// @param _value The amount of token to be transferred\n /// @return Whether the transfer was successful or not\n function transferFrom(address _from, address _to, uint _value) returns (bool success) {}\n\n /// @notice `msg.sender` approves `_addr` to spend `_value` tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @param _value The amount of wei to be approved for transfer\n /// @return Whether the approval was successful or not\n function approve(address _spender, uint _value) returns (bool success) {}\n\n /// @param _owner The address of the account owning tokens\n /// @param _spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address _owner, address _spender) constant returns (uint remaining) {}\n\n event Transfer(address indexed _from, address indexed _to, uint _value);\n event Approval(address indexed _owner, address indexed _spender, uint _value);\n}\n\n"
+ },
+ "sourceTreeHashHex": "0x544edb4a6a886e7483e4b5b0931f3a7acf15a9a252f007bb05ebf98ab091fd6a",
+ "compiler": {
+ "name": "solc",
+ "version": "soljson-v0.4.11+commit.68ef5810.js",
+ "settings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ }
+ },
+ "networks": {}
+} \ No newline at end of file
diff --git a/packages/contracts/generated-wrappers/asset_proxy_owner.ts b/packages/contracts/generated-wrappers/asset_proxy_owner.ts
new file mode 100644
index 000000000..8ca70e026
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/generated-wrappers/dummy_erc20_token.ts b/packages/contracts/generated-wrappers/dummy_erc20_token.ts
new file mode 100644
index 000000000..1efeeed0a
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/generated-wrappers/dummy_erc721_receiver.ts b/packages/contracts/generated-wrappers/dummy_erc721_receiver.ts
new file mode 100644
index 000000000..49fd3ca20
--- /dev/null
+++ b/packages/contracts/generated-wrappers/dummy_erc721_receiver.ts
@@ -0,0 +1,231 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type DummyERC721ReceiverEventArgs =
+ | DummyERC721ReceiverTokenReceivedEventArgs;
+
+export enum DummyERC721ReceiverEvents {
+ TokenReceived = 'TokenReceived',
+}
+
+export interface DummyERC721ReceiverTokenReceivedEventArgs extends DecodedLogArgs {
+ operator: string;
+ from: string;
+ tokenId: BigNumber;
+ data: string;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class DummyERC721ReceiverContract extends BaseContract {
+ public onERC721Received = {
+ async sendTransactionAsync(
+ _operator: string,
+ _from: string,
+ _tokenId: BigNumber,
+ _data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as DummyERC721ReceiverContract;
+ const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs;
+ [_operator,
+ _from,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ]);
+ const encodedData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator,
+ _from,
+ _tokenId,
+ _data
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.onERC721Received.estimateGasAsync.bind(
+ self,
+ _operator,
+ _from,
+ _tokenId,
+ _data
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _operator: string,
+ _from: string,
+ _tokenId: BigNumber,
+ _data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as DummyERC721ReceiverContract;
+ const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs;
+ [_operator,
+ _from,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator,
+ _from,
+ _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(
+ _operator: string,
+ _from: string,
+ _tokenId: BigNumber,
+ _data: string,
+ ): string {
+ const self = this as any as DummyERC721ReceiverContract;
+ const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs;
+ [_operator,
+ _from,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator,
+ _from,
+ _tokenId,
+ _data
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _operator: string,
+ _from: string,
+ _tokenId: BigNumber,
+ _data: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyERC721ReceiverContract;
+ const functionSignature = 'onERC721Received(address,address,uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_operator,
+ _from,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.onERC721Received;
+ const encodedData = ethersFunction.encode([_operator,
+ _from,
+ _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: 'onERC721Received'}) 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<DummyERC721ReceiverContract> {
+ 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 DummyERC721ReceiverContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<DummyERC721ReceiverContract> {
+ 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(`DummyERC721Receiver successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new DummyERC721ReceiverContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('DummyERC721Receiver', 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/contracts/generated-wrappers/dummy_erc721_token.ts b/packages/contracts/generated-wrappers/dummy_erc721_token.ts
new file mode 100644
index 000000000..cc5f9679f
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/generated-wrappers/dummy_multiple_return_erc20_token.ts b/packages/contracts/generated-wrappers/dummy_multiple_return_erc20_token.ts
new file mode 100644
index 000000000..d8a4c0f89
--- /dev/null
+++ b/packages/contracts/generated-wrappers/dummy_multiple_return_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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type DummyMultipleReturnERC20TokenEventArgs =
+ | DummyMultipleReturnERC20TokenTransferEventArgs
+ | DummyMultipleReturnERC20TokenApprovalEventArgs;
+
+export enum DummyMultipleReturnERC20TokenEvents {
+ Transfer = 'Transfer',
+ Approval = 'Approval',
+}
+
+export interface DummyMultipleReturnERC20TokenTransferEventArgs extends DecodedLogArgs {
+ _from: string;
+ _to: string;
+ _value: BigNumber;
+}
+
+export interface DummyMultipleReturnERC20TokenApprovalEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _spender: string;
+ _value: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class DummyMultipleReturnERC20TokenContract extends BaseContract {
+ public name = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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 DummyMultipleReturnERC20TokenContract;
+ 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<DummyMultipleReturnERC20TokenContract> {
+ 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 DummyMultipleReturnERC20TokenContract.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<DummyMultipleReturnERC20TokenContract> {
+ 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(`DummyMultipleReturnERC20Token successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new DummyMultipleReturnERC20TokenContract(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('DummyMultipleReturnERC20Token', 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/contracts/generated-wrappers/dummy_no_return_erc20_token.ts b/packages/contracts/generated-wrappers/dummy_no_return_erc20_token.ts
new file mode 100644
index 000000000..6bf32ae48
--- /dev/null
+++ b/packages/contracts/generated-wrappers/dummy_no_return_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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type DummyNoReturnERC20TokenEventArgs =
+ | DummyNoReturnERC20TokenTransferEventArgs
+ | DummyNoReturnERC20TokenApprovalEventArgs;
+
+export enum DummyNoReturnERC20TokenEvents {
+ Transfer = 'Transfer',
+ Approval = 'Approval',
+}
+
+export interface DummyNoReturnERC20TokenTransferEventArgs extends DecodedLogArgs {
+ _from: string;
+ _to: string;
+ _value: BigNumber;
+}
+
+export interface DummyNoReturnERC20TokenApprovalEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _spender: string;
+ _value: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class DummyNoReturnERC20TokenContract extends BaseContract {
+ public name = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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 DummyNoReturnERC20TokenContract;
+ 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<DummyNoReturnERC20TokenContract> {
+ 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 DummyNoReturnERC20TokenContract.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<DummyNoReturnERC20TokenContract> {
+ 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(`DummyNoReturnERC20Token successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new DummyNoReturnERC20TokenContract(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('DummyNoReturnERC20Token', 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/contracts/generated-wrappers/erc20_proxy.ts b/packages/contracts/generated-wrappers/erc20_proxy.ts
new file mode 100644
index 000000000..ab207b38e
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/generated-wrappers/erc20_token.ts b/packages/contracts/generated-wrappers/erc20_token.ts
new file mode 100644
index 000000000..8ee563b7e
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/generated-wrappers/erc721_proxy.ts b/packages/contracts/generated-wrappers/erc721_proxy.ts
new file mode 100644
index 000000000..691c55578
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/generated-wrappers/erc721_token.ts b/packages/contracts/generated-wrappers/erc721_token.ts
new file mode 100644
index 000000000..d1a2d5670
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/generated-wrappers/exchange.ts b/packages/contracts/generated-wrappers/exchange.ts
new file mode 100644
index 000000000..92245067a
--- /dev/null
+++ b/packages/contracts/generated-wrappers/exchange.ts
@@ -0,0 +1,3079 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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>,
+ _zrxAssetData: string,
+ ): 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, _zrxAssetData
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _zrxAssetData: string,
+ ): Promise<ExchangeContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_zrxAssetData
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_zrxAssetData
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_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(`Exchange successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ExchangeContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_zrxAssetData
+];
+ 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/contracts/generated-wrappers/exchange_wrapper.ts b/packages/contracts/generated-wrappers/exchange_wrapper.ts
new file mode 100644
index 000000000..75d355e79
--- /dev/null
+++ b/packages/contracts/generated-wrappers/exchange_wrapper.ts
@@ -0,0 +1,378 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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 ExchangeWrapperContract extends BaseContract {
+ 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,
+ salt: BigNumber,
+ orderSignature: string,
+ takerSignature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeWrapperContract;
+ const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ]);
+ const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').functions.fillOrder.encode([order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.fillOrder.estimateGasAsync.bind(
+ self,
+ order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ),
+ );
+ 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,
+ salt: BigNumber,
+ orderSignature: string,
+ takerSignature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeWrapperContract;
+ const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').functions.fillOrder.encode([order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ]);
+ 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,
+ salt: BigNumber,
+ orderSignature: string,
+ takerSignature: string,
+ ): string {
+ const self = this as any as ExchangeWrapperContract;
+ const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').functions.fillOrder.encode([order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ]);
+ 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,
+ salt: BigNumber,
+ orderSignature: string,
+ takerSignature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ExchangeWrapperContract;
+ const functionSignature = 'fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrder;
+ const encodedData = ethersFunction.encode([order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature,
+ takerSignature
+ ]);
+ 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;
+ },
+ };
+ public cancelOrdersUpTo = {
+ async sendTransactionAsync(
+ targetOrderEpoch: BigNumber,
+ salt: BigNumber,
+ makerSignature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ExchangeWrapperContract;
+ const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256,uint256,bytes)').inputs;
+ [targetOrderEpoch,
+ salt,
+ makerSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch,
+ salt,
+ makerSignature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch,
+ salt,
+ makerSignature
+ ]);
+ const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256,uint256,bytes)').functions.cancelOrdersUpTo.encode([targetOrderEpoch,
+ salt,
+ makerSignature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.cancelOrdersUpTo.estimateGasAsync.bind(
+ self,
+ targetOrderEpoch,
+ salt,
+ makerSignature
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ targetOrderEpoch: BigNumber,
+ salt: BigNumber,
+ makerSignature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ExchangeWrapperContract;
+ const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256,uint256,bytes)').inputs;
+ [targetOrderEpoch,
+ salt,
+ makerSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch,
+ salt,
+ makerSignature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256,uint256,bytes)').functions.cancelOrdersUpTo.encode([targetOrderEpoch,
+ salt,
+ makerSignature
+ ]);
+ 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,
+ salt: BigNumber,
+ makerSignature: string,
+ ): string {
+ const self = this as any as ExchangeWrapperContract;
+ const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256,uint256,bytes)').inputs;
+ [targetOrderEpoch,
+ salt,
+ makerSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch,
+ salt,
+ makerSignature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrdersUpTo(uint256,uint256,bytes)').functions.cancelOrdersUpTo.encode([targetOrderEpoch,
+ salt,
+ makerSignature
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ targetOrderEpoch: BigNumber,
+ salt: BigNumber,
+ makerSignature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ExchangeWrapperContract;
+ const functionSignature = 'cancelOrdersUpTo(uint256,uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [targetOrderEpoch,
+ salt,
+ makerSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch,
+ salt,
+ makerSignature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch,
+ salt,
+ makerSignature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrdersUpTo;
+ const encodedData = ethersFunction.encode([targetOrderEpoch,
+ salt,
+ makerSignature
+ ]);
+ 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 static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _exchange: string,
+ ): Promise<ExchangeWrapperContract> {
+ 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 ExchangeWrapperContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _exchange: string,
+ ): Promise<ExchangeWrapperContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_exchange
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_exchange
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_exchange
+]);
+ 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(`ExchangeWrapper successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ExchangeWrapperContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_exchange
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('ExchangeWrapper', 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/contracts/generated-wrappers/forwarder.ts b/packages/contracts/generated-wrappers/forwarder.ts
new file mode 100644
index 000000000..80bbc52c7
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/generated-wrappers/i_asset_data.ts b/packages/contracts/generated-wrappers/i_asset_data.ts
new file mode 100644
index 000000000..b87068a0a
--- /dev/null
+++ b/packages/contracts/generated-wrappers/i_asset_data.ts
@@ -0,0 +1,143 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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 IAssetDataContract extends BaseContract {
+ public ERC721Token = {
+ async callAsync(
+ tokenContract: string,
+ tokenId: BigNumber,
+ receiverData: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as IAssetDataContract;
+ const functionSignature = 'ERC721Token(address,uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [tokenContract,
+ tokenId,
+ receiverData
+ ] = BaseContract._formatABIDataItemList(inputAbi, [tokenContract,
+ tokenId,
+ receiverData
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [tokenContract,
+ tokenId,
+ receiverData
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ERC721Token;
+ const encodedData = ethersFunction.encode([tokenContract,
+ tokenId,
+ receiverData
+ ]);
+ 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: 'ERC721Token'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public ERC20Token = {
+ async callAsync(
+ tokenContract: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as IAssetDataContract;
+ const functionSignature = 'ERC20Token(address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [tokenContract
+ ] = BaseContract._formatABIDataItemList(inputAbi, [tokenContract
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [tokenContract
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ERC20Token;
+ const encodedData = ethersFunction.encode([tokenContract
+ ]);
+ 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: 'ERC20Token'}) 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<IAssetDataContract> {
+ 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 IAssetDataContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<IAssetDataContract> {
+ 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(`IAssetData successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new IAssetDataContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('IAssetData', 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/contracts/generated-wrappers/i_asset_proxy.ts b/packages/contracts/generated-wrappers/i_asset_proxy.ts
new file mode 100644
index 000000000..d3b5e7109
--- /dev/null
+++ b/packages/contracts/generated-wrappers/i_asset_proxy.ts
@@ -0,0 +1,684 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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 IAssetProxyContract extends BaseContract {
+ public addAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 removeAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 removeAuthorizedAddressAtIndex = {
+ async sendTransactionAsync(
+ target: string,
+ index: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 transferFrom = {
+ async sendTransactionAsync(
+ assetData: string,
+ from: string,
+ to: string,
+ amount: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as IAssetProxyContract;
+ const inputAbi = self._lookupAbi('transferFrom(bytes,address,address,uint256)').inputs;
+ [assetData,
+ from,
+ to,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ]);
+ const encodedData = self._lookupEthersInterface('transferFrom(bytes,address,address,uint256)').functions.transferFrom.encode([assetData,
+ from,
+ to,
+ amount
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferFrom.estimateGasAsync.bind(
+ self,
+ assetData,
+ from,
+ to,
+ amount
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ assetData: string,
+ from: string,
+ to: string,
+ amount: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as IAssetProxyContract;
+ const inputAbi = self._lookupAbi('transferFrom(bytes,address,address,uint256)').inputs;
+ [assetData,
+ from,
+ to,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('transferFrom(bytes,address,address,uint256)').functions.transferFrom.encode([assetData,
+ from,
+ to,
+ 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,
+ from: string,
+ to: string,
+ amount: BigNumber,
+ ): string {
+ const self = this as any as IAssetProxyContract;
+ const inputAbi = self._lookupAbi('transferFrom(bytes,address,address,uint256)').inputs;
+ [assetData,
+ from,
+ to,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(bytes,address,address,uint256)').functions.transferFrom.encode([assetData,
+ from,
+ to,
+ amount
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ assetData: string,
+ from: string,
+ to: string,
+ amount: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as IAssetProxyContract;
+ const functionSignature = 'transferFrom(bytes,address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [assetData,
+ from,
+ to,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
+ const encodedData = ethersFunction.encode([assetData,
+ from,
+ to,
+ 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: '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 getProxyId = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as IAssetProxyContract;
+ 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 getAuthorizedAddresses = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string[]
+ > {
+ const self = this as any as IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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 IAssetProxyContract;
+ 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<IAssetProxyContract> {
+ 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 IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<IAssetProxyContract> {
+ 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(`IAssetProxy successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new IAssetProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('IAssetProxy', 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/contracts/generated-wrappers/invalid_erc721_receiver.ts b/packages/contracts/generated-wrappers/invalid_erc721_receiver.ts
new file mode 100644
index 000000000..08767de70
--- /dev/null
+++ b/packages/contracts/generated-wrappers/invalid_erc721_receiver.ts
@@ -0,0 +1,231 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type InvalidERC721ReceiverEventArgs =
+ | InvalidERC721ReceiverTokenReceivedEventArgs;
+
+export enum InvalidERC721ReceiverEvents {
+ TokenReceived = 'TokenReceived',
+}
+
+export interface InvalidERC721ReceiverTokenReceivedEventArgs extends DecodedLogArgs {
+ operator: string;
+ from: string;
+ tokenId: BigNumber;
+ data: string;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class InvalidERC721ReceiverContract extends BaseContract {
+ public onERC721Received = {
+ async sendTransactionAsync(
+ _operator: string,
+ _from: string,
+ _tokenId: BigNumber,
+ _data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as InvalidERC721ReceiverContract;
+ const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs;
+ [_operator,
+ _from,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ]);
+ const encodedData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator,
+ _from,
+ _tokenId,
+ _data
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.onERC721Received.estimateGasAsync.bind(
+ self,
+ _operator,
+ _from,
+ _tokenId,
+ _data
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _operator: string,
+ _from: string,
+ _tokenId: BigNumber,
+ _data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as InvalidERC721ReceiverContract;
+ const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs;
+ [_operator,
+ _from,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator,
+ _from,
+ _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(
+ _operator: string,
+ _from: string,
+ _tokenId: BigNumber,
+ _data: string,
+ ): string {
+ const self = this as any as InvalidERC721ReceiverContract;
+ const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs;
+ [_operator,
+ _from,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator,
+ _from,
+ _tokenId,
+ _data
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _operator: string,
+ _from: string,
+ _tokenId: BigNumber,
+ _data: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as InvalidERC721ReceiverContract;
+ const functionSignature = 'onERC721Received(address,address,uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_operator,
+ _from,
+ _tokenId,
+ _data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator,
+ _from,
+ _tokenId,
+ _data
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.onERC721Received;
+ const encodedData = ethersFunction.encode([_operator,
+ _from,
+ _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: 'onERC721Received'}) 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<InvalidERC721ReceiverContract> {
+ 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 InvalidERC721ReceiverContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<InvalidERC721ReceiverContract> {
+ 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(`InvalidERC721Receiver successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new InvalidERC721ReceiverContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('InvalidERC721Receiver', 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/contracts/generated-wrappers/mixin_authorizable.ts b/packages/contracts/generated-wrappers/mixin_authorizable.ts
new file mode 100644
index 000000000..58d5b69bb
--- /dev/null
+++ b/packages/contracts/generated-wrappers/mixin_authorizable.ts
@@ -0,0 +1,619 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type MixinAuthorizableEventArgs =
+ | MixinAuthorizableAuthorizedAddressAddedEventArgs
+ | MixinAuthorizableAuthorizedAddressRemovedEventArgs;
+
+export enum MixinAuthorizableEvents {
+ AuthorizedAddressAdded = 'AuthorizedAddressAdded',
+ AuthorizedAddressRemoved = 'AuthorizedAddressRemoved',
+}
+
+export interface MixinAuthorizableAuthorizedAddressAddedEventArgs extends DecodedLogArgs {
+ target: string;
+ caller: string;
+}
+
+export interface MixinAuthorizableAuthorizedAddressRemovedEventArgs extends DecodedLogArgs {
+ target: string;
+ caller: string;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class MixinAuthorizableContract extends BaseContract {
+ public addAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 authorized = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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 MixinAuthorizableContract;
+ 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<MixinAuthorizableContract> {
+ 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 MixinAuthorizableContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<MixinAuthorizableContract> {
+ 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(`MixinAuthorizable successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new MixinAuthorizableContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('MixinAuthorizable', 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/contracts/generated-wrappers/multi_sig_wallet.ts b/packages/contracts/generated-wrappers/multi_sig_wallet.ts
new file mode 100644
index 000000000..7f887b2fd
--- /dev/null
+++ b/packages/contracts/generated-wrappers/multi_sig_wallet.ts
@@ -0,0 +1,1432 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type MultiSigWalletEventArgs =
+ | MultiSigWalletConfirmationEventArgs
+ | MultiSigWalletRevocationEventArgs
+ | MultiSigWalletSubmissionEventArgs
+ | MultiSigWalletExecutionEventArgs
+ | MultiSigWalletExecutionFailureEventArgs
+ | MultiSigWalletDepositEventArgs
+ | MultiSigWalletOwnerAdditionEventArgs
+ | MultiSigWalletOwnerRemovalEventArgs
+ | MultiSigWalletRequirementChangeEventArgs;
+
+export enum MultiSigWalletEvents {
+ Confirmation = 'Confirmation',
+ Revocation = 'Revocation',
+ Submission = 'Submission',
+ Execution = 'Execution',
+ ExecutionFailure = 'ExecutionFailure',
+ Deposit = 'Deposit',
+ OwnerAddition = 'OwnerAddition',
+ OwnerRemoval = 'OwnerRemoval',
+ RequirementChange = 'RequirementChange',
+}
+
+export interface MultiSigWalletConfirmationEventArgs extends DecodedLogArgs {
+ sender: string;
+ transactionId: BigNumber;
+}
+
+export interface MultiSigWalletRevocationEventArgs extends DecodedLogArgs {
+ sender: string;
+ transactionId: BigNumber;
+}
+
+export interface MultiSigWalletSubmissionEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface MultiSigWalletExecutionEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface MultiSigWalletExecutionFailureEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface MultiSigWalletDepositEventArgs extends DecodedLogArgs {
+ sender: string;
+ value: BigNumber;
+}
+
+export interface MultiSigWalletOwnerAdditionEventArgs extends DecodedLogArgs {
+ owner: string;
+}
+
+export interface MultiSigWalletOwnerRemovalEventArgs extends DecodedLogArgs {
+ owner: string;
+}
+
+export interface MultiSigWalletRequirementChangeEventArgs extends DecodedLogArgs {
+ required: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class MultiSigWalletContract extends BaseContract {
+ public owners = {
+ async callAsync(
+ index_0: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 getTransactionCount = {
+ async callAsync(
+ pending: boolean,
+ executed: boolean,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as MultiSigWalletContract;
+ 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 addOwner = {
+ async sendTransactionAsync(
+ owner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 getConfirmationCount = {
+ async callAsync(
+ transactionId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MAX_OWNER_COUNT = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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 MultiSigWalletContract;
+ 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[],
+ _required: BigNumber,
+ ): Promise<MultiSigWalletContract> {
+ 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 MultiSigWalletContract.deployAsync(bytecode, abi, provider, txDefaults, _owners,
+_required
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _owners: string[],
+ _required: BigNumber,
+ ): Promise<MultiSigWalletContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_owners,
+_required
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_owners,
+_required
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_owners,
+_required
+]);
+ 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(`MultiSigWallet successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new MultiSigWalletContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_owners,
+_required
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('MultiSigWallet', 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/contracts/generated-wrappers/multi_sig_wallet_with_time_lock.ts b/packages/contracts/generated-wrappers/multi_sig_wallet_with_time_lock.ts
new file mode 100644
index 000000000..126ce8387
--- /dev/null
+++ b/packages/contracts/generated-wrappers/multi_sig_wallet_with_time_lock.ts
@@ -0,0 +1,1614 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type MultiSigWalletWithTimeLockEventArgs =
+ | MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs
+ | MultiSigWalletWithTimeLockTimeLockChangeEventArgs
+ | MultiSigWalletWithTimeLockConfirmationEventArgs
+ | MultiSigWalletWithTimeLockRevocationEventArgs
+ | MultiSigWalletWithTimeLockSubmissionEventArgs
+ | MultiSigWalletWithTimeLockExecutionEventArgs
+ | MultiSigWalletWithTimeLockExecutionFailureEventArgs
+ | MultiSigWalletWithTimeLockDepositEventArgs
+ | MultiSigWalletWithTimeLockOwnerAdditionEventArgs
+ | MultiSigWalletWithTimeLockOwnerRemovalEventArgs
+ | MultiSigWalletWithTimeLockRequirementChangeEventArgs;
+
+export enum MultiSigWalletWithTimeLockEvents {
+ ConfirmationTimeSet = 'ConfirmationTimeSet',
+ TimeLockChange = 'TimeLockChange',
+ Confirmation = 'Confirmation',
+ Revocation = 'Revocation',
+ Submission = 'Submission',
+ Execution = 'Execution',
+ ExecutionFailure = 'ExecutionFailure',
+ Deposit = 'Deposit',
+ OwnerAddition = 'OwnerAddition',
+ OwnerRemoval = 'OwnerRemoval',
+ RequirementChange = 'RequirementChange',
+}
+
+export interface MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+ confirmationTime: BigNumber;
+}
+
+export interface MultiSigWalletWithTimeLockTimeLockChangeEventArgs extends DecodedLogArgs {
+ secondsTimeLocked: BigNumber;
+}
+
+export interface MultiSigWalletWithTimeLockConfirmationEventArgs extends DecodedLogArgs {
+ sender: string;
+ transactionId: BigNumber;
+}
+
+export interface MultiSigWalletWithTimeLockRevocationEventArgs extends DecodedLogArgs {
+ sender: string;
+ transactionId: BigNumber;
+}
+
+export interface MultiSigWalletWithTimeLockSubmissionEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface MultiSigWalletWithTimeLockExecutionEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface MultiSigWalletWithTimeLockExecutionFailureEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface MultiSigWalletWithTimeLockDepositEventArgs extends DecodedLogArgs {
+ sender: string;
+ value: BigNumber;
+}
+
+export interface MultiSigWalletWithTimeLockOwnerAdditionEventArgs extends DecodedLogArgs {
+ owner: string;
+}
+
+export interface MultiSigWalletWithTimeLockOwnerRemovalEventArgs extends DecodedLogArgs {
+ owner: string;
+}
+
+export interface MultiSigWalletWithTimeLockRequirementChangeEventArgs extends DecodedLogArgs {
+ required: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class MultiSigWalletWithTimeLockContract extends BaseContract {
+ public owners = {
+ async callAsync(
+ index_0: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 secondsTimeLocked = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 addOwner = {
+ async sendTransactionAsync(
+ owner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 getConfirmationCount = {
+ async callAsync(
+ transactionId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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 MultiSigWalletWithTimeLockContract;
+ 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[],
+ _required: BigNumber,
+ _secondsTimeLocked: BigNumber,
+ ): Promise<MultiSigWalletWithTimeLockContract> {
+ 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 MultiSigWalletWithTimeLockContract.deployAsync(bytecode, abi, provider, txDefaults, _owners,
+_required,
+_secondsTimeLocked
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _owners: string[],
+ _required: BigNumber,
+ _secondsTimeLocked: BigNumber,
+ ): Promise<MultiSigWalletWithTimeLockContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_owners,
+_required,
+_secondsTimeLocked
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_owners,
+_required,
+_secondsTimeLocked
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_owners,
+_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(`MultiSigWalletWithTimeLock successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new MultiSigWalletWithTimeLockContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_owners,
+_required,
+_secondsTimeLocked
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('MultiSigWalletWithTimeLock', 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/contracts/generated-wrappers/order_validator.ts b/packages/contracts/generated-wrappers/order_validator.ts
new file mode 100644
index 000000000..38233af3f
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/generated-wrappers/reentrant_erc20_token.ts b/packages/contracts/generated-wrappers/reentrant_erc20_token.ts
new file mode 100644
index 000000000..36f673e5d
--- /dev/null
+++ b/packages/contracts/generated-wrappers/reentrant_erc20_token.ts
@@ -0,0 +1,660 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type ReentrantERC20TokenEventArgs =
+ | ReentrantERC20TokenTransferEventArgs
+ | ReentrantERC20TokenApprovalEventArgs;
+
+export enum ReentrantERC20TokenEvents {
+ Transfer = 'Transfer',
+ Approval = 'Approval',
+}
+
+export interface ReentrantERC20TokenTransferEventArgs extends DecodedLogArgs {
+ _from: string;
+ _to: string;
+ _value: BigNumber;
+}
+
+export interface ReentrantERC20TokenApprovalEventArgs extends DecodedLogArgs {
+ _owner: string;
+ _spender: string;
+ _value: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class ReentrantERC20TokenContract extends BaseContract {
+ public approve = {
+ async sendTransactionAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 ReentrantERC20TokenContract;
+ 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 setCurrentFunction = {
+ async sendTransactionAsync(
+ _currentFunctionId: number|BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as ReentrantERC20TokenContract;
+ const inputAbi = self._lookupAbi('setCurrentFunction(uint8)').inputs;
+ [_currentFunctionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_currentFunctionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_currentFunctionId
+ ]);
+ const encodedData = self._lookupEthersInterface('setCurrentFunction(uint8)').functions.setCurrentFunction.encode([_currentFunctionId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.setCurrentFunction.estimateGasAsync.bind(
+ self,
+ _currentFunctionId
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ _currentFunctionId: number|BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as ReentrantERC20TokenContract;
+ const inputAbi = self._lookupAbi('setCurrentFunction(uint8)').inputs;
+ [_currentFunctionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_currentFunctionId
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('setCurrentFunction(uint8)').functions.setCurrentFunction.encode([_currentFunctionId
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _currentFunctionId: number|BigNumber,
+ ): string {
+ const self = this as any as ReentrantERC20TokenContract;
+ const inputAbi = self._lookupAbi('setCurrentFunction(uint8)').inputs;
+ [_currentFunctionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_currentFunctionId
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('setCurrentFunction(uint8)').functions.setCurrentFunction.encode([_currentFunctionId
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ _currentFunctionId: number|BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as ReentrantERC20TokenContract;
+ const functionSignature = 'setCurrentFunction(uint8)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [_currentFunctionId
+ ] = BaseContract._formatABIDataItemList(inputAbi, [_currentFunctionId
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [_currentFunctionId
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setCurrentFunction;
+ const encodedData = ethersFunction.encode([_currentFunctionId
+ ]);
+ 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: 'setCurrentFunction'}) 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(
+ _owner: string,
+ _spender: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as ReentrantERC20TokenContract;
+ 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>,
+ _exchange: string,
+ ): Promise<ReentrantERC20TokenContract> {
+ 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 ReentrantERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _exchange: string,
+ ): Promise<ReentrantERC20TokenContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_exchange
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_exchange
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_exchange
+]);
+ 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(`ReentrantERC20Token successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ReentrantERC20TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_exchange
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('ReentrantERC20Token', 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/contracts/generated-wrappers/test_asset_proxy_dispatcher.ts b/packages/contracts/generated-wrappers/test_asset_proxy_dispatcher.ts
new file mode 100644
index 000000000..d209700b0
--- /dev/null
+++ b/packages/contracts/generated-wrappers/test_asset_proxy_dispatcher.ts
@@ -0,0 +1,523 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type TestAssetProxyDispatcherEventArgs =
+ | TestAssetProxyDispatcherAssetProxyRegisteredEventArgs;
+
+export enum TestAssetProxyDispatcherEvents {
+ AssetProxyRegistered = 'AssetProxyRegistered',
+}
+
+export interface TestAssetProxyDispatcherAssetProxyRegisteredEventArgs extends DecodedLogArgs {
+ id: string;
+ assetProxy: string;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class TestAssetProxyDispatcherContract extends BaseContract {
+ public assetProxies = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestAssetProxyDispatcherContract;
+ 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 getAssetProxy = {
+ async callAsync(
+ assetProxyId: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestAssetProxyDispatcherContract;
+ 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 publicDispatchTransferFrom = {
+ async sendTransactionAsync(
+ assetData: string,
+ from: string,
+ to: string,
+ amount: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as TestAssetProxyDispatcherContract;
+ const inputAbi = self._lookupAbi('publicDispatchTransferFrom(bytes,address,address,uint256)').inputs;
+ [assetData,
+ from,
+ to,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ]);
+ const encodedData = self._lookupEthersInterface('publicDispatchTransferFrom(bytes,address,address,uint256)').functions.publicDispatchTransferFrom.encode([assetData,
+ from,
+ to,
+ amount
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.publicDispatchTransferFrom.estimateGasAsync.bind(
+ self,
+ assetData,
+ from,
+ to,
+ amount
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ assetData: string,
+ from: string,
+ to: string,
+ amount: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as TestAssetProxyDispatcherContract;
+ const inputAbi = self._lookupAbi('publicDispatchTransferFrom(bytes,address,address,uint256)').inputs;
+ [assetData,
+ from,
+ to,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('publicDispatchTransferFrom(bytes,address,address,uint256)').functions.publicDispatchTransferFrom.encode([assetData,
+ from,
+ to,
+ 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,
+ from: string,
+ to: string,
+ amount: BigNumber,
+ ): string {
+ const self = this as any as TestAssetProxyDispatcherContract;
+ const inputAbi = self._lookupAbi('publicDispatchTransferFrom(bytes,address,address,uint256)').inputs;
+ [assetData,
+ from,
+ to,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('publicDispatchTransferFrom(bytes,address,address,uint256)').functions.publicDispatchTransferFrom.encode([assetData,
+ from,
+ to,
+ amount
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ assetData: string,
+ from: string,
+ to: string,
+ amount: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as TestAssetProxyDispatcherContract;
+ const functionSignature = 'publicDispatchTransferFrom(bytes,address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [assetData,
+ from,
+ to,
+ amount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
+ from,
+ to,
+ amount
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicDispatchTransferFrom;
+ const encodedData = ethersFunction.encode([assetData,
+ from,
+ to,
+ 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: 'publicDispatchTransferFrom'}) 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 TestAssetProxyDispatcherContract;
+ 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 registerAssetProxy = {
+ async sendTransactionAsync(
+ assetProxy: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as TestAssetProxyDispatcherContract;
+ 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 TestAssetProxyDispatcherContract;
+ 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 TestAssetProxyDispatcherContract;
+ 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 TestAssetProxyDispatcherContract;
+ 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 transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as TestAssetProxyDispatcherContract;
+ 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 TestAssetProxyDispatcherContract;
+ 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 TestAssetProxyDispatcherContract;
+ 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 TestAssetProxyDispatcherContract;
+ 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<TestAssetProxyDispatcherContract> {
+ 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 TestAssetProxyDispatcherContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestAssetProxyDispatcherContract> {
+ 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(`TestAssetProxyDispatcher successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new TestAssetProxyDispatcherContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('TestAssetProxyDispatcher', 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/contracts/generated-wrappers/test_asset_proxy_owner.ts b/packages/contracts/generated-wrappers/test_asset_proxy_owner.ts
new file mode 100644
index 000000000..799cf8b97
--- /dev/null
+++ b/packages/contracts/generated-wrappers/test_asset_proxy_owner.ts
@@ -0,0 +1,1946 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type TestAssetProxyOwnerEventArgs =
+ | TestAssetProxyOwnerAssetProxyRegistrationEventArgs
+ | TestAssetProxyOwnerConfirmationTimeSetEventArgs
+ | TestAssetProxyOwnerTimeLockChangeEventArgs
+ | TestAssetProxyOwnerConfirmationEventArgs
+ | TestAssetProxyOwnerRevocationEventArgs
+ | TestAssetProxyOwnerSubmissionEventArgs
+ | TestAssetProxyOwnerExecutionEventArgs
+ | TestAssetProxyOwnerExecutionFailureEventArgs
+ | TestAssetProxyOwnerDepositEventArgs
+ | TestAssetProxyOwnerOwnerAdditionEventArgs
+ | TestAssetProxyOwnerOwnerRemovalEventArgs
+ | TestAssetProxyOwnerRequirementChangeEventArgs;
+
+export enum TestAssetProxyOwnerEvents {
+ 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 TestAssetProxyOwnerAssetProxyRegistrationEventArgs extends DecodedLogArgs {
+ assetProxyContract: string;
+ isRegistered: boolean;
+}
+
+export interface TestAssetProxyOwnerConfirmationTimeSetEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+ confirmationTime: BigNumber;
+}
+
+export interface TestAssetProxyOwnerTimeLockChangeEventArgs extends DecodedLogArgs {
+ secondsTimeLocked: BigNumber;
+}
+
+export interface TestAssetProxyOwnerConfirmationEventArgs extends DecodedLogArgs {
+ sender: string;
+ transactionId: BigNumber;
+}
+
+export interface TestAssetProxyOwnerRevocationEventArgs extends DecodedLogArgs {
+ sender: string;
+ transactionId: BigNumber;
+}
+
+export interface TestAssetProxyOwnerSubmissionEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface TestAssetProxyOwnerExecutionEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface TestAssetProxyOwnerExecutionFailureEventArgs extends DecodedLogArgs {
+ transactionId: BigNumber;
+}
+
+export interface TestAssetProxyOwnerDepositEventArgs extends DecodedLogArgs {
+ sender: string;
+ value: BigNumber;
+}
+
+export interface TestAssetProxyOwnerOwnerAdditionEventArgs extends DecodedLogArgs {
+ owner: string;
+}
+
+export interface TestAssetProxyOwnerOwnerRemovalEventArgs extends DecodedLogArgs {
+ owner: string;
+}
+
+export interface TestAssetProxyOwnerRequirementChangeEventArgs extends DecodedLogArgs {
+ required: BigNumber;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class TestAssetProxyOwnerContract extends BaseContract {
+ public owners = {
+ async callAsync(
+ index_0: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 isFunctionRemoveAuthorizedAddressAtIndex = {
+ async callAsync(
+ data: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestAssetProxyOwnerContract;
+ const functionSignature = 'isFunctionRemoveAuthorizedAddressAtIndex(bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [data
+ ] = BaseContract._formatABIDataItemList(inputAbi, [data
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [data
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isFunctionRemoveAuthorizedAddressAtIndex;
+ const encodedData = ethersFunction.encode([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: 'isFunctionRemoveAuthorizedAddressAtIndex'}) 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 isConfirmed = {
+ async callAsync(
+ transactionId: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 testValidRemoveAuthorizedAddressAtIndexTx = {
+ async callAsync(
+ id: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestAssetProxyOwnerContract;
+ const functionSignature = 'testValidRemoveAuthorizedAddressAtIndexTx(uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [id
+ ] = BaseContract._formatABIDataItemList(inputAbi, [id
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [id
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.testValidRemoveAuthorizedAddressAtIndexTx;
+ const encodedData = ethersFunction.encode([id
+ ]);
+ 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: 'testValidRemoveAuthorizedAddressAtIndexTx'}) 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 submitTransaction = {
+ async sendTransactionAsync(
+ destination: string,
+ value: BigNumber,
+ data: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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 TestAssetProxyOwnerContract;
+ 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<TestAssetProxyOwnerContract> {
+ 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 TestAssetProxyOwnerContract.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<TestAssetProxyOwnerContract> {
+ 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(`TestAssetProxyOwner successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new TestAssetProxyOwnerContract(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('TestAssetProxyOwner', 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/contracts/generated-wrappers/test_constants.ts b/packages/contracts/generated-wrappers/test_constants.ts
new file mode 100644
index 000000000..626780d95
--- /dev/null
+++ b/packages/contracts/generated-wrappers/test_constants.ts
@@ -0,0 +1,123 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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 TestConstantsContract extends BaseContract {
+ public assertValidZrxAssetData = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestConstantsContract;
+ const functionSignature = 'assertValidZrxAssetData()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.assertValidZrxAssetData;
+ 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: 'assertValidZrxAssetData'}) 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 MAINNET_ZRX_ASSET_DATA = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestConstantsContract;
+ const functionSignature = 'MAINNET_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.MAINNET_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: 'MAINNET_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 static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestConstantsContract> {
+ 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 TestConstantsContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestConstantsContract> {
+ 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(`TestConstants successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new TestConstantsContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('TestConstants', 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/contracts/generated-wrappers/test_exchange_internals.ts b/packages/contracts/generated-wrappers/test_exchange_internals.ts
new file mode 100644
index 000000000..5c6092044
--- /dev/null
+++ b/packages/contracts/generated-wrappers/test_exchange_internals.ts
@@ -0,0 +1,3595 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type TestExchangeInternalsEventArgs =
+ | TestExchangeInternalsSignatureValidatorApprovalEventArgs
+ | TestExchangeInternalsFillEventArgs
+ | TestExchangeInternalsCancelEventArgs
+ | TestExchangeInternalsCancelUpToEventArgs
+ | TestExchangeInternalsAssetProxyRegisteredEventArgs;
+
+export enum TestExchangeInternalsEvents {
+ SignatureValidatorApproval = 'SignatureValidatorApproval',
+ Fill = 'Fill',
+ Cancel = 'Cancel',
+ CancelUpTo = 'CancelUpTo',
+ AssetProxyRegistered = 'AssetProxyRegistered',
+}
+
+export interface TestExchangeInternalsSignatureValidatorApprovalEventArgs extends DecodedLogArgs {
+ signerAddress: string;
+ validatorAddress: string;
+ approved: boolean;
+}
+
+export interface TestExchangeInternalsFillEventArgs 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 TestExchangeInternalsCancelEventArgs extends DecodedLogArgs {
+ makerAddress: string;
+ feeRecipientAddress: string;
+ senderAddress: string;
+ orderHash: string;
+ makerAssetData: string;
+ takerAssetData: string;
+}
+
+export interface TestExchangeInternalsCancelUpToEventArgs extends DecodedLogArgs {
+ makerAddress: string;
+ senderAddress: string;
+ orderEpoch: BigNumber;
+}
+
+export interface TestExchangeInternalsAssetProxyRegisteredEventArgs extends DecodedLogArgs {
+ id: string;
+ assetProxy: string;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class TestExchangeInternalsContract extends BaseContract {
+ public publicIsRoundingErrorFloor = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestExchangeInternalsContract;
+ const functionSignature = 'publicIsRoundingErrorFloor(uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [numerator,
+ denominator,
+ target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [numerator,
+ denominator,
+ target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator,
+ denominator,
+ target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsRoundingErrorFloor;
+ const encodedData = ethersFunction.encode([numerator,
+ denominator,
+ 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: 'publicIsRoundingErrorFloor'}) 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 publicUpdateFilledState = {
+ 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},
+ takerAddress: string,
+ orderHash: string,
+ orderTakerAssetFilledAmount: BigNumber,
+ fillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber},
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as TestExchangeInternalsContract;
+ const inputAbi = self._lookupAbi('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').inputs;
+ [order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ]);
+ const encodedData = self._lookupEthersInterface('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').functions.publicUpdateFilledState.encode([order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.publicUpdateFilledState.estimateGasAsync.bind(
+ self,
+ order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ),
+ );
+ 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},
+ takerAddress: string,
+ orderHash: string,
+ orderTakerAssetFilledAmount: BigNumber,
+ fillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber},
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as TestExchangeInternalsContract;
+ const inputAbi = self._lookupAbi('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').inputs;
+ [order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').functions.publicUpdateFilledState.encode([order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ]);
+ 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},
+ takerAddress: string,
+ orderHash: string,
+ orderTakerAssetFilledAmount: BigNumber,
+ fillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber},
+ ): string {
+ const self = this as any as TestExchangeInternalsContract;
+ const inputAbi = self._lookupAbi('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').inputs;
+ [order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').functions.publicUpdateFilledState.encode([order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ]);
+ 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},
+ takerAddress: string,
+ orderHash: string,
+ orderTakerAssetFilledAmount: BigNumber,
+ fillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber},
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as TestExchangeInternalsContract;
+ const functionSignature = 'publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicUpdateFilledState;
+ const encodedData = ethersFunction.encode([order,
+ takerAddress,
+ orderHash,
+ orderTakerAssetFilledAmount,
+ fillResults
+ ]);
+ 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: 'publicUpdateFilledState'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public publicGetPartialAmountCeil = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as TestExchangeInternalsContract;
+ const functionSignature = 'publicGetPartialAmountCeil(uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [numerator,
+ denominator,
+ target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [numerator,
+ denominator,
+ target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator,
+ denominator,
+ target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicGetPartialAmountCeil;
+ const encodedData = ethersFunction.encode([numerator,
+ denominator,
+ 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: 'publicGetPartialAmountCeil'}) 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 filled = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 publicAddFillResults = {
+ async callAsync(
+ totalFillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber},
+ singleFillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber},
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as TestExchangeInternalsContract;
+ const functionSignature = 'publicAddFillResults({uint256,uint256,uint256,uint256},{uint256,uint256,uint256,uint256})';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [totalFillResults,
+ singleFillResults
+ ] = BaseContract._formatABIDataItemList(inputAbi, [totalFillResults,
+ singleFillResults
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [totalFillResults,
+ singleFillResults
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicAddFillResults;
+ const encodedData = ethersFunction.encode([totalFillResults,
+ singleFillResults
+ ]);
+ 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: 'publicAddFillResults'}) 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 publicIsRoundingErrorCeil = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestExchangeInternalsContract;
+ const functionSignature = 'publicIsRoundingErrorCeil(uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [numerator,
+ denominator,
+ target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [numerator,
+ denominator,
+ target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator,
+ denominator,
+ target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsRoundingErrorCeil;
+ const encodedData = ethersFunction.encode([numerator,
+ denominator,
+ 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: 'publicIsRoundingErrorCeil'}) 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 publicGetPartialAmountFloor = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as TestExchangeInternalsContract;
+ const functionSignature = 'publicGetPartialAmountFloor(uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [numerator,
+ denominator,
+ target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [numerator,
+ denominator,
+ target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator,
+ denominator,
+ target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicGetPartialAmountFloor;
+ const encodedData = ethersFunction.encode([numerator,
+ denominator,
+ 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: 'publicGetPartialAmountFloor'}) 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 publicSafeGetPartialAmountFloor = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as TestExchangeInternalsContract;
+ const functionSignature = 'publicSafeGetPartialAmountFloor(uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [numerator,
+ denominator,
+ target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [numerator,
+ denominator,
+ target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator,
+ denominator,
+ target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicSafeGetPartialAmountFloor;
+ const encodedData = ethersFunction.encode([numerator,
+ denominator,
+ 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: 'publicSafeGetPartialAmountFloor'}) 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 publicSafeGetPartialAmountCeil = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as TestExchangeInternalsContract;
+ const functionSignature = 'publicSafeGetPartialAmountCeil(uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [numerator,
+ denominator,
+ target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [numerator,
+ denominator,
+ target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator,
+ denominator,
+ target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicSafeGetPartialAmountCeil;
+ const encodedData = ethersFunction.encode([numerator,
+ denominator,
+ 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: 'publicSafeGetPartialAmountCeil'}) 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 publicCalculateFillResults = {
+ 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},
+ takerAssetFilledAmount: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as TestExchangeInternalsContract;
+ const functionSignature = 'publicCalculateFillResults({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order,
+ takerAssetFilledAmount
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFilledAmount
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFilledAmount
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicCalculateFillResults;
+ const encodedData = ethersFunction.encode([order,
+ takerAssetFilledAmount
+ ]);
+ 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: 'publicCalculateFillResults'}) 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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 TestExchangeInternalsContract;
+ 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<TestExchangeInternalsContract> {
+ 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 TestExchangeInternalsContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestExchangeInternalsContract> {
+ 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(`TestExchangeInternals successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new TestExchangeInternalsContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('TestExchangeInternals', 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/contracts/generated-wrappers/test_lib_bytes.ts b/packages/contracts/generated-wrappers/test_lib_bytes.ts
new file mode 100644
index 000000000..cd0f1af27
--- /dev/null
+++ b/packages/contracts/generated-wrappers/test_lib_bytes.ts
@@ -0,0 +1,683 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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 TestLibBytesContract extends BaseContract {
+ public publicPopLastByte = {
+ async callAsync(
+ b: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[string, string]
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicPopLastByte(bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicPopLastByte;
+ const encodedData = ethersFunction.encode([b
+ ]);
+ 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: 'publicPopLastByte'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public publicReadBytesWithLength = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicReadBytesWithLength(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadBytesWithLength;
+ const encodedData = ethersFunction.encode([b,
+ 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: 'publicReadBytesWithLength'}) 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 publicDeepCopyBytes = {
+ async callAsync(
+ dest: string,
+ source: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicDeepCopyBytes(bytes,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [dest,
+ source
+ ] = BaseContract._formatABIDataItemList(inputAbi, [dest,
+ source
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [dest,
+ source
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicDeepCopyBytes;
+ const encodedData = ethersFunction.encode([dest,
+ source
+ ]);
+ 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: 'publicDeepCopyBytes'}) 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 publicWriteAddress = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ input: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicWriteAddress(bytes,uint256,address)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index,
+ input
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index,
+ input
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index,
+ input
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteAddress;
+ const encodedData = ethersFunction.encode([b,
+ index,
+ input
+ ]);
+ 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: 'publicWriteAddress'}) 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 publicWriteBytesWithLength = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ input: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicWriteBytesWithLength(bytes,uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index,
+ input
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index,
+ input
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index,
+ input
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteBytesWithLength;
+ const encodedData = ethersFunction.encode([b,
+ index,
+ input
+ ]);
+ 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: 'publicWriteBytesWithLength'}) 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 testMemcpy = {
+ async callAsync(
+ mem: string,
+ dest: BigNumber,
+ source: BigNumber,
+ length: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'testMemcpy(bytes,uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [mem,
+ dest,
+ source,
+ length
+ ] = BaseContract._formatABIDataItemList(inputAbi, [mem,
+ dest,
+ source,
+ length
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [mem,
+ dest,
+ source,
+ length
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.testMemcpy;
+ const encodedData = ethersFunction.encode([mem,
+ dest,
+ source,
+ length
+ ]);
+ 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: 'testMemcpy'}) 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 publicReadAddress = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicReadAddress(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadAddress;
+ const encodedData = ethersFunction.encode([b,
+ 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: 'publicReadAddress'}) 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 publicWriteBytes32 = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ input: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicWriteBytes32(bytes,uint256,bytes32)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index,
+ input
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index,
+ input
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index,
+ input
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteBytes32;
+ const encodedData = ethersFunction.encode([b,
+ index,
+ input
+ ]);
+ 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: 'publicWriteBytes32'}) 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 publicPopLast20Bytes = {
+ async callAsync(
+ b: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<[string, string]
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicPopLast20Bytes(bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicPopLast20Bytes;
+ const encodedData = ethersFunction.encode([b
+ ]);
+ 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: 'publicPopLast20Bytes'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public publicEqualsPop1 = {
+ async callAsync(
+ lhs: string,
+ rhs: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicEqualsPop1(bytes,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [lhs,
+ rhs
+ ] = BaseContract._formatABIDataItemList(inputAbi, [lhs,
+ rhs
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [lhs,
+ rhs
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicEqualsPop1;
+ const encodedData = ethersFunction.encode([lhs,
+ rhs
+ ]);
+ 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: 'publicEqualsPop1'}) 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 publicWriteUint256 = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ input: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicWriteUint256(bytes,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index,
+ input
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index,
+ input
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index,
+ input
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteUint256;
+ const encodedData = ethersFunction.encode([b,
+ index,
+ input
+ ]);
+ 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: 'publicWriteUint256'}) 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 publicReadBytes32 = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicReadBytes32(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadBytes32;
+ const encodedData = ethersFunction.encode([b,
+ 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: 'publicReadBytes32'}) 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 publicReadBytes4 = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicReadBytes4(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadBytes4;
+ const encodedData = ethersFunction.encode([b,
+ 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: 'publicReadBytes4'}) 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 publicReadUint256 = {
+ async callAsync(
+ b: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicReadUint256(bytes,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [b,
+ index
+ ] = BaseContract._formatABIDataItemList(inputAbi, [b,
+ index
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [b,
+ index
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadUint256;
+ const encodedData = ethersFunction.encode([b,
+ 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: 'publicReadUint256'}) 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 publicEquals = {
+ async callAsync(
+ lhs: string,
+ rhs: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestLibBytesContract;
+ const functionSignature = 'publicEquals(bytes,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [lhs,
+ rhs
+ ] = BaseContract._formatABIDataItemList(inputAbi, [lhs,
+ rhs
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [lhs,
+ rhs
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicEquals;
+ const encodedData = ethersFunction.encode([lhs,
+ rhs
+ ]);
+ 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: 'publicEquals'}) 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<TestLibBytesContract> {
+ 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 TestLibBytesContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestLibBytesContract> {
+ 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(`TestLibBytes successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new TestLibBytesContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('TestLibBytes', 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/contracts/generated-wrappers/test_libs.ts b/packages/contracts/generated-wrappers/test_libs.ts
new file mode 100644
index 000000000..a58e1f1df
--- /dev/null
+++ b/packages/contracts/generated-wrappers/test_libs.ts
@@ -0,0 +1,453 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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 TestLibsContract extends BaseContract {
+ public publicIsRoundingErrorFloor = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestLibsContract;
+ const functionSignature = 'publicIsRoundingErrorFloor(uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [numerator,
+ denominator,
+ target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [numerator,
+ denominator,
+ target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator,
+ denominator,
+ target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsRoundingErrorFloor;
+ const encodedData = ethersFunction.encode([numerator,
+ denominator,
+ 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: 'publicIsRoundingErrorFloor'}) 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 publicGetPartialAmountCeil = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as TestLibsContract;
+ const functionSignature = 'publicGetPartialAmountCeil(uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [numerator,
+ denominator,
+ target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [numerator,
+ denominator,
+ target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator,
+ denominator,
+ target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicGetPartialAmountCeil;
+ const encodedData = ethersFunction.encode([numerator,
+ denominator,
+ 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: 'publicGetPartialAmountCeil'}) 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 getDomainSeparatorSchemaHash = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibsContract;
+ const functionSignature = 'getDomainSeparatorSchemaHash()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getDomainSeparatorSchemaHash;
+ 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: 'getDomainSeparatorSchemaHash'}) 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 publicAddFillResults = {
+ async callAsync(
+ totalFillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber},
+ singleFillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber},
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ > {
+ const self = this as any as TestLibsContract;
+ const functionSignature = 'publicAddFillResults({uint256,uint256,uint256,uint256},{uint256,uint256,uint256,uint256})';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [totalFillResults,
+ singleFillResults
+ ] = BaseContract._formatABIDataItemList(inputAbi, [totalFillResults,
+ singleFillResults
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [totalFillResults,
+ singleFillResults
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicAddFillResults;
+ const encodedData = ethersFunction.encode([totalFillResults,
+ singleFillResults
+ ]);
+ 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: 'publicAddFillResults'}) 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 publicIsRoundingErrorCeil = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestLibsContract;
+ const functionSignature = 'publicIsRoundingErrorCeil(uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [numerator,
+ denominator,
+ target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [numerator,
+ denominator,
+ target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator,
+ denominator,
+ target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsRoundingErrorCeil;
+ const encodedData = ethersFunction.encode([numerator,
+ denominator,
+ 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: 'publicIsRoundingErrorCeil'}) 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 getOrderSchemaHash = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestLibsContract;
+ const functionSignature = 'getOrderSchemaHash()';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, []);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderSchemaHash;
+ 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: 'getOrderSchemaHash'}) 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 publicGetPartialAmountFloor = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as any as TestLibsContract;
+ const functionSignature = 'publicGetPartialAmountFloor(uint256,uint256,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [numerator,
+ denominator,
+ target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [numerator,
+ denominator,
+ target
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator,
+ denominator,
+ target
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicGetPartialAmountFloor;
+ const encodedData = ethersFunction.encode([numerator,
+ denominator,
+ 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: 'publicGetPartialAmountFloor'}) 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 publicGetOrderHash = {
+ 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<string
+ > {
+ const self = this as any as TestLibsContract;
+ const functionSignature = 'publicGetOrderHash({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.publicGetOrderHash;
+ 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: 'publicGetOrderHash'}) 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 TestLibsContract;
+ 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 publicAbiEncodeFillOrder = {
+ 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<string
+ > {
+ const self = this as any as TestLibsContract;
+ const functionSignature = 'publicAbiEncodeFillOrder({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.publicAbiEncodeFillOrder;
+ 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: 'publicAbiEncodeFillOrder'}) 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<TestLibsContract> {
+ 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 TestLibsContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestLibsContract> {
+ 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(`TestLibs successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new TestLibsContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('TestLibs', 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/contracts/generated-wrappers/test_signature_validator.ts b/packages/contracts/generated-wrappers/test_signature_validator.ts
new file mode 100644
index 000000000..5cd24f505
--- /dev/null
+++ b/packages/contracts/generated-wrappers/test_signature_validator.ts
@@ -0,0 +1,746 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type TestSignatureValidatorEventArgs =
+ | TestSignatureValidatorSignatureValidatorApprovalEventArgs;
+
+export enum TestSignatureValidatorEvents {
+ SignatureValidatorApproval = 'SignatureValidatorApproval',
+}
+
+export interface TestSignatureValidatorSignatureValidatorApprovalEventArgs extends DecodedLogArgs {
+ signerAddress: string;
+ validatorAddress: string;
+ approved: boolean;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class TestSignatureValidatorContract extends BaseContract {
+ public preSign = {
+ async sendTransactionAsync(
+ hash: string,
+ signerAddress: string,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as TestSignatureValidatorContract;
+ 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 TestSignatureValidatorContract;
+ 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 TestSignatureValidatorContract;
+ 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 TestSignatureValidatorContract;
+ 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 transactions = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestSignatureValidatorContract;
+ 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 setSignatureValidatorApproval = {
+ async sendTransactionAsync(
+ validatorAddress: string,
+ approval: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as TestSignatureValidatorContract;
+ 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 TestSignatureValidatorContract;
+ 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 TestSignatureValidatorContract;
+ 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 TestSignatureValidatorContract;
+ 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 TestSignatureValidatorContract;
+ 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 preSigned = {
+ async callAsync(
+ index_0: string,
+ index_1: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestSignatureValidatorContract;
+ 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 isValidSignature = {
+ async callAsync(
+ hash: string,
+ signerAddress: string,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestSignatureValidatorContract;
+ 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 publicIsValidSignature = {
+ async callAsync(
+ hash: string,
+ signer: string,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestSignatureValidatorContract;
+ const functionSignature = 'publicIsValidSignature(bytes32,address,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [hash,
+ signer,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signer,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
+ signer,
+ signature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsValidSignature;
+ const encodedData = ethersFunction.encode([hash,
+ signer,
+ 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: 'publicIsValidSignature'}) 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 TestSignatureValidatorContract;
+ 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 TestSignatureValidatorContract;
+ 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 TestSignatureValidatorContract;
+ 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 TestSignatureValidatorContract;
+ 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 EIP712_DOMAIN_HASH = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestSignatureValidatorContract;
+ 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 currentContextAddress = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as TestSignatureValidatorContract;
+ 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 static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestSignatureValidatorContract> {
+ 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 TestSignatureValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestSignatureValidatorContract> {
+ 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(`TestSignatureValidator successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new TestSignatureValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('TestSignatureValidator', 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/contracts/generated-wrappers/test_static_call_receiver.ts b/packages/contracts/generated-wrappers/test_static_call_receiver.ts
new file mode 100644
index 000000000..d9136f363
--- /dev/null
+++ b/packages/contracts/generated-wrappers/test_static_call_receiver.ts
@@ -0,0 +1,449 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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 TestStaticCallReceiverContract extends BaseContract {
+ public isValidSignature2 = {
+ async sendTransactionAsync(
+ hash: string,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as TestStaticCallReceiverContract;
+ const inputAbi = self._lookupAbi('isValidSignature(bytes32,bytes)').inputs;
+ [hash,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
+ signature
+ ]);
+ const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,bytes)').functions.isValidSignature.encode([hash,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.isValidSignature2.estimateGasAsync.bind(
+ self,
+ hash,
+ signature
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ hash: string,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as TestStaticCallReceiverContract;
+ const inputAbi = self._lookupAbi('isValidSignature(bytes32,bytes)').inputs;
+ [hash,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,bytes)').functions.isValidSignature.encode([hash,
+ 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,
+ signature: string,
+ ): string {
+ const self = this as any as TestStaticCallReceiverContract;
+ const inputAbi = self._lookupAbi('isValidSignature(bytes32,bytes)').inputs;
+ [hash,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('isValidSignature(bytes32,bytes)').functions.isValidSignature.encode([hash,
+ signature
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ hash: string,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestStaticCallReceiverContract;
+ 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 isValidSignature1 = {
+ async sendTransactionAsync(
+ hash: string,
+ signerAddress: string,
+ signature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as TestStaticCallReceiverContract;
+ const inputAbi = self._lookupAbi('isValidSignature(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('isValidSignature(bytes32,address,bytes)').functions.isValidSignature.encode([hash,
+ signerAddress,
+ signature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.isValidSignature1.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 TestStaticCallReceiverContract;
+ const inputAbi = self._lookupAbi('isValidSignature(bytes32,address,bytes)').inputs;
+ [hash,
+ signerAddress,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signerAddress,
+ signature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,address,bytes)').functions.isValidSignature.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 TestStaticCallReceiverContract;
+ const inputAbi = self._lookupAbi('isValidSignature(bytes32,address,bytes)').inputs;
+ [hash,
+ signerAddress,
+ signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ signerAddress,
+ signature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('isValidSignature(bytes32,address,bytes)').functions.isValidSignature.encode([hash,
+ signerAddress,
+ signature
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ hash: string,
+ signerAddress: string,
+ signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as TestStaticCallReceiverContract;
+ 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 approveERC20 = {
+ async sendTransactionAsync(
+ token: string,
+ spender: string,
+ value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as TestStaticCallReceiverContract;
+ const inputAbi = self._lookupAbi('approveERC20(address,address,uint256)').inputs;
+ [token,
+ spender,
+ value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [token,
+ spender,
+ value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [token,
+ spender,
+ value
+ ]);
+ const encodedData = self._lookupEthersInterface('approveERC20(address,address,uint256)').functions.approveERC20.encode([token,
+ spender,
+ value
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.approveERC20.estimateGasAsync.bind(
+ self,
+ token,
+ spender,
+ value
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ token: string,
+ spender: string,
+ value: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as TestStaticCallReceiverContract;
+ const inputAbi = self._lookupAbi('approveERC20(address,address,uint256)').inputs;
+ [token,
+ spender,
+ value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [token,
+ spender,
+ value
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('approveERC20(address,address,uint256)').functions.approveERC20.encode([token,
+ 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(
+ token: string,
+ spender: string,
+ value: BigNumber,
+ ): string {
+ const self = this as any as TestStaticCallReceiverContract;
+ const inputAbi = self._lookupAbi('approveERC20(address,address,uint256)').inputs;
+ [token,
+ spender,
+ value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [token,
+ spender,
+ value
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('approveERC20(address,address,uint256)').functions.approveERC20.encode([token,
+ spender,
+ value
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ token: string,
+ spender: string,
+ value: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as TestStaticCallReceiverContract;
+ const functionSignature = 'approveERC20(address,address,uint256)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [token,
+ spender,
+ value
+ ] = BaseContract._formatABIDataItemList(inputAbi, [token,
+ spender,
+ value
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [token,
+ spender,
+ value
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approveERC20;
+ const encodedData = ethersFunction.encode([token,
+ 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: 'approveERC20'}) 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<TestStaticCallReceiverContract> {
+ 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 TestStaticCallReceiverContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<TestStaticCallReceiverContract> {
+ 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(`TestStaticCallReceiver successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new TestStaticCallReceiverContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('TestStaticCallReceiver', 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/contracts/generated-wrappers/validator.ts b/packages/contracts/generated-wrappers/validator.ts
new file mode 100644
index 000000000..1371e1523
--- /dev/null
+++ b/packages/contracts/generated-wrappers/validator.ts
@@ -0,0 +1,115 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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 ValidatorContract 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 ValidatorContract;
+ 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>,
+ validSigner: string,
+ ): Promise<ValidatorContract> {
+ 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 ValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, validSigner
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ validSigner: string,
+ ): Promise<ValidatorContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [validSigner
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [validSigner
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [validSigner
+]);
+ 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(`Validator successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new ValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [validSigner
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('Validator', 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/contracts/generated-wrappers/wallet.ts b/packages/contracts/generated-wrappers/wallet.ts
new file mode 100644
index 000000000..c0bd8ba71
--- /dev/null
+++ b/packages/contracts/generated-wrappers/wallet.ts
@@ -0,0 +1,110 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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 WalletContract extends BaseContract {
+ public isValidSignature = {
+ async callAsync(
+ hash: string,
+ eip712Signature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as WalletContract;
+ const functionSignature = 'isValidSignature(bytes32,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [hash,
+ eip712Signature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
+ eip712Signature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
+ eip712Signature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
+ const encodedData = ethersFunction.encode([hash,
+ eip712Signature
+ ]);
+ 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>,
+ walletOwner: string,
+ ): Promise<WalletContract> {
+ 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 WalletContract.deployAsync(bytecode, abi, provider, txDefaults, walletOwner
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ walletOwner: string,
+ ): Promise<WalletContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [walletOwner
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [walletOwner
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [walletOwner
+]);
+ 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(`Wallet successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new WalletContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [walletOwner
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('Wallet', 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/contracts/generated-wrappers/weth9.ts b/packages/contracts/generated-wrappers/weth9.ts
new file mode 100644
index 000000000..86d1031db
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/generated-wrappers/whitelist.ts b/packages/contracts/generated-wrappers/whitelist.ts
new file mode 100644
index 000000000..6145feb82
--- /dev/null
+++ b/packages/contracts/generated-wrappers/whitelist.ts
@@ -0,0 +1,547 @@
+// 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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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 WhitelistContract extends BaseContract {
+ public fillOrderIfWhitelisted = {
+ 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,
+ salt: BigNumber,
+ orderSignature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as WhitelistContract;
+ const inputAbi = self._lookupAbi('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ]);
+ const encodedData = self._lookupEthersInterface('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').functions.fillOrderIfWhitelisted.encode([order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.fillOrderIfWhitelisted.estimateGasAsync.bind(
+ self,
+ order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ),
+ );
+ 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,
+ salt: BigNumber,
+ orderSignature: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as WhitelistContract;
+ const inputAbi = self._lookupAbi('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').functions.fillOrderIfWhitelisted.encode([order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ]);
+ 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,
+ salt: BigNumber,
+ orderSignature: string,
+ ): string {
+ const self = this as any as WhitelistContract;
+ const inputAbi = self._lookupAbi('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').inputs;
+ [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').functions.fillOrderIfWhitelisted.encode([order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ]);
+ 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,
+ salt: BigNumber,
+ orderSignature: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as WhitelistContract;
+ const functionSignature = 'fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ] = BaseContract._formatABIDataItemList(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrderIfWhitelisted;
+ const encodedData = ethersFunction.encode([order,
+ takerAssetFillAmount,
+ salt,
+ orderSignature
+ ]);
+ 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: 'fillOrderIfWhitelisted'}) as MethodAbi).outputs;
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
+ resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
+ return resultArray;
+ },
+ };
+ public isWhitelisted = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as WhitelistContract;
+ const functionSignature = 'isWhitelisted(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.isWhitelisted;
+ 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: 'isWhitelisted'}) 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 WhitelistContract;
+ 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 WhitelistContract;
+ 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 updateWhitelistStatus = {
+ async sendTransactionAsync(
+ target: string,
+ isApproved: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as WhitelistContract;
+ const inputAbi = self._lookupAbi('updateWhitelistStatus(address,bool)').inputs;
+ [target,
+ isApproved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ isApproved
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
+ isApproved
+ ]);
+ const encodedData = self._lookupEthersInterface('updateWhitelistStatus(address,bool)').functions.updateWhitelistStatus.encode([target,
+ isApproved
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.updateWhitelistStatus.estimateGasAsync.bind(
+ self,
+ target,
+ isApproved
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ isApproved: boolean,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as WhitelistContract;
+ const inputAbi = self._lookupAbi('updateWhitelistStatus(address,bool)').inputs;
+ [target,
+ isApproved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ isApproved
+ ], BaseContract._bigNumberToString);
+ const encodedData = self._lookupEthersInterface('updateWhitelistStatus(address,bool)').functions.updateWhitelistStatus.encode([target,
+ isApproved
+ ]);
+ 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,
+ isApproved: boolean,
+ ): string {
+ const self = this as any as WhitelistContract;
+ const inputAbi = self._lookupAbi('updateWhitelistStatus(address,bool)').inputs;
+ [target,
+ isApproved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ isApproved
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('updateWhitelistStatus(address,bool)').functions.updateWhitelistStatus.encode([target,
+ isApproved
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ isApproved: boolean,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as WhitelistContract;
+ const functionSignature = 'updateWhitelistStatus(address,bool)';
+ const inputAbi = self._lookupAbi(functionSignature).inputs;
+ [target,
+ isApproved
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target,
+ isApproved
+ ], BaseContract._bigNumberToString.bind(self));
+ BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
+ isApproved
+ ]);
+ const ethersFunction = self._lookupEthersInterface(functionSignature).functions.updateWhitelistStatus;
+ const encodedData = ethersFunction.encode([target,
+ isApproved
+ ]);
+ 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: 'updateWhitelistStatus'}) 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 WhitelistContract;
+ 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 WhitelistContract;
+ 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 WhitelistContract;
+ 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 WhitelistContract;
+ 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,
+ ): Promise<WhitelistContract> {
+ 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 WhitelistContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange
+);
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ _exchange: string,
+ ): Promise<WhitelistContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [_exchange
+] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [_exchange
+],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, [_exchange
+]);
+ 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(`Whitelist successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new WhitelistContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [_exchange
+];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('Whitelist', 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/contracts/generated-wrappers/zrx_token.ts b/packages/contracts/generated-wrappers/zrx_token.ts
new file mode 100644
index 000000000..98079e77b
--- /dev/null
+++ b/packages/contracts/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 '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/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/contracts/package.json b/packages/contracts/package.json
deleted file mode 100644
index c87e2e95b..000000000
--- a/packages/contracts/package.json
+++ /dev/null
@@ -1,92 +0,0 @@
-{
- "private": true,
- "name": "contracts",
- "version": "2.1.54",
- "engines": {
- "node": ">=6.12"
- },
- "description": "Smart contract components of 0x protocol",
- "main": "lib/src/index.js",
- "directories": {
- "test": "test"
- },
- "scripts": {
- "build": "yarn pre_build && tsc -b",
- "build:ci": "yarn build",
- "pre_build": "run-s compile generate_contract_wrappers",
- "test": "yarn run_mocha",
- "rebuild_and_test": "run-s build test",
- "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
- "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
- "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
- "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
- "compile": "sol-compiler --contracts-dir contracts",
- "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
- "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
- "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
- "coverage:report:text": "istanbul report text",
- "coverage:report:html": "istanbul report html && open coverage/index.html",
- "profiler:report:html": "istanbul report html && open coverage/index.html",
- "coverage:report:lcov": "istanbul report lcov",
- "test:circleci": "yarn test",
- "lint-contracts": "solhint contracts/**/**/**/**/*.sol"
- },
- "config": {
- "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",
- "url": "https://github.com/0xProject/0x-monorepo.git"
- },
- "author": "Amir Bandeali",
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/0xProject/0x-monorepo/issues"
- },
- "homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md",
- "devDependencies": {
- "@0x/abi-gen": "^1.0.16",
- "@0x/dev-utils": "^1.0.17",
- "@0x/sol-compiler": "^1.1.12",
- "@0x/sol-cov": "^2.1.12",
- "@0x/subproviders": "^2.1.4",
- "@0x/tslint-config": "^1.0.10",
- "@types/bn.js": "^4.11.0",
- "@types/ethereumjs-abi": "^0.6.0",
- "@types/lodash": "4.14.104",
- "@types/node": "*",
- "@types/yargs": "^10.0.0",
- "chai": "^4.0.1",
- "chai-as-promised": "^7.1.0",
- "chai-bignumber": "^2.0.1",
- "dirty-chai": "^2.0.1",
- "make-promises-safe": "^1.1.0",
- "mocha": "^4.1.0",
- "npm-run-all": "^4.1.2",
- "shx": "^0.2.2",
- "solc": "^0.4.24",
- "solhint": "^1.2.1",
- "tslint": "5.11.0",
- "typescript": "3.0.1",
- "yargs": "^10.0.3"
- },
- "dependencies": {
- "@0x/base-contract": "^3.0.6",
- "@0x/order-utils": "^3.0.2",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
- "@types/js-combinatorics": "^0.5.29",
- "bn.js": "^4.11.8",
- "ethereum-types": "^1.1.2",
- "ethereumjs-abi": "0.6.5",
- "ethereumjs-util": "^5.1.1",
- "ethers": "~4.0.4",
- "js-combinatorics": "^0.5.3",
- "lodash": "^4.17.5"
- },
- "publishConfig": {
- "access": "public"
- }
-}
diff --git a/packages/contracts/src/artifacts/index.ts b/packages/contracts/src/artifacts/index.ts
deleted file mode 100644
index c30972a91..000000000
--- a/packages/contracts/src/artifacts/index.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-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
deleted file mode 100644
index 9ca676b56..000000000
--- a/packages/contracts/src/wrappers/index.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-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
deleted file mode 100644
index e21af9b81..000000000
--- a/packages/contracts/test/asset_proxy/authorizable.ts
+++ /dev/null
@@ -1,207 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { RevertReason } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-import * as _ from 'lodash';
-
-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';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-describe('Authorizable', () => {
- let owner: string;
- let notOwner: string;
- let address: string;
- let authorizable: MixinAuthorizableContract;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- [owner, address, notOwner] = _.slice(accounts, 0, 3);
- authorizable = await MixinAuthorizableContract.deployFrom0xArtifactAsync(
- artifacts.MixinAuthorizable,
- provider,
- txDefaults,
- );
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- describe('addAuthorizedAddress', () => {
- it('should throw if not called by owner', async () => {
- return expectTransactionFailedAsync(
- authorizable.addAuthorizedAddress.sendTransactionAsync(notOwner, { from: notOwner }),
- RevertReason.OnlyContractOwner,
- );
- });
- it('should allow owner to add an authorized address', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const isAuthorized = await authorizable.authorized.callAsync(address);
- expect(isAuthorized).to.be.true();
- });
- it('should throw if owner attempts to authorize a duplicate address', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- return expectTransactionFailedAsync(
- authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
- RevertReason.TargetAlreadyAuthorized,
- );
- });
- });
-
- describe('removeAuthorizedAddress', () => {
- it('should throw if not called by owner', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- return expectTransactionFailedAsync(
- authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
- from: notOwner,
- }),
- RevertReason.OnlyContractOwner,
- );
- });
-
- it('should allow owner to remove an authorized address', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const isAuthorized = await authorizable.authorized.callAsync(address);
- expect(isAuthorized).to.be.false();
- });
-
- it('should throw if owner attempts to remove an address that is not authorized', async () => {
- return expectTransactionFailedAsync(
- authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
- from: owner,
- }),
- RevertReason.TargetNotAuthorized,
- );
- });
- });
-
- describe('removeAuthorizedAddressAtIndex', () => {
- it('should throw if not called by owner', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const index = new BigNumber(0);
- return expectTransactionFailedAsync(
- authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
- from: notOwner,
- }),
- RevertReason.OnlyContractOwner,
- );
- });
- it('should throw if index is >= authorities.length', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const index = new BigNumber(1);
- return expectTransactionFailedAsync(
- authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
- from: owner,
- }),
- RevertReason.IndexOutOfBounds,
- );
- });
- it('should throw if owner attempts to remove an address that is not authorized', async () => {
- const index = new BigNumber(0);
- return expectTransactionFailedAsync(
- authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
- from: owner,
- }),
- RevertReason.TargetNotAuthorized,
- );
- });
- it('should throw if address at index does not match target', async () => {
- const address1 = address;
- const address2 = notOwner;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.addAuthorizedAddress.sendTransactionAsync(address1, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.addAuthorizedAddress.sendTransactionAsync(address2, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const address1Index = new BigNumber(0);
- return expectTransactionFailedAsync(
- authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address2, address1Index, {
- from: owner,
- }),
- RevertReason.AuthorizedAddressMismatch,
- );
- });
- it('should allow owner to remove an authorized address', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const index = new BigNumber(0);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const isAuthorized = await authorizable.authorized.callAsync(address);
- expect(isAuthorized).to.be.false();
- });
- });
-
- describe('getAuthorizedAddresses', () => {
- it('should return all authorized addresses', async () => {
- const initial = await authorizable.getAuthorizedAddresses.callAsync();
- expect(initial).to.have.length(0);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.addAuthorizedAddress.sendTransactionAsync(address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const afterAdd = await authorizable.getAuthorizedAddresses.callAsync();
- expect(afterAdd).to.have.length(1);
- expect(afterAdd).to.include(address);
-
- await web3Wrapper.awaitTransactionSuccessAsync(
- await authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const afterRemove = await authorizable.getAuthorizedAddresses.callAsync();
- expect(afterRemove).to.have.length(0);
- });
- });
-});
diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts
deleted file mode 100644
index b8305993e..000000000
--- a/packages/contracts/test/asset_proxy/proxies.ts
+++ /dev/null
@@ -1,629 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { assetDataUtils } from '@0x/order-utils';
-import { RevertReason } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-import * as _ from 'lodash';
-
-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';
-import { ERC20Wrapper } from '../utils/erc20_wrapper';
-import { ERC721Wrapper } from '../utils/erc721_wrapper';
-import { LogDecoder } from '../utils/log_decoder';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-const assetProxyInterface = new IAssetProxyContract(
- artifacts.IAssetProxy.compilerOutput.abi,
- constants.NULL_ADDRESS,
- provider,
-);
-
-// tslint:disable:no-unnecessary-type-assertion
-describe('Asset Transfer Proxies', () => {
- let owner: string;
- let notAuthorized: string;
- let exchangeAddress: string;
- let makerAddress: string;
- let takerAddress: string;
-
- let zrxToken: DummyERC20TokenContract;
- let erc721Token: DummyERC721TokenContract;
- let erc721Receiver: DummyERC721ReceiverContract;
- let erc20Proxy: ERC20ProxyContract;
- let erc721Proxy: ERC721ProxyContract;
- let noReturnErc20Token: DummyNoReturnERC20TokenContract;
- let multipleReturnErc20Token: DummyMultipleReturnERC20TokenContract;
-
- let erc20Wrapper: ERC20Wrapper;
- let erc721Wrapper: ERC721Wrapper;
- let erc721MakerTokenId: BigNumber;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- const usedAddresses = ([owner, notAuthorized, exchangeAddress, makerAddress, takerAddress] = _.slice(
- accounts,
- 0,
- 5,
- ));
-
- erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
- erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
-
- const numDummyErc20ToDeploy = 1;
- [zrxToken] = await erc20Wrapper.deployDummyTokensAsync(numDummyErc20ToDeploy, constants.DUMMY_TOKEN_DECIMALS);
- erc20Proxy = await erc20Wrapper.deployProxyAsync();
- await erc20Wrapper.setBalancesAndAllowancesAsync();
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeAddress, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
- erc721Proxy = await erc721Wrapper.deployProxyAsync();
- await erc721Wrapper.setBalancesAndAllowancesAsync();
- const erc721Balances = await erc721Wrapper.getBalancesAsync();
- erc721MakerTokenId = erc721Balances[makerAddress][erc721Token.address][0];
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeAddress, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- erc721Receiver = await DummyERC721ReceiverContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Receiver,
- provider,
- txDefaults,
- );
- noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyNoReturnERC20Token,
- provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- constants.DUMMY_TOKEN_DECIMALS,
- constants.DUMMY_TOKEN_TOTAL_SUPPLY,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await noReturnErc20Token.setBalance.sendTransactionAsync(makerAddress, constants.INITIAL_ERC20_BALANCE),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await noReturnErc20Token.approve.sendTransactionAsync(
- erc20Proxy.address,
- constants.INITIAL_ERC20_ALLOWANCE,
- { from: makerAddress },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- multipleReturnErc20Token = await DummyMultipleReturnERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyMultipleReturnERC20Token,
- provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- constants.DUMMY_TOKEN_DECIMALS,
- constants.DUMMY_TOKEN_TOTAL_SUPPLY,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await multipleReturnErc20Token.setBalance.sendTransactionAsync(
- makerAddress,
- constants.INITIAL_ERC20_BALANCE,
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await multipleReturnErc20Token.approve.sendTransactionAsync(
- erc20Proxy.address,
- constants.INITIAL_ERC20_ALLOWANCE,
- { from: makerAddress },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- describe('Transfer Proxy - ERC20', () => {
- it('should revert if undefined function is called', async () => {
- const undefinedSelector = '0x01020304';
- await expectTransactionFailedWithoutReasonAsync(
- web3Wrapper.sendTransactionAsync({
- from: owner,
- to: erc20Proxy.address,
- value: constants.ZERO_AMOUNT,
- data: undefinedSelector,
- }),
- );
- });
- describe('transferFrom', () => {
- it('should successfully transfer tokens', async () => {
- // Construct ERC20 asset data
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
- // Perform a transfer from makerAddress to takerAddress
- const erc20Balances = await erc20Wrapper.getBalancesAsync();
- const amount = new BigNumber(10);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await web3Wrapper.sendTransactionAsync({
- to: erc20Proxy.address,
- data,
- from: exchangeAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Verify transfer was successful
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(amount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].add(amount),
- );
- });
-
- it('should successfully transfer tokens that do not return a value', async () => {
- // Construct ERC20 asset data
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(noReturnErc20Token.address);
- // Perform a transfer from makerAddress to takerAddress
- const initialMakerBalance = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
- const initialTakerBalance = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
- const amount = new BigNumber(10);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await web3Wrapper.sendTransactionAsync({
- to: erc20Proxy.address,
- data,
- from: exchangeAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Verify transfer was successful
- const newMakerBalance = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
- const newTakerBalance = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
- expect(newMakerBalance).to.be.bignumber.equal(initialMakerBalance.minus(amount));
- expect(newTakerBalance).to.be.bignumber.equal(initialTakerBalance.plus(amount));
- });
-
- it('should successfully transfer tokens and ignore extra assetData', async () => {
- // Construct ERC20 asset data
- const extraData = '0102030405060708';
- const encodedAssetData = `${assetDataUtils.encodeERC20AssetData(zrxToken.address)}${extraData}`;
- // Perform a transfer from makerAddress to takerAddress
- const erc20Balances = await erc20Wrapper.getBalancesAsync();
- const amount = new BigNumber(10);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await web3Wrapper.sendTransactionAsync({
- to: erc20Proxy.address,
- data,
- from: exchangeAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Verify transfer was successful
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(amount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].add(amount),
- );
- });
-
- it('should do nothing if transferring 0 amount of a token', async () => {
- // Construct ERC20 asset data
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
- // Perform a transfer from makerAddress to takerAddress
- const erc20Balances = await erc20Wrapper.getBalancesAsync();
- const amount = new BigNumber(0);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await web3Wrapper.sendTransactionAsync({
- to: erc20Proxy.address,
- data,
- from: exchangeAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Verify transfer was successful
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address],
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address],
- );
- });
-
- it('should throw if allowances are too low', async () => {
- // Construct ERC20 asset data
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
- // Create allowance less than transfer amount. Set allowance on proxy.
- const allowance = new BigNumber(0);
- const amount = new BigNumber(10);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, allowance, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const erc20Balances = await erc20Wrapper.getBalancesAsync();
- // Perform a transfer; expect this to fail.
- await expectTransactionFailedAsync(
- web3Wrapper.sendTransactionAsync({
- to: erc20Proxy.address,
- data,
- from: exchangeAddress,
- }),
- RevertReason.TransferFailed,
- );
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.deep.equal(erc20Balances);
- });
-
- it('should throw if allowances are too low and token does not return a value', async () => {
- // Construct ERC20 asset data
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(noReturnErc20Token.address);
- // Create allowance less than transfer amount. Set allowance on proxy.
- const allowance = new BigNumber(0);
- const amount = new BigNumber(10);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await noReturnErc20Token.approve.sendTransactionAsync(erc20Proxy.address, allowance, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const initialMakerBalance = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
- const initialTakerBalance = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
- // Perform a transfer; expect this to fail.
- await expectTransactionFailedAsync(
- web3Wrapper.sendTransactionAsync({
- to: erc20Proxy.address,
- data,
- from: exchangeAddress,
- }),
- RevertReason.TransferFailed,
- );
- const newMakerBalance = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
- const newTakerBalance = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
- expect(newMakerBalance).to.be.bignumber.equal(initialMakerBalance);
- expect(newTakerBalance).to.be.bignumber.equal(initialTakerBalance);
- });
-
- it('should throw if requesting address is not authorized', async () => {
- // Construct ERC20 asset data
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
- // Perform a transfer from makerAddress to takerAddress
- const amount = new BigNumber(10);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- const erc20Balances = await erc20Wrapper.getBalancesAsync();
- await expectTransactionFailedAsync(
- web3Wrapper.sendTransactionAsync({
- to: erc20Proxy.address,
- data,
- from: notAuthorized,
- }),
- RevertReason.SenderNotAuthorized,
- );
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.deep.equal(erc20Balances);
- });
-
- it('should throw if token returns more than 32 bytes', async () => {
- // Construct ERC20 asset data
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(multipleReturnErc20Token.address);
- const amount = new BigNumber(10);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- const initialMakerBalance = await multipleReturnErc20Token.balanceOf.callAsync(makerAddress);
- const initialTakerBalance = await multipleReturnErc20Token.balanceOf.callAsync(takerAddress);
- // Perform a transfer; expect this to fail.
- await expectTransactionFailedAsync(
- web3Wrapper.sendTransactionAsync({
- to: erc20Proxy.address,
- data,
- from: exchangeAddress,
- }),
- RevertReason.TransferFailed,
- );
- const newMakerBalance = await multipleReturnErc20Token.balanceOf.callAsync(makerAddress);
- const newTakerBalance = await multipleReturnErc20Token.balanceOf.callAsync(takerAddress);
- expect(newMakerBalance).to.be.bignumber.equal(initialMakerBalance);
- expect(newTakerBalance).to.be.bignumber.equal(initialTakerBalance);
- });
- });
-
- it('should have an id of 0xf47261b0', async () => {
- const proxyId = await erc20Proxy.getProxyId.callAsync();
- const expectedProxyId = '0xf47261b0';
- expect(proxyId).to.equal(expectedProxyId);
- });
- });
-
- describe('Transfer Proxy - ERC721', () => {
- it('should revert if undefined function is called', async () => {
- const undefinedSelector = '0x01020304';
- await expectTransactionFailedWithoutReasonAsync(
- web3Wrapper.sendTransactionAsync({
- from: owner,
- to: erc721Proxy.address,
- value: constants.ZERO_AMOUNT,
- data: undefinedSelector,
- }),
- );
- });
- describe('transferFrom', () => {
- it('should successfully transfer tokens', async () => {
- // Construct ERC721 asset data
- const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
- // Verify pre-condition
- const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(ownerMakerAsset).to.be.equal(makerAddress);
- // Perform a transfer from makerAddress to takerAddress
- const amount = new BigNumber(1);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await web3Wrapper.sendTransactionAsync({
- to: erc721Proxy.address,
- data,
- from: exchangeAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Verify transfer was successful
- const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
- });
-
- it('should successfully transfer tokens and ignore extra assetData', async () => {
- // Construct ERC721 asset data
- const extraData = '0102030405060708';
- const encodedAssetData = `${assetDataUtils.encodeERC721AssetData(
- erc721Token.address,
- erc721MakerTokenId,
- )}${extraData}`;
- // Verify pre-condition
- const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(ownerMakerAsset).to.be.equal(makerAddress);
- // Perform a transfer from makerAddress to takerAddress
- const amount = new BigNumber(1);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await web3Wrapper.sendTransactionAsync({
- to: erc721Proxy.address,
- data,
- from: exchangeAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Verify transfer was successful
- const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
- });
-
- it('should not call onERC721Received when transferring to a smart contract', async () => {
- // Construct ERC721 asset data
- const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
- // Verify pre-condition
- const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(ownerMakerAsset).to.be.equal(makerAddress);
- // Perform a transfer from makerAddress to takerAddress
- const amount = new BigNumber(1);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- erc721Receiver.address,
- amount,
- );
- const logDecoder = new LogDecoder(web3Wrapper);
- const tx = await logDecoder.getTxWithDecodedLogsAsync(
- await web3Wrapper.sendTransactionAsync({
- to: erc721Proxy.address,
- data,
- from: exchangeAddress,
- gas: constants.MAX_TRANSFER_FROM_GAS,
- }),
- );
- // Verify that no log was emitted by erc721 receiver
- expect(tx.logs.length).to.be.equal(1);
- // Verify transfer was successful
- const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(newOwnerMakerAsset).to.be.bignumber.equal(erc721Receiver.address);
- });
-
- it('should throw if transferring 0 amount of a token', async () => {
- // Construct ERC721 asset data
- const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
- // Verify pre-condition
- const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(ownerMakerAsset).to.be.equal(makerAddress);
- // Perform a transfer from makerAddress to takerAddress
- const amount = new BigNumber(0);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await expectTransactionFailedAsync(
- web3Wrapper.sendTransactionAsync({
- to: erc721Proxy.address,
- data,
- from: exchangeAddress,
- }),
- RevertReason.InvalidAmount,
- );
- const newOwner = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(newOwner).to.be.equal(ownerMakerAsset);
- });
-
- it('should throw if transferring > 1 amount of a token', async () => {
- // Construct ERC721 asset data
- const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
- // Verify pre-condition
- const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(ownerMakerAsset).to.be.equal(makerAddress);
- // Perform a transfer from makerAddress to takerAddress
- const amount = new BigNumber(500);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await expectTransactionFailedAsync(
- web3Wrapper.sendTransactionAsync({
- to: erc721Proxy.address,
- data,
- from: exchangeAddress,
- }),
- RevertReason.InvalidAmount,
- );
- const newOwner = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(newOwner).to.be.equal(ownerMakerAsset);
- });
-
- it('should throw if allowances are too low', async () => {
- // Construct ERC721 asset data
- const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
- // Verify pre-condition
- const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(ownerMakerAsset).to.be.equal(makerAddress);
- // Remove transfer approval for makerAddress.
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.approve.sendTransactionAsync(constants.NULL_ADDRESS, erc721MakerTokenId, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Perform a transfer; expect this to fail.
- const amount = new BigNumber(1);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await expectTransactionFailedAsync(
- web3Wrapper.sendTransactionAsync({
- to: erc721Proxy.address,
- data,
- from: exchangeAddress,
- }),
- RevertReason.TransferFailed,
- );
- const newOwner = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(newOwner).to.be.equal(ownerMakerAsset);
- });
-
- it('should throw if requesting address is not authorized', async () => {
- // Construct ERC721 asset data
- const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId);
- // Verify pre-condition
- const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(ownerMakerAsset).to.be.equal(makerAddress);
- // Perform a transfer from makerAddress to takerAddress
- const amount = new BigNumber(1);
- const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- );
- await expectTransactionFailedAsync(
- web3Wrapper.sendTransactionAsync({
- to: erc721Proxy.address,
- data,
- from: notAuthorized,
- }),
- RevertReason.SenderNotAuthorized,
- );
- const newOwner = await erc721Token.ownerOf.callAsync(erc721MakerTokenId);
- expect(newOwner).to.be.equal(ownerMakerAsset);
- });
- });
-
- it('should have an id of 0x02571792', async () => {
- const proxyId = await erc721Proxy.getProxyId.callAsync();
- const expectedProxyId = '0x02571792';
- expect(proxyId).to.equal(expectedProxyId);
- });
- });
-});
-// tslint:enable:no-unnecessary-type-assertion
-// tslint:disable:max-file-line-count
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
deleted file mode 100644
index fc8dc5346..000000000
--- a/packages/contracts/test/exchange/core.ts
+++ /dev/null
@@ -1,829 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
-import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as chai from 'chai';
-import { LogWithDecodedArgs } from 'ethereum-types';
-import ethUtil = require('ethereumjs-util');
-import * as _ from 'lodash';
-
-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';
-import { constants } from '../utils/constants';
-import { ERC20Wrapper } from '../utils/erc20_wrapper';
-import { ERC721Wrapper } from '../utils/erc721_wrapper';
-import { ExchangeWrapper } from '../utils/exchange_wrapper';
-import { OrderFactory } from '../utils/order_factory';
-import { ERC20BalancesByOwner, OrderStatus } from '../utils/types';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-// tslint:disable:no-unnecessary-type-assertion
-describe('Exchange core', () => {
- let makerAddress: string;
- let owner: string;
- let takerAddress: string;
- let feeRecipientAddress: string;
-
- let erc20TokenA: DummyERC20TokenContract;
- let erc20TokenB: DummyERC20TokenContract;
- let zrxToken: DummyERC20TokenContract;
- let erc721Token: DummyERC721TokenContract;
- let noReturnErc20Token: DummyNoReturnERC20TokenContract;
- let reentrantErc20Token: ReentrantERC20TokenContract;
- let exchange: ExchangeContract;
- let erc20Proxy: ERC20ProxyContract;
- let erc721Proxy: ERC721ProxyContract;
- let maliciousWallet: TestStaticCallReceiverContract;
- let maliciousValidator: TestStaticCallReceiverContract;
-
- let signedOrder: SignedOrder;
- let erc20Balances: ERC20BalancesByOwner;
- let exchangeWrapper: ExchangeWrapper;
- let erc20Wrapper: ERC20Wrapper;
- let erc721Wrapper: ERC721Wrapper;
- let orderFactory: OrderFactory;
-
- let erc721MakerAssetIds: BigNumber[];
- let erc721TakerAssetIds: BigNumber[];
-
- let defaultMakerAssetAddress: string;
- let defaultTakerAssetAddress: string;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = _.slice(accounts, 0, 4));
-
- erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
- erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
-
- const numDummyErc20ToDeploy = 3;
- [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
- numDummyErc20ToDeploy,
- constants.DUMMY_TOKEN_DECIMALS,
- );
- erc20Proxy = await erc20Wrapper.deployProxyAsync();
- await erc20Wrapper.setBalancesAndAllowancesAsync();
-
- [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
- erc721Proxy = await erc721Wrapper.deployProxyAsync();
- await erc721Wrapper.setBalancesAndAllowancesAsync();
- const erc721Balances = await erc721Wrapper.getBalancesAsync();
- erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
- erc721TakerAssetIds = erc721Balances[takerAddress][erc721Token.address];
-
- exchange = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
- provider,
- txDefaults,
- assetDataUtils.encodeERC20AssetData(zrxToken.address),
- );
- exchangeWrapper = new ExchangeWrapper(exchange, provider);
- await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
- await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
-
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- maliciousWallet = maliciousValidator = await TestStaticCallReceiverContract.deployFrom0xArtifactAsync(
- artifacts.TestStaticCallReceiver,
- provider,
- txDefaults,
- );
- reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.ReentrantERC20Token,
- provider,
- txDefaults,
- exchange.address,
- );
-
- defaultMakerAssetAddress = erc20TokenA.address;
- defaultTakerAssetAddress = erc20TokenB.address;
-
- const defaultOrderParams = {
- ...constants.STATIC_ORDER_PARAMS,
- exchangeAddress: exchange.address,
- makerAddress,
- feeRecipientAddress,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
- };
- const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
- orderFactory = new OrderFactory(privateKey, defaultOrderParams);
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- describe('fillOrder', () => {
- beforeEach(async () => {
- erc20Balances = await erc20Wrapper.getBalancesAsync();
- signedOrder = await orderFactory.newSignedOrderAsync();
- });
-
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow fillOrder to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
- RevertReason.TransferFailed,
- );
- });
- });
- };
- describe('fillOrder reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should throw if signature is invalid', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
-
- const v = ethUtil.toBuffer(signedOrder.signature.slice(0, 4));
- const invalidR = ethUtil.sha3('invalidR');
- const invalidS = ethUtil.sha3('invalidS');
- const signatureType = ethUtil.toBuffer(`0x${signedOrder.signature.slice(-2)}`);
- const invalidSigBuff = Buffer.concat([v, invalidR, invalidS, signatureType]);
- const invalidSigHex = `0x${invalidSigBuff.toString('hex')}`;
- signedOrder.signature = invalidSigHex;
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
- RevertReason.InvalidOrderSignature,
- );
- });
-
- it('should throw if no value is filled', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync();
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
- RevertReason.OrderUnfillable,
- );
- });
-
- it('should revert if `isValidSignature` tries to update state when SignatureType=Wallet', async () => {
- const maliciousMakerAddress = maliciousWallet.address;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20TokenA.setBalance.sendTransactionAsync(
- maliciousMakerAddress,
- constants.INITIAL_ERC20_BALANCE,
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await maliciousWallet.approveERC20.sendTransactionAsync(
- erc20TokenA.address,
- erc20Proxy.address,
- constants.INITIAL_ERC20_ALLOWANCE,
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAddress: maliciousMakerAddress,
- makerFee: constants.ZERO_AMOUNT,
- });
- signedOrder.signature = `0x0${SignatureType.Wallet}`;
- await expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
- RevertReason.WalletError,
- );
- });
-
- it('should revert if `isValidSignature` tries to update state when SignatureType=Validator', async () => {
- const isApproved = true;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await exchange.setSignatureValidatorApproval.sendTransactionAsync(
- maliciousValidator.address,
- isApproved,
- { from: makerAddress },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- signedOrder.signature = `${maliciousValidator.address}0${SignatureType.Validator}`;
- await expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress),
- RevertReason.ValidatorError,
- );
- });
-
- it('should not emit transfer events for transfers where from == to', async () => {
- const txReceipt = await exchangeWrapper.fillOrderAsync(signedOrder, makerAddress);
- const logs = txReceipt.logs;
- const transferLogs = _.filter(
- logs,
- log => (log as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).event === 'Transfer',
- );
- expect(transferLogs.length).to.be.equal(2);
- expect((transferLogs[0] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).address).to.be.equal(
- zrxToken.address,
- );
- expect((transferLogs[0] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._from).to.be.equal(
- makerAddress,
- );
- expect((transferLogs[0] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._to).to.be.equal(
- feeRecipientAddress,
- );
- expect(
- (transferLogs[0] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._value,
- ).to.be.bignumber.equal(signedOrder.makerFee);
- expect((transferLogs[1] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).address).to.be.equal(
- zrxToken.address,
- );
- expect((transferLogs[1] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._from).to.be.equal(
- makerAddress,
- );
- expect((transferLogs[1] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._to).to.be.equal(
- feeRecipientAddress,
- );
- expect(
- (transferLogs[1] as LogWithDecodedArgs<DummyERC20TokenTransferEventArgs>).args._value,
- ).to.be.bignumber.equal(signedOrder.takerFee);
- });
- });
-
- describe('Testing exchange of ERC20 tokens with no return values', () => {
- before(async () => {
- noReturnErc20Token = await DummyNoReturnERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyNoReturnERC20Token,
- provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- constants.DUMMY_TOKEN_DECIMALS,
- constants.DUMMY_TOKEN_TOTAL_SUPPLY,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await noReturnErc20Token.setBalance.sendTransactionAsync(makerAddress, constants.INITIAL_ERC20_BALANCE),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await noReturnErc20Token.approve.sendTransactionAsync(
- erc20Proxy.address,
- constants.INITIAL_ERC20_ALLOWANCE,
- { from: makerAddress },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- });
- it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(noReturnErc20Token.address),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- });
-
- const initialMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
- const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
- const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
- const initialTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
- const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
- const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
- const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
-
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
-
- const finalMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
- const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
- const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
- const finalTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
- const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
- const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
- const finalFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
-
- expect(finalMakerBalanceA).to.be.bignumber.equal(initialMakerBalanceA.minus(signedOrder.makerAssetAmount));
- expect(finalMakerBalanceB).to.be.bignumber.equal(initialMakerBalanceB.plus(signedOrder.takerAssetAmount));
- expect(finalTakerBalanceA).to.be.bignumber.equal(initialTakerBalanceA.plus(signedOrder.makerAssetAmount));
- expect(finalTakerBalanceB).to.be.bignumber.equal(initialTakerBalanceB.minus(signedOrder.takerAssetAmount));
- expect(finalMakerZrxBalance).to.be.bignumber.equal(initialMakerZrxBalance.minus(signedOrder.makerFee));
- expect(finalTakerZrxBalance).to.be.bignumber.equal(initialTakerZrxBalance.minus(signedOrder.takerFee));
- expect(finalFeeRecipientZrxBalance).to.be.bignumber.equal(
- initialFeeRecipientZrxBalance.plus(signedOrder.makerFee.plus(signedOrder.takerFee)),
- );
- });
- it('should transfer the correct amounts when makerAssetAmount > takerAssetAmount', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(noReturnErc20Token.address),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- });
-
- const initialMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
- const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
- const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
- const initialTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
- const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
- const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
- const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
-
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
-
- const finalMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
- const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
- const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
- const finalTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
- const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
- const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
- const finalFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
-
- expect(finalMakerBalanceA).to.be.bignumber.equal(initialMakerBalanceA.minus(signedOrder.makerAssetAmount));
- expect(finalMakerBalanceB).to.be.bignumber.equal(initialMakerBalanceB.plus(signedOrder.takerAssetAmount));
- expect(finalTakerBalanceA).to.be.bignumber.equal(initialTakerBalanceA.plus(signedOrder.makerAssetAmount));
- expect(finalTakerBalanceB).to.be.bignumber.equal(initialTakerBalanceB.minus(signedOrder.takerAssetAmount));
- expect(finalMakerZrxBalance).to.be.bignumber.equal(initialMakerZrxBalance.minus(signedOrder.makerFee));
- expect(finalTakerZrxBalance).to.be.bignumber.equal(initialTakerZrxBalance.minus(signedOrder.takerFee));
- expect(finalFeeRecipientZrxBalance).to.be.bignumber.equal(
- initialFeeRecipientZrxBalance.plus(signedOrder.makerFee.plus(signedOrder.takerFee)),
- );
- });
- it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(noReturnErc20Token.address),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
- });
-
- const initialMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
- const initialMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
- const initialMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
- const initialTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
- const initialTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
- const initialTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
- const initialFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
-
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
-
- const finalMakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(makerAddress);
- const finalMakerBalanceB = await erc20TokenB.balanceOf.callAsync(makerAddress);
- const finalMakerZrxBalance = await zrxToken.balanceOf.callAsync(makerAddress);
- const finalTakerBalanceA = await noReturnErc20Token.balanceOf.callAsync(takerAddress);
- const finalTakerBalanceB = await erc20TokenB.balanceOf.callAsync(takerAddress);
- const finalTakerZrxBalance = await zrxToken.balanceOf.callAsync(takerAddress);
- const finalFeeRecipientZrxBalance = await zrxToken.balanceOf.callAsync(feeRecipientAddress);
-
- expect(finalMakerBalanceA).to.be.bignumber.equal(initialMakerBalanceA.minus(signedOrder.makerAssetAmount));
- expect(finalMakerBalanceB).to.be.bignumber.equal(initialMakerBalanceB.plus(signedOrder.takerAssetAmount));
- expect(finalTakerBalanceA).to.be.bignumber.equal(initialTakerBalanceA.plus(signedOrder.makerAssetAmount));
- expect(finalTakerBalanceB).to.be.bignumber.equal(initialTakerBalanceB.minus(signedOrder.takerAssetAmount));
- expect(finalMakerZrxBalance).to.be.bignumber.equal(initialMakerZrxBalance.minus(signedOrder.makerFee));
- expect(finalTakerZrxBalance).to.be.bignumber.equal(initialTakerZrxBalance.minus(signedOrder.takerFee));
- expect(finalFeeRecipientZrxBalance).to.be.bignumber.equal(
- initialFeeRecipientZrxBalance.plus(signedOrder.makerFee.plus(signedOrder.takerFee)),
- );
- });
- });
-
- describe('cancelOrder', () => {
- beforeEach(async () => {
- erc20Balances = await erc20Wrapper.getBalancesAsync();
- signedOrder = await orderFactory.newSignedOrderAsync();
- });
-
- it('should throw if not sent by maker', async () => {
- return expectTransactionFailedAsync(
- exchangeWrapper.cancelOrderAsync(signedOrder, takerAddress),
- RevertReason.InvalidMaker,
- );
- });
-
- it('should throw if makerAssetAmount is 0', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(0),
- });
-
- return expectTransactionFailedAsync(
- exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
- RevertReason.OrderUnfillable,
- );
- });
-
- it('should throw if takerAssetAmount is 0', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync({
- takerAssetAmount: new BigNumber(0),
- });
-
- return expectTransactionFailedAsync(
- exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
- RevertReason.OrderUnfillable,
- );
- });
-
- it('should be able to cancel a full order', async () => {
- await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
- }),
- RevertReason.OrderUnfillable,
- );
- });
-
- it('should log 1 event with correct arguments', async () => {
- const res = await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
- expect(res.logs).to.have.length(1);
-
- const log = res.logs[0] as LogWithDecodedArgs<ExchangeCancelEventArgs>;
- const logArgs = log.args;
-
- expect(signedOrder.makerAddress).to.be.equal(logArgs.makerAddress);
- expect(signedOrder.makerAddress).to.be.equal(logArgs.senderAddress);
- expect(signedOrder.feeRecipientAddress).to.be.equal(logArgs.feeRecipientAddress);
- expect(signedOrder.makerAssetData).to.be.equal(logArgs.makerAssetData);
- expect(signedOrder.takerAssetData).to.be.equal(logArgs.takerAssetData);
- expect(orderHashUtils.getOrderHashHex(signedOrder)).to.be.equal(logArgs.orderHash);
- });
-
- it('should throw if already cancelled', async () => {
- await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
- return expectTransactionFailedAsync(
- exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
- RevertReason.OrderUnfillable,
- );
- });
-
- it('should throw if order is expired', async () => {
- const currentTimestamp = await getLatestBlockTimestampAsync();
- signedOrder = await orderFactory.newSignedOrderAsync({
- expirationTimeSeconds: new BigNumber(currentTimestamp).sub(10),
- });
- return expectTransactionFailedAsync(
- exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress),
- RevertReason.OrderUnfillable,
- );
- });
-
- it('should throw if rounding error is greater than 0.1%', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1001),
- takerAssetAmount: new BigNumber(3),
- });
-
- const fillTakerAssetAmount1 = new BigNumber(2);
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerAssetFillAmount: fillTakerAssetAmount1,
- });
-
- const fillTakerAssetAmount2 = new BigNumber(1);
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerAssetFillAmount: fillTakerAssetAmount2,
- }),
- RevertReason.RoundingError,
- );
- });
- });
-
- describe('cancelOrdersUpTo', () => {
- it('should fail to set orderEpoch less than current orderEpoch', async () => {
- const orderEpoch = new BigNumber(1);
- await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
- const lesserOrderEpoch = new BigNumber(0);
- return expectTransactionFailedAsync(
- exchangeWrapper.cancelOrdersUpToAsync(lesserOrderEpoch, makerAddress),
- RevertReason.InvalidNewOrderEpoch,
- );
- });
-
- it('should fail to set orderEpoch equal to existing orderEpoch', async () => {
- const orderEpoch = new BigNumber(1);
- await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
- return expectTransactionFailedAsync(
- exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress),
- RevertReason.InvalidNewOrderEpoch,
- );
- });
-
- it('should cancel only orders with a orderEpoch less than existing orderEpoch', async () => {
- // Cancel all transactions with a orderEpoch less than 1
- const orderEpoch = new BigNumber(1);
- await exchangeWrapper.cancelOrdersUpToAsync(orderEpoch, makerAddress);
-
- // Create 3 orders with orderEpoch values: 0,1,2,3
- // Since we cancelled with orderEpoch=1, orders with orderEpoch<=1 will not be processed
- erc20Balances = await erc20Wrapper.getBalancesAsync();
- const signedOrders = [
- await orderFactory.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(9), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(9), 18),
- salt: new BigNumber(0),
- }),
- await orderFactory.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(79), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(79), 18),
- salt: new BigNumber(1),
- }),
- await orderFactory.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(979), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(979), 18),
- salt: new BigNumber(2),
- }),
- await orderFactory.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(7979), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(7979), 18),
- salt: new BigNumber(3),
- }),
- ];
- await exchangeWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress, {
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 600000,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- const fillMakerAssetAmount = signedOrders[2].makerAssetAmount.add(signedOrders[3].makerAssetAmount);
- const fillTakerAssetAmount = signedOrders[2].takerAssetAmount.add(signedOrders[3].takerAssetAmount);
- const makerFee = signedOrders[2].makerFee.add(signedOrders[3].makerFee);
- const takerFee = signedOrders[2].takerFee.add(signedOrders[3].takerFee);
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(fillMakerAssetAmount),
- );
- expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(fillTakerAssetAmount),
- );
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
- );
- expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultTakerAssetAddress].minus(fillTakerAssetAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(fillMakerAssetAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
- );
- expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
- );
- });
- });
-
- describe('Testing Exchange of ERC721 Tokens', () => {
- it('should throw when maker does not own the token with id makerAssetId', async () => {
- // Construct Exchange parameters
- const makerAssetId = erc721TakerAssetIds[0];
- const takerAssetId = erc721TakerAssetIds[1];
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1),
- takerAssetAmount: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
- });
- // Verify pre-conditions
- const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerAsset).to.be.bignumber.not.equal(makerAddress);
- const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
- // Call Exchange
- const takerAssetFillAmount = signedOrder.takerAssetAmount;
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
- RevertReason.TransferFailed,
- );
- });
-
- it('should throw when taker does not own the token with id takerAssetId', async () => {
- // Construct Exchange parameters
- const makerAssetId = erc721MakerAssetIds[0];
- const takerAssetId = erc721MakerAssetIds[1];
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1),
- takerAssetAmount: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
- });
- // Verify pre-conditions
- const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerAsset).to.be.bignumber.not.equal(takerAddress);
- // Call Exchange
- const takerAssetFillAmount = signedOrder.takerAssetAmount;
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
- RevertReason.TransferFailed,
- );
- });
-
- it('should throw when makerAssetAmount is greater than 1', async () => {
- // Construct Exchange parameters
- const makerAssetId = erc721MakerAssetIds[0];
- const takerAssetId = erc721TakerAssetIds[0];
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(2),
- takerAssetAmount: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
- });
- // Verify pre-conditions
- const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
- // Call Exchange
- const takerAssetFillAmount = signedOrder.takerAssetAmount;
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
- RevertReason.InvalidAmount,
- );
- });
-
- it('should throw when takerAssetAmount is greater than 1', async () => {
- // Construct Exchange parameters
- const makerAssetId = erc721MakerAssetIds[0];
- const takerAssetId = erc721TakerAssetIds[0];
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1),
- takerAssetAmount: new BigNumber(500),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
- });
- // Verify pre-conditions
- const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
- // Call Exchange
- const takerAssetFillAmount = signedOrder.takerAssetAmount;
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
- RevertReason.InvalidAmount,
- );
- });
-
- it('should throw on partial fill', async () => {
- // Construct Exchange parameters
- const makerAssetId = erc721MakerAssetIds[0];
- signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
- });
- // Call Exchange
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
- RevertReason.RoundingError,
- );
- });
- });
-
- describe('getOrderInfo', () => {
- beforeEach(async () => {
- signedOrder = await orderFactory.newSignedOrderAsync();
- });
- it('should return the correct orderInfo for an unfilled valid order', async () => {
- const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = new BigNumber(0);
- const expectedOrderStatus = OrderStatus.FILLABLE;
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- it('should return the correct orderInfo for a fully filled order', async () => {
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
- const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount;
- const expectedOrderStatus = OrderStatus.FULLY_FILLED;
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- it('should return the correct orderInfo for a partially filled order', async () => {
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = takerAssetFillAmount;
- const expectedOrderStatus = OrderStatus.FILLABLE;
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- it('should return the correct orderInfo for a cancelled and unfilled order', async () => {
- await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
- const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = new BigNumber(0);
- const expectedOrderStatus = OrderStatus.CANCELLED;
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- it('should return the correct orderInfo for a cancelled and partially filled order', async () => {
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- await exchangeWrapper.cancelOrderAsync(signedOrder, makerAddress);
- const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = takerAssetFillAmount;
- const expectedOrderStatus = OrderStatus.CANCELLED;
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- it('should return the correct orderInfo for an expired and unfilled order', async () => {
- const currentTimestamp = await getLatestBlockTimestampAsync();
- const timeUntilExpiration = signedOrder.expirationTimeSeconds.minus(currentTimestamp).toNumber();
- await increaseTimeAndMineBlockAsync(timeUntilExpiration);
- const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = new BigNumber(0);
- const expectedOrderStatus = OrderStatus.EXPIRED;
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- it('should return the correct orderInfo for an expired and partially filled order', async () => {
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount });
- const currentTimestamp = await getLatestBlockTimestampAsync();
- const timeUntilExpiration = signedOrder.expirationTimeSeconds.minus(currentTimestamp).toNumber();
- await increaseTimeAndMineBlockAsync(timeUntilExpiration);
- const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = takerAssetFillAmount;
- const expectedOrderStatus = OrderStatus.EXPIRED;
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- it('should return the correct orderInfo for an expired and fully filled order', async () => {
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress);
- const currentTimestamp = await getLatestBlockTimestampAsync();
- const timeUntilExpiration = signedOrder.expirationTimeSeconds.minus(currentTimestamp).toNumber();
- await increaseTimeAndMineBlockAsync(timeUntilExpiration);
- const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount;
- // FULLY_FILLED takes precedence over EXPIRED
- const expectedOrderStatus = OrderStatus.FULLY_FILLED;
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- it('should return the correct orderInfo for an order with a makerAssetAmount of 0', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync({ makerAssetAmount: new BigNumber(0) });
- const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = new BigNumber(0);
- const expectedOrderStatus = OrderStatus.INVALID_MAKER_ASSET_AMOUNT;
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- it('should return the correct orderInfo for an order with a takerAssetAmount of 0', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync({ takerAssetAmount: new BigNumber(0) });
- const orderInfo = await exchangeWrapper.getOrderInfoAsync(signedOrder);
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = new BigNumber(0);
- const expectedOrderStatus = OrderStatus.INVALID_TAKER_ASSET_AMOUNT;
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- });
-});
-// tslint:disable:max-file-line-count
-// tslint:enable:no-unnecessary-type-assertion
diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts
deleted file mode 100644
index 3d3aa42c2..000000000
--- a/packages/contracts/test/exchange/dispatcher.ts
+++ /dev/null
@@ -1,280 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { assetDataUtils } from '@0x/order-utils';
-import { AssetProxyId, RevertReason } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-import { LogWithDecodedArgs } from 'ethereum-types';
-import * as _ from 'lodash';
-
-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-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';
-import { ERC20Wrapper } from '../utils/erc20_wrapper';
-import { ERC721Wrapper } from '../utils/erc721_wrapper';
-import { LogDecoder } from '../utils/log_decoder';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-// tslint:disable:no-unnecessary-type-assertion
-describe('AssetProxyDispatcher', () => {
- let owner: string;
- let notOwner: string;
- let makerAddress: string;
- let takerAddress: string;
-
- let zrxToken: DummyERC20TokenContract;
- let erc20Proxy: ERC20ProxyContract;
- let erc721Proxy: ERC721ProxyContract;
- let assetProxyDispatcher: TestAssetProxyDispatcherContract;
-
- let erc20Wrapper: ERC20Wrapper;
- let erc721Wrapper: ERC721Wrapper;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- // Setup accounts & addresses
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- const usedAddresses = ([owner, notOwner, makerAddress, takerAddress] = _.slice(accounts, 0, 4));
-
- erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
- erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
-
- const numDummyErc20ToDeploy = 1;
- [zrxToken] = await erc20Wrapper.deployDummyTokensAsync(numDummyErc20ToDeploy, constants.DUMMY_TOKEN_DECIMALS);
- erc20Proxy = await erc20Wrapper.deployProxyAsync();
- await erc20Wrapper.setBalancesAndAllowancesAsync();
-
- erc721Proxy = await erc721Wrapper.deployProxyAsync();
-
- assetProxyDispatcher = await TestAssetProxyDispatcherContract.deployFrom0xArtifactAsync(
- artifacts.TestAssetProxyDispatcher,
- provider,
- txDefaults,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(assetProxyDispatcher.address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- describe('registerAssetProxy', () => {
- it('should record proxy upon registration', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
- expect(proxyAddress).to.be.equal(erc20Proxy.address);
- });
-
- it('should be able to record multiple proxies', async () => {
- // Record first proxy
- await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- let proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
- expect(proxyAddress).to.be.equal(erc20Proxy.address);
- // Record another proxy
- await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC721);
- expect(proxyAddress).to.be.equal(erc721Proxy.address);
- });
-
- it('should throw if a proxy with the same id is already registered', async () => {
- // Initial registration
- await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
- expect(proxyAddress).to.be.equal(erc20Proxy.address);
- // Deploy a new version of the ERC20 Transfer Proxy contract
- const newErc20TransferProxy = await ERC20ProxyContract.deployFrom0xArtifactAsync(
- artifacts.ERC20Proxy,
- provider,
- txDefaults,
- );
- // Register new ERC20 Transfer Proxy contract
- return expectTransactionFailedAsync(
- assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(newErc20TransferProxy.address, {
- from: owner,
- }),
- RevertReason.AssetProxyAlreadyExists,
- );
- });
-
- it('should throw if requesting address is not owner', async () => {
- return expectTransactionFailedAsync(
- assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: notOwner }),
- RevertReason.OnlyContractOwner,
- );
- });
-
- it('should log an event with correct arguments when an asset proxy is registered', async () => {
- const logDecoder = new LogDecoder(web3Wrapper);
- const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
- );
- const logs = txReceipt.logs;
- const log = logs[0] as LogWithDecodedArgs<TestAssetProxyDispatcherAssetProxyRegisteredEventArgs>;
- expect(log.args.id).to.equal(AssetProxyId.ERC20);
- expect(log.args.assetProxy).to.equal(erc20Proxy.address);
- });
- });
-
- describe('getAssetProxy', () => {
- it('should return correct address of registered proxy', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
- expect(proxyAddress).to.be.equal(erc20Proxy.address);
- });
-
- it('should return NULL address if requesting non-existent proxy', async () => {
- const proxyAddress = await assetProxyDispatcher.getAssetProxy.callAsync(AssetProxyId.ERC20);
- expect(proxyAddress).to.be.equal(constants.NULL_ADDRESS);
- });
- });
-
- describe('dispatchTransferFrom', () => {
- it('should dispatch transfer to registered proxy', async () => {
- // Register ERC20 proxy
- await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Construct metadata for ERC20 proxy
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
-
- // Perform a transfer from makerAddress to takerAddress
- const erc20Balances = await erc20Wrapper.getBalancesAsync();
- const amount = new BigNumber(10);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- { from: owner },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Verify transfer was successful
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(amount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].add(amount),
- );
- });
-
- it('should not dispatch a transfer if amount == 0', async () => {
- // Register ERC20 proxy
- await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Construct metadata for ERC20 proxy
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
-
- // Perform a transfer from makerAddress to takerAddress
- const erc20Balances = await erc20Wrapper.getBalancesAsync();
- const amount = constants.ZERO_AMOUNT;
- const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- { from: owner },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- expect(txReceipt.logs.length).to.be.equal(0);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.deep.equal(erc20Balances);
- });
-
- it('should not dispatch a transfer if from == to', async () => {
- // Register ERC20 proxy
- await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Construct metadata for ERC20 proxy
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
-
- // Perform a transfer from makerAddress to takerAddress
- const erc20Balances = await erc20Wrapper.getBalancesAsync();
- const amount = new BigNumber(10);
- const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(
- await assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
- encodedAssetData,
- makerAddress,
- makerAddress,
- amount,
- { from: owner },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- expect(txReceipt.logs.length).to.be.equal(0);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.deep.equal(erc20Balances);
- });
-
- it('should throw if dispatching to unregistered proxy', async () => {
- // Construct metadata for ERC20 proxy
- const encodedAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
- // Perform a transfer from makerAddress to takerAddress
- const amount = new BigNumber(10);
- return expectTransactionFailedAsync(
- assetProxyDispatcher.publicDispatchTransferFrom.sendTransactionAsync(
- encodedAssetData,
- makerAddress,
- takerAddress,
- amount,
- { from: owner },
- ),
- RevertReason.AssetProxyDoesNotExist,
- );
- });
- });
-});
-// tslint:enable:no-unnecessary-type-assertion
diff --git a/packages/contracts/test/exchange/fill_order.ts b/packages/contracts/test/exchange/fill_order.ts
deleted file mode 100644
index 37efaad2b..000000000
--- a/packages/contracts/test/exchange/fill_order.ts
+++ /dev/null
@@ -1,312 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import * as _ from 'lodash';
-
-import { chaiSetup } from '../utils/chai_setup';
-import {
- FillOrderCombinatorialUtils,
- fillOrderCombinatorialUtilsFactoryAsync,
-} from '../utils/fill_order_combinatorial_utils';
-import {
- AllowanceAmountScenario,
- AssetDataScenario,
- BalanceAmountScenario,
- ExpirationTimeSecondsScenario,
- FeeRecipientAddressScenario,
- FillScenario,
- OrderAssetAmountScenario,
- TakerAssetFillAmountScenario,
- TakerScenario,
-} from '../utils/types';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-const defaultFillScenario = {
- orderScenario: {
- takerScenario: TakerScenario.Unspecified,
- feeRecipientScenario: FeeRecipientAddressScenario.EthUserAddress,
- makerAssetAmountScenario: OrderAssetAmountScenario.Large,
- takerAssetAmountScenario: OrderAssetAmountScenario.Large,
- makerFeeScenario: OrderAssetAmountScenario.Large,
- takerFeeScenario: OrderAssetAmountScenario.Large,
- expirationTimeSecondsScenario: ExpirationTimeSecondsScenario.InFuture,
- makerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals,
- takerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals,
- },
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount,
- makerStateScenario: {
- traderAssetBalance: BalanceAmountScenario.Higher,
- traderAssetAllowance: AllowanceAmountScenario.Higher,
- zrxFeeBalance: BalanceAmountScenario.Higher,
- zrxFeeAllowance: AllowanceAmountScenario.Higher,
- },
- takerStateScenario: {
- traderAssetBalance: BalanceAmountScenario.Higher,
- traderAssetAllowance: AllowanceAmountScenario.Higher,
- zrxFeeBalance: BalanceAmountScenario.Higher,
- zrxFeeAllowance: AllowanceAmountScenario.Higher,
- },
-};
-
-describe('FillOrder Tests', () => {
- let fillOrderCombinatorialUtils: FillOrderCombinatorialUtils;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- fillOrderCombinatorialUtils = await fillOrderCombinatorialUtilsFactoryAsync(web3Wrapper, txDefaults);
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- describe('fillOrder', () => {
- const test = (fillScenarios: FillScenario[]) => {
- _.forEach(fillScenarios, fillScenario => {
- const description = `Combinatorial OrderFill: ${JSON.stringify(fillScenario)}`;
- it(description, async () => {
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
- });
- };
-
- const allFillScenarios = FillOrderCombinatorialUtils.generateFillOrderCombinations();
- describe('Combinatorially generated fills orders', () => test(allFillScenarios));
-
- it('should transfer the correct amounts when makerAssetAmount === takerAssetAmount', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
- it('should transfer the correct amounts when makerAssetAmount > takerAssetAmount', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- takerAssetAmountScenario: OrderAssetAmountScenario.Small,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
- it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- makerAssetAmountScenario: OrderAssetAmountScenario.Small,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
- it('should transfer the correct amounts when makerAssetAmount < takerAssetAmount with zero decimals', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- makerAssetAmountScenario: OrderAssetAmountScenario.Small,
- makerAssetDataScenario: AssetDataScenario.ERC20ZeroDecimals,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
- it('should transfer the correct amounts when taker is specified and order is claimed by taker', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- takerScenario: TakerScenario.CorrectlySpecified,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
- it('should fill remaining value if takerAssetFillAmount > remaining takerAssetAmount', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount,
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
- it('should throw when taker is specified and order is claimed by other', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- takerScenario: TakerScenario.IncorrectlySpecified,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should throw if makerAssetAmount is 0', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- makerAssetAmountScenario: OrderAssetAmountScenario.Zero,
- },
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount,
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should throw if takerAssetAmount is 0', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- takerAssetAmountScenario: OrderAssetAmountScenario.Zero,
- },
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount,
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should throw if takerAssetFillAmount is 0', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario.Zero,
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should throw if an order is expired', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- expirationTimeSecondsScenario: ExpirationTimeSecondsScenario.InPast,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should throw if maker erc20Balances are too low to fill order', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- makerStateScenario: {
- ...defaultFillScenario.makerStateScenario,
- traderAssetBalance: BalanceAmountScenario.TooLow,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should throw if taker erc20Balances are too low to fill order', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- takerStateScenario: {
- ...defaultFillScenario.makerStateScenario,
- traderAssetBalance: BalanceAmountScenario.TooLow,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should throw if maker allowances are too low to fill order', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- makerStateScenario: {
- ...defaultFillScenario.makerStateScenario,
- traderAssetAllowance: AllowanceAmountScenario.TooLow,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should throw if taker allowances are too low to fill order', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- takerStateScenario: {
- ...defaultFillScenario.makerStateScenario,
- traderAssetAllowance: AllowanceAmountScenario.TooLow,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
- });
-
- describe('Testing exchange of ERC721 Tokens', () => {
- it('should successfully exchange a single token between the maker and taker (via fillOrder)', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- makerAssetDataScenario: AssetDataScenario.ERC721,
- takerAssetDataScenario: AssetDataScenario.ERC721,
- },
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should successfully fill order when makerAsset is ERC721 and takerAsset is ERC20', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- makerAssetDataScenario: AssetDataScenario.ERC721,
- takerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals,
- },
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario, true);
- });
-
- it('should successfully fill order when makerAsset is ERC20 and takerAsset is ERC721', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- makerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals,
- takerAssetDataScenario: AssetDataScenario.ERC721,
- },
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should successfully fill order when makerAsset is ERC721 and approveAll is set for it', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- makerAssetDataScenario: AssetDataScenario.ERC721,
- takerAssetDataScenario: AssetDataScenario.ERC20NonZRXEighteenDecimals,
- },
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
- makerStateScenario: {
- ...defaultFillScenario.makerStateScenario,
- traderAssetAllowance: AllowanceAmountScenario.Unlimited,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
-
- it('should successfully fill order when makerAsset and takerAsset are ERC721 and approveAll is set for them', async () => {
- const fillScenario = {
- ...defaultFillScenario,
- orderScenario: {
- ...defaultFillScenario.orderScenario,
- makerAssetDataScenario: AssetDataScenario.ERC721,
- takerAssetDataScenario: AssetDataScenario.ERC721,
- },
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
- makerStateScenario: {
- ...defaultFillScenario.makerStateScenario,
- traderAssetAllowance: AllowanceAmountScenario.Unlimited,
- },
- takerStateScenario: {
- ...defaultFillScenario.takerStateScenario,
- traderAssetAllowance: AllowanceAmountScenario.Unlimited,
- },
- };
- await fillOrderCombinatorialUtils.testFillOrderScenarioAsync(provider, fillScenario);
- });
- });
-});
diff --git a/packages/contracts/test/exchange/internal.ts b/packages/contracts/test/exchange/internal.ts
deleted file mode 100644
index 109be29c6..000000000
--- a/packages/contracts/test/exchange/internal.ts
+++ /dev/null
@@ -1,466 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { Order, RevertReason, SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-import * as _ from 'lodash';
-
-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';
-import { constants } from '../utils/constants';
-import { FillResults } from '../utils/types';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
-
-const emptyOrder: Order = {
- senderAddress: constants.NULL_ADDRESS,
- makerAddress: constants.NULL_ADDRESS,
- takerAddress: constants.NULL_ADDRESS,
- makerFee: new BigNumber(0),
- takerFee: new BigNumber(0),
- makerAssetAmount: new BigNumber(0),
- takerAssetAmount: new BigNumber(0),
- makerAssetData: '0x',
- takerAssetData: '0x',
- salt: new BigNumber(0),
- exchangeAddress: constants.NULL_ADDRESS,
- feeRecipientAddress: constants.NULL_ADDRESS,
- expirationTimeSeconds: new BigNumber(0),
-};
-
-const emptySignedOrder: SignedOrder = {
- ...emptyOrder,
- signature: '',
-};
-
-const overflowErrorForCall = new Error(RevertReason.Uint256Overflow);
-
-describe('Exchange core internal functions', () => {
- let testExchange: TestExchangeInternalsContract;
- let overflowErrorForSendTransaction: Error | undefined;
- let divisionByZeroErrorForCall: Error | undefined;
- let roundingErrorForCall: Error | undefined;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- testExchange = await TestExchangeInternalsContract.deployFrom0xArtifactAsync(
- artifacts.TestExchangeInternals,
- provider,
- txDefaults,
- );
- overflowErrorForSendTransaction = new Error(
- await getRevertReasonOrErrorMessageForSendTransactionAsync(RevertReason.Uint256Overflow),
- );
- divisionByZeroErrorForCall = new Error(RevertReason.DivisionByZero);
- roundingErrorForCall = new Error(RevertReason.RoundingError);
- });
- // Note(albrow): Don't forget to add beforeEach and afterEach calls to reset
- // the blockchain state for any tests which modify it!
-
- async function referenceIsRoundingErrorFloorAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<boolean> {
- if (denominator.eq(0)) {
- throw divisionByZeroErrorForCall;
- }
- if (numerator.eq(0)) {
- return false;
- }
- if (target.eq(0)) {
- return false;
- }
- const product = numerator.mul(target);
- const remainder = product.mod(denominator);
- const remainderTimes1000 = remainder.mul('1000');
- const isError = remainderTimes1000.gte(product);
- if (product.greaterThan(MAX_UINT256)) {
- throw overflowErrorForCall;
- }
- if (remainderTimes1000.greaterThan(MAX_UINT256)) {
- throw overflowErrorForCall;
- }
- return isError;
- }
-
- async function referenceIsRoundingErrorCeilAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<boolean> {
- if (denominator.eq(0)) {
- throw divisionByZeroErrorForCall;
- }
- if (numerator.eq(0)) {
- return false;
- }
- if (target.eq(0)) {
- return false;
- }
- const product = numerator.mul(target);
- const remainder = product.mod(denominator);
- const error = denominator.sub(remainder).mod(denominator);
- const errorTimes1000 = error.mul('1000');
- const isError = errorTimes1000.gte(product);
- if (product.greaterThan(MAX_UINT256)) {
- throw overflowErrorForCall;
- }
- if (errorTimes1000.greaterThan(MAX_UINT256)) {
- throw overflowErrorForCall;
- }
- return isError;
- }
-
- async function referenceSafeGetPartialAmountFloorAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<BigNumber> {
- if (denominator.eq(0)) {
- throw divisionByZeroErrorForCall;
- }
- const isRoundingError = await referenceIsRoundingErrorFloorAsync(numerator, denominator, target);
- if (isRoundingError) {
- throw roundingErrorForCall;
- }
- const product = numerator.mul(target);
- if (product.greaterThan(MAX_UINT256)) {
- throw overflowErrorForCall;
- }
- return product.dividedToIntegerBy(denominator);
- }
-
- describe('addFillResults', async () => {
- function makeFillResults(value: BigNumber): FillResults {
- return {
- makerAssetFilledAmount: value,
- takerAssetFilledAmount: value,
- makerFeePaid: value,
- takerFeePaid: value,
- };
- }
- async function referenceAddFillResultsAsync(
- totalValue: BigNumber,
- singleValue: BigNumber,
- ): Promise<FillResults> {
- // Note(albrow): Here, each of totalFillResults and
- // singleFillResults will consist of fields with the same values.
- // This should be safe because none of the fields in a given
- // FillResults are ever used together in a mathemetical operation.
- // They are only used with the corresponding field from *the other*
- // FillResults, which are different.
- const totalFillResults = makeFillResults(totalValue);
- const singleFillResults = makeFillResults(singleValue);
- // HACK(albrow): _.mergeWith mutates the first argument! To
- // workaround this we use _.cloneDeep.
- return _.mergeWith(
- _.cloneDeep(totalFillResults),
- singleFillResults,
- (totalVal: BigNumber, singleVal: BigNumber) => {
- const newTotal = totalVal.add(singleVal);
- if (newTotal.greaterThan(MAX_UINT256)) {
- throw overflowErrorForCall;
- }
- return newTotal;
- },
- );
- }
- async function testAddFillResultsAsync(totalValue: BigNumber, singleValue: BigNumber): Promise<FillResults> {
- const totalFillResults = makeFillResults(totalValue);
- const singleFillResults = makeFillResults(singleValue);
- return testExchange.publicAddFillResults.callAsync(totalFillResults, singleFillResults);
- }
- await testCombinatoriallyWithReferenceFuncAsync(
- 'addFillResults',
- referenceAddFillResultsAsync,
- testAddFillResultsAsync,
- [uint256Values, uint256Values],
- );
- });
-
- describe('calculateFillResults', async () => {
- function makeOrder(
- makerAssetAmount: BigNumber,
- takerAssetAmount: BigNumber,
- makerFee: BigNumber,
- takerFee: BigNumber,
- ): Order {
- return {
- ...emptyOrder,
- makerAssetAmount,
- takerAssetAmount,
- makerFee,
- takerFee,
- };
- }
- async function referenceCalculateFillResultsAsync(
- orderTakerAssetAmount: BigNumber,
- takerAssetFilledAmount: BigNumber,
- otherAmount: BigNumber,
- ): Promise<FillResults> {
- // Note(albrow): Here we are re-using the same value (otherAmount)
- // for order.makerAssetAmount, order.makerFee, and order.takerFee.
- // This should be safe because they are never used with each other
- // in any mathematical operation in either the reference TypeScript
- // implementation or the Solidity implementation of
- // calculateFillResults.
- const makerAssetFilledAmount = await referenceSafeGetPartialAmountFloorAsync(
- takerAssetFilledAmount,
- orderTakerAssetAmount,
- otherAmount,
- );
- const order = makeOrder(otherAmount, orderTakerAssetAmount, otherAmount, otherAmount);
- const orderMakerAssetAmount = order.makerAssetAmount;
- return {
- makerAssetFilledAmount,
- takerAssetFilledAmount,
- makerFeePaid: await referenceSafeGetPartialAmountFloorAsync(
- makerAssetFilledAmount,
- orderMakerAssetAmount,
- otherAmount,
- ),
- takerFeePaid: await referenceSafeGetPartialAmountFloorAsync(
- takerAssetFilledAmount,
- orderTakerAssetAmount,
- otherAmount,
- ),
- };
- }
- async function testCalculateFillResultsAsync(
- orderTakerAssetAmount: BigNumber,
- takerAssetFilledAmount: BigNumber,
- otherAmount: BigNumber,
- ): Promise<FillResults> {
- const order = makeOrder(otherAmount, orderTakerAssetAmount, otherAmount, otherAmount);
- return testExchange.publicCalculateFillResults.callAsync(order, takerAssetFilledAmount);
- }
- await testCombinatoriallyWithReferenceFuncAsync(
- 'calculateFillResults',
- referenceCalculateFillResultsAsync,
- testCalculateFillResultsAsync,
- [uint256Values, uint256Values, uint256Values],
- );
- });
-
- describe('getPartialAmountFloor', async () => {
- async function referenceGetPartialAmountFloorAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<BigNumber> {
- if (denominator.eq(0)) {
- throw divisionByZeroErrorForCall;
- }
- const product = numerator.mul(target);
- if (product.greaterThan(MAX_UINT256)) {
- throw overflowErrorForCall;
- }
- return product.dividedToIntegerBy(denominator);
- }
- async function testGetPartialAmountFloorAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<BigNumber> {
- return testExchange.publicGetPartialAmountFloor.callAsync(numerator, denominator, target);
- }
- await testCombinatoriallyWithReferenceFuncAsync(
- 'getPartialAmountFloor',
- referenceGetPartialAmountFloorAsync,
- testGetPartialAmountFloorAsync,
- [uint256Values, uint256Values, uint256Values],
- );
- });
-
- describe('getPartialAmountCeil', async () => {
- async function referenceGetPartialAmountCeilAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<BigNumber> {
- if (denominator.eq(0)) {
- throw divisionByZeroErrorForCall;
- }
- const product = numerator.mul(target);
- const offset = product.add(denominator.sub(1));
- if (offset.greaterThan(MAX_UINT256)) {
- throw overflowErrorForCall;
- }
- const result = offset.dividedToIntegerBy(denominator);
- if (product.mod(denominator).eq(0)) {
- expect(result.mul(denominator)).to.be.bignumber.eq(product);
- } else {
- expect(result.mul(denominator)).to.be.bignumber.gt(product);
- }
- return result;
- }
- async function testGetPartialAmountCeilAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<BigNumber> {
- return testExchange.publicGetPartialAmountCeil.callAsync(numerator, denominator, target);
- }
- await testCombinatoriallyWithReferenceFuncAsync(
- 'getPartialAmountCeil',
- referenceGetPartialAmountCeilAsync,
- testGetPartialAmountCeilAsync,
- [uint256Values, uint256Values, uint256Values],
- );
- });
-
- describe('safeGetPartialAmountFloor', async () => {
- async function testSafeGetPartialAmountFloorAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<BigNumber> {
- return testExchange.publicSafeGetPartialAmountFloor.callAsync(numerator, denominator, target);
- }
- await testCombinatoriallyWithReferenceFuncAsync(
- 'safeGetPartialAmountFloor',
- referenceSafeGetPartialAmountFloorAsync,
- testSafeGetPartialAmountFloorAsync,
- [uint256Values, uint256Values, uint256Values],
- );
- });
-
- describe('safeGetPartialAmountCeil', async () => {
- async function referenceSafeGetPartialAmountCeilAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<BigNumber> {
- if (denominator.eq(0)) {
- throw divisionByZeroErrorForCall;
- }
- const isRoundingError = await referenceIsRoundingErrorCeilAsync(numerator, denominator, target);
- if (isRoundingError) {
- throw roundingErrorForCall;
- }
- const product = numerator.mul(target);
- const offset = product.add(denominator.sub(1));
- if (offset.greaterThan(MAX_UINT256)) {
- throw overflowErrorForCall;
- }
- const result = offset.dividedToIntegerBy(denominator);
- if (product.mod(denominator).eq(0)) {
- expect(result.mul(denominator)).to.be.bignumber.eq(product);
- } else {
- expect(result.mul(denominator)).to.be.bignumber.gt(product);
- }
- return result;
- }
- async function testSafeGetPartialAmountCeilAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<BigNumber> {
- return testExchange.publicSafeGetPartialAmountCeil.callAsync(numerator, denominator, target);
- }
- await testCombinatoriallyWithReferenceFuncAsync(
- 'safeGetPartialAmountCeil',
- referenceSafeGetPartialAmountCeilAsync,
- testSafeGetPartialAmountCeilAsync,
- [uint256Values, uint256Values, uint256Values],
- );
- });
-
- describe('isRoundingErrorFloor', async () => {
- async function testIsRoundingErrorFloorAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<boolean> {
- return testExchange.publicIsRoundingErrorFloor.callAsync(numerator, denominator, target);
- }
- await testCombinatoriallyWithReferenceFuncAsync(
- 'isRoundingErrorFloor',
- referenceIsRoundingErrorFloorAsync,
- testIsRoundingErrorFloorAsync,
- [uint256Values, uint256Values, uint256Values],
- );
- });
-
- describe('isRoundingErrorCeil', async () => {
- async function testIsRoundingErrorCeilAsync(
- numerator: BigNumber,
- denominator: BigNumber,
- target: BigNumber,
- ): Promise<boolean> {
- return testExchange.publicIsRoundingErrorCeil.callAsync(numerator, denominator, target);
- }
- await testCombinatoriallyWithReferenceFuncAsync(
- 'isRoundingErrorCeil',
- referenceIsRoundingErrorCeilAsync,
- testIsRoundingErrorCeilAsync,
- [uint256Values, uint256Values, uint256Values],
- );
- });
-
- describe('updateFilledState', async () => {
- // Note(albrow): Since updateFilledState modifies the state by calling
- // sendTransaction, we must reset the state after each test.
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- async function referenceUpdateFilledStateAsync(
- takerAssetFilledAmount: BigNumber,
- orderTakerAssetFilledAmount: BigNumber,
- // tslint:disable-next-line:no-unused-variable
- orderHash: string,
- ): Promise<BigNumber> {
- const totalFilledAmount = takerAssetFilledAmount.add(orderTakerAssetFilledAmount);
- if (totalFilledAmount.greaterThan(MAX_UINT256)) {
- throw overflowErrorForSendTransaction;
- }
- return totalFilledAmount;
- }
- async function testUpdateFilledStateAsync(
- takerAssetFilledAmount: BigNumber,
- orderTakerAssetFilledAmount: BigNumber,
- orderHash: string,
- ): Promise<BigNumber> {
- const fillResults = {
- makerAssetFilledAmount: new BigNumber(0),
- takerAssetFilledAmount,
- makerFeePaid: new BigNumber(0),
- takerFeePaid: new BigNumber(0),
- };
- await web3Wrapper.awaitTransactionSuccessAsync(
- await testExchange.publicUpdateFilledState.sendTransactionAsync(
- emptySignedOrder,
- constants.NULL_ADDRESS,
- orderHash,
- orderTakerAssetFilledAmount,
- fillResults,
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- return testExchange.filled.callAsync(orderHash);
- }
- await testCombinatoriallyWithReferenceFuncAsync(
- 'updateFilledState',
- referenceUpdateFilledStateAsync,
- testUpdateFilledStateAsync,
- [uint256Values, uint256Values, bytes32Values],
- );
- });
-});
diff --git a/packages/contracts/test/exchange/libs.ts b/packages/contracts/test/exchange/libs.ts
deleted file mode 100644
index 503ef0e0f..000000000
--- a/packages/contracts/test/exchange/libs.ts
+++ /dev/null
@@ -1,137 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
-import { SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-
-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 { chaiSetup } from '../utils/chai_setup';
-import { constants } from '../utils/constants';
-import { OrderFactory } from '../utils/order_factory';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-describe('Exchange libs', () => {
- let signedOrder: SignedOrder;
- let orderFactory: OrderFactory;
- let libs: TestLibsContract;
- let testConstants: TestConstantsContract;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- const makerAddress = accounts[0];
- libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
- testConstants = await TestConstantsContract.deployFrom0xArtifactAsync(
- artifacts.TestConstants,
- provider,
- txDefaults,
- );
-
- const defaultOrderParams = {
- ...constants.STATIC_ORDER_PARAMS,
- exchangeAddress: libs.address,
- makerAddress,
- feeRecipientAddress: addressUtils.generatePseudoRandomAddress(),
- makerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
- takerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
- };
- const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
- orderFactory = new OrderFactory(privateKey, defaultOrderParams);
- });
-
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
-
- describe('LibConstants', () => {
- describe('ZRX_ASSET_DATA', () => {
- it('should have the correct ZRX_ASSET_DATA', async () => {
- const isValid = await testConstants.assertValidZrxAssetData.callAsync();
- expect(isValid).to.be.equal(true);
- });
- });
- });
- // Note(albrow): These tests are designed to be supplemental to the
- // combinatorial tests in test/exchange/internal. They test specific edge
- // cases that are not covered by the combinatorial tests.
- describe('LibMath', () => {
- describe('isRoundingError', () => {
- it('should return true if there is a rounding error of 0.1%', async () => {
- const numerator = new BigNumber(20);
- const denominator = new BigNumber(999);
- const target = new BigNumber(50);
- // rounding error = ((20*50/999) - floor(20*50/999)) / (20*50/999) = 0.1%
- const isRoundingError = await libs.publicIsRoundingErrorFloor.callAsync(numerator, denominator, target);
- expect(isRoundingError).to.be.true();
- });
- it('should return false if there is a rounding of 0.09%', async () => {
- const numerator = new BigNumber(20);
- const denominator = new BigNumber(9991);
- const target = new BigNumber(500);
- // rounding error = ((20*500/9991) - floor(20*500/9991)) / (20*500/9991) = 0.09%
- const isRoundingError = await libs.publicIsRoundingErrorFloor.callAsync(numerator, denominator, target);
- expect(isRoundingError).to.be.false();
- });
- it('should return true if there is a rounding error of 0.11%', async () => {
- const numerator = new BigNumber(20);
- const denominator = new BigNumber(9989);
- const target = new BigNumber(500);
- // rounding error = ((20*500/9989) - floor(20*500/9989)) / (20*500/9989) = 0.011%
- const isRoundingError = await libs.publicIsRoundingErrorFloor.callAsync(numerator, denominator, target);
- expect(isRoundingError).to.be.true();
- });
- });
- describe('isRoundingErrorCeil', () => {
- it('should return true if there is a rounding error of 0.1%', async () => {
- const numerator = new BigNumber(20);
- const denominator = new BigNumber(1001);
- const target = new BigNumber(50);
- // rounding error = (ceil(20*50/1001) - (20*50/1001)) / (20*50/1001) = 0.1%
- const isRoundingError = await libs.publicIsRoundingErrorCeil.callAsync(numerator, denominator, target);
- expect(isRoundingError).to.be.true();
- });
- it('should return false if there is a rounding of 0.09%', async () => {
- const numerator = new BigNumber(20);
- const denominator = new BigNumber(10009);
- const target = new BigNumber(500);
- // rounding error = (ceil(20*500/10009) - (20*500/10009)) / (20*500/10009) = 0.09%
- const isRoundingError = await libs.publicIsRoundingErrorCeil.callAsync(numerator, denominator, target);
- expect(isRoundingError).to.be.false();
- });
- it('should return true if there is a rounding error of 0.11%', async () => {
- const numerator = new BigNumber(20);
- const denominator = new BigNumber(10011);
- const target = new BigNumber(500);
- // rounding error = (ceil(20*500/10011) - (20*500/10011)) / (20*500/10011) = 0.11%
- const isRoundingError = await libs.publicIsRoundingErrorCeil.callAsync(numerator, denominator, target);
- expect(isRoundingError).to.be.true();
- });
- });
- });
-
- describe('LibOrder', () => {
- describe('getOrderHash', () => {
- it('should output the correct orderHash', async () => {
- signedOrder = await orderFactory.newSignedOrderAsync();
- const orderHashHex = await libs.publicGetOrderHash.callAsync(signedOrder);
- expect(orderHashUtils.getOrderHashHex(signedOrder)).to.be.equal(orderHashHex);
- });
- });
- });
-});
diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts
deleted file mode 100644
index eea9992d9..000000000
--- a/packages/contracts/test/exchange/match_orders.ts
+++ /dev/null
@@ -1,1276 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { assetDataUtils } from '@0x/order-utils';
-import { RevertReason } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as chai from 'chai';
-import * as _ from 'lodash';
-
-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';
-import { ERC20Wrapper } from '../utils/erc20_wrapper';
-import { ERC721Wrapper } from '../utils/erc721_wrapper';
-import { ExchangeWrapper } from '../utils/exchange_wrapper';
-import { MatchOrderTester } from '../utils/match_order_tester';
-import { OrderFactory } from '../utils/order_factory';
-import { ERC20BalancesByOwner, ERC721TokenIdsByOwner } from '../utils/types';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-chaiSetup.configure();
-const expect = chai.expect;
-
-describe('matchOrders', () => {
- let makerAddressLeft: string;
- let makerAddressRight: string;
- let owner: string;
- let takerAddress: string;
- let feeRecipientAddressLeft: string;
- let feeRecipientAddressRight: string;
-
- let erc20TokenA: DummyERC20TokenContract;
- let erc20TokenB: DummyERC20TokenContract;
- let zrxToken: DummyERC20TokenContract;
- let erc721Token: DummyERC721TokenContract;
- let reentrantErc20Token: ReentrantERC20TokenContract;
- let exchange: ExchangeContract;
- let erc20Proxy: ERC20ProxyContract;
- let erc721Proxy: ERC721ProxyContract;
-
- let erc20BalancesByOwner: ERC20BalancesByOwner;
- let erc721TokenIdsByOwner: ERC721TokenIdsByOwner;
- let exchangeWrapper: ExchangeWrapper;
- let erc20Wrapper: ERC20Wrapper;
- let erc721Wrapper: ERC721Wrapper;
- let orderFactoryLeft: OrderFactory;
- let orderFactoryRight: OrderFactory;
-
- let erc721LeftMakerAssetIds: BigNumber[];
- let erc721RightMakerAssetIds: BigNumber[];
-
- let defaultERC20MakerAssetAddress: string;
- let defaultERC20TakerAssetAddress: string;
- let defaultERC721AssetAddress: string;
-
- let matchOrderTester: MatchOrderTester;
-
- let testExchange: TestExchangeInternalsContract;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- // Create accounts
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- // Hack(albrow): Both Prettier and TSLint insert a trailing comma below
- // but that is invalid syntax as of TypeScript version >= 2.8. We don't
- // have the right fine-grained configuration options in TSLint,
- // Prettier, or TypeScript, to reconcile this, so we will just have to
- // wait for them to sort it out. We disable TSLint and Prettier for
- // this part of the code for now. This occurs several times in this
- // file. See https://github.com/prettier/prettier/issues/4624.
- // prettier-ignore
- const usedAddresses = ([
- owner,
- makerAddressLeft,
- makerAddressRight,
- takerAddress,
- feeRecipientAddressLeft,
- // tslint:disable-next-line:trailing-comma
- feeRecipientAddressRight
- ] = _.slice(accounts, 0, 6));
- // Create wrappers
- erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
- erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
- // Deploy ERC20 token & ERC20 proxy
- const numDummyErc20ToDeploy = 3;
- [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
- numDummyErc20ToDeploy,
- constants.DUMMY_TOKEN_DECIMALS,
- );
- erc20Proxy = await erc20Wrapper.deployProxyAsync();
- await erc20Wrapper.setBalancesAndAllowancesAsync();
- // Deploy ERC721 token and proxy
- [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
- erc721Proxy = await erc721Wrapper.deployProxyAsync();
- await erc721Wrapper.setBalancesAndAllowancesAsync();
- const erc721Balances = await erc721Wrapper.getBalancesAsync();
- erc721LeftMakerAssetIds = erc721Balances[makerAddressLeft][erc721Token.address];
- erc721RightMakerAssetIds = erc721Balances[makerAddressRight][erc721Token.address];
- // Depoy exchange
- exchange = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
- provider,
- txDefaults,
- assetDataUtils.encodeERC20AssetData(zrxToken.address),
- );
- exchangeWrapper = new ExchangeWrapper(exchange, provider);
- await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
- await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
- // Authorize ERC20 and ERC721 trades by exchange
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.ReentrantERC20Token,
- provider,
- txDefaults,
- exchange.address,
- );
-
- // Set default addresses
- defaultERC20MakerAssetAddress = erc20TokenA.address;
- defaultERC20TakerAssetAddress = erc20TokenB.address;
- defaultERC721AssetAddress = erc721Token.address;
- // Create default order parameters
- const defaultOrderParamsLeft = {
- ...constants.STATIC_ORDER_PARAMS,
- makerAddress: makerAddressLeft,
- exchangeAddress: exchange.address,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
- feeRecipientAddress: feeRecipientAddressLeft,
- };
- const defaultOrderParamsRight = {
- ...constants.STATIC_ORDER_PARAMS,
- makerAddress: makerAddressRight,
- exchangeAddress: exchange.address,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
- feeRecipientAddress: feeRecipientAddressRight,
- };
- const privateKeyLeft = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressLeft)];
- orderFactoryLeft = new OrderFactory(privateKeyLeft, defaultOrderParamsLeft);
- const privateKeyRight = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddressRight)];
- orderFactoryRight = new OrderFactory(privateKeyRight, defaultOrderParamsRight);
- // Set match order tester
- matchOrderTester = new MatchOrderTester(exchangeWrapper, erc20Wrapper, erc721Wrapper, zrxToken.address);
- testExchange = await TestExchangeInternalsContract.deployFrom0xArtifactAsync(
- artifacts.TestExchangeInternals,
- provider,
- txDefaults,
- );
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- describe('matchOrders', () => {
- beforeEach(async () => {
- erc20BalancesByOwner = await erc20Wrapper.getBalancesAsync();
- erc721TokenIdsByOwner = await erc721Wrapper.getBalancesAsync();
- });
-
- it('Should transfer correct amounts when right order is fully filled and values pass isRoundingErrorFloor but fail isRoundingErrorCeil', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAddress: makerAddressLeft,
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(17), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(98), 0),
- feeRecipientAddress: feeRecipientAddressLeft,
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAddress: makerAddressRight,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(75), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
- feeRecipientAddress: feeRecipientAddressRight,
- });
- // Assert is rounding error ceil & not rounding error floor
- // These assertions are taken from MixinMatchOrders::calculateMatchedFillResults
- // The rounding error is derived computating how much the left maker will sell.
- const numerator = signedOrderLeft.makerAssetAmount;
- const denominator = signedOrderLeft.takerAssetAmount;
- const target = signedOrderRight.makerAssetAmount;
- const isRoundingErrorCeil = await testExchange.publicIsRoundingErrorCeil.callAsync(
- numerator,
- denominator,
- target,
- );
- expect(isRoundingErrorCeil).to.be.true();
- const isRoundingErrorFloor = await testExchange.publicIsRoundingErrorFloor.callAsync(
- numerator,
- denominator,
- target,
- );
- expect(isRoundingErrorFloor).to.be.false();
- // Match signedOrderLeft with signedOrderRight
- // Note that the left maker received a slightly better sell price.
- // This is intentional; see note in MixinMatchOrders.calculateMatchedFillResults.
- // Because the left maker received a slightly more favorable sell price, the fee
- // paid by the left taker is slightly higher than that paid by the left maker.
- // Fees can be thought of as a tax paid by the seller, derived from the sale price.
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(75), 0),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('76.4705882352941176'), 16), // 76.47%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(75), 0),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 0),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber('76.5306122448979591'), 16), // 76.53%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('Should transfer correct amounts when left order is fully filled and values pass isRoundingErrorCeil but fail isRoundingErrorFloor', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAddress: makerAddressLeft,
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(15), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 0),
- feeRecipientAddress: feeRecipientAddressLeft,
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAddress: makerAddressRight,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(97), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(14), 0),
- feeRecipientAddress: feeRecipientAddressRight,
- });
- // Assert is rounding error floor & not rounding error ceil
- // These assertions are taken from MixinMatchOrders::calculateMatchedFillResults
- // The rounding error is derived computating how much the right maker will buy.
- const numerator = signedOrderRight.takerAssetAmount;
- const denominator = signedOrderRight.makerAssetAmount;
- const target = signedOrderLeft.takerAssetAmount;
- const isRoundingErrorFloor = await testExchange.publicIsRoundingErrorFloor.callAsync(
- numerator,
- denominator,
- target,
- );
- expect(isRoundingErrorFloor).to.be.true();
- const isRoundingErrorCeil = await testExchange.publicIsRoundingErrorCeil.callAsync(
- numerator,
- denominator,
- target,
- );
- expect(isRoundingErrorCeil).to.be.false();
- // Match signedOrderLeft with signedOrderRight
- // Note that the right maker received a slightly better purchase price.
- // This is intentional; see note in MixinMatchOrders.calculateMatchedFillResults.
- // Because the right maker received a slightly more favorable buy price, the fee
- // paid by the right taker is slightly higher than that paid by the right maker.
- // Fees can be thought of as a tax paid by the seller, derived from the sale price.
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(15), 0),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 0),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 0),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('92.7835051546391752'), 16), // 92.78%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 0),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber('92.8571428571428571'), 16), // 92.85%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('Should give right maker a better buy price when rounding', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAddress: makerAddressLeft,
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(16), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
- feeRecipientAddress: feeRecipientAddressLeft,
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAddress: makerAddressRight,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(83), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(49), 0),
- feeRecipientAddress: feeRecipientAddressRight,
- });
- // Note:
- // The correct price buy price for the right maker would yield (49/83) * 22 = 12.988 units
- // of the left maker asset. This gets rounded up to 13, giving the right maker a better price.
- // Note:
- // The maker/taker fee percentage paid on the right order differs because
- // they received different sale prices. The right maker pays a
- // fee slightly lower than the right taker.
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(16), 0),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('26.5060240963855421'), 16), // 26.506%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 0),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber('26.5306122448979591'), 16), // 26.531%
- };
- // Match signedOrderLeft with signedOrderRight
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('Should give left maker a better sell price when rounding', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAddress: makerAddressLeft,
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(12), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(97), 0),
- feeRecipientAddress: feeRecipientAddressLeft,
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAddress: makerAddressRight,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
- feeRecipientAddress: feeRecipientAddressRight,
- });
- // Note:
- // The maker/taker fee percentage paid on the left order differs because
- // they received different sale prices. The left maker pays a fee
- // slightly lower than the left taker.
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(11), 0),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('91.6666666666666666'), 16), // 91.6%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 0),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber('91.7525773195876288'), 16), // 91.75%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- // Match signedOrderLeft with signedOrderRight
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('Should give right maker and right taker a favorable fee price when rounding', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAddress: makerAddressLeft,
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(16), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
- feeRecipientAddress: feeRecipientAddressLeft,
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAddress: makerAddressRight,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(83), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(49), 0),
- feeRecipientAddress: feeRecipientAddressRight,
- makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 0),
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 0),
- });
- // Note:
- // The maker/taker fee percentage paid on the right order differs because
- // they received different sale prices. The right maker pays a
- // fee slightly lower than the right taker.
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(16), 0),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(22), 0),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(13), 0),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2650), 0), // 2650.6 rounded down tro 2650
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 0),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(2653), 0), // 2653.1 rounded down to 2653
- };
- // Match signedOrderLeft with signedOrderRight
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('Should give left maker and left taker a favorable fee price when rounding', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAddress: makerAddressLeft,
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(12), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(97), 0),
- feeRecipientAddress: feeRecipientAddressLeft,
- makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 0),
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 0),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAddress: makerAddressRight,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
- feeRecipientAddress: feeRecipientAddressRight,
- });
- // Note:
- // The maker/taker fee percentage paid on the left order differs because
- // they received different sale prices. The left maker pays a
- // fee slightly lower than the left taker.
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(11), 0),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(9166), 0), // 9166.6 rounded down to 9166
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(89), 0),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 0),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(9175), 0), // 9175.2 rounded down to 9175
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- // Match signedOrderLeft with signedOrderRight
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('Should transfer correct amounts when right order fill amount deviates from amount derived by `Exchange.fillOrder`', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAddress: makerAddressLeft,
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1005), 0),
- feeRecipientAddress: feeRecipientAddressLeft,
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAddress: makerAddressRight,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2126), 0),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1063), 0),
- feeRecipientAddress: feeRecipientAddressRight,
- });
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 0),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1005), 0),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- // Notes:
- // i.
- // The left order is fully filled by the right order, so the right maker must sell 1005 units of their asset to the left maker.
- // By selling 1005 units, the right maker should theoretically receive 502.5 units of the left maker's asset.
- // Since the transfer amount must be an integer, this value must be rounded down to 502 or up to 503.
- // ii.
- // If the right order were filled via `Exchange.fillOrder` the respective fill amounts would be [1004, 502] or [1006, 503].
- // It follows that we cannot trigger a sale of 1005 units of the right maker's asset through `Exchange.fillOrder`.
- // iii.
- // For an optimal match, the algorithm must choose either [1005, 502] or [1005, 503] as fill amounts for the right order.
- // The algorithm favors the right maker when the exchange rate must be rounded, so the final fill for the right order is [1005, 503].
- // iv.
- // The right maker fee differs from the right taker fee because their exchange rate differs.
- // The right maker always receives the better exchange and fee price.
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1005), 0),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(503), 0),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber('47.2718720602069614'), 16), // 47.27%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(497), 0),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber('47.3189087488240827'), 16), // 47.31%
- };
- // Match signedOrderLeft with signedOrderRight
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow matchOrders to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAddress: makerAddressRight,
- takerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feeRecipientAddress: feeRecipientAddressRight,
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await expectTransactionFailedAsync(
- exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
- RevertReason.TransferFailed,
- );
- });
- });
- };
- describe('matchOrders reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should transfer the correct amounts when orders completely fill each other', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Match signedOrderLeft with signedOrderRight
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('should transfer the correct amounts when orders completely fill each other and taker doesnt take a profit', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- });
- // Match signedOrderLeft with signedOrderRight
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- // Match signedOrderLeft with signedOrderRight
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('should transfer the correct amounts when left order is completely filled and right order is partially filled', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
- });
- // Match signedOrderLeft with signedOrderRight
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 16), // 50%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 16), // 50%
- };
- // Match signedOrderLeft with signedOrderRight
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('should transfer the correct amounts when right order is completely filled and left order is partially filled', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Match signedOrderLeft with signedOrderRight
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 16), // 10%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 16), // 10%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- // Match signedOrderLeft with signedOrderRight
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('should transfer the correct amounts when consecutive calls are used to completely fill the left order', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Match orders
- let newERC20BalancesByOwner: ERC20BalancesByOwner;
- let newERC721TokenIdsByOwner: ERC721TokenIdsByOwner;
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 16), // 10%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 16), // 10%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- // prettier-ignore
- [
- newERC20BalancesByOwner,
- // tslint:disable-next-line:trailing-comma
- newERC721TokenIdsByOwner
- ] = await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- // Construct second right order
- // Note: This order needs makerAssetAmount=90/takerAssetAmount=[anything <= 45] to fully fill the right order.
- // However, we use 100/50 to ensure a partial fill as we want to go down the "left fill"
- // branch in the contract twice for this test.
- const signedOrderRight2 = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
- });
- // Match signedOrderLeft with signedOrderRight2
- const leftTakerAssetFilledAmount = signedOrderRight.makerAssetAmount;
- const rightTakerAssetFilledAmount = new BigNumber(0);
- const expectedTransferAmounts2 = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(45), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 16), // 90% (10% paid earlier)
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(45), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 16), // 90%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 16), // 90% (10% paid earlier)
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(90), 16), // 90%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight2,
- takerAddress,
- newERC20BalancesByOwner,
- newERC721TokenIdsByOwner,
- expectedTransferAmounts2,
- leftTakerAssetFilledAmount,
- rightTakerAssetFilledAmount,
- );
- });
-
- it('should transfer the correct amounts when consecutive calls are used to completely fill the right order', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
-
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- });
- // Match orders
- let newERC20BalancesByOwner: ERC20BalancesByOwner;
- let newERC721TokenIdsByOwner: ERC721TokenIdsByOwner;
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 16), // 4%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(6), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(4), 16), // 4%
- };
- // prettier-ignore
- [
- newERC20BalancesByOwner,
- // tslint:disable-next-line:trailing-comma
- newERC721TokenIdsByOwner
- ] = await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
-
- // Create second left order
- // Note: This order needs makerAssetAmount=96/takerAssetAmount=48 to fully fill the right order.
- // However, we use 100/50 to ensure a partial fill as we want to go down the "right fill"
- // branch in the contract twice for this test.
- const signedOrderLeft2 = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), 18),
- });
- // Match signedOrderLeft2 with signedOrderRight
- const leftTakerAssetFilledAmount = new BigNumber(0);
- const takerAmountReceived = newERC20BalancesByOwner[takerAddress][defaultERC20MakerAssetAddress].minus(
- erc20BalancesByOwner[takerAddress][defaultERC20MakerAssetAddress],
- );
- const rightTakerAssetFilledAmount = signedOrderLeft.makerAssetAmount.minus(takerAmountReceived);
- const expectedTransferAmounts2 = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(48), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 16), // 96%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(48), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 16), // 96%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 16), // 96%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(96), 16), // 96%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft2,
- signedOrderRight,
- takerAddress,
- newERC20BalancesByOwner,
- newERC721TokenIdsByOwner,
- expectedTransferAmounts2,
- leftTakerAssetFilledAmount,
- rightTakerAssetFilledAmount,
- );
- });
-
- it('should transfer the correct amounts if fee recipient is the same across both matched orders', async () => {
- const feeRecipientAddress = feeRecipientAddressLeft;
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feeRecipientAddress,
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feeRecipientAddress,
- });
- // Match orders
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('should transfer the correct amounts if taker is also the left order maker', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Match orders
- takerAddress = signedOrderLeft.makerAddress;
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('should transfer the correct amounts if taker is also the right order maker', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Match orders
- takerAddress = signedOrderRight.makerAddress;
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('should transfer the correct amounts if taker is also the left fee recipient', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Match orders
- takerAddress = feeRecipientAddressLeft;
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('should transfer the correct amounts if taker is also the right fee recipient', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Match orders
- takerAddress = feeRecipientAddressRight;
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('should transfer the correct amounts if left maker is the left fee recipient and right maker is the right fee recipient', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Match orders
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('Should throw if left order is not fillable', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Cancel left order
- await exchangeWrapper.cancelOrderAsync(signedOrderLeft, signedOrderLeft.makerAddress);
- // Match orders
- return expectTransactionFailedAsync(
- exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
- RevertReason.OrderUnfillable,
- );
- });
-
- it('Should throw if right order is not fillable', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Cancel right order
- await exchangeWrapper.cancelOrderAsync(signedOrderRight, signedOrderRight.makerAddress);
- // Match orders
- return expectTransactionFailedAsync(
- exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
- RevertReason.OrderUnfillable,
- );
- });
-
- it('should throw if there is not a positive spread', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
- });
- // Match orders
- return expectTransactionFailedAsync(
- exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
- RevertReason.NegativeSpreadRequired,
- );
- });
-
- it('should throw if the left maker asset is not equal to the right taker asset ', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20TakerAssetAddress),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Match orders
- return expectTransactionFailedAsync(
- exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
- // We are assuming assetData fields of the right order are the
- // reverse of the left order, rather than checking equality. This
- // saves a bunch of gas, but as a result if the assetData fields are
- // off then the failure ends up happening at signature validation
- RevertReason.InvalidOrderSignature,
- );
- });
-
- it('should throw if the right maker asset is not equal to the left taker asset', async () => {
- // Create orders to match
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultERC20MakerAssetAddress),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(5), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- });
- // Match orders
- return expectTransactionFailedAsync(
- exchangeWrapper.matchOrdersAsync(signedOrderLeft, signedOrderRight, takerAddress),
- RevertReason.InvalidOrderSignature,
- );
- });
-
- it('should transfer correct amounts when left order maker asset is an ERC721 token', async () => {
- // Create orders to match
- const erc721TokenToTransfer = erc721LeftMakerAssetIds[0];
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
- makerAssetAmount: new BigNumber(1),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- takerAssetData: assetDataUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: new BigNumber(1),
- });
- // Match orders
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 50%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
-
- it('should transfer correct amounts when right order maker asset is an ERC721 token', async () => {
- // Create orders to match
- const erc721TokenToTransfer = erc721RightMakerAssetIds[0];
- const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({
- takerAssetData: assetDataUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- takerAssetAmount: new BigNumber(1),
- });
- const signedOrderRight = await orderFactoryRight.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC721AssetData(defaultERC721AssetAddress, erc721TokenToTransfer),
- makerAssetAmount: new BigNumber(1),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(8), 18),
- });
- // Match orders
- const expectedTransferAmounts = {
- // Left Maker
- amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 18),
- amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
- feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Right Maker
- amountSoldByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 0),
- amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(8), 18),
- feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- // Taker
- amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 18),
- feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100%
- };
- await matchOrderTester.matchOrdersAndAssertEffectsAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- });
- });
-}); // tslint:disable-line:max-file-line-count
diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts
deleted file mode 100644
index 756c72766..000000000
--- a/packages/contracts/test/exchange/signature_validator.ts
+++ /dev/null
@@ -1,522 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { assetDataUtils, orderHashUtils, signatureUtils } from '@0x/order-utils';
-import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
-import * as chai from 'chai';
-import { LogWithDecodedArgs } from 'ethereum-types';
-import ethUtil = require('ethereumjs-util');
-
-import {
- TestSignatureValidatorContract,
- TestSignatureValidatorSignatureValidatorApprovalEventArgs,
-} 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 { expectContractCallFailedAsync } from '../utils/assertions';
-import { chaiSetup } from '../utils/chai_setup';
-import { constants } from '../utils/constants';
-import { LogDecoder } from '../utils/log_decoder';
-import { OrderFactory } from '../utils/order_factory';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-// tslint:disable:no-unnecessary-type-assertion
-describe('MixinSignatureValidator', () => {
- let signedOrder: SignedOrder;
- let orderFactory: OrderFactory;
- let signatureValidator: TestSignatureValidatorContract;
- let testWallet: WalletContract;
- let testValidator: ValidatorContract;
- let maliciousWallet: TestStaticCallReceiverContract;
- let maliciousValidator: TestStaticCallReceiverContract;
- let signerAddress: string;
- let signerPrivateKey: Buffer;
- let notSignerAddress: string;
- let notSignerPrivateKey: Buffer;
- let signatureValidatorLogDecoder: LogDecoder;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- const makerAddress = accounts[0];
- signerAddress = makerAddress;
- notSignerAddress = accounts[1];
- signatureValidator = await TestSignatureValidatorContract.deployFrom0xArtifactAsync(
- artifacts.TestSignatureValidator,
- provider,
- txDefaults,
- );
- testWallet = await WalletContract.deployFrom0xArtifactAsync(
- artifacts.Wallet,
- provider,
- txDefaults,
- signerAddress,
- );
- testValidator = await ValidatorContract.deployFrom0xArtifactAsync(
- artifacts.Validator,
- provider,
- txDefaults,
- signerAddress,
- );
- maliciousWallet = maliciousValidator = await TestStaticCallReceiverContract.deployFrom0xArtifactAsync(
- artifacts.TestStaticCallReceiver,
- provider,
- txDefaults,
- );
- signatureValidatorLogDecoder = new LogDecoder(web3Wrapper);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(testValidator.address, true, {
- from: signerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(
- maliciousValidator.address,
- true,
- {
- from: signerAddress,
- },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const defaultOrderParams = {
- ...constants.STATIC_ORDER_PARAMS,
- exchangeAddress: signatureValidator.address,
- makerAddress,
- feeRecipientAddress: addressUtils.generatePseudoRandomAddress(),
- makerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
- takerAssetData: assetDataUtils.encodeERC20AssetData(addressUtils.generatePseudoRandomAddress()),
- };
- signerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
- notSignerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(notSignerAddress)];
- orderFactory = new OrderFactory(signerPrivateKey, defaultOrderParams);
- });
-
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
-
- describe('isValidSignature', () => {
- beforeEach(async () => {
- signedOrder = await orderFactory.newSignedOrderAsync();
- });
-
- it('should revert when signature is empty', async () => {
- const emptySignature = '0x';
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- return expectContractCallFailedAsync(
- signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signedOrder.makerAddress,
- emptySignature,
- ),
- RevertReason.LengthGreaterThan0Required,
- );
- });
-
- it('should revert when signature type is unsupported', async () => {
- const unsupportedSignatureType = SignatureType.NSignatureTypes;
- const unsupportedSignatureHex = '0x' + Buffer.from([unsupportedSignatureType]).toString('hex');
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- return expectContractCallFailedAsync(
- signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signedOrder.makerAddress,
- unsupportedSignatureHex,
- ),
- RevertReason.SignatureUnsupported,
- );
- });
-
- it('should revert when SignatureType=Illegal', async () => {
- const unsupportedSignatureHex = '0x' + Buffer.from([SignatureType.Illegal]).toString('hex');
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- return expectContractCallFailedAsync(
- signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signedOrder.makerAddress,
- unsupportedSignatureHex,
- ),
- RevertReason.SignatureIllegal,
- );
- });
-
- it('should return false when SignatureType=Invalid and signature has a length of zero', async () => {
- const signatureHex = '0x' + Buffer.from([SignatureType.Invalid]).toString('hex');
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signedOrder.makerAddress,
- signatureHex,
- );
- expect(isValidSignature).to.be.false();
- });
-
- it('should revert when SignatureType=Invalid and signature length is non-zero', async () => {
- const fillerData = ethUtil.toBuffer('0xdeadbeef');
- const signatureType = ethUtil.toBuffer(`0x${SignatureType.Invalid}`);
- const signatureBuffer = Buffer.concat([fillerData, signatureType]);
- const signatureHex = ethUtil.bufferToHex(signatureBuffer);
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- return expectContractCallFailedAsync(
- signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signedOrder.makerAddress,
- signatureHex,
- ),
- RevertReason.Length0Required,
- );
- });
-
- it('should return true when SignatureType=EIP712 and signature is valid', async () => {
- // Create EIP712 signature
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
- const ecSignature = ethUtil.ecsign(orderHashBuffer, signerPrivateKey);
- // Create 0x signature from EIP712 signature
- const signature = Buffer.concat([
- ethUtil.toBuffer(ecSignature.v),
- ecSignature.r,
- ecSignature.s,
- ethUtil.toBuffer(`0x${SignatureType.EIP712}`),
- ]);
- const signatureHex = ethUtil.bufferToHex(signature);
- // Validate signature
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signerAddress,
- signatureHex,
- );
- expect(isValidSignature).to.be.true();
- });
-
- it('should return false when SignatureType=EIP712 and signature is invalid', async () => {
- // Create EIP712 signature
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
- const ecSignature = ethUtil.ecsign(orderHashBuffer, signerPrivateKey);
- // Create 0x signature from EIP712 signature
- const signature = Buffer.concat([
- ethUtil.toBuffer(ecSignature.v),
- ecSignature.r,
- ecSignature.s,
- ethUtil.toBuffer(`0x${SignatureType.EIP712}`),
- ]);
- const signatureHex = ethUtil.bufferToHex(signature);
- // Validate signature.
- // This will fail because `signerAddress` signed the message, but we're passing in `notSignerAddress`
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- notSignerAddress,
- signatureHex,
- );
- expect(isValidSignature).to.be.false();
- });
-
- it('should return true when SignatureType=EthSign and signature is valid', async () => {
- // Create EthSign signature
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const orderHashWithEthSignPrefixHex = signatureUtils.addSignedMessagePrefix(orderHashHex);
- const orderHashWithEthSignPrefixBuffer = ethUtil.toBuffer(orderHashWithEthSignPrefixHex);
- const ecSignature = ethUtil.ecsign(orderHashWithEthSignPrefixBuffer, signerPrivateKey);
- // Create 0x signature from EthSign signature
- const signature = Buffer.concat([
- ethUtil.toBuffer(ecSignature.v),
- ecSignature.r,
- ecSignature.s,
- ethUtil.toBuffer(`0x${SignatureType.EthSign}`),
- ]);
- const signatureHex = ethUtil.bufferToHex(signature);
- // Validate signature
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signerAddress,
- signatureHex,
- );
- expect(isValidSignature).to.be.true();
- });
-
- it('should return false when SignatureType=EthSign and signature is invalid', async () => {
- // Create EthSign signature
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const orderHashWithEthSignPrefixHex = signatureUtils.addSignedMessagePrefix(orderHashHex);
- const orderHashWithEthSignPrefixBuffer = ethUtil.toBuffer(orderHashWithEthSignPrefixHex);
- const ecSignature = ethUtil.ecsign(orderHashWithEthSignPrefixBuffer, signerPrivateKey);
- // Create 0x signature from EthSign signature
- const signature = Buffer.concat([
- ethUtil.toBuffer(ecSignature.v),
- ecSignature.r,
- ecSignature.s,
- ethUtil.toBuffer(`0x${SignatureType.EthSign}`),
- ]);
- const signatureHex = ethUtil.bufferToHex(signature);
- // Validate signature.
- // This will fail because `signerAddress` signed the message, but we're passing in `notSignerAddress`
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- notSignerAddress,
- signatureHex,
- );
- expect(isValidSignature).to.be.false();
- });
-
- it('should return true when SignatureType=Wallet and signature is valid', async () => {
- // Create EIP712 signature
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
- const ecSignature = ethUtil.ecsign(orderHashBuffer, signerPrivateKey);
- // Create 0x signature from EIP712 signature
- const signature = Buffer.concat([
- ethUtil.toBuffer(ecSignature.v),
- ecSignature.r,
- ecSignature.s,
- ethUtil.toBuffer(`0x${SignatureType.Wallet}`),
- ]);
- const signatureHex = ethUtil.bufferToHex(signature);
- // Validate signature
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- testWallet.address,
- signatureHex,
- );
- expect(isValidSignature).to.be.true();
- });
-
- it('should return false when SignatureType=Wallet and signature is invalid', async () => {
- // Create EIP712 signature using a private key that does not belong to the wallet owner.
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
- const notWalletOwnerPrivateKey = notSignerPrivateKey;
- const ecSignature = ethUtil.ecsign(orderHashBuffer, notWalletOwnerPrivateKey);
- // Create 0x signature from EIP712 signature
- const signature = Buffer.concat([
- ethUtil.toBuffer(ecSignature.v),
- ecSignature.r,
- ecSignature.s,
- ethUtil.toBuffer(`0x${SignatureType.Wallet}`),
- ]);
- const signatureHex = ethUtil.bufferToHex(signature);
- // Validate signature
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- testWallet.address,
- signatureHex,
- );
- expect(isValidSignature).to.be.false();
- });
-
- it('should revert when `isValidSignature` attempts to update state and SignatureType=Wallet', async () => {
- // Create EIP712 signature
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const orderHashBuffer = ethUtil.toBuffer(orderHashHex);
- const ecSignature = ethUtil.ecsign(orderHashBuffer, signerPrivateKey);
- // Create 0x signature from EIP712 signature
- const signature = Buffer.concat([
- ethUtil.toBuffer(ecSignature.v),
- ecSignature.r,
- ecSignature.s,
- ethUtil.toBuffer(`0x${SignatureType.Wallet}`),
- ]);
- const signatureHex = ethUtil.bufferToHex(signature);
- await expectContractCallFailedAsync(
- signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- maliciousWallet.address,
- signatureHex,
- ),
- RevertReason.WalletError,
- );
- });
-
- it('should return true when SignatureType=Validator, signature is valid and validator is approved', async () => {
- const validatorAddress = ethUtil.toBuffer(`${testValidator.address}`);
- const signatureType = ethUtil.toBuffer(`0x${SignatureType.Validator}`);
- const signature = Buffer.concat([validatorAddress, signatureType]);
- const signatureHex = ethUtil.bufferToHex(signature);
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signerAddress,
- signatureHex,
- );
- expect(isValidSignature).to.be.true();
- });
-
- it('should return false when SignatureType=Validator, signature is invalid and validator is approved', async () => {
- const validatorAddress = ethUtil.toBuffer(`${testValidator.address}`);
- const signatureType = ethUtil.toBuffer(`0x${SignatureType.Validator}`);
- const signature = Buffer.concat([validatorAddress, signatureType]);
- const signatureHex = ethUtil.bufferToHex(signature);
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- // This will return false because we signed the message with `signerAddress`, but
- // are validating against `notSignerAddress`
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- notSignerAddress,
- signatureHex,
- );
- expect(isValidSignature).to.be.false();
- });
-
- it('should revert when `isValidSignature` attempts to update state and SignatureType=Validator', async () => {
- const validatorAddress = ethUtil.toBuffer(`${maliciousValidator.address}`);
- const signatureType = ethUtil.toBuffer(`0x${SignatureType.Validator}`);
- const signature = Buffer.concat([validatorAddress, signatureType]);
- const signatureHex = ethUtil.bufferToHex(signature);
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- await expectContractCallFailedAsync(
- signatureValidator.publicIsValidSignature.callAsync(orderHashHex, signerAddress, signatureHex),
- RevertReason.ValidatorError,
- );
- });
- it('should return false when SignatureType=Validator, signature is valid and validator is not approved', async () => {
- // Set approval of signature validator to false
- await web3Wrapper.awaitTransactionSuccessAsync(
- await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(
- testValidator.address,
- false,
- { from: signerAddress },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Validate signature
- const validatorAddress = ethUtil.toBuffer(`${testValidator.address}`);
- const signatureType = ethUtil.toBuffer(`0x${SignatureType.Validator}`);
- const signature = Buffer.concat([validatorAddress, signatureType]);
- const signatureHex = ethUtil.bufferToHex(signature);
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signerAddress,
- signatureHex,
- );
- expect(isValidSignature).to.be.false();
- });
-
- it('should return true when SignatureType=Presigned and signer has presigned hash', async () => {
- // Presign hash
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await signatureValidator.preSign.sendTransactionAsync(
- orderHashHex,
- signedOrder.makerAddress,
- signedOrder.signature,
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- // Validate presigned signature
- const signature = ethUtil.toBuffer(`0x${SignatureType.PreSigned}`);
- const signatureHex = ethUtil.bufferToHex(signature);
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signedOrder.makerAddress,
- signatureHex,
- );
- expect(isValidSignature).to.be.true();
- });
-
- it('should return false when SignatureType=Presigned and signer has not presigned hash', async () => {
- const signature = ethUtil.toBuffer(`0x${SignatureType.PreSigned}`);
- const signatureHex = ethUtil.bufferToHex(signature);
- const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder);
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- orderHashHex,
- signedOrder.makerAddress,
- signatureHex,
- );
- expect(isValidSignature).to.be.false();
- });
-
- it('should return true when message was signed by a Trezor One (firmware version 1.6.2)', async () => {
- // messageHash translates to 0x2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
- const messageHash = ethUtil.bufferToHex(ethUtil.toBuffer('++++++++++++++++++++++++++++++++'));
- const signer = '0xc28b145f10f0bcf0fc000e778615f8fd73490bad';
- const v = ethUtil.toBuffer('0x1c');
- const r = ethUtil.toBuffer('0x7b888b596ccf87f0bacab0dcb483124973f7420f169b4824d7a12534ac1e9832');
- const s = ethUtil.toBuffer('0x0c8e14f7edc01459e13965f1da56e0c23ed11e2cca932571eee1292178f90424');
- const trezorSignatureType = ethUtil.toBuffer(`0x${SignatureType.EthSign}`);
- const signature = Buffer.concat([v, r, s, trezorSignatureType]);
- const signatureHex = ethUtil.bufferToHex(signature);
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- messageHash,
- signer,
- signatureHex,
- );
- expect(isValidSignature).to.be.true();
- });
-
- it('should return true when message was signed by a Trezor Model T (firmware version 2.0.7)', async () => {
- // messageHash translates to 0x2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
- const messageHash = ethUtil.bufferToHex(ethUtil.toBuffer('++++++++++++++++++++++++++++++++'));
- const signer = '0x98ce6d9345e8ffa7d99ee0822272fae9d2c0e895';
- const v = ethUtil.toBuffer('0x1c');
- const r = ethUtil.toBuffer('0x423b71062c327f0ec4fe199b8da0f34185e59b4c1cb4cc23df86cac4a601fb3f');
- const s = ethUtil.toBuffer('0x53810d6591b5348b7ee08ee812c874b0fdfb942c9849d59512c90e295221091f');
- const trezorSignatureType = ethUtil.toBuffer(`0x${SignatureType.EthSign}`);
- const signature = Buffer.concat([v, r, s, trezorSignatureType]);
- const signatureHex = ethUtil.bufferToHex(signature);
- const isValidSignature = await signatureValidator.publicIsValidSignature.callAsync(
- messageHash,
- signer,
- signatureHex,
- );
- expect(isValidSignature).to.be.true();
- });
- });
-
- describe('setSignatureValidatorApproval', () => {
- it('should emit a SignatureValidatorApprovalSet with correct args when a validator is approved', async () => {
- const approval = true;
- const res = await signatureValidatorLogDecoder.getTxWithDecodedLogsAsync(
- await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(
- testValidator.address,
- approval,
- {
- from: signerAddress,
- },
- ),
- );
- expect(res.logs.length).to.equal(1);
- const log = res.logs[0] as LogWithDecodedArgs<TestSignatureValidatorSignatureValidatorApprovalEventArgs>;
- const logArgs = log.args;
- expect(logArgs.signerAddress).to.equal(signerAddress);
- expect(logArgs.validatorAddress).to.equal(testValidator.address);
- expect(logArgs.approved).to.equal(approval);
- });
- it('should emit a SignatureValidatorApprovalSet with correct args when a validator is disapproved', async () => {
- const approval = false;
- const res = await signatureValidatorLogDecoder.getTxWithDecodedLogsAsync(
- await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(
- testValidator.address,
- approval,
- {
- from: signerAddress,
- },
- ),
- );
- expect(res.logs.length).to.equal(1);
- const log = res.logs[0] as LogWithDecodedArgs<TestSignatureValidatorSignatureValidatorApprovalEventArgs>;
- const logArgs = log.args;
- expect(logArgs.signerAddress).to.equal(signerAddress);
- expect(logArgs.validatorAddress).to.equal(testValidator.address);
- expect(logArgs.approved).to.equal(approval);
- });
- });
-});
-// tslint:disable:max-file-line-count
-// tslint:enable:no-unnecessary-type-assertion
diff --git a/packages/contracts/test/exchange/transactions.ts b/packages/contracts/test/exchange/transactions.ts
deleted file mode 100644
index 1b5eef295..000000000
--- a/packages/contracts/test/exchange/transactions.ts
+++ /dev/null
@@ -1,462 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
-import { OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-import * as _ from 'lodash';
-
-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';
-import { ERC20Wrapper } from '../utils/erc20_wrapper';
-import { ExchangeWrapper } from '../utils/exchange_wrapper';
-import { OrderFactory } from '../utils/order_factory';
-import { orderUtils } from '../utils/order_utils';
-import { TransactionFactory } from '../utils/transaction_factory';
-import { ERC20BalancesByOwner, SignedTransaction } from '../utils/types';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-describe('Exchange transactions', () => {
- let senderAddress: string;
- let owner: string;
- let makerAddress: string;
- let takerAddress: string;
- let feeRecipientAddress: string;
-
- let erc20TokenA: DummyERC20TokenContract;
- let erc20TokenB: DummyERC20TokenContract;
- let zrxToken: DummyERC20TokenContract;
- let exchange: ExchangeContract;
- let erc20Proxy: ERC20ProxyContract;
-
- let erc20Balances: ERC20BalancesByOwner;
- let signedOrder: SignedOrder;
- let signedTx: SignedTransaction;
- let orderWithoutExchangeAddress: OrderWithoutExchangeAddress;
- let orderFactory: OrderFactory;
- let makerTransactionFactory: TransactionFactory;
- let takerTransactionFactory: TransactionFactory;
- let exchangeWrapper: ExchangeWrapper;
- let erc20Wrapper: ERC20Wrapper;
-
- let defaultMakerTokenAddress: string;
- let defaultTakerTokenAddress: string;
- let makerPrivateKey: Buffer;
- let takerPrivateKey: Buffer;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- const usedAddresses = ([owner, senderAddress, makerAddress, takerAddress, feeRecipientAddress] = _.slice(
- accounts,
- 0,
- 5,
- ));
-
- erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
-
- const numDummyErc20ToDeploy = 3;
- [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
- numDummyErc20ToDeploy,
- constants.DUMMY_TOKEN_DECIMALS,
- );
- erc20Proxy = await erc20Wrapper.deployProxyAsync();
- await erc20Wrapper.setBalancesAndAllowancesAsync();
-
- exchange = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
- provider,
- txDefaults,
- assetDataUtils.encodeERC20AssetData(zrxToken.address),
- );
- exchangeWrapper = new ExchangeWrapper(exchange, provider);
- await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
-
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- defaultMakerTokenAddress = erc20TokenA.address;
- defaultTakerTokenAddress = erc20TokenB.address;
-
- const defaultOrderParams = {
- ...constants.STATIC_ORDER_PARAMS,
- senderAddress,
- exchangeAddress: exchange.address,
- makerAddress,
- feeRecipientAddress,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerTokenAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerTokenAddress),
- };
- makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
- takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
- orderFactory = new OrderFactory(makerPrivateKey, defaultOrderParams);
- makerTransactionFactory = new TransactionFactory(makerPrivateKey, exchange.address);
- takerTransactionFactory = new TransactionFactory(takerPrivateKey, exchange.address);
- });
- describe('executeTransaction', () => {
- describe('fillOrder', () => {
- let takerAssetFillAmount: BigNumber;
- beforeEach(async () => {
- erc20Balances = await erc20Wrapper.getBalancesAsync();
- signedOrder = await orderFactory.newSignedOrderAsync();
- orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
-
- takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- const data = exchange.fillOrder.getABIEncodedTransactionData(
- orderWithoutExchangeAddress,
- takerAssetFillAmount,
- signedOrder.signature,
- );
- signedTx = takerTransactionFactory.newSignedTransaction(data);
- });
-
- it('should throw if not called by specified sender', async () => {
- return expectTransactionFailedAsync(
- exchangeWrapper.executeTransactionAsync(signedTx, takerAddress),
- RevertReason.FailedExecution,
- );
- });
-
- it('should transfer the correct amounts when signed by taker and called by sender', async () => {
- await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- const makerAssetFillAmount = takerAssetFillAmount
- .times(signedOrder.makerAssetAmount)
- .dividedToIntegerBy(signedOrder.takerAssetAmount);
- const makerFeePaid = signedOrder.makerFee
- .times(makerAssetFillAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- const takerFeePaid = signedOrder.takerFee
- .times(makerAssetFillAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
- );
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid),
- );
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid),
- );
- expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
- );
- });
-
- it('should throw if the a 0x transaction with the same transactionHash has already been executed', async () => {
- await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
- return expectTransactionFailedAsync(
- exchangeWrapper.executeTransactionAsync(signedTx, senderAddress),
- RevertReason.InvalidTxHash,
- );
- });
-
- it('should reset the currentContextAddress', async () => {
- await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
- const currentContextAddress = await exchange.currentContextAddress.callAsync();
- expect(currentContextAddress).to.equal(constants.NULL_ADDRESS);
- });
- });
-
- describe('cancelOrder', () => {
- beforeEach(async () => {
- const data = exchange.cancelOrder.getABIEncodedTransactionData(orderWithoutExchangeAddress);
- signedTx = makerTransactionFactory.newSignedTransaction(data);
- });
-
- it('should throw if not called by specified sender', async () => {
- return expectTransactionFailedAsync(
- exchangeWrapper.executeTransactionAsync(signedTx, makerAddress),
- RevertReason.FailedExecution,
- );
- });
-
- it('should cancel the order when signed by maker and called by sender', async () => {
- await exchangeWrapper.executeTransactionAsync(signedTx, senderAddress);
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrderAsync(signedOrder, senderAddress),
- RevertReason.OrderUnfillable,
- );
- });
- });
-
- describe('cancelOrdersUpTo', () => {
- let exchangeWrapperContract: ExchangeWrapperContract;
-
- before(async () => {
- exchangeWrapperContract = await ExchangeWrapperContract.deployFrom0xArtifactAsync(
- artifacts.ExchangeWrapper,
- provider,
- txDefaults,
- exchange.address,
- );
- });
-
- it("should cancel an order if called from the order's sender", async () => {
- const orderSalt = new BigNumber(0);
- signedOrder = await orderFactory.newSignedOrderAsync({
- senderAddress: exchangeWrapperContract.address,
- salt: orderSalt,
- });
- const targetOrderEpoch = orderSalt.add(1);
- const cancelData = exchange.cancelOrdersUpTo.getABIEncodedTransactionData(targetOrderEpoch);
- const signedCancelTx = makerTransactionFactory.newSignedTransaction(cancelData);
- await exchangeWrapperContract.cancelOrdersUpTo.sendTransactionAsync(
- targetOrderEpoch,
- signedCancelTx.salt,
- signedCancelTx.signature,
- {
- from: makerAddress,
- },
- );
-
- const takerAssetFillAmount = signedOrder.takerAssetAmount;
- orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
- const fillData = exchange.fillOrder.getABIEncodedTransactionData(
- orderWithoutExchangeAddress,
- takerAssetFillAmount,
- signedOrder.signature,
- );
- const signedFillTx = takerTransactionFactory.newSignedTransaction(fillData);
- return expectTransactionFailedAsync(
- exchangeWrapperContract.fillOrder.sendTransactionAsync(
- orderWithoutExchangeAddress,
- takerAssetFillAmount,
- signedFillTx.salt,
- signedOrder.signature,
- signedFillTx.signature,
- { from: takerAddress },
- ),
- RevertReason.FailedExecution,
- );
- });
-
- it("should not cancel an order if not called from the order's sender", async () => {
- const orderSalt = new BigNumber(0);
- signedOrder = await orderFactory.newSignedOrderAsync({
- senderAddress: exchangeWrapperContract.address,
- salt: orderSalt,
- });
- const targetOrderEpoch = orderSalt.add(1);
- await exchangeWrapper.cancelOrdersUpToAsync(targetOrderEpoch, makerAddress);
-
- erc20Balances = await erc20Wrapper.getBalancesAsync();
- const takerAssetFillAmount = signedOrder.takerAssetAmount;
- orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
- const data = exchange.fillOrder.getABIEncodedTransactionData(
- orderWithoutExchangeAddress,
- takerAssetFillAmount,
- signedOrder.signature,
- );
- signedTx = takerTransactionFactory.newSignedTransaction(data);
- await exchangeWrapperContract.fillOrder.sendTransactionAsync(
- orderWithoutExchangeAddress,
- takerAssetFillAmount,
- signedTx.salt,
- signedOrder.signature,
- signedTx.signature,
- { from: takerAddress },
- );
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- const makerAssetFillAmount = takerAssetFillAmount
- .times(signedOrder.makerAssetAmount)
- .dividedToIntegerBy(signedOrder.takerAssetAmount);
- const makerFeePaid = signedOrder.makerFee
- .times(makerAssetFillAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- const takerFeePaid = signedOrder.takerFee
- .times(makerAssetFillAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
- );
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid),
- );
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid),
- );
- expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
- );
- });
- });
- });
-
- describe('Whitelist', () => {
- let whitelist: WhitelistContract;
- let whitelistOrderFactory: OrderFactory;
-
- before(async () => {
- whitelist = await WhitelistContract.deployFrom0xArtifactAsync(
- artifacts.Whitelist,
- provider,
- txDefaults,
- exchange.address,
- );
- const isApproved = true;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await exchange.setSignatureValidatorApproval.sendTransactionAsync(whitelist.address, isApproved, {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const defaultOrderParams = {
- ...constants.STATIC_ORDER_PARAMS,
- senderAddress: whitelist.address,
- exchangeAddress: exchange.address,
- makerAddress,
- feeRecipientAddress,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerTokenAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerTokenAddress),
- };
- whitelistOrderFactory = new OrderFactory(makerPrivateKey, defaultOrderParams);
- });
-
- beforeEach(async () => {
- signedOrder = await whitelistOrderFactory.newSignedOrderAsync();
- erc20Balances = await erc20Wrapper.getBalancesAsync();
- });
-
- it('should revert if maker has not been whitelisted', async () => {
- const isApproved = true;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await whitelist.updateWhitelistStatus.sendTransactionAsync(takerAddress, isApproved, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
- const takerAssetFillAmount = signedOrder.takerAssetAmount;
- const salt = generatePseudoRandomSalt();
- return expectTransactionFailedAsync(
- whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
- orderWithoutExchangeAddress,
- takerAssetFillAmount,
- salt,
- signedOrder.signature,
- { from: takerAddress },
- ),
- RevertReason.MakerNotWhitelisted,
- );
- });
-
- it('should revert if taker has not been whitelisted', async () => {
- const isApproved = true;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await whitelist.updateWhitelistStatus.sendTransactionAsync(makerAddress, isApproved, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
- const takerAssetFillAmount = signedOrder.takerAssetAmount;
- const salt = generatePseudoRandomSalt();
- return expectTransactionFailedAsync(
- whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
- orderWithoutExchangeAddress,
- takerAssetFillAmount,
- salt,
- signedOrder.signature,
- { from: takerAddress },
- ),
- RevertReason.TakerNotWhitelisted,
- );
- });
-
- it('should fill the order if maker and taker have been whitelisted', async () => {
- const isApproved = true;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await whitelist.updateWhitelistStatus.sendTransactionAsync(makerAddress, isApproved, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- await web3Wrapper.awaitTransactionSuccessAsync(
- await whitelist.updateWhitelistStatus.sendTransactionAsync(takerAddress, isApproved, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- orderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(signedOrder);
- const takerAssetFillAmount = signedOrder.takerAssetAmount;
- const salt = generatePseudoRandomSalt();
- await web3Wrapper.awaitTransactionSuccessAsync(
- await whitelist.fillOrderIfWhitelisted.sendTransactionAsync(
- orderWithoutExchangeAddress,
- takerAssetFillAmount,
- salt,
- signedOrder.signature,
- { from: takerAddress },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const makerAssetFillAmount = signedOrder.makerAssetAmount;
- const makerFeePaid = signedOrder.makerFee;
- const takerFeePaid = signedOrder.takerFee;
-
- expect(newBalances[makerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerTokenAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerTokenAddress].add(takerAssetFillAmount),
- );
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerFeePaid),
- );
- expect(newBalances[takerAddress][defaultTakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultTakerTokenAddress].minus(takerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerTokenAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerTokenAddress].add(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].minus(takerFeePaid),
- );
- expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFeePaid.add(takerFeePaid)),
- );
- });
- });
-});
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts
deleted file mode 100644
index 6b660aac5..000000000
--- a/packages/contracts/test/exchange/wrapper.ts
+++ /dev/null
@@ -1,1452 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
-import { RevertReason, SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as chai from 'chai';
-import * as _ from 'lodash';
-
-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';
-import { constants } from '../utils/constants';
-import { ERC20Wrapper } from '../utils/erc20_wrapper';
-import { ERC721Wrapper } from '../utils/erc721_wrapper';
-import { ExchangeWrapper } from '../utils/exchange_wrapper';
-import { OrderFactory } from '../utils/order_factory';
-import { ERC20BalancesByOwner, OrderStatus } from '../utils/types';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-describe('Exchange wrappers', () => {
- let makerAddress: string;
- let owner: string;
- let takerAddress: string;
- let feeRecipientAddress: string;
-
- let erc20TokenA: DummyERC20TokenContract;
- let erc20TokenB: DummyERC20TokenContract;
- let zrxToken: DummyERC20TokenContract;
- let erc721Token: DummyERC721TokenContract;
- let exchange: ExchangeContract;
- let erc20Proxy: ERC20ProxyContract;
- let erc721Proxy: ERC721ProxyContract;
- let reentrantErc20Token: ReentrantERC20TokenContract;
-
- let exchangeWrapper: ExchangeWrapper;
- let erc20Wrapper: ERC20Wrapper;
- let erc721Wrapper: ERC721Wrapper;
- let erc20Balances: ERC20BalancesByOwner;
- let orderFactory: OrderFactory;
-
- let erc721MakerAssetId: BigNumber;
- let erc721TakerAssetId: BigNumber;
-
- let defaultMakerAssetAddress: string;
- let defaultTakerAssetAddress: string;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = _.slice(accounts, 0, 4));
-
- erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
- erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
-
- const numDummyErc20ToDeploy = 3;
- [erc20TokenA, erc20TokenB, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
- numDummyErc20ToDeploy,
- constants.DUMMY_TOKEN_DECIMALS,
- );
- erc20Proxy = await erc20Wrapper.deployProxyAsync();
- await erc20Wrapper.setBalancesAndAllowancesAsync();
-
- [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
- erc721Proxy = await erc721Wrapper.deployProxyAsync();
- await erc721Wrapper.setBalancesAndAllowancesAsync();
- const erc721Balances = await erc721Wrapper.getBalancesAsync();
- erc721MakerAssetId = erc721Balances[makerAddress][erc721Token.address][0];
- erc721TakerAssetId = erc721Balances[takerAddress][erc721Token.address][0];
-
- exchange = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
- provider,
- txDefaults,
- assetDataUtils.encodeERC20AssetData(zrxToken.address),
- );
- exchangeWrapper = new ExchangeWrapper(exchange, provider);
- await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
- await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
-
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
- from: owner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- reentrantErc20Token = await ReentrantERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.ReentrantERC20Token,
- provider,
- txDefaults,
- exchange.address,
- );
-
- defaultMakerAssetAddress = erc20TokenA.address;
- defaultTakerAssetAddress = erc20TokenB.address;
-
- const defaultOrderParams = {
- ...constants.STATIC_ORDER_PARAMS,
- exchangeAddress: exchange.address,
- makerAddress,
- feeRecipientAddress,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
- };
- const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
- orderFactory = new OrderFactory(privateKey, defaultOrderParams);
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- erc20Balances = await erc20Wrapper.getBalancesAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- describe('fillOrKillOrder', () => {
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow fillOrKillOrder to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await expectTransactionFailedAsync(
- exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
- RevertReason.TransferFailed,
- );
- });
- });
- };
- describe('fillOrKillOrder reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should transfer the correct amounts', async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
- });
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- await exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress, {
- takerAssetFillAmount,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const makerAssetFilledAmount = takerAssetFillAmount
- .times(signedOrder.makerAssetAmount)
- .dividedToIntegerBy(signedOrder.takerAssetAmount);
- const makerFee = signedOrder.makerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- const takerFee = signedOrder.takerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
- );
- expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
- );
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
- );
- expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
- );
- expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
- );
- });
-
- it('should throw if a signedOrder is expired', async () => {
- const currentTimestamp = await getLatestBlockTimestampAsync();
- const signedOrder = await orderFactory.newSignedOrderAsync({
- expirationTimeSeconds: new BigNumber(currentTimestamp).sub(10),
- });
-
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
- RevertReason.OrderUnfillable,
- );
- });
-
- it('should throw if entire takerAssetFillAmount not filled', async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync();
-
- await exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, {
- takerAssetFillAmount: signedOrder.takerAssetAmount.div(2),
- });
-
- return expectTransactionFailedAsync(
- exchangeWrapper.fillOrKillOrderAsync(signedOrder, takerAddress),
- RevertReason.CompleteFillFailed,
- );
- });
- });
-
- describe('fillOrderNoThrow', () => {
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow fillOrderNoThrow to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(erc20Balances).to.deep.equal(newBalances);
- });
- });
- };
- describe('fillOrderNoThrow reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should transfer the correct amounts', async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
- });
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
-
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, {
- takerAssetFillAmount,
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 250000,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- const makerAssetFilledAmount = takerAssetFillAmount
- .times(signedOrder.makerAssetAmount)
- .dividedToIntegerBy(signedOrder.takerAssetAmount);
- const makerFee = signedOrder.makerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- const takerFee = signedOrder.takerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
-
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
- );
- expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
- );
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
- );
- expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
- );
- expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
- );
- });
-
- it('should not change erc20Balances if maker erc20Balances are too low to fill order', async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
- });
-
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should not change erc20Balances if taker erc20Balances are too low to fill order', async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18),
- });
-
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should not change erc20Balances if maker allowances are too low to fill order', async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync();
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should not change erc20Balances if taker allowances are too low to fill order', async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync();
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should not change erc20Balances if makerAssetAddress is ZRX, makerAssetAmount + makerFee > maker balance', async () => {
- const makerZRXBalance = new BigNumber(erc20Balances[makerAddress][zrxToken.address]);
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: makerZRXBalance,
- makerFee: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- });
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should not change erc20Balances if makerAssetAddress is ZRX, makerAssetAmount + makerFee > maker allowance', async () => {
- const makerZRXAllowance = await zrxToken.allowance.callAsync(makerAddress, erc20Proxy.address);
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(makerZRXAllowance),
- makerFee: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- });
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should not change erc20Balances if takerAssetAddress is ZRX, takerAssetAmount + takerFee > taker balance', async () => {
- const takerZRXBalance = new BigNumber(erc20Balances[takerAddress][zrxToken.address]);
- const signedOrder = await orderFactory.newSignedOrderAsync({
- takerAssetAmount: takerZRXBalance,
- takerFee: new BigNumber(1),
- takerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- });
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should not change erc20Balances if takerAssetAddress is ZRX, takerAssetAmount + takerFee > taker allowance', async () => {
- const takerZRXAllowance = await zrxToken.allowance.callAsync(takerAddress, erc20Proxy.address);
- const signedOrder = await orderFactory.newSignedOrderAsync({
- takerAssetAmount: new BigNumber(takerZRXAllowance),
- takerFee: new BigNumber(1),
- takerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- });
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should successfully exchange ERC721 tokens', async () => {
- // Construct Exchange parameters
- const makerAssetId = erc721MakerAssetId;
- const takerAssetId = erc721TakerAssetId;
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1),
- takerAssetAmount: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
- });
- // Verify pre-conditions
- const initialOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(initialOwnerMakerAsset).to.be.bignumber.equal(makerAddress);
- const initialOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(initialOwnerTakerAsset).to.be.bignumber.equal(takerAddress);
- // Call Exchange
- const takerAssetFillAmount = signedOrder.takerAssetAmount;
- await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress, {
- takerAssetFillAmount,
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 280000,
- });
- // Verify post-conditions
- const newOwnerMakerAsset = await erc721Token.ownerOf.callAsync(makerAssetId);
- expect(newOwnerMakerAsset).to.be.bignumber.equal(takerAddress);
- const newOwnerTakerAsset = await erc721Token.ownerOf.callAsync(takerAssetId);
- expect(newOwnerTakerAsset).to.be.bignumber.equal(makerAddress);
- });
- });
-
- describe('batch functions', () => {
- let signedOrders: SignedOrder[];
- beforeEach(async () => {
- signedOrders = [
- await orderFactory.newSignedOrderAsync(),
- await orderFactory.newSignedOrderAsync(),
- await orderFactory.newSignedOrderAsync(),
- ];
- });
-
- describe('batchFillOrders', () => {
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow batchFillOrders to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await expectTransactionFailedAsync(
- exchangeWrapper.batchFillOrdersAsync([signedOrder], takerAddress),
- RevertReason.TransferFailed,
- );
- });
- });
- };
- describe('batchFillOrders reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should transfer the correct amounts', async () => {
- const takerAssetFillAmounts: BigNumber[] = [];
- const makerAssetAddress = erc20TokenA.address;
- const takerAssetAddress = erc20TokenB.address;
- _.forEach(signedOrders, signedOrder => {
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- const makerAssetFilledAmount = takerAssetFillAmount
- .times(signedOrder.makerAssetAmount)
- .dividedToIntegerBy(signedOrder.takerAssetAmount);
- const makerFee = signedOrder.makerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- const takerFee = signedOrder.takerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- takerAssetFillAmounts.push(takerAssetFillAmount);
- erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
- makerAssetAddress
- ].minus(makerAssetFilledAmount);
- erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
- takerAssetFillAmount,
- );
- erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
- makerFee,
- );
- erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
- makerAssetFilledAmount,
- );
- erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
- takerAssetAddress
- ].minus(takerAssetFillAmount);
- erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
- takerFee,
- );
- erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
- zrxToken.address
- ].add(makerFee.add(takerFee));
- });
-
- await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress, {
- takerAssetFillAmounts,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
- });
-
- describe('batchFillOrKillOrders', () => {
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow batchFillOrKillOrders to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await expectTransactionFailedAsync(
- exchangeWrapper.batchFillOrKillOrdersAsync([signedOrder], takerAddress),
- RevertReason.TransferFailed,
- );
- });
- });
- };
- describe('batchFillOrKillOrders reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should transfer the correct amounts', async () => {
- const takerAssetFillAmounts: BigNumber[] = [];
- const makerAssetAddress = erc20TokenA.address;
- const takerAssetAddress = erc20TokenB.address;
- _.forEach(signedOrders, signedOrder => {
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- const makerAssetFilledAmount = takerAssetFillAmount
- .times(signedOrder.makerAssetAmount)
- .dividedToIntegerBy(signedOrder.takerAssetAmount);
- const makerFee = signedOrder.makerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- const takerFee = signedOrder.takerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- takerAssetFillAmounts.push(takerAssetFillAmount);
- erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
- makerAssetAddress
- ].minus(makerAssetFilledAmount);
- erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
- takerAssetFillAmount,
- );
- erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
- makerFee,
- );
- erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
- makerAssetFilledAmount,
- );
- erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
- takerAssetAddress
- ].minus(takerAssetFillAmount);
- erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
- takerFee,
- );
- erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
- zrxToken.address
- ].add(makerFee.add(takerFee));
- });
-
- await exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
- takerAssetFillAmounts,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should throw if a single signedOrder does not fill the expected amount', async () => {
- const takerAssetFillAmounts: BigNumber[] = [];
- _.forEach(signedOrders, signedOrder => {
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- takerAssetFillAmounts.push(takerAssetFillAmount);
- });
-
- await exchangeWrapper.fillOrKillOrderAsync(signedOrders[0], takerAddress);
-
- return expectTransactionFailedAsync(
- exchangeWrapper.batchFillOrKillOrdersAsync(signedOrders, takerAddress, {
- takerAssetFillAmounts,
- }),
- RevertReason.OrderUnfillable,
- );
- });
- });
-
- describe('batchFillOrdersNoThrow', async () => {
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow batchFillOrdersNoThrow to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await exchangeWrapper.batchFillOrdersNoThrowAsync([signedOrder], takerAddress);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(erc20Balances).to.deep.equal(newBalances);
- });
- });
- };
- describe('batchFillOrdersNoThrow reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should transfer the correct amounts', async () => {
- const takerAssetFillAmounts: BigNumber[] = [];
- const makerAssetAddress = erc20TokenA.address;
- const takerAssetAddress = erc20TokenB.address;
- _.forEach(signedOrders, signedOrder => {
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- const makerAssetFilledAmount = takerAssetFillAmount
- .times(signedOrder.makerAssetAmount)
- .dividedToIntegerBy(signedOrder.takerAssetAmount);
- const makerFee = signedOrder.makerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- const takerFee = signedOrder.takerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- takerAssetFillAmounts.push(takerAssetFillAmount);
- erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
- makerAssetAddress
- ].minus(makerAssetFilledAmount);
- erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
- takerAssetFillAmount,
- );
- erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
- makerFee,
- );
- erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
- makerAssetFilledAmount,
- );
- erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
- takerAssetAddress
- ].minus(takerAssetFillAmount);
- erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
- takerFee,
- );
- erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
- zrxToken.address
- ].add(makerFee.add(takerFee));
- });
-
- await exchangeWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerAssetFillAmounts,
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 600000,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should not throw if an order is invalid and fill the remaining orders', async () => {
- const takerAssetFillAmounts: BigNumber[] = [];
- const makerAssetAddress = erc20TokenA.address;
- const takerAssetAddress = erc20TokenB.address;
-
- const invalidOrder = {
- ...signedOrders[0],
- signature: '0x00',
- };
- const validOrders = signedOrders.slice(1);
-
- takerAssetFillAmounts.push(invalidOrder.takerAssetAmount.div(2));
- _.forEach(validOrders, signedOrder => {
- const takerAssetFillAmount = signedOrder.takerAssetAmount.div(2);
- const makerAssetFilledAmount = takerAssetFillAmount
- .times(signedOrder.makerAssetAmount)
- .dividedToIntegerBy(signedOrder.takerAssetAmount);
- const makerFee = signedOrder.makerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- const takerFee = signedOrder.takerFee
- .times(makerAssetFilledAmount)
- .dividedToIntegerBy(signedOrder.makerAssetAmount);
- takerAssetFillAmounts.push(takerAssetFillAmount);
- erc20Balances[makerAddress][makerAssetAddress] = erc20Balances[makerAddress][
- makerAssetAddress
- ].minus(makerAssetFilledAmount);
- erc20Balances[makerAddress][takerAssetAddress] = erc20Balances[makerAddress][takerAssetAddress].add(
- takerAssetFillAmount,
- );
- erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
- makerFee,
- );
- erc20Balances[takerAddress][makerAssetAddress] = erc20Balances[takerAddress][makerAssetAddress].add(
- makerAssetFilledAmount,
- );
- erc20Balances[takerAddress][takerAssetAddress] = erc20Balances[takerAddress][
- takerAssetAddress
- ].minus(takerAssetFillAmount);
- erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
- takerFee,
- );
- erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
- zrxToken.address
- ].add(makerFee.add(takerFee));
- });
-
- const newOrders = [invalidOrder, ...validOrders];
- await exchangeWrapper.batchFillOrdersNoThrowAsync(newOrders, takerAddress, {
- takerAssetFillAmounts,
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 450000,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
- });
-
- describe('marketSellOrders', () => {
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow marketSellOrders to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await expectTransactionFailedAsync(
- exchangeWrapper.marketSellOrdersAsync([signedOrder], takerAddress, {
- takerAssetFillAmount: signedOrder.takerAssetAmount,
- }),
- RevertReason.TransferFailed,
- );
- });
- });
- };
- describe('marketSellOrders reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should stop when the entire takerAssetFillAmount is filled', async () => {
- const takerAssetFillAmount = signedOrders[0].takerAssetAmount.plus(
- signedOrders[1].takerAssetAmount.div(2),
- );
- await exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
- takerAssetFillAmount,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const makerAssetFilledAmount = signedOrders[0].makerAssetAmount.add(
- signedOrders[1].makerAssetAmount.dividedToIntegerBy(2),
- );
- const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
- const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
- );
- expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
- );
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
- );
- expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
- );
- expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
- );
- });
-
- it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
- const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
- _.forEach(signedOrders, signedOrder => {
- erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
- defaultMakerAssetAddress
- ].minus(signedOrder.makerAssetAmount);
- erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
- defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
- erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
- signedOrder.makerFee,
- );
- erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
- defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
- erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
- defaultTakerAssetAddress
- ].minus(signedOrder.takerAssetAmount);
- erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
- signedOrder.takerFee,
- );
- erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
- zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
- });
- await exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
- takerAssetFillAmount,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should throw when a signedOrder does not use the same takerAssetAddress', async () => {
- signedOrders = [
- await orderFactory.newSignedOrderAsync(),
- await orderFactory.newSignedOrderAsync({
- takerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- }),
- await orderFactory.newSignedOrderAsync(),
- ];
-
- return expectTransactionFailedAsync(
- exchangeWrapper.marketSellOrdersAsync(signedOrders, takerAddress, {
- takerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
- }),
- // We simply use the takerAssetData from the first order for all orders.
- // If they are not the same, the contract throws when validating the order signature
- RevertReason.InvalidOrderSignature,
- );
- });
- });
-
- describe('marketSellOrdersNoThrow', () => {
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow marketSellOrdersNoThrow to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await exchangeWrapper.marketSellOrdersNoThrowAsync([signedOrder], takerAddress, {
- takerAssetFillAmount: signedOrder.takerAssetAmount,
- });
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(erc20Balances).to.deep.equal(newBalances);
- });
- });
- };
- describe('marketSellOrdersNoThrow reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should stop when the entire takerAssetFillAmount is filled', async () => {
- const takerAssetFillAmount = signedOrders[0].takerAssetAmount.plus(
- signedOrders[1].takerAssetAmount.div(2),
- );
- await exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerAssetFillAmount,
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 6000000,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const makerAssetFilledAmount = signedOrders[0].makerAssetAmount.add(
- signedOrders[1].makerAssetAmount.dividedToIntegerBy(2),
- );
- const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
- const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFilledAmount),
- );
- expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(takerAssetFillAmount),
- );
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
- );
- expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultTakerAssetAddress].minus(takerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFilledAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
- );
- expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
- );
- });
-
- it('should fill all signedOrders if cannot fill entire takerAssetFillAmount', async () => {
- const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
- _.forEach(signedOrders, signedOrder => {
- erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
- defaultMakerAssetAddress
- ].minus(signedOrder.makerAssetAmount);
- erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
- defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
- erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
- signedOrder.makerFee,
- );
- erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
- defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
- erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
- defaultTakerAssetAddress
- ].minus(signedOrder.takerAssetAmount);
- erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
- signedOrder.takerFee,
- );
- erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
- zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
- });
- await exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerAssetFillAmount,
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 600000,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should not fill a signedOrder that does not use the same takerAssetAddress', async () => {
- signedOrders = [
- await orderFactory.newSignedOrderAsync(),
- await orderFactory.newSignedOrderAsync(),
- await orderFactory.newSignedOrderAsync({
- takerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- }),
- ];
- const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
- const filledSignedOrders = signedOrders.slice(0, -1);
- _.forEach(filledSignedOrders, signedOrder => {
- erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
- defaultMakerAssetAddress
- ].minus(signedOrder.makerAssetAmount);
- erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
- defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
- erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
- signedOrder.makerFee,
- );
- erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
- defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
- erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
- defaultTakerAssetAddress
- ].minus(signedOrder.takerAssetAmount);
- erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
- signedOrder.takerFee,
- );
- erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
- zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
- });
- await exchangeWrapper.marketSellOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerAssetFillAmount,
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 600000,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
- });
-
- describe('marketBuyOrders', () => {
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow marketBuyOrders to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await expectTransactionFailedAsync(
- exchangeWrapper.marketBuyOrdersAsync([signedOrder], takerAddress, {
- makerAssetFillAmount: signedOrder.makerAssetAmount,
- }),
- RevertReason.TransferFailed,
- );
- });
- });
- };
- describe('marketBuyOrders reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should stop when the entire makerAssetFillAmount is filled', async () => {
- const makerAssetFillAmount = signedOrders[0].makerAssetAmount.plus(
- signedOrders[1].makerAssetAmount.div(2),
- );
- await exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
- makerAssetFillAmount,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const makerAmountBought = signedOrders[0].takerAssetAmount.add(
- signedOrders[1].takerAssetAmount.dividedToIntegerBy(2),
- );
- const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
- const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
- );
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
- );
- expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
- );
- expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
- );
- });
-
- it('should fill all signedOrders if cannot fill entire makerAssetFillAmount', async () => {
- const makerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
- _.forEach(signedOrders, signedOrder => {
- erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
- defaultMakerAssetAddress
- ].minus(signedOrder.makerAssetAmount);
- erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
- defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
- erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
- signedOrder.makerFee,
- );
- erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
- defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
- erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
- defaultTakerAssetAddress
- ].minus(signedOrder.takerAssetAmount);
- erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
- signedOrder.takerFee,
- );
- erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
- zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
- });
- await exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
- makerAssetFillAmount,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should throw when a signedOrder does not use the same makerAssetAddress', async () => {
- signedOrders = [
- await orderFactory.newSignedOrderAsync(),
- await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- }),
- await orderFactory.newSignedOrderAsync(),
- ];
-
- return expectTransactionFailedAsync(
- exchangeWrapper.marketBuyOrdersAsync(signedOrders, takerAddress, {
- makerAssetFillAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 18),
- }),
- RevertReason.InvalidOrderSignature,
- );
- });
- });
-
- describe('marketBuyOrdersNoThrow', () => {
- const reentrancyTest = (functionNames: string[]) => {
- _.forEach(functionNames, async (functionName: string, functionId: number) => {
- const description = `should not allow marketBuyOrdersNoThrow to reenter the Exchange contract via ${functionName}`;
- it(description, async () => {
- const signedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(reentrantErc20Token.address),
- });
- await web3Wrapper.awaitTransactionSuccessAsync(
- await reentrantErc20Token.setCurrentFunction.sendTransactionAsync(functionId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await exchangeWrapper.marketBuyOrdersNoThrowAsync([signedOrder], takerAddress, {
- makerAssetFillAmount: signedOrder.makerAssetAmount,
- });
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(erc20Balances).to.deep.equal(newBalances);
- });
- });
- };
- describe('marketBuyOrdersNoThrow reentrancy tests', () => reentrancyTest(constants.FUNCTIONS_WITH_MUTEX));
-
- it('should stop when the entire makerAssetFillAmount is filled', async () => {
- const makerAssetFillAmount = signedOrders[0].makerAssetAmount.plus(
- signedOrders[1].makerAssetAmount.div(2),
- );
- await exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
- makerAssetFillAmount,
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 600000,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const makerAmountBought = signedOrders[0].takerAssetAmount.add(
- signedOrders[1].takerAssetAmount.dividedToIntegerBy(2),
- );
- const makerFee = signedOrders[0].makerFee.add(signedOrders[1].makerFee.dividedToIntegerBy(2));
- const takerFee = signedOrders[0].takerFee.add(signedOrders[1].takerFee.dividedToIntegerBy(2));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultTakerAssetAddress].add(makerAmountBought),
- );
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerFee),
- );
- expect(newBalances[takerAddress][defaultTakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultTakerAssetAddress].minus(makerAmountBought),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].add(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].minus(takerFee),
- );
- expect(newBalances[feeRecipientAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[feeRecipientAddress][zrxToken.address].add(makerFee.add(takerFee)),
- );
- });
-
- it('should fill all signedOrders if cannot fill entire makerAssetFillAmount', async () => {
- const makerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
- _.forEach(signedOrders, signedOrder => {
- erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
- defaultMakerAssetAddress
- ].minus(signedOrder.makerAssetAmount);
- erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
- defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
- erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
- signedOrder.makerFee,
- );
- erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
- defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
- erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
- defaultTakerAssetAddress
- ].minus(signedOrder.takerAssetAmount);
- erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
- signedOrder.takerFee,
- );
- erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
- zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
- });
- await exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
- makerAssetFillAmount,
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 600000,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
-
- it('should not fill a signedOrder that does not use the same makerAssetAddress', async () => {
- signedOrders = [
- await orderFactory.newSignedOrderAsync(),
- await orderFactory.newSignedOrderAsync(),
- await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- }),
- ];
-
- const makerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(100000), 18);
- const filledSignedOrders = signedOrders.slice(0, -1);
- _.forEach(filledSignedOrders, signedOrder => {
- erc20Balances[makerAddress][defaultMakerAssetAddress] = erc20Balances[makerAddress][
- defaultMakerAssetAddress
- ].minus(signedOrder.makerAssetAmount);
- erc20Balances[makerAddress][defaultTakerAssetAddress] = erc20Balances[makerAddress][
- defaultTakerAssetAddress
- ].add(signedOrder.takerAssetAmount);
- erc20Balances[makerAddress][zrxToken.address] = erc20Balances[makerAddress][zrxToken.address].minus(
- signedOrder.makerFee,
- );
- erc20Balances[takerAddress][defaultMakerAssetAddress] = erc20Balances[takerAddress][
- defaultMakerAssetAddress
- ].add(signedOrder.makerAssetAmount);
- erc20Balances[takerAddress][defaultTakerAssetAddress] = erc20Balances[takerAddress][
- defaultTakerAssetAddress
- ].minus(signedOrder.takerAssetAmount);
- erc20Balances[takerAddress][zrxToken.address] = erc20Balances[takerAddress][zrxToken.address].minus(
- signedOrder.takerFee,
- );
- erc20Balances[feeRecipientAddress][zrxToken.address] = erc20Balances[feeRecipientAddress][
- zrxToken.address
- ].add(signedOrder.makerFee.add(signedOrder.takerFee));
- });
- await exchangeWrapper.marketBuyOrdersNoThrowAsync(signedOrders, takerAddress, {
- makerAssetFillAmount,
- // HACK(albrow): We need to hardcode the gas estimate here because
- // the Geth gas estimator doesn't work with the way we use
- // delegatecall and swallow errors.
- gas: 600000,
- });
-
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances).to.be.deep.equal(erc20Balances);
- });
- });
-
- describe('batchCancelOrders', () => {
- it('should be able to cancel multiple signedOrders', async () => {
- const takerAssetCancelAmounts = _.map(signedOrders, signedOrder => signedOrder.takerAssetAmount);
- await exchangeWrapper.batchCancelOrdersAsync(signedOrders, makerAddress);
-
- await exchangeWrapper.batchFillOrdersNoThrowAsync(signedOrders, takerAddress, {
- takerAssetFillAmounts: takerAssetCancelAmounts,
- });
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(erc20Balances).to.be.deep.equal(newBalances);
- });
- });
-
- describe('getOrdersInfo', () => {
- beforeEach(async () => {
- signedOrders = [
- await orderFactory.newSignedOrderAsync(),
- await orderFactory.newSignedOrderAsync(),
- await orderFactory.newSignedOrderAsync(),
- ];
- });
- it('should get the correct information for multiple unfilled orders', async () => {
- const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
- expect(ordersInfo.length).to.be.equal(3);
- _.forEach(signedOrders, (signedOrder, index) => {
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = new BigNumber(0);
- const expectedOrderStatus = OrderStatus.FILLABLE;
- const orderInfo = ordersInfo[index];
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- });
- it('should get the correct information for multiple partially filled orders', async () => {
- const takerAssetFillAmounts = _.map(signedOrders, signedOrder => signedOrder.takerAssetAmount.div(2));
- await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress, { takerAssetFillAmounts });
- const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
- expect(ordersInfo.length).to.be.equal(3);
- _.forEach(signedOrders, (signedOrder, index) => {
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount.div(2);
- const expectedOrderStatus = OrderStatus.FILLABLE;
- const orderInfo = ordersInfo[index];
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- });
- it('should get the correct information for multiple fully filled orders', async () => {
- await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress);
- const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
- expect(ordersInfo.length).to.be.equal(3);
- _.forEach(signedOrders, (signedOrder, index) => {
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount;
- const expectedOrderStatus = OrderStatus.FULLY_FILLED;
- const orderInfo = ordersInfo[index];
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- });
- it('should get the correct information for multiple cancelled and unfilled orders', async () => {
- await exchangeWrapper.batchCancelOrdersAsync(signedOrders, makerAddress);
- const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
- expect(ordersInfo.length).to.be.equal(3);
- _.forEach(signedOrders, (signedOrder, index) => {
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = new BigNumber(0);
- const expectedOrderStatus = OrderStatus.CANCELLED;
- const orderInfo = ordersInfo[index];
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- });
- it('should get the correct information for multiple cancelled and partially filled orders', async () => {
- const takerAssetFillAmounts = _.map(signedOrders, signedOrder => signedOrder.takerAssetAmount.div(2));
- await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress, { takerAssetFillAmounts });
- await exchangeWrapper.batchCancelOrdersAsync(signedOrders, makerAddress);
- const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
- expect(ordersInfo.length).to.be.equal(3);
- _.forEach(signedOrders, (signedOrder, index) => {
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount.div(2);
- const expectedOrderStatus = OrderStatus.CANCELLED;
- const orderInfo = ordersInfo[index];
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- });
- it('should get the correct information for multiple expired and unfilled orders', async () => {
- const currentTimestamp = await getLatestBlockTimestampAsync();
- const timeUntilExpiration = signedOrders[0].expirationTimeSeconds.minus(currentTimestamp).toNumber();
- await increaseTimeAndMineBlockAsync(timeUntilExpiration);
- const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
- expect(ordersInfo.length).to.be.equal(3);
- _.forEach(signedOrders, (signedOrder, index) => {
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = new BigNumber(0);
- const expectedOrderStatus = OrderStatus.EXPIRED;
- const orderInfo = ordersInfo[index];
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- });
- it('should get the correct information for multiple expired and partially filled orders', async () => {
- const takerAssetFillAmounts = _.map(signedOrders, signedOrder => signedOrder.takerAssetAmount.div(2));
- await exchangeWrapper.batchFillOrdersAsync(signedOrders, takerAddress, { takerAssetFillAmounts });
- const currentTimestamp = await getLatestBlockTimestampAsync();
- const timeUntilExpiration = signedOrders[0].expirationTimeSeconds.minus(currentTimestamp).toNumber();
- await increaseTimeAndMineBlockAsync(timeUntilExpiration);
- const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
- expect(ordersInfo.length).to.be.equal(3);
- _.forEach(signedOrders, (signedOrder, index) => {
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedTakerAssetFilledAmount = signedOrder.takerAssetAmount.div(2);
- const expectedOrderStatus = OrderStatus.EXPIRED;
- const orderInfo = ordersInfo[index];
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(expectedTakerAssetFilledAmount);
- expect(orderInfo.orderStatus).to.equal(expectedOrderStatus);
- });
- });
- it('should get the correct information for a mix of unfilled, partially filled, fully filled, cancelled, and expired orders', async () => {
- const unfilledOrder = await orderFactory.newSignedOrderAsync();
- const partiallyFilledOrder = await orderFactory.newSignedOrderAsync();
- await exchangeWrapper.fillOrderAsync(partiallyFilledOrder, takerAddress, {
- takerAssetFillAmount: partiallyFilledOrder.takerAssetAmount.div(2),
- });
- const fullyFilledOrder = await orderFactory.newSignedOrderAsync();
- await exchangeWrapper.fillOrderAsync(fullyFilledOrder, takerAddress);
- const cancelledOrder = await orderFactory.newSignedOrderAsync();
- await exchangeWrapper.cancelOrderAsync(cancelledOrder, makerAddress);
- const currentTimestamp = await getLatestBlockTimestampAsync();
- const expiredOrder = await orderFactory.newSignedOrderAsync({
- expirationTimeSeconds: new BigNumber(currentTimestamp),
- });
- signedOrders = [unfilledOrder, partiallyFilledOrder, fullyFilledOrder, cancelledOrder, expiredOrder];
- const ordersInfo = await exchangeWrapper.getOrdersInfoAsync(signedOrders);
- expect(ordersInfo.length).to.be.equal(5);
-
- const expectedUnfilledOrderHash = orderHashUtils.getOrderHashHex(unfilledOrder);
- const expectedUnfilledTakerAssetFilledAmount = new BigNumber(0);
- const expectedUnfilledOrderStatus = OrderStatus.FILLABLE;
- const unfilledOrderInfo = ordersInfo[0];
- expect(unfilledOrderInfo.orderHash).to.be.equal(expectedUnfilledOrderHash);
- expect(unfilledOrderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(
- expectedUnfilledTakerAssetFilledAmount,
- );
- expect(unfilledOrderInfo.orderStatus).to.be.equal(expectedUnfilledOrderStatus);
-
- const expectedPartialOrderHash = orderHashUtils.getOrderHashHex(partiallyFilledOrder);
- const expectedPartialTakerAssetFilledAmount = partiallyFilledOrder.takerAssetAmount.div(2);
- const expectedPartialOrderStatus = OrderStatus.FILLABLE;
- const partialOrderInfo = ordersInfo[1];
- expect(partialOrderInfo.orderHash).to.be.equal(expectedPartialOrderHash);
- expect(partialOrderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(
- expectedPartialTakerAssetFilledAmount,
- );
- expect(partialOrderInfo.orderStatus).to.be.equal(expectedPartialOrderStatus);
-
- const expectedFilledOrderHash = orderHashUtils.getOrderHashHex(fullyFilledOrder);
- const expectedFilledTakerAssetFilledAmount = fullyFilledOrder.takerAssetAmount;
- const expectedFilledOrderStatus = OrderStatus.FULLY_FILLED;
- const filledOrderInfo = ordersInfo[2];
- expect(filledOrderInfo.orderHash).to.be.equal(expectedFilledOrderHash);
- expect(filledOrderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(
- expectedFilledTakerAssetFilledAmount,
- );
- expect(filledOrderInfo.orderStatus).to.be.equal(expectedFilledOrderStatus);
-
- const expectedCancelledOrderHash = orderHashUtils.getOrderHashHex(cancelledOrder);
- const expectedCancelledTakerAssetFilledAmount = new BigNumber(0);
- const expectedCancelledOrderStatus = OrderStatus.CANCELLED;
- const cancelledOrderInfo = ordersInfo[3];
- expect(cancelledOrderInfo.orderHash).to.be.equal(expectedCancelledOrderHash);
- expect(cancelledOrderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(
- expectedCancelledTakerAssetFilledAmount,
- );
- expect(cancelledOrderInfo.orderStatus).to.be.equal(expectedCancelledOrderStatus);
-
- const expectedExpiredOrderHash = orderHashUtils.getOrderHashHex(expiredOrder);
- const expectedExpiredTakerAssetFilledAmount = new BigNumber(0);
- const expectedExpiredOrderStatus = OrderStatus.EXPIRED;
- const expiredOrderInfo = ordersInfo[4];
- expect(expiredOrderInfo.orderHash).to.be.equal(expectedExpiredOrderHash);
- expect(expiredOrderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(
- expectedExpiredTakerAssetFilledAmount,
- );
- expect(expiredOrderInfo.orderStatus).to.be.equal(expectedExpiredOrderStatus);
- });
- });
- });
-}); // tslint:disable-line:max-file-line-count
diff --git a/packages/contracts/test/extensions/forwarder.ts b/packages/contracts/test/extensions/forwarder.ts
deleted file mode 100644
index c006be0fe..000000000
--- a/packages/contracts/test/extensions/forwarder.ts
+++ /dev/null
@@ -1,1282 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { assetDataUtils } from '@0x/order-utils';
-import { RevertReason, SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as chai from 'chai';
-import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
-
-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,
- sendTransactionResult,
-} from '../utils/assertions';
-import { chaiSetup } from '../utils/chai_setup';
-import { constants } from '../utils/constants';
-import { ERC20Wrapper } from '../utils/erc20_wrapper';
-import { ERC721Wrapper } from '../utils/erc721_wrapper';
-import { ExchangeWrapper } from '../utils/exchange_wrapper';
-import { ForwarderWrapper } from '../utils/forwarder_wrapper';
-import { OrderFactory } from '../utils/order_factory';
-import { ContractName, ERC20BalancesByOwner } from '../utils/types';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-const DECIMALS_DEFAULT = 18;
-const MAX_WETH_FILL_PERCENTAGE = 95;
-
-describe(ContractName.Forwarder, () => {
- let makerAddress: string;
- let owner: string;
- let takerAddress: string;
- let feeRecipientAddress: string;
- let otherAddress: string;
- let defaultMakerAssetAddress: string;
- let zrxAssetData: string;
- let wethAssetData: string;
-
- let weth: DummyERC20TokenContract;
- let zrxToken: DummyERC20TokenContract;
- let erc20TokenA: DummyERC20TokenContract;
- let erc721Token: DummyERC721TokenContract;
- let forwarderContract: ForwarderContract;
- let wethContract: WETH9Contract;
- let forwarderWrapper: ForwarderWrapper;
- let exchangeWrapper: ExchangeWrapper;
-
- let orderWithoutFee: SignedOrder;
- let orderWithFee: SignedOrder;
- let feeOrder: SignedOrder;
- let orderFactory: OrderFactory;
- let erc20Wrapper: ERC20Wrapper;
- let erc20Balances: ERC20BalancesByOwner;
- let tx: TransactionReceiptWithDecodedLogs;
-
- let erc721MakerAssetIds: BigNumber[];
- let takerEthBalanceBefore: BigNumber;
- let feePercentage: BigNumber;
- let gasPrice: BigNumber;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress, otherAddress] = accounts);
-
- const txHash = await web3Wrapper.sendTransactionAsync({ from: accounts[0], to: accounts[0], value: 0 });
- const transaction = await web3Wrapper.getTransactionByHashAsync(txHash);
- gasPrice = new BigNumber(transaction.gasPrice);
-
- const erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
- erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
-
- const numDummyErc20ToDeploy = 3;
- [erc20TokenA, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
- numDummyErc20ToDeploy,
- constants.DUMMY_TOKEN_DECIMALS,
- );
- const erc20Proxy = await erc20Wrapper.deployProxyAsync();
- await erc20Wrapper.setBalancesAndAllowancesAsync();
-
- [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
- const erc721Proxy = await erc721Wrapper.deployProxyAsync();
- await erc721Wrapper.setBalancesAndAllowancesAsync();
- const erc721Balances = await erc721Wrapper.getBalancesAsync();
- erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
-
- wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
- weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider);
- erc20Wrapper.addDummyTokenContract(weth);
-
- wethAssetData = assetDataUtils.encodeERC20AssetData(wethContract.address);
- zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
- const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
- provider,
- txDefaults,
- zrxAssetData,
- );
- exchangeWrapper = new ExchangeWrapper(exchangeInstance, provider);
- await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
- await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
-
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
- from: owner,
- });
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeInstance.address, {
- from: owner,
- });
-
- defaultMakerAssetAddress = erc20TokenA.address;
- const defaultTakerAssetAddress = wethContract.address;
- const defaultOrderParams = {
- exchangeAddress: exchangeInstance.address,
- makerAddress,
- feeRecipientAddress,
- makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
- takerAssetData: assetDataUtils.encodeERC20AssetData(defaultTakerAssetAddress),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), DECIMALS_DEFAULT),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), DECIMALS_DEFAULT),
- makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(0), DECIMALS_DEFAULT),
- };
- const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
- orderFactory = new OrderFactory(privateKey, defaultOrderParams);
-
- const forwarderInstance = await ForwarderContract.deployFrom0xArtifactAsync(
- artifacts.Forwarder,
- provider,
- txDefaults,
- exchangeInstance.address,
- zrxAssetData,
- wethAssetData,
- );
- forwarderContract = new ForwarderContract(forwarderInstance.abi, forwarderInstance.address, provider);
- forwarderWrapper = new ForwarderWrapper(forwarderContract, provider);
- const zrxDepositAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.transfer.sendTransactionAsync(forwarderContract.address, zrxDepositAmount),
- );
- erc20Wrapper.addTokenOwnerAddress(forwarderInstance.address);
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- erc20Balances = await erc20Wrapper.getBalancesAsync();
- takerEthBalanceBefore = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- orderWithoutFee = await orderFactory.newSignedOrderAsync();
- feeOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
- });
- orderWithFee = await orderFactory.newSignedOrderAsync({
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
- });
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
-
- describe('constructor', () => {
- it('should revert if assetProxy is unregistered', async () => {
- const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
- provider,
- txDefaults,
- zrxAssetData,
- );
- return expectContractCreationFailedAsync(
- (ForwarderContract.deployFrom0xArtifactAsync(
- artifacts.Forwarder,
- provider,
- txDefaults,
- exchangeInstance.address,
- zrxAssetData,
- wethAssetData,
- ) as any) as sendTransactionResult,
- RevertReason.UnregisteredAssetProxy,
- );
- });
- });
- describe('marketSellOrdersWithEth without extra fees', () => {
- it('should fill a single order', async () => {
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const ethValue = orderWithoutFee.takerAssetAmount.dividedToIntegerBy(2);
-
- tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithoutFee, feeOrders, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = ForwarderWrapper.getPercentageOfValue(
- ethValue,
- MAX_WETH_FILL_PERCENTAGE,
- );
- const makerAssetFillAmount = primaryTakerAssetFillAmount
- .times(orderWithoutFee.makerAssetAmount)
- .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should fill multiple orders', async () => {
- const secondOrderWithoutFee = await orderFactory.newSignedOrderAsync();
- const ordersWithoutFee = [orderWithoutFee, secondOrderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const ethValue = ordersWithoutFee[0].takerAssetAmount.plus(
- ordersWithoutFee[1].takerAssetAmount.dividedToIntegerBy(2),
- );
-
- tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithoutFee, feeOrders, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = ForwarderWrapper.getPercentageOfValue(
- ethValue,
- MAX_WETH_FILL_PERCENTAGE,
- );
- const firstTakerAssetFillAmount = ordersWithoutFee[0].takerAssetAmount;
- const secondTakerAssetFillAmount = primaryTakerAssetFillAmount.minus(firstTakerAssetFillAmount);
-
- const makerAssetFillAmount = ordersWithoutFee[0].makerAssetAmount.plus(
- ordersWithoutFee[1].makerAssetAmount
- .times(secondTakerAssetFillAmount)
- .dividedToIntegerBy(ordersWithoutFee[1].takerAssetAmount),
- );
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should fill the order and pay ZRX fees from a single feeOrder', async () => {
- const ordersWithFee = [orderWithFee];
- const feeOrders = [feeOrder];
- const ethValue = orderWithFee.takerAssetAmount.dividedToIntegerBy(2);
-
- tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithFee, feeOrders, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = ForwarderWrapper.getPercentageOfValue(
- ethValue,
- MAX_WETH_FILL_PERCENTAGE,
- );
- const makerAssetFillAmount = primaryTakerAssetFillAmount
- .times(orderWithoutFee.makerAssetAmount)
- .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
- const feeAmount = ForwarderWrapper.getPercentageOfValue(
- orderWithFee.takerFee.dividedToIntegerBy(2),
- MAX_WETH_FILL_PERCENTAGE,
- );
- const wethSpentOnFeeOrders = ForwarderWrapper.getWethForFeeOrders(feeAmount, feeOrders);
- const totalEthSpent = primaryTakerAssetFillAmount
- .plus(wethSpentOnFeeOrders)
- .plus(gasPrice.times(tx.gasUsed));
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount).plus(wethSpentOnFeeOrders),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should fill the orders and pay ZRX from multiple feeOrders', async () => {
- const ordersWithFee = [orderWithFee];
- const ethValue = orderWithFee.takerAssetAmount;
- const makerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
- const makerAssetAmount = orderWithFee.takerFee.dividedToIntegerBy(2);
- const takerAssetAmount = feeOrder.takerAssetAmount
- .times(makerAssetAmount)
- .dividedToIntegerBy(feeOrder.makerAssetAmount);
-
- const firstFeeOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData,
- makerAssetAmount,
- takerAssetAmount,
- });
- const secondFeeOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData,
- makerAssetAmount,
- takerAssetAmount,
- });
- const feeOrders = [firstFeeOrder, secondFeeOrder];
-
- tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithFee, feeOrders, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = ForwarderWrapper.getPercentageOfValue(
- ethValue,
- MAX_WETH_FILL_PERCENTAGE,
- );
- const makerAssetFillAmount = primaryTakerAssetFillAmount
- .times(orderWithoutFee.makerAssetAmount)
- .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
- const feeAmount = ForwarderWrapper.getPercentageOfValue(orderWithFee.takerFee, MAX_WETH_FILL_PERCENTAGE);
- const wethSpentOnFeeOrders = ForwarderWrapper.getWethForFeeOrders(feeAmount, feeOrders);
- const totalEthSpent = primaryTakerAssetFillAmount
- .plus(wethSpentOnFeeOrders)
- .plus(gasPrice.times(tx.gasUsed));
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount).plus(wethSpentOnFeeOrders),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should fill the order when token is ZRX with fees', async () => {
- orderWithFee = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
- });
- const ordersWithFee = [orderWithFee];
- const feeOrders: SignedOrder[] = [];
- const ethValue = orderWithFee.takerAssetAmount.dividedToIntegerBy(2);
-
- tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithFee, feeOrders, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const makerAssetFillAmount = orderWithFee.makerAssetAmount.dividedToIntegerBy(2);
- const totalEthSpent = ethValue.plus(gasPrice.times(tx.gasUsed));
- const takerFeePaid = orderWithFee.takerFee.dividedToIntegerBy(2);
- const makerFeePaid = orderWithFee.makerFee.dividedToIntegerBy(2);
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount).minus(makerFeePaid),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount).minus(takerFeePaid),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(ethValue),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[forwarderContract.address][zrxToken.address],
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should refund remaining ETH if amount is greater than takerAssetAmount', async () => {
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const ethValue = orderWithoutFee.takerAssetAmount.times(2);
-
- tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithoutFee, feeOrders, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const totalEthSpent = orderWithoutFee.takerAssetAmount.plus(gasPrice.times(tx.gasUsed));
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- });
- it('should revert if ZRX cannot be fully repurchased', async () => {
- orderWithFee = await orderFactory.newSignedOrderAsync({
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(50), DECIMALS_DEFAULT),
- });
- const ordersWithFee = [orderWithFee];
- feeOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
- });
- const feeOrders = [feeOrder];
- const ethValue = orderWithFee.takerAssetAmount;
- return expectTransactionFailedAsync(
- forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithFee, feeOrders, {
- value: ethValue,
- from: takerAddress,
- }),
- RevertReason.CompleteFillFailed,
- );
- });
- it('should not fill orders with different makerAssetData than the first order', async () => {
- const makerAssetId = erc721MakerAssetIds[0];
- const erc721SignedOrder = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- });
- const erc20SignedOrder = await orderFactory.newSignedOrderAsync();
- const ordersWithoutFee = [erc20SignedOrder, erc721SignedOrder];
- const feeOrders: SignedOrder[] = [];
- const ethValue = erc20SignedOrder.takerAssetAmount.plus(erc721SignedOrder.takerAssetAmount);
-
- tx = await forwarderWrapper.marketSellOrdersWithEthAsync(ordersWithoutFee, feeOrders, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const totalEthSpent = erc20SignedOrder.takerAssetAmount.plus(gasPrice.times(tx.gasUsed));
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- });
- });
- describe('marketSellOrdersWithEth with extra fees', () => {
- it('should fill the order and send fee to feeRecipient', async () => {
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const ethValue = orderWithoutFee.takerAssetAmount.div(2);
-
- const baseFeePercentage = 2;
- feePercentage = ForwarderWrapper.getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, baseFeePercentage);
- const feeRecipientEthBalanceBefore = await web3Wrapper.getBalanceInWeiAsync(feeRecipientAddress);
- tx = await forwarderWrapper.marketSellOrdersWithEthAsync(
- ordersWithoutFee,
- feeOrders,
- {
- value: ethValue,
- from: takerAddress,
- },
- { feePercentage, feeRecipient: feeRecipientAddress },
- );
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const feeRecipientEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(feeRecipientAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = ForwarderWrapper.getPercentageOfValue(
- ethValue,
- MAX_WETH_FILL_PERCENTAGE,
- );
- const makerAssetFillAmount = primaryTakerAssetFillAmount
- .times(orderWithoutFee.makerAssetAmount)
- .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
- const ethSpentOnFee = ForwarderWrapper.getPercentageOfValue(primaryTakerAssetFillAmount, baseFeePercentage);
- const totalEthSpent = primaryTakerAssetFillAmount.plus(ethSpentOnFee).plus(gasPrice.times(tx.gasUsed));
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(feeRecipientEthBalanceAfter).to.be.bignumber.equal(feeRecipientEthBalanceBefore.plus(ethSpentOnFee));
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should fail if the fee is set too high', async () => {
- const ethValue = orderWithoutFee.takerAssetAmount.div(2);
- const baseFeePercentage = 6;
- feePercentage = ForwarderWrapper.getPercentageOfValue(ethValue, baseFeePercentage);
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- await expectTransactionFailedAsync(
- forwarderWrapper.marketSellOrdersWithEthAsync(
- ordersWithoutFee,
- feeOrders,
- { from: takerAddress, value: ethValue, gasPrice },
- { feePercentage, feeRecipient: feeRecipientAddress },
- ),
- RevertReason.FeePercentageTooLarge,
- );
- });
- it('should fail if there is not enough ETH remaining to pay the fee', async () => {
- const ethValue = orderWithoutFee.takerAssetAmount.div(2);
- const baseFeePercentage = 5;
- feePercentage = ForwarderWrapper.getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, baseFeePercentage);
- const ordersWithFee = [orderWithFee];
- const feeOrders = [feeOrder];
- await expectTransactionFailedAsync(
- forwarderWrapper.marketSellOrdersWithEthAsync(
- ordersWithFee,
- feeOrders,
- { from: takerAddress, value: ethValue, gasPrice },
- { feePercentage, feeRecipient: feeRecipientAddress },
- ),
- RevertReason.InsufficientEthRemaining,
- );
- });
- });
- describe('marketBuyOrdersWithEth without extra fees', () => {
- it('should buy the exact amount of makerAsset in a single order', async () => {
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
- const ethValue = orderWithoutFee.takerAssetAmount.dividedToIntegerBy(2);
-
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = ethValue;
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should buy the exact amount of makerAsset in multiple orders', async () => {
- const secondOrderWithoutFee = await orderFactory.newSignedOrderAsync();
- const ordersWithoutFee = [orderWithoutFee, secondOrderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = ordersWithoutFee[0].makerAssetAmount.plus(
- ordersWithoutFee[1].makerAssetAmount.dividedToIntegerBy(2),
- );
- const ethValue = ordersWithoutFee[0].takerAssetAmount.plus(
- ordersWithoutFee[1].takerAssetAmount.dividedToIntegerBy(2),
- );
-
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = ethValue;
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should buy the exact amount of makerAsset and return excess ETH', async () => {
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
- const ethValue = orderWithoutFee.takerAssetAmount;
-
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = ethValue.dividedToIntegerBy(2);
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should buy the exact amount of makerAsset and pay ZRX from feeOrders', async () => {
- const ordersWithFee = [orderWithFee];
- const feeOrders = [feeOrder];
- const makerAssetFillAmount = orderWithFee.makerAssetAmount.dividedToIntegerBy(2);
- const ethValue = orderWithFee.takerAssetAmount;
-
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithFee, feeOrders, makerAssetFillAmount, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = orderWithFee.takerAssetAmount.dividedToIntegerBy(2);
- const feeAmount = orderWithFee.takerFee.dividedToIntegerBy(2);
- const wethSpentOnFeeOrders = ForwarderWrapper.getWethForFeeOrders(feeAmount, feeOrders);
- const totalEthSpent = primaryTakerAssetFillAmount
- .plus(wethSpentOnFeeOrders)
- .plus(gasPrice.times(tx.gasUsed));
-
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount).plus(wethSpentOnFeeOrders),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should buy slightly greater than makerAssetAmount when buying ZRX', async () => {
- orderWithFee = await orderFactory.newSignedOrderAsync({
- makerAssetData: assetDataUtils.encodeERC20AssetData(zrxToken.address),
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
- });
- const ordersWithFee = [orderWithFee];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = orderWithFee.makerAssetAmount.dividedToIntegerBy(2);
- const ethValue = orderWithFee.takerAssetAmount;
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithFee, feeOrders, makerAssetFillAmount, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = ForwarderWrapper.getWethForFeeOrders(
- makerAssetFillAmount,
- ordersWithFee,
- );
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
- const makerAssetFilledAmount = orderWithFee.makerAssetAmount
- .times(primaryTakerAssetFillAmount)
- .dividedToIntegerBy(orderWithFee.takerAssetAmount);
- const takerFeePaid = orderWithFee.takerFee
- .times(primaryTakerAssetFillAmount)
- .dividedToIntegerBy(orderWithFee.takerAssetAmount);
- const makerFeePaid = orderWithFee.makerFee
- .times(primaryTakerAssetFillAmount)
- .dividedToIntegerBy(orderWithFee.takerAssetAmount);
- const totalZrxPurchased = makerAssetFilledAmount.minus(takerFeePaid);
- // Up to 1 wei worth of ZRX will be overbought per order
- const maxOverboughtZrx = new BigNumber(1)
- .times(orderWithFee.makerAssetAmount)
- .dividedToIntegerBy(orderWithFee.takerAssetAmount);
-
- expect(totalZrxPurchased).to.be.bignumber.gte(makerAssetFillAmount);
- expect(totalZrxPurchased).to.be.bignumber.lte(makerAssetFillAmount.plus(maxOverboughtZrx));
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFilledAmount).minus(makerFeePaid),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].plus(totalZrxPurchased),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[forwarderContract.address][zrxToken.address],
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should revert if the amount of ETH sent is too low to fill the makerAssetAmount', async () => {
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
- const ethValue = orderWithoutFee.takerAssetAmount.dividedToIntegerBy(4);
- return expectTransactionFailedAsync(
- forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
- value: ethValue,
- from: takerAddress,
- }),
- RevertReason.CompleteFillFailed,
- );
- });
- it('should buy an ERC721 asset from a single order', async () => {
- const makerAssetId = erc721MakerAssetIds[0];
- orderWithoutFee = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- });
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = new BigNumber(1);
- const ethValue = orderWithFee.takerAssetAmount;
-
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
- from: takerAddress,
- value: ethValue,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newOwner = await erc721Token.ownerOf.callAsync(makerAssetId);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = ethValue;
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
- expect(newOwner).to.be.bignumber.equal(takerAddress);
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should revert if buying an ERC721 asset when later orders contain different makerAssetData', async () => {
- const makerAssetId = erc721MakerAssetIds[0];
- orderWithoutFee = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- });
- const differentMakerAssetDataOrder = await orderFactory.newSignedOrderAsync();
- const ordersWithoutFee = [orderWithoutFee, differentMakerAssetDataOrder];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = new BigNumber(1).plus(differentMakerAssetDataOrder.makerAssetAmount);
- const ethValue = orderWithFee.takerAssetAmount;
- return expectTransactionFailedAsync(
- forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
- value: ethValue,
- from: takerAddress,
- }),
- RevertReason.CompleteFillFailed,
- );
- });
- it('should buy an ERC721 asset and pay ZRX fees from a single fee order', async () => {
- const makerAssetId = erc721MakerAssetIds[0];
- orderWithFee = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
- });
- const ordersWithFee = [orderWithFee];
- const feeOrders = [feeOrder];
- const makerAssetFillAmount = orderWithFee.makerAssetAmount;
- const primaryTakerAssetFillAmount = orderWithFee.takerAssetAmount;
- const feeAmount = orderWithFee.takerFee;
- const wethSpentOnFeeOrders = ForwarderWrapper.getWethForFeeOrders(feeAmount, feeOrders);
- const ethValue = primaryTakerAssetFillAmount.plus(wethSpentOnFeeOrders);
-
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithFee, feeOrders, makerAssetFillAmount, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newOwner = await erc721Token.ownerOf.callAsync(makerAssetId);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const totalEthSpent = ethValue.plus(gasPrice.times(tx.gasUsed));
-
- expect(newOwner).to.be.bignumber.equal(takerAddress);
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount).plus(wethSpentOnFeeOrders),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should buy an ERC721 asset and pay ZRX fees from multiple fee orders', async () => {
- const makerAssetId = erc721MakerAssetIds[0];
- orderWithFee = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber(1),
- makerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), DECIMALS_DEFAULT),
- });
- const ordersWithFee = [orderWithFee];
- const makerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
- const makerAssetAmount = orderWithFee.takerFee.dividedToIntegerBy(2);
- const takerAssetAmount = feeOrder.takerAssetAmount
- .times(makerAssetAmount)
- .dividedToIntegerBy(feeOrder.makerAssetAmount);
-
- const firstFeeOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData,
- makerAssetAmount,
- takerAssetAmount,
- });
- const secondFeeOrder = await orderFactory.newSignedOrderAsync({
- makerAssetData,
- makerAssetAmount,
- takerAssetAmount,
- });
- const feeOrders = [firstFeeOrder, secondFeeOrder];
-
- const makerAssetFillAmount = orderWithFee.makerAssetAmount;
- const primaryTakerAssetFillAmount = orderWithFee.takerAssetAmount;
- const feeAmount = orderWithFee.takerFee;
- const wethSpentOnFeeOrders = ForwarderWrapper.getWethForFeeOrders(feeAmount, feeOrders);
- const ethValue = primaryTakerAssetFillAmount.plus(wethSpentOnFeeOrders);
-
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithFee, feeOrders, makerAssetFillAmount, {
- value: ethValue,
- from: takerAddress,
- });
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newOwner = await erc721Token.ownerOf.callAsync(makerAssetId);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const totalEthSpent = ethValue.plus(gasPrice.times(tx.gasUsed));
-
- expect(newOwner).to.be.bignumber.equal(takerAddress);
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount).plus(wethSpentOnFeeOrders),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('Should buy slightly greater MakerAsset when exchange rate is rounded', async () => {
- // The 0x Protocol contracts round the exchange rate in favor of the Maker.
- // In this case, the taker must round up how much they're going to spend, which
- // in turn increases the amount of MakerAsset being purchased.
- // Example:
- // The taker wants to buy 5 units of the MakerAsset at a rate of 3M/2T.
- // For every 2 units of TakerAsset, the taker will receive 3 units of MakerAsset.
- // To purchase 5 units, the taker must spend 10/3 = 3.33 units of TakerAssset.
- // However, the Taker can only spend whole units.
- // Spending floor(10/3) = 3 units will yield a profit of Floor(3*3/2) = Floor(4.5) = 4 units of MakerAsset.
- // Spending ceil(10/3) = 4 units will yield a profit of Floor(4*3/2) = 6 units of MakerAsset.
- //
- // The forwarding contract will opt for the second option, which overbuys, to ensure the taker
- // receives at least the amount of MakerAsset they requested.
- //
- // Construct test case using values from example above
- orderWithoutFee = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber('30'),
- takerAssetAmount: new BigNumber('20'),
- makerAssetData: assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
- takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
- makerFee: new BigNumber(0),
- takerFee: new BigNumber(0),
- });
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const desiredMakerAssetFillAmount = new BigNumber('5');
- const makerAssetFillAmount = new BigNumber('6');
- const ethValue = new BigNumber('4');
- // Execute test case
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
- ordersWithoutFee,
- feeOrders,
- desiredMakerAssetFillAmount,
- {
- value: ethValue,
- from: takerAddress,
- },
- );
- // Fetch end balances and construct expected outputs
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- const primaryTakerAssetFillAmount = ethValue;
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
- // Validate test case
- expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('Should buy slightly greater MakerAsset when exchange rate is rounded, and MakerAsset is ZRX', async () => {
- // See the test case above for a detailed description of this case.
- // The difference here is that the MakerAsset is ZRX. We expect the same result as above,
- // but this tests a different code path.
- //
- // Construct test case using values from example above
- orderWithoutFee = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber('30'),
- takerAssetAmount: new BigNumber('20'),
- makerAssetData: zrxAssetData,
- takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
- makerFee: new BigNumber(0),
- takerFee: new BigNumber(0),
- });
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const desiredMakerAssetFillAmount = new BigNumber('5');
- const makerAssetFillAmount = new BigNumber('6');
- const ethValue = new BigNumber('4');
- // Execute test case
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
- ordersWithoutFee,
- feeOrders,
- desiredMakerAssetFillAmount,
- {
- value: ethValue,
- from: takerAddress,
- },
- );
- // Fetch end balances and construct expected outputs
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- const primaryTakerAssetFillAmount = ethValue;
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
- // Validate test case
- expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('Should buy slightly greater MakerAsset when exchange rate is rounded (Regression Test)', async () => {
- // Order taken from a transaction on mainnet that failed due to a rounding error.
- orderWithoutFee = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber('268166666666666666666'),
- takerAssetAmount: new BigNumber('219090625878836371'),
- makerAssetData: assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
- takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
- makerFee: new BigNumber(0),
- takerFee: new BigNumber(0),
- });
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- // The taker will receive more than the desired amount of makerAsset due to rounding
- const desiredMakerAssetFillAmount = new BigNumber('5000000000000000000');
- const ethValue = new BigNumber('4084971271824171');
- const makerAssetFillAmount = ethValue
- .times(orderWithoutFee.makerAssetAmount)
- .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
- // Execute test case
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
- ordersWithoutFee,
- feeOrders,
- desiredMakerAssetFillAmount,
- {
- value: ethValue,
- from: takerAddress,
- },
- );
- // Fetch end balances and construct expected outputs
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- const primaryTakerAssetFillAmount = ethValue;
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
- // Validate test case
- expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('Should buy slightly greater MakerAsset when exchange rate is rounded, and MakerAsset is ZRX (Regression Test)', async () => {
- // Order taken from a transaction on mainnet that failed due to a rounding error.
- orderWithoutFee = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber('268166666666666666666'),
- takerAssetAmount: new BigNumber('219090625878836371'),
- makerAssetData: zrxAssetData,
- takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
- makerFee: new BigNumber(0),
- takerFee: new BigNumber(0),
- });
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- // The taker will receive more than the desired amount of makerAsset due to rounding
- const desiredMakerAssetFillAmount = new BigNumber('5000000000000000000');
- const ethValue = new BigNumber('4084971271824171');
- const makerAssetFillAmount = ethValue
- .times(orderWithoutFee.makerAssetAmount)
- .dividedToIntegerBy(orderWithoutFee.takerAssetAmount);
- // Execute test case
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
- ordersWithoutFee,
- feeOrders,
- desiredMakerAssetFillAmount,
- {
- value: ethValue,
- from: takerAddress,
- },
- );
- // Fetch end balances and construct expected outputs
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- const primaryTakerAssetFillAmount = ethValue;
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
- // Validate test case
- expect(makerAssetFillAmount).to.be.bignumber.greaterThan(desiredMakerAssetFillAmount);
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('Should buy correct MakerAsset when exchange rate is NOT rounded, and MakerAsset is ZRX (Regression Test)', async () => {
- // An extra unit of TakerAsset was sent to the exchange contract to account for rounding errors, in Forwarder v1.
- // Specifically, the takerFillAmount was calculated using Floor(desiredMakerAmount * exchangeRate) + 1
- // We have since changed this to be Ceil(desiredMakerAmount * exchangeRate)
- // These calculations produce different results when `desiredMakerAmount * exchangeRate` is an integer.
- //
- // This test verifies that `ceil` is sufficient:
- // Let TakerAssetAmount = MakerAssetAmount * 2
- // -> exchangeRate = TakerAssetAmount / MakerAssetAmount = (2*MakerAssetAmount)/MakerAssetAmount = 2
- // .: desiredMakerAmount * exchangeRate is an integer.
- //
- // Construct test case using values from example above
- orderWithoutFee = await orderFactory.newSignedOrderAsync({
- makerAssetAmount: new BigNumber('30'),
- takerAssetAmount: new BigNumber('60'),
- makerAssetData: zrxAssetData,
- takerAssetData: assetDataUtils.encodeERC20AssetData(weth.address),
- makerFee: new BigNumber(0),
- takerFee: new BigNumber(0),
- });
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = new BigNumber('5');
- const ethValue = new BigNumber('10');
- // Execute test case
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(ordersWithoutFee, feeOrders, makerAssetFillAmount, {
- value: ethValue,
- from: takerAddress,
- });
- // Fetch end balances and construct expected outputs
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- const primaryTakerAssetFillAmount = ethValue;
- const totalEthSpent = primaryTakerAssetFillAmount.plus(gasPrice.times(tx.gasUsed));
- // Validate test case
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][zrxToken.address].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[takerAddress][zrxToken.address].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- });
- describe('marketBuyOrdersWithEth with extra fees', () => {
- it('should buy an asset and send fee to feeRecipient', async () => {
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
- const ethValue = orderWithoutFee.takerAssetAmount;
-
- const baseFeePercentage = 2;
- feePercentage = ForwarderWrapper.getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, baseFeePercentage);
- const feeRecipientEthBalanceBefore = await web3Wrapper.getBalanceInWeiAsync(feeRecipientAddress);
- tx = await forwarderWrapper.marketBuyOrdersWithEthAsync(
- ordersWithoutFee,
- feeOrders,
- makerAssetFillAmount,
- {
- value: ethValue,
- from: takerAddress,
- },
- { feePercentage, feeRecipient: feeRecipientAddress },
- );
- const takerEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
- const forwarderEthBalance = await web3Wrapper.getBalanceInWeiAsync(forwarderContract.address);
- const feeRecipientEthBalanceAfter = await web3Wrapper.getBalanceInWeiAsync(feeRecipientAddress);
- const newBalances = await erc20Wrapper.getBalancesAsync();
-
- const primaryTakerAssetFillAmount = orderWithoutFee.takerAssetAmount.dividedToIntegerBy(2);
- const ethSpentOnFee = ForwarderWrapper.getPercentageOfValue(primaryTakerAssetFillAmount, baseFeePercentage);
- const totalEthSpent = primaryTakerAssetFillAmount.plus(ethSpentOnFee).plus(gasPrice.times(tx.gasUsed));
-
- expect(feeRecipientEthBalanceAfter).to.be.bignumber.equal(feeRecipientEthBalanceBefore.plus(ethSpentOnFee));
- expect(takerEthBalanceAfter).to.be.bignumber.equal(takerEthBalanceBefore.minus(totalEthSpent));
- expect(newBalances[makerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[makerAddress][defaultMakerAssetAddress].minus(makerAssetFillAmount),
- );
- expect(newBalances[takerAddress][defaultMakerAssetAddress]).to.be.bignumber.equal(
- erc20Balances[takerAddress][defaultMakerAssetAddress].plus(makerAssetFillAmount),
- );
- expect(newBalances[makerAddress][weth.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][weth.address].plus(primaryTakerAssetFillAmount),
- );
- expect(newBalances[forwarderContract.address][weth.address]).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(newBalances[forwarderContract.address][defaultMakerAssetAddress]).to.be.bignumber.equal(
- constants.ZERO_AMOUNT,
- );
- expect(forwarderEthBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should fail if the fee is set too high', async () => {
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
- const ethValue = orderWithoutFee.takerAssetAmount;
-
- const baseFeePercentage = 6;
- feePercentage = ForwarderWrapper.getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, baseFeePercentage);
- await expectTransactionFailedAsync(
- forwarderWrapper.marketBuyOrdersWithEthAsync(
- ordersWithoutFee,
- feeOrders,
- makerAssetFillAmount,
- {
- value: ethValue,
- from: takerAddress,
- },
- { feePercentage, feeRecipient: feeRecipientAddress },
- ),
- RevertReason.FeePercentageTooLarge,
- );
- });
- it('should fail if there is not enough ETH remaining to pay the fee', async () => {
- const ordersWithoutFee = [orderWithoutFee];
- const feeOrders: SignedOrder[] = [];
- const makerAssetFillAmount = orderWithoutFee.makerAssetAmount.dividedToIntegerBy(2);
- const ethValue = orderWithoutFee.takerAssetAmount.dividedToIntegerBy(2);
-
- const baseFeePercentage = 2;
- feePercentage = ForwarderWrapper.getPercentageOfValue(constants.PERCENTAGE_DENOMINATOR, baseFeePercentage);
- await expectTransactionFailedAsync(
- forwarderWrapper.marketBuyOrdersWithEthAsync(
- ordersWithoutFee,
- feeOrders,
- makerAssetFillAmount,
- {
- value: ethValue,
- from: takerAddress,
- },
- { feePercentage, feeRecipient: feeRecipientAddress },
- ),
- RevertReason.InsufficientEthRemaining,
- );
- });
- });
- describe('withdrawAsset', () => {
- it('should allow owner to withdraw ERC20 tokens', async () => {
- const zrxWithdrawAmount = erc20Balances[forwarderContract.address][zrxToken.address];
- await forwarderWrapper.withdrawAssetAsync(zrxAssetData, zrxWithdrawAmount, { from: owner });
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances[owner][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[owner][zrxToken.address].plus(zrxWithdrawAmount),
- );
- expect(newBalances[forwarderContract.address][zrxToken.address]).to.be.bignumber.equal(
- erc20Balances[forwarderContract.address][zrxToken.address].minus(zrxWithdrawAmount),
- );
- });
- it('should revert if not called by owner', async () => {
- const zrxWithdrawAmount = erc20Balances[forwarderContract.address][zrxToken.address];
- await expectTransactionFailedAsync(
- forwarderWrapper.withdrawAssetAsync(zrxAssetData, zrxWithdrawAmount, { from: makerAddress }),
- RevertReason.OnlyContractOwner,
- );
- });
- });
-});
-// tslint:disable:max-file-line-count
-// tslint:enable:no-unnecessary-type-assertion
diff --git a/packages/contracts/test/extensions/order_validator.ts b/packages/contracts/test/extensions/order_validator.ts
deleted file mode 100644
index 37bd1b0e2..000000000
--- a/packages/contracts/test/extensions/order_validator.ts
+++ /dev/null
@@ -1,600 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
-import { SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-import * as _ from 'lodash';
-
-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';
-import { ERC721Wrapper } from '../utils/erc721_wrapper';
-import { ExchangeWrapper } from '../utils/exchange_wrapper';
-import { OrderFactory } from '../utils/order_factory';
-import { OrderStatus } from '../utils/types';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-describe('OrderValidator', () => {
- let makerAddress: string;
- let owner: string;
- let takerAddress: string;
- let erc20AssetData: string;
- let erc721AssetData: string;
-
- let erc20Token: DummyERC20TokenContract;
- let zrxToken: DummyERC20TokenContract;
- let erc721Token: DummyERC721TokenContract;
- let exchange: ExchangeContract;
- let orderValidator: OrderValidatorContract;
- let erc20Proxy: ERC20ProxyContract;
- let erc721Proxy: ERC721ProxyContract;
-
- let signedOrder: SignedOrder;
- let signedOrder2: SignedOrder;
- let orderFactory: OrderFactory;
-
- const tokenId = new BigNumber(123456789);
- const tokenId2 = new BigNumber(987654321);
- const ERC721_BALANCE = new BigNumber(1);
- const ERC721_ALLOWANCE = new BigNumber(1);
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
-
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- const usedAddresses = ([owner, makerAddress, takerAddress] = _.slice(accounts, 0, 3));
-
- const erc20Wrapper = new ERC20Wrapper(provider, usedAddresses, owner);
- const erc721Wrapper = new ERC721Wrapper(provider, usedAddresses, owner);
-
- const numDummyErc20ToDeploy = 2;
- [erc20Token, zrxToken] = await erc20Wrapper.deployDummyTokensAsync(
- numDummyErc20ToDeploy,
- constants.DUMMY_TOKEN_DECIMALS,
- );
- erc20Proxy = await erc20Wrapper.deployProxyAsync();
-
- [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
- erc721Proxy = await erc721Wrapper.deployProxyAsync();
-
- const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
- exchange = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
- provider,
- txDefaults,
- zrxAssetData,
- );
- const exchangeWrapper = new ExchangeWrapper(exchange, provider);
- await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, owner);
- await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, owner);
-
- orderValidator = await OrderValidatorContract.deployFrom0xArtifactAsync(
- artifacts.OrderValidator,
- provider,
- txDefaults,
- exchange.address,
- zrxAssetData,
- );
-
- erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20Token.address);
- erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, tokenId);
- const defaultOrderParams = {
- ...constants.STATIC_ORDER_PARAMS,
- exchangeAddress: exchange.address,
- makerAddress,
- feeRecipientAddress: constants.NULL_ADDRESS,
- makerAssetData: erc20AssetData,
- takerAssetData: erc721AssetData,
- };
- const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(makerAddress)];
- orderFactory = new OrderFactory(privateKey, defaultOrderParams);
- });
-
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
-
- describe('getBalanceAndAllowance', () => {
- describe('getERC721TokenOwner', async () => {
- it('should return the null address when tokenId is not owned', async () => {
- const tokenOwner = await orderValidator.getERC721TokenOwner.callAsync(makerAddress, tokenId);
- expect(tokenOwner).to.be.equal(constants.NULL_ADDRESS);
- });
- it('should return the owner address when tokenId is owned', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const tokenOwner = await orderValidator.getERC721TokenOwner.callAsync(erc721Token.address, tokenId);
- expect(tokenOwner).to.be.equal(makerAddress);
- });
- });
- describe('ERC20 assetData', () => {
- it('should return the correct balances and allowances when both values are 0', async () => {
- const [newBalance, newAllowance] = await orderValidator.getBalanceAndAllowance.callAsync(
- makerAddress,
- erc20AssetData,
- );
- expect(constants.ZERO_AMOUNT).to.be.bignumber.equal(newBalance);
- expect(constants.ZERO_AMOUNT).to.be.bignumber.equal(newAllowance);
- });
- it('should return the correct balance and allowance when both values are non-zero', async () => {
- const balance = new BigNumber(123);
- const allowance = new BigNumber(456);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.setBalance.sendTransactionAsync(makerAddress, balance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, allowance, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const [newBalance, newAllowance] = await orderValidator.getBalanceAndAllowance.callAsync(
- makerAddress,
- erc20AssetData,
- );
- expect(balance).to.be.bignumber.equal(newBalance);
- expect(allowance).to.be.bignumber.equal(newAllowance);
- });
- });
- describe('ERC721 assetData', () => {
- it('should return a balance of 0 when the tokenId is not owned by target', async () => {
- const [newBalance] = await orderValidator.getBalanceAndAllowance.callAsync(
- makerAddress,
- erc721AssetData,
- );
- expect(newBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should return an allowance of 0 when no approval is set', async () => {
- const [, newAllowance] = await orderValidator.getBalanceAndAllowance.callAsync(
- makerAddress,
- erc721AssetData,
- );
- expect(newAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should return a balance of 1 when the tokenId is owned by target', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const [newBalance] = await orderValidator.getBalanceAndAllowance.callAsync(
- makerAddress,
- erc721AssetData,
- );
- expect(newBalance).to.be.bignumber.equal(ERC721_BALANCE);
- });
- it('should return an allowance of 1 when ERC721Proxy is approved for all', async () => {
- const isApproved = true;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const [, newAllowance] = await orderValidator.getBalanceAndAllowance.callAsync(
- makerAddress,
- erc721AssetData,
- );
- expect(newAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
- });
- it('should return an allowance of 1 when ERC721Proxy is approved for specific tokenId', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const [, newAllowance] = await orderValidator.getBalanceAndAllowance.callAsync(
- makerAddress,
- erc721AssetData,
- );
- expect(newAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
- });
- });
- });
- describe('getBalancesAndAllowances', () => {
- it('should return the correct balances and allowances when all values are 0', async () => {
- const [
- [erc20Balance, erc721Balance],
- [erc20Allowance, erc721Allowance],
- ] = await orderValidator.getBalancesAndAllowances.callAsync(makerAddress, [
- erc20AssetData,
- erc721AssetData,
- ]);
- expect(erc20Balance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(erc721Balance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(erc20Allowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(erc721Allowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should return the correct balances and allowances when balances and allowances are non-zero', async () => {
- const balance = new BigNumber(123);
- const allowance = new BigNumber(456);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.setBalance.sendTransactionAsync(makerAddress, balance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, allowance, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.mint.sendTransactionAsync(makerAddress, tokenId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const [
- [erc20Balance, erc721Balance],
- [erc20Allowance, erc721Allowance],
- ] = await orderValidator.getBalancesAndAllowances.callAsync(makerAddress, [
- erc20AssetData,
- erc721AssetData,
- ]);
- expect(erc20Balance).to.be.bignumber.equal(balance);
- expect(erc721Balance).to.be.bignumber.equal(ERC721_BALANCE);
- expect(erc20Allowance).to.be.bignumber.equal(allowance);
- expect(erc721Allowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
- });
- });
- describe('getTraderInfo', () => {
- beforeEach(async () => {
- signedOrder = await orderFactory.newSignedOrderAsync();
- });
- it('should return the correct info when no balances or allowances are set', async () => {
- const traderInfo = await orderValidator.getTraderInfo.callAsync(signedOrder, takerAddress);
- expect(traderInfo.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should return the correct info when balances and allowances are set', async () => {
- const makerBalance = new BigNumber(123);
- const makerAllowance = new BigNumber(456);
- const makerZrxBalance = new BigNumber(789);
- const takerZrxAllowance = new BigNumber(987);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.setBalance.sendTransactionAsync(makerAddress, makerBalance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, makerAllowance, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.setBalance.sendTransactionAsync(makerAddress, makerZrxBalance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, takerZrxAllowance, {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const traderInfo = await orderValidator.getTraderInfo.callAsync(signedOrder, takerAddress);
- expect(traderInfo.makerBalance).to.be.bignumber.equal(makerBalance);
- expect(traderInfo.makerAllowance).to.be.bignumber.equal(makerAllowance);
- expect(traderInfo.takerBalance).to.be.bignumber.equal(ERC721_BALANCE);
- expect(traderInfo.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
- expect(traderInfo.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
- expect(traderInfo.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
- });
- });
- describe('getTradersInfo', () => {
- beforeEach(async () => {
- signedOrder = await orderFactory.newSignedOrderAsync();
- signedOrder2 = await orderFactory.newSignedOrderAsync({
- takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, tokenId2),
- });
- });
- it('should return the correct info when no balances or allowances have been set', async () => {
- const orders = [signedOrder, signedOrder2];
- const takers = [takerAddress, takerAddress];
- const [traderInfo1, traderInfo2] = await orderValidator.getTradersInfo.callAsync(orders, takers);
- expect(traderInfo1.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should return the correct info when balances and allowances are set', async () => {
- const makerBalance = new BigNumber(123);
- const makerAllowance = new BigNumber(456);
- const makerZrxBalance = new BigNumber(789);
- const takerZrxAllowance = new BigNumber(987);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.setBalance.sendTransactionAsync(makerAddress, makerBalance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, makerAllowance, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.setBalance.sendTransactionAsync(makerAddress, makerZrxBalance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, takerZrxAllowance, {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const isApproved = true;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId2),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const orders = [signedOrder, signedOrder2];
- const takers = [takerAddress, takerAddress];
- const [traderInfo1, traderInfo2] = await orderValidator.getTradersInfo.callAsync(orders, takers);
-
- expect(traderInfo1.makerBalance).to.be.bignumber.equal(makerBalance);
- expect(traderInfo1.makerAllowance).to.be.bignumber.equal(makerAllowance);
- expect(traderInfo1.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
- expect(traderInfo1.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
- expect(traderInfo1.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
- expect(traderInfo2.makerBalance).to.be.bignumber.equal(makerBalance);
- expect(traderInfo2.makerAllowance).to.be.bignumber.equal(makerAllowance);
- expect(traderInfo2.takerBalance).to.be.bignumber.equal(ERC721_BALANCE);
- expect(traderInfo2.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
- expect(traderInfo2.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
- expect(traderInfo2.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
- });
- });
- describe('getOrderAndTraderInfo', () => {
- beforeEach(async () => {
- signedOrder = await orderFactory.newSignedOrderAsync();
- });
- it('should return the correct info when no balances or allowances are set', async () => {
- const [orderInfo, traderInfo] = await orderValidator.getOrderAndTraderInfo.callAsync(
- signedOrder,
- takerAddress,
- );
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FILLABLE);
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should return the correct info when balances and allowances are set', async () => {
- const makerBalance = new BigNumber(123);
- const makerAllowance = new BigNumber(456);
- const makerZrxBalance = new BigNumber(789);
- const takerZrxAllowance = new BigNumber(987);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.setBalance.sendTransactionAsync(makerAddress, makerBalance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, makerAllowance, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.setBalance.sendTransactionAsync(makerAddress, makerZrxBalance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, takerZrxAllowance, {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.approve.sendTransactionAsync(erc721Proxy.address, tokenId, {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const [orderInfo, traderInfo] = await orderValidator.getOrderAndTraderInfo.callAsync(
- signedOrder,
- takerAddress,
- );
- const expectedOrderHash = orderHashUtils.getOrderHashHex(signedOrder);
- expect(orderInfo.orderStatus).to.be.equal(OrderStatus.FILLABLE);
- expect(orderInfo.orderHash).to.be.equal(expectedOrderHash);
- expect(orderInfo.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.makerBalance).to.be.bignumber.equal(makerBalance);
- expect(traderInfo.makerAllowance).to.be.bignumber.equal(makerAllowance);
- expect(traderInfo.takerBalance).to.be.bignumber.equal(ERC721_BALANCE);
- expect(traderInfo.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
- expect(traderInfo.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
- expect(traderInfo.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
- });
- });
- describe('getOrdersAndTradersInfo', () => {
- beforeEach(async () => {
- signedOrder = await orderFactory.newSignedOrderAsync();
- signedOrder2 = await orderFactory.newSignedOrderAsync({
- takerAssetData: assetDataUtils.encodeERC721AssetData(erc721Token.address, tokenId2),
- });
- });
- it('should return the correct info when no balances or allowances have been set', async () => {
- const orders = [signedOrder, signedOrder2];
- const takers = [takerAddress, takerAddress];
- const [
- [orderInfo1, orderInfo2],
- [traderInfo1, traderInfo2],
- ] = await orderValidator.getOrdersAndTradersInfo.callAsync(orders, takers);
- const expectedOrderHash1 = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedOrderHash2 = orderHashUtils.getOrderHashHex(signedOrder2);
- expect(orderInfo1.orderStatus).to.be.equal(OrderStatus.FILLABLE);
- expect(orderInfo1.orderHash).to.be.equal(expectedOrderHash1);
- expect(orderInfo1.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(orderInfo2.orderStatus).to.be.equal(OrderStatus.FILLABLE);
- expect(orderInfo2.orderHash).to.be.equal(expectedOrderHash2);
- expect(orderInfo2.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.makerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.makerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.makerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- });
- it('should return the correct info when balances and allowances are set', async () => {
- const makerBalance = new BigNumber(123);
- const makerAllowance = new BigNumber(456);
- const makerZrxBalance = new BigNumber(789);
- const takerZrxAllowance = new BigNumber(987);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.setBalance.sendTransactionAsync(makerAddress, makerBalance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Token.approve.sendTransactionAsync(erc20Proxy.address, makerAllowance, {
- from: makerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.setBalance.sendTransactionAsync(makerAddress, makerZrxBalance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.approve.sendTransactionAsync(erc20Proxy.address, takerZrxAllowance, {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const isApproved = true;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.setApprovalForAll.sendTransactionAsync(erc721Proxy.address, isApproved, {
- from: takerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Token.mint.sendTransactionAsync(takerAddress, tokenId2),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const orders = [signedOrder, signedOrder2];
- const takers = [takerAddress, takerAddress];
- const [
- [orderInfo1, orderInfo2],
- [traderInfo1, traderInfo2],
- ] = await orderValidator.getOrdersAndTradersInfo.callAsync(orders, takers);
- const expectedOrderHash1 = orderHashUtils.getOrderHashHex(signedOrder);
- const expectedOrderHash2 = orderHashUtils.getOrderHashHex(signedOrder2);
- expect(orderInfo1.orderStatus).to.be.equal(OrderStatus.FILLABLE);
- expect(orderInfo1.orderHash).to.be.equal(expectedOrderHash1);
- expect(orderInfo1.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(orderInfo2.orderStatus).to.be.equal(OrderStatus.FILLABLE);
- expect(orderInfo2.orderHash).to.be.equal(expectedOrderHash2);
- expect(orderInfo2.orderTakerAssetFilledAmount).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.makerBalance).to.be.bignumber.equal(makerBalance);
- expect(traderInfo1.makerAllowance).to.be.bignumber.equal(makerAllowance);
- expect(traderInfo1.takerBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
- expect(traderInfo1.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
- expect(traderInfo1.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo1.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
- expect(traderInfo2.makerBalance).to.be.bignumber.equal(makerBalance);
- expect(traderInfo2.makerAllowance).to.be.bignumber.equal(makerAllowance);
- expect(traderInfo2.takerBalance).to.be.bignumber.equal(ERC721_BALANCE);
- expect(traderInfo2.takerAllowance).to.be.bignumber.equal(ERC721_ALLOWANCE);
- expect(traderInfo2.makerZrxBalance).to.be.bignumber.equal(makerZrxBalance);
- expect(traderInfo2.makerZrxAllowance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerZrxBalance).to.be.bignumber.equal(constants.ZERO_AMOUNT);
- expect(traderInfo2.takerZrxAllowance).to.be.bignumber.equal(takerZrxAllowance);
- });
- });
-});
-// tslint:disable:max-file-line-count
diff --git a/packages/contracts/test/global_hooks.ts b/packages/contracts/test/global_hooks.ts
deleted file mode 100644
index 2e9ac9e21..000000000
--- a/packages/contracts/test/global_hooks.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { env, EnvVars } from '@0x/dev-utils';
-
-import { coverage } from './utils/coverage';
-import { profiler } from './utils/profiler';
-
-after('generate coverage report', async () => {
- if (env.parseBoolean(EnvVars.SolidityCoverage)) {
- const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
- await coverageSubprovider.writeCoverageAsync();
- }
- if (env.parseBoolean(EnvVars.SolidityProfiler)) {
- const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
- await profilerSubprovider.writeProfilerOutputAsync();
- }
-});
diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts
deleted file mode 100644
index b1a389f00..000000000
--- a/packages/contracts/test/libraries/lib_bytes.ts
+++ /dev/null
@@ -1,871 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { generatePseudoRandomSalt } from '@0x/order-utils';
-import { RevertReason } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import BN = require('bn.js');
-import * as chai from 'chai';
-import ethUtil = require('ethereumjs-util');
-import * as _ from 'lodash';
-
-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';
-import { typeEncodingUtils } from '../utils/type_encoding_utils';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-// BUG: Ideally we would use Buffer.from(memory).toString('hex')
-// https://github.com/Microsoft/TypeScript/issues/23155
-const toHex = (buf: Uint8Array): string => buf.reduce((a, v) => a + ('00' + v.toString(16)).slice(-2), '0x');
-
-const fromHex = (str: string): Uint8Array => Uint8Array.from(Buffer.from(str.slice(2), 'hex'));
-
-describe('LibBytes', () => {
- let libBytes: TestLibBytesContract;
- const byteArrayShorterThan32Bytes = '0x012345';
- const byteArrayShorterThan20Bytes = byteArrayShorterThan32Bytes;
- const byteArrayLongerThan32Bytes =
- '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
- const byteArrayLongerThan32BytesFirstBytesSwapped =
- '0x2301456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
- const byteArrayLongerThan32BytesLastBytesSwapped =
- '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abefcd';
- let testAddress: string;
- let testAddressB: string;
- const testBytes32 = '0x102030405060708090a0b0c0d0e0f0102030405060708090a0b0c0d0e0f01020';
- const testBytes32B = '0x534877abd8443578526845cdfef020047528759477fedef87346527659aced32';
- const testUint256 = new BigNumber(testBytes32, 16);
- const testUint256B = new BigNumber(testBytes32B, 16);
- const testBytes4 = '0xabcdef12';
- const testByte = '0xab';
- let shortData: string;
- let shortTestBytes: string;
- let shortTestBytesAsBuffer: Buffer;
- let wordOfData: string;
- let wordOfTestBytes: string;
- let wordOfTestBytesAsBuffer: Buffer;
- let longData: string;
- let longTestBytes: string;
- let longTestBytesAsBuffer: Buffer;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- // Setup accounts & addresses
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- testAddress = accounts[1];
- testAddressB = accounts[2];
- // Deploy LibBytes
- libBytes = await TestLibBytesContract.deployFrom0xArtifactAsync(artifacts.TestLibBytes, provider, txDefaults);
- // Verify lengths of test data
- const byteArrayShorterThan32BytesLength = ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength;
- expect(byteArrayShorterThan32BytesLength).to.be.lessThan(32);
- const byteArrayLongerThan32BytesLength = ethUtil.toBuffer(byteArrayLongerThan32Bytes).byteLength;
- expect(byteArrayLongerThan32BytesLength).to.be.greaterThan(32);
- const testBytes32Length = ethUtil.toBuffer(testBytes32).byteLength;
- expect(testBytes32Length).to.be.equal(32);
- // Create short test bytes
- shortData = '0xffffaa';
- const encodedShortData = ethUtil.toBuffer(shortData);
- const shortDataLength = new BigNumber(encodedShortData.byteLength);
- const encodedShortDataLength = typeEncodingUtils.encodeUint256(shortDataLength);
- shortTestBytesAsBuffer = Buffer.concat([encodedShortDataLength, encodedShortData]);
- shortTestBytes = ethUtil.bufferToHex(shortTestBytesAsBuffer);
- // Create test bytes one word in length
- wordOfData = ethUtil.bufferToHex(typeEncodingUtils.encodeUint256(generatePseudoRandomSalt()));
- const encodedWordOfData = ethUtil.toBuffer(wordOfData);
- const wordOfDataLength = new BigNumber(encodedWordOfData.byteLength);
- const encodedWordOfDataLength = typeEncodingUtils.encodeUint256(wordOfDataLength);
- wordOfTestBytesAsBuffer = Buffer.concat([encodedWordOfDataLength, encodedWordOfData]);
- wordOfTestBytes = ethUtil.bufferToHex(wordOfTestBytesAsBuffer);
- // Create long test bytes (combines short test bytes with word of test bytes)
- longData = ethUtil.bufferToHex(Buffer.concat([encodedShortData, encodedWordOfData]));
- const longDataLength = new BigNumber(encodedShortData.byteLength + encodedWordOfData.byteLength);
- const encodedLongDataLength = typeEncodingUtils.encodeUint256(longDataLength);
- longTestBytesAsBuffer = Buffer.concat([encodedLongDataLength, encodedShortData, encodedWordOfData]);
- longTestBytes = ethUtil.bufferToHex(longTestBytesAsBuffer);
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
-
- describe('popLastByte', () => {
- it('should revert if length is 0', async () => {
- return expectContractCallFailedAsync(
- libBytes.publicPopLastByte.callAsync(constants.NULL_BYTES),
- RevertReason.LibBytesGreaterThanZeroLengthRequired,
- );
- });
- it('should pop the last byte from the input and return it when array holds more than 1 byte', async () => {
- const [newBytes, poppedByte] = await libBytes.publicPopLastByte.callAsync(byteArrayLongerThan32Bytes);
- const expectedNewBytes = byteArrayLongerThan32Bytes.slice(0, -2);
- const expectedPoppedByte = `0x${byteArrayLongerThan32Bytes.slice(-2)}`;
- expect(newBytes).to.equal(expectedNewBytes);
- expect(poppedByte).to.equal(expectedPoppedByte);
- });
- it('should pop the last byte from the input and return it when array is exactly 1 byte', async () => {
- const [newBytes, poppedByte] = await libBytes.publicPopLastByte.callAsync(testByte);
- const expectedNewBytes = '0x';
- expect(newBytes).to.equal(expectedNewBytes);
- return expect(poppedByte).to.be.equal(testByte);
- });
- });
-
- describe('popLast20Bytes', () => {
- it('should revert if length is less than 20', async () => {
- return expectContractCallFailedAsync(
- libBytes.publicPopLast20Bytes.callAsync(byteArrayShorterThan20Bytes),
- RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
- );
- });
- it('should pop the last 20 bytes from the input and return it when array holds more than 20 bytes', async () => {
- const [newBytes, poppedAddress] = await libBytes.publicPopLast20Bytes.callAsync(byteArrayLongerThan32Bytes);
- const expectedNewBytes = byteArrayLongerThan32Bytes.slice(0, -40);
- const expectedPoppedAddress = `0x${byteArrayLongerThan32Bytes.slice(-40)}`;
- expect(newBytes).to.equal(expectedNewBytes);
- expect(poppedAddress).to.equal(expectedPoppedAddress);
- });
- it('should pop the last 20 bytes from the input and return it when array is exactly 20 bytes', async () => {
- const [newBytes, poppedAddress] = await libBytes.publicPopLast20Bytes.callAsync(testAddress);
- const expectedNewBytes = '0x';
- const expectedPoppedAddress = testAddress;
- expect(newBytes).to.equal(expectedNewBytes);
- expect(poppedAddress).to.equal(expectedPoppedAddress);
- });
- });
-
- describe('equals', () => {
- it('should return true if byte arrays are equal (both arrays < 32 bytes)', async () => {
- const isEqual = await libBytes.publicEquals.callAsync(
- byteArrayShorterThan32Bytes,
- byteArrayShorterThan32Bytes,
- );
- return expect(isEqual).to.be.true();
- });
- it('should return true if byte arrays are equal (both arrays > 32 bytes)', async () => {
- const isEqual = await libBytes.publicEquals.callAsync(
- byteArrayLongerThan32Bytes,
- byteArrayLongerThan32Bytes,
- );
- return expect(isEqual).to.be.true();
- });
- it('should return false if byte arrays are not equal (first array < 32 bytes, second array > 32 bytes)', async () => {
- const isEqual = await libBytes.publicEquals.callAsync(
- byteArrayShorterThan32Bytes,
- byteArrayLongerThan32Bytes,
- );
- return expect(isEqual).to.be.false();
- });
- it('should return false if byte arrays are not equal (first array > 32 bytes, second array < 32 bytes)', async () => {
- const isEqual = await libBytes.publicEquals.callAsync(
- byteArrayLongerThan32Bytes,
- byteArrayShorterThan32Bytes,
- );
- return expect(isEqual).to.be.false();
- });
- it('should return false if byte arrays are not equal (same length, but a byte in first word differs)', async () => {
- const isEqual = await libBytes.publicEquals.callAsync(
- byteArrayLongerThan32BytesFirstBytesSwapped,
- byteArrayLongerThan32Bytes,
- );
- return expect(isEqual).to.be.false();
- });
- it('should return false if byte arrays are not equal (same length, but a byte in last word differs)', async () => {
- const isEqual = await libBytes.publicEquals.callAsync(
- byteArrayLongerThan32BytesLastBytesSwapped,
- byteArrayLongerThan32Bytes,
- );
- return expect(isEqual).to.be.false();
- });
-
- describe('should ignore trailing data', () => {
- it('should return true when both < 32 bytes', async () => {
- const isEqual = await libBytes.publicEqualsPop1.callAsync('0x0102', '0x0103');
- return expect(isEqual).to.be.true();
- });
- });
- });
-
- describe('deepCopyBytes', () => {
- it('should revert if dest is shorter than source', async () => {
- return expectContractCallFailedAsync(
- libBytes.publicDeepCopyBytes.callAsync(byteArrayShorterThan32Bytes, byteArrayLongerThan32Bytes),
- RevertReason.LibBytesGreaterOrEqualToSourceBytesLengthRequired,
- );
- });
- it('should overwrite dest with source if source and dest have equal length', async () => {
- const zeroedByteArrayLongerThan32Bytes = `0x${_.repeat('0', byteArrayLongerThan32Bytes.length - 2)}`;
- const zeroedBytesAfterCopy = await libBytes.publicDeepCopyBytes.callAsync(
- zeroedByteArrayLongerThan32Bytes,
- byteArrayLongerThan32Bytes,
- );
- return expect(zeroedBytesAfterCopy).to.be.equal(byteArrayLongerThan32Bytes);
- });
- it('should overwrite the leftmost len(source) bytes of dest if dest is larger than source', async () => {
- const zeroedByteArrayLongerThan32Bytes = `0x${_.repeat('0', byteArrayLongerThan32Bytes.length * 2)}`;
- const zeroedBytesAfterCopy = await libBytes.publicDeepCopyBytes.callAsync(
- zeroedByteArrayLongerThan32Bytes,
- byteArrayLongerThan32Bytes,
- );
- const copiedBytes = zeroedBytesAfterCopy.slice(0, byteArrayLongerThan32Bytes.length);
- return expect(copiedBytes).to.be.equal(byteArrayLongerThan32Bytes);
- });
- it('should not overwrite the rightmost bytes of dest if dest is larger than source', async () => {
- const zeroedByteArrayLongerThan32Bytes = `0x${_.repeat('0', byteArrayLongerThan32Bytes.length * 2)}`;
- const zeroedBytesAfterCopy = await libBytes.publicDeepCopyBytes.callAsync(
- zeroedByteArrayLongerThan32Bytes,
- byteArrayLongerThan32Bytes,
- );
- const expectedNotCopiedBytes = zeroedByteArrayLongerThan32Bytes.slice(byteArrayLongerThan32Bytes.length);
- const notCopiedBytes = zeroedBytesAfterCopy.slice(byteArrayLongerThan32Bytes.length);
- return expect(notCopiedBytes).to.be.equal(expectedNotCopiedBytes);
- });
- });
-
- describe('readAddress', () => {
- it('should successfully read address when the address takes up the whole array', async () => {
- const byteArray = ethUtil.addHexPrefix(testAddress);
- const testAddressOffset = new BigNumber(0);
- const address = await libBytes.publicReadAddress.callAsync(byteArray, testAddressOffset);
- return expect(address).to.be.equal(testAddress);
- });
- it('should successfully read address when it is offset in the array', async () => {
- const addressByteArrayBuffer = ethUtil.toBuffer(testAddress);
- const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
- const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, addressByteArrayBuffer]);
- const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
- const testAddressOffset = new BigNumber(prefixByteArrayBuffer.byteLength);
- const address = await libBytes.publicReadAddress.callAsync(combinedByteArray, testAddressOffset);
- return expect(address).to.be.equal(testAddress);
- });
- it('should fail if the byte array is too short to hold an address', async () => {
- const shortByteArray = '0xabcdef';
- const offset = new BigNumber(0);
- return expectContractCallFailedAsync(
- libBytes.publicReadAddress.callAsync(shortByteArray, offset),
- RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
- );
- });
- it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
- const byteArray = testAddress;
- const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
- return expectContractCallFailedAsync(
- libBytes.publicReadAddress.callAsync(byteArray, badOffset),
- RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
- );
- });
- });
-
- describe('writeAddress', () => {
- it('should successfully write address when the address takes up the whole array', async () => {
- const byteArray = testAddress;
- const testAddressOffset = new BigNumber(0);
- const newByteArray = await libBytes.publicWriteAddress.callAsync(
- byteArray,
- testAddressOffset,
- testAddressB,
- );
- return expect(newByteArray).to.be.equal(testAddressB);
- });
- it('should successfully write address when it is offset in the array', async () => {
- const addressByteArrayBuffer = ethUtil.toBuffer(testAddress);
- const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
- const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, addressByteArrayBuffer]);
- const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
- const testAddressOffset = new BigNumber(prefixByteArrayBuffer.byteLength);
- const newByteArray = await libBytes.publicWriteAddress.callAsync(
- combinedByteArray,
- testAddressOffset,
- testAddressB,
- );
- const newByteArrayBuffer = ethUtil.toBuffer(newByteArray);
- const addressFromOffsetBuffer = newByteArrayBuffer.slice(prefixByteArrayBuffer.byteLength);
- const addressFromOffset = ethUtil.addHexPrefix(ethUtil.bufferToHex(addressFromOffsetBuffer));
- return expect(addressFromOffset).to.be.equal(testAddressB);
- });
- it('should fail if the byte array is too short to hold an address', async () => {
- const offset = new BigNumber(0);
- return expectContractCallFailedAsync(
- libBytes.publicWriteAddress.callAsync(byteArrayShorterThan20Bytes, offset, testAddress),
- RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
- );
- });
- it('should fail if the length between the offset and end of the byte array is too short to hold an address', async () => {
- const byteArray = byteArrayLongerThan32Bytes;
- const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
- return expectContractCallFailedAsync(
- libBytes.publicWriteAddress.callAsync(byteArray, badOffset, testAddress),
- RevertReason.LibBytesGreaterOrEqualTo20LengthRequired,
- );
- });
- });
-
- describe('readBytes32', () => {
- it('should successfully read bytes32 when the bytes32 takes up the whole array', async () => {
- const testBytes32Offset = new BigNumber(0);
- const bytes32 = await libBytes.publicReadBytes32.callAsync(testBytes32, testBytes32Offset);
- return expect(bytes32).to.be.equal(testBytes32);
- });
- it('should successfully read bytes32 when it is offset in the array', async () => {
- const bytes32ByteArrayBuffer = ethUtil.toBuffer(testBytes32);
- const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
- const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes32ByteArrayBuffer]);
- const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
- const testBytes32Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
- const bytes32 = await libBytes.publicReadBytes32.callAsync(combinedByteArray, testBytes32Offset);
- return expect(bytes32).to.be.equal(testBytes32);
- });
- it('should fail if the byte array is too short to hold a bytes32', async () => {
- const offset = new BigNumber(0);
- return expectContractCallFailedAsync(
- libBytes.publicReadBytes32.callAsync(byteArrayShorterThan32Bytes, offset),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
- const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength);
- return expectContractCallFailedAsync(
- libBytes.publicReadBytes32.callAsync(testBytes32, badOffset),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- });
-
- describe('writeBytes32', () => {
- it('should successfully write bytes32 when the address takes up the whole array', async () => {
- const byteArray = testBytes32;
- const testBytes32Offset = new BigNumber(0);
- const newByteArray = await libBytes.publicWriteBytes32.callAsync(
- byteArray,
- testBytes32Offset,
- testBytes32B,
- );
- return expect(newByteArray).to.be.equal(testBytes32B);
- });
- it('should successfully write bytes32 when it is offset in the array', async () => {
- const bytes32ByteArrayBuffer = ethUtil.toBuffer(testBytes32);
- const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
- const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes32ByteArrayBuffer]);
- const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
- const testBytes32Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
- const newByteArray = await libBytes.publicWriteBytes32.callAsync(
- combinedByteArray,
- testBytes32Offset,
- testBytes32B,
- );
- const newByteArrayBuffer = ethUtil.toBuffer(newByteArray);
- const bytes32FromOffsetBuffer = newByteArrayBuffer.slice(prefixByteArrayBuffer.byteLength);
- const bytes32FromOffset = ethUtil.addHexPrefix(ethUtil.bufferToHex(bytes32FromOffsetBuffer));
- return expect(bytes32FromOffset).to.be.equal(testBytes32B);
- });
- it('should fail if the byte array is too short to hold a bytes32', async () => {
- const offset = new BigNumber(0);
- return expectContractCallFailedAsync(
- libBytes.publicWriteBytes32.callAsync(byteArrayShorterThan32Bytes, offset, testBytes32),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- it('should fail if the length between the offset and end of the byte array is too short to hold a bytes32', async () => {
- const byteArray = byteArrayLongerThan32Bytes;
- const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
- return expectContractCallFailedAsync(
- libBytes.publicWriteBytes32.callAsync(byteArray, badOffset, testBytes32),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- });
-
- describe('readUint256', () => {
- it('should successfully read uint256 when the uint256 takes up the whole array', async () => {
- const formattedTestUint256 = new BN(testUint256.toString(10));
- const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256);
- const byteArray = ethUtil.bufferToHex(testUint256AsBuffer);
- const testUint256Offset = new BigNumber(0);
- const uint256 = await libBytes.publicReadUint256.callAsync(byteArray, testUint256Offset);
- return expect(uint256).to.bignumber.equal(testUint256);
- });
- it('should successfully read uint256 when it is offset in the array', async () => {
- const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
- const formattedTestUint256 = new BN(testUint256.toString(10));
- const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256);
- const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, testUint256AsBuffer]);
- const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
- const testUint256Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
- const uint256 = await libBytes.publicReadUint256.callAsync(combinedByteArray, testUint256Offset);
- return expect(uint256).to.bignumber.equal(testUint256);
- });
- it('should fail if the byte array is too short to hold a uint256', async () => {
- const offset = new BigNumber(0);
- return expectContractCallFailedAsync(
- libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => {
- const formattedTestUint256 = new BN(testUint256.toString(10));
- const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256);
- const byteArray = ethUtil.bufferToHex(testUint256AsBuffer);
- const badOffset = new BigNumber(testUint256AsBuffer.byteLength);
- return expectContractCallFailedAsync(
- libBytes.publicReadUint256.callAsync(byteArray, badOffset),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- });
-
- describe('writeUint256', () => {
- it('should successfully write uint256 when the address takes up the whole array', async () => {
- const byteArray = testBytes32;
- const testUint256Offset = new BigNumber(0);
- const newByteArray = await libBytes.publicWriteUint256.callAsync(
- byteArray,
- testUint256Offset,
- testUint256B,
- );
- const newByteArrayAsUint256 = new BigNumber(newByteArray, 16);
- return expect(newByteArrayAsUint256).to.be.bignumber.equal(testUint256B);
- });
- it('should successfully write uint256 when it is offset in the array', async () => {
- const bytes32ByteArrayBuffer = ethUtil.toBuffer(testBytes32);
- const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
- const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes32ByteArrayBuffer]);
- const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
- const testUint256Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
- const newByteArray = await libBytes.publicWriteUint256.callAsync(
- combinedByteArray,
- testUint256Offset,
- testUint256B,
- );
- const newByteArrayBuffer = ethUtil.toBuffer(newByteArray);
- const uint256FromOffsetBuffer = newByteArrayBuffer.slice(prefixByteArrayBuffer.byteLength);
- const uint256FromOffset = new BigNumber(
- ethUtil.addHexPrefix(ethUtil.bufferToHex(uint256FromOffsetBuffer)),
- 16,
- );
- return expect(uint256FromOffset).to.be.bignumber.equal(testUint256B);
- });
- it('should fail if the byte array is too short to hold a uint256', async () => {
- const offset = new BigNumber(0);
- return expectContractCallFailedAsync(
- libBytes.publicWriteUint256.callAsync(byteArrayShorterThan32Bytes, offset, testUint256),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- it('should fail if the length between the offset and end of the byte array is too short to hold a uint256', async () => {
- const byteArray = byteArrayLongerThan32Bytes;
- const badOffset = new BigNumber(ethUtil.toBuffer(byteArray).byteLength);
- return expectContractCallFailedAsync(
- libBytes.publicWriteUint256.callAsync(byteArray, badOffset, testUint256),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- });
-
- describe('readBytes4', () => {
- // AssertionError: expected promise to be rejected with an error including 'revert' but it was fulfilled with '0x08c379a0'
- it('should revert if byte array has a length < 4', async () => {
- const byteArrayLessThan4Bytes = '0x010101';
- const offset = new BigNumber(0);
- return expectContractCallFailedAsync(
- libBytes.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, offset),
- RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
- );
- });
- it('should return the first 4 bytes of a byte array of arbitrary length', async () => {
- const first4Bytes = await libBytes.publicReadBytes4.callAsync(byteArrayLongerThan32Bytes, new BigNumber(0));
- const expectedFirst4Bytes = byteArrayLongerThan32Bytes.slice(0, 10);
- expect(first4Bytes).to.equal(expectedFirst4Bytes);
- });
- it('should successfully read bytes4 when the bytes4 takes up the whole array', async () => {
- const testBytes4Offset = new BigNumber(0);
- const bytes4 = await libBytes.publicReadBytes4.callAsync(testBytes4, testBytes4Offset);
- return expect(bytes4).to.be.equal(testBytes4);
- });
- it('should successfully read bytes4 when it is offset in the array', async () => {
- const bytes4ByteArrayBuffer = ethUtil.toBuffer(testBytes4);
- const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
- const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, bytes4ByteArrayBuffer]);
- const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
- const testBytes4Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
- const bytes4 = await libBytes.publicReadBytes4.callAsync(combinedByteArray, testBytes4Offset);
- return expect(bytes4).to.be.equal(testBytes4);
- });
- it('should fail if the length between the offset and end of the byte array is too short to hold a bytes4', async () => {
- const badOffset = new BigNumber(ethUtil.toBuffer(testBytes4).byteLength);
- return expectContractCallFailedAsync(
- libBytes.publicReadBytes4.callAsync(testBytes4, badOffset),
- RevertReason.LibBytesGreaterOrEqualTo4LengthRequired,
- );
- });
- });
-
- describe('readBytesWithLength', () => {
- it('should successfully read short, nested array of bytes when it takes up the whole array', async () => {
- const testBytesOffset = new BigNumber(0);
- const bytes = await libBytes.publicReadBytesWithLength.callAsync(shortTestBytes, testBytesOffset);
- return expect(bytes).to.be.equal(shortData);
- });
- it('should successfully read short, nested array of bytes when it is offset in the array', async () => {
- const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
- const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, shortTestBytesAsBuffer]);
- const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
- const testUint256Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
- const bytes = await libBytes.publicReadBytesWithLength.callAsync(combinedByteArray, testUint256Offset);
- return expect(bytes).to.be.equal(shortData);
- });
- it('should successfully read a nested array of bytes - one word in length - when it takes up the whole array', async () => {
- const testBytesOffset = new BigNumber(0);
- const bytes = await libBytes.publicReadBytesWithLength.callAsync(wordOfTestBytes, testBytesOffset);
- return expect(bytes).to.be.equal(wordOfData);
- });
- it('should successfully read a nested array of bytes - one word in length - when it is offset in the array', async () => {
- const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
- const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, wordOfTestBytesAsBuffer]);
- const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
- const testUint256Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
- const bytes = await libBytes.publicReadBytesWithLength.callAsync(combinedByteArray, testUint256Offset);
- return expect(bytes).to.be.equal(wordOfData);
- });
- it('should successfully read long, nested array of bytes when it takes up the whole array', async () => {
- const testBytesOffset = new BigNumber(0);
- const bytes = await libBytes.publicReadBytesWithLength.callAsync(longTestBytes, testBytesOffset);
- return expect(bytes).to.be.equal(longData);
- });
- it('should successfully read long, nested array of bytes when it is offset in the array', async () => {
- const prefixByteArrayBuffer = ethUtil.toBuffer('0xabcdef');
- const combinedByteArrayBuffer = Buffer.concat([prefixByteArrayBuffer, longTestBytesAsBuffer]);
- const combinedByteArray = ethUtil.bufferToHex(combinedByteArrayBuffer);
- const testUint256Offset = new BigNumber(prefixByteArrayBuffer.byteLength);
- const bytes = await libBytes.publicReadBytesWithLength.callAsync(combinedByteArray, testUint256Offset);
- return expect(bytes).to.be.equal(longData);
- });
- it('should fail if the byte array is too short to hold the length of a nested byte array', async () => {
- // The length of the nested array is 32 bytes. By storing less than 32 bytes, a length cannot be read.
- const offset = new BigNumber(0);
- return expectContractCallFailedAsync(
- libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, offset),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- it('should fail if we store a nested byte array length, without a nested byte array', async () => {
- const offset = new BigNumber(0);
- return expectContractCallFailedAsync(
- libBytes.publicReadBytesWithLength.callAsync(testBytes32, offset),
- RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
- );
- });
- it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array', async () => {
- const badOffset = new BigNumber(ethUtil.toBuffer(byteArrayShorterThan32Bytes).byteLength);
- return expectContractCallFailedAsync(
- libBytes.publicReadBytesWithLength.callAsync(byteArrayShorterThan32Bytes, badOffset),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- it('should fail if the length between the offset and end of the byte array is too short to hold the nested byte array', async () => {
- const badOffset = new BigNumber(ethUtil.toBuffer(testBytes32).byteLength);
- return expectContractCallFailedAsync(
- libBytes.publicReadBytesWithLength.callAsync(testBytes32, badOffset),
- RevertReason.LibBytesGreaterOrEqualTo32LengthRequired,
- );
- });
- });
-
- describe('writeBytesWithLength', () => {
- it('should successfully write short, nested array of bytes when it takes up the whole array', async () => {
- const testBytesOffset = new BigNumber(0);
- const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength));
- const bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
- emptyByteArray,
- testBytesOffset,
- shortData,
- );
- const bytesRead = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
- return expect(bytesRead).to.be.equal(shortData);
- });
- it('should successfully write short, nested array of bytes when it is offset in the array', async () => {
- // Write a prefix to the array
- const prefixData = '0xabcdef';
- const prefixDataAsBuffer = ethUtil.toBuffer(prefixData);
- const prefixOffset = new BigNumber(0);
- const emptyByteArray = ethUtil.bufferToHex(
- new Buffer(prefixDataAsBuffer.byteLength + shortTestBytesAsBuffer.byteLength),
- );
- let bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
- emptyByteArray,
- prefixOffset,
- prefixData,
- );
- // Write data after prefix
- const testBytesOffset = new BigNumber(prefixDataAsBuffer.byteLength);
- bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
- bytesWritten,
- testBytesOffset,
- shortData,
- );
- // Read data after prefix and validate
- const bytes = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
- return expect(bytes).to.be.equal(shortData);
- });
- it('should successfully write a nested array of bytes - one word in length - when it takes up the whole array', async () => {
- const testBytesOffset = new BigNumber(0);
- const emptyByteArray = ethUtil.bufferToHex(new Buffer(wordOfTestBytesAsBuffer.byteLength));
- const bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
- emptyByteArray,
- testBytesOffset,
- wordOfData,
- );
- const bytesRead = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
- return expect(bytesRead).to.be.equal(wordOfData);
- });
- it('should successfully write a nested array of bytes - one word in length - when it is offset in the array', async () => {
- // Write a prefix to the array
- const prefixData = '0xabcdef';
- const prefixDataAsBuffer = ethUtil.toBuffer(prefixData);
- const prefixOffset = new BigNumber(0);
- const emptyByteArray = ethUtil.bufferToHex(
- new Buffer(prefixDataAsBuffer.byteLength + wordOfTestBytesAsBuffer.byteLength),
- );
- let bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
- emptyByteArray,
- prefixOffset,
- prefixData,
- );
- // Write data after prefix
- const testBytesOffset = new BigNumber(prefixDataAsBuffer.byteLength);
- bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
- bytesWritten,
- testBytesOffset,
- wordOfData,
- );
- // Read data after prefix and validate
- const bytes = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
- return expect(bytes).to.be.equal(wordOfData);
- });
- it('should successfully write a long, nested bytes when it takes up the whole array', async () => {
- const testBytesOffset = new BigNumber(0);
- const emptyByteArray = ethUtil.bufferToHex(new Buffer(longTestBytesAsBuffer.byteLength));
- const bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
- emptyByteArray,
- testBytesOffset,
- longData,
- );
- const bytesRead = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
- return expect(bytesRead).to.be.equal(longData);
- });
- it('should successfully write long, nested array of bytes when it is offset in the array', async () => {
- // Write a prefix to the array
- const prefixData = '0xabcdef';
- const prefixDataAsBuffer = ethUtil.toBuffer(prefixData);
- const prefixOffset = new BigNumber(0);
- const emptyByteArray = ethUtil.bufferToHex(
- new Buffer(prefixDataAsBuffer.byteLength + longTestBytesAsBuffer.byteLength),
- );
- let bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(
- emptyByteArray,
- prefixOffset,
- prefixData,
- );
- // Write data after prefix
- const testBytesOffset = new BigNumber(prefixDataAsBuffer.byteLength);
- bytesWritten = await libBytes.publicWriteBytesWithLength.callAsync(bytesWritten, testBytesOffset, longData);
- // Read data after prefix and validate
- const bytes = await libBytes.publicReadBytesWithLength.callAsync(bytesWritten, testBytesOffset);
- return expect(bytes).to.be.equal(longData);
- });
- it('should fail if the byte array is too short to hold the length of a nested byte array', async () => {
- const offset = new BigNumber(0);
- const emptyByteArray = ethUtil.bufferToHex(new Buffer(1));
- return expectContractCallFailedAsync(
- libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, offset, longData),
- RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
- );
- });
- it('should fail if the length between the offset and end of the byte array is too short to hold the length of a nested byte array', async () => {
- const emptyByteArray = ethUtil.bufferToHex(new Buffer(shortTestBytesAsBuffer.byteLength));
- const badOffset = new BigNumber(ethUtil.toBuffer(shortTestBytesAsBuffer).byteLength);
- return expectContractCallFailedAsync(
- libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, badOffset, shortData),
- RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired,
- );
- });
- });
-
- describe('memCopy', () => {
- // Create memory 0x000102...FF
- const memSize = 256;
- // tslint:disable:no-shadowed-variable
- const memory = new Uint8Array(memSize).map((_, i) => i);
- const memHex = toHex(memory);
-
- // Reference implementation to test against
- const refMemcpy = (mem: Uint8Array, dest: number, source: number, length: number): Uint8Array =>
- Uint8Array.from(mem).copyWithin(dest, source, source + length);
-
- // Test vectors: destination, source, length, job description
- type Tests = Array<[number, number, number, string]>;
-
- const test = (tests: Tests) =>
- tests.forEach(([dest, source, length, job]) =>
- it(job, async () => {
- const expected = refMemcpy(memory, dest, source, length);
- const resultStr = await libBytes.testMemcpy.callAsync(
- memHex,
- new BigNumber(dest),
- new BigNumber(source),
- new BigNumber(length),
- );
- const result = fromHex(resultStr);
- expect(result).to.deep.equal(expected);
- }),
- );
-
- test([[0, 0, 0, 'copies zero bytes with overlap']]);
-
- describe('copies forward', () =>
- test([
- [128, 0, 0, 'zero bytes'],
- [128, 0, 1, 'one byte'],
- [128, 0, 11, 'eleven bytes'],
- [128, 0, 31, 'thirty-one bytes'],
- [128, 0, 32, 'one word'],
- [128, 0, 64, 'two words'],
- [128, 0, 96, 'three words'],
- [128, 0, 33, 'one word and one byte'],
- [128, 0, 72, 'two words and eight bytes'],
- [128, 0, 100, 'three words and four bytes'],
- ]));
-
- describe('copies forward within one word', () =>
- test([
- [16, 0, 0, 'zero bytes'],
- [16, 0, 1, 'one byte'],
- [16, 0, 11, 'eleven bytes'],
- [16, 0, 16, 'sixteen bytes'],
- ]));
-
- describe('copies forward with one byte overlap', () =>
- test([
- [0, 0, 1, 'one byte'],
- [10, 0, 11, 'eleven bytes'],
- [30, 0, 31, 'thirty-one bytes'],
- [31, 0, 32, 'one word'],
- [32, 0, 33, 'one word and one byte'],
- [71, 0, 72, 'two words and eight bytes'],
- [99, 0, 100, 'three words and four bytes'],
- ]));
-
- describe('copies forward with thirty-one bytes overlap', () =>
- test([
- [0, 0, 31, 'thirty-one bytes'],
- [1, 0, 32, 'one word'],
- [2, 0, 33, 'one word and one byte'],
- [41, 0, 72, 'two words and eight bytes'],
- [69, 0, 100, 'three words and four bytes'],
- ]));
-
- describe('copies forward with one word overlap', () =>
- test([
- [0, 0, 32, 'one word'],
- [1, 0, 33, 'one word and one byte'],
- [41, 0, 72, 'two words and eight bytes'],
- [69, 0, 100, 'three words and four bytes'],
- ]));
-
- describe('copies forward with one word and one byte overlap', () =>
- test([
- [0, 0, 33, 'one word and one byte'],
- [40, 0, 72, 'two words and eight bytes'],
- [68, 0, 100, 'three words and four bytes'],
- ]));
-
- describe('copies forward with two words overlap', () =>
- test([
- [0, 0, 64, 'two words'],
- [8, 0, 72, 'two words and eight bytes'],
- [36, 0, 100, 'three words and four bytes'],
- ]));
-
- describe('copies forward within one word and one byte overlap', () =>
- test([[0, 0, 1, 'one byte'], [10, 0, 11, 'eleven bytes'], [15, 0, 16, 'sixteen bytes']]));
-
- describe('copies backward', () =>
- test([
- [0, 128, 0, 'zero bytes'],
- [0, 128, 1, 'one byte'],
- [0, 128, 11, 'eleven bytes'],
- [0, 128, 31, 'thirty-one bytes'],
- [0, 128, 32, 'one word'],
- [0, 128, 64, 'two words'],
- [0, 128, 96, 'three words'],
- [0, 128, 33, 'one word and one byte'],
- [0, 128, 72, 'two words and eight bytes'],
- [0, 128, 100, 'three words and four bytes'],
- ]));
-
- describe('copies backward within one word', () =>
- test([
- [0, 16, 0, 'zero bytes'],
- [0, 16, 1, 'one byte'],
- [0, 16, 11, 'eleven bytes'],
- [0, 16, 16, 'sixteen bytes'],
- ]));
-
- describe('copies backward with one byte overlap', () =>
- test([
- [0, 0, 1, 'one byte'],
- [0, 10, 11, 'eleven bytes'],
- [0, 30, 31, 'thirty-one bytes'],
- [0, 31, 32, 'one word'],
- [0, 32, 33, 'one word and one byte'],
- [0, 71, 72, 'two words and eight bytes'],
- [0, 99, 100, 'three words and four bytes'],
- ]));
-
- describe('copies backward with thirty-one bytes overlap', () =>
- test([
- [0, 0, 31, 'thirty-one bytes'],
- [0, 1, 32, 'one word'],
- [0, 2, 33, 'one word and one byte'],
- [0, 41, 72, 'two words and eight bytes'],
- [0, 69, 100, 'three words and four bytes'],
- ]));
-
- describe('copies backward with one word overlap', () =>
- test([
- [0, 0, 32, 'one word'],
- [0, 1, 33, 'one word and one byte'],
- [0, 41, 72, 'two words and eight bytes'],
- [0, 69, 100, 'three words and four bytes'],
- ]));
-
- describe('copies backward with one word and one byte overlap', () =>
- test([
- [0, 0, 33, 'one word and one byte'],
- [0, 40, 72, 'two words and eight bytes'],
- [0, 68, 100, 'three words and four bytes'],
- ]));
-
- describe('copies backward with two words overlap', () =>
- test([
- [0, 0, 64, 'two words'],
- [0, 8, 72, 'two words and eight bytes'],
- [0, 36, 100, 'three words and four bytes'],
- ]));
-
- describe('copies forward within one word and one byte overlap', () =>
- test([[0, 0, 1, 'one byte'], [0, 10, 11, 'eleven bytes'], [0, 15, 16, 'sixteen bytes']]));
- });
-});
-// tslint:disable:max-file-line-count
diff --git a/packages/contracts/test/multisig/asset_proxy_owner.ts b/packages/contracts/test/multisig/asset_proxy_owner.ts
deleted file mode 100644
index 087152316..000000000
--- a/packages/contracts/test/multisig/asset_proxy_owner.ts
+++ /dev/null
@@ -1,498 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { RevertReason } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-import { LogWithDecodedArgs } from 'ethereum-types';
-
-import {
- AssetProxyOwnerAssetProxyRegistrationEventArgs,
- AssetProxyOwnerContract,
- AssetProxyOwnerExecutionEventArgs,
- AssetProxyOwnerExecutionFailureEventArgs,
- AssetProxyOwnerSubmissionEventArgs,
-} 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,
- expectTransactionFailedAsync,
- expectTransactionFailedWithoutReasonAsync,
- sendTransactionResult,
-} from '../utils/assertions';
-import { increaseTimeAndMineBlockAsync } from '../utils/block_timestamp';
-import { chaiSetup } from '../utils/chai_setup';
-import { constants } from '../utils/constants';
-import { MultiSigWrapper } from '../utils/multi_sig_wrapper';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-// tslint:disable:no-unnecessary-type-assertion
-describe('AssetProxyOwner', () => {
- let owners: string[];
- let authorized: string;
- let notOwner: string;
- const REQUIRED_APPROVALS = new BigNumber(2);
- const SECONDS_TIME_LOCKED = new BigNumber(1000000);
-
- let erc20Proxy: MixinAuthorizableContract;
- let erc721Proxy: MixinAuthorizableContract;
- let testAssetProxyOwner: TestAssetProxyOwnerContract;
- let multiSigWrapper: MultiSigWrapper;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- owners = [accounts[0], accounts[1]];
- authorized = accounts[2];
- notOwner = accounts[3];
- const initialOwner = accounts[0];
- erc20Proxy = await MixinAuthorizableContract.deployFrom0xArtifactAsync(
- artifacts.MixinAuthorizable,
- provider,
- txDefaults,
- );
- erc721Proxy = await MixinAuthorizableContract.deployFrom0xArtifactAsync(
- artifacts.MixinAuthorizable,
- provider,
- txDefaults,
- );
- const defaultAssetProxyContractAddresses: string[] = [];
- testAssetProxyOwner = await TestAssetProxyOwnerContract.deployFrom0xArtifactAsync(
- artifacts.TestAssetProxyOwner,
- provider,
- txDefaults,
- owners,
- defaultAssetProxyContractAddresses,
- REQUIRED_APPROVALS,
- SECONDS_TIME_LOCKED,
- );
- multiSigWrapper = new MultiSigWrapper(testAssetProxyOwner, provider);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.transferOwnership.sendTransactionAsync(testAssetProxyOwner.address, {
- from: initialOwner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.transferOwnership.sendTransactionAsync(testAssetProxyOwner.address, {
- from: initialOwner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
-
- describe('constructor', () => {
- it('should register passed in assetProxyContracts', async () => {
- const assetProxyContractAddresses = [erc20Proxy.address, erc721Proxy.address];
- const newMultiSig = await AssetProxyOwnerContract.deployFrom0xArtifactAsync(
- artifacts.AssetProxyOwner,
- provider,
- txDefaults,
- owners,
- assetProxyContractAddresses,
- REQUIRED_APPROVALS,
- SECONDS_TIME_LOCKED,
- );
- const isErc20ProxyRegistered = await newMultiSig.isAssetProxyRegistered.callAsync(erc20Proxy.address);
- const isErc721ProxyRegistered = await newMultiSig.isAssetProxyRegistered.callAsync(erc721Proxy.address);
- expect(isErc20ProxyRegistered).to.equal(true);
- expect(isErc721ProxyRegistered).to.equal(true);
- });
- it('should throw if a null address is included in assetProxyContracts', async () => {
- const assetProxyContractAddresses = [erc20Proxy.address, constants.NULL_ADDRESS];
- return expectContractCreationFailedAsync(
- (AssetProxyOwnerContract.deployFrom0xArtifactAsync(
- artifacts.AssetProxyOwner,
- provider,
- txDefaults,
- owners,
- assetProxyContractAddresses,
- REQUIRED_APPROVALS,
- SECONDS_TIME_LOCKED,
- ) as any) as sendTransactionResult,
- RevertReason.InvalidAssetProxy,
- );
- });
- });
-
- describe('isFunctionRemoveAuthorizedAddressAtIndex', () => {
- it('should return false if data is not for removeAuthorizedAddressAtIndex', async () => {
- const notRemoveAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(
- owners[0],
- );
-
- const isFunctionRemoveAuthorizedAddressAtIndex = await testAssetProxyOwner.isFunctionRemoveAuthorizedAddressAtIndex.callAsync(
- notRemoveAuthorizedAddressData,
- );
- expect(isFunctionRemoveAuthorizedAddressAtIndex).to.be.false();
- });
-
- it('should return true if data is for removeAuthorizedAddressAtIndex', async () => {
- const index = new BigNumber(0);
- const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
- owners[0],
- index,
- );
- const isFunctionRemoveAuthorizedAddressAtIndex = await testAssetProxyOwner.isFunctionRemoveAuthorizedAddressAtIndex.callAsync(
- removeAuthorizedAddressAtIndexData,
- );
- expect(isFunctionRemoveAuthorizedAddressAtIndex).to.be.true();
- });
- });
-
- describe('registerAssetProxy', () => {
- it('should throw if not called by multisig', async () => {
- const isRegistered = true;
- return expectTransactionFailedWithoutReasonAsync(
- testAssetProxyOwner.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, isRegistered, {
- from: owners[0],
- }),
- );
- });
-
- it('should register an address if called by multisig after timelock', async () => {
- const addressToRegister = erc20Proxy.address;
- const isRegistered = true;
- const registerAssetProxyData = testAssetProxyOwner.registerAssetProxy.getABIEncodedTransactionData(
- addressToRegister,
- isRegistered,
- );
- const submitTxRes = await multiSigWrapper.submitTransactionAsync(
- testAssetProxyOwner.address,
- registerAssetProxyData,
- owners[0],
- );
-
- const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = log.args.transactionId;
-
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
-
- const executeTxRes = await multiSigWrapper.executeTransactionAsync(txId, owners[0]);
- const registerLog = executeTxRes.logs[0] as LogWithDecodedArgs<
- AssetProxyOwnerAssetProxyRegistrationEventArgs
- >;
- expect(registerLog.args.assetProxyContract).to.equal(addressToRegister);
- expect(registerLog.args.isRegistered).to.equal(isRegistered);
-
- const isAssetProxyRegistered = await testAssetProxyOwner.isAssetProxyRegistered.callAsync(
- addressToRegister,
- );
- expect(isAssetProxyRegistered).to.equal(isRegistered);
- });
-
- it('should fail if registering a null address', async () => {
- const addressToRegister = constants.NULL_ADDRESS;
- const isRegistered = true;
- const registerAssetProxyData = testAssetProxyOwner.registerAssetProxy.getABIEncodedTransactionData(
- addressToRegister,
- isRegistered,
- );
- const submitTxRes = await multiSigWrapper.submitTransactionAsync(
- testAssetProxyOwner.address,
- registerAssetProxyData,
- owners[0],
- );
- const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = log.args.transactionId;
-
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
-
- const executeTxRes = await multiSigWrapper.executeTransactionAsync(txId, owners[0]);
- const failureLog = executeTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerExecutionFailureEventArgs>;
- expect(failureLog.args.transactionId).to.be.bignumber.equal(txId);
-
- const isAssetProxyRegistered = await testAssetProxyOwner.isAssetProxyRegistered.callAsync(
- addressToRegister,
- );
- expect(isAssetProxyRegistered).to.equal(false);
- });
- });
-
- describe('Calling removeAuthorizedAddressAtIndex', () => {
- const erc20Index = new BigNumber(0);
- const erc721Index = new BigNumber(1);
- before('authorize both proxies and register erc20 proxy', async () => {
- // Only register ERC20 proxy
- const addressToRegister = erc20Proxy.address;
- const isRegistered = true;
- const registerAssetProxyData = testAssetProxyOwner.registerAssetProxy.getABIEncodedTransactionData(
- addressToRegister,
- isRegistered,
- );
- const registerAssetProxySubmitRes = await multiSigWrapper.submitTransactionAsync(
- testAssetProxyOwner.address,
- registerAssetProxyData,
- owners[0],
- );
- const registerAssetProxySubmitLog = registerAssetProxySubmitRes.logs[0] as LogWithDecodedArgs<
- AssetProxyOwnerSubmissionEventArgs
- >;
-
- const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(authorized);
- const erc20AddAuthorizedAddressSubmitRes = await multiSigWrapper.submitTransactionAsync(
- erc20Proxy.address,
- addAuthorizedAddressData,
- owners[0],
- );
- const erc721AddAuthorizedAddressSubmitRes = await multiSigWrapper.submitTransactionAsync(
- erc721Proxy.address,
- addAuthorizedAddressData,
- owners[0],
- );
- const erc20AddAuthorizedAddressSubmitLog = erc20AddAuthorizedAddressSubmitRes.logs[0] as LogWithDecodedArgs<
- AssetProxyOwnerSubmissionEventArgs
- >;
- const erc721AddAuthorizedAddressSubmitLog = erc721AddAuthorizedAddressSubmitRes
- .logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
-
- const registerAssetProxyTxId = registerAssetProxySubmitLog.args.transactionId;
- const erc20AddAuthorizedAddressTxId = erc20AddAuthorizedAddressSubmitLog.args.transactionId;
- const erc721AddAuthorizedAddressTxId = erc721AddAuthorizedAddressSubmitLog.args.transactionId;
-
- await multiSigWrapper.confirmTransactionAsync(registerAssetProxyTxId, owners[1]);
- await multiSigWrapper.confirmTransactionAsync(erc20AddAuthorizedAddressTxId, owners[1]);
- await multiSigWrapper.confirmTransactionAsync(erc721AddAuthorizedAddressTxId, owners[1]);
- await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
- await multiSigWrapper.executeTransactionAsync(registerAssetProxyTxId, owners[0]);
- await multiSigWrapper.executeTransactionAsync(erc20AddAuthorizedAddressTxId, owners[0], {
- gas: constants.MAX_EXECUTE_TRANSACTION_GAS,
- });
- await multiSigWrapper.executeTransactionAsync(erc721AddAuthorizedAddressTxId, owners[0], {
- gas: constants.MAX_EXECUTE_TRANSACTION_GAS,
- });
- });
-
- describe('validRemoveAuthorizedAddressAtIndexTx', () => {
- it('should revert if data is not for removeAuthorizedAddressAtIndex and proxy is registered', async () => {
- const notRemoveAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(
- authorized,
- );
- const submitTxRes = await multiSigWrapper.submitTransactionAsync(
- erc20Proxy.address,
- notRemoveAuthorizedAddressData,
- owners[0],
- );
- const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = log.args.transactionId;
- return expectContractCallFailedAsync(
- testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(txId),
- RevertReason.InvalidFunctionSelector,
- );
- });
-
- it('should return true if data is for removeAuthorizedAddressAtIndex and proxy is registered', async () => {
- const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
- authorized,
- erc20Index,
- );
- const submitTxRes = await multiSigWrapper.submitTransactionAsync(
- erc20Proxy.address,
- removeAuthorizedAddressAtIndexData,
- owners[0],
- );
- const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = log.args.transactionId;
- const isValidRemoveAuthorizedAddressAtIndexTx = await testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(
- txId,
- );
- expect(isValidRemoveAuthorizedAddressAtIndexTx).to.be.true();
- });
-
- it('should revert if data is for removeAuthorizedAddressAtIndex and proxy is not registered', async () => {
- const removeAuthorizedAddressAtIndexData = erc721Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
- authorized,
- erc721Index,
- );
- const submitTxRes = await multiSigWrapper.submitTransactionAsync(
- erc721Proxy.address,
- removeAuthorizedAddressAtIndexData,
- owners[0],
- );
- const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = log.args.transactionId;
- return expectContractCallFailedAsync(
- testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(txId),
- RevertReason.UnregisteredAssetProxy,
- );
- });
- });
-
- describe('executeRemoveAuthorizedAddressAtIndex', () => {
- it('should throw without the required confirmations', async () => {
- const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
- authorized,
- erc20Index,
- );
- const res = await multiSigWrapper.submitTransactionAsync(
- erc20Proxy.address,
- removeAuthorizedAddressAtIndexData,
- owners[0],
- );
- const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = log.args.transactionId;
-
- return expectTransactionFailedAsync(
- testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
- from: owners[1],
- }),
- RevertReason.TxNotFullyConfirmed,
- );
- });
-
- it('should throw if tx destination is not registered', async () => {
- const removeAuthorizedAddressAtIndexData = erc721Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
- authorized,
- erc721Index,
- );
- const res = await multiSigWrapper.submitTransactionAsync(
- erc721Proxy.address,
- removeAuthorizedAddressAtIndexData,
- owners[0],
- );
- const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = log.args.transactionId;
-
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
-
- return expectTransactionFailedAsync(
- testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
- from: owners[1],
- }),
- RevertReason.UnregisteredAssetProxy,
- );
- });
-
- it('should throw if tx data is not for removeAuthorizedAddressAtIndex', async () => {
- const newAuthorized = owners[1];
- const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(
- newAuthorized,
- );
- const res = await multiSigWrapper.submitTransactionAsync(
- erc20Proxy.address,
- addAuthorizedAddressData,
- owners[0],
- );
- const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = log.args.transactionId;
-
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
-
- return expectTransactionFailedAsync(
- testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
- from: owners[1],
- }),
- RevertReason.InvalidFunctionSelector,
- );
- });
-
- it('should execute removeAuthorizedAddressAtIndex for registered address if fully confirmed and called by owner', async () => {
- const isAuthorizedBefore = await erc20Proxy.authorized.callAsync(authorized);
- expect(isAuthorizedBefore).to.equal(true);
-
- const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
- authorized,
- erc20Index,
- );
- const submitRes = await multiSigWrapper.submitTransactionAsync(
- erc20Proxy.address,
- removeAuthorizedAddressAtIndexData,
- owners[0],
- );
- const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = submitLog.args.transactionId;
-
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
-
- const execRes = await multiSigWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, owners[0]);
- const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
- expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
-
- const tx = await testAssetProxyOwner.transactions.callAsync(txId);
- const isExecuted = tx[3];
- expect(isExecuted).to.equal(true);
-
- const isAuthorizedAfter = await erc20Proxy.authorized.callAsync(authorized);
- expect(isAuthorizedAfter).to.equal(false);
- });
-
- it('should execute removeAuthorizedAddressAtIndex for registered address if fully confirmed and called by non-owner', async () => {
- const isAuthorizedBefore = await erc20Proxy.authorized.callAsync(authorized);
- expect(isAuthorizedBefore).to.equal(true);
-
- const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
- authorized,
- erc20Index,
- );
- const submitRes = await multiSigWrapper.submitTransactionAsync(
- erc20Proxy.address,
- removeAuthorizedAddressAtIndexData,
- owners[0],
- );
- const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = submitLog.args.transactionId;
-
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
-
- const execRes = await multiSigWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, notOwner);
- const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
- expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
-
- const tx = await testAssetProxyOwner.transactions.callAsync(txId);
- const isExecuted = tx[3];
- expect(isExecuted).to.equal(true);
-
- const isAuthorizedAfter = await erc20Proxy.authorized.callAsync(authorized);
- expect(isAuthorizedAfter).to.equal(false);
- });
-
- it('should throw if already executed', async () => {
- const removeAuthorizedAddressAtIndexData = erc20Proxy.removeAuthorizedAddressAtIndex.getABIEncodedTransactionData(
- authorized,
- erc20Index,
- );
- const submitRes = await multiSigWrapper.submitTransactionAsync(
- erc20Proxy.address,
- removeAuthorizedAddressAtIndexData,
- owners[0],
- );
- const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
- const txId = submitLog.args.transactionId;
-
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
-
- const execRes = await multiSigWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, owners[0]);
- const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
- expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
-
- const tx = await testAssetProxyOwner.transactions.callAsync(txId);
- const isExecuted = tx[3];
- expect(isExecuted).to.equal(true);
-
- return expectTransactionFailedWithoutReasonAsync(
- testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
- from: owners[1],
- }),
- );
- });
- });
- });
-});
-// tslint:enable:no-unnecessary-type-assertion
diff --git a/packages/contracts/test/multisig/multi_sig_with_time_lock.ts b/packages/contracts/test/multisig/multi_sig_with_time_lock.ts
deleted file mode 100644
index 1c0cb0515..000000000
--- a/packages/contracts/test/multisig/multi_sig_with_time_lock.ts
+++ /dev/null
@@ -1,347 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { RevertReason } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-import { LogWithDecodedArgs } from 'ethereum-types';
-import * as _ from 'lodash';
-
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import {
- MultiSigWalletWithTimeLockConfirmationEventArgs,
- MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs,
- MultiSigWalletWithTimeLockContract,
- MultiSigWalletWithTimeLockExecutionEventArgs,
- MultiSigWalletWithTimeLockExecutionFailureEventArgs,
- MultiSigWalletWithTimeLockSubmissionEventArgs,
-} 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';
-import { constants } from '../utils/constants';
-import { MultiSigWrapper } from '../utils/multi_sig_wrapper';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-// tslint:disable:no-unnecessary-type-assertion
-describe('MultiSigWalletWithTimeLock', () => {
- let owners: string[];
- let notOwner: string;
- const REQUIRED_APPROVALS = new BigNumber(2);
- const SECONDS_TIME_LOCKED = new BigNumber(1000000);
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- owners = [accounts[0], accounts[1], accounts[2]];
- notOwner = accounts[3];
- });
-
- let multiSig: MultiSigWalletWithTimeLockContract;
- let multiSigWrapper: MultiSigWrapper;
-
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
-
- describe('external_call', () => {
- it('should be internal', async () => {
- const secondsTimeLocked = new BigNumber(0);
- multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
- artifacts.MultiSigWalletWithTimeLock,
- provider,
- txDefaults,
- owners,
- REQUIRED_APPROVALS,
- secondsTimeLocked,
- );
- expect(_.isUndefined((multiSig as any).external_call)).to.be.equal(true);
- });
- });
- describe('confirmTransaction', () => {
- let txId: BigNumber;
- beforeEach(async () => {
- const secondsTimeLocked = new BigNumber(0);
- multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
- artifacts.MultiSigWalletWithTimeLock,
- provider,
- txDefaults,
- owners,
- REQUIRED_APPROVALS,
- secondsTimeLocked,
- );
- multiSigWrapper = new MultiSigWrapper(multiSig, provider);
- const destination = notOwner;
- const data = constants.NULL_BYTES;
- const txReceipt = await multiSigWrapper.submitTransactionAsync(destination, data, owners[0]);
- txId = (txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>).args
- .transactionId;
- });
- it('should revert if called by a non-owner', async () => {
- await expectTransactionFailedWithoutReasonAsync(multiSigWrapper.confirmTransactionAsync(txId, notOwner));
- });
- it('should revert if transaction does not exist', async () => {
- const nonexistentTxId = new BigNumber(123456789);
- await expectTransactionFailedWithoutReasonAsync(
- multiSigWrapper.confirmTransactionAsync(nonexistentTxId, owners[1]),
- );
- });
- it('should revert if transaction is already confirmed by caller', async () => {
- await expectTransactionFailedWithoutReasonAsync(multiSigWrapper.confirmTransactionAsync(txId, owners[0]));
- });
- it('should confirm transaction for caller and log a Confirmation event', async () => {
- const txReceipt = await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- const log = txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockConfirmationEventArgs>;
- expect(log.event).to.be.equal('Confirmation');
- expect(log.args.sender).to.be.equal(owners[1]);
- expect(log.args.transactionId).to.be.bignumber.equal(txId);
- });
- it('should revert if fully confirmed', async () => {
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- await expectTransactionFailedAsync(
- multiSigWrapper.confirmTransactionAsync(txId, owners[2]),
- RevertReason.TxFullyConfirmed,
- );
- });
- it('should set the confirmation time of the transaction if it becomes fully confirmed', async () => {
- const txReceipt = await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- const blockNum = await web3Wrapper.getBlockNumberAsync();
- const timestamp = new BigNumber(await web3Wrapper.getBlockTimestampAsync(blockNum));
- const log = txReceipt.logs[1] as LogWithDecodedArgs<MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs>;
- expect(log.args.confirmationTime).to.be.bignumber.equal(timestamp);
- expect(log.args.transactionId).to.be.bignumber.equal(txId);
- });
- });
- describe('executeTransaction', () => {
- let txId: BigNumber;
- const secondsTimeLocked = new BigNumber(1000000);
- beforeEach(async () => {
- multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
- artifacts.MultiSigWalletWithTimeLock,
- provider,
- txDefaults,
- owners,
- REQUIRED_APPROVALS,
- secondsTimeLocked,
- );
- multiSigWrapper = new MultiSigWrapper(multiSig, provider);
- const destination = notOwner;
- const data = constants.NULL_BYTES;
- const txReceipt = await multiSigWrapper.submitTransactionAsync(destination, data, owners[0]);
- txId = (txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>).args
- .transactionId;
- });
- it('should revert if transaction has not been fully confirmed', async () => {
- await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
- await expectTransactionFailedAsync(
- multiSigWrapper.executeTransactionAsync(txId, owners[1]),
- RevertReason.TxNotFullyConfirmed,
- );
- });
- it('should revert if time lock has not passed', async () => {
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- await expectTransactionFailedAsync(
- multiSigWrapper.executeTransactionAsync(txId, owners[1]),
- RevertReason.TimeLockIncomplete,
- );
- });
- it('should execute a transaction and log an Execution event if successful and called by owner', async () => {
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
- const txReceipt = await multiSigWrapper.executeTransactionAsync(txId, owners[1]);
- const log = txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockExecutionEventArgs>;
- expect(log.event).to.be.equal('Execution');
- expect(log.args.transactionId).to.be.bignumber.equal(txId);
- });
- it('should execute a transaction and log an Execution event if successful and called by non-owner', async () => {
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
- const txReceipt = await multiSigWrapper.executeTransactionAsync(txId, notOwner);
- const log = txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockExecutionEventArgs>;
- expect(log.event).to.be.equal('Execution');
- expect(log.args.transactionId).to.be.bignumber.equal(txId);
- });
- it('should revert if a required confirmation is revoked before executeTransaction is called', async () => {
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
- await multiSigWrapper.revokeConfirmationAsync(txId, owners[0]);
- await expectTransactionFailedAsync(
- multiSigWrapper.executeTransactionAsync(txId, owners[1]),
- RevertReason.TxNotFullyConfirmed,
- );
- });
- it('should revert if transaction has been executed', async () => {
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
- const txReceipt = await multiSigWrapper.executeTransactionAsync(txId, owners[1]);
- const log = txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockExecutionEventArgs>;
- expect(log.args.transactionId).to.be.bignumber.equal(txId);
- await expectTransactionFailedWithoutReasonAsync(multiSigWrapper.executeTransactionAsync(txId, owners[1]));
- });
- it("should log an ExecutionFailure event and not update the transaction's execution state if unsuccessful", async () => {
- const contractWithoutFallback = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC20Token,
- provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- constants.DUMMY_TOKEN_DECIMALS,
- constants.DUMMY_TOKEN_TOTAL_SUPPLY,
- );
- const data = constants.NULL_BYTES;
- const value = new BigNumber(10);
- const submissionTxReceipt = await multiSigWrapper.submitTransactionAsync(
- contractWithoutFallback.address,
- data,
- owners[0],
- { value },
- );
- const newTxId = (submissionTxReceipt.logs[0] as LogWithDecodedArgs<
- MultiSigWalletWithTimeLockSubmissionEventArgs
- >).args.transactionId;
- await multiSigWrapper.confirmTransactionAsync(newTxId, owners[1]);
- await increaseTimeAndMineBlockAsync(secondsTimeLocked.toNumber());
- const txReceipt = await multiSigWrapper.executeTransactionAsync(newTxId, owners[1]);
- const executionFailureLog = txReceipt.logs[0] as LogWithDecodedArgs<
- MultiSigWalletWithTimeLockExecutionFailureEventArgs
- >;
- expect(executionFailureLog.event).to.be.equal('ExecutionFailure');
- expect(executionFailureLog.args.transactionId).to.be.bignumber.equal(newTxId);
- });
- });
- describe('changeTimeLock', () => {
- describe('initially non-time-locked', async () => {
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before('deploy a wallet', async () => {
- const secondsTimeLocked = new BigNumber(0);
- multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
- artifacts.MultiSigWalletWithTimeLock,
- provider,
- txDefaults,
- owners,
- REQUIRED_APPROVALS,
- secondsTimeLocked,
- );
- multiSigWrapper = new MultiSigWrapper(multiSig, provider);
- });
-
- it('should throw when not called by wallet', async () => {
- return expectTransactionFailedWithoutReasonAsync(
- multiSig.changeTimeLock.sendTransactionAsync(SECONDS_TIME_LOCKED, { from: owners[0] }),
- );
- });
-
- it('should throw without enough confirmations', async () => {
- const destination = multiSig.address;
- const changeTimeLockData = multiSig.changeTimeLock.getABIEncodedTransactionData(SECONDS_TIME_LOCKED);
- const res = await multiSigWrapper.submitTransactionAsync(destination, changeTimeLockData, owners[0]);
- const log = res.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>;
- const txId = log.args.transactionId;
- return expectTransactionFailedAsync(
- multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
- RevertReason.TxNotFullyConfirmed,
- );
- });
-
- it('should set confirmation time with enough confirmations', async () => {
- const destination = multiSig.address;
- const changeTimeLockData = multiSig.changeTimeLock.getABIEncodedTransactionData(SECONDS_TIME_LOCKED);
- const subRes = await multiSigWrapper.submitTransactionAsync(destination, changeTimeLockData, owners[0]);
- const subLog = subRes.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>;
- const txId = subLog.args.transactionId;
-
- const confirmRes = await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- expect(confirmRes.logs).to.have.length(2);
-
- const blockNum = await web3Wrapper.getBlockNumberAsync();
- const blockInfo = await web3Wrapper.getBlockIfExistsAsync(blockNum);
- if (_.isUndefined(blockInfo)) {
- throw new Error(`Unexpectedly failed to fetch block at #${blockNum}`);
- }
- const timestamp = new BigNumber(blockInfo.timestamp);
- const confirmationTimeBigNum = new BigNumber(await multiSig.confirmationTimes.callAsync(txId));
-
- expect(timestamp).to.be.bignumber.equal(confirmationTimeBigNum);
- });
-
- it('should be executable with enough confirmations and secondsTimeLocked of 0', async () => {
- const destination = multiSig.address;
- const changeTimeLockData = multiSig.changeTimeLock.getABIEncodedTransactionData(SECONDS_TIME_LOCKED);
- const subRes = await multiSigWrapper.submitTransactionAsync(destination, changeTimeLockData, owners[0]);
- const subLog = subRes.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>;
- const txId = subLog.args.transactionId;
-
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- await multiSigWrapper.executeTransactionAsync(txId, owners[1]);
-
- const secondsTimeLocked = new BigNumber(await multiSig.secondsTimeLocked.callAsync());
- expect(secondsTimeLocked).to.be.bignumber.equal(SECONDS_TIME_LOCKED);
- });
- });
- describe('initially time-locked', async () => {
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- let txId: BigNumber;
- const newSecondsTimeLocked = new BigNumber(0);
- before('deploy a wallet, submit transaction to change timelock, and confirm the transaction', async () => {
- multiSig = await MultiSigWalletWithTimeLockContract.deployFrom0xArtifactAsync(
- artifacts.MultiSigWalletWithTimeLock,
- provider,
- txDefaults,
- owners,
- REQUIRED_APPROVALS,
- SECONDS_TIME_LOCKED,
- );
- multiSigWrapper = new MultiSigWrapper(multiSig, provider);
-
- const changeTimeLockData = multiSig.changeTimeLock.getABIEncodedTransactionData(newSecondsTimeLocked);
- const res = await multiSigWrapper.submitTransactionAsync(
- multiSig.address,
- changeTimeLockData,
- owners[0],
- );
- const log = res.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockSubmissionEventArgs>;
- txId = log.args.transactionId;
- await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
- });
-
- it('should throw if it has enough confirmations but is not past the time lock', async () => {
- return expectTransactionFailedAsync(
- multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
- RevertReason.TimeLockIncomplete,
- );
- });
-
- it('should execute if it has enough confirmations and is past the time lock', async () => {
- await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
- await web3Wrapper.awaitTransactionSuccessAsync(
- await multiSig.executeTransaction.sendTransactionAsync(txId, { from: owners[0] }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const secondsTimeLocked = new BigNumber(await multiSig.secondsTimeLocked.callAsync());
- expect(secondsTimeLocked).to.be.bignumber.equal(newSecondsTimeLocked);
- });
- });
- });
-});
-// tslint:enable:no-unnecessary-type-assertion
diff --git a/packages/contracts/test/tokens/erc721_token.ts b/packages/contracts/test/tokens/erc721_token.ts
deleted file mode 100644
index 72407748f..000000000
--- a/packages/contracts/test/tokens/erc721_token.ts
+++ /dev/null
@@ -1,279 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { RevertReason } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-import { LogWithDecodedArgs } from 'ethereum-types';
-
-import {
- DummyERC721ReceiverContract,
- DummyERC721ReceiverTokenReceivedEventArgs,
-} from '../../generated-wrappers/dummy_erc721_receiver';
-import {
- DummyERC721TokenContract,
- DummyERC721TokenTransferEventArgs,
-} from '../../generated-wrappers/dummy_erc721_token';
-import { InvalidERC721ReceiverContract } from '../../generated-wrappers/invalid_erc721_receiver';
-import { artifacts } from '../../src/artifacts';
-import { expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
-import { chaiSetup } from '../utils/chai_setup';
-import { constants } from '../utils/constants';
-import { LogDecoder } from '../utils/log_decoder';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-// tslint:disable:no-unnecessary-type-assertion
-describe('ERC721Token', () => {
- let owner: string;
- let spender: string;
- let token: DummyERC721TokenContract;
- let erc721Receiver: DummyERC721ReceiverContract;
- let logDecoder: LogDecoder;
- const tokenId = new BigNumber(1);
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- owner = accounts[0];
- spender = accounts[1];
- token = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Token,
- provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- );
- erc721Receiver = await DummyERC721ReceiverContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Receiver,
- provider,
- txDefaults,
- );
- logDecoder = new LogDecoder(web3Wrapper);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.mint.sendTransactionAsync(owner, tokenId, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
-
- describe('transferFrom', () => {
- it('should revert if the tokenId is not owner', async () => {
- const from = owner;
- const to = erc721Receiver.address;
- const unownedTokenId = new BigNumber(2);
- await expectTransactionFailedAsync(
- token.transferFrom.sendTransactionAsync(from, to, unownedTokenId),
- RevertReason.Erc721ZeroOwner,
- );
- });
- it('should revert if transferring to a null address', async () => {
- const from = owner;
- const to = constants.NULL_ADDRESS;
- await expectTransactionFailedAsync(
- token.transferFrom.sendTransactionAsync(from, to, tokenId),
- RevertReason.Erc721ZeroToAddress,
- );
- });
- it('should revert if the from address does not own the token', async () => {
- const from = spender;
- const to = erc721Receiver.address;
- await expectTransactionFailedAsync(
- token.transferFrom.sendTransactionAsync(from, to, tokenId),
- RevertReason.Erc721OwnerMismatch,
- );
- });
- it('should revert if spender does not own the token, is not approved, and is not approved for all', async () => {
- const from = owner;
- const to = erc721Receiver.address;
- await expectTransactionFailedAsync(
- token.transferFrom.sendTransactionAsync(from, to, tokenId, { from: spender }),
- RevertReason.Erc721InvalidSpender,
- );
- });
- it('should transfer the token if called by owner', async () => {
- const from = owner;
- const to = erc721Receiver.address;
- const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
- await token.transferFrom.sendTransactionAsync(from, to, tokenId),
- );
- const newOwner = await token.ownerOf.callAsync(tokenId);
- expect(newOwner).to.be.equal(to);
- const log = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
- expect(log.args._from).to.be.equal(from);
- expect(log.args._to).to.be.equal(to);
- expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
- });
- it('should transfer the token if spender is approved for all', async () => {
- const isApproved = true;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.setApprovalForAll.sendTransactionAsync(spender, isApproved),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const from = owner;
- const to = erc721Receiver.address;
- const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
- await token.transferFrom.sendTransactionAsync(from, to, tokenId),
- );
- const newOwner = await token.ownerOf.callAsync(tokenId);
- expect(newOwner).to.be.equal(to);
- const log = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
- expect(log.args._from).to.be.equal(from);
- expect(log.args._to).to.be.equal(to);
- expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
- });
- it('should transfer the token if spender is individually approved', async () => {
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.approve.sendTransactionAsync(spender, tokenId),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const from = owner;
- const to = erc721Receiver.address;
- const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
- await token.transferFrom.sendTransactionAsync(from, to, tokenId),
- );
- const newOwner = await token.ownerOf.callAsync(tokenId);
- expect(newOwner).to.be.equal(to);
-
- const approvedAddress = await token.getApproved.callAsync(tokenId);
- expect(approvedAddress).to.be.equal(constants.NULL_ADDRESS);
- const log = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
- expect(log.args._from).to.be.equal(from);
- expect(log.args._to).to.be.equal(to);
- expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
- });
- });
- describe('safeTransferFrom without data', () => {
- it('should transfer token to a non-contract address if called by owner', async () => {
- const from = owner;
- const to = spender;
- const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
- await token.safeTransferFrom1.sendTransactionAsync(from, to, tokenId),
- );
- const newOwner = await token.ownerOf.callAsync(tokenId);
- expect(newOwner).to.be.equal(to);
- const log = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
- expect(log.args._from).to.be.equal(from);
- expect(log.args._to).to.be.equal(to);
- expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
- });
- it('should revert if transferring to a contract address without onERC721Received', async () => {
- const contract = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Token,
- provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- );
- const from = owner;
- const to = contract.address;
- await expectTransactionFailedWithoutReasonAsync(
- token.safeTransferFrom1.sendTransactionAsync(from, to, tokenId),
- );
- });
- it('should revert if onERC721Received does not return the correct value', async () => {
- const invalidErc721Receiver = await InvalidERC721ReceiverContract.deployFrom0xArtifactAsync(
- artifacts.InvalidERC721Receiver,
- provider,
- txDefaults,
- );
- const from = owner;
- const to = invalidErc721Receiver.address;
- await expectTransactionFailedAsync(
- token.safeTransferFrom1.sendTransactionAsync(from, to, tokenId),
- RevertReason.Erc721InvalidSelector,
- );
- });
- it('should transfer to contract and call onERC721Received with correct return value', async () => {
- const from = owner;
- const to = erc721Receiver.address;
- const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
- await token.safeTransferFrom1.sendTransactionAsync(from, to, tokenId),
- );
- const newOwner = await token.ownerOf.callAsync(tokenId);
- expect(newOwner).to.be.equal(to);
- const transferLog = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
- const receiverLog = txReceipt.logs[1] as LogWithDecodedArgs<DummyERC721ReceiverTokenReceivedEventArgs>;
- expect(transferLog.args._from).to.be.equal(from);
- expect(transferLog.args._to).to.be.equal(to);
- expect(transferLog.args._tokenId).to.be.bignumber.equal(tokenId);
- expect(receiverLog.args.operator).to.be.equal(owner);
- expect(receiverLog.args.from).to.be.equal(from);
- expect(receiverLog.args.tokenId).to.be.bignumber.equal(tokenId);
- expect(receiverLog.args.data).to.be.equal(constants.NULL_BYTES);
- });
- });
- describe('safeTransferFrom with data', () => {
- const data = '0x0102030405060708090a0b0c0d0e0f';
- it('should transfer token to a non-contract address if called by owner', async () => {
- const from = owner;
- const to = spender;
- const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
- await token.safeTransferFrom2.sendTransactionAsync(from, to, tokenId, data),
- );
- const newOwner = await token.ownerOf.callAsync(tokenId);
- expect(newOwner).to.be.equal(to);
- const log = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
- expect(log.args._from).to.be.equal(from);
- expect(log.args._to).to.be.equal(to);
- expect(log.args._tokenId).to.be.bignumber.equal(tokenId);
- });
- it('should revert if transferring to a contract address without onERC721Received', async () => {
- const contract = await DummyERC721TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Token,
- provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- );
- const from = owner;
- const to = contract.address;
- await expectTransactionFailedWithoutReasonAsync(
- token.safeTransferFrom2.sendTransactionAsync(from, to, tokenId, data),
- );
- });
- it('should revert if onERC721Received does not return the correct value', async () => {
- const invalidErc721Receiver = await InvalidERC721ReceiverContract.deployFrom0xArtifactAsync(
- artifacts.InvalidERC721Receiver,
- provider,
- txDefaults,
- );
- const from = owner;
- const to = invalidErc721Receiver.address;
- await expectTransactionFailedAsync(
- token.safeTransferFrom2.sendTransactionAsync(from, to, tokenId, data),
- RevertReason.Erc721InvalidSelector,
- );
- });
- it('should transfer to contract and call onERC721Received with correct return value', async () => {
- const from = owner;
- const to = erc721Receiver.address;
- const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
- await token.safeTransferFrom2.sendTransactionAsync(from, to, tokenId, data),
- );
- const newOwner = await token.ownerOf.callAsync(tokenId);
- expect(newOwner).to.be.equal(to);
- const transferLog = txReceipt.logs[0] as LogWithDecodedArgs<DummyERC721TokenTransferEventArgs>;
- const receiverLog = txReceipt.logs[1] as LogWithDecodedArgs<DummyERC721ReceiverTokenReceivedEventArgs>;
- expect(transferLog.args._from).to.be.equal(from);
- expect(transferLog.args._to).to.be.equal(to);
- expect(transferLog.args._tokenId).to.be.bignumber.equal(tokenId);
- expect(receiverLog.args.operator).to.be.equal(owner);
- expect(receiverLog.args.from).to.be.equal(from);
- expect(receiverLog.args.tokenId).to.be.bignumber.equal(tokenId);
- expect(receiverLog.args.data).to.be.equal(data);
- });
- });
-});
-// tslint:enable:no-unnecessary-type-assertion
diff --git a/packages/contracts/test/tokens/unlimited_allowance_token.ts b/packages/contracts/test/tokens/unlimited_allowance_token.ts
deleted file mode 100644
index ea5a50522..000000000
--- a/packages/contracts/test/tokens/unlimited_allowance_token.ts
+++ /dev/null
@@ -1,191 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { RevertReason } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { artifacts } from '../../src/artifacts';
-import { expectContractCallFailedAsync } from '../utils/assertions';
-import { chaiSetup } from '../utils/chai_setup';
-import { constants } from '../utils/constants';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-describe('UnlimitedAllowanceToken', () => {
- let owner: string;
- let spender: string;
- const MAX_MINT_VALUE = new BigNumber(10000000000000000000000);
- let token: DummyERC20TokenContract;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- owner = accounts[0];
- spender = accounts[1];
- token = await DummyERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC20Token,
- provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- constants.DUMMY_TOKEN_DECIMALS,
- constants.DUMMY_TOKEN_TOTAL_SUPPLY,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.mint.sendTransactionAsync(MAX_MINT_VALUE, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- describe('transfer', () => {
- it('should throw if owner has insufficient balance', async () => {
- const ownerBalance = await token.balanceOf.callAsync(owner);
- const amountToTransfer = ownerBalance.plus(1);
- return expectContractCallFailedAsync(
- token.transfer.callAsync(spender, amountToTransfer, { from: owner }),
- RevertReason.Erc20InsufficientBalance,
- );
- });
-
- it('should transfer balance from sender to receiver', async () => {
- const receiver = spender;
- const initOwnerBalance = await token.balanceOf.callAsync(owner);
- const amountToTransfer = new BigNumber(1);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const finalOwnerBalance = await token.balanceOf.callAsync(owner);
- const finalReceiverBalance = await token.balanceOf.callAsync(receiver);
-
- const expectedFinalOwnerBalance = initOwnerBalance.minus(amountToTransfer);
- const expectedFinalReceiverBalance = amountToTransfer;
- expect(finalOwnerBalance).to.be.bignumber.equal(expectedFinalOwnerBalance);
- expect(finalReceiverBalance).to.be.bignumber.equal(expectedFinalReceiverBalance);
- });
-
- it('should return true on a 0 value transfer', async () => {
- const didReturnTrue = await token.transfer.callAsync(spender, new BigNumber(0), {
- from: owner,
- });
- expect(didReturnTrue).to.be.true();
- });
- });
-
- describe('transferFrom', () => {
- it('should throw if owner has insufficient balance', async () => {
- const ownerBalance = await token.balanceOf.callAsync(owner);
- const amountToTransfer = ownerBalance.plus(1);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- return expectContractCallFailedAsync(
- token.transferFrom.callAsync(owner, spender, amountToTransfer, {
- from: spender,
- }),
- RevertReason.Erc20InsufficientBalance,
- );
- });
-
- it('should throw if spender has insufficient allowance', async () => {
- const ownerBalance = await token.balanceOf.callAsync(owner);
- const amountToTransfer = ownerBalance;
-
- const spenderAllowance = await token.allowance.callAsync(owner, spender);
- const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
- expect(isSpenderAllowanceInsufficient).to.be.true();
-
- return expectContractCallFailedAsync(
- token.transferFrom.callAsync(owner, spender, amountToTransfer, {
- from: spender,
- }),
- RevertReason.Erc20InsufficientAllowance,
- );
- });
-
- it('should return true on a 0 value transfer', async () => {
- const amountToTransfer = new BigNumber(0);
- const didReturnTrue = await token.transferFrom.callAsync(owner, spender, amountToTransfer, {
- from: spender,
- });
- expect(didReturnTrue).to.be.true();
- });
-
- it('should not modify spender allowance if spender allowance is 2^256 - 1', async () => {
- const initOwnerBalance = await token.balanceOf.callAsync(owner);
- const amountToTransfer = initOwnerBalance;
- const initSpenderAllowance = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const newSpenderAllowance = await token.allowance.callAsync(owner, spender);
- expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
- });
-
- it('should transfer the correct balances if spender has sufficient allowance', async () => {
- const initOwnerBalance = await token.balanceOf.callAsync(owner);
- const amountToTransfer = initOwnerBalance;
- const initSpenderAllowance = initOwnerBalance;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const newOwnerBalance = await token.balanceOf.callAsync(owner);
- const newSpenderBalance = await token.balanceOf.callAsync(spender);
-
- expect(newOwnerBalance).to.be.bignumber.equal(0);
- expect(newSpenderBalance).to.be.bignumber.equal(initOwnerBalance);
- });
-
- it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
- const initOwnerBalance = await token.balanceOf.callAsync(owner);
- const amountToTransfer = initOwnerBalance;
- const initSpenderAllowance = initOwnerBalance;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.approve.sendTransactionAsync(spender, initSpenderAllowance, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await token.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const newSpenderAllowance = await token.allowance.callAsync(owner, spender);
- expect(newSpenderAllowance).to.be.bignumber.equal(0);
- });
- });
-});
diff --git a/packages/contracts/test/tokens/weth9.ts b/packages/contracts/test/tokens/weth9.ts
deleted file mode 100644
index 9a31dc3f2..000000000
--- a/packages/contracts/test/tokens/weth9.ts
+++ /dev/null
@@ -1,138 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as chai from 'chai';
-
-import { WETH9Contract } from '../../generated-wrappers/weth9';
-import { artifacts } from '../../src/artifacts';
-import { expectInsufficientFundsAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
-import { chaiSetup } from '../utils/chai_setup';
-import { constants } from '../utils/constants';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-describe('EtherToken', () => {
- let account: string;
- const gasPrice = Web3Wrapper.toBaseUnitAmount(new BigNumber(20), 9);
- let etherToken: WETH9Contract;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- account = accounts[0];
-
- etherToken = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, {
- gasPrice,
- ...txDefaults,
- });
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- describe('deposit', () => {
- it('should throw if caller attempts to deposit more Ether than caller balance', async () => {
- const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
- const ethToDeposit = initEthBalance.plus(1);
-
- return expectInsufficientFundsAsync(etherToken.deposit.sendTransactionAsync({ value: ethToDeposit }));
- });
-
- it('should convert deposited Ether to wrapped Ether tokens', async () => {
- const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
- const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
-
- const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
-
- const txHash = await etherToken.deposit.sendTransactionAsync({ value: ethToDeposit });
- const receipt = await web3Wrapper.awaitTransactionSuccessAsync(
- txHash,
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
- const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
- const finalEthTokenBalance = await etherToken.balanceOf.callAsync(account);
-
- expect(finalEthBalance).to.be.bignumber.equal(initEthBalance.minus(ethToDeposit.plus(ethSpentOnGas)));
- expect(finalEthTokenBalance).to.be.bignumber.equal(initEthTokenBalance.plus(ethToDeposit));
- });
- });
-
- describe('withdraw', () => {
- it('should throw if caller attempts to withdraw greater than caller balance', async () => {
- const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
- const ethTokensToWithdraw = initEthTokenBalance.plus(1);
-
- return expectTransactionFailedWithoutReasonAsync(
- etherToken.withdraw.sendTransactionAsync(ethTokensToWithdraw),
- );
- });
-
- it('should convert ether tokens to ether with sufficient balance', async () => {
- const ethToDeposit = new BigNumber(Web3Wrapper.toWei(new BigNumber(1)));
- await web3Wrapper.awaitTransactionSuccessAsync(
- await etherToken.deposit.sendTransactionAsync({ value: ethToDeposit }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
- const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
- const ethTokensToWithdraw = initEthTokenBalance;
- expect(ethTokensToWithdraw).to.not.be.bignumber.equal(0);
- const txHash = await etherToken.withdraw.sendTransactionAsync(ethTokensToWithdraw, {
- gas: constants.MAX_ETHERTOKEN_WITHDRAW_GAS,
- });
- const receipt = await web3Wrapper.awaitTransactionSuccessAsync(
- txHash,
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
- const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
- const finalEthTokenBalance = await etherToken.balanceOf.callAsync(account);
-
- expect(finalEthBalance).to.be.bignumber.equal(
- initEthBalance.plus(ethTokensToWithdraw.minus(ethSpentOnGas)),
- );
- expect(finalEthTokenBalance).to.be.bignumber.equal(initEthTokenBalance.minus(ethTokensToWithdraw));
- });
- });
-
- describe('fallback', () => {
- it('should convert sent ether to ether tokens', async () => {
- const initEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
- const initEthTokenBalance = await etherToken.balanceOf.callAsync(account);
-
- const ethToDeposit = Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18);
-
- const txHash = await web3Wrapper.sendTransactionAsync({
- from: account,
- to: etherToken.address,
- value: ethToDeposit,
- gasPrice,
- });
-
- const receipt = await web3Wrapper.awaitTransactionSuccessAsync(
- txHash,
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const ethSpentOnGas = gasPrice.times(receipt.gasUsed);
- const finalEthBalance = await web3Wrapper.getBalanceInWeiAsync(account);
- const finalEthTokenBalance = await etherToken.balanceOf.callAsync(account);
-
- expect(finalEthBalance).to.be.bignumber.equal(initEthBalance.minus(ethToDeposit.plus(ethSpentOnGas)));
- expect(finalEthTokenBalance).to.be.bignumber.equal(initEthTokenBalance.plus(ethToDeposit));
- });
- });
-});
diff --git a/packages/contracts/test/tokens/zrx_token.ts b/packages/contracts/test/tokens/zrx_token.ts
deleted file mode 100644
index cab62c205..000000000
--- a/packages/contracts/test/tokens/zrx_token.ts
+++ /dev/null
@@ -1,206 +0,0 @@
-import { BlockchainLifecycle } from '@0x/dev-utils';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as chai from 'chai';
-
-import { ZRXTokenContract } from '../../generated-wrappers/zrx_token';
-import { artifacts } from '../../src/artifacts';
-import { chaiSetup } from '../utils/chai_setup';
-import { constants } from '../utils/constants';
-import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-chaiSetup.configure();
-const expect = chai.expect;
-const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-describe('ZRXToken', () => {
- let owner: string;
- let spender: string;
- let MAX_UINT: BigNumber;
- let zrxToken: ZRXTokenContract;
-
- before(async () => {
- await blockchainLifecycle.startAsync();
- });
- after(async () => {
- await blockchainLifecycle.revertAsync();
- });
- before(async () => {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- owner = accounts[0];
- spender = accounts[1];
- zrxToken = await ZRXTokenContract.deployFrom0xArtifactAsync(artifacts.ZRXToken, provider, txDefaults);
- MAX_UINT = constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
- });
- beforeEach(async () => {
- await blockchainLifecycle.startAsync();
- });
- afterEach(async () => {
- await blockchainLifecycle.revertAsync();
- });
- describe('constants', () => {
- it('should have 18 decimals', async () => {
- const decimals = new BigNumber(await zrxToken.decimals.callAsync());
- const expectedDecimals = 18;
- expect(decimals).to.be.bignumber.equal(expectedDecimals);
- });
-
- it('should have a total supply of 1 billion tokens', async () => {
- const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
- const expectedTotalSupply = 1000000000;
- expect(Web3Wrapper.toUnitAmount(totalSupply, 18)).to.be.bignumber.equal(expectedTotalSupply);
- });
-
- it('should be named 0x Protocol Token', async () => {
- const name = await zrxToken.name.callAsync();
- const expectedName = '0x Protocol Token';
- expect(name).to.be.equal(expectedName);
- });
-
- it('should have the symbol ZRX', async () => {
- const symbol = await zrxToken.symbol.callAsync();
- const expectedSymbol = 'ZRX';
- expect(symbol).to.be.equal(expectedSymbol);
- });
- });
-
- describe('constructor', () => {
- it('should initialize owner balance to totalSupply', async () => {
- const ownerBalance = await zrxToken.balanceOf.callAsync(owner);
- const totalSupply = new BigNumber(await zrxToken.totalSupply.callAsync());
- expect(totalSupply).to.be.bignumber.equal(ownerBalance);
- });
- });
-
- describe('transfer', () => {
- it('should transfer balance from sender to receiver', async () => {
- const receiver = spender;
- const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
- const amountToTransfer = new BigNumber(1);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.transfer.sendTransactionAsync(receiver, amountToTransfer, { from: owner }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const finalOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
- const finalReceiverBalance = await zrxToken.balanceOf.callAsync(receiver);
-
- const expectedFinalOwnerBalance = initOwnerBalance.minus(amountToTransfer);
- const expectedFinalReceiverBalance = amountToTransfer;
- expect(finalOwnerBalance).to.be.bignumber.equal(expectedFinalOwnerBalance);
- expect(finalReceiverBalance).to.be.bignumber.equal(expectedFinalReceiverBalance);
- });
-
- it('should return true on a 0 value transfer', async () => {
- const didReturnTrue = await zrxToken.transfer.callAsync(spender, new BigNumber(0), {
- from: owner,
- });
- expect(didReturnTrue).to.be.true();
- });
- });
-
- describe('transferFrom', () => {
- it('should return false if owner has insufficient balance', async () => {
- const ownerBalance = await zrxToken.balanceOf.callAsync(owner);
- const amountToTransfer = ownerBalance.plus(1);
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.approve.sendTransactionAsync(spender, amountToTransfer, {
- from: owner,
- gas: constants.MAX_TOKEN_APPROVE_GAS,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
- from: spender,
- });
- expect(didReturnTrue).to.be.false();
- });
-
- it('should return false if spender has insufficient allowance', async () => {
- const ownerBalance = await zrxToken.balanceOf.callAsync(owner);
- const amountToTransfer = ownerBalance;
-
- const spenderAllowance = await zrxToken.allowance.callAsync(owner, spender);
- const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0;
- expect(isSpenderAllowanceInsufficient).to.be.true();
-
- const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
- from: spender,
- });
- expect(didReturnTrue).to.be.false();
- });
-
- it('should return true on a 0 value transfer', async () => {
- const amountToTransfer = new BigNumber(0);
- const didReturnTrue = await zrxToken.transferFrom.callAsync(owner, spender, amountToTransfer, {
- from: spender,
- });
- expect(didReturnTrue).to.be.true();
- });
-
- it('should not modify spender allowance if spender allowance is 2^256 - 1', async () => {
- const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
- const amountToTransfer = initOwnerBalance;
- const initSpenderAllowance = MAX_UINT;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.approve.sendTransactionAsync(spender, initSpenderAllowance, {
- from: owner,
- gas: constants.MAX_TOKEN_APPROVE_GAS,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const newSpenderAllowance = await zrxToken.allowance.callAsync(owner, spender);
- expect(initSpenderAllowance).to.be.bignumber.equal(newSpenderAllowance);
- });
-
- it('should transfer the correct balances if spender has sufficient allowance', async () => {
- const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
- const initSpenderBalance = await zrxToken.balanceOf.callAsync(spender);
- const amountToTransfer = initOwnerBalance;
- const initSpenderAllowance = initOwnerBalance;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.approve.sendTransactionAsync(spender, initSpenderAllowance),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const newOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
- const newSpenderBalance = await zrxToken.balanceOf.callAsync(spender);
-
- expect(newOwnerBalance).to.be.bignumber.equal(0);
- expect(newSpenderBalance).to.be.bignumber.equal(initSpenderBalance.plus(initOwnerBalance));
- });
-
- it('should modify allowance if spender has sufficient allowance less than 2^256 - 1', async () => {
- const initOwnerBalance = await zrxToken.balanceOf.callAsync(owner);
- const amountToTransfer = initOwnerBalance;
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.approve.sendTransactionAsync(spender, amountToTransfer),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await zrxToken.transferFrom.sendTransactionAsync(owner, spender, amountToTransfer, {
- from: spender,
- gas: constants.MAX_TOKEN_TRANSFERFROM_GAS,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const newSpenderAllowance = await zrxToken.allowance.callAsync(owner, spender);
- expect(newSpenderAllowance).to.be.bignumber.equal(0);
- });
- });
-});
diff --git a/packages/contracts/test/tutorials/arbitrage.ts b/packages/contracts/test/tutorials/arbitrage.ts
deleted file mode 100644
index 78e0bc238..000000000
--- a/packages/contracts/test/tutorials/arbitrage.ts
+++ /dev/null
@@ -1,260 +0,0 @@
-// import { ECSignature, SignedOrder, ZeroEx } from '0x.js';
-// import { BlockchainLifecycle, devConstants, web3Factory } from '@0x/dev-utils';
-// import { ExchangeContractErrs } from 'ethereum-types';
-// import { BigNumber } from '@0x/utils';
-// import { Web3Wrapper } from '@0x/web3-wrapper';
-// import * as chai from 'chai';
-// import ethUtil = require('ethereumjs-util');
-// import * as Web3 from 'web3';
-
-// import { AccountLevelsContract } from '../../src/generated_contract_wrappers/account_levels';
-// import { ArbitrageContract } from '../../src/generated_contract_wrappers/arbitrage';
-// import { DummyTokenContract } from '../../src/generated_contract_wrappers/dummy_token';
-// import { EtherDeltaContract } from '../../src/generated_contract_wrappers/ether_delta';
-// import { ExchangeContract } from '../../src/generated_contract_wrappers/exchange';
-// import { TokenTransferProxyContract } from '../../src/generated_contract_wrappers/token_transfer_proxy';
-// import { artifacts } from '../../util/artifacts';
-// import { Balances } from '../../util/balances';
-// import { constants } from '../../util/constants';
-// import { crypto } from '../../util/crypto';
-// import { ExchangeWrapper } from '../../util/exchange_wrapper';
-// import { OrderFactory } from '../../util/order_factory';
-// import { BalancesByOwner, ContractName } from '../../util/types';
-// import { chaiSetup } from '../utils/chai_setup';
-
-// import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
-
-// chaiSetup.configure();
-// const expect = chai.expect;
-// const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
-
-// describe('Arbitrage', () => {
-// let coinbase: string;
-// let maker: string;
-// let edMaker: string;
-// let edFrontRunner: string;
-// let amountGet: BigNumber;
-// let amountGive: BigNumber;
-// let makerTokenAmount: BigNumber;
-// let takerTokenAmount: BigNumber;
-// const feeRecipient = constants.NULL_ADDRESS;
-// const INITIAL_BALANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
-// const INITIAL_ALLOWANCE = ZeroEx.toBaseUnitAmount(new BigNumber(10000), 18);
-
-// let weth: DummyTokenContract;
-// let zrx: DummyTokenContract;
-// let arbitrage: ArbitrageContract;
-// let etherDelta: EtherDeltaContract;
-
-// let signedOrder: SignedOrder;
-// let exWrapper: ExchangeWrapper;
-// let orderFactory: OrderFactory;
-
-// let zeroEx: ZeroEx;
-
-// // From a bird's eye view - we create two orders.
-// // 0x order of 1 ZRX (maker) for 1 WETH (taker)
-// // ED order of 2 WETH (tokenGive) for 1 ZRX (tokenGet)
-// // And then we do an atomic arbitrage between them which gives us 1 WETH.
-// before(async () => {
-// const accounts = await web3Wrapper.getAvailableAddressesAsync();
-// [coinbase, maker, edMaker, edFrontRunner] = accounts;
-// weth = await DummyTokenContract.deployFrom0xArtifactAsync(
-// artifacts.DummyToken,
-// provider,
-// txDefaults,
-// constants.DUMMY_TOKEN_NAME,
-// constants.DUMMY_TOKEN_SYMBOL,
-// constants.DUMMY_TOKEN_DECIMALS,
-// constants.DUMMY_TOKEN_TOTAL_SUPPLY,
-// );
-// zrx = await DummyTokenContract.deployFrom0xArtifactAsync(
-// artifacts.DummyToken,
-// provider,
-// txDefaults,
-// constants.DUMMY_TOKEN_NAME,
-// constants.DUMMY_TOKEN_SYMBOL,
-// constants.DUMMY_TOKEN_DECIMALS,
-// constants.DUMMY_TOKEN_TOTAL_SUPPLY,
-// );
-// const accountLevels = await AccountLevelsContract.deployFrom0xArtifactAsync(
-// artifacts.AccountLevels,
-// provider,
-// txDefaults,
-// );
-// const edAdminAddress = accounts[0];
-// const edMakerFee = new BigNumber(0);
-// const edTakerFee = new BigNumber(0);
-// const edFeeRebate = new BigNumber(0);
-// etherDelta = await EtherDeltaContract.deployFrom0xArtifactAsync(
-// artifacts.EtherDelta,
-// provider,
-// txDefaults,
-// edAdminAddress,
-// feeRecipient,
-// accountLevels.address,
-// edMakerFee,
-// edTakerFee,
-// edFeeRebate,
-// );
-// const tokenTransferProxy = await TokenTransferProxyContract.deployFrom0xArtifactAsync(
-// artifacts.TokenTransferProxy,
-// provider,
-// txDefaults,
-// );
-// const exchange = await ExchangeContract.deployFrom0xArtifactAsync(
-// artifacts.Exchange,
-// provider,
-// txDefaults,
-// zrx.address,
-// tokenTransferProxy.address,
-// );
-// await tokenTransferProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { from: accounts[0] });
-// zeroEx = new ZeroEx(provider, {
-// exchangeContractAddress: exchange.address,
-// networkId: constants.TESTRPC_NETWORK_ID,
-// });
-// exWrapper = new ExchangeWrapper(exchange, provider);
-
-// makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(1), 18);
-// takerTokenAmount = makerTokenAmount;
-// const defaultOrderParams = {
-// exchangeContractAddress: exchange.address,
-// maker,
-// feeRecipient,
-// makerTokenAddress: zrx.address,
-// takerTokenAddress: weth.address,
-// makerTokenAmount,
-// takerTokenAmount,
-// makerFee: new BigNumber(0),
-// takerFee: new BigNumber(0),
-// };
-// orderFactory = new OrderFactory(zeroEx, defaultOrderParams);
-// arbitrage = await ArbitrageContract.deployFrom0xArtifactAsync(
-// artifacts.Arbitrage,
-// provider,
-// txDefaults,
-// exchange.address,
-// etherDelta.address,
-// tokenTransferProxy.address,
-// );
-// // Enable arbitrage and withdrawals of tokens
-// await arbitrage.setAllowances.sendTransactionAsync(weth.address, { from: coinbase });
-// await arbitrage.setAllowances.sendTransactionAsync(zrx.address, { from: coinbase });
-
-// // Give some tokens to arbitrage contract
-// await weth.setBalance.sendTransactionAsync(arbitrage.address, takerTokenAmount, { from: coinbase });
-
-// // Fund the maker on exchange side
-// await zrx.setBalance.sendTransactionAsync(maker, makerTokenAmount, { from: coinbase });
-// // Set the allowance for the maker on Exchange side
-// await zrx.approve.sendTransactionAsync(tokenTransferProxy.address, INITIAL_ALLOWANCE, { from: maker });
-
-// amountGive = ZeroEx.toBaseUnitAmount(new BigNumber(2), 18);
-// // Fund the maker on EtherDelta side
-// await weth.setBalance.sendTransactionAsync(edMaker, amountGive, { from: coinbase });
-// // Set the allowance for the maker on EtherDelta side
-// await weth.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edMaker });
-// // Deposit maker funds into EtherDelta
-// await etherDelta.depositToken.sendTransactionAsync(weth.address, amountGive, { from: edMaker });
-
-// amountGet = makerTokenAmount;
-// // Fund the front runner on EtherDelta side
-// await zrx.setBalance.sendTransactionAsync(edFrontRunner, amountGet, { from: coinbase });
-// // Set the allowance for the front-runner on EtherDelta side
-// await zrx.approve.sendTransactionAsync(etherDelta.address, INITIAL_ALLOWANCE, { from: edFrontRunner });
-// // Deposit front runner funds into EtherDelta
-// await etherDelta.depositToken.sendTransactionAsync(zrx.address, amountGet, { from: edFrontRunner });
-// });
-// beforeEach(async () => {
-// await blockchainLifecycle.startAsync();
-// });
-// afterEach(async () => {
-// await blockchainLifecycle.revertAsync();
-// });
-// describe('makeAtomicTrade', () => {
-// let addresses: string[];
-// let values: BigNumber[];
-// let v: number[];
-// let r: string[];
-// let s: string[];
-// let tokenGet: string;
-// let tokenGive: string;
-// let expires: BigNumber;
-// let nonce: BigNumber;
-// let edSignature: ECSignature;
-// before(async () => {
-// signedOrder = await orderFactory.newSignedOrderAsync();
-// tokenGet = zrx.address;
-// tokenGive = weth.address;
-// const blockNumber = await web3Wrapper.getBlockNumberAsync();
-// const ED_ORDER_EXPIRATION_IN_BLOCKS = 10;
-// expires = new BigNumber(blockNumber + ED_ORDER_EXPIRATION_IN_BLOCKS);
-// nonce = new BigNumber(42);
-// const edOrderHash = `0x${crypto
-// .solSHA256([etherDelta.address, tokenGet, amountGet, tokenGive, amountGive, expires, nonce])
-// .toString('hex')}`;
-// const shouldAddPersonalMessagePrefix = false;
-// edSignature = await zeroEx.signOrderHashAsync(edOrderHash, edMaker, shouldAddPersonalMessagePrefix);
-// addresses = [
-// signedOrder.maker,
-// signedOrder.taker,
-// signedOrder.makerTokenAddress,
-// signedOrder.takerTokenAddress,
-// signedOrder.feeRecipient,
-// edMaker,
-// ];
-// const fillTakerTokenAmount = takerTokenAmount;
-// const edFillAmount = makerTokenAmount;
-// values = [
-// signedOrder.makerTokenAmount,
-// signedOrder.takerTokenAmount,
-// signedOrder.makerFee,
-// signedOrder.takerFee,
-// signedOrder.expirationUnixTimestampSec,
-// signedOrder.salt,
-// fillTakerTokenAmount,
-// amountGet,
-// amountGive,
-// expires,
-// nonce,
-// edFillAmount,
-// ];
-// v = [signedOrder.ecSignature.v, edSignature.v];
-// r = [signedOrder.ecSignature.r, edSignature.r];
-// s = [signedOrder.ecSignature.s, edSignature.s];
-// });
-// it('should successfully execute the arbitrage if not front-runned', async () => {
-// const txHash = await arbitrage.makeAtomicTrade.sendTransactionAsync(addresses, values, v, r, s, {
-// from: coinbase,
-// });
-// const res = await zeroEx.awaitTransactionMinedAsync(txHash);
-// const postBalance = await weth.balanceOf.callAsync(arbitrage.address);
-// expect(postBalance).to.be.bignumber.equal(amountGive);
-// });
-// it('should fail and revert if front-runned', async () => {
-// const preBalance = await weth.balanceOf.callAsync(arbitrage.address);
-// // Front-running transaction
-// await etherDelta.trade.sendTransactionAsync(
-// tokenGet,
-// amountGet,
-// tokenGive,
-// amountGive,
-// expires,
-// nonce,
-// edMaker,
-// edSignature.v,
-// edSignature.r,
-// edSignature.s,
-// amountGet,
-// { from: edFrontRunner },
-// );
-// // tslint:disable-next-line:await-promise
-// await expect(
-// arbitrage.makeAtomicTrade.sendTransactionAsync(addresses, values, v, r, s, { from: coinbase }),
-// ).to.be.rejectedWith(constants.REVERT);
-// const postBalance = await weth.balanceOf.callAsync(arbitrage.address);
-// expect(preBalance).to.be.bignumber.equal(postBalance);
-// });
-// });
-// });
diff --git a/packages/contracts/test/utils/assertions.ts b/packages/contracts/test/utils/assertions.ts
deleted file mode 100644
index 5b1cedfcc..000000000
--- a/packages/contracts/test/utils/assertions.ts
+++ /dev/null
@@ -1,199 +0,0 @@
-import { RevertReason } from '@0x/types';
-import { logUtils } from '@0x/utils';
-import { NodeType } from '@0x/web3-wrapper';
-import * as chai from 'chai';
-import { TransactionReceipt, TransactionReceiptStatus, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
-import * as _ from 'lodash';
-
-import { web3Wrapper } from './web3_wrapper';
-
-const expect = chai.expect;
-
-let nodeType: NodeType | undefined;
-
-// Represents the return value of a `sendTransaction` call. The Promise should
-// resolve with either a transaction receipt or a transaction hash.
-export type sendTransactionResult = Promise<TransactionReceipt | TransactionReceiptWithDecodedLogs | string>;
-
-/**
- * Returns ganacheError if the backing Ethereum node is Ganache and gethError
- * if it is Geth.
- * @param ganacheError the error to be returned if the backing node is Ganache.
- * @param gethError the error to be returned if the backing node is Geth.
- * @returns either the given ganacheError or gethError depending on the backing
- * node.
- */
-async function _getGanacheOrGethError(ganacheError: string, gethError: string): Promise<string> {
- if (_.isUndefined(nodeType)) {
- nodeType = await web3Wrapper.getNodeTypeAsync();
- }
- switch (nodeType) {
- case NodeType.Ganache:
- return ganacheError;
- case NodeType.Geth:
- return gethError;
- default:
- throw new Error(`Unknown node type: ${nodeType}`);
- }
-}
-
-async function _getInsufficientFundsErrorMessageAsync(): Promise<string> {
- return _getGanacheOrGethError("sender doesn't have enough funds", 'insufficient funds');
-}
-
-async function _getTransactionFailedErrorMessageAsync(): Promise<string> {
- return _getGanacheOrGethError('revert', 'always failing transaction');
-}
-
-async function _getContractCallFailedErrorMessageAsync(): Promise<string> {
- return _getGanacheOrGethError('revert', 'Contract call failed');
-}
-
-/**
- * Returns the expected error message for an 'invalid opcode' resulting from a
- * contract call. The exact error message depends on the backing Ethereum node.
- */
-export async function getInvalidOpcodeErrorMessageForCallAsync(): Promise<string> {
- return _getGanacheOrGethError('invalid opcode', 'Contract call failed');
-}
-
-/**
- * Returns the expected error message for the given revert reason resulting from
- * a sendTransaction call. The exact error message depends on the backing
- * Ethereum node and whether it supports revert reasons.
- * @param reason a specific revert reason.
- * @returns the expected error message.
- */
-export async function getRevertReasonOrErrorMessageForSendTransactionAsync(reason: RevertReason): Promise<string> {
- return _getGanacheOrGethError(reason, 'always failing transaction');
-}
-
-/**
- * Rejects if the given Promise does not reject with an error indicating
- * insufficient funds.
- * @param p a promise resulting from a contract call or sendTransaction call.
- * @returns a new Promise which will reject if the conditions are not met and
- * otherwise resolve with no value.
- */
-export async function expectInsufficientFundsAsync<T>(p: Promise<T>): Promise<void> {
- const errMessage = await _getInsufficientFundsErrorMessageAsync();
- return expect(p).to.be.rejectedWith(errMessage);
-}
-
-/**
- * Resolves if the the sendTransaction call fails with the given revert reason.
- * However, since Geth does not support revert reasons for sendTransaction, this
- * falls back to expectTransactionFailedWithoutReasonAsync if the backing
- * Ethereum node is Geth.
- * @param p a Promise resulting from a sendTransaction call
- * @param reason a specific revert reason
- * @returns a new Promise which will reject if the conditions are not met and
- * otherwise resolve with no value.
- */
-export async function expectTransactionFailedAsync(p: sendTransactionResult, reason: RevertReason): Promise<void> {
- // HACK(albrow): This dummy `catch` should not be necessary, but if you
- // remove it, there is an uncaught exception and the Node process will
- // forcibly exit. It's possible this is a false positive in
- // make-promises-safe.
- p.catch(e => {
- _.noop(e);
- });
-
- if (_.isUndefined(nodeType)) {
- nodeType = await web3Wrapper.getNodeTypeAsync();
- }
- switch (nodeType) {
- case NodeType.Ganache:
- return expect(p).to.be.rejectedWith(reason);
- case NodeType.Geth:
- logUtils.warn(
- 'WARNING: Geth does not support revert reasons for sendTransaction. This test will pass if the transaction fails for any reason.',
- );
- return expectTransactionFailedWithoutReasonAsync(p);
- default:
- throw new Error(`Unknown node type: ${nodeType}`);
- }
-}
-
-/**
- * Resolves if the transaction fails without a revert reason, or if the
- * corresponding transactionReceipt has a status of 0 or '0', indicating
- * failure.
- * @param p a Promise resulting from a sendTransaction call
- * @returns a new Promise which will reject if the conditions are not met and
- * otherwise resolve with no value.
- */
-export async function expectTransactionFailedWithoutReasonAsync(p: sendTransactionResult): Promise<void> {
- return p
- .then(async result => {
- let txReceiptStatus: TransactionReceiptStatus;
- if (_.isString(result)) {
- // Result is a txHash. We need to make a web3 call to get the
- // receipt, then get the status from the receipt.
- const txReceipt = await web3Wrapper.awaitTransactionMinedAsync(result);
- txReceiptStatus = txReceipt.status;
- } else if ('status' in result) {
- // Result is a transaction receipt, so we can get the status
- // directly.
- txReceiptStatus = result.status;
- } else {
- throw new Error('Unexpected result type: ' + typeof result);
- }
- expect(_.toString(txReceiptStatus)).to.equal(
- '0',
- 'Expected transaction to fail but receipt had a non-zero status, indicating success',
- );
- })
- .catch(async err => {
- // If the promise rejects, we expect a specific error message,
- // depending on the backing Ethereum node type.
- const errMessage = await _getTransactionFailedErrorMessageAsync();
- expect(err.message).to.include(errMessage);
- });
-}
-
-/**
- * Resolves if the the contract call fails with the given revert reason.
- * @param p a Promise resulting from a contract call
- * @param reason a specific revert reason
- * @returns a new Promise which will reject if the conditions are not met and
- * otherwise resolve with no value.
- */
-export async function expectContractCallFailedAsync<T>(p: Promise<T>, reason: RevertReason): Promise<void> {
- return expect(p).to.be.rejectedWith(reason);
-}
-
-/**
- * Resolves if the contract call fails without a revert reason.
- * @param p a Promise resulting from a contract call
- * @returns a new Promise which will reject if the conditions are not met and
- * otherwise resolve with no value.
- */
-export async function expectContractCallFailedWithoutReasonAsync<T>(p: Promise<T>): Promise<void> {
- const errMessage = await _getContractCallFailedErrorMessageAsync();
- return expect(p).to.be.rejectedWith(errMessage);
-}
-
-/**
- * Resolves if the contract creation/deployment fails without a revert reason.
- * @param p a Promise resulting from a contract creation/deployment
- * @returns a new Promise which will reject if the conditions are not met and
- * otherwise resolve with no value.
- */
-export async function expectContractCreationFailedAsync<T>(
- p: sendTransactionResult,
- reason: RevertReason,
-): Promise<void> {
- return expectTransactionFailedAsync(p, reason);
-}
-
-/**
- * Resolves if the contract creation/deployment fails without a revert reason.
- * @param p a Promise resulting from a contract creation/deployment
- * @returns a new Promise which will reject if the conditions are not met and
- * otherwise resolve with no value.
- */
-export async function expectContractCreationFailedWithoutReasonAsync<T>(p: Promise<T>): Promise<void> {
- const errMessage = await _getTransactionFailedErrorMessageAsync();
- return expect(p).to.be.rejectedWith(errMessage);
-}
diff --git a/packages/contracts/test/utils/asset_wrapper.ts b/packages/contracts/test/utils/asset_wrapper.ts
deleted file mode 100644
index 4e7696066..000000000
--- a/packages/contracts/test/utils/asset_wrapper.ts
+++ /dev/null
@@ -1,223 +0,0 @@
-import { assetDataUtils } from '@0x/order-utils';
-import { AssetProxyId } from '@0x/types';
-import { BigNumber, errorUtils } from '@0x/utils';
-import * as _ from 'lodash';
-
-import { AbstractAssetWrapper } from './abstract_asset_wrapper';
-import { constants } from './constants';
-import { ERC20Wrapper } from './erc20_wrapper';
-import { ERC721Wrapper } from './erc721_wrapper';
-
-interface ProxyIdToAssetWrappers {
- [proxyId: string]: AbstractAssetWrapper;
-}
-
-/**
- * This class abstracts away the differences between ERC20 and ERC721 tokens so that
- * the logic that uses it does not need to care what standard a token belongs to.
- */
-export class AssetWrapper {
- private readonly _proxyIdToAssetWrappers: ProxyIdToAssetWrappers;
- constructor(assetWrappers: AbstractAssetWrapper[]) {
- this._proxyIdToAssetWrappers = {};
- _.each(assetWrappers, assetWrapper => {
- const proxyId = assetWrapper.getProxyId();
- this._proxyIdToAssetWrappers[proxyId] = assetWrapper;
- });
- }
- public async getBalanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
- const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
- switch (proxyId) {
- case AssetProxyId.ERC20: {
- const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
- const balance = await erc20Wrapper.getBalanceAsync(userAddress, assetData);
- return balance;
- }
- case AssetProxyId.ERC721: {
- const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
- const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
- const isOwner = await assetWrapper.isOwnerAsync(
- userAddress,
- assetProxyData.tokenAddress,
- assetProxyData.tokenId,
- );
- const balance = isOwner ? new BigNumber(1) : new BigNumber(0);
- return balance;
- }
- default:
- throw errorUtils.spawnSwitchErr('proxyId', proxyId);
- }
- }
- public async setBalanceAsync(userAddress: string, assetData: string, desiredBalance: BigNumber): Promise<void> {
- const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
- switch (proxyId) {
- case AssetProxyId.ERC20: {
- const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
- await erc20Wrapper.setBalanceAsync(userAddress, assetData, desiredBalance);
- return;
- }
- case AssetProxyId.ERC721: {
- if (!desiredBalance.eq(0) && !desiredBalance.eq(1)) {
- throw new Error(`Balance for ERC721 token can only be set to 0 or 1. Got: ${desiredBalance}`);
- }
- const erc721Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
- const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
- const doesTokenExist = erc721Wrapper.doesTokenExistAsync(
- assetProxyData.tokenAddress,
- assetProxyData.tokenId,
- );
- if (!doesTokenExist && desiredBalance.eq(1)) {
- await erc721Wrapper.mintAsync(assetProxyData.tokenAddress, assetProxyData.tokenId, userAddress);
- return;
- } else if (!doesTokenExist && desiredBalance.eq(0)) {
- return; // noop
- }
- const tokenOwner = await erc721Wrapper.ownerOfAsync(
- assetProxyData.tokenAddress,
- assetProxyData.tokenId,
- );
- if (userAddress !== tokenOwner && desiredBalance.eq(1)) {
- await erc721Wrapper.transferFromAsync(
- assetProxyData.tokenAddress,
- assetProxyData.tokenId,
- tokenOwner,
- userAddress,
- );
- } else if (tokenOwner === userAddress && desiredBalance.eq(0)) {
- // Transfer token to someone else
- const userAddresses = await (erc721Wrapper as any)._web3Wrapper.getAvailableAddressesAsync();
- const nonOwner = _.find(userAddresses, a => a !== userAddress);
- await erc721Wrapper.transferFromAsync(
- assetProxyData.tokenAddress,
- assetProxyData.tokenId,
- tokenOwner,
- nonOwner,
- );
- return;
- } else if (
- (userAddress !== tokenOwner && desiredBalance.eq(0)) ||
- (tokenOwner === userAddress && desiredBalance.eq(1))
- ) {
- return; // noop
- }
- break;
- }
- default:
- throw errorUtils.spawnSwitchErr('proxyId', proxyId);
- }
- }
- public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
- const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
- switch (proxyId) {
- case AssetProxyId.ERC20: {
- const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
- const allowance = await erc20Wrapper.getProxyAllowanceAsync(userAddress, assetData);
- return allowance;
- }
- case AssetProxyId.ERC721: {
- const assetWrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
- const erc721ProxyData = assetDataUtils.decodeERC721AssetData(assetData);
- const isProxyApprovedForAll = await assetWrapper.isProxyApprovedForAllAsync(
- userAddress,
- erc721ProxyData.tokenAddress,
- );
- if (isProxyApprovedForAll) {
- return constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS;
- }
-
- const isProxyApproved = await assetWrapper.isProxyApprovedAsync(
- erc721ProxyData.tokenAddress,
- erc721ProxyData.tokenId,
- );
- const allowance = isProxyApproved ? new BigNumber(1) : new BigNumber(0);
- return allowance;
- }
- default:
- throw errorUtils.spawnSwitchErr('proxyId', proxyId);
- }
- }
- public async setProxyAllowanceAsync(
- userAddress: string,
- assetData: string,
- desiredAllowance: BigNumber,
- ): Promise<void> {
- const proxyId = assetDataUtils.decodeAssetProxyId(assetData);
- switch (proxyId) {
- case AssetProxyId.ERC20: {
- const erc20Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC20Wrapper;
- await erc20Wrapper.setAllowanceAsync(userAddress, assetData, desiredAllowance);
- return;
- }
- case AssetProxyId.ERC721: {
- if (
- !desiredAllowance.eq(0) &&
- !desiredAllowance.eq(1) &&
- !desiredAllowance.eq(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS)
- ) {
- throw new Error(
- `Allowance for ERC721 token can only be set to 0, 1 or 2^256-1. Got: ${desiredAllowance}`,
- );
- }
- const erc721Wrapper = this._proxyIdToAssetWrappers[proxyId] as ERC721Wrapper;
- const assetProxyData = assetDataUtils.decodeERC721AssetData(assetData);
-
- const doesTokenExist = await erc721Wrapper.doesTokenExistAsync(
- assetProxyData.tokenAddress,
- assetProxyData.tokenId,
- );
- if (!doesTokenExist) {
- throw new Error(
- `Cannot setProxyAllowance on non-existent token: ${assetProxyData.tokenAddress} ${
- assetProxyData.tokenId
- }`,
- );
- }
- const isProxyApprovedForAll = await erc721Wrapper.isProxyApprovedForAllAsync(
- userAddress,
- assetProxyData.tokenAddress,
- );
- if (!isProxyApprovedForAll && desiredAllowance.eq(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS)) {
- const isApproved = true;
- await erc721Wrapper.approveProxyForAllAsync(
- assetProxyData.tokenAddress,
- assetProxyData.tokenId,
- isApproved,
- );
- } else if (isProxyApprovedForAll && desiredAllowance.eq(0)) {
- const isApproved = false;
- await erc721Wrapper.approveProxyForAllAsync(
- assetProxyData.tokenAddress,
- assetProxyData.tokenId,
- isApproved,
- );
- } else if (isProxyApprovedForAll && desiredAllowance.eq(constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS)) {
- return; // Noop
- }
-
- const isProxyApproved = await erc721Wrapper.isProxyApprovedAsync(
- assetProxyData.tokenAddress,
- assetProxyData.tokenId,
- );
- if (!isProxyApproved && desiredAllowance.eq(1)) {
- await erc721Wrapper.approveProxyAsync(assetProxyData.tokenAddress, assetProxyData.tokenId);
- } else if (isProxyApproved && desiredAllowance.eq(0)) {
- // Remove approval
- await erc721Wrapper.approveAsync(
- constants.NULL_ADDRESS,
- assetProxyData.tokenAddress,
- assetProxyData.tokenId,
- );
- } else if (
- (!isProxyApproved && desiredAllowance.eq(0)) ||
- (isProxyApproved && desiredAllowance.eq(1))
- ) {
- return; // noop
- }
-
- break;
- }
- default:
- throw errorUtils.spawnSwitchErr('proxyId', proxyId);
- }
- }
-}
diff --git a/packages/contracts/test/utils/constants.ts b/packages/contracts/test/utils/constants.ts
deleted file mode 100644
index cd21330e9..000000000
--- a/packages/contracts/test/utils/constants.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as ethUtil from 'ethereumjs-util';
-import * as _ from 'lodash';
-
-const TESTRPC_PRIVATE_KEYS_STRINGS = [
- '0xf2f48ee19680706196e2e339e5da3491186e0c4c5030670656b0e0164837257d',
- '0x5d862464fe9303452126c8bc94274b8c5f9874cbd219789b3eb2128075a76f72',
- '0xdf02719c4df8b9b8ac7f551fcb5d9ef48fa27eef7a66453879f4d8fdc6e78fb1',
- '0xff12e391b79415e941a94de3bf3a9aee577aed0731e297d5cfa0b8a1e02fa1d0',
- '0x752dd9cf65e68cfaba7d60225cbdbc1f4729dd5e5507def72815ed0d8abc6249',
- '0xefb595a0178eb79a8df953f87c5148402a224cdf725e88c0146727c6aceadccd',
- '0x83c6d2cc5ddcf9711a6d59b417dc20eb48afd58d45290099e5987e3d768f328f',
- '0xbb2d3f7c9583780a7d3904a2f55d792707c345f21de1bacb2d389934d82796b2',
- '0xb2fd4d29c1390b71b8795ae81196bfd60293adf99f9d32a0aff06288fcdac55f',
- '0x23cb7121166b9a2f93ae0b7c05bde02eae50d64449b2cbb42bc84e9d38d6cc89',
-];
-
-export const constants = {
- BASE_16: 16,
- INVALID_OPCODE: 'invalid opcode',
- TESTRPC_NETWORK_ID: 50,
- // Note(albrow): In practice V8 and most other engines limit the minimum
- // interval for setInterval to 10ms. We still set it to 0 here in order to
- // ensure we always use the minimum interval.
- AWAIT_TRANSACTION_MINED_MS: 0,
- MAX_ETHERTOKEN_WITHDRAW_GAS: 43000,
- MAX_EXECUTE_TRANSACTION_GAS: 1000000,
- MAX_TOKEN_TRANSFERFROM_GAS: 80000,
- MAX_TOKEN_APPROVE_GAS: 60000,
- MAX_TRANSFER_FROM_GAS: 150000,
- DUMMY_TOKEN_NAME: '',
- DUMMY_TOKEN_SYMBOL: '',
- DUMMY_TOKEN_DECIMALS: new BigNumber(18),
- DUMMY_TOKEN_TOTAL_SUPPLY: new BigNumber(0),
- NULL_BYTES: '0x',
- NUM_DUMMY_ERC20_TO_DEPLOY: 3,
- NUM_DUMMY_ERC721_TO_DEPLOY: 1,
- NUM_ERC721_TOKENS_TO_MINT: 2,
- NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
- UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1),
- TESTRPC_PRIVATE_KEYS: _.map(TESTRPC_PRIVATE_KEYS_STRINGS, privateKeyString => ethUtil.toBuffer(privateKeyString)),
- INITIAL_ERC20_BALANCE: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18),
- INITIAL_ERC20_ALLOWANCE: Web3Wrapper.toBaseUnitAmount(new BigNumber(10000), 18),
- STATIC_ORDER_PARAMS: {
- makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 18),
- takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(200), 18),
- makerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
- takerFee: Web3Wrapper.toBaseUnitAmount(new BigNumber(1), 18),
- },
- WORD_LENGTH: 32,
- ZERO_AMOUNT: new BigNumber(0),
- PERCENTAGE_DENOMINATOR: new BigNumber(10).pow(18),
- FUNCTIONS_WITH_MUTEX: [
- 'FILL_ORDER',
- 'FILL_OR_KILL_ORDER',
- 'BATCH_FILL_ORDERS',
- 'BATCH_FILL_OR_KILL_ORDERS',
- 'MARKET_BUY_ORDERS',
- 'MARKET_SELL_ORDERS',
- 'MATCH_ORDERS',
- 'CANCEL_ORDER',
- 'BATCH_CANCEL_ORDERS',
- 'CANCEL_ORDERS_UP_TO',
- 'SET_SIGNATURE_VALIDATOR_APPROVAL',
- ],
-};
diff --git a/packages/contracts/test/utils/erc20_wrapper.ts b/packages/contracts/test/utils/erc20_wrapper.ts
deleted file mode 100644
index c281a2abf..000000000
--- a/packages/contracts/test/utils/erc20_wrapper.ts
+++ /dev/null
@@ -1,182 +0,0 @@
-import { assetDataUtils } from '@0x/order-utils';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import { Provider } from 'ethereum-types';
-import * as _ from 'lodash';
-
-import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
-import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
-import { artifacts } from '../../src/artifacts';
-
-import { constants } from './constants';
-import { ERC20BalancesByOwner } from './types';
-import { txDefaults } from './web3_wrapper';
-
-export class ERC20Wrapper {
- private readonly _tokenOwnerAddresses: string[];
- private readonly _contractOwnerAddress: string;
- private readonly _web3Wrapper: Web3Wrapper;
- private readonly _provider: Provider;
- private readonly _dummyTokenContracts: DummyERC20TokenContract[];
- private _proxyContract?: ERC20ProxyContract;
- private _proxyIdIfExists?: string;
- /**
- * Instanitates an ERC20Wrapper
- * @param provider Web3 provider to use for all JSON RPC requests
- * @param tokenOwnerAddresses Addresses that we want to endow as owners for dummy ERC20 tokens
- * @param contractOwnerAddress Desired owner of the contract
- * Instance of ERC20Wrapper
- */
- constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
- this._dummyTokenContracts = [];
- this._web3Wrapper = new Web3Wrapper(provider);
- this._provider = provider;
- this._tokenOwnerAddresses = tokenOwnerAddresses;
- this._contractOwnerAddress = contractOwnerAddress;
- }
- public async deployDummyTokensAsync(
- numberToDeploy: number,
- decimals: BigNumber,
- ): Promise<DummyERC20TokenContract[]> {
- for (let i = 0; i < numberToDeploy; i++) {
- this._dummyTokenContracts.push(
- await DummyERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC20Token,
- this._provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- decimals,
- constants.DUMMY_TOKEN_TOTAL_SUPPLY,
- ),
- );
- }
- return this._dummyTokenContracts;
- }
- public async deployProxyAsync(): Promise<ERC20ProxyContract> {
- this._proxyContract = await ERC20ProxyContract.deployFrom0xArtifactAsync(
- artifacts.ERC20Proxy,
- this._provider,
- txDefaults,
- );
- this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync();
- return this._proxyContract;
- }
- public getProxyId(): string {
- this._validateProxyContractExistsOrThrow();
- return this._proxyIdIfExists as string;
- }
- public async setBalancesAndAllowancesAsync(): Promise<void> {
- this._validateDummyTokenContractsExistOrThrow();
- this._validateProxyContractExistsOrThrow();
- for (const dummyTokenContract of this._dummyTokenContracts) {
- for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await dummyTokenContract.setBalance.sendTransactionAsync(
- tokenOwnerAddress,
- constants.INITIAL_ERC20_BALANCE,
- { from: this._contractOwnerAddress },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await dummyTokenContract.approve.sendTransactionAsync(
- (this._proxyContract as ERC20ProxyContract).address,
- constants.INITIAL_ERC20_ALLOWANCE,
- { from: tokenOwnerAddress },
- ),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- }
- }
- public async getBalanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
- const tokenContract = this._getTokenContractFromAssetData(assetData);
- const balance = new BigNumber(await tokenContract.balanceOf.callAsync(userAddress));
- return balance;
- }
- public async setBalanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(assetData);
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.setBalance.sendTransactionAsync(userAddress, amount, {
- from: this._contractOwnerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise<BigNumber> {
- const tokenContract = this._getTokenContractFromAssetData(assetData);
- const proxyAddress = (this._proxyContract as ERC20ProxyContract).address;
- const allowance = new BigNumber(await tokenContract.allowance.callAsync(userAddress, proxyAddress));
- return allowance;
- }
- public async setAllowanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(assetData);
- const proxyAddress = (this._proxyContract as ERC20ProxyContract).address;
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.approve.sendTransactionAsync(proxyAddress, amount, {
- from: userAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async getBalancesAsync(): Promise<ERC20BalancesByOwner> {
- this._validateDummyTokenContractsExistOrThrow();
- const balancesByOwner: ERC20BalancesByOwner = {};
- const balances: BigNumber[] = [];
- const balanceInfo: Array<{ tokenOwnerAddress: string; tokenAddress: string }> = [];
- for (const dummyTokenContract of this._dummyTokenContracts) {
- for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
- balances.push(await dummyTokenContract.balanceOf.callAsync(tokenOwnerAddress));
- balanceInfo.push({
- tokenOwnerAddress,
- tokenAddress: dummyTokenContract.address,
- });
- }
- }
- _.forEach(balances, (balance, balanceIndex) => {
- const tokenAddress = balanceInfo[balanceIndex].tokenAddress;
- const tokenOwnerAddress = balanceInfo[balanceIndex].tokenOwnerAddress;
- if (_.isUndefined(balancesByOwner[tokenOwnerAddress])) {
- balancesByOwner[tokenOwnerAddress] = {};
- }
- const wrappedBalance = new BigNumber(balance);
- balancesByOwner[tokenOwnerAddress][tokenAddress] = wrappedBalance;
- });
- return balancesByOwner;
- }
- public addDummyTokenContract(dummy: DummyERC20TokenContract): void {
- if (!_.isUndefined(this._dummyTokenContracts)) {
- this._dummyTokenContracts.push(dummy);
- }
- }
- public addTokenOwnerAddress(address: string): void {
- this._tokenOwnerAddresses.push(address);
- }
- public getTokenOwnerAddresses(): string[] {
- return this._tokenOwnerAddresses;
- }
- public getTokenAddresses(): string[] {
- const tokenAddresses = _.map(this._dummyTokenContracts, dummyTokenContract => dummyTokenContract.address);
- return tokenAddresses;
- }
- private _getTokenContractFromAssetData(assetData: string): DummyERC20TokenContract {
- const erc20ProxyData = assetDataUtils.decodeERC20AssetData(assetData);
- const tokenAddress = erc20ProxyData.tokenAddress;
- const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
- if (_.isUndefined(tokenContractIfExists)) {
- throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`);
- }
- return tokenContractIfExists;
- }
- private _validateDummyTokenContractsExistOrThrow(): void {
- if (_.isUndefined(this._dummyTokenContracts)) {
- throw new Error('Dummy ERC20 tokens not yet deployed, please call "deployDummyTokensAsync"');
- }
- }
- private _validateProxyContractExistsOrThrow(): void {
- if (_.isUndefined(this._proxyContract)) {
- throw new Error('ERC20 proxy contract not yet deployed, please call "deployProxyAsync"');
- }
- }
-}
diff --git a/packages/contracts/test/utils/erc721_wrapper.ts b/packages/contracts/test/utils/erc721_wrapper.ts
deleted file mode 100644
index 3ef4e701d..000000000
--- a/packages/contracts/test/utils/erc721_wrapper.ts
+++ /dev/null
@@ -1,237 +0,0 @@
-import { generatePseudoRandomSalt } from '@0x/order-utils';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import { Provider } from 'ethereum-types';
-import * as _ from 'lodash';
-
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
-import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
-import { artifacts } from '../../src/artifacts';
-
-import { constants } from './constants';
-import { ERC721TokenIdsByOwner } from './types';
-import { txDefaults } from './web3_wrapper';
-
-export class ERC721Wrapper {
- private readonly _tokenOwnerAddresses: string[];
- private readonly _contractOwnerAddress: string;
- private readonly _web3Wrapper: Web3Wrapper;
- private readonly _provider: Provider;
- private readonly _dummyTokenContracts: DummyERC721TokenContract[];
- private _proxyContract?: ERC721ProxyContract;
- private _proxyIdIfExists?: string;
- private _initialTokenIdsByOwner: ERC721TokenIdsByOwner = {};
- constructor(provider: Provider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
- this._web3Wrapper = new Web3Wrapper(provider);
- this._provider = provider;
- this._dummyTokenContracts = [];
- this._tokenOwnerAddresses = tokenOwnerAddresses;
- this._contractOwnerAddress = contractOwnerAddress;
- }
- public async deployDummyTokensAsync(): Promise<DummyERC721TokenContract[]> {
- for (let i = 0; i < constants.NUM_DUMMY_ERC721_TO_DEPLOY; i++) {
- this._dummyTokenContracts.push(
- await DummyERC721TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Token,
- this._provider,
- txDefaults,
- constants.DUMMY_TOKEN_NAME,
- constants.DUMMY_TOKEN_SYMBOL,
- ),
- );
- }
- return this._dummyTokenContracts;
- }
- public async deployProxyAsync(): Promise<ERC721ProxyContract> {
- this._proxyContract = await ERC721ProxyContract.deployFrom0xArtifactAsync(
- artifacts.ERC721Proxy,
- this._provider,
- txDefaults,
- );
- this._proxyIdIfExists = await this._proxyContract.getProxyId.callAsync();
- return this._proxyContract;
- }
- public getProxyId(): string {
- this._validateProxyContractExistsOrThrow();
- return this._proxyIdIfExists as string;
- }
- public async setBalancesAndAllowancesAsync(): Promise<void> {
- this._validateDummyTokenContractsExistOrThrow();
- this._validateProxyContractExistsOrThrow();
- this._initialTokenIdsByOwner = {};
- for (const dummyTokenContract of this._dummyTokenContracts) {
- for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
- for (let i = 0; i < constants.NUM_ERC721_TOKENS_TO_MINT; i++) {
- const tokenId = generatePseudoRandomSalt();
- await this.mintAsync(dummyTokenContract.address, tokenId, tokenOwnerAddress);
- if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress])) {
- this._initialTokenIdsByOwner[tokenOwnerAddress] = {
- [dummyTokenContract.address]: [],
- };
- }
- if (_.isUndefined(this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address])) {
- this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address] = [];
- }
- this._initialTokenIdsByOwner[tokenOwnerAddress][dummyTokenContract.address].push(tokenId);
-
- await this.approveProxyAsync(dummyTokenContract.address, tokenId);
- }
- }
- }
- }
- public async doesTokenExistAsync(tokenAddress: string, tokenId: BigNumber): Promise<boolean> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const owner = await tokenContract.ownerOf.callAsync(tokenId);
- const doesExist = owner !== constants.NULL_ADDRESS;
- return doesExist;
- }
- public async approveProxyAsync(tokenAddress: string, tokenId: BigNumber): Promise<void> {
- const proxyAddress = (this._proxyContract as ERC721ProxyContract).address;
- await this.approveAsync(proxyAddress, tokenAddress, tokenId);
- }
- public async approveProxyForAllAsync(tokenAddress: string, tokenId: BigNumber, isApproved: boolean): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId);
- const proxyAddress = (this._proxyContract as ERC721ProxyContract).address;
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.setApprovalForAll.sendTransactionAsync(proxyAddress, isApproved, {
- from: tokenOwner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async approveAsync(to: string, tokenAddress: string, tokenId: BigNumber): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId);
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.approve.sendTransactionAsync(to, tokenId, {
- from: tokenOwner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async transferFromAsync(
- tokenAddress: string,
- tokenId: BigNumber,
- currentOwner: string,
- userAddress: string,
- ): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.transferFrom.sendTransactionAsync(currentOwner, userAddress, tokenId, {
- from: currentOwner,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async mintAsync(tokenAddress: string, tokenId: BigNumber, userAddress: string): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.mint.sendTransactionAsync(userAddress, tokenId, {
- from: this._contractOwnerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async burnAsync(tokenAddress: string, tokenId: BigNumber, owner: string): Promise<void> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- await this._web3Wrapper.awaitTransactionSuccessAsync(
- await tokenContract.burn.sendTransactionAsync(owner, tokenId, {
- from: this._contractOwnerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- }
- public async ownerOfAsync(tokenAddress: string, tokenId: BigNumber): Promise<string> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const owner = await tokenContract.ownerOf.callAsync(tokenId);
- return owner;
- }
- public async isOwnerAsync(userAddress: string, tokenAddress: string, tokenId: BigNumber): Promise<boolean> {
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const tokenOwner = await tokenContract.ownerOf.callAsync(tokenId);
- const isOwner = tokenOwner === userAddress;
- return isOwner;
- }
- public async isProxyApprovedForAllAsync(userAddress: string, tokenAddress: string): Promise<boolean> {
- this._validateProxyContractExistsOrThrow();
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const operator = (this._proxyContract as ERC721ProxyContract).address;
- const didApproveAll = await tokenContract.isApprovedForAll.callAsync(userAddress, operator);
- return didApproveAll;
- }
- public async isProxyApprovedAsync(tokenAddress: string, tokenId: BigNumber): Promise<boolean> {
- this._validateProxyContractExistsOrThrow();
- const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
- const approvedAddress = await tokenContract.getApproved.callAsync(tokenId);
- const proxyAddress = (this._proxyContract as ERC721ProxyContract).address;
- const isProxyAnApprovedOperator = approvedAddress === proxyAddress;
- return isProxyAnApprovedOperator;
- }
- public async getBalancesAsync(): Promise<ERC721TokenIdsByOwner> {
- this._validateDummyTokenContractsExistOrThrow();
- this._validateBalancesAndAllowancesSetOrThrow();
- const tokenIdsByOwner: ERC721TokenIdsByOwner = {};
- const tokenOwnerAddresses: string[] = [];
- const tokenInfo: Array<{ tokenId: BigNumber; tokenAddress: string }> = [];
- for (const dummyTokenContract of this._dummyTokenContracts) {
- for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
- const initialTokenOwnerIds = this._initialTokenIdsByOwner[tokenOwnerAddress][
- dummyTokenContract.address
- ];
- for (const tokenId of initialTokenOwnerIds) {
- tokenOwnerAddresses.push(await dummyTokenContract.ownerOf.callAsync(tokenId));
- tokenInfo.push({
- tokenId,
- tokenAddress: dummyTokenContract.address,
- });
- }
- }
- }
- _.forEach(tokenOwnerAddresses, (tokenOwnerAddress, ownerIndex) => {
- const tokenAddress = tokenInfo[ownerIndex].tokenAddress;
- const tokenId = tokenInfo[ownerIndex].tokenId;
- if (_.isUndefined(tokenIdsByOwner[tokenOwnerAddress])) {
- tokenIdsByOwner[tokenOwnerAddress] = {
- [tokenAddress]: [],
- };
- }
- if (_.isUndefined(tokenIdsByOwner[tokenOwnerAddress][tokenAddress])) {
- tokenIdsByOwner[tokenOwnerAddress][tokenAddress] = [];
- }
- tokenIdsByOwner[tokenOwnerAddress][tokenAddress].push(tokenId);
- });
- return tokenIdsByOwner;
- }
- public getTokenOwnerAddresses(): string[] {
- return this._tokenOwnerAddresses;
- }
- public getTokenAddresses(): string[] {
- const tokenAddresses = _.map(this._dummyTokenContracts, dummyTokenContract => dummyTokenContract.address);
- return tokenAddresses;
- }
- private _getTokenContractFromAssetData(tokenAddress: string): DummyERC721TokenContract {
- const tokenContractIfExists = _.find(this._dummyTokenContracts, c => c.address === tokenAddress);
- if (_.isUndefined(tokenContractIfExists)) {
- throw new Error(`Token: ${tokenAddress} was not deployed through ERC20Wrapper`);
- }
- return tokenContractIfExists;
- }
- private _validateDummyTokenContractsExistOrThrow(): void {
- if (_.isUndefined(this._dummyTokenContracts)) {
- throw new Error('Dummy ERC721 tokens not yet deployed, please call "deployDummyTokensAsync"');
- }
- }
- private _validateProxyContractExistsOrThrow(): void {
- if (_.isUndefined(this._proxyContract)) {
- throw new Error('ERC721 proxy contract not yet deployed, please call "deployProxyAsync"');
- }
- }
- private _validateBalancesAndAllowancesSetOrThrow(): void {
- if (_.keys(this._initialTokenIdsByOwner).length === 0) {
- throw new Error(
- 'Dummy ERC721 balances and allowances not yet set, please call "setBalancesAndAllowancesAsync"',
- );
- }
- }
-}
diff --git a/packages/contracts/test/utils/exchange_wrapper.ts b/packages/contracts/test/utils/exchange_wrapper.ts
deleted file mode 100644
index c28989d3f..000000000
--- a/packages/contracts/test/utils/exchange_wrapper.ts
+++ /dev/null
@@ -1,276 +0,0 @@
-import { SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
-
-import { ExchangeContract } from '../../generated-wrappers/exchange';
-
-import { formatters } from './formatters';
-import { LogDecoder } from './log_decoder';
-import { orderUtils } from './order_utils';
-import { FillResults, OrderInfo, SignedTransaction } from './types';
-
-export class ExchangeWrapper {
- private readonly _exchange: ExchangeContract;
- private readonly _web3Wrapper: Web3Wrapper;
- private readonly _logDecoder: LogDecoder;
- constructor(exchangeContract: ExchangeContract, provider: Provider) {
- this._exchange = exchangeContract;
- this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper);
- }
- public async fillOrderAsync(
- signedOrder: SignedOrder,
- from: string,
- opts: { takerAssetFillAmount?: BigNumber } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
- const txHash = await this._exchange.fillOrder.sendTransactionAsync(
- params.order,
- params.takerAssetFillAmount,
- params.signature,
- { from },
- );
- const txReceipt = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return txReceipt;
- }
- public async cancelOrderAsync(signedOrder: SignedOrder, from: string): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createCancel(signedOrder);
- const txHash = await this._exchange.cancelOrder.sendTransactionAsync(params.order, { from });
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async fillOrKillOrderAsync(
- signedOrder: SignedOrder,
- from: string,
- opts: { takerAssetFillAmount?: BigNumber } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
- const txHash = await this._exchange.fillOrKillOrder.sendTransactionAsync(
- params.order,
- params.takerAssetFillAmount,
- params.signature,
- { from },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async fillOrderNoThrowAsync(
- signedOrder: SignedOrder,
- from: string,
- opts: { takerAssetFillAmount?: BigNumber; gas?: number } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
- const txHash = await this._exchange.fillOrderNoThrow.sendTransactionAsync(
- params.order,
- params.takerAssetFillAmount,
- params.signature,
- { from, gas: opts.gas },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async batchFillOrdersAsync(
- orders: SignedOrder[],
- from: string,
- opts: { takerAssetFillAmounts?: BigNumber[] } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
- const txHash = await this._exchange.batchFillOrders.sendTransactionAsync(
- params.orders,
- params.takerAssetFillAmounts,
- params.signatures,
- { from },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async batchFillOrKillOrdersAsync(
- orders: SignedOrder[],
- from: string,
- opts: { takerAssetFillAmounts?: BigNumber[] } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
- const txHash = await this._exchange.batchFillOrKillOrders.sendTransactionAsync(
- params.orders,
- params.takerAssetFillAmounts,
- params.signatures,
- { from },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async batchFillOrdersNoThrowAsync(
- orders: SignedOrder[],
- from: string,
- opts: { takerAssetFillAmounts?: BigNumber[]; gas?: number } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchFill(orders, opts.takerAssetFillAmounts);
- const txHash = await this._exchange.batchFillOrdersNoThrow.sendTransactionAsync(
- params.orders,
- params.takerAssetFillAmounts,
- params.signatures,
- { from, gas: opts.gas },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async marketSellOrdersAsync(
- orders: SignedOrder[],
- from: string,
- opts: { takerAssetFillAmount: BigNumber },
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount);
- const txHash = await this._exchange.marketSellOrders.sendTransactionAsync(
- params.orders,
- params.takerAssetFillAmount,
- params.signatures,
- { from },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async marketSellOrdersNoThrowAsync(
- orders: SignedOrder[],
- from: string,
- opts: { takerAssetFillAmount: BigNumber; gas?: number },
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketSellOrders(orders, opts.takerAssetFillAmount);
- const txHash = await this._exchange.marketSellOrdersNoThrow.sendTransactionAsync(
- params.orders,
- params.takerAssetFillAmount,
- params.signatures,
- { from, gas: opts.gas },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async marketBuyOrdersAsync(
- orders: SignedOrder[],
- from: string,
- opts: { makerAssetFillAmount: BigNumber },
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
- const txHash = await this._exchange.marketBuyOrders.sendTransactionAsync(
- params.orders,
- params.makerAssetFillAmount,
- params.signatures,
- { from },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async marketBuyOrdersNoThrowAsync(
- orders: SignedOrder[],
- from: string,
- opts: { makerAssetFillAmount: BigNumber; gas?: number },
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createMarketBuyOrders(orders, opts.makerAssetFillAmount);
- const txHash = await this._exchange.marketBuyOrdersNoThrow.sendTransactionAsync(
- params.orders,
- params.makerAssetFillAmount,
- params.signatures,
- { from, gas: opts.gas },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async batchCancelOrdersAsync(
- orders: SignedOrder[],
- from: string,
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = formatters.createBatchCancel(orders);
- const txHash = await this._exchange.batchCancelOrders.sendTransactionAsync(params.orders, { from });
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async cancelOrdersUpToAsync(salt: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
- const txHash = await this._exchange.cancelOrdersUpTo.sendTransactionAsync(salt, { from });
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async registerAssetProxyAsync(
- assetProxyAddress: string,
- from: string,
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const txHash = await this._exchange.registerAssetProxy.sendTransactionAsync(assetProxyAddress, { from });
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async executeTransactionAsync(
- signedTx: SignedTransaction,
- from: string,
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const txHash = await this._exchange.executeTransaction.sendTransactionAsync(
- signedTx.salt,
- signedTx.signerAddress,
- signedTx.data,
- signedTx.signature,
- { from },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async getTakerAssetFilledAmountAsync(orderHashHex: string): Promise<BigNumber> {
- const filledAmount = await this._exchange.filled.callAsync(orderHashHex);
- return filledAmount;
- }
- public async isCancelledAsync(orderHashHex: string): Promise<boolean> {
- const isCancelled = await this._exchange.cancelled.callAsync(orderHashHex);
- return isCancelled;
- }
- public async getOrderEpochAsync(makerAddress: string, senderAddress: string): Promise<BigNumber> {
- const orderEpoch = await this._exchange.orderEpoch.callAsync(makerAddress, senderAddress);
- return orderEpoch;
- }
- public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> {
- const orderInfo = (await this._exchange.getOrderInfo.callAsync(signedOrder)) as OrderInfo;
- return orderInfo;
- }
- public async getOrdersInfoAsync(signedOrders: SignedOrder[]): Promise<OrderInfo[]> {
- const ordersInfo = (await this._exchange.getOrdersInfo.callAsync(signedOrders)) as OrderInfo[];
- return ordersInfo;
- }
- public async matchOrdersAsync(
- signedOrderLeft: SignedOrder,
- signedOrderRight: SignedOrder,
- from: string,
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = orderUtils.createMatchOrders(signedOrderLeft, signedOrderRight);
- const txHash = await this._exchange.matchOrders.sendTransactionAsync(
- params.left,
- params.right,
- params.leftSignature,
- params.rightSignature,
- { from },
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async getFillOrderResultsAsync(
- signedOrder: SignedOrder,
- from: string,
- opts: { takerAssetFillAmount?: BigNumber } = {},
- ): Promise<FillResults> {
- const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
- const fillResults = await this._exchange.fillOrder.callAsync(
- params.order,
- params.takerAssetFillAmount,
- params.signature,
- { from },
- );
- return fillResults;
- }
- public abiEncodeFillOrder(signedOrder: SignedOrder, opts: { takerAssetFillAmount?: BigNumber } = {}): string {
- const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
- const data = this._exchange.fillOrder.getABIEncodedTransactionData(
- params.order,
- params.takerAssetFillAmount,
- params.signature,
- );
- return data;
- }
- public getExchangeAddress(): string {
- return this._exchange.address;
- }
-}
diff --git a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
deleted file mode 100644
index 8046771f9..000000000
--- a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts
+++ /dev/null
@@ -1,924 +0,0 @@
-import {
- assetDataUtils,
- BalanceAndProxyAllowanceLazyStore,
- ExchangeTransferSimulator,
- orderHashUtils,
- OrderStateUtils,
- OrderValidationUtils,
-} from '@0x/order-utils';
-import { AssetProxyId, RevertReason, SignatureType, SignedOrder } from '@0x/types';
-import { BigNumber, errorUtils, logUtils } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as chai from 'chai';
-import { LogWithDecodedArgs, Provider, TxData } from 'ethereum-types';
-import * as _ from 'lodash';
-import 'make-promises-safe';
-
-import { ExchangeContract, ExchangeFillEventArgs } from '../../generated-wrappers/exchange';
-import { TestLibsContract } from '../../generated-wrappers/test_libs';
-import { artifacts } from '../../src/artifacts';
-
-import { expectTransactionFailedAsync } from './assertions';
-import { AssetWrapper } from './asset_wrapper';
-import { chaiSetup } from './chai_setup';
-import { constants } from './constants';
-import { ERC20Wrapper } from './erc20_wrapper';
-import { ERC721Wrapper } from './erc721_wrapper';
-import { ExchangeWrapper } from './exchange_wrapper';
-import { OrderFactoryFromScenario } from './order_factory_from_scenario';
-import { orderUtils } from './order_utils';
-import { signingUtils } from './signing_utils';
-import { SimpleAssetBalanceAndProxyAllowanceFetcher } from './simple_asset_balance_and_proxy_allowance_fetcher';
-import { SimpleOrderFilledCancelledFetcher } from './simple_order_filled_cancelled_fetcher';
-import {
- AllowanceAmountScenario,
- AssetDataScenario,
- BalanceAmountScenario,
- ExpirationTimeSecondsScenario,
- FeeRecipientAddressScenario,
- FillScenario,
- OrderAssetAmountScenario,
- TakerAssetFillAmountScenario,
- TakerScenario,
- TraderStateScenario,
-} from './types';
-
-chaiSetup.configure();
-const expect = chai.expect;
-
-/**
- * Instantiates a new instance of FillOrderCombinatorialUtils. Since this method has some
- * required async setup, a factory method is required.
- * @param web3Wrapper Web3Wrapper instance
- * @param txDefaults Default Ethereum tx options
- * @return FillOrderCombinatorialUtils instance
- */
-export async function fillOrderCombinatorialUtilsFactoryAsync(
- web3Wrapper: Web3Wrapper,
- txDefaults: Partial<TxData>,
-): Promise<FillOrderCombinatorialUtils> {
- const accounts = await web3Wrapper.getAvailableAddressesAsync();
- const userAddresses = _.slice(accounts, 0, 5);
- const [ownerAddress, makerAddress, takerAddress] = userAddresses;
- const makerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[userAddresses.indexOf(makerAddress)];
-
- const provider = web3Wrapper.getProvider();
- const erc20Wrapper = new ERC20Wrapper(provider, userAddresses, ownerAddress);
- const erc721Wrapper = new ERC721Wrapper(provider, userAddresses, ownerAddress);
-
- const erc20EighteenDecimalTokenCount = 3;
- const eighteenDecimals = new BigNumber(18);
- const [
- erc20EighteenDecimalTokenA,
- erc20EighteenDecimalTokenB,
- zrxToken,
- ] = await erc20Wrapper.deployDummyTokensAsync(erc20EighteenDecimalTokenCount, eighteenDecimals);
- const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
-
- const erc20FiveDecimalTokenCount = 2;
- const fiveDecimals = new BigNumber(5);
- const [erc20FiveDecimalTokenA, erc20FiveDecimalTokenB] = await erc20Wrapper.deployDummyTokensAsync(
- erc20FiveDecimalTokenCount,
- fiveDecimals,
- );
- const zeroDecimals = new BigNumber(0);
- const erc20ZeroDecimalTokenCount = 2;
- const [erc20ZeroDecimalTokenA, erc20ZeroDecimalTokenB] = await erc20Wrapper.deployDummyTokensAsync(
- erc20ZeroDecimalTokenCount,
- zeroDecimals,
- );
- const erc20Proxy = await erc20Wrapper.deployProxyAsync();
- await erc20Wrapper.setBalancesAndAllowancesAsync();
-
- const [erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
- const erc721Proxy = await erc721Wrapper.deployProxyAsync();
- await erc721Wrapper.setBalancesAndAllowancesAsync();
- const erc721Balances = await erc721Wrapper.getBalancesAsync();
-
- const assetWrapper = new AssetWrapper([erc20Wrapper, erc721Wrapper]);
-
- const exchangeContract = await ExchangeContract.deployFrom0xArtifactAsync(
- artifacts.Exchange,
- provider,
- txDefaults,
- zrxAssetData,
- );
- const exchangeWrapper = new ExchangeWrapper(exchangeContract, provider);
- await exchangeWrapper.registerAssetProxyAsync(erc20Proxy.address, ownerAddress);
- await exchangeWrapper.registerAssetProxyAsync(erc721Proxy.address, ownerAddress);
-
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeContract.address, {
- from: ownerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
- await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchangeContract.address, {
- from: ownerAddress,
- }),
- constants.AWAIT_TRANSACTION_MINED_MS,
- );
-
- const orderFactory = new OrderFactoryFromScenario(
- userAddresses,
- zrxToken.address,
- [erc20EighteenDecimalTokenA.address, erc20EighteenDecimalTokenB.address],
- [erc20FiveDecimalTokenA.address, erc20FiveDecimalTokenB.address],
- [erc20ZeroDecimalTokenA.address, erc20ZeroDecimalTokenB.address],
- erc721Token,
- erc721Balances,
- exchangeContract.address,
- );
-
- const testLibsContract = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
-
- const fillOrderCombinatorialUtils = new FillOrderCombinatorialUtils(
- orderFactory,
- ownerAddress,
- makerAddress,
- makerPrivateKey,
- takerAddress,
- zrxAssetData,
- exchangeWrapper,
- assetWrapper,
- testLibsContract,
- );
- return fillOrderCombinatorialUtils;
-}
-
-export class FillOrderCombinatorialUtils {
- public orderFactory: OrderFactoryFromScenario;
- public ownerAddress: string;
- public makerAddress: string;
- public makerPrivateKey: Buffer;
- public takerAddress: string;
- public zrxAssetData: string;
- public exchangeWrapper: ExchangeWrapper;
- public assetWrapper: AssetWrapper;
- public testLibsContract: TestLibsContract;
- public static generateFillOrderCombinations(): FillScenario[] {
- const takerScenarios = [
- TakerScenario.Unspecified,
- // TakerScenario.CorrectlySpecified,
- // TakerScenario.IncorrectlySpecified,
- ];
- const feeRecipientScenarios = [
- FeeRecipientAddressScenario.EthUserAddress,
- // FeeRecipientAddressScenario.BurnAddress,
- ];
- const makerAssetAmountScenario = [
- OrderAssetAmountScenario.Large,
- // OrderAssetAmountScenario.Zero,
- // OrderAssetAmountScenario.Small,
- ];
- const takerAssetAmountScenario = [
- OrderAssetAmountScenario.Large,
- // OrderAssetAmountScenario.Zero,
- // OrderAssetAmountScenario.Small,
- ];
- const makerFeeScenario = [
- OrderAssetAmountScenario.Large,
- // OrderAssetAmountScenario.Small,
- // OrderAssetAmountScenario.Zero,
- ];
- const takerFeeScenario = [
- OrderAssetAmountScenario.Large,
- // OrderAssetAmountScenario.Small,
- // OrderAssetAmountScenario.Zero,
- ];
- const expirationTimeSecondsScenario = [
- ExpirationTimeSecondsScenario.InFuture,
- ExpirationTimeSecondsScenario.InPast,
- ];
- const makerAssetDataScenario = [
- AssetDataScenario.ERC20FiveDecimals,
- AssetDataScenario.ERC20NonZRXEighteenDecimals,
- AssetDataScenario.ERC721,
- AssetDataScenario.ZRXFeeToken,
- ];
- const takerAssetDataScenario = [
- AssetDataScenario.ERC20FiveDecimals,
- AssetDataScenario.ERC20NonZRXEighteenDecimals,
- AssetDataScenario.ERC721,
- AssetDataScenario.ZRXFeeToken,
- ];
- const takerAssetFillAmountScenario = [
- TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount,
- // TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount,
- // TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount,
- ];
- const makerAssetBalanceScenario = [
- BalanceAmountScenario.Higher,
- // BalanceAmountScenario.Exact,
- // BalanceAmountScenario.TooLow,
- ];
- const makerAssetAllowanceScenario = [
- AllowanceAmountScenario.Higher,
- // AllowanceAmountScenario.Exact,
- // AllowanceAmountScenario.TooLow,
- // AllowanceAmountScenario.Unlimited,
- ];
- const makerZRXBalanceScenario = [
- BalanceAmountScenario.Higher,
- // BalanceAmountScenario.Exact,
- // BalanceAmountScenario.TooLow,
- ];
- const makerZRXAllowanceScenario = [
- AllowanceAmountScenario.Higher,
- // AllowanceAmountScenario.Exact,
- // AllowanceAmountScenario.TooLow,
- // AllowanceAmountScenario.Unlimited,
- ];
- const takerAssetBalanceScenario = [
- BalanceAmountScenario.Higher,
- // BalanceAmountScenario.Exact,
- // BalanceAmountScenario.TooLow,
- ];
- const takerAssetAllowanceScenario = [
- AllowanceAmountScenario.Higher,
- // AllowanceAmountScenario.Exact,
- // AllowanceAmountScenario.TooLow,
- // AllowanceAmountScenario.Unlimited,
- ];
- const takerZRXBalanceScenario = [
- BalanceAmountScenario.Higher,
- // BalanceAmountScenario.Exact,
- // BalanceAmountScenario.TooLow,
- ];
- const takerZRXAllowanceScenario = [
- AllowanceAmountScenario.Higher,
- // AllowanceAmountScenario.Exact,
- // AllowanceAmountScenario.TooLow,
- // AllowanceAmountScenario.Unlimited,
- ];
- const fillScenarioArrays = FillOrderCombinatorialUtils._getAllCombinations([
- takerScenarios,
- feeRecipientScenarios,
- makerAssetAmountScenario,
- takerAssetAmountScenario,
- makerFeeScenario,
- takerFeeScenario,
- expirationTimeSecondsScenario,
- makerAssetDataScenario,
- takerAssetDataScenario,
- takerAssetFillAmountScenario,
- makerAssetBalanceScenario,
- makerAssetAllowanceScenario,
- makerZRXBalanceScenario,
- makerZRXAllowanceScenario,
- takerAssetBalanceScenario,
- takerAssetAllowanceScenario,
- takerZRXBalanceScenario,
- takerZRXAllowanceScenario,
- ]);
-
- const fillScenarios = _.map(fillScenarioArrays, fillScenarioArray => {
- // tslint:disable:custom-no-magic-numbers
- const fillScenario: FillScenario = {
- orderScenario: {
- takerScenario: fillScenarioArray[0] as TakerScenario,
- feeRecipientScenario: fillScenarioArray[1] as FeeRecipientAddressScenario,
- makerAssetAmountScenario: fillScenarioArray[2] as OrderAssetAmountScenario,
- takerAssetAmountScenario: fillScenarioArray[3] as OrderAssetAmountScenario,
- makerFeeScenario: fillScenarioArray[4] as OrderAssetAmountScenario,
- takerFeeScenario: fillScenarioArray[5] as OrderAssetAmountScenario,
- expirationTimeSecondsScenario: fillScenarioArray[6] as ExpirationTimeSecondsScenario,
- makerAssetDataScenario: fillScenarioArray[7] as AssetDataScenario,
- takerAssetDataScenario: fillScenarioArray[8] as AssetDataScenario,
- },
- takerAssetFillAmountScenario: fillScenarioArray[9] as TakerAssetFillAmountScenario,
- makerStateScenario: {
- traderAssetBalance: fillScenarioArray[10] as BalanceAmountScenario,
- traderAssetAllowance: fillScenarioArray[11] as AllowanceAmountScenario,
- zrxFeeBalance: fillScenarioArray[12] as BalanceAmountScenario,
- zrxFeeAllowance: fillScenarioArray[13] as AllowanceAmountScenario,
- },
- takerStateScenario: {
- traderAssetBalance: fillScenarioArray[14] as BalanceAmountScenario,
- traderAssetAllowance: fillScenarioArray[15] as AllowanceAmountScenario,
- zrxFeeBalance: fillScenarioArray[16] as BalanceAmountScenario,
- zrxFeeAllowance: fillScenarioArray[17] as AllowanceAmountScenario,
- },
- };
- // tslint:enable:custom-no-magic-numbers
- return fillScenario;
- });
-
- return fillScenarios;
- }
- /**
- * Recursive implementation of generating all combinations of the supplied
- * string-containing arrays.
- */
- private static _getAllCombinations(arrays: string[][]): string[][] {
- // Base case
- if (arrays.length === 1) {
- const remainingValues = _.map(arrays[0], val => {
- return [val];
- });
- return remainingValues;
- } else {
- const result = [];
- const restOfArrays = arrays.slice(1);
- const allCombinationsOfRemaining = FillOrderCombinatorialUtils._getAllCombinations(restOfArrays); // recur with the rest of array
- // tslint:disable:prefer-for-of
- for (let i = 0; i < allCombinationsOfRemaining.length; i++) {
- for (let j = 0; j < arrays[0].length; j++) {
- result.push([arrays[0][j], ...allCombinationsOfRemaining[i]]);
- }
- }
- // tslint:enable:prefer-for-of
- return result;
- }
- }
- constructor(
- orderFactory: OrderFactoryFromScenario,
- ownerAddress: string,
- makerAddress: string,
- makerPrivateKey: Buffer,
- takerAddress: string,
- zrxAssetData: string,
- exchangeWrapper: ExchangeWrapper,
- assetWrapper: AssetWrapper,
- testLibsContract: TestLibsContract,
- ) {
- this.orderFactory = orderFactory;
- this.ownerAddress = ownerAddress;
- this.makerAddress = makerAddress;
- this.makerPrivateKey = makerPrivateKey;
- this.takerAddress = takerAddress;
- this.zrxAssetData = zrxAssetData;
- this.exchangeWrapper = exchangeWrapper;
- this.assetWrapper = assetWrapper;
- this.testLibsContract = testLibsContract;
- }
- public async testFillOrderScenarioAsync(
- provider: Provider,
- fillScenario: FillScenario,
- isVerbose: boolean = false,
- ): Promise<void> {
- // 1. Generate order
- const order = this.orderFactory.generateOrder(fillScenario.orderScenario);
-
- // 2. Sign order
- const orderHashBuff = orderHashUtils.getOrderHashBuffer(order);
- const signature = signingUtils.signMessage(orderHashBuff, this.makerPrivateKey, SignatureType.EthSign);
- const signedOrder = {
- ...order,
- signature: `0x${signature.toString('hex')}`,
- };
-
- const balanceAndProxyAllowanceFetcher = new SimpleAssetBalanceAndProxyAllowanceFetcher(this.assetWrapper);
- const orderFilledCancelledFetcher = new SimpleOrderFilledCancelledFetcher(
- this.exchangeWrapper,
- this.zrxAssetData,
- );
-
- // 3. Figure out fill amount
- const takerAssetFillAmount = await this._getTakerAssetFillAmountAsync(
- signedOrder,
- fillScenario.takerAssetFillAmountScenario,
- balanceAndProxyAllowanceFetcher,
- orderFilledCancelledFetcher,
- );
-
- // 4. Permutate the maker and taker balance/allowance scenarios
- await this._modifyTraderStateAsync(
- fillScenario.makerStateScenario,
- fillScenario.takerStateScenario,
- signedOrder,
- takerAssetFillAmount,
- );
-
- // 5. If I fill it by X, what are the resulting balances/allowances/filled amounts expected?
- const orderValidationUtils = new OrderValidationUtils(orderFilledCancelledFetcher, provider);
- const lazyStore = new BalanceAndProxyAllowanceLazyStore(balanceAndProxyAllowanceFetcher);
- const exchangeTransferSimulator = new ExchangeTransferSimulator(lazyStore);
-
- let fillRevertReasonIfExists;
- try {
- await orderValidationUtils.validateFillOrderThrowIfInvalidAsync(
- exchangeTransferSimulator,
- provider,
- signedOrder,
- takerAssetFillAmount,
- this.takerAddress,
- this.zrxAssetData,
- );
- if (isVerbose) {
- logUtils.log(`Expecting fillOrder to succeed.`);
- }
- } catch (err) {
- fillRevertReasonIfExists = err.message;
- if (isVerbose) {
- logUtils.log(`Expecting fillOrder to fail with:`);
- logUtils.log(err);
- }
- }
-
- // 6. Fill the order
- await this._fillOrderAndAssertOutcomeAsync(
- signedOrder,
- takerAssetFillAmount,
- lazyStore,
- fillRevertReasonIfExists,
- );
-
- await this._abiEncodeFillOrderAndAssertOutcomeAsync(signedOrder, takerAssetFillAmount);
- }
- private async _fillOrderAndAssertOutcomeAsync(
- signedOrder: SignedOrder,
- takerAssetFillAmount: BigNumber,
- lazyStore: BalanceAndProxyAllowanceLazyStore,
- fillRevertReasonIfExists: RevertReason | undefined,
- ): Promise<void> {
- if (!_.isUndefined(fillRevertReasonIfExists)) {
- return expectTransactionFailedAsync(
- this.exchangeWrapper.fillOrderAsync(signedOrder, this.takerAddress, { takerAssetFillAmount }),
- fillRevertReasonIfExists,
- );
- }
-
- const makerAddress = signedOrder.makerAddress;
- const makerAssetData = signedOrder.makerAssetData;
- const takerAssetData = signedOrder.takerAssetData;
- const feeRecipient = signedOrder.feeRecipientAddress;
-
- const expMakerAssetBalanceOfMaker = await lazyStore.getBalanceAsync(makerAssetData, makerAddress);
- const expMakerAssetAllowanceOfMaker = await lazyStore.getProxyAllowanceAsync(makerAssetData, makerAddress);
- const expTakerAssetBalanceOfMaker = await lazyStore.getBalanceAsync(takerAssetData, makerAddress);
- const expZRXAssetBalanceOfMaker = await lazyStore.getBalanceAsync(this.zrxAssetData, makerAddress);
- const expZRXAssetAllowanceOfMaker = await lazyStore.getProxyAllowanceAsync(this.zrxAssetData, makerAddress);
- const expTakerAssetBalanceOfTaker = await lazyStore.getBalanceAsync(takerAssetData, this.takerAddress);
- const expTakerAssetAllowanceOfTaker = await lazyStore.getProxyAllowanceAsync(takerAssetData, this.takerAddress);
- const expMakerAssetBalanceOfTaker = await lazyStore.getBalanceAsync(makerAssetData, this.takerAddress);
- const expZRXAssetBalanceOfTaker = await lazyStore.getBalanceAsync(this.zrxAssetData, this.takerAddress);
- const expZRXAssetAllowanceOfTaker = await lazyStore.getProxyAllowanceAsync(
- this.zrxAssetData,
- this.takerAddress,
- );
- const expZRXAssetBalanceOfFeeRecipient = await lazyStore.getBalanceAsync(this.zrxAssetData, feeRecipient);
-
- const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
- const alreadyFilledTakerAmount = await this.exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash);
- const remainingTakerAmountToFill = signedOrder.takerAssetAmount.minus(alreadyFilledTakerAmount);
- const expFilledTakerAmount = takerAssetFillAmount.gt(remainingTakerAmountToFill)
- ? remainingTakerAmountToFill
- : alreadyFilledTakerAmount.add(takerAssetFillAmount);
-
- const expFilledMakerAmount = orderUtils.getPartialAmountFloor(
- expFilledTakerAmount,
- signedOrder.takerAssetAmount,
- signedOrder.makerAssetAmount,
- );
- const expMakerFeePaid = orderUtils.getPartialAmountFloor(
- expFilledTakerAmount,
- signedOrder.takerAssetAmount,
- signedOrder.makerFee,
- );
- const expTakerFeePaid = orderUtils.getPartialAmountFloor(
- expFilledTakerAmount,
- signedOrder.takerAssetAmount,
- signedOrder.takerFee,
- );
- const fillResults = await this.exchangeWrapper.getFillOrderResultsAsync(signedOrder, this.takerAddress, {
- takerAssetFillAmount,
- });
- expect(fillResults.takerAssetFilledAmount).to.be.bignumber.equal(
- expFilledTakerAmount,
- 'takerAssetFilledAmount',
- );
- expect(fillResults.makerAssetFilledAmount).to.be.bignumber.equal(
- expFilledMakerAmount,
- 'makerAssetFilledAmount',
- );
- expect(fillResults.takerFeePaid).to.be.bignumber.equal(expTakerFeePaid, 'takerFeePaid');
- expect(fillResults.makerFeePaid).to.be.bignumber.equal(expMakerFeePaid, 'makerFeePaid');
-
- // - Let's fill the order!
- const txReceipt = await this.exchangeWrapper.fillOrderAsync(signedOrder, this.takerAddress, {
- takerAssetFillAmount,
- });
-
- const actFilledTakerAmount = await this.exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash);
- expect(actFilledTakerAmount).to.be.bignumber.equal(expFilledTakerAmount, 'filledTakerAmount');
-
- const exchangeLogs = _.filter(
- txReceipt.logs,
- txLog => txLog.address === this.exchangeWrapper.getExchangeAddress(),
- );
- expect(exchangeLogs.length).to.be.equal(1, 'logs length');
- // tslint:disable-next-line:no-unnecessary-type-assertion
- const log = txReceipt.logs[0] as LogWithDecodedArgs<ExchangeFillEventArgs>;
- expect(log.args.makerAddress).to.be.equal(makerAddress, 'log.args.makerAddress');
- expect(log.args.takerAddress).to.be.equal(this.takerAddress, 'log.args.this.takerAddress');
- expect(log.args.feeRecipientAddress).to.be.equal(feeRecipient, 'log.args.feeRecipientAddress');
- expect(log.args.makerAssetFilledAmount).to.be.bignumber.equal(
- expFilledMakerAmount,
- 'log.args.makerAssetFilledAmount',
- );
- expect(log.args.takerAssetFilledAmount).to.be.bignumber.equal(
- expFilledTakerAmount,
- 'log.args.takerAssetFilledAmount',
- );
- expect(log.args.makerFeePaid).to.be.bignumber.equal(expMakerFeePaid, 'log.args.makerFeePaid');
- expect(log.args.takerFeePaid).to.be.bignumber.equal(expTakerFeePaid, 'logs.args.takerFeePaid');
- expect(log.args.orderHash).to.be.equal(orderHash, 'log.args.orderHash');
- expect(log.args.makerAssetData).to.be.equal(makerAssetData, 'log.args.makerAssetData');
- expect(log.args.takerAssetData).to.be.equal(takerAssetData, 'log.args.takerAssetData');
-
- const actMakerAssetBalanceOfMaker = await this.assetWrapper.getBalanceAsync(makerAddress, makerAssetData);
- expect(actMakerAssetBalanceOfMaker).to.be.bignumber.equal(
- expMakerAssetBalanceOfMaker,
- 'makerAssetBalanceOfMaker',
- );
-
- const actMakerAssetAllowanceOfMaker = await this.assetWrapper.getProxyAllowanceAsync(
- makerAddress,
- makerAssetData,
- );
- expect(actMakerAssetAllowanceOfMaker).to.be.bignumber.equal(
- expMakerAssetAllowanceOfMaker,
- 'makerAssetAllowanceOfMaker',
- );
-
- const actTakerAssetBalanceOfMaker = await this.assetWrapper.getBalanceAsync(makerAddress, takerAssetData);
- expect(actTakerAssetBalanceOfMaker).to.be.bignumber.equal(
- expTakerAssetBalanceOfMaker,
- 'takerAssetBalanceOfMaker',
- );
-
- const actZRXAssetBalanceOfMaker = await this.assetWrapper.getBalanceAsync(makerAddress, this.zrxAssetData);
- expect(actZRXAssetBalanceOfMaker).to.be.bignumber.equal(expZRXAssetBalanceOfMaker, 'ZRXAssetBalanceOfMaker');
-
- const actZRXAssetAllowanceOfMaker = await this.assetWrapper.getProxyAllowanceAsync(
- makerAddress,
- this.zrxAssetData,
- );
- expect(actZRXAssetAllowanceOfMaker).to.be.bignumber.equal(
- expZRXAssetAllowanceOfMaker,
- 'ZRXAssetAllowanceOfMaker',
- );
-
- const actTakerAssetBalanceOfTaker = await this.assetWrapper.getBalanceAsync(this.takerAddress, takerAssetData);
- expect(actTakerAssetBalanceOfTaker).to.be.bignumber.equal(
- expTakerAssetBalanceOfTaker,
- 'TakerAssetBalanceOfTaker',
- );
-
- const actTakerAssetAllowanceOfTaker = await this.assetWrapper.getProxyAllowanceAsync(
- this.takerAddress,
- takerAssetData,
- );
-
- expect(actTakerAssetAllowanceOfTaker).to.be.bignumber.equal(
- expTakerAssetAllowanceOfTaker,
- 'TakerAssetAllowanceOfTaker',
- );
-
- const actMakerAssetBalanceOfTaker = await this.assetWrapper.getBalanceAsync(this.takerAddress, makerAssetData);
- expect(actMakerAssetBalanceOfTaker).to.be.bignumber.equal(
- expMakerAssetBalanceOfTaker,
- 'MakerAssetBalanceOfTaker',
- );
-
- const actZRXAssetBalanceOfTaker = await this.assetWrapper.getBalanceAsync(this.takerAddress, this.zrxAssetData);
- expect(actZRXAssetBalanceOfTaker).to.be.bignumber.equal(expZRXAssetBalanceOfTaker, 'ZRXAssetBalanceOfTaker');
-
- const actZRXAssetAllowanceOfTaker = await this.assetWrapper.getProxyAllowanceAsync(
- this.takerAddress,
- this.zrxAssetData,
- );
- expect(actZRXAssetAllowanceOfTaker).to.be.bignumber.equal(
- expZRXAssetAllowanceOfTaker,
- 'ZRXAssetAllowanceOfTaker',
- );
-
- const actZRXAssetBalanceOfFeeRecipient = await this.assetWrapper.getBalanceAsync(
- feeRecipient,
- this.zrxAssetData,
- );
- expect(actZRXAssetBalanceOfFeeRecipient).to.be.bignumber.equal(
- expZRXAssetBalanceOfFeeRecipient,
- 'ZRXAssetBalanceOfFeeRecipient',
- );
- }
- private async _abiEncodeFillOrderAndAssertOutcomeAsync(
- signedOrder: SignedOrder,
- takerAssetFillAmount: BigNumber,
- ): Promise<void> {
- const params = orderUtils.createFill(signedOrder, takerAssetFillAmount);
- const expectedAbiEncodedData = this.exchangeWrapper.abiEncodeFillOrder(signedOrder, { takerAssetFillAmount });
- const libsAbiEncodedData = await this.testLibsContract.publicAbiEncodeFillOrder.callAsync(
- params.order,
- params.takerAssetFillAmount,
- params.signature,
- );
- expect(libsAbiEncodedData).to.be.equal(expectedAbiEncodedData, 'ABIEncodedFillOrderData');
- }
- private async _getTakerAssetFillAmountAsync(
- signedOrder: SignedOrder,
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario,
- balanceAndProxyAllowanceFetcher: SimpleAssetBalanceAndProxyAllowanceFetcher,
- orderFilledCancelledFetcher: SimpleOrderFilledCancelledFetcher,
- ): Promise<BigNumber> {
- const orderStateUtils = new OrderStateUtils(balanceAndProxyAllowanceFetcher, orderFilledCancelledFetcher);
- const fillableTakerAssetAmount = await orderStateUtils.getMaxFillableTakerAssetAmountAsync(
- signedOrder,
- this.takerAddress,
- );
-
- let takerAssetFillAmount;
- switch (takerAssetFillAmountScenario) {
- case TakerAssetFillAmountScenario.Zero:
- takerAssetFillAmount = new BigNumber(0);
- break;
-
- case TakerAssetFillAmountScenario.ExactlyRemainingFillableTakerAssetAmount:
- takerAssetFillAmount = fillableTakerAssetAmount;
- break;
-
- case TakerAssetFillAmountScenario.GreaterThanRemainingFillableTakerAssetAmount:
- takerAssetFillAmount = fillableTakerAssetAmount.add(1);
- break;
-
- case TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount:
- const takerAssetProxyId = assetDataUtils.decodeAssetProxyId(signedOrder.takerAssetData);
- const makerAssetProxyId = assetDataUtils.decodeAssetProxyId(signedOrder.makerAssetData);
- const isEitherAssetERC721 =
- takerAssetProxyId === AssetProxyId.ERC721 || makerAssetProxyId === AssetProxyId.ERC721;
- if (isEitherAssetERC721) {
- throw new Error(
- 'Cannot test `TakerAssetFillAmountScenario.LessThanRemainingFillableTakerAssetAmount` together with ERC721 assets since orders involving ERC721 must always be filled exactly.',
- );
- }
- takerAssetFillAmount = fillableTakerAssetAmount.div(2).floor();
- break;
-
- default:
- throw errorUtils.spawnSwitchErr('TakerAssetFillAmountScenario', takerAssetFillAmountScenario);
- }
-
- return takerAssetFillAmount;
- }
- private async _modifyTraderStateAsync(
- makerStateScenario: TraderStateScenario,
- takerStateScenario: TraderStateScenario,
- signedOrder: SignedOrder,
- takerAssetFillAmount: BigNumber,
- ): Promise<void> {
- const makerAssetFillAmount = orderUtils.getPartialAmountFloor(
- takerAssetFillAmount,
- signedOrder.takerAssetAmount,
- signedOrder.makerAssetAmount,
- );
- switch (makerStateScenario.traderAssetBalance) {
- case BalanceAmountScenario.Higher:
- break; // Noop since this is already the default
-
- case BalanceAmountScenario.TooLow:
- if (makerAssetFillAmount.eq(0)) {
- throw new Error(`Cannot set makerAssetBalanceOfMaker TooLow if makerAssetFillAmount is 0`);
- }
- const tooLowBalance = makerAssetFillAmount.minus(1);
- await this.assetWrapper.setBalanceAsync(
- signedOrder.makerAddress,
- signedOrder.makerAssetData,
- tooLowBalance,
- );
- break;
-
- case BalanceAmountScenario.Exact:
- const exactBalance = makerAssetFillAmount;
- await this.assetWrapper.setBalanceAsync(
- signedOrder.makerAddress,
- signedOrder.makerAssetData,
- exactBalance,
- );
- break;
-
- default:
- throw errorUtils.spawnSwitchErr(
- 'makerStateScenario.traderAssetBalance',
- makerStateScenario.traderAssetBalance,
- );
- }
-
- const makerFee = orderUtils.getPartialAmountFloor(
- takerAssetFillAmount,
- signedOrder.takerAssetAmount,
- signedOrder.makerFee,
- );
- switch (makerStateScenario.zrxFeeBalance) {
- case BalanceAmountScenario.Higher:
- break; // Noop since this is already the default
-
- case BalanceAmountScenario.TooLow:
- if (makerFee.eq(0)) {
- throw new Error(`Cannot set zrxAsserBalanceOfMaker TooLow if makerFee is 0`);
- }
- const tooLowBalance = makerFee.minus(1);
- await this.assetWrapper.setBalanceAsync(signedOrder.makerAddress, this.zrxAssetData, tooLowBalance);
- break;
-
- case BalanceAmountScenario.Exact:
- const exactBalance = makerFee;
- await this.assetWrapper.setBalanceAsync(signedOrder.makerAddress, this.zrxAssetData, exactBalance);
- break;
-
- default:
- throw errorUtils.spawnSwitchErr('makerStateScenario.zrxFeeBalance', makerStateScenario.zrxFeeBalance);
- }
-
- switch (makerStateScenario.traderAssetAllowance) {
- case AllowanceAmountScenario.Higher:
- break; // Noop since this is already the default
-
- case AllowanceAmountScenario.TooLow:
- const tooLowAllowance = makerAssetFillAmount.minus(1);
- await this.assetWrapper.setProxyAllowanceAsync(
- signedOrder.makerAddress,
- signedOrder.makerAssetData,
- tooLowAllowance,
- );
- break;
-
- case AllowanceAmountScenario.Exact:
- const exactAllowance = makerAssetFillAmount;
- await this.assetWrapper.setProxyAllowanceAsync(
- signedOrder.makerAddress,
- signedOrder.makerAssetData,
- exactAllowance,
- );
- break;
-
- case AllowanceAmountScenario.Unlimited:
- await this.assetWrapper.setProxyAllowanceAsync(
- signedOrder.makerAddress,
- signedOrder.makerAssetData,
- constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
- );
- break;
-
- default:
- throw errorUtils.spawnSwitchErr(
- 'makerStateScenario.traderAssetAllowance',
- makerStateScenario.traderAssetAllowance,
- );
- }
-
- switch (makerStateScenario.zrxFeeAllowance) {
- case AllowanceAmountScenario.Higher:
- break; // Noop since this is already the default
-
- case AllowanceAmountScenario.TooLow:
- const tooLowAllowance = makerFee.minus(1);
- await this.assetWrapper.setProxyAllowanceAsync(
- signedOrder.makerAddress,
- this.zrxAssetData,
- tooLowAllowance,
- );
- break;
-
- case AllowanceAmountScenario.Exact:
- const exactAllowance = makerFee;
- await this.assetWrapper.setProxyAllowanceAsync(
- signedOrder.makerAddress,
- this.zrxAssetData,
- exactAllowance,
- );
- break;
-
- case AllowanceAmountScenario.Unlimited:
- await this.assetWrapper.setProxyAllowanceAsync(
- signedOrder.makerAddress,
- this.zrxAssetData,
- constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
- );
- break;
-
- default:
- throw errorUtils.spawnSwitchErr(
- 'makerStateScenario.zrxFeeAllowance',
- makerStateScenario.zrxFeeAllowance,
- );
- }
-
- switch (takerStateScenario.traderAssetBalance) {
- case BalanceAmountScenario.Higher:
- break; // Noop since this is already the default
-
- case BalanceAmountScenario.TooLow:
- if (takerAssetFillAmount.eq(0)) {
- throw new Error(`Cannot set takerAssetBalanceOfTaker TooLow if takerAssetFillAmount is 0`);
- }
- const tooLowBalance = takerAssetFillAmount.minus(1);
- await this.assetWrapper.setBalanceAsync(this.takerAddress, signedOrder.takerAssetData, tooLowBalance);
- break;
-
- case BalanceAmountScenario.Exact:
- const exactBalance = takerAssetFillAmount;
- await this.assetWrapper.setBalanceAsync(this.takerAddress, signedOrder.takerAssetData, exactBalance);
- break;
-
- default:
- throw errorUtils.spawnSwitchErr(
- 'takerStateScenario.traderAssetBalance',
- takerStateScenario.traderAssetBalance,
- );
- }
-
- const takerFee = orderUtils.getPartialAmountFloor(
- takerAssetFillAmount,
- signedOrder.takerAssetAmount,
- signedOrder.takerFee,
- );
- switch (takerStateScenario.zrxFeeBalance) {
- case BalanceAmountScenario.Higher:
- break; // Noop since this is already the default
-
- case BalanceAmountScenario.TooLow:
- if (takerFee.eq(0)) {
- throw new Error(`Cannot set zrxAssetBalanceOfTaker TooLow if takerFee is 0`);
- }
- const tooLowBalance = takerFee.minus(1);
- await this.assetWrapper.setBalanceAsync(this.takerAddress, this.zrxAssetData, tooLowBalance);
- break;
-
- case BalanceAmountScenario.Exact:
- const exactBalance = takerFee;
- await this.assetWrapper.setBalanceAsync(this.takerAddress, this.zrxAssetData, exactBalance);
- break;
-
- default:
- throw errorUtils.spawnSwitchErr('takerStateScenario.zrxFeeBalance', takerStateScenario.zrxFeeBalance);
- }
-
- switch (takerStateScenario.traderAssetAllowance) {
- case AllowanceAmountScenario.Higher:
- break; // Noop since this is already the default
-
- case AllowanceAmountScenario.TooLow:
- const tooLowAllowance = takerAssetFillAmount.minus(1);
- await this.assetWrapper.setProxyAllowanceAsync(
- this.takerAddress,
- signedOrder.takerAssetData,
- tooLowAllowance,
- );
- break;
-
- case AllowanceAmountScenario.Exact:
- const exactAllowance = takerAssetFillAmount;
- await this.assetWrapper.setProxyAllowanceAsync(
- this.takerAddress,
- signedOrder.takerAssetData,
- exactAllowance,
- );
- break;
-
- case AllowanceAmountScenario.Unlimited:
- await this.assetWrapper.setProxyAllowanceAsync(
- this.takerAddress,
- signedOrder.takerAssetData,
- constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
- );
- break;
-
- default:
- throw errorUtils.spawnSwitchErr(
- 'takerStateScenario.traderAssetAllowance',
- takerStateScenario.traderAssetAllowance,
- );
- }
-
- switch (takerStateScenario.zrxFeeAllowance) {
- case AllowanceAmountScenario.Higher:
- break; // Noop since this is already the default
-
- case AllowanceAmountScenario.TooLow:
- const tooLowAllowance = takerFee.minus(1);
- await this.assetWrapper.setProxyAllowanceAsync(this.takerAddress, this.zrxAssetData, tooLowAllowance);
- break;
-
- case AllowanceAmountScenario.Exact:
- const exactAllowance = takerFee;
- await this.assetWrapper.setProxyAllowanceAsync(this.takerAddress, this.zrxAssetData, exactAllowance);
- break;
-
- case AllowanceAmountScenario.Unlimited:
- await this.assetWrapper.setProxyAllowanceAsync(
- this.takerAddress,
- this.zrxAssetData,
- constants.UNLIMITED_ALLOWANCE_IN_BASE_UNITS,
- );
- break;
-
- default:
- throw errorUtils.spawnSwitchErr(
- 'takerStateScenario.zrxFeeAllowance',
- takerStateScenario.zrxFeeAllowance,
- );
- }
- }
-} // tslint:disable:max-file-line-count
diff --git a/packages/contracts/test/utils/forwarder_wrapper.ts b/packages/contracts/test/utils/forwarder_wrapper.ts
deleted file mode 100644
index a0bfcfe1d..000000000
--- a/packages/contracts/test/utils/forwarder_wrapper.ts
+++ /dev/null
@@ -1,121 +0,0 @@
-import { SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import { Provider, TransactionReceiptWithDecodedLogs, TxDataPayable } from 'ethereum-types';
-import * as _ from 'lodash';
-
-import { ForwarderContract } from '../../generated-wrappers/forwarder';
-
-import { constants } from './constants';
-import { formatters } from './formatters';
-import { LogDecoder } from './log_decoder';
-import { MarketSellOrders } from './types';
-
-export class ForwarderWrapper {
- private readonly _web3Wrapper: Web3Wrapper;
- private readonly _forwarderContract: ForwarderContract;
- private readonly _logDecoder: LogDecoder;
- public static getPercentageOfValue(value: BigNumber, percentage: number): BigNumber {
- const numerator = constants.PERCENTAGE_DENOMINATOR.times(percentage).dividedToIntegerBy(100);
- const newValue = value.times(numerator).dividedToIntegerBy(constants.PERCENTAGE_DENOMINATOR);
- return newValue;
- }
- public static getWethForFeeOrders(feeAmount: BigNumber, feeOrders: SignedOrder[]): BigNumber {
- let wethAmount = new BigNumber(0);
- let remainingFeeAmount = feeAmount;
- _.forEach(feeOrders, feeOrder => {
- const feeAvailable = feeOrder.makerAssetAmount.minus(feeOrder.takerFee);
- if (!remainingFeeAmount.isZero() && feeAvailable.gt(remainingFeeAmount)) {
- wethAmount = wethAmount.plus(
- feeOrder.takerAssetAmount
- .times(remainingFeeAmount)
- .dividedBy(feeAvailable)
- .ceil(),
- );
- remainingFeeAmount = new BigNumber(0);
- } else if (!remainingFeeAmount.isZero()) {
- wethAmount = wethAmount.plus(feeOrder.takerAssetAmount);
- remainingFeeAmount = remainingFeeAmount.minus(feeAvailable);
- }
- });
- return wethAmount;
- }
- private static _createOptimizedOrders(signedOrders: SignedOrder[]): MarketSellOrders {
- _.forEach(signedOrders, (signedOrder, index) => {
- signedOrder.takerAssetData = constants.NULL_BYTES;
- if (index > 0) {
- signedOrder.makerAssetData = constants.NULL_BYTES;
- }
- });
- const params = formatters.createMarketSellOrders(signedOrders, constants.ZERO_AMOUNT);
- return params;
- }
- private static _createOptimizedZrxOrders(signedOrders: SignedOrder[]): MarketSellOrders {
- _.forEach(signedOrders, signedOrder => {
- signedOrder.makerAssetData = constants.NULL_BYTES;
- signedOrder.takerAssetData = constants.NULL_BYTES;
- });
- const params = formatters.createMarketSellOrders(signedOrders, constants.ZERO_AMOUNT);
- return params;
- }
- constructor(contractInstance: ForwarderContract, provider: Provider) {
- this._forwarderContract = contractInstance;
- this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper);
- }
- public async marketSellOrdersWithEthAsync(
- orders: SignedOrder[],
- feeOrders: SignedOrder[],
- txData: TxDataPayable,
- opts: { feePercentage?: BigNumber; feeRecipient?: string } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = ForwarderWrapper._createOptimizedOrders(orders);
- const feeParams = ForwarderWrapper._createOptimizedZrxOrders(feeOrders);
- const feePercentage = _.isUndefined(opts.feePercentage) ? constants.ZERO_AMOUNT : opts.feePercentage;
- const feeRecipient = _.isUndefined(opts.feeRecipient) ? constants.NULL_ADDRESS : opts.feeRecipient;
- const txHash = await this._forwarderContract.marketSellOrdersWithEth.sendTransactionAsync(
- params.orders,
- params.signatures,
- feeParams.orders,
- feeParams.signatures,
- feePercentage,
- feeRecipient,
- txData,
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async marketBuyOrdersWithEthAsync(
- orders: SignedOrder[],
- feeOrders: SignedOrder[],
- makerAssetFillAmount: BigNumber,
- txData: TxDataPayable,
- opts: { feePercentage?: BigNumber; feeRecipient?: string } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const params = ForwarderWrapper._createOptimizedOrders(orders);
- const feeParams = ForwarderWrapper._createOptimizedZrxOrders(feeOrders);
- const feePercentage = _.isUndefined(opts.feePercentage) ? constants.ZERO_AMOUNT : opts.feePercentage;
- const feeRecipient = _.isUndefined(opts.feeRecipient) ? constants.NULL_ADDRESS : opts.feeRecipient;
- const txHash = await this._forwarderContract.marketBuyOrdersWithEth.sendTransactionAsync(
- params.orders,
- makerAssetFillAmount,
- params.signatures,
- feeParams.orders,
- feeParams.signatures,
- feePercentage,
- feeRecipient,
- txData,
- );
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async withdrawAssetAsync(
- assetData: string,
- amount: BigNumber,
- txData: TxDataPayable,
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const txHash = await this._forwarderContract.withdrawAsset.sendTransactionAsync(assetData, amount, txData);
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
-}
diff --git a/packages/contracts/test/utils/log_decoder.ts b/packages/contracts/test/utils/log_decoder.ts
deleted file mode 100644
index 05b0a9204..000000000
--- a/packages/contracts/test/utils/log_decoder.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { AbiDecoder, BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import {
- AbiDefinition,
- ContractArtifact,
- DecodedLogArgs,
- LogEntry,
- LogWithDecodedArgs,
- RawLog,
- TransactionReceiptWithDecodedLogs,
-} from 'ethereum-types';
-import * as _ from 'lodash';
-
-import { artifacts } from '../../src/artifacts';
-
-import { constants } from './constants';
-
-export class LogDecoder {
- private readonly _web3Wrapper: Web3Wrapper;
- private readonly _abiDecoder: AbiDecoder;
- public static wrapLogBigNumbers(log: any): any {
- const argNames = _.keys(log.args);
- for (const argName of argNames) {
- const isWeb3BigNumber = _.startsWith(log.args[argName].constructor.toString(), 'function BigNumber(');
- if (isWeb3BigNumber) {
- log.args[argName] = new BigNumber(log.args[argName]);
- }
- }
- }
- constructor(web3Wrapper: Web3Wrapper) {
- this._web3Wrapper = web3Wrapper;
- const abiArrays: AbiDefinition[][] = [];
- _.forEach(artifacts, (artifact: ContractArtifact) => {
- const compilerOutput = artifact.compilerOutput;
- abiArrays.push(compilerOutput.abi);
- });
- this._abiDecoder = new AbiDecoder(abiArrays);
- }
- public decodeLogOrThrow<ArgsType extends DecodedLogArgs>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog {
- const logWithDecodedArgsOrLog = this._abiDecoder.tryToDecodeLogOrNoop(log);
- // tslint:disable-next-line:no-unnecessary-type-assertion
- if (_.isUndefined((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args)) {
- throw new Error(`Unable to decode log: ${JSON.stringify(log)}`);
- }
- LogDecoder.wrapLogBigNumbers(logWithDecodedArgsOrLog);
- return logWithDecodedArgsOrLog;
- }
- public async getTxWithDecodedLogsAsync(txHash: string): Promise<TransactionReceiptWithDecodedLogs> {
- const tx = await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
- tx.logs = _.map(tx.logs, log => this.decodeLogOrThrow(log));
- return tx;
- }
-}
diff --git a/packages/contracts/test/utils/match_order_tester.ts b/packages/contracts/test/utils/match_order_tester.ts
deleted file mode 100644
index 6c2c84959..000000000
--- a/packages/contracts/test/utils/match_order_tester.ts
+++ /dev/null
@@ -1,566 +0,0 @@
-import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
-import { AssetProxyId, SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import * as chai from 'chai';
-import * as _ from 'lodash';
-
-import { TransactionReceiptWithDecodedLogs } from '../../../../node_modules/ethereum-types';
-
-import { chaiSetup } from './chai_setup';
-import { ERC20Wrapper } from './erc20_wrapper';
-import { ERC721Wrapper } from './erc721_wrapper';
-import { ExchangeWrapper } from './exchange_wrapper';
-import {
- ERC20BalancesByOwner,
- ERC721TokenIdsByOwner,
- OrderInfo,
- OrderStatus,
- TransferAmountsByMatchOrders as TransferAmounts,
- TransferAmountsLoggedByMatchOrders as LoggedTransferAmounts,
-} from './types';
-
-chaiSetup.configure();
-const expect = chai.expect;
-
-export class MatchOrderTester {
- private readonly _exchangeWrapper: ExchangeWrapper;
- private readonly _erc20Wrapper: ERC20Wrapper;
- private readonly _erc721Wrapper: ERC721Wrapper;
- private readonly _feeTokenAddress: string;
- /// @dev Checks values from the logs produced by Exchange.matchOrders against the expected transfer amounts.
- /// Values include the amounts transferred from the left/right makers and taker, along with
- /// the fees paid on each matched order. These are also the return values of MatchOrders.
- /// @param signedOrderLeft First matched order.
- /// @param signedOrderRight Second matched order.
- /// @param transactionReceipt Transaction receipt and logs produced by Exchange.matchOrders.
- /// @param takerAddress Address of taker (account that called Exchange.matchOrders)
- /// @param expectedTransferAmounts Expected amounts transferred as a result of order matching.
- private static async _assertLogsAsync(
- signedOrderLeft: SignedOrder,
- signedOrderRight: SignedOrder,
- transactionReceipt: TransactionReceiptWithDecodedLogs,
- takerAddress: string,
- expectedTransferAmounts: TransferAmounts,
- ): Promise<void> {
- // Should have two fill event logs -- one for each order.
- const transactionFillLogs = _.filter(transactionReceipt.logs, ['event', 'Fill']);
- expect(transactionFillLogs.length, 'Checking number of logs').to.be.equal(2);
- // First log is for left fill
- const leftLog = (transactionFillLogs[0] as any).args as LoggedTransferAmounts;
- expect(leftLog.makerAddress, 'Checking logged maker address of left order').to.be.equal(
- signedOrderLeft.makerAddress,
- );
- expect(leftLog.takerAddress, 'Checking logged taker address of right order').to.be.equal(takerAddress);
- const amountBoughtByLeftMaker = new BigNumber(leftLog.takerAssetFilledAmount);
- const amountSoldByLeftMaker = new BigNumber(leftLog.makerAssetFilledAmount);
- const feePaidByLeftMaker = new BigNumber(leftLog.makerFeePaid);
- const feePaidByTakerLeft = new BigNumber(leftLog.takerFeePaid);
- // Second log is for right fill
- const rightLog = (transactionFillLogs[1] as any).args as LoggedTransferAmounts;
- expect(rightLog.makerAddress, 'Checking logged maker address of right order').to.be.equal(
- signedOrderRight.makerAddress,
- );
- expect(rightLog.takerAddress, 'Checking loggerd taker address of right order').to.be.equal(takerAddress);
- const amountBoughtByRightMaker = new BigNumber(rightLog.takerAssetFilledAmount);
- const amountSoldByRightMaker = new BigNumber(rightLog.makerAssetFilledAmount);
- const feePaidByRightMaker = new BigNumber(rightLog.makerFeePaid);
- const feePaidByTakerRight = new BigNumber(rightLog.takerFeePaid);
- // Derive amount received by taker
- const amountReceivedByTaker = amountSoldByLeftMaker.sub(amountBoughtByRightMaker);
- // Assert log values - left order
- expect(amountBoughtByLeftMaker, 'Checking logged amount bought by left maker').to.be.bignumber.equal(
- expectedTransferAmounts.amountBoughtByLeftMaker,
- );
- expect(amountSoldByLeftMaker, 'Checking logged amount sold by left maker').to.be.bignumber.equal(
- expectedTransferAmounts.amountSoldByLeftMaker,
- );
- expect(feePaidByLeftMaker, 'Checking logged fee paid by left maker').to.be.bignumber.equal(
- expectedTransferAmounts.feePaidByLeftMaker,
- );
- expect(feePaidByTakerLeft, 'Checking logged fee paid on left order by taker').to.be.bignumber.equal(
- expectedTransferAmounts.feePaidByTakerLeft,
- );
- // Assert log values - right order
- expect(amountBoughtByRightMaker, 'Checking logged amount bought by right maker').to.be.bignumber.equal(
- expectedTransferAmounts.amountBoughtByRightMaker,
- );
- expect(amountSoldByRightMaker, 'Checking logged amount sold by right maker').to.be.bignumber.equal(
- expectedTransferAmounts.amountSoldByRightMaker,
- );
- expect(feePaidByRightMaker, 'Checking logged fee paid by right maker').to.be.bignumber.equal(
- expectedTransferAmounts.feePaidByRightMaker,
- );
- expect(feePaidByTakerRight, 'Checking logged fee paid on right order by taker').to.be.bignumber.equal(
- expectedTransferAmounts.feePaidByTakerRight,
- );
- // Assert derived amount received by taker
- expect(amountReceivedByTaker, 'Checking logged amount received by taker').to.be.bignumber.equal(
- expectedTransferAmounts.amountReceivedByTaker,
- );
- }
- /// @dev Asserts all expected ERC20 and ERC721 account holdings match the real holdings.
- /// @param expectedERC20BalancesByOwner Expected ERC20 balances.
- /// @param realERC20BalancesByOwner Real ERC20 balances.
- /// @param expectedERC721TokenIdsByOwner Expected ERC721 token owners.
- /// @param realERC721TokenIdsByOwner Real ERC20 token owners.
- private static async _assertAllKnownBalancesAsync(
- expectedERC20BalancesByOwner: ERC20BalancesByOwner,
- realERC20BalancesByOwner: ERC20BalancesByOwner,
- expectedERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
- realERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
- ): Promise<void> {
- // ERC20 Balances
- const areERC20BalancesEqual = _.isEqual(expectedERC20BalancesByOwner, realERC20BalancesByOwner);
- expect(areERC20BalancesEqual, 'Checking all known ERC20 account balances').to.be.true();
- // ERC721 Token Ids
- const sortedExpectedNewERC721TokenIdsByOwner = _.mapValues(expectedERC721TokenIdsByOwner, tokenIdsByOwner => {
- _.mapValues(tokenIdsByOwner, tokenIds => {
- _.sortBy(tokenIds);
- });
- });
- const sortedNewERC721TokenIdsByOwner = _.mapValues(realERC721TokenIdsByOwner, tokenIdsByOwner => {
- _.mapValues(tokenIdsByOwner, tokenIds => {
- _.sortBy(tokenIds);
- });
- });
- const areERC721TokenIdsEqual = _.isEqual(
- sortedExpectedNewERC721TokenIdsByOwner,
- sortedNewERC721TokenIdsByOwner,
- );
- expect(areERC721TokenIdsEqual, 'Checking all known ERC721 account balances').to.be.true();
- }
- /// @dev Constructs new MatchOrderTester.
- /// @param exchangeWrapper Used to call to the Exchange.
- /// @param erc20Wrapper Used to fetch ERC20 balances.
- /// @param erc721Wrapper Used to fetch ERC721 token owners.
- /// @param feeTokenAddress Address of ERC20 fee token.
- constructor(
- exchangeWrapper: ExchangeWrapper,
- erc20Wrapper: ERC20Wrapper,
- erc721Wrapper: ERC721Wrapper,
- feeTokenAddress: string,
- ) {
- this._exchangeWrapper = exchangeWrapper;
- this._erc20Wrapper = erc20Wrapper;
- this._erc721Wrapper = erc721Wrapper;
- this._feeTokenAddress = feeTokenAddress;
- }
- /// @dev Matches two complementary orders and asserts results.
- /// @param signedOrderLeft First matched order.
- /// @param signedOrderRight Second matched order.
- /// @param takerAddress Address of taker (the address who matched the two orders)
- /// @param erc20BalancesByOwner Current ERC20 balances.
- /// @param erc721TokenIdsByOwner Current ERC721 token owners.
- /// @param expectedTransferAmounts Expected amounts transferred as a result of order matching.
- /// @param initialLeftOrderFilledAmount How much left order has been filled, prior to matching orders.
- /// @param initialRightOrderFilledAmount How much the right order has been filled, prior to matching orders.
- /// @return New ERC20 balances & ERC721 token owners.
- public async matchOrdersAndAssertEffectsAsync(
- signedOrderLeft: SignedOrder,
- signedOrderRight: SignedOrder,
- takerAddress: string,
- erc20BalancesByOwner: ERC20BalancesByOwner,
- erc721TokenIdsByOwner: ERC721TokenIdsByOwner,
- expectedTransferAmounts: TransferAmounts,
- initialLeftOrderFilledAmount: BigNumber = new BigNumber(0),
- initialRightOrderFilledAmount: BigNumber = new BigNumber(0),
- ): Promise<[ERC20BalancesByOwner, ERC721TokenIdsByOwner]> {
- // Assert initial order states
- await this._assertInitialOrderStatesAsync(
- signedOrderLeft,
- signedOrderRight,
- initialLeftOrderFilledAmount,
- initialRightOrderFilledAmount,
- );
- // Match left & right orders
- const transactionReceipt = await this._exchangeWrapper.matchOrdersAsync(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- );
- const newERC20BalancesByOwner = await this._erc20Wrapper.getBalancesAsync();
- const newERC721TokenIdsByOwner = await this._erc721Wrapper.getBalancesAsync();
- // Assert logs
- await MatchOrderTester._assertLogsAsync(
- signedOrderLeft,
- signedOrderRight,
- transactionReceipt,
- takerAddress,
- expectedTransferAmounts,
- );
- // Assert exchange state
- await this._assertExchangeStateAsync(
- signedOrderLeft,
- signedOrderRight,
- initialLeftOrderFilledAmount,
- initialRightOrderFilledAmount,
- expectedTransferAmounts,
- );
- // Assert balances of makers, taker, and fee recipients
- await this._assertBalancesAsync(
- signedOrderLeft,
- signedOrderRight,
- erc20BalancesByOwner,
- erc721TokenIdsByOwner,
- newERC20BalancesByOwner,
- newERC721TokenIdsByOwner,
- expectedTransferAmounts,
- takerAddress,
- );
- return [newERC20BalancesByOwner, newERC721TokenIdsByOwner];
- }
- /// @dev Asserts initial exchange state for the left and right orders.
- /// @param signedOrderLeft First matched order.
- /// @param signedOrderRight Second matched order.
- /// @param expectedOrderFilledAmountLeft How much left order has been filled, prior to matching orders.
- /// @param expectedOrderFilledAmountRight How much the right order has been filled, prior to matching orders.
- private async _assertInitialOrderStatesAsync(
- signedOrderLeft: SignedOrder,
- signedOrderRight: SignedOrder,
- expectedOrderFilledAmountLeft: BigNumber,
- expectedOrderFilledAmountRight: BigNumber,
- ): Promise<void> {
- // Assert left order initial state
- const orderTakerAssetFilledAmountLeft = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
- orderHashUtils.getOrderHashHex(signedOrderLeft),
- );
- expect(orderTakerAssetFilledAmountLeft, 'Checking inital state of left order').to.be.bignumber.equal(
- expectedOrderFilledAmountLeft,
- );
- // Assert right order initial state
- const orderTakerAssetFilledAmountRight = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
- orderHashUtils.getOrderHashHex(signedOrderRight),
- );
- expect(orderTakerAssetFilledAmountRight, 'Checking inital state of right order').to.be.bignumber.equal(
- expectedOrderFilledAmountRight,
- );
- }
- /// @dev Asserts the exchange state against the expected amounts transferred by from matching orders.
- /// @param signedOrderLeft First matched order.
- /// @param signedOrderRight Second matched order.
- /// @param initialLeftOrderFilledAmount How much left order has been filled, prior to matching orders.
- /// @param initialRightOrderFilledAmount How much the right order has been filled, prior to matching orders.
- /// @return TransferAmounts A struct containing the expected transfer amounts.
- private async _assertExchangeStateAsync(
- signedOrderLeft: SignedOrder,
- signedOrderRight: SignedOrder,
- initialLeftOrderFilledAmount: BigNumber,
- initialRightOrderFilledAmount: BigNumber,
- expectedTransferAmounts: TransferAmounts,
- ): Promise<void> {
- // Assert state for left order: amount bought by left maker
- let amountBoughtByLeftMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
- orderHashUtils.getOrderHashHex(signedOrderLeft),
- );
- amountBoughtByLeftMaker = amountBoughtByLeftMaker.minus(initialLeftOrderFilledAmount);
- expect(amountBoughtByLeftMaker, 'Checking exchange state for left order').to.be.bignumber.equal(
- expectedTransferAmounts.amountBoughtByLeftMaker,
- );
- // Assert state for right order: amount bought by right maker
- let amountBoughtByRightMaker = await this._exchangeWrapper.getTakerAssetFilledAmountAsync(
- orderHashUtils.getOrderHashHex(signedOrderRight),
- );
- amountBoughtByRightMaker = amountBoughtByRightMaker.minus(initialRightOrderFilledAmount);
- expect(amountBoughtByRightMaker, 'Checking exchange state for right order').to.be.bignumber.equal(
- expectedTransferAmounts.amountBoughtByRightMaker,
- );
- // Assert left order status
- const maxAmountBoughtByLeftMaker = signedOrderLeft.takerAssetAmount.minus(initialLeftOrderFilledAmount);
- const leftOrderInfo: OrderInfo = await this._exchangeWrapper.getOrderInfoAsync(signedOrderLeft);
- const leftExpectedStatus = expectedTransferAmounts.amountBoughtByLeftMaker.equals(maxAmountBoughtByLeftMaker)
- ? OrderStatus.FULLY_FILLED
- : OrderStatus.FILLABLE;
- expect(leftOrderInfo.orderStatus as OrderStatus, 'Checking exchange status for left order').to.be.equal(
- leftExpectedStatus,
- );
- // Assert right order status
- const maxAmountBoughtByRightMaker = signedOrderRight.takerAssetAmount.minus(initialRightOrderFilledAmount);
- const rightOrderInfo: OrderInfo = await this._exchangeWrapper.getOrderInfoAsync(signedOrderRight);
- const rightExpectedStatus = expectedTransferAmounts.amountBoughtByRightMaker.equals(maxAmountBoughtByRightMaker)
- ? OrderStatus.FULLY_FILLED
- : OrderStatus.FILLABLE;
- expect(rightOrderInfo.orderStatus as OrderStatus, 'Checking exchange status for right order').to.be.equal(
- rightExpectedStatus,
- );
- }
- /// @dev Asserts account balances after matching orders.
- /// @param signedOrderLeft First matched order.
- /// @param signedOrderRight Second matched order.
- /// @param initialERC20BalancesByOwner ERC20 balances prior to order matching.
- /// @param initialERC721TokenIdsByOwner ERC721 token owners prior to order matching.
- /// @param finalERC20BalancesByOwner ERC20 balances after order matching.
- /// @param finalERC721TokenIdsByOwner ERC721 token owners after order matching.
- /// @param expectedTransferAmounts Expected amounts transferred as a result of order matching.
- /// @param takerAddress Address of taker (account that called Exchange.matchOrders).
- private async _assertBalancesAsync(
- signedOrderLeft: SignedOrder,
- signedOrderRight: SignedOrder,
- initialERC20BalancesByOwner: ERC20BalancesByOwner,
- initialERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
- finalERC20BalancesByOwner: ERC20BalancesByOwner,
- finalERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
- expectedTransferAmounts: TransferAmounts,
- takerAddress: string,
- ): Promise<void> {
- let expectedERC20BalancesByOwner: ERC20BalancesByOwner;
- let expectedERC721TokenIdsByOwner: ERC721TokenIdsByOwner;
- [expectedERC20BalancesByOwner, expectedERC721TokenIdsByOwner] = this._calculateExpectedBalances(
- signedOrderLeft,
- signedOrderRight,
- takerAddress,
- initialERC20BalancesByOwner,
- initialERC721TokenIdsByOwner,
- expectedTransferAmounts,
- );
- // Assert balances of makers, taker, and fee recipients
- await this._assertMakerTakerAndFeeRecipientBalancesAsync(
- signedOrderLeft,
- signedOrderRight,
- expectedERC20BalancesByOwner,
- finalERC20BalancesByOwner,
- expectedERC721TokenIdsByOwner,
- finalERC721TokenIdsByOwner,
- takerAddress,
- );
- // Assert balances for all known accounts
- await MatchOrderTester._assertAllKnownBalancesAsync(
- expectedERC20BalancesByOwner,
- finalERC20BalancesByOwner,
- expectedERC721TokenIdsByOwner,
- finalERC721TokenIdsByOwner,
- );
- }
- /// @dev Calculates the expected balances of order makers, fee recipients, and the taker,
- /// as a result of matching two orders.
- /// @param signedOrderRight First matched order.
- /// @param signedOrderRight Second matched order.
- /// @param takerAddress Address of taker (the address who matched the two orders)
- /// @param erc20BalancesByOwner Current ERC20 balances.
- /// @param erc721TokenIdsByOwner Current ERC721 token owners.
- /// @param expectedTransferAmounts Expected amounts transferred as a result of order matching.
- /// @return Expected ERC20 balances & ERC721 token owners after orders have been matched.
- private _calculateExpectedBalances(
- signedOrderLeft: SignedOrder,
- signedOrderRight: SignedOrder,
- takerAddress: string,
- erc20BalancesByOwner: ERC20BalancesByOwner,
- erc721TokenIdsByOwner: ERC721TokenIdsByOwner,
- expectedTransferAmounts: TransferAmounts,
- ): [ERC20BalancesByOwner, ERC721TokenIdsByOwner] {
- const makerAddressLeft = signedOrderLeft.makerAddress;
- const makerAddressRight = signedOrderRight.makerAddress;
- const feeRecipientAddressLeft = signedOrderLeft.feeRecipientAddress;
- const feeRecipientAddressRight = signedOrderRight.feeRecipientAddress;
- // Operations are performed on copies of the balances
- const expectedNewERC20BalancesByOwner = _.cloneDeep(erc20BalancesByOwner);
- const expectedNewERC721TokenIdsByOwner = _.cloneDeep(erc721TokenIdsByOwner);
- // Left Maker Asset (Right Taker Asset)
- const makerAssetProxyIdLeft = assetDataUtils.decodeAssetProxyId(signedOrderLeft.makerAssetData);
- if (makerAssetProxyIdLeft === AssetProxyId.ERC20) {
- // Decode asset data
- const erc20AssetData = assetDataUtils.decodeERC20AssetData(signedOrderLeft.makerAssetData);
- const makerAssetAddressLeft = erc20AssetData.tokenAddress;
- const takerAssetAddressRight = makerAssetAddressLeft;
- // Left Maker
- expectedNewERC20BalancesByOwner[makerAddressLeft][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
- makerAddressLeft
- ][makerAssetAddressLeft].minus(expectedTransferAmounts.amountSoldByLeftMaker);
- // Right Maker
- expectedNewERC20BalancesByOwner[makerAddressRight][
- takerAssetAddressRight
- ] = expectedNewERC20BalancesByOwner[makerAddressRight][takerAssetAddressRight].add(
- expectedTransferAmounts.amountBoughtByRightMaker,
- );
- // Taker
- expectedNewERC20BalancesByOwner[takerAddress][makerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
- takerAddress
- ][makerAssetAddressLeft].add(expectedTransferAmounts.amountReceivedByTaker);
- } else if (makerAssetProxyIdLeft === AssetProxyId.ERC721) {
- // Decode asset data
- const erc721AssetData = assetDataUtils.decodeERC721AssetData(signedOrderLeft.makerAssetData);
- const makerAssetAddressLeft = erc721AssetData.tokenAddress;
- const makerAssetIdLeft = erc721AssetData.tokenId;
- const takerAssetAddressRight = makerAssetAddressLeft;
- const takerAssetIdRight = makerAssetIdLeft;
- // Left Maker
- _.remove(expectedNewERC721TokenIdsByOwner[makerAddressLeft][makerAssetAddressLeft], makerAssetIdLeft);
- // Right Maker
- expectedNewERC721TokenIdsByOwner[makerAddressRight][takerAssetAddressRight].push(takerAssetIdRight);
- // Taker: Since there is only 1 asset transferred, the taker does not receive any of the left maker asset.
- }
- // Left Taker Asset (Right Maker Asset)
- // Note: This exchange is only between the order makers: the Taker does not receive any of the left taker asset.
- const takerAssetProxyIdLeft = assetDataUtils.decodeAssetProxyId(signedOrderLeft.takerAssetData);
- if (takerAssetProxyIdLeft === AssetProxyId.ERC20) {
- // Decode asset data
- const erc20AssetData = assetDataUtils.decodeERC20AssetData(signedOrderLeft.takerAssetData);
- const takerAssetAddressLeft = erc20AssetData.tokenAddress;
- const makerAssetAddressRight = takerAssetAddressLeft;
- // Left Maker
- expectedNewERC20BalancesByOwner[makerAddressLeft][takerAssetAddressLeft] = expectedNewERC20BalancesByOwner[
- makerAddressLeft
- ][takerAssetAddressLeft].add(expectedTransferAmounts.amountBoughtByLeftMaker);
- // Right Maker
- expectedNewERC20BalancesByOwner[makerAddressRight][
- makerAssetAddressRight
- ] = expectedNewERC20BalancesByOwner[makerAddressRight][makerAssetAddressRight].minus(
- expectedTransferAmounts.amountSoldByRightMaker,
- );
- } else if (takerAssetProxyIdLeft === AssetProxyId.ERC721) {
- // Decode asset data
- const erc721AssetData = assetDataUtils.decodeERC721AssetData(signedOrderRight.makerAssetData);
- const makerAssetAddressRight = erc721AssetData.tokenAddress;
- const makerAssetIdRight = erc721AssetData.tokenId;
- const takerAssetAddressLeft = makerAssetAddressRight;
- const takerAssetIdLeft = makerAssetIdRight;
- // Right Maker
- _.remove(expectedNewERC721TokenIdsByOwner[makerAddressRight][makerAssetAddressRight], makerAssetIdRight);
- // Left Maker
- expectedNewERC721TokenIdsByOwner[makerAddressLeft][takerAssetAddressLeft].push(takerAssetIdLeft);
- }
- // Left Maker Fees
- expectedNewERC20BalancesByOwner[makerAddressLeft][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[
- makerAddressLeft
- ][this._feeTokenAddress].minus(expectedTransferAmounts.feePaidByLeftMaker);
- // Right Maker Fees
- expectedNewERC20BalancesByOwner[makerAddressRight][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[
- makerAddressRight
- ][this._feeTokenAddress].minus(expectedTransferAmounts.feePaidByRightMaker);
- // Taker Fees
- expectedNewERC20BalancesByOwner[takerAddress][this._feeTokenAddress] = expectedNewERC20BalancesByOwner[
- takerAddress
- ][this._feeTokenAddress].minus(
- expectedTransferAmounts.feePaidByTakerLeft.add(expectedTransferAmounts.feePaidByTakerRight),
- );
- // Left Fee Recipient Fees
- expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][
- this._feeTokenAddress
- ] = expectedNewERC20BalancesByOwner[feeRecipientAddressLeft][this._feeTokenAddress].add(
- expectedTransferAmounts.feePaidByLeftMaker.add(expectedTransferAmounts.feePaidByTakerLeft),
- );
- // Right Fee Recipient Fees
- expectedNewERC20BalancesByOwner[feeRecipientAddressRight][
- this._feeTokenAddress
- ] = expectedNewERC20BalancesByOwner[feeRecipientAddressRight][this._feeTokenAddress].add(
- expectedTransferAmounts.feePaidByRightMaker.add(expectedTransferAmounts.feePaidByTakerRight),
- );
-
- return [expectedNewERC20BalancesByOwner, expectedNewERC721TokenIdsByOwner];
- }
- /// @dev Asserts ERC20 account balances and ERC721 token holdings that result from order matching.
- /// Specifically checks balances of makers, taker and fee recipients.
- /// @param signedOrderLeft First matched order.
- /// @param signedOrderRight Second matched order.
- /// @param expectedERC20BalancesByOwner Expected ERC20 balances.
- /// @param realERC20BalancesByOwner Real ERC20 balances.
- /// @param expectedERC721TokenIdsByOwner Expected ERC721 token owners.
- /// @param realERC721TokenIdsByOwner Real ERC20 token owners.
- /// @param takerAddress Address of taker (account that called Exchange.matchOrders).
- private async _assertMakerTakerAndFeeRecipientBalancesAsync(
- signedOrderLeft: SignedOrder,
- signedOrderRight: SignedOrder,
- expectedERC20BalancesByOwner: ERC20BalancesByOwner,
- realERC20BalancesByOwner: ERC20BalancesByOwner,
- expectedERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
- realERC721TokenIdsByOwner: ERC721TokenIdsByOwner,
- takerAddress: string,
- ): Promise<void> {
- // Individual balance comparisons
- const makerAssetProxyIdLeft = assetDataUtils.decodeAssetProxyId(signedOrderLeft.makerAssetData);
- const makerERC20AssetDataLeft =
- makerAssetProxyIdLeft === AssetProxyId.ERC20
- ? assetDataUtils.decodeERC20AssetData(signedOrderLeft.makerAssetData)
- : assetDataUtils.decodeERC721AssetData(signedOrderLeft.makerAssetData);
- const makerAssetAddressLeft = makerERC20AssetDataLeft.tokenAddress;
- const makerAssetProxyIdRight = assetDataUtils.decodeAssetProxyId(signedOrderRight.makerAssetData);
- const makerERC20AssetDataRight =
- makerAssetProxyIdRight === AssetProxyId.ERC20
- ? assetDataUtils.decodeERC20AssetData(signedOrderRight.makerAssetData)
- : assetDataUtils.decodeERC721AssetData(signedOrderRight.makerAssetData);
- const makerAssetAddressRight = makerERC20AssetDataRight.tokenAddress;
- if (makerAssetProxyIdLeft === AssetProxyId.ERC20) {
- expect(
- realERC20BalancesByOwner[signedOrderLeft.makerAddress][makerAssetAddressLeft],
- 'Checking left maker egress ERC20 account balance',
- ).to.be.bignumber.equal(expectedERC20BalancesByOwner[signedOrderLeft.makerAddress][makerAssetAddressLeft]);
- expect(
- realERC20BalancesByOwner[signedOrderRight.makerAddress][makerAssetAddressLeft],
- 'Checking right maker ingress ERC20 account balance',
- ).to.be.bignumber.equal(expectedERC20BalancesByOwner[signedOrderRight.makerAddress][makerAssetAddressLeft]);
- expect(
- realERC20BalancesByOwner[takerAddress][makerAssetAddressLeft],
- 'Checking taker ingress ERC20 account balance',
- ).to.be.bignumber.equal(expectedERC20BalancesByOwner[takerAddress][makerAssetAddressLeft]);
- } else if (makerAssetProxyIdLeft === AssetProxyId.ERC721) {
- expect(
- realERC721TokenIdsByOwner[signedOrderLeft.makerAddress][makerAssetAddressLeft].sort(),
- 'Checking left maker egress ERC721 account holdings',
- ).to.be.deep.equal(
- expectedERC721TokenIdsByOwner[signedOrderLeft.makerAddress][makerAssetAddressLeft].sort(),
- );
- expect(
- realERC721TokenIdsByOwner[signedOrderRight.makerAddress][makerAssetAddressLeft].sort(),
- 'Checking right maker ERC721 account holdings',
- ).to.be.deep.equal(
- expectedERC721TokenIdsByOwner[signedOrderRight.makerAddress][makerAssetAddressLeft].sort(),
- );
- expect(
- realERC721TokenIdsByOwner[takerAddress][makerAssetAddressLeft].sort(),
- 'Checking taker ingress ERC721 account holdings',
- ).to.be.deep.equal(expectedERC721TokenIdsByOwner[takerAddress][makerAssetAddressLeft].sort());
- } else {
- throw new Error(`Unhandled Asset Proxy ID: ${makerAssetProxyIdLeft}`);
- }
- if (makerAssetProxyIdRight === AssetProxyId.ERC20) {
- expect(
- realERC20BalancesByOwner[signedOrderLeft.makerAddress][makerAssetAddressRight],
- 'Checking left maker ingress ERC20 account balance',
- ).to.be.bignumber.equal(expectedERC20BalancesByOwner[signedOrderLeft.makerAddress][makerAssetAddressRight]);
- expect(
- realERC20BalancesByOwner[signedOrderRight.makerAddress][makerAssetAddressRight],
- 'Checking right maker egress ERC20 account balance',
- ).to.be.bignumber.equal(
- expectedERC20BalancesByOwner[signedOrderRight.makerAddress][makerAssetAddressRight],
- );
- } else if (makerAssetProxyIdRight === AssetProxyId.ERC721) {
- expect(
- realERC721TokenIdsByOwner[signedOrderLeft.makerAddress][makerAssetAddressRight].sort(),
- 'Checking left maker ingress ERC721 account holdings',
- ).to.be.deep.equal(
- expectedERC721TokenIdsByOwner[signedOrderLeft.makerAddress][makerAssetAddressRight].sort(),
- );
- expect(
- realERC721TokenIdsByOwner[signedOrderRight.makerAddress][makerAssetAddressRight],
- 'Checking right maker agress ERC721 account holdings',
- ).to.be.deep.equal(expectedERC721TokenIdsByOwner[signedOrderRight.makerAddress][makerAssetAddressRight]);
- } else {
- throw new Error(`Unhandled Asset Proxy ID: ${makerAssetProxyIdRight}`);
- }
- // Paid fees
- expect(
- realERC20BalancesByOwner[signedOrderLeft.makerAddress][this._feeTokenAddress],
- 'Checking left maker egress ERC20 account fees',
- ).to.be.bignumber.equal(expectedERC20BalancesByOwner[signedOrderLeft.makerAddress][this._feeTokenAddress]);
- expect(
- realERC20BalancesByOwner[signedOrderRight.makerAddress][this._feeTokenAddress],
- 'Checking right maker egress ERC20 account fees',
- ).to.be.bignumber.equal(expectedERC20BalancesByOwner[signedOrderRight.makerAddress][this._feeTokenAddress]);
- expect(
- realERC20BalancesByOwner[takerAddress][this._feeTokenAddress],
- 'Checking taker egress ERC20 account fees',
- ).to.be.bignumber.equal(expectedERC20BalancesByOwner[takerAddress][this._feeTokenAddress]);
- // Received fees
- expect(
- realERC20BalancesByOwner[signedOrderLeft.feeRecipientAddress][this._feeTokenAddress],
- 'Checking left fee recipient ingress ERC20 account fees',
- ).to.be.bignumber.equal(
- expectedERC20BalancesByOwner[signedOrderLeft.feeRecipientAddress][this._feeTokenAddress],
- );
- expect(
- realERC20BalancesByOwner[signedOrderRight.feeRecipientAddress][this._feeTokenAddress],
- 'Checking right fee receipient ingress ERC20 account fees',
- ).to.be.bignumber.equal(
- expectedERC20BalancesByOwner[signedOrderRight.feeRecipientAddress][this._feeTokenAddress],
- );
- }
-} // tslint:disable-line:max-file-line-count
diff --git a/packages/contracts/test/utils/multi_sig_wrapper.ts b/packages/contracts/test/utils/multi_sig_wrapper.ts
deleted file mode 100644
index 74fd3b4d6..000000000
--- a/packages/contracts/test/utils/multi_sig_wrapper.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-import { BigNumber } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
-import * as _ from 'lodash';
-
-import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner';
-import { MultiSigWalletContract } from '../../generated-wrappers/multi_sig_wallet';
-
-import { LogDecoder } from './log_decoder';
-
-export class MultiSigWrapper {
- private readonly _multiSig: MultiSigWalletContract;
- private readonly _web3Wrapper: Web3Wrapper;
- private readonly _logDecoder: LogDecoder;
- constructor(multiSigContract: MultiSigWalletContract, provider: Provider) {
- this._multiSig = multiSigContract;
- this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper);
- }
- public async submitTransactionAsync(
- destination: string,
- data: string,
- from: string,
- opts: { value?: BigNumber } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value;
- const txHash = await this._multiSig.submitTransaction.sendTransactionAsync(destination, value, data, {
- from,
- });
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async confirmTransactionAsync(txId: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
- const txHash = await this._multiSig.confirmTransaction.sendTransactionAsync(txId, { from });
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async revokeConfirmationAsync(txId: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
- const txHash = await this._multiSig.revokeConfirmation.sendTransactionAsync(txId, { from });
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async executeTransactionAsync(
- txId: BigNumber,
- from: string,
- opts: { gas?: number } = {},
- ): Promise<TransactionReceiptWithDecodedLogs> {
- const txHash = await this._multiSig.executeTransaction.sendTransactionAsync(txId, {
- from,
- gas: opts.gas,
- });
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
- public async executeRemoveAuthorizedAddressAtIndexAsync(
- txId: BigNumber,
- from: string,
- ): Promise<TransactionReceiptWithDecodedLogs> {
- // tslint:disable-next-line:no-unnecessary-type-assertion
- const txHash = await (this
- ._multiSig as AssetProxyOwnerContract).executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
- from,
- });
- const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
- return tx;
- }
-}
diff --git a/packages/contracts/test/utils/order_factory_from_scenario.ts b/packages/contracts/test/utils/order_factory_from_scenario.ts
deleted file mode 100644
index 60c8606c4..000000000
--- a/packages/contracts/test/utils/order_factory_from_scenario.ts
+++ /dev/null
@@ -1,296 +0,0 @@
-import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
-import { Order } from '@0x/types';
-import { BigNumber, errorUtils } from '@0x/utils';
-
-import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
-
-import { constants } from './constants';
-import {
- AssetDataScenario,
- ERC721TokenIdsByOwner,
- ExpirationTimeSecondsScenario,
- FeeRecipientAddressScenario,
- OrderAssetAmountScenario,
- OrderScenario,
- TakerScenario,
-} from './types';
-
-const TEN_UNITS_EIGHTEEN_DECIMALS = new BigNumber(10_000_000_000_000_000_000);
-const FIVE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(5_000_000_000_000_000_000);
-const POINT_ONE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(100_000_000_000_000_000);
-const POINT_ZERO_FIVE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(50_000_000_000_000_000);
-const TEN_UNITS_FIVE_DECIMALS = new BigNumber(1_000_000);
-const FIVE_UNITS_FIVE_DECIMALS = new BigNumber(500_000);
-const TEN_UNITS_ZERO_DECIMALS = new BigNumber(10);
-const ONE_THOUSAND_UNITS_ZERO_DECIMALS = new BigNumber(1000);
-const ONE_NFT_UNIT = new BigNumber(1);
-
-export class OrderFactoryFromScenario {
- private readonly _userAddresses: string[];
- private readonly _zrxAddress: string;
- private readonly _nonZrxERC20EighteenDecimalTokenAddresses: string[];
- private readonly _erc20FiveDecimalTokenAddresses: string[];
- private readonly _erc20ZeroDecimalTokenAddresses: string[];
- private readonly _erc721Token: DummyERC721TokenContract;
- private readonly _erc721Balances: ERC721TokenIdsByOwner;
- private readonly _exchangeAddress: string;
- constructor(
- userAddresses: string[],
- zrxAddress: string,
- nonZrxERC20EighteenDecimalTokenAddresses: string[],
- erc20FiveDecimalTokenAddresses: string[],
- erc20ZeroDecimalTokenAddresses: string[],
- erc721Token: DummyERC721TokenContract,
- erc721Balances: ERC721TokenIdsByOwner,
- exchangeAddress: string,
- ) {
- this._userAddresses = userAddresses;
- this._zrxAddress = zrxAddress;
- this._nonZrxERC20EighteenDecimalTokenAddresses = nonZrxERC20EighteenDecimalTokenAddresses;
- this._erc20FiveDecimalTokenAddresses = erc20FiveDecimalTokenAddresses;
- this._erc20ZeroDecimalTokenAddresses = erc20ZeroDecimalTokenAddresses;
- this._erc721Token = erc721Token;
- this._erc721Balances = erc721Balances;
- this._exchangeAddress = exchangeAddress;
- }
- public generateOrder(orderScenario: OrderScenario): Order {
- const makerAddress = this._userAddresses[1];
- let takerAddress = this._userAddresses[2];
- const erc721MakerAssetIds = this._erc721Balances[makerAddress][this._erc721Token.address];
- const erc721TakerAssetIds = this._erc721Balances[takerAddress][this._erc721Token.address];
- let feeRecipientAddress;
- let makerAssetAmount;
- let takerAssetAmount;
- let makerFee;
- let takerFee;
- let expirationTimeSeconds;
- let makerAssetData;
- let takerAssetData;
-
- switch (orderScenario.feeRecipientScenario) {
- case FeeRecipientAddressScenario.BurnAddress:
- feeRecipientAddress = constants.NULL_ADDRESS;
- break;
- case FeeRecipientAddressScenario.EthUserAddress:
- feeRecipientAddress = this._userAddresses[4];
- break;
- default:
- throw errorUtils.spawnSwitchErr('FeeRecipientAddressScenario', orderScenario.feeRecipientScenario);
- }
-
- switch (orderScenario.makerAssetDataScenario) {
- case AssetDataScenario.ZRXFeeToken:
- makerAssetData = assetDataUtils.encodeERC20AssetData(this._zrxAddress);
- break;
- case AssetDataScenario.ERC20NonZRXEighteenDecimals:
- makerAssetData = assetDataUtils.encodeERC20AssetData(this._nonZrxERC20EighteenDecimalTokenAddresses[0]);
- break;
- case AssetDataScenario.ERC20FiveDecimals:
- makerAssetData = assetDataUtils.encodeERC20AssetData(this._erc20FiveDecimalTokenAddresses[0]);
- break;
- case AssetDataScenario.ERC721:
- makerAssetData = assetDataUtils.encodeERC721AssetData(
- this._erc721Token.address,
- erc721MakerAssetIds[0],
- );
- break;
- case AssetDataScenario.ERC20ZeroDecimals:
- makerAssetData = assetDataUtils.encodeERC20AssetData(this._erc20ZeroDecimalTokenAddresses[0]);
- break;
- default:
- throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.makerAssetDataScenario);
- }
-
- switch (orderScenario.takerAssetDataScenario) {
- case AssetDataScenario.ZRXFeeToken:
- takerAssetData = assetDataUtils.encodeERC20AssetData(this._zrxAddress);
- break;
- case AssetDataScenario.ERC20NonZRXEighteenDecimals:
- takerAssetData = assetDataUtils.encodeERC20AssetData(this._nonZrxERC20EighteenDecimalTokenAddresses[1]);
- break;
- case AssetDataScenario.ERC20FiveDecimals:
- takerAssetData = assetDataUtils.encodeERC20AssetData(this._erc20FiveDecimalTokenAddresses[1]);
- break;
- case AssetDataScenario.ERC721:
- takerAssetData = assetDataUtils.encodeERC721AssetData(
- this._erc721Token.address,
- erc721TakerAssetIds[0],
- );
- break;
- case AssetDataScenario.ERC20ZeroDecimals:
- takerAssetData = assetDataUtils.encodeERC20AssetData(this._erc20ZeroDecimalTokenAddresses[1]);
- break;
- default:
- throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.takerAssetDataScenario);
- }
-
- switch (orderScenario.makerAssetAmountScenario) {
- case OrderAssetAmountScenario.Large:
- switch (orderScenario.makerAssetDataScenario) {
- case AssetDataScenario.ZRXFeeToken:
- case AssetDataScenario.ERC20NonZRXEighteenDecimals:
- makerAssetAmount = TEN_UNITS_EIGHTEEN_DECIMALS;
- break;
- case AssetDataScenario.ERC20FiveDecimals:
- makerAssetAmount = TEN_UNITS_FIVE_DECIMALS;
- break;
- case AssetDataScenario.ERC721:
- makerAssetAmount = ONE_NFT_UNIT;
- break;
- case AssetDataScenario.ERC20ZeroDecimals:
- makerAssetAmount = ONE_THOUSAND_UNITS_ZERO_DECIMALS;
- break;
- default:
- throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.makerAssetDataScenario);
- }
- break;
- case OrderAssetAmountScenario.Small:
- switch (orderScenario.makerAssetDataScenario) {
- case AssetDataScenario.ZRXFeeToken:
- case AssetDataScenario.ERC20NonZRXEighteenDecimals:
- makerAssetAmount = FIVE_UNITS_EIGHTEEN_DECIMALS;
- break;
- case AssetDataScenario.ERC20FiveDecimals:
- makerAssetAmount = FIVE_UNITS_FIVE_DECIMALS;
- break;
- case AssetDataScenario.ERC721:
- makerAssetAmount = ONE_NFT_UNIT;
- break;
- case AssetDataScenario.ERC20ZeroDecimals:
- makerAssetAmount = TEN_UNITS_ZERO_DECIMALS;
- break;
- default:
- throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.makerAssetDataScenario);
- }
- break;
- case OrderAssetAmountScenario.Zero:
- makerAssetAmount = new BigNumber(0);
- break;
- default:
- throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.makerAssetAmountScenario);
- }
-
- switch (orderScenario.takerAssetAmountScenario) {
- case OrderAssetAmountScenario.Large:
- switch (orderScenario.takerAssetDataScenario) {
- case AssetDataScenario.ERC20NonZRXEighteenDecimals:
- case AssetDataScenario.ZRXFeeToken:
- takerAssetAmount = TEN_UNITS_EIGHTEEN_DECIMALS;
- break;
- case AssetDataScenario.ERC20FiveDecimals:
- takerAssetAmount = TEN_UNITS_FIVE_DECIMALS;
- break;
- case AssetDataScenario.ERC721:
- takerAssetAmount = ONE_NFT_UNIT;
- break;
- case AssetDataScenario.ERC20ZeroDecimals:
- takerAssetAmount = ONE_THOUSAND_UNITS_ZERO_DECIMALS;
- break;
- default:
- throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.takerAssetDataScenario);
- }
- break;
- case OrderAssetAmountScenario.Small:
- switch (orderScenario.takerAssetDataScenario) {
- case AssetDataScenario.ERC20NonZRXEighteenDecimals:
- case AssetDataScenario.ZRXFeeToken:
- takerAssetAmount = FIVE_UNITS_EIGHTEEN_DECIMALS;
- break;
- case AssetDataScenario.ERC20FiveDecimals:
- takerAssetAmount = FIVE_UNITS_FIVE_DECIMALS;
- break;
- case AssetDataScenario.ERC721:
- takerAssetAmount = ONE_NFT_UNIT;
- break;
- case AssetDataScenario.ERC20ZeroDecimals:
- takerAssetAmount = TEN_UNITS_ZERO_DECIMALS;
- break;
- default:
- throw errorUtils.spawnSwitchErr('AssetDataScenario', orderScenario.takerAssetDataScenario);
- }
- break;
- case OrderAssetAmountScenario.Zero:
- takerAssetAmount = new BigNumber(0);
- break;
- default:
- throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.takerAssetAmountScenario);
- }
-
- switch (orderScenario.makerFeeScenario) {
- case OrderAssetAmountScenario.Large:
- makerFee = POINT_ONE_UNITS_EIGHTEEN_DECIMALS;
- break;
- case OrderAssetAmountScenario.Small:
- makerFee = POINT_ZERO_FIVE_UNITS_EIGHTEEN_DECIMALS;
- break;
- case OrderAssetAmountScenario.Zero:
- makerFee = new BigNumber(0);
- break;
- default:
- throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.makerFeeScenario);
- }
-
- switch (orderScenario.takerFeeScenario) {
- case OrderAssetAmountScenario.Large:
- takerFee = POINT_ONE_UNITS_EIGHTEEN_DECIMALS;
- break;
- case OrderAssetAmountScenario.Small:
- takerFee = POINT_ZERO_FIVE_UNITS_EIGHTEEN_DECIMALS;
- break;
- case OrderAssetAmountScenario.Zero:
- takerFee = new BigNumber(0);
- break;
- default:
- throw errorUtils.spawnSwitchErr('OrderAssetAmountScenario', orderScenario.takerFeeScenario);
- }
-
- switch (orderScenario.expirationTimeSecondsScenario) {
- case ExpirationTimeSecondsScenario.InFuture:
- expirationTimeSeconds = new BigNumber(2524604400); // Close to infinite
- break;
- case ExpirationTimeSecondsScenario.InPast:
- expirationTimeSeconds = new BigNumber(0); // Jan 1, 1970
- break;
- default:
- throw errorUtils.spawnSwitchErr(
- 'ExpirationTimeSecondsScenario',
- orderScenario.expirationTimeSecondsScenario,
- );
- }
-
- switch (orderScenario.takerScenario) {
- case TakerScenario.CorrectlySpecified:
- break; // noop since takerAddress is already specified
-
- case TakerScenario.IncorrectlySpecified:
- const notTaker = this._userAddresses[3];
- takerAddress = notTaker;
- break;
-
- case TakerScenario.Unspecified:
- takerAddress = constants.NULL_ADDRESS;
- break;
-
- default:
- throw errorUtils.spawnSwitchErr('TakerScenario', orderScenario.takerScenario);
- }
-
- const order = {
- senderAddress: constants.NULL_ADDRESS,
- makerAddress,
- takerAddress,
- makerFee,
- takerFee,
- makerAssetAmount,
- takerAssetAmount,
- makerAssetData,
- takerAssetData,
- salt: generatePseudoRandomSalt(),
- exchangeAddress: this._exchangeAddress,
- feeRecipientAddress,
- expirationTimeSeconds,
- };
-
- return order;
- }
-}
diff --git a/packages/contracts/test/utils/test_with_reference.ts b/packages/contracts/test/utils/test_with_reference.ts
deleted file mode 100644
index b80be4a6c..000000000
--- a/packages/contracts/test/utils/test_with_reference.ts
+++ /dev/null
@@ -1,139 +0,0 @@
-import * as chai from 'chai';
-import * as _ from 'lodash';
-
-import { chaiSetup } from './chai_setup';
-
-chaiSetup.configure();
-const expect = chai.expect;
-
-class Value<T> {
- public value: T;
- constructor(value: T) {
- this.value = value;
- }
-}
-
-// tslint:disable-next-line: max-classes-per-file
-class ErrorMessage {
- public error: string;
- constructor(message: string) {
- this.error = message;
- }
-}
-
-type PromiseResult<T> = Value<T> | ErrorMessage;
-
-// TODO(albrow): This seems like a generic utility function that could exist in
-// lodash. We should replace it by a library implementation, or move it to our
-// own.
-async function evaluatePromise<T>(promise: Promise<T>): Promise<PromiseResult<T>> {
- try {
- return new Value<T>(await promise);
- } catch (e) {
- return new ErrorMessage(e.message);
- }
-}
-
-export async function testWithReferenceFuncAsync<P0, R>(
- referenceFunc: (p0: P0) => Promise<R>,
- testFunc: (p0: P0) => Promise<R>,
- values: [P0],
-): Promise<void>;
-export async function testWithReferenceFuncAsync<P0, P1, R>(
- referenceFunc: (p0: P0, p1: P1) => Promise<R>,
- testFunc: (p0: P0, p1: P1) => Promise<R>,
- values: [P0, P1],
-): Promise<void>;
-export async function testWithReferenceFuncAsync<P0, P1, P2, R>(
- referenceFunc: (p0: P0, p1: P1, p2: P2) => Promise<R>,
- testFunc: (p0: P0, p1: P1, p2: P2) => Promise<R>,
- values: [P0, P1, P2],
-): Promise<void>;
-export async function testWithReferenceFuncAsync<P0, P1, P2, P3, R>(
- referenceFunc: (p0: P0, p1: P1, p2: P2, p3: P3) => Promise<R>,
- testFunc: (p0: P0, p1: P1, p2: P2, p3: P3) => Promise<R>,
- values: [P0, P1, P2, P3],
-): Promise<void>;
-export async function testWithReferenceFuncAsync<P0, P1, P2, P3, P4, R>(
- referenceFunc: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) => Promise<R>,
- testFunc: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) => Promise<R>,
- values: [P0, P1, P2, P3, P4],
-): Promise<void>;
-
-/**
- * Tests the behavior of a test function by comparing it to the expected
- * behavior (defined by a reference function).
- *
- * First the reference function will be called to obtain an "expected result",
- * or if the reference function throws/rejects, an "expected error". Next, the
- * test function will be called to obtain an "actual result", or if the test
- * function throws/rejects, an "actual error". The test passes if at least one
- * of the following conditions is met:
- *
- * 1) Neither the reference function or the test function throw and the
- * "expected result" equals the "actual result".
- *
- * 2) Both the reference function and the test function throw and the "actual
- * error" message *contains* the "expected error" message.
- *
- * @param referenceFuncAsync a reference function implemented in pure
- * JavaScript/TypeScript which accepts N arguments and returns the "expected
- * result" or throws/rejects with the "expected error".
- * @param testFuncAsync a test function which, e.g., makes a call or sends a
- * transaction to a contract. It accepts the same N arguments returns the
- * "actual result" or throws/rejects with the "actual error".
- * @param values an array of N values, where each value corresponds in-order to
- * an argument to both the test function and the reference function.
- * @return A Promise that resolves if the test passes and rejects if the test
- * fails, according to the rules described above.
- */
-export async function testWithReferenceFuncAsync(
- referenceFuncAsync: (...args: any[]) => Promise<any>,
- testFuncAsync: (...args: any[]) => Promise<any>,
- values: any[],
-): Promise<void> {
- // Measure correct behaviour
- const expected = await evaluatePromise(referenceFuncAsync(...values));
-
- // Measure actual behaviour
- const actual = await evaluatePromise(testFuncAsync(...values));
-
- // Compare behaviour
- if (expected instanceof ErrorMessage) {
- // If we expected an error, check if the actual error message contains the
- // expected error message.
- if (!(actual instanceof ErrorMessage)) {
- throw new Error(
- `Expected error containing ${expected.error} but got no error\n\tTest case: ${_getTestCaseString(
- referenceFuncAsync,
- values,
- )}`,
- );
- }
- expect(actual.error).to.contain(
- expected.error,
- `${actual.error}\n\tTest case: ${_getTestCaseString(referenceFuncAsync, values)}`,
- );
- } else {
- // If we do not expect an error, compare actual and expected directly.
- expect(actual).to.deep.equal(expected, `Test case ${_getTestCaseString(referenceFuncAsync, values)}`);
- }
-}
-
-function _getTestCaseString(referenceFuncAsync: (...args: any[]) => Promise<any>, values: any[]): string {
- const paramNames = _getParameterNames(referenceFuncAsync);
- return JSON.stringify(_.zipObject(paramNames, values));
-}
-
-// Source: https://stackoverflow.com/questions/1007981/how-to-get-function-parameter-names-values-dynamically
-function _getParameterNames(func: (...args: any[]) => any): string[] {
- return _.toString(func)
- .replace(/[/][/].*$/gm, '') // strip single-line comments
- .replace(/\s+/g, '') // strip white space
- .replace(/[/][*][^/*]*[*][/]/g, '') // strip multi-line comments
- .split('){', 1)[0]
- .replace(/^[^(]*[(]/, '') // extract the parameters
- .replace(/=[^,]+/g, '') // strip any ES6 defaults
- .split(',')
- .filter(Boolean); // split & filter [""]
-}
diff --git a/packages/contracts/test/utils/types.ts b/packages/contracts/test/utils/types.ts
deleted file mode 100644
index 9fc9e1570..000000000
--- a/packages/contracts/test/utils/types.ts
+++ /dev/null
@@ -1,241 +0,0 @@
-import { OrderWithoutExchangeAddress } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import { AbiDefinition } from 'ethereum-types';
-
-export interface ERC20BalancesByOwner {
- [ownerAddress: string]: {
- [tokenAddress: string]: BigNumber;
- };
-}
-
-export interface ERC721TokenIdsByOwner {
- [ownerAddress: string]: {
- [tokenAddress: string]: BigNumber[];
- };
-}
-
-export interface SubmissionContractEventArgs {
- transactionId: BigNumber;
-}
-
-export interface BatchFillOrders {
- orders: OrderWithoutExchangeAddress[];
- signatures: string[];
- takerAssetFillAmounts: BigNumber[];
-}
-
-export interface MarketSellOrders {
- orders: OrderWithoutExchangeAddress[];
- signatures: string[];
- takerAssetFillAmount: BigNumber;
-}
-
-export interface MarketBuyOrders {
- orders: OrderWithoutExchangeAddress[];
- signatures: string[];
- makerAssetFillAmount: BigNumber;
-}
-
-export interface BatchCancelOrders {
- orders: OrderWithoutExchangeAddress[];
-}
-
-export interface CancelOrdersBefore {
- salt: BigNumber;
-}
-
-export interface TransactionDataParams {
- name: string;
- abi: AbiDefinition[];
- args: any[];
-}
-
-export interface MultiSigConfig {
- owners: string[];
- confirmationsRequired: number;
- secondsRequired: number;
-}
-
-export interface MultiSigConfigByNetwork {
- [networkName: string]: MultiSigConfig;
-}
-
-export interface Token {
- address?: string;
- name: string;
- symbol: string;
- decimals: number;
- ipfsHash: string;
- swarmHash: string;
-}
-
-export enum OrderStatus {
- INVALID,
- INVALID_MAKER_ASSET_AMOUNT,
- INVALID_TAKER_ASSET_AMOUNT,
- FILLABLE,
- EXPIRED,
- FULLY_FILLED,
- CANCELLED,
-}
-
-export enum ContractName {
- TokenRegistry = 'TokenRegistry',
- MultiSigWalletWithTimeLock = 'MultiSigWalletWithTimeLock',
- Exchange = 'Exchange',
- ZRXToken = 'ZRXToken',
- DummyERC20Token = 'DummyERC20Token',
- EtherToken = 'WETH9',
- AssetProxyOwner = 'AssetProxyOwner',
- AccountLevels = 'AccountLevels',
- EtherDelta = 'EtherDelta',
- Arbitrage = 'Arbitrage',
- TestAssetDataDecoders = 'TestAssetDataDecoders',
- TestAssetProxyDispatcher = 'TestAssetProxyDispatcher',
- TestLibs = 'TestLibs',
- TestSignatureValidator = 'TestSignatureValidator',
- ERC20Proxy = 'ERC20Proxy',
- ERC721Proxy = 'ERC721Proxy',
- DummyERC721Receiver = 'DummyERC721Receiver',
- DummyERC721Token = 'DummyERC721Token',
- TestLibBytes = 'TestLibBytes',
- TestWallet = 'TestWallet',
- Authorizable = 'Authorizable',
- Whitelist = 'Whitelist',
- Forwarder = 'Forwarder',
-}
-
-export interface SignedTransaction {
- exchangeAddress: string;
- salt: BigNumber;
- signerAddress: string;
- data: string;
- signature: string;
-}
-
-export interface TransferAmountsByMatchOrders {
- // Left Maker
- amountBoughtByLeftMaker: BigNumber;
- amountSoldByLeftMaker: BigNumber;
- feePaidByLeftMaker: BigNumber;
- // Right Maker
- amountBoughtByRightMaker: BigNumber;
- amountSoldByRightMaker: BigNumber;
- feePaidByRightMaker: BigNumber;
- // Taker
- amountReceivedByTaker: BigNumber;
- feePaidByTakerLeft: BigNumber;
- feePaidByTakerRight: BigNumber;
-}
-
-export interface TransferAmountsLoggedByMatchOrders {
- makerAddress: string;
- takerAddress: string;
- makerAssetFilledAmount: string;
- takerAssetFilledAmount: string;
- makerFeePaid: string;
- takerFeePaid: string;
-}
-
-export interface OrderInfo {
- orderStatus: number;
- orderHash: string;
- orderTakerAssetFilledAmount: BigNumber;
-}
-
-export interface CancelOrder {
- order: OrderWithoutExchangeAddress;
- takerAssetCancelAmount: BigNumber;
-}
-
-export interface MatchOrder {
- left: OrderWithoutExchangeAddress;
- right: OrderWithoutExchangeAddress;
- leftSignature: string;
- rightSignature: string;
-}
-
-// Combinatorial testing types
-
-export enum FeeRecipientAddressScenario {
- BurnAddress = 'BURN_ADDRESS',
- EthUserAddress = 'ETH_USER_ADDRESS',
-}
-
-export enum OrderAssetAmountScenario {
- Zero = 'ZERO',
- Large = 'LARGE',
- Small = 'SMALL',
-}
-
-export enum TakerScenario {
- CorrectlySpecified = 'CORRECTLY_SPECIFIED',
- IncorrectlySpecified = 'INCORRECTLY_SPECIFIED',
- Unspecified = 'UNSPECIFIED',
-}
-
-export enum ExpirationTimeSecondsScenario {
- InPast = 'IN_PAST',
- InFuture = 'IN_FUTURE',
-}
-
-export enum AssetDataScenario {
- ERC20ZeroDecimals = 'ERC20_ZERO_DECIMALS',
- ZRXFeeToken = 'ZRX_FEE_TOKEN',
- ERC20FiveDecimals = 'ERC20_FIVE_DECIMALS',
- ERC20NonZRXEighteenDecimals = 'ERC20_NON_ZRX_EIGHTEEN_DECIMALS',
- ERC721 = 'ERC721',
-}
-
-export enum TakerAssetFillAmountScenario {
- Zero = 'ZERO',
- GreaterThanRemainingFillableTakerAssetAmount = 'GREATER_THAN_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT',
- LessThanRemainingFillableTakerAssetAmount = 'LESS_THAN_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT',
- ExactlyRemainingFillableTakerAssetAmount = 'EXACTLY_REMAINING_FILLABLE_TAKER_ASSET_AMOUNT',
-}
-
-export interface OrderScenario {
- takerScenario: TakerScenario;
- feeRecipientScenario: FeeRecipientAddressScenario;
- makerAssetAmountScenario: OrderAssetAmountScenario;
- takerAssetAmountScenario: OrderAssetAmountScenario;
- makerFeeScenario: OrderAssetAmountScenario;
- takerFeeScenario: OrderAssetAmountScenario;
- expirationTimeSecondsScenario: ExpirationTimeSecondsScenario;
- makerAssetDataScenario: AssetDataScenario;
- takerAssetDataScenario: AssetDataScenario;
-}
-
-export enum BalanceAmountScenario {
- Exact = 'EXACT',
- TooLow = 'TOO_LOW',
- Higher = 'HIGHER',
-}
-
-export enum AllowanceAmountScenario {
- Exact = 'EXACT',
- TooLow = 'TOO_LOW',
- Higher = 'HIGHER',
- Unlimited = 'UNLIMITED',
-}
-
-export interface TraderStateScenario {
- traderAssetBalance: BalanceAmountScenario;
- traderAssetAllowance: AllowanceAmountScenario;
- zrxFeeBalance: BalanceAmountScenario;
- zrxFeeAllowance: AllowanceAmountScenario;
-}
-
-export interface FillScenario {
- orderScenario: OrderScenario;
- takerAssetFillAmountScenario: TakerAssetFillAmountScenario;
- makerStateScenario: TraderStateScenario;
- takerStateScenario: TraderStateScenario;
-}
-
-export interface FillResults {
- makerAssetFilledAmount: BigNumber;
- takerAssetFilledAmount: BigNumber;
- makerFeePaid: BigNumber;
- takerFeePaid: BigNumber;
-}
diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts
deleted file mode 100644
index f7b1a732a..000000000
--- a/packages/contracts/test/utils/web3_wrapper.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import { devConstants, env, EnvVars, web3Factory } from '@0x/dev-utils';
-import { prependSubprovider, Web3ProviderEngine } from '@0x/subproviders';
-import { logUtils } from '@0x/utils';
-import { Web3Wrapper } from '@0x/web3-wrapper';
-import * as _ from 'lodash';
-
-import { coverage } from './coverage';
-import { profiler } from './profiler';
-import { revertTrace } from './revert_trace';
-
-enum ProviderType {
- Ganache = 'ganache',
- Geth = 'geth',
-}
-
-let testProvider: ProviderType;
-switch (process.env.TEST_PROVIDER) {
- case undefined:
- testProvider = ProviderType.Ganache;
- break;
- case 'ganache':
- testProvider = ProviderType.Ganache;
- break;
- case 'geth':
- testProvider = ProviderType.Geth;
- break;
- default:
- throw new Error(`Unknown TEST_PROVIDER: ${process.env.TEST_PROVIDER}`);
-}
-
-const ganacheTxDefaults = {
- from: devConstants.TESTRPC_FIRST_ADDRESS,
- gas: devConstants.GAS_LIMIT,
-};
-const gethTxDefaults = {
- from: devConstants.TESTRPC_FIRST_ADDRESS,
-};
-export const txDefaults = testProvider === ProviderType.Ganache ? ganacheTxDefaults : gethTxDefaults;
-
-const gethConfigs = {
- shouldUseInProcessGanache: false,
- rpcUrl: 'http://localhost:8501',
- shouldUseFakeGasEstimate: false,
-};
-const ganacheConfigs = {
- shouldUseInProcessGanache: true,
-};
-const providerConfigs = testProvider === ProviderType.Ganache ? ganacheConfigs : gethConfigs;
-
-export const provider: Web3ProviderEngine = web3Factory.getRpcProvider(providerConfigs);
-const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage);
-const isProfilerEnabled = env.parseBoolean(EnvVars.SolidityProfiler);
-const isRevertTraceEnabled = env.parseBoolean(EnvVars.SolidityRevertTrace);
-const enabledSubproviderCount = _.filter(
- [isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled],
- _.identity.bind(_),
-).length;
-if (enabledSubproviderCount > 1) {
- throw new Error(`Only one of coverage, profiler, or revert trace subproviders can be enabled at a time`);
-}
-if (isCoverageEnabled) {
- const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
- prependSubprovider(provider, coverageSubprovider);
-}
-if (isProfilerEnabled) {
- if (testProvider === ProviderType.Ganache) {
- logUtils.warn(
- "Gas costs in Ganache traces are incorrect and we don't recommend using it for profiling. Please switch to Geth",
- );
- process.exit(1);
- }
- const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
- logUtils.log(
- "By default profilerSubprovider is stopped so that you don't get noise from setup code. Don't forget to start it before the code you want to profile and stop it afterwards",
- );
- profilerSubprovider.stop();
- prependSubprovider(provider, profilerSubprovider);
-}
-if (isRevertTraceEnabled) {
- const revertTraceSubprovider = revertTrace.getRevertTraceSubproviderSingleton();
- prependSubprovider(provider, revertTraceSubprovider);
-}
-
-export const web3Wrapper = new Web3Wrapper(provider);
diff --git a/packages/contracts/test/utils_test/test_with_reference.ts b/packages/contracts/test/utils_test/test_with_reference.ts
deleted file mode 100644
index 8d633cd1f..000000000
--- a/packages/contracts/test/utils_test/test_with_reference.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import * as chai from 'chai';
-
-import { chaiSetup } from '../utils/chai_setup';
-import { testWithReferenceFuncAsync } from '../utils/test_with_reference';
-
-chaiSetup.configure();
-const expect = chai.expect;
-
-async function divAsync(x: number, y: number): Promise<number> {
- if (y === 0) {
- throw new Error('MathError: divide by zero');
- }
- return x / y;
-}
-
-// returns an async function that always returns the given value.
-function alwaysValueFunc(value: number): (x: number, y: number) => Promise<number> {
- return async (x: number, y: number) => value;
-}
-
-// returns an async function which always throws/rejects with the given error
-// message.
-function alwaysFailFunc(errMessage: string): (x: number, y: number) => Promise<number> {
- return async (x: number, y: number) => {
- throw new Error(errMessage);
- };
-}
-
-describe('testWithReferenceFuncAsync', () => {
- it('passes when both succeed and actual === expected', async () => {
- await testWithReferenceFuncAsync(alwaysValueFunc(0.5), divAsync, [1, 2]);
- });
-
- it('passes when both fail and actual error contains expected error', async () => {
- await testWithReferenceFuncAsync(alwaysFailFunc('divide by zero'), divAsync, [1, 0]);
- });
-
- it('fails when both succeed and actual !== expected', async () => {
- expect(testWithReferenceFuncAsync(alwaysValueFunc(3), divAsync, [1, 2])).to.be.rejectedWith(
- 'Test case {"x":1,"y":2}: expected { value: 0.5 } to deeply equal { value: 3 }',
- );
- });
-
- it('fails when both fail and actual error does not contain expected error', async () => {
- expect(
- testWithReferenceFuncAsync(alwaysFailFunc('Unexpected math error'), divAsync, [1, 0]),
- ).to.be.rejectedWith(
- 'MathError: divide by zero\n\tTest case: {"x":1,"y":0}: expected \'MathError: divide by zero\' to include \'Unexpected math error\'',
- );
- });
-
- it('fails when referenceFunc succeeds and testFunc fails', async () => {
- expect(testWithReferenceFuncAsync(alwaysValueFunc(0), divAsync, [1, 0])).to.be.rejectedWith(
- 'Test case {"x":1,"y":0}: expected { error: \'MathError: divide by zero\' } to deeply equal { value: 0 }',
- );
- });
-
- it('fails when referenceFunc fails and testFunc succeeds', async () => {
- expect(testWithReferenceFuncAsync(alwaysFailFunc('divide by zero'), divAsync, [1, 2])).to.be.rejectedWith(
- 'Expected error containing divide by zero but got no error\n\tTest case: {"x":1,"y":2}',
- );
- });
-});
diff --git a/packages/contracts/tsconfig.json b/packages/contracts/tsconfig.json
deleted file mode 100644
index 8b29365cc..000000000
--- a/packages/contracts/tsconfig.json
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "lib",
- "rootDir": ".",
- "resolveJsonModule": true
- },
- "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
- "files": [
- "./generated-artifacts/AssetProxyOwner.json",
- "./generated-artifacts/DummyERC20Token.json",
- "./generated-artifacts/DummyERC721Receiver.json",
- "./generated-artifacts/DummyERC721Token.json",
- "./generated-artifacts/DummyMultipleReturnERC20Token.json",
- "./generated-artifacts/DummyNoReturnERC20Token.json",
- "./generated-artifacts/ERC20Proxy.json",
- "./generated-artifacts/ERC20Token.json",
- "./generated-artifacts/ERC721Proxy.json",
- "./generated-artifacts/ERC721Token.json",
- "./generated-artifacts/Exchange.json",
- "./generated-artifacts/ExchangeWrapper.json",
- "./generated-artifacts/Forwarder.json",
- "./generated-artifacts/IAssetData.json",
- "./generated-artifacts/IAssetProxy.json",
- "./generated-artifacts/IValidator.json",
- "./generated-artifacts/IWallet.json",
- "./generated-artifacts/InvalidERC721Receiver.json",
- "./generated-artifacts/MixinAuthorizable.json",
- "./generated-artifacts/MultiSigWallet.json",
- "./generated-artifacts/MultiSigWalletWithTimeLock.json",
- "./generated-artifacts/OrderValidator.json",
- "./generated-artifacts/ReentrantERC20Token.json",
- "./generated-artifacts/TestAssetProxyDispatcher.json",
- "./generated-artifacts/TestAssetProxyOwner.json",
- "./generated-artifacts/TestConstants.json",
- "./generated-artifacts/TestExchangeInternals.json",
- "./generated-artifacts/TestLibBytes.json",
- "./generated-artifacts/TestLibs.json",
- "./generated-artifacts/TestSignatureValidator.json",
- "./generated-artifacts/TestStaticCallReceiver.json",
- "./generated-artifacts/Validator.json",
- "./generated-artifacts/WETH9.json",
- "./generated-artifacts/Wallet.json",
- "./generated-artifacts/Whitelist.json",
- "./generated-artifacts/ZRXToken.json"
- ],
- "exclude": ["./deploy/solc/solc_bin"]
-}
diff --git a/packages/dev-tools-pages/package.json b/packages/dev-tools-pages/package.json
index 87ed562ae..3ea27719d 100644
--- a/packages/dev-tools-pages/package.json
+++ b/packages/dev-tools-pages/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/dev-tools-pages",
- "version": "0.0.6",
+ "version": "0.0.10",
"engines": {
"node": ">=6.12"
},
@@ -16,8 +16,7 @@
},
"license": "Apache-2.0",
"dependencies": {
- "@0x/react-shared": "^1.0.21",
- "@0xproject/react-shared": "^1.0.15",
+ "@0x/react-shared": "^1.0.25",
"basscss": "^8.0.3",
"bowser": "^1.9.3",
"highlight.js": "^9.13.1",
diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json
index d6cdd1c5a..b6cc74ce7 100644
--- a/packages/dev-utils/CHANGELOG.json
+++ b/packages/dev-utils/CHANGELOG.json
@@ -1,5 +1,41 @@
[
{
+ "version": "1.0.21",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.20",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "1.0.19",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "1.0.18",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "1.0.17",
"changes": [
diff --git a/packages/dev-utils/CHANGELOG.md b/packages/dev-utils/CHANGELOG.md
index 4becadf81..9a55e4e58 100644
--- a/packages/dev-utils/CHANGELOG.md
+++ b/packages/dev-utils/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.21 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.20 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v1.0.19 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v1.0.18 - _November 21, 2018_
+
+ * Dependencies updated
+
## v1.0.17 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/dev-utils/README.md b/packages/dev-utils/README.md
index 73b0b8816..b85159dd8 100644
--- a/packages/dev-utils/README.md
+++ b/packages/dev-utils/README.md
@@ -27,6 +27,21 @@ If your project is in [TypeScript](https://www.typescriptlang.org/), add the fol
}
```
+## Troubleshooting
+
+If you are still seeing TS type errors complaining about missing DOM types such as `Response`:
+
+```
+error TS2304: Cannot find name 'Response'.
+```
+
+Then you need to explicitly add the `dom` lib to your compiler options in `tsconfig.json`. The `dom` library is included by default, but customizing the `lib` option can cause it to be dropped.
+
+```
+"compilerOptions": {
+ "lib": [..., "dom"],
+```
+
## Contributing
We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json
index 3db391131..a3eb4651a 100644
--- a/packages/dev-utils/package.json
+++ b/packages/dev-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/dev-utils",
- "version": "1.0.17",
+ "version": "1.0.21",
"engines": {
"node": ">=6.12"
},
@@ -29,7 +29,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/dev-utils/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"make-promises-safe": "^1.1.0",
@@ -41,14 +41,14 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/subproviders": "^2.1.4",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/web3-provider-engine": "^14.0.0",
"chai": "^4.0.1",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},
"publishConfig": {
diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts
index b22bcc88b..5f8981a46 100644
--- a/packages/dev-utils/src/web3_factory.ts
+++ b/packages/dev-utils/src/web3_factory.ts
@@ -17,6 +17,7 @@ export interface Web3Config {
shouldThrowErrorsOnGanacheRPCResponse?: boolean; // default: true
rpcUrl?: string; // default: localhost:8545
shouldUseFakeGasEstimate?: boolean; // default: true
+ ganacheDatabasePath?: string; // default: undefined, creates a tmp dir
}
export const web3Factory = {
@@ -45,9 +46,14 @@ export const web3Factory = {
const shouldThrowErrorsOnGanacheRPCResponse =
_.isUndefined(config.shouldThrowErrorsOnGanacheRPCResponse) ||
config.shouldThrowErrorsOnGanacheRPCResponse;
+ if (!_.isUndefined(config.ganacheDatabasePath)) {
+ // Saving the snapshot to a local db. Ganache requires this directory to exist
+ fs.mkdirSync(config.ganacheDatabasePath);
+ }
provider.addProvider(
new GanacheSubprovider({
vmErrorsOnRPCResponse: shouldThrowErrorsOnGanacheRPCResponse,
+ db_path: config.ganacheDatabasePath,
gasLimit: constants.GAS_LIMIT,
logger,
verbose: env.parseBoolean(EnvVars.VerboseGanache),
diff --git a/packages/ethereum-types/CHANGELOG.json b/packages/ethereum-types/CHANGELOG.json
index 9db75ae9f..9a0f2ad49 100644
--- a/packages/ethereum-types/CHANGELOG.json
+++ b/packages/ethereum-types/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "1.1.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.1.3",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"version": "1.1.2",
"changes": [
{
diff --git a/packages/ethereum-types/CHANGELOG.md b/packages/ethereum-types/CHANGELOG.md
index 6ad7b4cc6..1d27757f3 100644
--- a/packages/ethereum-types/CHANGELOG.md
+++ b/packages/ethereum-types/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.1.4 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.1.3 - _December 11, 2018_
+
+ * Dependencies updated
+
## v1.1.2 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json
index 1630344db..69ae64c2b 100644
--- a/packages/ethereum-types/package.json
+++ b/packages/ethereum-types/package.json
@@ -1,6 +1,6 @@
{
"name": "ethereum-types",
- "version": "1.1.2",
+ "version": "1.1.4",
"engines": {
"node": ">=6.12"
},
@@ -29,7 +29,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/ethereum-types/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
"tslint": "5.11.0",
diff --git a/packages/ethereum-types/src/index.ts b/packages/ethereum-types/src/index.ts
index eff38711a..9430fdc98 100644
--- a/packages/ethereum-types/src/index.ts
+++ b/packages/ethereum-types/src/index.ts
@@ -283,6 +283,11 @@ export interface RawLogEntry {
export enum SolidityTypes {
Address = 'address',
+ Bool = 'bool',
+ Bytes = 'bytes',
+ Int = 'int',
+ String = 'string',
+ Tuple = 'tuple',
Uint256 = 'uint256',
Uint8 = 'uint8',
Uint = 'uint',
diff --git a/packages/fill-scenarios/CHANGELOG.json b/packages/fill-scenarios/CHANGELOG.json
index deeae5f5d..2c3e261cb 100644
--- a/packages/fill-scenarios/CHANGELOG.json
+++ b/packages/fill-scenarios/CHANGELOG.json
@@ -1,5 +1,50 @@
[
{
+ "version": "1.1.0",
+ "changes": [
+ {
+ "note": "Add support for MultiAssetProxy",
+ "pr": 1363
+ }
+ ]
+ },
+ {
+ "version": "1.0.16",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.15",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "1.0.14",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "1.0.13",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "1.0.12",
"changes": [
diff --git a/packages/fill-scenarios/CHANGELOG.md b/packages/fill-scenarios/CHANGELOG.md
index c8bd402de..e9b88547d 100644
--- a/packages/fill-scenarios/CHANGELOG.md
+++ b/packages/fill-scenarios/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.16 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.15 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v1.0.14 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v1.0.13 - _November 21, 2018_
+
+ * Dependencies updated
+
## v1.0.12 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json
index 2d9bff0e7..7a9d21e0a 100644
--- a/packages/fill-scenarios/package.json
+++ b/packages/fill-scenarios/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/fill-scenarios",
- "version": "1.0.12",
+ "version": "1.0.16",
"description": "0x order fill scenario generator",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@@ -20,7 +20,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/fill-scenarios/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
@@ -28,15 +28,15 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^1.0.5",
- "@0x/base-contract": "^3.0.6",
- "@0x/contract-artifacts": "^1.1.0",
- "@0x/order-utils": "^3.0.2",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
- "ethereum-types": "^1.1.2",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contract-artifacts": "^1.1.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5"
},
diff --git a/packages/fill-scenarios/src/fill_scenarios.ts b/packages/fill-scenarios/src/fill_scenarios.ts
index 0154bcd0a..ce1f7f9ff 100644
--- a/packages/fill-scenarios/src/fill_scenarios.ts
+++ b/packages/fill-scenarios/src/fill_scenarios.ts
@@ -2,7 +2,7 @@ import { DummyERC20TokenContract, DummyERC721TokenContract, ExchangeContract } f
import * as artifacts from '@0x/contract-artifacts';
import { assetDataUtils } from '@0x/order-utils';
import { orderFactory } from '@0x/order-utils/lib/src/order_factory';
-import { AssetProxyId, ERC721AssetData, OrderWithoutExchangeAddress, SignedOrder } from '@0x/types';
+import { OrderWithoutExchangeAddress, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
@@ -150,39 +150,8 @@ export class FillScenarios {
feeRecipientAddress: string,
expirationTimeSeconds?: BigNumber,
): Promise<SignedOrder> {
- const decodedMakerAssetData = assetDataUtils.decodeAssetDataOrThrow(makerAssetData);
- if (decodedMakerAssetData.assetProxyId === AssetProxyId.ERC20) {
- await this._increaseERC20BalanceAndAllowanceAsync(
- decodedMakerAssetData.tokenAddress,
- makerAddress,
- makerFillableAmount,
- );
- } else {
- if (!makerFillableAmount.equals(1)) {
- throw new Error(`ERC721 makerFillableAmount should be equal 1. Found: ${makerFillableAmount}`);
- }
- await this._increaseERC721BalanceAndAllowanceAsync(
- decodedMakerAssetData.tokenAddress,
- makerAddress,
- // tslint:disable-next-line:no-unnecessary-type-assertion
- (decodedMakerAssetData as ERC721AssetData).tokenId,
- );
- }
- const decodedTakerAssetData = assetDataUtils.decodeAssetDataOrThrow(takerAssetData);
- if (decodedTakerAssetData.assetProxyId === AssetProxyId.ERC20) {
- const takerTokenAddress = decodedTakerAssetData.tokenAddress;
- await this._increaseERC20BalanceAndAllowanceAsync(takerTokenAddress, takerAddress, takerFillableAmount);
- } else {
- if (!takerFillableAmount.equals(1)) {
- throw new Error(`ERC721 takerFillableAmount should be equal 1. Found: ${takerFillableAmount}`);
- }
- await this._increaseERC721BalanceAndAllowanceAsync(
- decodedTakerAssetData.tokenAddress,
- takerAddress,
- // tslint:disable-next-line:no-unnecessary-type-assertion
- (decodedMakerAssetData as ERC721AssetData).tokenId,
- );
- }
+ await this._increaseBalanceAndAllowanceWithAssetDataAsync(makerAssetData, makerAddress, makerFillableAmount);
+ await this._increaseBalanceAndAllowanceWithAssetDataAsync(takerAssetData, takerAddress, takerFillableAmount);
// Fees
await Promise.all([
this._increaseERC20BalanceAndAllowanceAsync(this._zrxTokenAddress, makerAddress, makerFee),
@@ -298,4 +267,30 @@ export class FillScenarios {
});
await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
}
+ private async _increaseBalanceAndAllowanceWithAssetDataAsync(
+ assetData: string,
+ userAddress: string,
+ amount: BigNumber,
+ ): Promise<void> {
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
+ if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
+ await this._increaseERC20BalanceAndAllowanceAsync(decodedAssetData.tokenAddress, userAddress, amount);
+ } else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
+ await this._increaseERC721BalanceAndAllowanceAsync(
+ decodedAssetData.tokenAddress,
+ userAddress,
+ decodedAssetData.tokenId,
+ );
+ } else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
+ for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
+ const amountsElement = decodedAssetData.amounts[index];
+ const totalAmount = amount.times(amountsElement);
+ await this._increaseBalanceAndAllowanceWithAssetDataAsync(
+ nestedAssetDataElement,
+ userAddress,
+ totalAmount,
+ );
+ }
+ }
+ }
}
diff --git a/packages/instant/.DS_Store b/packages/instant/.DS_Store
new file mode 100644
index 000000000..c86c5cbcd
--- /dev/null
+++ b/packages/instant/.DS_Store
Binary files differ
diff --git a/packages/instant/.dogfood.discharge.json b/packages/instant/.dogfood.discharge.json
index ca36b3861..651b3daa6 100644
--- a/packages/instant/.dogfood.discharge.json
+++ b/packages/instant/.dogfood.discharge.json
@@ -1,12 +1,12 @@
{
"domain": "0x-instant-dogfood",
- "build_command": "WEBPACK_OUTPUT_PATH=public yarn build:umd:prod",
+ "build_command": "WEBPACK_OUTPUT_PATH=public dotenv yarn build -- --env.discharge_target=dogfood",
"upload_directory": "public",
"index_key": "index.html",
"error_key": "index.html",
"trailing_slashes": true,
"cache": 3600,
- "aws_profile": "default",
+ "aws_profile": "0xproject",
"aws_region": "us-east-1",
"cdn": false,
"dns_configured": true
diff --git a/packages/instant/.env_example b/packages/instant/.env_example
new file mode 100644
index 000000000..234e64bbe
--- /dev/null
+++ b/packages/instant/.env_example
@@ -0,0 +1,7 @@
+INSTANT_ROLLBAR_PUBLISH_TOKEN=
+INSTANT_ROLLBAR_CLIENT_TOKEN=
+INSTANT_HEAP_ANALYTICS_ID_PRODUCTION=
+INSTANT_HEAP_ANALYTICS_ID_DEVELOPMENT=
+# if you want to report to heap or rollbar when building in development mode, you can use the following:
+# INSTANT_HEAP_FORCE_DEVELOPMENT=true
+# INSTANT_ROLLBAR_FORCE_DEVELOPMENT=true \ No newline at end of file
diff --git a/packages/instant/.gitignore b/packages/instant/.gitignore
index a99cea187..2e65f192d 100644
--- a/packages/instant/.gitignore
+++ b/packages/instant/.gitignore
@@ -1,3 +1,4 @@
public/instant.js
public/instant.js.map
-umd/* \ No newline at end of file
+umd/*
+.env \ No newline at end of file
diff --git a/packages/instant/.npmignore b/packages/instant/.npmignore
index 579d65af0..563923652 100644
--- a/packages/instant/.npmignore
+++ b/packages/instant/.npmignore
@@ -1,5 +1,6 @@
.*
*
*/
-!lib/src/**/*
-!umd/**/* \ No newline at end of file
+!lib/**/*
+!umd/**/*
+.env \ No newline at end of file
diff --git a/packages/instant/.production.discharge.json b/packages/instant/.production.discharge.json
new file mode 100644
index 000000000..c87f8b187
--- /dev/null
+++ b/packages/instant/.production.discharge.json
@@ -0,0 +1,13 @@
+{
+ "domain": "instant.0x.org",
+ "build_command": "dotenv yarn build -- --env.discharge_target=production",
+ "upload_directory": "umd",
+ "index_key": "instant.js",
+ "error_key": "404.html",
+ "trailing_slashes": true,
+ "cache": 3600,
+ "aws_profile": "0xproject",
+ "aws_region": "us-east-1",
+ "cdn": true,
+ "dns_configured": true
+}
diff --git a/packages/instant/.staging.discharge.json b/packages/instant/.staging.discharge.json
index c917a650b..844e3ca4e 100644
--- a/packages/instant/.staging.discharge.json
+++ b/packages/instant/.staging.discharge.json
@@ -1,12 +1,12 @@
{
"domain": "0x-instant-staging",
- "build_command": "WEBPACK_OUTPUT_PATH=public yarn build:umd:prod",
+ "build_command": "WEBPACK_OUTPUT_PATH=public dotenv yarn build -- --env.discharge_target=staging",
"upload_directory": "public",
"index_key": "index.html",
"error_key": "index.html",
"trailing_slashes": true,
"cache": 3600,
- "aws_profile": "default",
+ "aws_profile": "0xproject",
"aws_region": "us-east-1",
"cdn": false,
"dns_configured": true
diff --git a/packages/instant/CHANGELOG.json b/packages/instant/CHANGELOG.json
index fe51488c7..db187140f 100644
--- a/packages/instant/CHANGELOG.json
+++ b/packages/instant/CHANGELOG.json
@@ -1 +1,11 @@
-[]
+[
+ {
+ "timestamp": 1542821676,
+ "version": "1.0.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ }
+]
diff --git a/packages/instant/CHANGELOG.md b/packages/instant/CHANGELOG.md
index 8b1378917..c8be0c644 100644
--- a/packages/instant/CHANGELOG.md
+++ b/packages/instant/CHANGELOG.md
@@ -1 +1,10 @@
+<!--
+changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+CHANGELOG
+
+## v1.0.1 - _November 21, 2018_
+
+ * Dependencies updated
diff --git a/packages/instant/README.md b/packages/instant/README.md
index b83a10508..32abf76e0 100644
--- a/packages/instant/README.md
+++ b/packages/instant/README.md
@@ -1,40 +1,18 @@
## @0x/instant
-## Installation
-
-```bash
-yarn add @0x/instant
-```
-
-**Import**
+## Integration
-**CommonJS module**
-
-```typescript
-import { ZeroExInstant } from '@0x/instant';
-```
-
-or
-
-```javascript
-var ZeroExInstant = require('@0x/instant').ZeroExInstant;
-```
+Looking to integrate 0x Instant into your web application or site? Check out the dedicated [instant documentation](https://0xproject.com/wiki#Get-Started-With-Instant) to get started. The documentation covers instant and related topics in depth. For a more "drag and drop" experience, check out our [configurator tool](https://0xproject.com/instant#configure). For on demand developer support, join our [Discord](https://discordapp.com/invite/d3FTX3M).
-If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`:
+Check out a live sample integration [here](https://www.rexrelay.com/instant).
-```json
-"compilerOptions": {
- "typeRoots": ["node_modules/@0x/typescript-typings/types", "node_modules/@types"],
-}
-```
-
-**UMD Module**
+## Installation
-The package is also available as a UMD module named `zeroExInstant`.
+The package is available as a UMD module named `zeroExInstant` at https://instant.0xproject.com/instant.js.
```html
<head>
- <script type="text/javascript" src="[zeroExInstantUMDPath]" charset="utf-8"></script>
+ <script type="text/javascript" src="https://instant.0xproject.com/instant.js" charset="utf-8"></script>
</head>
<body>
<div id="zeroExInstantContainer"></div>
@@ -48,23 +26,33 @@ The package is also available as a UMD module named `zeroExInstant`.
## Deploying
-You can deploy a work-in-progress version of 0x Instant at http://0x-instant-dogfood.s3-website-us-east-1.amazonaws.com for easy sharing.
+To run any of the following commands you need to configure your `.env` file. There is an example `.env_example` file to show you what values are required.
-To build and deploy the site run
+You can deploy a work-in-progress version of 0x Instant at http://0x-instant-dogfood.s3-website-us-east-1.amazonaws.com/instant.js for easy sharing.
+
+To build and deploy the bundle run
```
yarn deploy_dogfood
```
-We also have a staging bucket that is to be updated less frequently can be used to share instant externally: http://0x-instant-staging.s3-website-us-east-1.amazonaws.com/
+We also have a staging bucket that is to be updated less frequently can be used to share a beta version of instant externally: http://0x-instant-staging.s3-website-us-east-1.amazonaws.com/instant.js
-To build and deploy to this bucket, run
+To build and deploy to this bundle, run
```
yarn deploy_staging
```
-**NOTE: On deploying the site, it will say the site is available at a non-existent URL. Please ignore and use the (now updated) URL above.**
+Finally, we have our live production bundle that is only meant to be updated with stable, polished releases: https://instant.0xproject.com/instant.js
+
+To build and deploy to this bundle, run
+
+```
+yarn deploy_production
+```
+
+**NOTE: On deploying the site to staging and dogfood, it will say the site is available at a non-existent URL. Please ignore and use the (now updated) URL above.**
## Contributing
diff --git a/packages/instant/package.json b/packages/instant/package.json
index 1813d61e5..0a5e152ca 100644
--- a/packages/instant/package.json
+++ b/packages/instant/package.json
@@ -1,21 +1,16 @@
{
"name": "@0x/instant",
- "version": "1.0.0",
+ "version": "1.0.4",
"engines": {
"node": ">=6.12"
},
- "description": "0x Instant React Component",
"private": true,
- "main": "lib/src/index.js",
- "types": "lib/src/index.d.ts",
+ "description": "0x Instant React Component",
+ "main": "umd/instant.js",
"scripts": {
- "build": "yarn build:all",
- "build:all": "run-p build:umd:prod build:commonjs",
- "build:umd:prod": "webpack --mode production",
- "build:commonjs": "tsc -b",
+ "build": "webpack --mode production",
"build:ci": "yarn build",
- "watch_without_deps": "tsc -w",
- "dev": "webpack-dev-server --mode development",
+ "dev": "dotenv webpack-dev-server -- --mode development",
"lint": "tslint --format stylish --project .",
"test": "jest",
"test:coverage": "jest --coverage",
@@ -24,6 +19,7 @@
"clean": "shx rm -rf lib coverage scripts",
"deploy_dogfood": "discharge deploy -c .dogfood.discharge.json",
"deploy_staging": "discharge deploy -c .staging.discharge.json",
+ "deploy_production": "discharge deploy -c .production.discharge.json",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
},
"config": {
@@ -45,18 +41,18 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/instant/README.md",
"dependencies": {
- "@0x/assert": "^1.0.17",
- "@0x/asset-buyer": "^3.0.0",
- "@0x/json-schemas": "^2.1.1",
- "@0x/order-utils": "^3.0.2",
- "@0x/subproviders": "^2.1.4",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/assert": "^1.0.20",
+ "@0x/asset-buyer": "^3.0.4",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"bowser": "^1.9.4",
"copy-to-clipboard": "^3.0.8",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"lodash": "^4.17.5",
"polished": "^2.2.0",
"react": "^16.5.2",
@@ -64,11 +60,12 @@
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-devtools-extension": "^2.13.5",
+ "rollbar": "^2.5.0",
"styled-components": "^4.0.2",
"ts-optchain": "^0.1.1"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@static/discharge": "https://github.com/0xProject/discharge.git",
"@types/enzyme": "^3.1.14",
"@types/enzyme-adapter-react-16": "^1.0.3",
@@ -81,6 +78,7 @@
"@types/redux": "^3.6.0",
"@types/styled-components": "^4.0.1",
"awesome-typescript-loader": "^5.2.1",
+ "dotenv-cli": "^1.4.0",
"enzyme": "^3.6.0",
"enzyme-adapter-react-16": "^1.5.0",
"ip": "^1.1.5",
@@ -88,7 +86,9 @@
"make-promises-safe": "^1.1.0",
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
+ "rollbar-sourcemap-webpack-plugin": "^2.4.0",
"shx": "^0.2.2",
+ "source-map-loader": "^0.2.4",
"svg-react-loader": "^0.4.6",
"ts-jest": "^23.10.3",
"tslint": "5.11.0",
diff --git a/packages/instant/public/external.css b/packages/instant/public/external.css
index cab11112a..21278577e 100644
--- a/packages/instant/public/external.css
+++ b/packages/instant/public/external.css
@@ -15,6 +15,10 @@ input {
height: 100px;
}
+input::-webkit-input-placeholder {
+ color: #b4b4b4 !important;
+}
+
div {
padding: 3px;
}
diff --git a/packages/instant/public/index.html b/packages/instant/public/index.html
index 253cbb194..d10618c58 100644
--- a/packages/instant/public/index.html
+++ b/packages/instant/public/index.html
@@ -1,137 +1,207 @@
<!DOCTYPE html>
<html>
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>0x Instant Dev Environment</title>
+ <link rel="stylesheet" href="/external.css" />
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css" />
+ <script type="text/javascript" src="/instant.js" charset="utf-8"></script>
+ <script type="text/javascript" src="https://unpkg.com/jsuri@1.3.1/Uri.js" charset="utf-8"></script>
+ <script type="text/javascript" src="https://unpkg.com/bignumber.js@4.1.0/bignumber.js" charset="utf-8"></script>
+ <style>
+ .flex-center {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 100%;
+ width: 100%;
+ }
-<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>0x Instant Dev Environment</title>
- <link rel="stylesheet" href="/external.css">
- <script type="text/javascript" src="/instant.js" charset="utf-8"></script>
- <script type="text/javascript" src="https://unpkg.com/jsuri@1.3.1/Uri.js" charset="utf-8"></script>
- <script type="text/javascript" src="https://unpkg.com/bignumber.js@4.1.0/bignumber.js" charset="utf-8"></script>
- <style>
- #zeroExInstantContainer {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100vh;
- }
+ .flex-center--column {
+ flex-direction: column;
+ }
- body {
- margin: 0;
- background-color: rgba(0, 0, 0, 0.2);
- }
- </style>
-</head>
+ .button {
+ margin: 10px;
+ }
-<body>
- <div id="zeroExInstantContainer"></div>
- <script>
- const removeUndefined = (obj) => {
- for (let k in obj) if (obj[k] === undefined) delete obj[k];
- return obj;
- }
- BigNumber.config({
- EXPONENTIAL_AT: 1000,
- DECIMAL_PLACES: 78,
- });
- const providedOrders = [
- // Order selling REP
- {
- senderAddress: '0x0000000000000000000000000000000000000000',
- makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
- takerAddress: '0x0000000000000000000000000000000000000000',
- makerFee: new BigNumber('0'),
- takerFee: new BigNumber('0'),
- makerAssetAmount: new BigNumber('200000000000000000000'),
- takerAssetAmount: new BigNumber('10000000000000000000'),
- makerAssetData: '0xf47261b00000000000000000000000008cb3971b8eb709c14616bd556ff6683019e90d9c',
- takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
- expirationTimeSeconds: new BigNumber('1601535600'),
- feeRecipientAddress: '0x0000000000000000000000000000000000000000',
- salt: new BigNumber('3101985707338942582579795423923841749956600670712030922928319824580764688653'),
- signature: '0x1bd4d5686fea801fe33c68c4944356085e7e6cb553eb7073160abd815609f714e85fb47f44b7ffd0a2a1321ac40d72d55163869d0a50fdb5a402132150fe33a08403',
- exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2'
- },
- // Order selling ZRX
- {
- senderAddress: '0x0000000000000000000000000000000000000000',
- makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
- takerAddress: '0x0000000000000000000000000000000000000000',
- makerFee: new BigNumber('0'),
- takerFee: new BigNumber('0'),
- makerAssetAmount: new BigNumber('300000000000000000000'),
- takerAssetAmount: new BigNumber('31000000000000000000'),
- makerAssetData: '0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa',
- takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
- expirationTimeSeconds: new BigNumber('2524636800'),
- feeRecipientAddress: '0x0000000000000000000000000000000000000000',
- salt: new BigNumber('64592004666704945574675477805199411288137454783320798602050822322450089238268'),
- signature: '0x1c13cacddca8d7d8248e91f412377e68f8f1f9891a59a6c1b2eea9f7b33558c30c4fb86a448e08ab7def40a28fb3a3062dcb33bb3c45302447fce5c4288b7c7f5b03',
- exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2'
- },
- // Order selling GNT
- {
- senderAddress: '0x0000000000000000000000000000000000000000',
- makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
- takerAddress: '0x0000000000000000000000000000000000000000',
- makerFee: new BigNumber('0'),
- takerFee: new BigNumber('0'),
- makerAssetAmount: new BigNumber('250000000000000000000'),
- takerAssetAmount: new BigNumber('10000000000000000000'),
- makerAssetData: '0xf47261b000000000000000000000000031fb614e223706f15d0d3c5f4b08bdf0d5c78623',
- takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
- expirationTimeSeconds: new BigNumber('1601535600'),
- feeRecipientAddress: '0x0000000000000000000000000000000000000000',
- salt: new BigNumber('40204378562212615907903051460421336779451270522691667164301816101569427926606'),
- signature: '0x1c788bf4b93769da1e8f195f52f0f59b4a298ac6da30cf6d05a87ed4be5ee974f61352ed1bc6a0844d0962b8c894c9ca08e452431255958a4e98dd93cbe1fbc73803',
- exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2'
- },
- // Order selling MKR
- {
- senderAddress: '0x0000000000000000000000000000000000000000',
- makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
- takerAddress: '0x0000000000000000000000000000000000000000',
- makerFee: new BigNumber('0'),
- takerFee: new BigNumber('0'),
- makerAssetAmount: new BigNumber('200000000000000000000'),
- takerAssetAmount: new BigNumber('5000000000000000000'),
- makerAssetData: '0xf47261b00000000000000000000000007b6b10caa9e8e9552ba72638ea5b47c25afea1f3',
- takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
- expirationTimeSeconds: new BigNumber('1601535600'),
- feeRecipientAddress: '0x0000000000000000000000000000000000000000',
- salt: new BigNumber('71338269924068280039932133924198049371838034090153601678083172009862985793828'),
- signature: '0x1bb3151d57ee1e8fa697767ce83ee4ba77d1ceb8cc1e79c7d77126b3687517704c50c6b3d9cb42c7e7d4478d574b297dfbd1626c5c18a7bc9c2a792c4c07f0797c03',
- exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2'
+ body {
+ margin: 0;
+ height: 100vh;
+ background-color: rgba(0, 0, 0, 0.2);
}
- ];
- const queryParams = new Uri(window.location.search);
- const renderOptionsDefaults = {
- orderSource: 'https://api.radarrelay.com/0x/v2/',
- onClose: () => { console.log('0x Instant Closed') }
- }
- const orderSourceOverride = queryParams.getQueryParamValue('orderSource');
- const availableAssetDatasString = queryParams.getQueryParamValue('availableAssetDatas');
- const feeRecipientOverride = queryParams.getQueryParamValue('feeRecipient');
- const feePercentageOverride = +queryParams.getQueryParamValue('feePercentage');
- let affiliateInfoOverride;
- if (feeRecipientOverride !== undefined && feePercentageOverride !== undefined) {
- affiliateInfoOverride = {
- feeRecipient: feeRecipientOverride,
- feePercentage: feePercentageOverride
- };
- }
- const renderOptionsOverrides = {
- orderSource: orderSourceOverride === 'provided' ? providedOrders : orderSourceOverride,
- networkId: +queryParams.getQueryParamValue('networkId') || undefined,
- defaultAssetBuyAmount: +queryParams.getQueryParamValue('defaultAssetBuyAmount') || undefined,
- availableAssetDatas: availableAssetDatasString ? JSON.parse(availableAssetDatasString) : undefined,
- defaultSelectedAssetData: queryParams.getQueryParamValue('defaultSelectedAssetData'),
- affiliateInfo: affiliateInfoOverride,
- }
- const renderOptions = Object.assign({}, renderOptionsDefaults, removeUndefined(renderOptionsOverrides));
- zeroExInstant.render(renderOptions);
- </script>
-</body>
+ </style>
+ </head>
+
+ <body>
+ <div class="flex-center flex-center--column">
+ <div><button class="button is-large" onClick="renderWithUrlDefaults()">Open</button></div>
+ <div>
+ <button
+ class="button is-danger"
+ onClick="renderWithAssetData('0xf47261b00000000000000000000000001985365e9f78359a9b6ad760e32412f4a445e862')"
+ >
+ Buy REP
+ </button>
+ <button
+ class="button is-black"
+ onClick="renderWithAssetData('0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498')"
+ >
+ Buy ZRX
+ </button>
+ <button
+ class="button is-info"
+ onClick="renderWithAssetData('0xf47261b00000000000000000000000006810e776880c02933d47db1b9fc05908e5386b96')"
+ >
+ Buy GNO
+ </button>
+ </div>
+ </div>
+ <div id="zeroExInstantContainer"></div>
+ <script>
+ // Simulate history
+ window.history.pushState({ page: 1 }, '0x Instant');
+ window.history.pushState({ page: 2 }, '0x Instant');
+ window.history.pushState({ page: 3 }, '0x Instant');
+ window.onpopstate = () => console.log("Integrator's onpopstate called");
-</html> \ No newline at end of file
+ const removeUndefined = obj => {
+ for (let k in obj) if (obj[k] === undefined) delete obj[k];
+ return obj;
+ };
+ BigNumber.config({
+ EXPONENTIAL_AT: 1000,
+ DECIMAL_PLACES: 78,
+ });
+ const providedOrders = [
+ // Order selling REP
+ {
+ senderAddress: '0x0000000000000000000000000000000000000000',
+ makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
+ takerAddress: '0x0000000000000000000000000000000000000000',
+ makerFee: new BigNumber('0'),
+ takerFee: new BigNumber('0'),
+ makerAssetAmount: new BigNumber('200000000000000000000'),
+ takerAssetAmount: new BigNumber('10000000000000000000'),
+ makerAssetData: '0xf47261b00000000000000000000000008cb3971b8eb709c14616bd556ff6683019e90d9c',
+ takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
+ expirationTimeSeconds: new BigNumber('1601535600'),
+ feeRecipientAddress: '0x0000000000000000000000000000000000000000',
+ salt: new BigNumber('3101985707338942582579795423923841749956600670712030922928319824580764688653'),
+ signature:
+ '0x1bd4d5686fea801fe33c68c4944356085e7e6cb553eb7073160abd815609f714e85fb47f44b7ffd0a2a1321ac40d72d55163869d0a50fdb5a402132150fe33a08403',
+ exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2',
+ },
+ // Order selling ZRX
+ {
+ senderAddress: '0x0000000000000000000000000000000000000000',
+ makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
+ takerAddress: '0x0000000000000000000000000000000000000000',
+ makerFee: new BigNumber('0'),
+ takerFee: new BigNumber('0'),
+ makerAssetAmount: new BigNumber('300000000000000000000'),
+ takerAssetAmount: new BigNumber('31000000000000000000'),
+ makerAssetData: '0xf47261b00000000000000000000000002002d3812f58e35f0ea1ffbf80a75a38c32175fa',
+ takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
+ expirationTimeSeconds: new BigNumber('2524636800'),
+ feeRecipientAddress: '0x0000000000000000000000000000000000000000',
+ salt: new BigNumber(
+ '64592004666704945574675477805199411288137454783320798602050822322450089238268',
+ ),
+ signature:
+ '0x1c13cacddca8d7d8248e91f412377e68f8f1f9891a59a6c1b2eea9f7b33558c30c4fb86a448e08ab7def40a28fb3a3062dcb33bb3c45302447fce5c4288b7c7f5b03',
+ exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2',
+ },
+ // Order selling GNT
+ {
+ senderAddress: '0x0000000000000000000000000000000000000000',
+ makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
+ takerAddress: '0x0000000000000000000000000000000000000000',
+ makerFee: new BigNumber('0'),
+ takerFee: new BigNumber('0'),
+ makerAssetAmount: new BigNumber('250000000000000000000'),
+ takerAssetAmount: new BigNumber('10000000000000000000'),
+ makerAssetData: '0xf47261b000000000000000000000000031fb614e223706f15d0d3c5f4b08bdf0d5c78623',
+ takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
+ expirationTimeSeconds: new BigNumber('1601535600'),
+ feeRecipientAddress: '0x0000000000000000000000000000000000000000',
+ salt: new BigNumber(
+ '40204378562212615907903051460421336779451270522691667164301816101569427926606',
+ ),
+ signature:
+ '0x1c788bf4b93769da1e8f195f52f0f59b4a298ac6da30cf6d05a87ed4be5ee974f61352ed1bc6a0844d0962b8c894c9ca08e452431255958a4e98dd93cbe1fbc73803',
+ exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2',
+ },
+ // Order selling MKR
+ {
+ senderAddress: '0x0000000000000000000000000000000000000000',
+ makerAddress: '0x34a745008a643eebc58920eaa29fb1165b4a288e',
+ takerAddress: '0x0000000000000000000000000000000000000000',
+ makerFee: new BigNumber('0'),
+ takerFee: new BigNumber('0'),
+ makerAssetAmount: new BigNumber('200000000000000000000'),
+ takerAssetAmount: new BigNumber('5000000000000000000'),
+ makerAssetData: '0xf47261b00000000000000000000000007b6b10caa9e8e9552ba72638ea5b47c25afea1f3',
+ takerAssetData: '0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c',
+ expirationTimeSeconds: new BigNumber('1601535600'),
+ feeRecipientAddress: '0x0000000000000000000000000000000000000000',
+ salt: new BigNumber(
+ '71338269924068280039932133924198049371838034090153601678083172009862985793828',
+ ),
+ signature:
+ '0x1bb3151d57ee1e8fa697767ce83ee4ba77d1ceb8cc1e79c7d77126b3687517704c50c6b3d9cb42c7e7d4478d574b297dfbd1626c5c18a7bc9c2a792c4c07f0797c03',
+ exchangeAddress: '0x35dd2932454449b14cee11a94d3674a936d5d7b2',
+ },
+ ];
+ const getRenderOptionsOverridesFromUrl = () => {
+ const queryParams = new Uri(window.location.search);
+ const orderSourceOverride = queryParams.getQueryParamValue('orderSource');
+ const availableAssetDatasString = queryParams.getQueryParamValue('availableAssetDatas');
+ const feeRecipientOverride = queryParams.getQueryParamValue('feeRecipient');
+ const feePercentageOverride = +queryParams.getQueryParamValue('feePercentage');
+ let affiliateInfoOverride;
+ if (feeRecipientOverride !== undefined && feePercentageOverride !== undefined) {
+ affiliateInfoOverride = {
+ feeRecipient: feeRecipientOverride,
+ feePercentage: feePercentageOverride,
+ };
+ }
+ const renderOptionsOverrides = {
+ orderSource: orderSourceOverride === 'provided' ? providedOrders : orderSourceOverride,
+ networkId: +queryParams.getQueryParamValue('networkId') || undefined,
+ defaultAssetBuyAmount: +queryParams.getQueryParamValue('defaultAssetBuyAmount') || undefined,
+ availableAssetDatas: availableAssetDatasString ? JSON.parse(availableAssetDatasString) : undefined,
+ defaultSelectedAssetData: queryParams.getQueryParamValue('defaultSelectedAssetData'),
+ affiliateInfo: affiliateInfoOverride,
+ shouldDisablePushToHistory: !!queryParams.getQueryParamValue('shouldDisablePushToHistory'),
+ walletDisplayName: queryParams.getQueryParamValue('walletDisplayName') || undefined,
+ };
+ return renderOptionsOverrides;
+ };
+ const render = renderOptionsOverrides => {
+ const renderOptionsDefaults = {
+ orderSource: 'https://api.radarrelay.com/0x/v2/',
+ onClose: () => {
+ console.log('0x Instant Closed');
+ },
+ };
+ const renderOptions = Object.assign({}, renderOptionsDefaults, removeUndefined(renderOptionsOverrides));
+ zeroExInstant.render(renderOptions);
+ };
+ const renderWithUrlDefaults = (renderOptions = {}) => {
+ const finalOptions = {
+ ...getRenderOptionsOverridesFromUrl(),
+ ...renderOptions,
+ };
+ render(finalOptions);
+ };
+ renderWithUrlDefaults();
+ const renderWithAssetData = assetData => {
+ renderWithUrlDefaults({
+ defaultSelectedAssetData: assetData,
+ });
+ };
+ </script>
+ </body>
+</html>
diff --git a/packages/instant/src/assets/icons/zrx.svg b/packages/instant/src/assets/icons/zrx.svg
index 07518f551..da623710b 100644
--- a/packages/instant/src/assets/icons/zrx.svg
+++ b/packages/instant/src/assets/icons/zrx.svg
@@ -1,3 +1,6 @@
-<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path fill-rule="evenodd" clip-rule="evenodd" d="M22.6726 18.5002L22.6787 18.5063L22.625 18.5868C22.641 18.558 22.6569 18.5291 22.6726 18.5002V18.5002H22.6726ZM22.7893 18.5002L21.3866 17.0053L17.9692 12.9131L19.6779 11.0919L17.1249 7.89955L18.8337 6.07835L20.0599 4.74999C20.663 5.26419 21.2058 5.83552 21.6882 6.46394C22.1707 7.09242 22.5828 7.77444 22.9245 8.5101C23.2663 9.2457 23.5309 10.0206 23.7186 10.8347C23.9062 11.6489 24 12.4916 24 13.3628C24 14.3055 23.8928 15.216 23.6784 16.0945C23.4703 16.9468 23.174 17.7487 22.7893 18.5L22.7893 18.5002ZM6.74427 15.3604L8.87512 18.1019L7.20654 19.8795L5.94009 21.2502L5.91999 21.2288C5.3169 20.7291 4.77415 20.1651 4.29169 19.5368C3.80923 18.9086 3.39714 18.2268 3.05539 17.4915C2.71365 16.7562 2.45567 15.9816 2.28144 15.1677C2.09382 14.3539 2 13.5114 2 12.6405C2 11.6981 2.10721 10.7913 2.32164 9.92041C2.53608 9.04943 2.83091 8.24276 3.20615 7.50025L4.61334 8.99943L8.45293 13.54L6.7442 15.3605L6.74427 15.3604ZM7.89849 8.87512L6.12088 7.20654L4.75015 5.94009L4.77157 5.91999C5.27132 5.3169 5.83531 4.77415 6.46352 4.29169C7.09178 3.80923 7.77357 3.39714 8.50886 3.05539C9.2442 2.71365 10.0188 2.45567 10.8326 2.28144C11.6465 2.09382 12.489 2 13.3599 2C14.3023 2 15.209 2.10721 16.08 2.32164C16.9509 2.53608 17.7576 2.83091 18.5001 3.20615L17.0866 4.55302L12.9101 8.0307L11.0896 6.32197L7.89835 8.87496L7.89849 8.87512ZM18.1019 17.1252L19.8795 18.7938L21.2503 20.0602L21.2288 20.0803C20.7291 20.6834 20.1651 21.2262 19.5369 21.7086C18.9086 22.1911 18.2268 22.6032 17.4916 22.9449C16.7562 23.2867 15.9817 23.5447 15.1678 23.7189C14.3539 23.9065 13.5114 24.0003 12.6405 24.0003C11.6981 24.0003 10.7914 23.8931 9.92046 23.6787C9.04952 23.4643 8.2428 23.1694 7.50029 22.7942L8.91381 21.4473L13.54 17.5474L15.3606 19.6782L18.1021 17.1252L18.1019 17.1252Z" fill="white"/>
+<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M4.62099 13.9044L6.3287 12.1375L4.20565 9.27256L1.50251 5.44771C0.547534 7.07749 0 8.97462 0 11C0 14.3552 1.50251 17.3593 3.8722 19.3768L7.30341 16.9518C6.13632 16.2248 5.19614 15.1662 4.62099 13.9044Z" fill="white"/>
+<path d="M8.09561 4.62099L9.86251 6.3287L12.7274 4.20565L16.5523 1.50251C14.9225 0.547534 13.0254 0 11 0C7.64475 0 4.64072 1.50251 2.62323 3.8722L5.04816 7.30341C5.77525 6.13632 6.83381 5.19614 8.09561 4.62099Z" fill="white"/>
+<path d="M15.6713 9.86251L17.7943 12.7274L20.4975 16.5523C21.4525 14.9225 22 13.0254 22 11C22 7.64475 20.4975 4.64072 18.1278 2.62323L14.6966 5.04816C15.8637 5.77525 16.8039 6.83381 17.379 8.09561L15.6713 9.86251Z" fill="white"/>
+<path d="M19.3768 18.1278L16.9518 14.6966C16.2248 15.8637 15.1662 16.8039 13.9044 17.379L12.1375 15.6713L9.27256 17.7943L5.44771 20.4975C7.07749 21.4525 8.97462 22 11 22C14.3552 22 17.3593 20.4975 19.3768 18.1278Z" fill="white"/>
</svg>
diff --git a/packages/instant/src/components/amount_placeholder.tsx b/packages/instant/src/components/amount_placeholder.tsx
index 29ce8fafb..290e34a07 100644
--- a/packages/instant/src/components/amount_placeholder.tsx
+++ b/packages/instant/src/components/amount_placeholder.tsx
@@ -30,3 +30,5 @@ export const AmountPlaceholder: React.StatelessComponent<AmountPlaceholderProps>
return <PlainPlaceholder color={props.color} />;
}
};
+
+AmountPlaceholder.displayName = 'AmountPlaceholder';
diff --git a/packages/instant/src/components/animations/slide_animation.tsx b/packages/instant/src/components/animations/slide_animation.tsx
index 5992bcba7..6ac47e9a6 100644
--- a/packages/instant/src/components/animations/slide_animation.tsx
+++ b/packages/instant/src/components/animations/slide_animation.tsx
@@ -11,6 +11,7 @@ export interface SlideAnimationProps {
slideOutSettings: OptionallyScreenSpecific<PositionAnimationSettings>;
zIndex?: OptionallyScreenSpecific<number>;
height?: string;
+ onAnimationEnd?: () => void;
}
export const SlideAnimation: React.StatelessComponent<SlideAnimationProps> = props => {
@@ -19,8 +20,15 @@ export const SlideAnimation: React.StatelessComponent<SlideAnimationProps> = pro
}
const positionSettings = props.animationState === 'slidIn' ? props.slideInSettings : props.slideOutSettings;
return (
- <PositionAnimation height={props.height} positionSettings={positionSettings} zIndex={props.zIndex}>
+ <PositionAnimation
+ onAnimationEnd={props.onAnimationEnd}
+ height={props.height}
+ positionSettings={positionSettings}
+ zIndex={props.zIndex}
+ >
{props.children}
</PositionAnimation>
);
};
+
+SlideAnimation.displayName = 'SlideAnimation';
diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx
index 8b6121e43..551e857a5 100644
--- a/packages/instant/src/components/buy_button.tsx
+++ b/packages/instant/src/components/buy_button.tsx
@@ -1,4 +1,5 @@
import { AssetBuyer, AssetBuyerError, BuyQuote } from '@0x/asset-buyer';
+import { AssetProxyId } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
@@ -7,7 +8,9 @@ import { oc } from 'ts-optchain';
import { WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX } from '../constants';
import { ColorOption } from '../style/theme';
-import { AffiliateInfo, ZeroExInstantError } from '../types';
+import { AffiliateInfo, Asset, ZeroExInstantError } from '../types';
+import { analytics } from '../util/analytics';
+import { errorReporter } from '../util/error_reporter';
import { gasPriceEstimator } from '../util/gas_price_estimator';
import { util } from '../util/util';
@@ -20,6 +23,7 @@ export interface BuyButtonProps {
assetBuyer: AssetBuyer;
web3Wrapper: Web3Wrapper;
affiliateInfo?: AffiliateInfo;
+ selectedAsset?: Asset;
onValidationPending: (buyQuote: BuyQuote) => void;
onValidationFail: (buyQuote: BuyQuote, errorMessage: AssetBuyerError | ZeroExInstantError) => void;
onSignatureDenied: (buyQuote: BuyQuote) => void;
@@ -28,15 +32,19 @@ export interface BuyButtonProps {
onBuyFailure: (buyQuote: BuyQuote, txHash: string) => void;
}
-export class BuyButton extends React.Component<BuyButtonProps> {
+export class BuyButton extends React.PureComponent<BuyButtonProps> {
public static defaultProps = {
onClick: util.boundNoop,
onBuySuccess: util.boundNoop,
onBuyFailure: util.boundNoop,
};
public render(): React.ReactNode {
- const { buyQuote, accountAddress } = this.props;
+ const { buyQuote, accountAddress, selectedAsset } = this.props;
const shouldDisableButton = _.isUndefined(buyQuote) || _.isUndefined(accountAddress);
+ const buttonText =
+ !_.isUndefined(selectedAsset) && selectedAsset.metaData.assetProxyId === AssetProxyId.ERC20
+ ? `Buy ${selectedAsset.metaData.symbol.toUpperCase()}`
+ : 'Buy Now';
return (
<Button
width="100%"
@@ -44,7 +52,7 @@ export class BuyButton extends React.Component<BuyButtonProps> {
isDisabled={shouldDisableButton}
fontColor={ColorOption.white}
>
- Buy
+ {buttonText}
</Button>
);
}
@@ -59,6 +67,7 @@ export class BuyButton extends React.Component<BuyButtonProps> {
// if we don't have a balance for the user, let the transaction through, it will be handled by the wallet
const hasSufficientEth = _.isUndefined(accountEthBalanceInWei) || accountEthBalanceInWei.gte(ethNeededForBuy);
if (!hasSufficientEth) {
+ analytics.trackBuyNotEnoughEth(buyQuote);
this.props.onValidationFail(buyQuote, ZeroExInstantError.InsufficientETH);
return;
}
@@ -66,6 +75,7 @@ export class BuyButton extends React.Component<BuyButtonProps> {
const gasInfo = await gasPriceEstimator.getGasInfoAsync();
const feeRecipient = oc(affiliateInfo).feeRecipient();
try {
+ analytics.trackBuyStarted(buyQuote);
txHash = await assetBuyer.executeBuyQuoteAsync(buyQuote, {
feeRecipient,
takerAddress: accountAddress,
@@ -73,11 +83,18 @@ export class BuyButton extends React.Component<BuyButtonProps> {
});
} catch (e) {
if (e instanceof Error) {
- if (e.message === AssetBuyerError.SignatureRequestDenied) {
+ if (e.message === AssetBuyerError.TransactionValueTooLow) {
+ analytics.trackBuySimulationFailed(buyQuote);
+ this.props.onValidationFail(buyQuote, AssetBuyerError.TransactionValueTooLow);
+ return;
+ } else if (e.message === AssetBuyerError.SignatureRequestDenied) {
+ analytics.trackBuySignatureDenied(buyQuote);
this.props.onSignatureDenied(buyQuote);
return;
- } else if (e.message === AssetBuyerError.TransactionValueTooLow) {
- this.props.onValidationFail(buyQuote, AssetBuyerError.TransactionValueTooLow);
+ } else {
+ errorReporter.report(e);
+ analytics.trackBuyUnknownError(buyQuote, e.message);
+ this.props.onValidationFail(buyQuote, ZeroExInstantError.CouldNotSubmitTransaction);
return;
}
}
@@ -87,14 +104,17 @@ export class BuyButton extends React.Component<BuyButtonProps> {
const expectedEndTimeUnix = startTimeUnix + gasInfo.estimatedTimeMs;
this.props.onBuyProcessing(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix);
try {
+ analytics.trackBuyTxSubmitted(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix);
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
} catch (e) {
if (e instanceof Error && e.message.startsWith(WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX)) {
+ analytics.trackBuyTxFailed(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix);
this.props.onBuyFailure(buyQuote, txHash);
return;
}
throw e;
}
+ analytics.trackBuyTxSucceeded(buyQuote, txHash, startTimeUnix, expectedEndTimeUnix);
this.props.onBuySuccess(buyQuote, txHash);
};
}
diff --git a/packages/instant/src/components/buy_order_progress.tsx b/packages/instant/src/components/buy_order_progress.tsx
index 6568de91b..11ac5d5e0 100644
--- a/packages/instant/src/components/buy_order_progress.tsx
+++ b/packages/instant/src/components/buy_order_progress.tsx
@@ -21,7 +21,7 @@ export const BuyOrderProgress: React.StatelessComponent<BuyOrderProgressProps> =
const hasEnded = buyOrderState.processState !== OrderProcessState.Processing;
const expectedTimeMs = progress.expectedEndTimeUnix - progress.startTimeUnix;
return (
- <Container padding="20px 20px 0px 20px" width="100%">
+ <Container width="100%" padding="20px 20px 0px 20px">
<Container marginBottom="5px">
<TimeCounter estimatedTimeMs={expectedTimeMs} hasEnded={hasEnded} key={progress.startTimeUnix} />
</Container>
@@ -31,3 +31,5 @@ export const BuyOrderProgress: React.StatelessComponent<BuyOrderProgressProps> =
}
return null;
};
+
+BuyOrderProgress.displayName = 'BuyOrderProgress';
diff --git a/packages/instant/src/components/buy_order_state_buttons.tsx b/packages/instant/src/components/buy_order_state_buttons.tsx
index e563bec73..1214559d1 100644
--- a/packages/instant/src/components/buy_order_state_buttons.tsx
+++ b/packages/instant/src/components/buy_order_state_buttons.tsx
@@ -4,7 +4,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as React from 'react';
import { ColorOption } from '../style/theme';
-import { AffiliateInfo, OrderProcessState, ZeroExInstantError } from '../types';
+import { AffiliateInfo, Asset, OrderProcessState, ZeroExInstantError } from '../types';
import { BuyButton } from './buy_button';
import { PlacingOrderButton } from './placing_order_button';
@@ -21,6 +21,7 @@ export interface BuyOrderStateButtonProps {
assetBuyer: AssetBuyer;
web3Wrapper: Web3Wrapper;
affiliateInfo?: AffiliateInfo;
+ selectedAsset?: Asset;
onViewTransaction: () => void;
onValidationPending: (buyQuote: BuyQuote) => void;
onValidationFail: (buyQuote: BuyQuote, errorMessage: AssetBuyerError | ZeroExInstantError) => void;
@@ -60,6 +61,7 @@ export const BuyOrderStateButtons: React.StatelessComponent<BuyOrderStateButtonP
assetBuyer={props.assetBuyer}
web3Wrapper={props.web3Wrapper}
affiliateInfo={props.affiliateInfo}
+ selectedAsset={props.selectedAsset}
onValidationPending={props.onValidationPending}
onValidationFail={props.onValidationFail}
onSignatureDenied={props.onSignatureDenied}
@@ -69,3 +71,5 @@ export const BuyOrderStateButtons: React.StatelessComponent<BuyOrderStateButtonP
/>
);
};
+
+BuyOrderStateButtons.displayName = 'BuyOrderStateButtons';
diff --git a/packages/instant/src/components/erc20_asset_amount_input.tsx b/packages/instant/src/components/erc20_asset_amount_input.tsx
index b825255c4..0418f9165 100644
--- a/packages/instant/src/components/erc20_asset_amount_input.tsx
+++ b/packages/instant/src/components/erc20_asset_amount_input.tsx
@@ -31,7 +31,7 @@ export interface ERC20AssetAmountInputState {
currentFontSizePx: number;
}
-export class ERC20AssetAmountInput extends React.Component<ERC20AssetAmountInputProps, ERC20AssetAmountInputState> {
+export class ERC20AssetAmountInput extends React.PureComponent<ERC20AssetAmountInputProps, ERC20AssetAmountInputState> {
public static defaultProps = {
onChange: util.boundNoop,
isDisabled: false,
@@ -64,6 +64,9 @@ export class ERC20AssetAmountInput extends React.Component<ERC20AssetAmountInput
maxFontSizePx={this.props.startingFontSizePx}
onAmountChange={this._handleChange}
onFontSizeChange={this._handleFontSizeChange}
+ hasAutofocus={true}
+ /* We send in a key of asset data to force a rerender of this component when the user selects a new asset. We do this so the autofocus attribute will bring focus onto this input */
+ key={asset.assetData}
/>
</Container>
<Container
@@ -110,7 +113,7 @@ export class ERC20AssetAmountInput extends React.Component<ERC20AssetAmountInput
);
};
private readonly _renderChevronIcon = (): React.ReactNode => {
- if (!this._areMultipleAssetsAvailable()) {
+ if (!this._areAnyAssetsAvailable()) {
return null;
}
return (
@@ -131,14 +134,14 @@ export class ERC20AssetAmountInput extends React.Component<ERC20AssetAmountInput
// We don't want to allow opening the token selection panel if there are no assets.
// Since styles are inferred from the presence of a click handler, we want to return undefined
// instead of providing a noop.
- if (!this._areMultipleAssetsAvailable() || _.isUndefined(this.props.onSelectAssetClick)) {
+ if (!this._areAnyAssetsAvailable() || _.isUndefined(this.props.onSelectAssetClick)) {
return undefined;
}
return this._handleSelectAssetClick;
};
- private readonly _areMultipleAssetsAvailable = (): boolean => {
+ private readonly _areAnyAssetsAvailable = (): boolean => {
const { numberOfAssetsAvailable } = this.props;
- return !_.isUndefined(numberOfAssetsAvailable) && numberOfAssetsAvailable > 1;
+ return !_.isUndefined(numberOfAssetsAvailable) && numberOfAssetsAvailable > 0;
};
private readonly _handleSelectAssetClick = (): void => {
if (this.props.onSelectAssetClick) {
diff --git a/packages/instant/src/components/erc20_token_selector.tsx b/packages/instant/src/components/erc20_token_selector.tsx
index 1b1921acb..a26fb5cf5 100644
--- a/packages/instant/src/components/erc20_token_selector.tsx
+++ b/packages/instant/src/components/erc20_token_selector.tsx
@@ -3,10 +3,10 @@ import * as React from 'react';
import { ColorOption } from '../style/theme';
import { ERC20Asset } from '../types';
+import { analytics } from '../util/analytics';
import { assetUtils } from '../util/asset';
import { SearchInput } from './search_input';
-
import { Circle } from './ui/circle';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
@@ -18,15 +18,15 @@ export interface ERC20TokenSelectorProps {
}
export interface ERC20TokenSelectorState {
- searchQuery?: string;
+ searchQuery: string;
}
-export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps> {
+export class ERC20TokenSelector extends React.PureComponent<ERC20TokenSelectorProps> {
public state: ERC20TokenSelectorState = {
- searchQuery: undefined,
+ searchQuery: '',
};
public render(): React.ReactNode {
- const { tokens, onTokenSelect } = this.props;
+ const { tokens } = this.props;
return (
<Container height="100%">
<Container marginBottom="10px">
@@ -42,12 +42,11 @@ export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps>
tabIndex={-1}
/>
<Container overflow="scroll" height="calc(100% - 90px)" marginTop="10px">
- {_.map(tokens, token => {
- if (!this._isTokenQueryMatch(token)) {
- return null;
- }
- return <TokenSelectorRow key={token.assetData} token={token} onClick={onTokenSelect} />;
- })}
+ <TokenRowFilter
+ tokens={tokens}
+ onClick={this._handleTokenClick}
+ searchQuery={this.state.searchQuery}
+ />
</Container>
</Container>
);
@@ -57,13 +56,38 @@ export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps>
this.setState({
searchQuery,
});
+ analytics.trackTokenSelectorSearched(searchQuery);
+ };
+ private readonly _handleTokenClick = (token: ERC20Asset): void => {
+ this.props.onTokenSelect(token);
};
+}
+
+interface TokenRowFilterProps {
+ tokens: ERC20Asset[];
+ onClick: (token: ERC20Asset) => void;
+ searchQuery: string;
+}
+
+class TokenRowFilter extends React.Component<TokenRowFilterProps> {
+ public render(): React.ReactNode {
+ return _.map(this.props.tokens, token => {
+ if (!this._isTokenQueryMatch(token)) {
+ return null;
+ }
+ return <TokenSelectorRow key={token.assetData} token={token} onClick={this.props.onClick} />;
+ });
+ }
+ public shouldComponentUpdate(nextProps: TokenRowFilterProps): boolean {
+ const arePropsDeeplyEqual = _.isEqual(nextProps, this.props);
+ return !arePropsDeeplyEqual;
+ }
private readonly _isTokenQueryMatch = (token: ERC20Asset): boolean => {
- const { searchQuery } = this.state;
- if (_.isUndefined(searchQuery)) {
+ const { searchQuery } = this.props;
+ const searchQueryLowerCase = searchQuery.toLowerCase().trim();
+ if (searchQueryLowerCase === '') {
return true;
}
- const searchQueryLowerCase = searchQuery.toLowerCase();
const tokenName = token.metaData.name.toLowerCase();
const tokenSymbol = token.metaData.symbol.toLowerCase();
return _.startsWith(tokenSymbol, searchQueryLowerCase) || _.startsWith(tokenName, searchQueryLowerCase);
@@ -75,7 +99,7 @@ interface TokenSelectorRowProps {
onClick: (token: ERC20Asset) => void;
}
-class TokenSelectorRow extends React.Component<TokenSelectorRowProps> {
+class TokenSelectorRow extends React.PureComponent<TokenSelectorRowProps> {
public render(): React.ReactNode {
const { token } = this.props;
const circleColor = token.metaData.primaryColor || 'black';
@@ -121,20 +145,32 @@ interface TokenSelectorRowIconProps {
token: ERC20Asset;
}
-const TokenSelectorRowIcon: React.StatelessComponent<TokenSelectorRowIconProps> = props => {
- const { token } = props;
- const iconUrlIfExists = token.metaData.iconUrl;
- const TokenIcon = require(`../assets/icons/${token.metaData.symbol}.svg`);
- const displaySymbol = assetUtils.bestNameForAsset(token);
- if (!_.isUndefined(iconUrlIfExists)) {
- return <img src={iconUrlIfExists} />;
- } else if (!_.isUndefined(TokenIcon)) {
- return <TokenIcon />;
- } else {
- return (
- <Text fontColor={ColorOption.white} fontSize="8px">
- {displaySymbol}
- </Text>
- );
+const getTokenIcon = (symbol: string): React.StatelessComponent | undefined => {
+ try {
+ return require(`../assets/icons/${symbol}.svg`) as React.StatelessComponent;
+ } catch (e) {
+ // Can't find icon
+ return undefined;
}
};
+
+class TokenSelectorRowIcon extends React.PureComponent<TokenSelectorRowIconProps> {
+ public render(): React.ReactNode {
+ const { token } = this.props;
+ const iconUrlIfExists = token.metaData.iconUrl;
+
+ const TokenIcon = getTokenIcon(token.metaData.symbol);
+ const displaySymbol = assetUtils.bestNameForAsset(token);
+ if (!_.isUndefined(iconUrlIfExists)) {
+ return <img src={iconUrlIfExists} />;
+ } else if (!_.isUndefined(TokenIcon)) {
+ return <TokenIcon />;
+ } else {
+ return (
+ <Text fontColor={ColorOption.white} fontSize="8px">
+ {displaySymbol}
+ </Text>
+ );
+ }
+ }
+}
diff --git a/packages/instant/src/components/install_wallet_panel_content.tsx b/packages/instant/src/components/install_wallet_panel_content.tsx
index 88c26f59c..1af3dafbb 100644
--- a/packages/instant/src/components/install_wallet_panel_content.tsx
+++ b/packages/instant/src/components/install_wallet_panel_content.tsx
@@ -8,7 +8,9 @@ import {
} from '../constants';
import { ColorOption } from '../style/theme';
import { Browser } from '../types';
+import { analytics } from '../util/analytics';
import { envUtil } from '../util/env';
+import { util } from '../util/util';
import { MetaMaskLogo } from './meta_mask_logo';
import { StandardPanelContent, StandardPanelContentProps } from './standard_panel_content';
@@ -16,7 +18,7 @@ import { Button } from './ui/button';
export interface InstallWalletPanelContentProps {}
-export class InstallWalletPanelContent extends React.Component<InstallWalletPanelContentProps> {
+export class InstallWalletPanelContent extends React.PureComponent<InstallWalletPanelContentProps> {
public render(): React.ReactNode {
const panelProps = this._getStandardPanelContentProps();
return <StandardPanelContent {...panelProps} />;
@@ -45,6 +47,10 @@ export class InstallWalletPanelContent extends React.Component<InstallWalletPane
default:
break;
}
+ const onActionClick = () => {
+ analytics.trackInstallWalletModalClickedGet();
+ util.createOpenUrlInNewWindow(actionUrl)();
+ };
return {
image: <MetaMaskLogo width={85} height={80} />,
title: 'Install MetaMask',
@@ -52,10 +58,11 @@ export class InstallWalletPanelContent extends React.Component<InstallWalletPane
moreInfoSettings: {
href: META_MASK_SITE_URL,
text: 'What is MetaMask?',
+ onClick: analytics.trackInstallWalletModalClickedExplanation,
},
action: (
<Button
- href={actionUrl}
+ onClick={onActionClick}
width="100%"
fontColor={ColorOption.white}
backgroundColor={ColorOption.darkOrange}
diff --git a/packages/instant/src/components/instant_heading.tsx b/packages/instant/src/components/instant_heading.tsx
index 002695269..e943f68d7 100644
--- a/packages/instant/src/components/instant_heading.tsx
+++ b/packages/instant/src/components/instant_heading.tsx
@@ -28,11 +28,11 @@ const ICON_WIDTH = 34;
const ICON_HEIGHT = 34;
const ICON_COLOR = ColorOption.white;
-export class InstantHeading extends React.Component<InstantHeadingProps, {}> {
+export class InstantHeading extends React.PureComponent<InstantHeadingProps, {}> {
public render(): React.ReactNode {
const iconOrAmounts = this._renderIcon() || this._renderAmountsSection();
return (
- <Container backgroundColor={ColorOption.primaryColor} padding="20px" width="100%">
+ <Container backgroundColor={ColorOption.primaryColor} width="100%" padding="20px">
<Container marginBottom="5px">
<Text
letterSpacing="1px"
@@ -61,12 +61,19 @@ export class InstantHeading extends React.Component<InstantHeadingProps, {}> {
}
private _renderAmountsSection(): React.ReactNode {
- return (
- <Container>
- <Container marginBottom="5px">{this._renderPlaceholderOrAmount(this._renderEthAmount)}</Container>
- <Container opacity={0.7}>{this._renderPlaceholderOrAmount(this._renderDollarAmount)}</Container>
- </Container>
- );
+ if (
+ _.isUndefined(this.props.totalEthBaseUnitAmount) &&
+ this.props.quoteRequestState !== AsyncProcessState.Pending
+ ) {
+ return null;
+ } else {
+ return (
+ <Container>
+ <Container marginBottom="5px">{this._renderPlaceholderOrAmount(this._renderEthAmount)}</Container>
+ <Container opacity={0.7}>{this._renderPlaceholderOrAmount(this._renderDollarAmount)}</Container>
+ </Container>
+ );
+ }
}
private _renderIcon(): React.ReactNode {
@@ -106,20 +113,30 @@ export class InstantHeading extends React.Component<InstantHeadingProps, {}> {
}
private readonly _renderEthAmount = (): React.ReactNode => {
+ const ethAmount = format.ethBaseUnitAmount(
+ this.props.totalEthBaseUnitAmount,
+ 4,
+ <AmountPlaceholder isPulsating={false} color={PLACEHOLDER_COLOR} />,
+ );
+
+ const fontSize = _.isString(ethAmount) && ethAmount.length >= 13 ? '14px' : '16px';
return (
- <Text fontSize="16px" fontColor={ColorOption.white} fontWeight={500}>
- {format.ethBaseUnitAmount(
- this.props.totalEthBaseUnitAmount,
- 4,
- <AmountPlaceholder isPulsating={false} color={PLACEHOLDER_COLOR} />,
- )}
+ <Text
+ fontSize={fontSize}
+ textAlign="right"
+ width="100%"
+ fontColor={ColorOption.white}
+ fontWeight={500}
+ noWrap={true}
+ >
+ {ethAmount}
</Text>
);
};
private readonly _renderDollarAmount = (): React.ReactNode => {
return (
- <Text fontSize="16px" fontColor={ColorOption.white}>
+ <Text fontSize="16px" textAlign="right" width="100%" fontColor={ColorOption.white} noWrap={true}>
{format.ethBaseUnitAmountInUsd(
this.props.totalEthBaseUnitAmount,
this.props.ethUsdPrice,
diff --git a/packages/instant/src/components/order_details.tsx b/packages/instant/src/components/order_details.tsx
index 5fc956e1c..4db20b13e 100644
--- a/packages/instant/src/components/order_details.tsx
+++ b/packages/instant/src/components/order_details.tsx
@@ -4,124 +4,227 @@ import * as _ from 'lodash';
import * as React from 'react';
import { oc } from 'ts-optchain';
-import { BIG_NUMBER_ZERO } from '../constants';
+import { BIG_NUMBER_ZERO, DEFAULT_UNKOWN_ASSET_NAME } from '../constants';
import { ColorOption } from '../style/theme';
+import { BaseCurrency } from '../types';
import { format } from '../util/format';
import { AmountPlaceholder } from './amount_placeholder';
+import { SectionHeader } from './section_header';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
-import { Text } from './ui/text';
+import { Text, TextProps } from './ui/text';
export interface OrderDetailsProps {
buyQuoteInfo?: BuyQuoteInfo;
selectedAssetUnitAmount?: BigNumber;
ethUsdPrice?: BigNumber;
isLoading: boolean;
+ assetName?: string;
+ baseCurrency: BaseCurrency;
+ onBaseCurrencySwitchEth: () => void;
+ onBaseCurrencySwitchUsd: () => void;
}
-export class OrderDetails extends React.Component<OrderDetailsProps> {
+export class OrderDetails extends React.PureComponent<OrderDetailsProps> {
public render(): React.ReactNode {
- const { buyQuoteInfo, ethUsdPrice, selectedAssetUnitAmount } = this.props;
- const buyQuoteAccessor = oc(buyQuoteInfo);
- const assetEthBaseUnitAmount = buyQuoteAccessor.assetEthAmount();
- const feeEthBaseUnitAmount = buyQuoteAccessor.feeEthAmount();
- const totalEthBaseUnitAmount = buyQuoteAccessor.totalEthAmount();
- const pricePerTokenEth =
- !_.isUndefined(assetEthBaseUnitAmount) &&
- !_.isUndefined(selectedAssetUnitAmount) &&
- !selectedAssetUnitAmount.eq(BIG_NUMBER_ZERO)
- ? assetEthBaseUnitAmount.div(selectedAssetUnitAmount).ceil()
- : undefined;
+ const shouldShowUsdError = this.props.baseCurrency === BaseCurrency.USD && this._hadErrorFetchingUsdPrice();
return (
- <Container padding="20px" width="100%" flexGrow={1}>
- <Container marginBottom="10px">
- <Text
- letterSpacing="1px"
- fontColor={ColorOption.primaryColor}
- fontWeight={600}
- textTransform="uppercase"
- fontSize="14px"
- >
- Order Details
- </Text>
- </Container>
- <EthAmountRow
- rowLabel="Token Price"
- ethAmount={pricePerTokenEth}
- ethUsdPrice={ethUsdPrice}
- isLoading={this.props.isLoading}
+ <Container width="100%" flexGrow={1} padding="20px 20px 0px 20px">
+ <Container marginBottom="10px">{this._renderHeader()}</Container>
+ {shouldShowUsdError ? this._renderErrorFetchingUsdPrice() : this._renderRows()}
+ </Container>
+ );
+ }
+
+ private _renderRows(): React.ReactNode {
+ const { buyQuoteInfo } = this.props;
+ return (
+ <React.Fragment>
+ <OrderDetailsRow
+ labelText={this._assetAmountLabel()}
+ primaryValue={this._displayAmountOrPlaceholder(buyQuoteInfo && buyQuoteInfo.assetEthAmount)}
/>
- <EthAmountRow
- rowLabel="Fee"
- ethAmount={feeEthBaseUnitAmount}
- ethUsdPrice={ethUsdPrice}
- isLoading={this.props.isLoading}
+ <OrderDetailsRow
+ labelText="Fee"
+ primaryValue={this._displayAmountOrPlaceholder(buyQuoteInfo && buyQuoteInfo.feeEthAmount)}
/>
- <EthAmountRow
- rowLabel="Total Cost"
- ethAmount={totalEthBaseUnitAmount}
- ethUsdPrice={ethUsdPrice}
- shouldEmphasize={true}
- isLoading={this.props.isLoading}
+ <OrderDetailsRow
+ labelText="Total Cost"
+ isLabelBold={true}
+ primaryValue={this._displayAmountOrPlaceholder(buyQuoteInfo && buyQuoteInfo.totalEthAmount)}
+ isPrimaryValueBold={true}
+ secondaryValue={this._totalCostSecondaryValue()}
/>
- </Container>
+ </React.Fragment>
);
}
-}
-export interface EthAmountRowProps {
- rowLabel: string;
- ethAmount?: BigNumber;
- isEthAmountInBaseUnits?: boolean;
- ethUsdPrice?: BigNumber;
- shouldEmphasize?: boolean;
- isLoading: boolean;
+ private _renderErrorFetchingUsdPrice(): React.ReactNode {
+ return (
+ <Text>
+ There was an error fetching the USD price.
+ <Text
+ onClick={this.props.onBaseCurrencySwitchEth}
+ fontWeight={700}
+ fontColor={ColorOption.primaryColor}
+ >
+ Click here
+ </Text>
+ {' to view ETH prices'}
+ </Text>
+ );
+ }
+
+ private _hadErrorFetchingUsdPrice(): boolean {
+ return this.props.ethUsdPrice ? this.props.ethUsdPrice.equals(BIG_NUMBER_ZERO) : false;
+ }
+
+ private _totalCostSecondaryValue(): React.ReactNode {
+ const secondaryCurrency = this.props.baseCurrency === BaseCurrency.USD ? BaseCurrency.ETH : BaseCurrency.USD;
+
+ const canDisplayCurrency =
+ secondaryCurrency === BaseCurrency.ETH ||
+ (secondaryCurrency === BaseCurrency.USD && this.props.ethUsdPrice && !this._hadErrorFetchingUsdPrice());
+
+ if (this.props.buyQuoteInfo && canDisplayCurrency) {
+ return this._displayAmount(secondaryCurrency, this.props.buyQuoteInfo.totalEthAmount);
+ } else {
+ return undefined;
+ }
+ }
+
+ private _displayAmountOrPlaceholder(weiAmount?: BigNumber): React.ReactNode {
+ const { baseCurrency, isLoading } = this.props;
+
+ if (_.isUndefined(weiAmount)) {
+ return (
+ <Container opacity={0.5}>
+ <AmountPlaceholder color={ColorOption.lightGrey} isPulsating={isLoading} />
+ </Container>
+ );
+ }
+
+ return this._displayAmount(baseCurrency, weiAmount);
+ }
+
+ private _displayAmount(currency: BaseCurrency, weiAmount: BigNumber): React.ReactNode {
+ switch (currency) {
+ case BaseCurrency.USD:
+ return format.ethBaseUnitAmountInUsd(weiAmount, this.props.ethUsdPrice, 2, '');
+ case BaseCurrency.ETH:
+ return format.ethBaseUnitAmount(weiAmount, 4, '');
+ }
+ }
+
+ private _assetAmountLabel(): React.ReactNode {
+ const { assetName, baseCurrency } = this.props;
+ const numTokens = this.props.selectedAssetUnitAmount;
+
+ // Display as 0 if we have a selected asset
+ const displayNumTokens =
+ assetName && assetName !== DEFAULT_UNKOWN_ASSET_NAME && _.isUndefined(numTokens)
+ ? new BigNumber(0)
+ : numTokens;
+ if (!_.isUndefined(displayNumTokens)) {
+ let numTokensWithSymbol: React.ReactNode = displayNumTokens.toString();
+ if (assetName) {
+ numTokensWithSymbol += ` ${assetName}`;
+ }
+ const pricePerTokenWei = this._pricePerTokenWei();
+ if (pricePerTokenWei) {
+ const atPriceDisplay = (
+ <Text fontColor={ColorOption.lightGrey}>
+ @ {this._displayAmount(baseCurrency, pricePerTokenWei)}
+ </Text>
+ );
+ numTokensWithSymbol = (
+ <React.Fragment>
+ {numTokensWithSymbol} {atPriceDisplay}
+ </React.Fragment>
+ );
+ }
+ return numTokensWithSymbol;
+ }
+ return 'Token Amount';
+ }
+
+ private _pricePerTokenWei(): BigNumber | undefined {
+ const buyQuoteAccessor = oc(this.props.buyQuoteInfo);
+ const assetTotalInWei = buyQuoteAccessor.assetEthAmount();
+ const selectedAssetUnitAmount = this.props.selectedAssetUnitAmount;
+ return !_.isUndefined(assetTotalInWei) &&
+ !_.isUndefined(selectedAssetUnitAmount) &&
+ !selectedAssetUnitAmount.eq(BIG_NUMBER_ZERO)
+ ? assetTotalInWei.div(selectedAssetUnitAmount).ceil()
+ : undefined;
+ }
+
+ private _baseCurrencyChoice(choice: BaseCurrency): React.ReactNode {
+ const onClick =
+ choice === BaseCurrency.ETH ? this.props.onBaseCurrencySwitchEth : this.props.onBaseCurrencySwitchUsd;
+ const isSelected = this.props.baseCurrency === choice;
+
+ const textStyle: TextProps = { onClick, fontSize: '12px' };
+ if (isSelected) {
+ textStyle.fontColor = ColorOption.primaryColor;
+ textStyle.fontWeight = 700;
+ } else {
+ textStyle.fontColor = ColorOption.lightGrey;
+ }
+ return <Text {...textStyle}>{choice}</Text>;
+ }
+
+ private _renderHeader(): React.ReactNode {
+ return (
+ <Flex justify="space-between">
+ <SectionHeader>Order Details</SectionHeader>
+ <Container>
+ {this._baseCurrencyChoice(BaseCurrency.ETH)}
+ <Container marginLeft="5px" marginRight="5px" display="inline">
+ <Text fontSize="12px" fontColor={ColorOption.feintGrey}>
+ /
+ </Text>
+ </Container>
+ {this._baseCurrencyChoice(BaseCurrency.USD)}
+ </Container>
+ </Flex>
+ );
+ }
}
-export class EthAmountRow extends React.Component<EthAmountRowProps> {
- public static defaultProps = {
- shouldEmphasize: false,
- isEthAmountInBaseUnits: true,
- };
+export interface OrderDetailsRowProps {
+ labelText: React.ReactNode;
+ isLabelBold?: boolean;
+ isPrimaryValueBold?: boolean;
+ primaryValue: React.ReactNode;
+ secondaryValue?: React.ReactNode;
+}
+export class OrderDetailsRow extends React.PureComponent<OrderDetailsRowProps, {}> {
public render(): React.ReactNode {
- const { rowLabel, ethAmount, isEthAmountInBaseUnits, shouldEmphasize, isLoading } = this.props;
-
- const fontWeight = shouldEmphasize ? 700 : 400;
- const ethFormatter = isEthAmountInBaseUnits ? format.ethBaseUnitAmount : format.ethUnitAmount;
return (
<Container padding="10px 0px" borderTop="1px dashed" borderColor={ColorOption.feintGrey}>
<Flex justify="space-between">
- <Text fontWeight={fontWeight} fontColor={ColorOption.grey}>
- {rowLabel}
+ <Text fontWeight={this.props.isLabelBold ? 700 : 400} fontColor={ColorOption.grey}>
+ {this.props.labelText}
</Text>
- <Container>
- {this._renderUsdSection()}
- <Text fontWeight={fontWeight} fontColor={ColorOption.grey}>
- {ethFormatter(
- ethAmount,
- 4,
- <Container opacity={0.5}>
- <AmountPlaceholder color={ColorOption.lightGrey} isPulsating={isLoading} />
- </Container>,
- )}
- </Text>
- </Container>
+ <Container>{this._renderValues()}</Container>
</Flex>
</Container>
);
}
- private _renderUsdSection(): React.ReactNode {
- const usdFormatter = this.props.isEthAmountInBaseUnits
- ? format.ethBaseUnitAmountInUsd
- : format.ethUnitAmountInUsd;
- const shouldHideUsdPriceSection = _.isUndefined(this.props.ethUsdPrice) || _.isUndefined(this.props.ethAmount);
- return shouldHideUsdPriceSection ? null : (
+
+ private _renderValues(): React.ReactNode {
+ const secondaryValueNode: React.ReactNode = this.props.secondaryValue && (
<Container marginRight="3px" display="inline-block">
- <Text fontColor={ColorOption.lightGrey}>
- ({usdFormatter(this.props.ethAmount, this.props.ethUsdPrice)})
- </Text>
+ <Text fontColor={ColorOption.lightGrey}>({this.props.secondaryValue})</Text>
</Container>
);
+ return (
+ <React.Fragment>
+ {secondaryValueNode}
+ <Text fontWeight={this.props.isPrimaryValueBold ? 700 : 400}>{this.props.primaryValue}</Text>
+ </React.Fragment>
+ );
}
}
diff --git a/packages/instant/src/components/payment_method.tsx b/packages/instant/src/components/payment_method.tsx
index ebcd62f35..ada9f7bab 100644
--- a/packages/instant/src/components/payment_method.tsx
+++ b/packages/instant/src/components/payment_method.tsx
@@ -8,6 +8,7 @@ import { envUtil } from '../util/env';
import { CoinbaseWalletLogo } from './coinbase_wallet_logo';
import { MetaMaskLogo } from './meta_mask_logo';
import { PaymentMethodDropdown } from './payment_method_dropdown';
+import { SectionHeader } from './section_header';
import { Circle } from './ui/circle';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
@@ -18,26 +19,18 @@ import { WalletPrompt } from './wallet_prompt';
export interface PaymentMethodProps {
account: Account;
network: Network;
- walletName: string;
+ walletDisplayName: string;
onInstallWalletClick: () => void;
onUnlockWalletClick: () => void;
}
-export class PaymentMethod extends React.Component<PaymentMethodProps> {
+export class PaymentMethod extends React.PureComponent<PaymentMethodProps> {
public render(): React.ReactNode {
return (
- <Container padding="20px" width="100%">
+ <Container width="100%" height="120px" padding="20px 20px 0px 20px">
<Container marginBottom="12px">
<Flex justify="space-between">
- <Text
- letterSpacing="1px"
- fontColor={ColorOption.primaryColor}
- fontWeight={600}
- textTransform="uppercase"
- fontSize="14px"
- >
- {this._renderTitleText()}
- </Text>
+ <SectionHeader>{this._renderTitleText()}</SectionHeader>
{this._renderTitleLabel()}
</Flex>
</Container>
@@ -62,11 +55,11 @@ export class PaymentMethod extends React.Component<PaymentMethodProps> {
if (account.state === AccountState.Ready || account.state === AccountState.Locked) {
const circleColor: ColorOption = account.state === AccountState.Ready ? ColorOption.green : ColorOption.red;
return (
- <Flex>
+ <Flex align="center">
<Circle diameter={8} color={circleColor} />
- <Container marginLeft="3px">
- <Text fontColor={ColorOption.darkGrey} fontSize="12px">
- {this.props.walletName}
+ <Container marginLeft="5px">
+ <Text fontColor={ColorOption.darkGrey} fontSize="12px" lineHeight="30px">
+ {this.props.walletDisplayName}
</Text>
</Container>
</Flex>
@@ -83,16 +76,19 @@ export class PaymentMethod extends React.Component<PaymentMethodProps> {
const colors = { primaryColor, secondaryColor };
switch (account.state) {
case AccountState.Loading:
- // Just take up the same amount of space as the other states.
- return <Container height="52px" />;
+ return null;
case AccountState.Locked:
return (
<WalletPrompt
onClick={this.props.onUnlockWalletClick}
- image={<Icon width={13} icon="lock" color={ColorOption.black} />}
+ image={
+ <Container position="relative" top="2px">
+ <Icon width={13} icon="lock" color={ColorOption.black} />
+ </Container>
+ }
{...colors}
>
- Please Unlock {this.props.walletName}
+ Click to Connect {this.props.walletDisplayName}
</WalletPrompt>
);
case AccountState.None:
diff --git a/packages/instant/src/components/payment_method_dropdown.tsx b/packages/instant/src/components/payment_method_dropdown.tsx
index b330dbcd6..e463e3eae 100644
--- a/packages/instant/src/components/payment_method_dropdown.tsx
+++ b/packages/instant/src/components/payment_method_dropdown.tsx
@@ -1,8 +1,9 @@
import { BigNumber } from '@0x/utils';
-import copy from 'copy-to-clipboard';
+import * as copy from 'copy-to-clipboard';
import * as React from 'react';
import { Network } from '../types';
+import { analytics } from '../util/analytics';
import { envUtil } from '../util/env';
import { etherscanUtil } from '../util/etherscan';
import { format } from '../util/format';
@@ -15,12 +16,19 @@ export interface PaymentMethodDropdownProps {
network: Network;
}
-export class PaymentMethodDropdown extends React.Component<PaymentMethodDropdownProps> {
+export class PaymentMethodDropdown extends React.PureComponent<PaymentMethodDropdownProps> {
public render(): React.ReactNode {
const { accountAddress, accountEthBalanceInWei } = this.props;
const value = format.ethAddress(accountAddress);
const label = format.ethBaseUnitAmount(accountEthBalanceInWei, 4, '') as string;
- return <Dropdown value={value} label={label} items={this._getDropdownItemConfigs()} />;
+ return (
+ <Dropdown
+ value={value}
+ label={label}
+ items={this._getDropdownItemConfigs()}
+ onOpen={analytics.trackPaymentMethodDropdownOpened}
+ />
+ );
}
private readonly _getDropdownItemConfigs = (): DropdownItemConfig[] => {
if (envUtil.isMobileOperatingSystem()) {
@@ -37,11 +45,15 @@ export class PaymentMethodDropdown extends React.Component<PaymentMethodDropdown
return [viewOnEtherscan, copyAddressToClipboard];
};
private readonly _handleEtherscanClick = (): void => {
+ analytics.trackPaymentMethodOpenedEtherscan();
+
const { accountAddress, network } = this.props;
const etherscanUrl = etherscanUtil.getEtherScanEthAddressIfExists(accountAddress, network);
window.open(etherscanUrl, '_blank');
};
private readonly _handleCopyToClipboardClick = (): void => {
+ analytics.trackPaymentMethodCopiedAddress();
+
const { accountAddress } = this.props;
copy(accountAddress);
};
diff --git a/packages/instant/src/components/placing_order_button.tsx b/packages/instant/src/components/placing_order_button.tsx
index 2516b90b1..528a305dc 100644
--- a/packages/instant/src/components/placing_order_button.tsx
+++ b/packages/instant/src/components/placing_order_button.tsx
@@ -14,3 +14,5 @@ export const PlacingOrderButton: React.StatelessComponent<{}> = props => (
Placing Order&hellip;
</Button>
);
+
+PlacingOrderButton.displayName = 'PlacingOrderButton';
diff --git a/packages/instant/src/components/scaling_amount_input.tsx b/packages/instant/src/components/scaling_amount_input.tsx
index 5dc719293..7dc1fdc0c 100644
--- a/packages/instant/src/components/scaling_amount_input.tsx
+++ b/packages/instant/src/components/scaling_amount_input.tsx
@@ -4,6 +4,7 @@ import * as React from 'react';
import { Maybe } from '../types';
+import { GIT_SHA, MAGIC_TRIGGER_ERROR_INPUT, MAGIC_TRIGGER_ERROR_MESSAGE, NPM_PACKAGE_VERSION } from '../constants';
import { ColorOption } from '../style/theme';
import { maybeBigNumberUtil } from '../util/maybe_big_number';
import { util } from '../util/util';
@@ -18,17 +19,19 @@ export interface ScalingAmountInputProps {
value?: BigNumber;
onAmountChange: (value?: BigNumber) => void;
onFontSizeChange: (fontSizePx: number) => void;
+ hasAutofocus: boolean;
}
interface ScalingAmountInputState {
stringValue: string;
}
const { stringToMaybeBigNumber, areMaybeBigNumbersEqual } = maybeBigNumberUtil;
-export class ScalingAmountInput extends React.Component<ScalingAmountInputProps, ScalingAmountInputState> {
+export class ScalingAmountInput extends React.PureComponent<ScalingAmountInputProps, ScalingAmountInputState> {
public static defaultProps = {
onAmountChange: util.boundNoop,
onFontSizeChange: util.boundNoop,
isDisabled: false,
+ hasAutofocus: false,
};
public constructor(props: ScalingAmountInputProps) {
super(props);
@@ -55,6 +58,7 @@ export class ScalingAmountInput extends React.Component<ScalingAmountInputProps,
const { textLengthThreshold, fontColor, maxFontSizePx, onFontSizeChange } = this.props;
return (
<ScalingInput
+ type="number"
maxFontSizePx={maxFontSizePx}
textLengthThreshold={textLengthThreshold}
onFontSizeChange={onFontSizeChange}
@@ -64,10 +68,15 @@ export class ScalingAmountInput extends React.Component<ScalingAmountInputProps,
placeholder="0.00"
emptyInputWidthCh={3.5}
isDisabled={this.props.isDisabled}
+ hasAutofocus={this.props.hasAutofocus}
/>
);
}
private readonly _handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
+ if (event.target.value === MAGIC_TRIGGER_ERROR_INPUT) {
+ throw new Error(`${MAGIC_TRIGGER_ERROR_MESSAGE} git: ${GIT_SHA}, npm: ${NPM_PACKAGE_VERSION}`);
+ }
+
const sanitizedValue = event.target.value.replace(/[^0-9.]/g, ''); // only allow numbers and "."
this.setState({
stringValue: sanitizedValue,
diff --git a/packages/instant/src/components/scaling_input.tsx b/packages/instant/src/components/scaling_input.tsx
index e1599a316..c31de1fb5 100644
--- a/packages/instant/src/components/scaling_input.tsx
+++ b/packages/instant/src/components/scaling_input.tsx
@@ -1,3 +1,4 @@
+import { ObjectMap } from '@0x/types';
import * as _ from 'lodash';
import * as React from 'react';
@@ -13,10 +14,15 @@ export enum ScalingInputPhase {
export interface ScalingSettings {
percentageToReduceFontSizePerCharacter: number;
- constantPxToIncreaseWidthPerCharacter: number;
+ // 1ch = the width of the 0 chararacter.
+ // Allow to customize 'char' length for different characters.
+ characterWidthOverrides: ObjectMap<number>;
+ // How much room to leave to the right of the scaling input.
+ additionalInputSpaceInCh: number;
}
export interface ScalingInputProps {
+ type?: string;
textLengthThreshold: number;
maxFontSizePx: number;
value: string;
@@ -28,10 +34,7 @@ export interface ScalingInputProps {
maxLength?: number;
scalingSettings: ScalingSettings;
isDisabled: boolean;
-}
-
-export interface ScalingInputState {
- inputWidthPxAtPhaseChange?: number;
+ hasAutofocus: boolean;
}
export interface ScalingInputSnapshot {
@@ -40,20 +43,22 @@ export interface ScalingInputSnapshot {
// These are magic numbers that were determined experimentally.
const defaultScalingSettings: ScalingSettings = {
- percentageToReduceFontSizePerCharacter: 0.125,
- constantPxToIncreaseWidthPerCharacter: 4,
+ percentageToReduceFontSizePerCharacter: 0.1,
+ characterWidthOverrides: {
+ '1': 0.7,
+ '.': 0.4,
+ },
+ additionalInputSpaceInCh: 0.4,
};
-export class ScalingInput extends React.Component<ScalingInputProps, ScalingInputState> {
+export class ScalingInput extends React.PureComponent<ScalingInputProps> {
public static defaultProps = {
onChange: util.boundNoop,
onFontSizeChange: util.boundNoop,
- maxLength: 7,
+ maxLength: 9,
scalingSettings: defaultScalingSettings,
isDisabled: false,
- };
- public state: ScalingInputState = {
- inputWidthPxAtPhaseChange: undefined,
+ hasAutofocus: false,
};
private readonly _inputRef = React.createRef<HTMLInputElement>();
public static getPhase(textLengthThreshold: number, value: string): ScalingInputPhase {
@@ -91,30 +96,15 @@ export class ScalingInput extends React.Component<ScalingInputProps, ScalingInpu
scalingSettings.percentageToReduceFontSizePerCharacter,
);
}
- public getSnapshotBeforeUpdate(): ScalingInputSnapshot {
- return {
- inputWidthPx: this._getInputWidthInPx(),
- };
+ public componentDidMount(): void {
+ // Trigger an initial notification of the calculated fontSize.
+ const currentPhase = ScalingInput.getPhaseFromProps(this.props);
+ const currentFontSize = ScalingInput.calculateFontSizeFromProps(this.props, currentPhase);
+ this.props.onFontSizeChange(currentFontSize);
}
- public componentDidUpdate(
- prevProps: ScalingInputProps,
- prevState: ScalingInputState,
- snapshot: ScalingInputSnapshot,
- ): void {
+ public componentDidUpdate(prevProps: ScalingInputProps): void {
const prevPhase = ScalingInput.getPhaseFromProps(prevProps);
const curPhase = ScalingInput.getPhaseFromProps(this.props);
- // if we went from fixed to scaling, save the width from the transition
- if (prevPhase !== ScalingInputPhase.ScalingFontSize && curPhase === ScalingInputPhase.ScalingFontSize) {
- this.setState({
- inputWidthPxAtPhaseChange: snapshot.inputWidthPx,
- });
- }
- // if we went from scaling to fixed, revert back to scaling using `ch`
- if (prevPhase === ScalingInputPhase.ScalingFontSize && curPhase !== ScalingInputPhase.ScalingFontSize) {
- this.setState({
- inputWidthPxAtPhaseChange: undefined,
- });
- }
const prevFontSize = ScalingInput.calculateFontSizeFromProps(prevProps, prevPhase);
const curFontSize = ScalingInput.calculateFontSizeFromProps(this.props, curPhase);
// If font size has changed, notify.
@@ -123,49 +113,53 @@ export class ScalingInput extends React.Component<ScalingInputProps, ScalingInpu
}
}
public render(): React.ReactNode {
- const { isDisabled, fontColor, onChange, placeholder, value, maxLength } = this.props;
+ const { type, hasAutofocus, isDisabled, fontColor, placeholder, value, maxLength } = this.props;
const phase = ScalingInput.getPhaseFromProps(this.props);
return (
<Input
+ type={type}
ref={this._inputRef as any}
fontColor={fontColor}
- onChange={onChange}
+ onChange={this._handleChange}
value={value}
placeholder={placeholder}
fontSize={`${this._calculateFontSize(phase)}px`}
width={this._calculateWidth(phase)}
maxLength={maxLength}
disabled={isDisabled}
+ autoFocus={hasAutofocus}
/>
);
}
private readonly _calculateWidth = (phase: ScalingInputPhase): string => {
- const { value, textLengthThreshold, scalingSettings } = this.props;
+ const { value, scalingSettings } = this.props;
if (_.isEmpty(value)) {
return `${this.props.emptyInputWidthCh}ch`;
}
- switch (phase) {
- case ScalingInputPhase.FixedFontSize:
- return `${value.length}ch`;
- case ScalingInputPhase.ScalingFontSize:
- const { inputWidthPxAtPhaseChange } = this.state;
- if (!_.isUndefined(inputWidthPxAtPhaseChange)) {
- const charactersOverMax = value.length - textLengthThreshold;
- const scalingAmount = scalingSettings.constantPxToIncreaseWidthPerCharacter * charactersOverMax;
- const width = inputWidthPxAtPhaseChange + scalingAmount;
- return `${width}px`;
+ const lengthInCh = _.reduce(
+ value.split(''),
+ (sum, char) => {
+ const widthOverride = scalingSettings.characterWidthOverrides[char];
+ if (!_.isUndefined(widthOverride)) {
+ // tslint is confused
+ // tslint:disable-next-line:restrict-plus-operands
+ return sum + widthOverride;
}
- return `${textLengthThreshold}ch`;
- }
+ return sum + 1;
+ },
+ scalingSettings.additionalInputSpaceInCh,
+ );
+ return `${lengthInCh}ch`;
};
private readonly _calculateFontSize = (phase: ScalingInputPhase): number => {
return ScalingInput.calculateFontSizeFromProps(this.props, phase);
};
- private readonly _getInputWidthInPx = (): number => {
- const ref = this._inputRef.current;
- if (!ref) {
- return 0;
+ private readonly _handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
+ const value = event.target.value;
+ const { maxLength } = this.props;
+ if (!_.isUndefined(value) && !_.isUndefined(maxLength) && value.length > maxLength) {
+ return;
}
- return ref.getBoundingClientRect().width;
+ this.props.onChange(event);
};
}
diff --git a/packages/instant/src/components/search_input.tsx b/packages/instant/src/components/search_input.tsx
index 3a693b9f8..71bc18915 100644
--- a/packages/instant/src/components/search_input.tsx
+++ b/packages/instant/src/components/search_input.tsx
@@ -13,10 +13,10 @@ export interface SearchInputProps extends InputProps {
}
export const SearchInput: React.StatelessComponent<SearchInputProps> = props => (
- <Container backgroundColor={props.backgroundColor} borderRadius="3px" padding=".5em .3em">
- <Flex justify="flex-start" align="flex-end">
- <Icon width={14} height={14} icon="search" color={ColorOption.lightGrey} padding="0px 12px" />
- <Input {...props} fontSize="14px" fontColor={props.fontColor} />
+ <Container backgroundColor={props.backgroundColor} borderRadius="3px" padding=".5em .5em">
+ <Flex justify="flex-start" align="center">
+ <Icon width={14} height={14} icon="search" color={ColorOption.lightGrey} padding="2px 12px" />
+ <Input {...props} type="search" fontSize="16px" fontColor={props.fontColor} />
</Flex>
</Container>
);
diff --git a/packages/instant/src/components/secondary_button.tsx b/packages/instant/src/components/secondary_button.tsx
index 705390e28..0714ce287 100644
--- a/packages/instant/src/components/secondary_button.tsx
+++ b/packages/instant/src/components/secondary_button.tsx
@@ -24,3 +24,4 @@ export const SecondaryButton: React.StatelessComponent<SecondaryButtonProps> = p
SecondaryButton.defaultProps = {
width: '100%',
};
+SecondaryButton.displayName = 'SecondaryButton';
diff --git a/packages/instant/src/components/section_header.tsx b/packages/instant/src/components/section_header.tsx
new file mode 100644
index 000000000..2185b67ba
--- /dev/null
+++ b/packages/instant/src/components/section_header.tsx
@@ -0,0 +1,21 @@
+import * as React from 'react';
+
+import { ColorOption } from '../style/theme';
+
+import { Text } from './ui/text';
+
+export interface SectionHeaderProps {}
+export const SectionHeader: React.StatelessComponent<SectionHeaderProps> = props => {
+ return (
+ <Text
+ letterSpacing="1px"
+ fontColor={ColorOption.primaryColor}
+ fontWeight={600}
+ textTransform="uppercase"
+ fontSize="12px"
+ >
+ {props.children}
+ </Text>
+ );
+};
+SectionHeader.displayName = 'SectionHeader';
diff --git a/packages/instant/src/components/sliding_error.tsx b/packages/instant/src/components/sliding_error.tsx
index b59e2a905..c7c6732cf 100644
--- a/packages/instant/src/components/sliding_error.tsx
+++ b/packages/instant/src/components/sliding_error.tsx
@@ -38,6 +38,8 @@ export const Error: React.StatelessComponent<ErrorProps> = props => (
</Container>
);
+Error.displayName = 'Error';
+
export interface SlidingErrorProps extends ErrorProps {
animationState: SlideAnimationState;
}
@@ -94,3 +96,5 @@ export const SlidingError: React.StatelessComponent<SlidingErrorProps> = props =
</SlideAnimation>
);
};
+
+SlidingError.displayName = 'SlidingError';
diff --git a/packages/instant/src/components/sliding_panel.tsx b/packages/instant/src/components/sliding_panel.tsx
index 7f9037049..9b09a0d80 100644
--- a/packages/instant/src/components/sliding_panel.tsx
+++ b/packages/instant/src/components/sliding_panel.tsx
@@ -26,42 +26,48 @@ export const Panel: React.StatelessComponent<PanelProps> = ({ children, onClose
</Container>
);
+Panel.displayName = 'Panel';
+
export interface SlidingPanelProps extends PanelProps {
animationState: SlideAnimationState;
+ onAnimationEnd?: () => void;
}
-export const SlidingPanel: React.StatelessComponent<SlidingPanelProps> = props => {
- if (props.animationState === 'none') {
- return null;
+export class SlidingPanel extends React.PureComponent<SlidingPanelProps> {
+ public render(): React.ReactNode {
+ if (this.props.animationState === 'none') {
+ return null;
+ }
+ const { animationState, onAnimationEnd, ...rest } = this.props;
+ const slideAmount = '100%';
+ const slideUpSettings: PositionAnimationSettings = {
+ duration: '0.3s',
+ timingFunction: 'ease-in-out',
+ top: {
+ from: slideAmount,
+ to: '0px',
+ },
+ position: 'absolute',
+ };
+ const slideDownSettings: PositionAnimationSettings = {
+ duration: '0.3s',
+ timingFunction: 'ease-out',
+ top: {
+ from: '0px',
+ to: slideAmount,
+ },
+ position: 'absolute',
+ };
+ return (
+ <SlideAnimation
+ slideInSettings={slideUpSettings}
+ slideOutSettings={slideDownSettings}
+ animationState={animationState}
+ height="100%"
+ onAnimationEnd={onAnimationEnd}
+ >
+ <Panel {...rest} />
+ </SlideAnimation>
+ );
}
- const { animationState, ...rest } = props;
- const slideAmount = '100%';
- const slideUpSettings: PositionAnimationSettings = {
- duration: '0.3s',
- timingFunction: 'ease-in-out',
- top: {
- from: slideAmount,
- to: '0px',
- },
- position: 'absolute',
- };
- const slideDownSettings: PositionAnimationSettings = {
- duration: '0.3s',
- timingFunction: 'ease-out',
- top: {
- from: '0px',
- to: slideAmount,
- },
- position: 'absolute',
- };
- return (
- <SlideAnimation
- slideInSettings={slideUpSettings}
- slideOutSettings={slideDownSettings}
- animationState={animationState}
- height="100%"
- >
- <Panel {...rest} />
- </SlideAnimation>
- );
-};
+}
diff --git a/packages/instant/src/components/standard_panel_content.tsx b/packages/instant/src/components/standard_panel_content.tsx
index 582b3318e..f2987df82 100644
--- a/packages/instant/src/components/standard_panel_content.tsx
+++ b/packages/instant/src/components/standard_panel_content.tsx
@@ -1,6 +1,7 @@
import * as React from 'react';
import { ColorOption } from '../style/theme';
+import { util } from '../util/util';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
@@ -9,6 +10,7 @@ import { Text } from './ui/text';
export interface MoreInfoSettings {
text: string;
href: string;
+ onClick?: () => void;
}
export interface StandardPanelContentProps {
@@ -21,6 +23,15 @@ export interface StandardPanelContentProps {
const SPACING_BETWEEN_PX = '20px';
+const onMoreInfoClick = (href: string, onClick?: () => void) => {
+ return () => {
+ if (onClick) {
+ onClick();
+ }
+ util.createOpenUrlInNewWindow(href)();
+ };
+};
+
export const StandardPanelContent: React.StatelessComponent<StandardPanelContentProps> = ({
image,
title,
@@ -50,7 +61,7 @@ export const StandardPanelContent: React.StatelessComponent<StandardPanelContent
fontSize="13px"
textDecorationLine="underline"
fontColor={ColorOption.lightGrey}
- href={moreInfoSettings.href}
+ onClick={onMoreInfoClick(moreInfoSettings.href, moreInfoSettings.onClick)}
>
{moreInfoSettings.text}
</Text>
@@ -60,3 +71,5 @@ export const StandardPanelContent: React.StatelessComponent<StandardPanelContent
<Container>{action}</Container>
</Container>
);
+
+StandardPanelContent.displayName = 'StandardPanelContent';
diff --git a/packages/instant/src/components/standard_sliding_panel.tsx b/packages/instant/src/components/standard_sliding_panel.tsx
index f587ff79a..bcc9d3dce 100644
--- a/packages/instant/src/components/standard_sliding_panel.tsx
+++ b/packages/instant/src/components/standard_sliding_panel.tsx
@@ -1,6 +1,6 @@
import * as React from 'react';
-import { SlideAnimationState, StandardSlidingPanelContent, StandardSlidingPanelSettings } from '../types';
+import { StandardSlidingPanelContent, StandardSlidingPanelSettings } from '../types';
import { InstallWalletPanelContent } from './install_wallet_panel_content';
import { SlidingPanel } from './sliding_panel';
@@ -9,7 +9,7 @@ export interface StandardSlidingPanelProps extends StandardSlidingPanelSettings
onClose: () => void;
}
-export class StandardSlidingPanel extends React.Component<StandardSlidingPanelProps> {
+export class StandardSlidingPanel extends React.PureComponent<StandardSlidingPanelProps> {
public render(): React.ReactNode {
const { animationState, content, onClose } = this.props;
return (
diff --git a/packages/instant/src/components/time_counter.tsx b/packages/instant/src/components/time_counter.tsx
index f9b68163c..93dc497d5 100644
--- a/packages/instant/src/components/time_counter.tsx
+++ b/packages/instant/src/components/time_counter.tsx
@@ -16,7 +16,7 @@ interface TimeCounterState {
elapsedSeconds: number;
}
-export class TimeCounter extends React.Component<TimeCounterProps, TimeCounterState> {
+export class TimeCounter extends React.PureComponent<TimeCounterProps, TimeCounterState> {
public state = {
elapsedSeconds: 0,
};
diff --git a/packages/instant/src/components/timed_progress_bar.tsx b/packages/instant/src/components/timed_progress_bar.tsx
index 8465b9cd0..b1644b871 100644
--- a/packages/instant/src/components/timed_progress_bar.tsx
+++ b/packages/instant/src/components/timed_progress_bar.tsx
@@ -1,8 +1,9 @@
import * as _ from 'lodash';
+import { transparentize } from 'polished';
import * as React from 'react';
import { PROGRESS_FINISH_ANIMATION_TIME_MS, PROGRESS_STALL_AT_WIDTH } from '../constants';
-import { ColorOption, css, keyframes, styled } from '../style/theme';
+import { ColorOption, css, keyframes, styled, ThemeConsumer } from '../style/theme';
import { Container } from './ui/container';
@@ -16,7 +17,7 @@ export interface TimedProgressBarProps {
* Goes from 0% -> PROGRESS_STALL_AT_WIDTH over time of expectedTimeMs
* When hasEnded set to true, goes to 100% through animation of PROGRESS_FINISH_ANIMATION_TIME_MS length of time
*/
-export class TimedProgressBar extends React.Component<TimedProgressBarProps, {}> {
+export class TimedProgressBar extends React.PureComponent<TimedProgressBarProps, {}> {
private readonly _barRef = React.createRef<HTMLDivElement>();
public render(): React.ReactNode {
@@ -93,8 +94,16 @@ export interface ProgressBarProps extends ProgressProps {}
export const ProgressBar: React.ComponentType<ProgressBarProps & React.ClassAttributes<{}>> = React.forwardRef(
(props, ref) => (
- <Container width="100%" backgroundColor={ColorOption.lightGrey} borderRadius="6px">
- <Progress {...props} ref={ref as any} />
- </Container>
+ <ThemeConsumer>
+ {theme => (
+ <Container
+ width="100%"
+ borderRadius="6px"
+ rawBackgroundColor={transparentize(0.5, theme[ColorOption.primaryColor])}
+ >
+ <Progress {...props} ref={ref as any} />
+ </Container>
+ )}
+ </ThemeConsumer>
),
);
diff --git a/packages/instant/src/components/ui/container.tsx b/packages/instant/src/components/ui/container.tsx
index 4dafe1386..58d7d5871 100644
--- a/packages/instant/src/components/ui/container.tsx
+++ b/packages/instant/src/components/ui/container.tsx
@@ -27,17 +27,30 @@ export interface ContainerProps {
borderBottom?: string;
className?: string;
backgroundColor?: ColorOption;
+ rawBackgroundColor?: string;
hasBoxShadow?: boolean;
+ isHidden?: boolean;
zIndex?: number;
whiteSpace?: string;
opacity?: number;
cursor?: string;
overflow?: string;
darkenOnHover?: boolean;
+ rawHoverColor?: string;
boxShadowOnHover?: boolean;
flexGrow?: string | number;
}
+const getBackgroundColor = (theme: any, backgroundColor?: ColorOption, rawBackgroundColor?: string): string => {
+ if (backgroundColor) {
+ return theme[backgroundColor] as string;
+ }
+ if (rawBackgroundColor) {
+ return rawBackgroundColor;
+ }
+ return 'none';
+};
+
export const Container =
styled.div <
ContainerProps >
@@ -65,14 +78,17 @@ export const Container =
${props => cssRuleIfExists(props, 'opacity')}
${props => cssRuleIfExists(props, 'cursor')}
${props => cssRuleIfExists(props, 'overflow')}
+ ${props => (props.overflow === 'scroll' ? `-webkit-overflow-scrolling: touch` : '')};
${props => (props.hasBoxShadow ? `box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1)` : '')};
${props => props.display && stylesForMedia<string>('display', props.display)}
${props => props.width && stylesForMedia<string>('width', props.width)}
${props => props.height && stylesForMedia<string>('height', props.height)}
${props => props.borderRadius && stylesForMedia<string>('border-radius', props.borderRadius)}
- background-color: ${props => (props.backgroundColor ? props.theme[props.backgroundColor] : 'none')};
+ ${props => (props.isHidden ? 'visibility: hidden;' : '')}
+ background-color: ${props => getBackgroundColor(props.theme, props.backgroundColor, props.rawBackgroundColor)};
border-color: ${props => (props.borderColor ? props.theme[props.borderColor] : 'none')};
&:hover {
+ ${props => (props.rawHoverColor ? `background-color: ${props.rawHoverColor}` : '')}
${props =>
props.darkenOnHover
? `background-color: ${
diff --git a/packages/instant/src/components/ui/dropdown.tsx b/packages/instant/src/components/ui/dropdown.tsx
index 3a23f456d..8788d3d59 100644
--- a/packages/instant/src/components/ui/dropdown.tsx
+++ b/packages/instant/src/components/ui/dropdown.tsx
@@ -1,7 +1,8 @@
import * as _ from 'lodash';
+import { transparentize } from 'polished';
import * as React from 'react';
-import { ColorOption, completelyTransparent } from '../../style/theme';
+import { ColorOption, completelyTransparent, ThemeConsumer } from '../../style/theme';
import { zIndex } from '../../style/z_index';
import { Container } from './container';
@@ -19,13 +20,14 @@ export interface DropdownProps {
value: string;
label?: string;
items: DropdownItemConfig[];
+ onOpen?: () => void;
}
export interface DropdownState {
isOpen: boolean;
}
-export class Dropdown extends React.Component<DropdownProps, DropdownState> {
+export class Dropdown extends React.PureComponent<DropdownProps, DropdownState> {
public static defaultProps = {
items: [],
};
@@ -97,9 +99,14 @@ export class Dropdown extends React.Component<DropdownProps, DropdownState> {
if (_.isEmpty(this.props.items)) {
return;
}
+ const isOpen = !this.state.isOpen;
this.setState({
- isOpen: !this.state.isOpen,
+ isOpen,
});
+
+ if (isOpen && this.props.onOpen) {
+ this.props.onOpen();
+ }
};
private readonly _closeDropdown = (): void => {
this.setState({
@@ -115,20 +122,26 @@ export interface DropdownItemProps extends DropdownItemConfig {
}
export const DropdownItem: React.StatelessComponent<DropdownItemProps> = ({ text, onClick, isLast }) => (
- <Container
- onClick={onClick}
- cursor="pointer"
- darkenOnHover={true}
- backgroundColor={ColorOption.white}
- padding="0.8em"
- borderTop="0"
- border="1px solid"
- borderRadius={isLast ? '0px 0px 4px 4px' : undefined}
- width="100%"
- borderColor={ColorOption.feintGrey}
- >
- <Text fontSize="14px" fontColor={ColorOption.darkGrey}>
- {text}
- </Text>
- </Container>
+ <ThemeConsumer>
+ {theme => (
+ <Container
+ onClick={onClick}
+ cursor="pointer"
+ rawHoverColor={transparentize(0.9, theme[ColorOption.primaryColor])}
+ backgroundColor={ColorOption.white}
+ padding="0.8em"
+ borderTop="0"
+ border="1px solid"
+ borderRadius={isLast ? '0px 0px 4px 4px' : undefined}
+ width="100%"
+ borderColor={ColorOption.feintGrey}
+ >
+ <Text fontSize="14px" fontColor={ColorOption.darkGrey}>
+ {text}
+ </Text>
+ </Container>
+ )}
+ </ThemeConsumer>
);
+
+DropdownItem.displayName = 'DropdownItem';
diff --git a/packages/instant/src/components/ui/input.tsx b/packages/instant/src/components/ui/input.tsx
index 1ea5d8fe1..53c43ea0b 100644
--- a/packages/instant/src/components/ui/input.tsx
+++ b/packages/instant/src/components/ui/input.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { ColorOption, styled } from '../../style/theme';
-export interface InputProps {
+export interface InputProps extends React.HTMLAttributes<HTMLInputElement> {
tabIndex?: number;
className?: string;
value?: string;
@@ -10,6 +10,7 @@ export interface InputProps {
fontSize?: string;
fontColor?: ColorOption;
placeholder?: string;
+ type?: string;
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
}
@@ -28,9 +29,13 @@ export const Input =
outline: none;
border: none;
&::placeholder {
- color: ${props => props.theme[props.fontColor || 'white']};
- opacity: 0.5;
+ color: ${props => props.theme[props.fontColor || 'white']} !important;
+ opacity: 0.5 !important;
}
+ &::-webkit-outer-spin-button, &::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+ }
}
`;
diff --git a/packages/instant/src/components/ui/overlay.tsx b/packages/instant/src/components/ui/overlay.tsx
index f67d6fb2f..0b5eaf299 100644
--- a/packages/instant/src/components/ui/overlay.tsx
+++ b/packages/instant/src/components/ui/overlay.tsx
@@ -33,7 +33,7 @@ export const Overlay =
Overlay.defaultProps = {
zIndex: zIndex.overlayDefault,
- backgroundColor: generateOverlayBlack(0.6),
+ backgroundColor: generateOverlayBlack(0.7),
};
Overlay.displayName = 'Overlay';
diff --git a/packages/instant/src/components/ui/text.tsx b/packages/instant/src/components/ui/text.tsx
index fd14cc4d1..282477758 100644
--- a/packages/instant/src/components/ui/text.tsx
+++ b/packages/instant/src/components/ui/text.tsx
@@ -1,4 +1,3 @@
-import { darken } from 'polished';
import * as React from 'react';
import { ColorOption, styled } from '../../style/theme';
@@ -11,6 +10,7 @@ export interface TextProps {
fontSize?: string;
opacity?: number;
letterSpacing?: string;
+ textAlign?: string;
textTransform?: string;
lineHeight?: string;
className?: string;
@@ -22,6 +22,7 @@ export interface TextProps {
noWrap?: boolean;
display?: string;
href?: string;
+ width?: string;
}
export const Text: React.StatelessComponent<TextProps> = ({ href, onClick, ...rest }) => {
@@ -29,7 +30,7 @@ export const Text: React.StatelessComponent<TextProps> = ({ href, onClick, ...re
return <StyledText {...rest} onClick={computedOnClick} />;
};
-const darkenOnHoverAmount = 0.3;
+const opacityOnHoverAmount = 0.5;
export const StyledText =
styled.div <
TextProps >
@@ -51,9 +52,10 @@ export const StyledText =
${props => (props.display ? `display: ${props.display}` : '')};
${props => (props.letterSpacing ? `letter-spacing: ${props.letterSpacing}` : '')};
${props => (props.textTransform ? `text-transform: ${props.textTransform}` : '')};
+ ${props => (props.textAlign ? `text-align: ${props.textAlign}` : '')};
+ ${props => (props.width ? `width: ${props.width}` : '')};
&:hover {
- ${props =>
- props.onClick ? `color: ${darken(darkenOnHoverAmount, props.theme[props.fontColor || 'white'])}` : ''};
+ ${props => (props.onClick ? `opacity: ${opacityOnHoverAmount};` : '')};
}
}
`;
diff --git a/packages/instant/src/components/wallet_prompt.tsx b/packages/instant/src/components/wallet_prompt.tsx
index a0b3ae457..10433767f 100644
--- a/packages/instant/src/components/wallet_prompt.tsx
+++ b/packages/instant/src/components/wallet_prompt.tsx
@@ -21,7 +21,7 @@ export const WalletPrompt: React.StatelessComponent<WalletPromptProps> = ({
primaryColor,
}) => (
<Container
- padding="14.5px"
+ padding="10px"
border={`1px solid ${primaryColor}`}
backgroundColor={secondaryColor}
width="100%"
@@ -33,7 +33,7 @@ export const WalletPrompt: React.StatelessComponent<WalletPromptProps> = ({
<Flex>
{image}
<Container marginLeft="10px">
- <Text fontSize="16px" fontColor={primaryColor}>
+ <Text fontSize="16px" fontColor={primaryColor} fontWeight="500">
{children}
</Text>
</Container>
@@ -45,3 +45,5 @@ WalletPrompt.defaultProps = {
primaryColor: ColorOption.darkOrange,
secondaryColor: ColorOption.lightOrange,
};
+
+WalletPrompt.displayName = 'WalletPrompt';
diff --git a/packages/instant/src/components/zero_ex_instant.tsx b/packages/instant/src/components/zero_ex_instant.tsx
index 2267b4dbf..e9cb48e61 100644
--- a/packages/instant/src/components/zero_ex_instant.tsx
+++ b/packages/instant/src/components/zero_ex_instant.tsx
@@ -17,3 +17,5 @@ export const ZeroExInstant: React.StatelessComponent<ZeroExInstantProps> = props
</div>
);
};
+
+ZeroExInstant.displayName = 'ZeroExInstant';
diff --git a/packages/instant/src/components/zero_ex_instant_container.tsx b/packages/instant/src/components/zero_ex_instant_container.tsx
index 47c938472..e8c64d5d1 100644
--- a/packages/instant/src/components/zero_ex_instant_container.tsx
+++ b/packages/instant/src/components/zero_ex_instant_container.tsx
@@ -11,21 +11,23 @@ import { SelectedAssetBuyOrderStateButtons } from '../containers/selected_asset_
import { SelectedAssetInstantHeading } from '../containers/selected_asset_instant_heading';
import { ColorOption } from '../style/theme';
import { zIndex } from '../style/z_index';
-import { OrderProcessState, SlideAnimationState } from '../types';
+import { SlideAnimationState } from '../types';
+import { analytics, TokenSelectorClosedVia } from '../util/analytics';
import { CSSReset } from './css_reset';
import { SlidingPanel } from './sliding_panel';
import { Container } from './ui/container';
import { Flex } from './ui/flex';
-export interface ZeroExInstantContainerProps {
- orderProcessState: OrderProcessState;
-}
+export interface ZeroExInstantContainerProps {}
export interface ZeroExInstantContainerState {
tokenSelectionPanelAnimationState: SlideAnimationState;
}
-export class ZeroExInstantContainer extends React.Component<{}, ZeroExInstantContainerState> {
+export class ZeroExInstantContainer extends React.PureComponent<
+ ZeroExInstantContainerProps,
+ ZeroExInstantContainerState
+> {
public state = {
tokenSelectionPanelAnimationState: 'none' as SlideAnimationState,
};
@@ -60,9 +62,10 @@ export class ZeroExInstantContainer extends React.Component<{}, ZeroExInstantCon
</Flex>
<SlidingPanel
animationState={this.state.tokenSelectionPanelAnimationState}
- onClose={this._handlePanelClose}
+ onClose={this._handlePanelCloseClickedX}
+ onAnimationEnd={this._handleSlidingPanelAnimationEnd}
>
- <AvailableERC20TokenSelector onTokenSelect={this._handlePanelClose} />
+ <AvailableERC20TokenSelector onTokenSelect={this._handlePanelCloseAfterChose} />
</SlidingPanel>
<CurrentStandardSlidingPanel />
</Container>
@@ -71,7 +74,7 @@ export class ZeroExInstantContainer extends React.Component<{}, ZeroExInstantCon
marginTop="10px"
marginLeft="auto"
marginRight="auto"
- width="140px"
+ width="108px"
>
<a href={ZERO_EX_SITE_URL} target="_blank">
<PoweredByLogo />
@@ -82,13 +85,28 @@ export class ZeroExInstantContainer extends React.Component<{}, ZeroExInstantCon
);
}
private readonly _handleSymbolClick = (): void => {
+ analytics.trackTokenSelectorOpened();
this.setState({
tokenSelectionPanelAnimationState: 'slidIn',
});
};
- private readonly _handlePanelClose = (): void => {
+ private readonly _handlePanelCloseClickedX = (): void => {
+ this._handlePanelClose(TokenSelectorClosedVia.ClickedX);
+ };
+ private readonly _handlePanelCloseAfterChose = (): void => {
+ this._handlePanelClose(TokenSelectorClosedVia.TokenChose);
+ };
+ private readonly _handlePanelClose = (closedVia: TokenSelectorClosedVia): void => {
+ analytics.trackTokenSelectorClosed(closedVia);
this.setState({
tokenSelectionPanelAnimationState: 'slidOut',
});
};
+ private readonly _handleSlidingPanelAnimationEnd = (): void => {
+ if (this.state.tokenSelectionPanelAnimationState === 'slidOut') {
+ // When the slidOut animation completes, don't keep the panel mounted.
+ // Performance optimization
+ this.setState({ tokenSelectionPanelAnimationState: 'none' });
+ }
+ };
}
diff --git a/packages/instant/src/components/zero_ex_instant_overlay.tsx b/packages/instant/src/components/zero_ex_instant_overlay.tsx
index 2856ea3e3..38a716091 100644
--- a/packages/instant/src/components/zero_ex_instant_overlay.tsx
+++ b/packages/instant/src/components/zero_ex_instant_overlay.tsx
@@ -1,6 +1,7 @@
import * as React from 'react';
import { ZeroExInstantContainer } from '../components/zero_ex_instant_container';
+import { MAIN_CONTAINER_DIV_CLASS, OVERLAY_CLOSE_BUTTON_DIV_CLASS, OVERLAY_DIV_CLASS } from '../constants';
import { ColorOption } from '../style/theme';
import { Container } from './ui/container';
@@ -18,9 +19,15 @@ export const ZeroExInstantOverlay: React.StatelessComponent<ZeroExInstantOverlay
const { onClose, zIndex, ...rest } = props;
return (
<ZeroExInstantProvider {...rest}>
- <Overlay zIndex={zIndex}>
+ <Overlay zIndex={zIndex} className={OVERLAY_DIV_CLASS}>
<Flex height="100vh">
- <Container position="absolute" top="0px" right="0px" display={{ default: 'initial', sm: 'none' }}>
+ <Container
+ className={OVERLAY_CLOSE_BUTTON_DIV_CLASS}
+ position="absolute"
+ top="0px"
+ right="0px"
+ display={{ default: 'initial', sm: 'none' }}
+ >
<Icon
height={18}
width={18}
@@ -30,7 +37,11 @@ export const ZeroExInstantOverlay: React.StatelessComponent<ZeroExInstantOverlay
padding="2em 2em"
/>
</Container>
- <Container width={{ default: 'auto', sm: '100%' }} height={{ default: 'auto', sm: '100%' }}>
+ <Container
+ width={{ default: 'auto', sm: '100%' }}
+ height={{ default: 'auto', sm: '100%' }}
+ className={MAIN_CONTAINER_DIV_CLASS}
+ >
<ZeroExInstantContainer />
</Container>
</Flex>
@@ -38,3 +49,5 @@ export const ZeroExInstantOverlay: React.StatelessComponent<ZeroExInstantOverlay
</ZeroExInstantProvider>
);
};
+
+ZeroExInstantOverlay.displayName = 'ZeroExInstantOverlay';
diff --git a/packages/instant/src/components/zero_ex_instant_provider.tsx b/packages/instant/src/components/zero_ex_instant_provider.tsx
index 9435d8c7c..ec8e82ee3 100644
--- a/packages/instant/src/components/zero_ex_instant_provider.tsx
+++ b/packages/instant/src/components/zero_ex_instant_provider.tsx
@@ -1,6 +1,4 @@
-import { ObjectMap } from '@0x/types';
import { BigNumber } from '@0x/utils';
-import { Provider } from 'ethereum-types';
import * as _ from 'lodash';
import * as React from 'react';
import { Provider as ReduxProvider } from 'react-redux';
@@ -11,36 +9,19 @@ import { asyncData } from '../redux/async_data';
import { DEFAULT_STATE, DefaultState, State } from '../redux/reducer';
import { store, Store } from '../redux/store';
import { fonts } from '../style/fonts';
-import { AccountState, AffiliateInfo, AssetMetaData, Network, OrderSource } from '../types';
+import { AccountState, Network, QuoteFetchOrigin, ZeroExInstantBaseConfig } from '../types';
import { analytics, disableAnalytics } from '../util/analytics';
import { assetUtils } from '../util/asset';
import { errorFlasher } from '../util/error_flasher';
+import { setupRollbar } from '../util/error_reporter';
import { gasPriceEstimator } from '../util/gas_price_estimator';
import { Heartbeater } from '../util/heartbeater';
import { generateAccountHeartbeater, generateBuyQuoteHeartbeater } from '../util/heartbeater_factory';
import { providerStateFactory } from '../util/provider_state_factory';
-fonts.include();
+export type ZeroExInstantProviderProps = ZeroExInstantBaseConfig;
-export type ZeroExInstantProviderProps = ZeroExInstantProviderRequiredProps &
- Partial<ZeroExInstantProviderOptionalProps>;
-
-export interface ZeroExInstantProviderRequiredProps {
- orderSource: OrderSource;
-}
-
-export interface ZeroExInstantProviderOptionalProps {
- provider: Provider;
- availableAssetDatas: string[];
- defaultAssetBuyAmount: number;
- defaultSelectedAssetData: string;
- additionalAssetMetaDataMap: ObjectMap<AssetMetaData>;
- networkId: Network;
- affiliateInfo: AffiliateInfo;
- shouldDisableAnalyticsTracking: boolean;
-}
-
-export class ZeroExInstantProvider extends React.Component<ZeroExInstantProviderProps> {
+export class ZeroExInstantProvider extends React.PureComponent<ZeroExInstantProviderProps> {
private readonly _store: Store;
private _accountUpdateHeartbeat?: Heartbeater;
private _buyQuoteHeartbeat?: Heartbeater;
@@ -57,10 +38,12 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
props.orderSource,
networkId,
props.provider,
+ props.walletDisplayName,
);
// merge the additional additionalAssetMetaDataMap with our default map
const completeAssetMetaDataMap = {
- ...props.additionalAssetMetaDataMap,
+ // Make sure the passed in assetDatas are lower case
+ ..._.mapKeys(props.additionalAssetMetaDataMap || {}, (value, key) => key.toLowerCase()),
...defaultState.assetMetaDataMap,
};
// construct the final state
@@ -68,6 +51,7 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
...defaultState,
providerState,
network: networkId,
+ walletDisplayName: props.walletDisplayName,
selectedAsset: _.isUndefined(props.defaultSelectedAssetData)
? undefined
: assetUtils.createAssetFromAssetDataOrThrow(
@@ -88,6 +72,8 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
}
constructor(props: ZeroExInstantProviderProps) {
super(props);
+ setupRollbar();
+ fonts.include();
const initialAppState = ZeroExInstantProvider._mergeDefaultStateWithProps(this.props);
this._store = store.create(initialAppState);
}
@@ -116,7 +102,9 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
this._buyQuoteHeartbeat.start(BUY_QUOTE_UPDATE_INTERVAL_TIME_MS);
// Trigger first buyquote fetch
// tslint:disable-next-line:no-floating-promises
- asyncData.fetchCurrentBuyQuoteAndDispatchToStore(state, dispatch, { updateSilently: false });
+ asyncData.fetchCurrentBuyQuoteAndDispatchToStore(state, dispatch, QuoteFetchOrigin.Manual, {
+ updateSilently: false,
+ });
// warm up the gas price estimator cache just in case we can't
// grab the gas price estimate when submitting the transaction
// tslint:disable-next-line:no-floating-promises
@@ -126,14 +114,17 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
// Analytics
disableAnalytics(this.props.shouldDisableAnalyticsTracking || false);
- analytics.addEventProperties({
- embeddedHost: window.location.host,
- embeddedUrl: window.location.href,
- networkId: state.network,
- providerName: state.providerState.name,
- gitSha: process.env.GIT_SHA,
- npmVersion: process.env.NPM_PACKAGE_VERSION,
- });
+ analytics.addEventProperties(
+ analytics.generateEventProperties(
+ state.network,
+ this.props.orderSource,
+ state.providerState,
+ window,
+ state.selectedAsset,
+ this.props.affiliateInfo,
+ state.baseCurrency,
+ ),
+ );
analytics.trackInstantOpened();
}
public componentWillUnmount(): void {
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
index be6077ca9..22f0cb6a4 100644
--- a/packages/instant/src/constants.ts
+++ b/packages/instant/src/constants.ts
@@ -7,19 +7,42 @@ export const ETH_DECIMALS = 18;
export const DEFAULT_ZERO_EX_CONTAINER_SELECTOR = '#zeroExInstantContainer';
export const INJECTED_DIV_CLASS = 'zeroExInstantResetRoot';
export const INJECTED_DIV_ID = 'zeroExInstant';
+export const OVERLAY_DIV_CLASS = 'zeroExInstantOverlay';
+export const OVERLAY_CLOSE_BUTTON_DIV_CLASS = 'zeroExInstantOverlayCloseButton';
+export const MAIN_CONTAINER_DIV_CLASS = 'zeroExInstantMainContainer';
export const WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX = 'Transaction failed';
export const GWEI_IN_WEI = new BigNumber(1000000000);
export const ONE_SECOND_MS = 1000;
export const ONE_MINUTE_MS = ONE_SECOND_MS * 60;
+export const GIT_SHA = process.env.GIT_SHA;
+export const NODE_ENV = process.env.NODE_ENV;
+export const NPM_PACKAGE_VERSION = process.env.NPM_PACKAGE_VERSION;
+export const DEFAULT_UNKOWN_ASSET_NAME = '???';
export const ACCOUNT_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 5;
export const BUY_QUOTE_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 15;
export const DEFAULT_GAS_PRICE = GWEI_IN_WEI.mul(6);
export const DEFAULT_ESTIMATED_TRANSACTION_TIME_MS = ONE_MINUTE_MS * 2;
+export const MAGIC_TRIGGER_ERROR_INPUT = '0€';
+export const MAGIC_TRIGGER_ERROR_MESSAGE = 'Triggered error';
export const ETH_GAS_STATION_API_BASE_URL = 'https://ethgasstation.info';
export const HEAP_ANALYTICS_ID = process.env.HEAP_ANALYTICS_ID;
+export const HEAP_ENABLED = process.env.HEAP_ENABLED;
export const COINBASE_API_BASE_URL = 'https://api.coinbase.com/v2';
export const PROGRESS_STALL_AT_WIDTH = '95%';
export const PROGRESS_FINISH_ANIMATION_TIME_MS = 200;
+export const HOST_DOMAINS_EXTERNAL = [
+ '0x-instant-staging.s3-website-us-east-1.amazonaws.com',
+ '0x-instant-dogfood.s3-website-us-east-1.amazonaws.com',
+ 'instant.0xproject.com',
+];
+export const HOST_DOMAINS_LOCAL = ['localhost', '127.0.0.1', '0.0.0.0'];
+export const ROLLBAR_CLIENT_TOKEN = process.env.ROLLBAR_CLIENT_TOKEN;
+export const ROLLBAR_ENABLED = process.env.ROLLBAR_ENABLED;
+export const INSTANT_DISCHARGE_TARGET = process.env.INSTANT_DISCHARGE_TARGET as
+ | 'production'
+ | 'dogfood'
+ | 'staging'
+ | undefined;
export const COINBASE_WALLET_IOS_APP_STORE_URL = 'https://itunes.apple.com/us/app/coinbase-wallet/id1278383455?mt=8';
export const COINBASE_WALLET_ANDROID_APP_STORE_URL = 'https://play.google.com/store/apps/details?id=org.toshi&hl=en';
export const COINBASE_WALLET_SITE_URL = 'https://wallet.coinbase.com/';
@@ -49,5 +72,6 @@ export const PROVIDER_TYPE_TO_NAME: { [key in ProviderType]: string } = {
[ProviderType.Mist]: 'Mist',
[ProviderType.CoinbaseWallet]: 'Coinbase Wallet',
[ProviderType.Parity]: 'Parity',
+ [ProviderType.TrustWallet]: 'Trust Wallet',
[ProviderType.Fallback]: 'Fallback',
};
diff --git a/packages/instant/src/containers/connected_account_payment_method.ts b/packages/instant/src/containers/connected_account_payment_method.ts
index eacbadfca..f648f0b54 100644
--- a/packages/instant/src/containers/connected_account_payment_method.ts
+++ b/packages/instant/src/containers/connected_account_payment_method.ts
@@ -11,7 +11,8 @@ import {
import { Action, actions } from '../redux/actions';
import { asyncData } from '../redux/async_data';
import { State } from '../redux/reducer';
-import { Network, Omit, OperatingSystem, ProviderState, StandardSlidingPanelContent } from '../types';
+import { Network, Omit, OperatingSystem, ProviderState, StandardSlidingPanelContent, WalletSuggestion } from '../types';
+import { analytics } from '../util/analytics';
import { envUtil } from '../util/env';
export interface ConnectedAccountPaymentMethodProps {}
@@ -19,6 +20,7 @@ export interface ConnectedAccountPaymentMethodProps {}
interface ConnectedState {
network: Network;
providerState: ProviderState;
+ walletDisplayName?: string;
}
interface ConnectedDispatch {
@@ -33,6 +35,7 @@ type FinalProps = ConnectedProps & ConnectedAccountPaymentMethodProps;
const mapStateToProps = (state: State, _ownProps: ConnectedAccountPaymentMethodProps): ConnectedState => ({
network: state.network,
providerState: state.providerState,
+ walletDisplayName: state.walletDisplayName,
});
const mapDispatchToProps = (
@@ -40,8 +43,11 @@ const mapDispatchToProps = (
ownProps: ConnectedAccountPaymentMethodProps,
): ConnectedDispatch => ({
openInstallWalletPanel: () => dispatch(actions.openStandardSlidingPanel(StandardSlidingPanelContent.InstallWallet)),
- unlockWalletAndDispatchToStore: async (providerState: ProviderState) =>
- asyncData.fetchAccountInfoAndDispatchToStore(providerState, dispatch, true),
+ unlockWalletAndDispatchToStore: (providerState: ProviderState) => {
+ analytics.trackAccountUnlockRequested();
+ // tslint:disable-next-line:no-floating-promises
+ asyncData.fetchAccountInfoAndDispatchToStore(providerState, dispatch, true);
+ },
});
const mergeProps = (
@@ -52,27 +58,32 @@ const mergeProps = (
...ownProps,
network: connectedState.network,
account: connectedState.providerState.account,
- walletName: connectedState.providerState.name,
+ walletDisplayName: connectedState.providerState.displayName,
onUnlockWalletClick: () => connectedDispatch.unlockWalletAndDispatchToStore(connectedState.providerState),
onInstallWalletClick: () => {
const isMobile = envUtil.isMobileOperatingSystem();
- if (!isMobile) {
+ const walletSuggestion: WalletSuggestion = isMobile
+ ? WalletSuggestion.CoinbaseWallet
+ : WalletSuggestion.MetaMask;
+
+ analytics.trackInstallWalletClicked(walletSuggestion);
+ if (walletSuggestion === WalletSuggestion.MetaMask) {
connectedDispatch.openInstallWalletPanel();
- return;
- }
- const operatingSystem = envUtil.getOperatingSystem();
- let url = COINBASE_WALLET_SITE_URL;
- switch (operatingSystem) {
- case OperatingSystem.Android:
- url = COINBASE_WALLET_ANDROID_APP_STORE_URL;
- break;
- case OperatingSystem.iOS:
- url = COINBASE_WALLET_IOS_APP_STORE_URL;
- break;
- default:
- break;
+ } else {
+ const operatingSystem = envUtil.getOperatingSystem();
+ let url = COINBASE_WALLET_SITE_URL;
+ switch (operatingSystem) {
+ case OperatingSystem.Android:
+ url = COINBASE_WALLET_ANDROID_APP_STORE_URL;
+ break;
+ case OperatingSystem.iOS:
+ url = COINBASE_WALLET_IOS_APP_STORE_URL;
+ break;
+ default:
+ break;
+ }
+ window.open(url, '_blank');
}
- window.open(url, '_blank');
},
});
diff --git a/packages/instant/src/containers/latest_buy_quote_order_details.ts b/packages/instant/src/containers/latest_buy_quote_order_details.ts
index 5dfe535e7..148735c47 100644
--- a/packages/instant/src/containers/latest_buy_quote_order_details.ts
+++ b/packages/instant/src/containers/latest_buy_quote_order_details.ts
@@ -1,32 +1,41 @@
-import { BuyQuoteInfo } from '@0x/asset-buyer';
-import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
import * as React from 'react';
import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
import { oc } from 'ts-optchain';
+import { Action, actions } from '../redux/actions';
import { State } from '../redux/reducer';
-import { OrderDetails } from '../components/order_details';
-import { AsyncProcessState } from '../types';
+import { OrderDetails, OrderDetailsProps } from '../components/order_details';
+import { AsyncProcessState, BaseCurrency, Omit } from '../types';
+import { assetUtils } from '../util/asset';
-export interface LatestBuyQuoteOrderDetailsProps {}
-
-interface ConnectedState {
- buyQuoteInfo?: BuyQuoteInfo;
- selectedAssetUnitAmount?: BigNumber;
- ethUsdPrice?: BigNumber;
- isLoading: boolean;
-}
+type DispatchProperties = 'onBaseCurrencySwitchEth' | 'onBaseCurrencySwitchUsd';
+interface ConnectedState extends Omit<OrderDetailsProps, DispatchProperties> {}
const mapStateToProps = (state: State, _ownProps: LatestBuyQuoteOrderDetailsProps): ConnectedState => ({
// use the worst case quote info
buyQuoteInfo: oc(state).latestBuyQuote.worstCaseQuoteInfo(),
selectedAssetUnitAmount: state.selectedAssetUnitAmount,
ethUsdPrice: state.ethUsdPrice,
isLoading: state.quoteRequestState === AsyncProcessState.Pending,
+ assetName: assetUtils.bestNameForAsset(state.selectedAsset),
+ baseCurrency: state.baseCurrency,
});
+interface ConnectedDispatch extends Pick<OrderDetailsProps, DispatchProperties> {}
+const mapDispatchToProps = (dispatch: Dispatch<Action>): ConnectedDispatch => ({
+ onBaseCurrencySwitchEth: () => {
+ dispatch(actions.updateBaseCurrency(BaseCurrency.ETH));
+ },
+ onBaseCurrencySwitchUsd: () => {
+ dispatch(actions.updateBaseCurrency(BaseCurrency.USD));
+ },
+});
+
+export interface LatestBuyQuoteOrderDetailsProps {}
export const LatestBuyQuoteOrderDetails: React.ComponentClass<LatestBuyQuoteOrderDetailsProps> = connect(
mapStateToProps,
+ mapDispatchToProps,
)(OrderDetails);
diff --git a/packages/instant/src/containers/latest_error.tsx b/packages/instant/src/containers/latest_error.tsx
index b7cfdb504..6da4558ef 100644
--- a/packages/instant/src/containers/latest_error.tsx
+++ b/packages/instant/src/containers/latest_error.tsx
@@ -4,6 +4,7 @@ import { connect } from 'react-redux';
import { Dispatch } from 'redux';
import { SlidingError } from '../components/sliding_error';
+import { Container } from '../components/ui/container';
import { Overlay } from '../components/ui/overlay';
import { Action } from '../redux/actions';
import { State } from '../redux/reducer';
@@ -13,7 +14,7 @@ import { zIndex } from '../style/z_index';
import { Asset, DisplayStatus, Omit, SlideAnimationState } from '../types';
import { errorFlasher } from '../util/error_flasher';
-export interface LatestErrorComponentProps {
+interface LatestErrorComponentProps {
asset?: Asset;
latestErrorMessage?: string;
animationState: SlideAnimationState;
@@ -21,9 +22,14 @@ export interface LatestErrorComponentProps {
onOverlayClick: () => void;
}
-export const LatestErrorComponent: React.StatelessComponent<LatestErrorComponentProps> = props => {
+const LatestErrorComponent: React.StatelessComponent<LatestErrorComponentProps> = props => {
if (!props.latestErrorMessage) {
- return <div />;
+ // Render a hidden SlidingError such that instant does not move when a real error is rendered.
+ return (
+ <Container isHidden={true}>
+ <SlidingError animationState="slidIn" icon="😢" message="" />
+ </Container>
+ );
}
return (
<React.Fragment>
diff --git a/packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts b/packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts
index 610335243..4da99cf04 100644
--- a/packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts
+++ b/packages/instant/src/containers/selected_asset_buy_order_state_buttons.ts
@@ -9,7 +9,8 @@ import { Dispatch } from 'redux';
import { BuyOrderStateButtons } from '../components/buy_order_state_buttons';
import { Action, actions } from '../redux/actions';
import { State } from '../redux/reducer';
-import { AccountState, AffiliateInfo, OrderProcessState, ZeroExInstantError } from '../types';
+import { AccountState, AffiliateInfo, Asset, OrderProcessState, ZeroExInstantError } from '../types';
+import { analytics } from '../util/analytics';
import { errorFlasher } from '../util/error_flasher';
import { etherscanUtil } from '../util/etherscan';
@@ -21,6 +22,7 @@ interface ConnectedState {
assetBuyer: AssetBuyer;
web3Wrapper: Web3Wrapper;
affiliateInfo?: AffiliateInfo;
+ selectedAsset?: Asset;
onViewTransaction: () => void;
}
@@ -40,6 +42,7 @@ const mapStateToProps = (state: State, _ownProps: SelectedAssetBuyOrderStateButt
const account = state.providerState.account;
const accountAddress = account.state === AccountState.Ready ? account.address : undefined;
const accountEthBalanceInWei = account.state === AccountState.Ready ? account.ethBalanceInWei : undefined;
+ const selectedAsset = state.selectedAsset;
return {
accountAddress,
accountEthBalanceInWei,
@@ -48,6 +51,7 @@ const mapStateToProps = (state: State, _ownProps: SelectedAssetBuyOrderStateButt
web3Wrapper,
buyQuote: state.latestBuyQuote,
affiliateInfo: state.affiliateInfo,
+ selectedAsset,
onViewTransaction: () => {
if (
state.buyOrderState.processState === OrderProcessState.Processing ||
@@ -59,6 +63,8 @@ const mapStateToProps = (state: State, _ownProps: SelectedAssetBuyOrderStateButt
assetBuyer.networkId,
);
if (etherscanUrl) {
+ analytics.trackTransactionViewed(state.buyOrderState.processState);
+
window.open(etherscanUrl, '_blank');
return;
}
@@ -89,6 +95,9 @@ const mapDispatchToProps = (
if (error === ZeroExInstantError.InsufficientETH) {
const errorMessage = "You don't have enough ETH";
errorFlasher.flashNewErrorMessage(dispatch, errorMessage);
+ } else if (error === ZeroExInstantError.CouldNotSubmitTransaction) {
+ const errorMessage = 'Could not submit transaction';
+ errorFlasher.flashNewErrorMessage(dispatch, errorMessage);
} else {
errorFlasher.flashNewErrorMessage(dispatch);
}
diff --git a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
index a39bc46a2..cb9df527e 100644
--- a/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
+++ b/packages/instant/src/containers/selected_erc20_asset_amount_input.ts
@@ -10,7 +10,7 @@ import { ERC20AssetAmountInput, ERC20AssetAmountInputProps } from '../components
import { Action, actions } from '../redux/actions';
import { State } from '../redux/reducer';
import { ColorOption } from '../style/theme';
-import { AffiliateInfo, ERC20Asset, Omit, OrderProcessState } from '../types';
+import { AffiliateInfo, ERC20Asset, Omit, OrderProcessState, QuoteFetchOrigin } from '../types';
import { buyQuoteUpdater } from '../util/buy_quote_updater';
export interface SelectedERC20AssetAmountInputProps {
@@ -88,7 +88,7 @@ const mapDispatchToProps = (
// even if it's debounced, give them the illusion it's loading
dispatch(actions.setQuoteRequestStatePending());
// tslint:disable-next-line:no-floating-promises
- debouncedUpdateBuyQuoteAsync(assetBuyer, dispatch, asset, value, {
+ debouncedUpdateBuyQuoteAsync(assetBuyer, dispatch, asset, value, QuoteFetchOrigin.Manual, {
setPending: true,
dispatchErrors: true,
affiliateInfo,
diff --git a/packages/instant/src/data/asset_meta_data_map.ts b/packages/instant/src/data/asset_meta_data_map.ts
index b24c9c83d..88611a8c0 100644
--- a/packages/instant/src/data/asset_meta_data_map.ts
+++ b/packages/instant/src/data/asset_meta_data_map.ts
@@ -83,14 +83,14 @@ export const assetMetaDataMap: ObjectMap<AssetMetaData> = {
'0xf47261b0000000000000000000000000e0b7927c4af23765cb51314a0e0521a9645f0e2a': {
assetProxyId: AssetProxyId.ERC20,
decimals: 9,
- primaryColor: '#DEB564',
+ primaryColor: '#E1AA3E',
symbol: 'dgd',
name: 'DigixDao',
},
'0xf47261b00000000000000000000000004f3afec4e5a3f2a6a1a411def7d7dfe50ee057bf': {
assetProxyId: AssetProxyId.ERC20,
decimals: 9,
- primaryColor: '#DEB564',
+ primaryColor: '#E1AA3E',
symbol: 'dgx',
name: 'Digix Gold Token',
},
@@ -195,7 +195,7 @@ export const assetMetaDataMap: ObjectMap<AssetMetaData> = {
'0xf47261b000000000000000000000000089d24a6b4ccb1b6faa2625fe562bdd9a23260359': {
assetProxyId: AssetProxyId.ERC20,
decimals: 18,
- primaryColor: '#F2B350',
+ primaryColor: '#DEA349',
symbol: 'dai',
name: 'Dai Stablecoin',
},
diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts
index 5010347b3..d172f4145 100644
--- a/packages/instant/src/index.umd.ts
+++ b/packages/instant/src/index.umd.ts
@@ -2,43 +2,63 @@ import * as _ from 'lodash';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
-import { DEFAULT_ZERO_EX_CONTAINER_SELECTOR, INJECTED_DIV_CLASS, INJECTED_DIV_ID } from './constants';
+import {
+ DEFAULT_ZERO_EX_CONTAINER_SELECTOR,
+ GIT_SHA as GIT_SHA_FROM_CONSTANT,
+ INJECTED_DIV_CLASS,
+ INJECTED_DIV_ID,
+ NPM_PACKAGE_VERSION,
+} from './constants';
import { ZeroExInstantOverlay, ZeroExInstantOverlayProps } from './index';
+import { analytics } from './util/analytics';
import { assert } from './util/assert';
+import { util } from './util/util';
-export const render = (props: ZeroExInstantOverlayProps, selector: string = DEFAULT_ZERO_EX_CONTAINER_SELECTOR) => {
- assert.isValidOrderSource('orderSource', props.orderSource);
- if (!_.isUndefined(props.defaultSelectedAssetData)) {
- assert.isHexString('defaultSelectedAssetData', props.defaultSelectedAssetData);
+const isInstantRendered = (): boolean => !!document.getElementById(INJECTED_DIV_ID);
+
+const validateInstantRenderConfig = (config: ZeroExInstantConfig, selector: string) => {
+ assert.isValidOrderSource('orderSource', config.orderSource);
+ if (!_.isUndefined(config.defaultSelectedAssetData)) {
+ assert.isHexString('defaultSelectedAssetData', config.defaultSelectedAssetData);
+ }
+ if (!_.isUndefined(config.additionalAssetMetaDataMap)) {
+ assert.isValidAssetMetaDataMap('additionalAssetMetaDataMap', config.additionalAssetMetaDataMap);
}
- if (!_.isUndefined(props.additionalAssetMetaDataMap)) {
- assert.isValidAssetMetaDataMap('props.additionalAssetMetaDataMap', props.additionalAssetMetaDataMap);
+ if (!_.isUndefined(config.defaultAssetBuyAmount)) {
+ assert.isNumber('defaultAssetBuyAmount', config.defaultAssetBuyAmount);
}
- if (!_.isUndefined(props.defaultAssetBuyAmount)) {
- assert.isNumber('props.defaultAssetBuyAmount', props.defaultAssetBuyAmount);
+ if (!_.isUndefined(config.networkId)) {
+ assert.isNumber('networkId', config.networkId);
}
- if (!_.isUndefined(props.networkId)) {
- assert.isNumber('props.networkId', props.networkId);
+ if (!_.isUndefined(config.availableAssetDatas)) {
+ assert.areValidAssetDatas('availableAssetDatas', config.availableAssetDatas);
}
- if (!_.isUndefined(props.availableAssetDatas)) {
- assert.areValidAssetDatas('availableAssetDatas', props.availableAssetDatas);
+ if (!_.isUndefined(config.onClose)) {
+ assert.isFunction('onClose', config.onClose);
}
- if (!_.isUndefined(props.onClose)) {
- assert.isFunction('props.onClose', props.onClose);
+ if (!_.isUndefined(config.zIndex)) {
+ assert.isNumber('zIndex', config.zIndex);
}
- if (!_.isUndefined(props.zIndex)) {
- assert.isNumber('props.zIndex', props.zIndex);
+ if (!_.isUndefined(config.affiliateInfo)) {
+ assert.isValidAffiliateInfo('affiliateInfo', config.affiliateInfo);
}
- if (!_.isUndefined(props.affiliateInfo)) {
- assert.isValidAffiliateInfo('props.affiliateInfo', props.affiliateInfo);
+ if (!_.isUndefined(config.provider)) {
+ assert.isWeb3Provider('provider', config.provider);
}
- if (!_.isUndefined(props.provider)) {
- assert.isWeb3Provider('props.provider', props.provider);
+ if (!_.isUndefined(config.walletDisplayName)) {
+ assert.isString('walletDisplayName', config.walletDisplayName);
}
- if (!_.isUndefined(props.shouldDisableAnalyticsTracking)) {
- assert.isBoolean('props.shouldDisableAnalyticsTracking', props.shouldDisableAnalyticsTracking);
+ if (!_.isUndefined(config.shouldDisablePushToHistory)) {
+ assert.isBoolean('shouldDisablePushToHistory', config.shouldDisablePushToHistory);
+ }
+ if (!_.isUndefined(config.shouldDisableAnalyticsTracking)) {
+ assert.isBoolean('shouldDisableAnalyticsTracking', config.shouldDisableAnalyticsTracking);
}
assert.isString('selector', selector);
+};
+
+// Render instant and return a callback that allows you to remove it from the DOM.
+const renderInstant = (config: ZeroExInstantConfig, selector: string) => {
const appendToIfExists = document.querySelector(selector);
assert.assert(!_.isNull(appendToIfExists), `Could not find div with selector: ${selector}`);
const appendTo = appendToIfExists as Element;
@@ -46,14 +66,62 @@ export const render = (props: ZeroExInstantOverlayProps, selector: string = DEFA
injectedDiv.setAttribute('id', INJECTED_DIV_ID);
injectedDiv.setAttribute('class', INJECTED_DIV_CLASS);
appendTo.appendChild(injectedDiv);
+ const closeInstant = () => {
+ analytics.trackInstantClosed();
+ if (!_.isUndefined(config.onClose)) {
+ config.onClose();
+ }
+ appendTo.removeChild(injectedDiv);
+ };
const instantOverlayProps = {
- ...props,
- onClose: () => {
- appendTo.removeChild(injectedDiv);
- if (!_.isUndefined(props.onClose)) {
- props.onClose();
- }
- },
+ ...config,
+ // If we are using the history API, just go back to close
+ onClose: () => (config.shouldDisablePushToHistory ? closeInstant() : window.history.back()),
};
ReactDOM.render(React.createElement(ZeroExInstantOverlay, instantOverlayProps), injectedDiv);
+ return closeInstant;
};
+
+export interface ZeroExInstantConfig extends ZeroExInstantOverlayProps {
+ shouldDisablePushToHistory?: boolean;
+}
+
+export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_ZERO_EX_CONTAINER_SELECTOR) => {
+ validateInstantRenderConfig(config, selector);
+ if (config.shouldDisablePushToHistory) {
+ if (!isInstantRendered()) {
+ renderInstant(config, selector);
+ }
+ return;
+ }
+ // Before we render, push to history saying that instant is showing for this part of the history.
+ window.history.pushState({ zeroExInstantShowing: true }, '0x Instant');
+ let removeInstant = renderInstant(config, selector);
+ // If the integrator defined a popstate handler, save it to __zeroExInstantIntegratorsPopStateHandler
+ // unless we have already done so on a previous render.
+ const anyWindow = window as any;
+ const popStateExistsAndNotSetPreviously = window.onpopstate && !anyWindow.__zeroExInstantIntegratorsPopStateHandler;
+ anyWindow.__zeroExInstantIntegratorsPopStateHandler = popStateExistsAndNotSetPreviously
+ ? anyWindow.onpopstate.bind(window)
+ : util.boundNoop;
+ const onPopStateHandler = (e: PopStateEvent) => {
+ anyWindow.__zeroExInstantIntegratorsPopStateHandler(e);
+ const newState = e.state;
+ if (newState && newState.zeroExInstantShowing) {
+ // We have returned to a history state that expects instant to be rendered.
+ if (!isInstantRendered()) {
+ removeInstant = renderInstant(config, selector);
+ }
+ } else {
+ // History has changed to a different state.
+ if (isInstantRendered()) {
+ removeInstant();
+ }
+ }
+ };
+ window.onpopstate = onPopStateHandler;
+};
+
+// Write version info to the exported object for debugging
+export const GIT_SHA = GIT_SHA_FROM_CONSTANT;
+export const NPM_VERSION = NPM_PACKAGE_VERSION;
diff --git a/packages/instant/src/redux/actions.ts b/packages/instant/src/redux/actions.ts
index 77e3dec12..9d7a61fc7 100644
--- a/packages/instant/src/redux/actions.ts
+++ b/packages/instant/src/redux/actions.ts
@@ -2,7 +2,7 @@ import { BuyQuote } from '@0x/asset-buyer';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
-import { ActionsUnion, AddressAndEthBalanceInWei, Asset, StandardSlidingPanelContent } from '../types';
+import { ActionsUnion, AddressAndEthBalanceInWei, Asset, BaseCurrency, StandardSlidingPanelContent } from '../types';
export interface PlainAction<T extends string> {
type: T;
@@ -43,6 +43,7 @@ export enum ActionTypes {
RESET_AMOUNT = 'RESET_AMOUNT',
OPEN_STANDARD_SLIDING_PANEL = 'OPEN_STANDARD_SLIDING_PANEL',
CLOSE_STANDARD_SLIDING_PANEL = 'CLOSE_STANDARD_SLIDING_PANEL',
+ UPDATE_BASE_CURRENCY = 'UPDATE_BASE_CURRENCY',
}
export const actions = {
@@ -72,4 +73,5 @@ export const actions = {
openStandardSlidingPanel: (content: StandardSlidingPanelContent) =>
createAction(ActionTypes.OPEN_STANDARD_SLIDING_PANEL, content),
closeStandardSlidingPanel: () => createAction(ActionTypes.CLOSE_STANDARD_SLIDING_PANEL),
+ updateBaseCurrency: (baseCurrency: BaseCurrency) => createAction(ActionTypes.UPDATE_BASE_CURRENCY, baseCurrency),
};
diff --git a/packages/instant/src/redux/analytics_middleware.ts b/packages/instant/src/redux/analytics_middleware.ts
index f971dbd33..a86a16b1a 100644
--- a/packages/instant/src/redux/analytics_middleware.ts
+++ b/packages/instant/src/redux/analytics_middleware.ts
@@ -1,29 +1,16 @@
+import { AssetProxyId } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
import { Middleware } from 'redux';
import { ETH_DECIMALS } from '../constants';
-import { Account, AccountState } from '../types';
-import { analytics } from '../util/analytics';
+import { AccountState, StandardSlidingPanelContent } from '../types';
+import { analytics, AnalyticsEventOptions } from '../util/analytics';
import { Action, ActionTypes } from './actions';
import { State } from './reducer';
-const shouldTriggerWalletReady = (prevAccount: Account, curAccount: Account): boolean => {
- const didJustTurnReady = curAccount.state === AccountState.Ready && prevAccount.state !== AccountState.Ready;
- if (didJustTurnReady) {
- return true;
- }
-
- if (curAccount.state === AccountState.Ready && prevAccount.state === AccountState.Ready) {
- // Account was ready, and is now ready again, but address has changed
- return curAccount.address !== prevAccount.address;
- }
-
- return false;
-};
-
export const analyticsMiddleware: Middleware = store => next => middlewareAction => {
const prevState = store.getState() as State;
const prevAccount = prevState.providerState.account;
@@ -35,10 +22,26 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
switch (nextAction.type) {
case ActionTypes.SET_ACCOUNT_STATE_READY:
- if (curAccount.state === AccountState.Ready && shouldTriggerWalletReady(prevAccount, curAccount)) {
+ if (curAccount.state === AccountState.Ready) {
+ const didJustTurnReady = prevAccount.state !== AccountState.Ready;
+ const didJustUpdateAddress =
+ prevAccount.state === AccountState.Ready && prevAccount.address !== curAccount.address;
const ethAddress = curAccount.address;
- analytics.addUserProperties({ ethAddress });
- analytics.trackWalletReady();
+ if (didJustTurnReady) {
+ analytics.trackAccountReady(ethAddress);
+ analytics.addUserProperties({ lastKnownEthAddress: ethAddress });
+ analytics.addEventProperties({ ethAddress });
+ } else if (didJustUpdateAddress) {
+ analytics.trackAccountAddressChanged(ethAddress);
+ analytics.addUserProperties({ lastKnownEthAddress: ethAddress });
+ analytics.addEventProperties({ ethAddress });
+ }
+ }
+ break;
+ case ActionTypes.SET_ACCOUNT_STATE_LOCKED:
+ if (prevAccount.state !== AccountState.Locked && curAccount.state === AccountState.Locked) {
+ // if we are moving from account not locked to account locked, track `Account - Locked`
+ analytics.trackAccountLocked();
}
break;
case ActionTypes.UPDATE_ACCOUNT_ETH_BALANCE:
@@ -51,8 +54,54 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
curAccount.ethBalanceInWei,
ETH_DECIMALS,
).toString();
- analytics.addUserProperties({ ethBalanceInUnitAmount });
+ analytics.addUserProperties({ lastEthBalanceInUnitAmount: ethBalanceInUnitAmount });
+ analytics.addEventProperties({ ethBalanceInUnitAmount });
+ }
+ break;
+ case ActionTypes.UPDATE_SELECTED_ASSET:
+ const selectedAsset = curState.selectedAsset;
+ if (selectedAsset) {
+ const assetName = selectedAsset.metaData.name;
+ const assetData = selectedAsset.assetData;
+ analytics.trackTokenSelectorChose({
+ assetName,
+ assetData,
+ });
+
+ const selectedAssetEventProperties: AnalyticsEventOptions = {
+ selectedAssetName: assetName,
+ selectedAssetData: assetData,
+ };
+ if (selectedAsset.metaData.assetProxyId === AssetProxyId.ERC20) {
+ selectedAssetEventProperties.selectedAssetDecimals = selectedAsset.metaData.decimals;
+ selectedAssetEventProperties.selectedAssetSymbol = selectedAsset.metaData.symbol;
+ }
+ analytics.addEventProperties(selectedAssetEventProperties);
}
+ break;
+ case ActionTypes.SET_AVAILABLE_ASSETS:
+ const availableAssets = curState.availableAssets;
+ if (availableAssets) {
+ analytics.addEventProperties({
+ numberAvailableAssets: availableAssets.length,
+ });
+ }
+ break;
+ case ActionTypes.OPEN_STANDARD_SLIDING_PANEL:
+ const openSlidingContent = curState.standardSlidingPanelSettings.content;
+ if (openSlidingContent === StandardSlidingPanelContent.InstallWallet) {
+ analytics.trackInstallWalletModalOpened();
+ }
+ break;
+ case ActionTypes.CLOSE_STANDARD_SLIDING_PANEL:
+ const closeSlidingContent = curState.standardSlidingPanelSettings.content;
+ if (closeSlidingContent === StandardSlidingPanelContent.InstallWallet) {
+ analytics.trackInstallWalletModalClosed();
+ }
+ break;
+ case ActionTypes.UPDATE_BASE_CURRENCY:
+ analytics.trackBaseCurrencyChanged(curState.baseCurrency);
+ analytics.addEventProperties({ baseCurrency: curState.baseCurrency });
}
return nextAction;
diff --git a/packages/instant/src/redux/async_data.ts b/packages/instant/src/redux/async_data.ts
index 5d30388b8..884ab103d 100644
--- a/packages/instant/src/redux/async_data.ts
+++ b/packages/instant/src/redux/async_data.ts
@@ -4,11 +4,13 @@ import * as _ from 'lodash';
import { Dispatch } from 'redux';
import { BIG_NUMBER_ZERO } from '../constants';
-import { AccountState, ERC20Asset, OrderProcessState, ProviderState } from '../types';
+import { AccountState, BaseCurrency, ERC20Asset, OrderProcessState, ProviderState, QuoteFetchOrigin } from '../types';
+import { analytics } from '../util/analytics';
import { assetUtils } from '../util/asset';
import { buyQuoteUpdater } from '../util/buy_quote_updater';
import { coinbaseApi } from '../util/coinbase_api';
import { errorFlasher } from '../util/error_flasher';
+import { errorReporter } from '../util/error_reporter';
import { actions } from './actions';
import { State } from './reducer';
@@ -22,6 +24,9 @@ export const asyncData = {
const errorMessage = 'Error fetching ETH/USD price';
errorFlasher.flashNewErrorMessage(dispatch, errorMessage);
dispatch(actions.updateEthUsdPrice(BIG_NUMBER_ZERO));
+ dispatch(actions.updateBaseCurrency(BaseCurrency.ETH));
+ errorReporter.report(e);
+ analytics.trackUsdPriceFailed();
}
},
fetchAvailableAssetDatasAndDispatchToStore: async (state: State, dispatch: Dispatch) => {
@@ -29,13 +34,15 @@ export const asyncData = {
const assetBuyer = providerState.assetBuyer;
try {
const assetDatas = await assetBuyer.getAvailableAssetDatasAsync();
- const assets = assetUtils.createAssetsFromAssetDatas(assetDatas, assetMetaDataMap, network);
+ const deduplicatedAssetDatas = _.uniq(assetDatas);
+ const assets = assetUtils.createAssetsFromAssetDatas(deduplicatedAssetDatas, assetMetaDataMap, network);
dispatch(actions.setAvailableAssets(assets));
} catch (e) {
const errorMessage = 'Could not find any assets';
errorFlasher.flashNewErrorMessage(dispatch, errorMessage);
// On error, just specify that none are available
dispatch(actions.setAvailableAssets([]));
+ errorReporter.report(e);
}
},
fetchAccountInfoAndDispatchToStore: async (
@@ -58,6 +65,7 @@ export const asyncData = {
? await (provider as any).enable()
: await web3Wrapper.getAvailableAddressesAsync();
} catch (e) {
+ analytics.trackAccountUnlockDenied();
dispatch(actions.setAccountStateLocked());
return;
}
@@ -75,6 +83,7 @@ export const asyncData = {
const ethBalanceInWei = await web3Wrapper.getBalanceInWeiAsync(address);
dispatch(actions.updateAccountEthBalance({ address, ethBalanceInWei }));
} catch (e) {
+ errorReporter.report(e);
// leave balance as is
return;
}
@@ -82,6 +91,7 @@ export const asyncData = {
fetchCurrentBuyQuoteAndDispatchToStore: async (
state: State,
dispatch: Dispatch,
+ fetchOrigin: QuoteFetchOrigin,
options: { updateSilently: boolean },
) => {
const { buyOrderState, providerState, selectedAsset, selectedAssetUnitAmount, affiliateInfo } = state;
@@ -89,6 +99,7 @@ export const asyncData = {
if (
!_.isUndefined(selectedAssetUnitAmount) &&
!_.isUndefined(selectedAsset) &&
+ selectedAssetUnitAmount.greaterThan(BIG_NUMBER_ZERO) &&
buyOrderState.processState === OrderProcessState.None &&
selectedAsset.metaData.assetProxyId === AssetProxyId.ERC20
) {
@@ -97,7 +108,12 @@ export const asyncData = {
dispatch,
selectedAsset as ERC20Asset,
selectedAssetUnitAmount,
- { setPending: !options.updateSilently, dispatchErrors: !options.updateSilently, affiliateInfo },
+ fetchOrigin,
+ {
+ setPending: !options.updateSilently,
+ dispatchErrors: !options.updateSilently,
+ affiliateInfo,
+ },
);
}
},
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts
index dfc2b89f3..8c13c9c72 100644
--- a/packages/instant/src/redux/reducer.ts
+++ b/packages/instant/src/redux/reducer.ts
@@ -14,6 +14,7 @@ import {
Asset,
AssetMetaData,
AsyncProcessState,
+ BaseCurrency,
DisplayStatus,
Network,
OrderProcessState,
@@ -33,6 +34,7 @@ export interface DefaultState {
latestErrorDisplayStatus: DisplayStatus;
quoteRequestState: AsyncProcessState;
standardSlidingPanelSettings: StandardSlidingPanelSettings;
+ baseCurrency: BaseCurrency;
}
// State that is required but needs to be derived from the props
@@ -49,6 +51,7 @@ interface OptionalState {
latestBuyQuote: BuyQuote;
latestErrorMessage: string;
affiliateInfo: AffiliateInfo;
+ walletDisplayName: string;
}
export type State = DefaultState & PropsDerivedState & Partial<OptionalState>;
@@ -63,6 +66,7 @@ export const DEFAULT_STATE: DefaultState = {
animationState: 'none',
content: StandardSlidingPanelContent.None,
},
+ baseCurrency: BaseCurrency.USD,
};
export const createReducer = (initialState: State) => {
@@ -242,6 +246,11 @@ export const createReducer = (initialState: State) => {
animationState: 'slidOut',
},
};
+ case ActionTypes.UPDATE_BASE_CURRENCY:
+ return {
+ ...state,
+ baseCurrency: action.data,
+ };
default:
return state;
}
diff --git a/packages/instant/src/style/theme.ts b/packages/instant/src/style/theme.ts
index a0751286b..fd3f03c3f 100644
--- a/packages/instant/src/style/theme.ts
+++ b/packages/instant/src/style/theme.ts
@@ -1,6 +1,14 @@
import * as styledComponents from 'styled-components';
-const { default: styled, css, keyframes, withTheme, createGlobalStyle, ThemeProvider } = styledComponents;
+const {
+ default: styled,
+ css,
+ keyframes,
+ withTheme,
+ createGlobalStyle,
+ ThemeConsumer,
+ ThemeProvider,
+} = styledComponents;
export type Theme = { [key in ColorOption]: string };
@@ -30,8 +38,8 @@ export const theme: Theme = {
lightestGrey: '#EEEEEE',
darkGrey: '#333333',
white: 'white',
- lightOrange: '#F9F2ED',
- darkOrange: '#F2994C',
+ lightOrange: '#FFF8F2',
+ darkOrange: '#F7A24F',
green: '#3CB34F',
red: '#D00000',
darkBlue: '#135df6',
@@ -45,4 +53,4 @@ export const generateOverlayBlack = (opacity = 0.6) => {
return `rgba(0, 0, 0, ${opacity})`;
};
-export { styled, css, keyframes, withTheme, createGlobalStyle, ThemeProvider };
+export { styled, css, keyframes, withTheme, createGlobalStyle, ThemeConsumer, ThemeProvider };
diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts
index 999d50fed..ae672c919 100644
--- a/packages/instant/src/types.ts
+++ b/packages/instant/src/types.ts
@@ -21,6 +21,16 @@ export enum OrderProcessState {
Failure = 'FAILURE',
}
+export enum QuoteFetchOrigin {
+ Manual = 'Manual',
+ Heartbeat = 'Heartbeat',
+}
+
+export enum BaseCurrency {
+ USD = 'USD',
+ ETH = 'ETH',
+}
+
export interface SimulatedProgress {
startTimeUnix: number;
expectedEndTimeUnix: number;
@@ -86,6 +96,7 @@ export enum Network {
export enum ZeroExInstantError {
AssetMetaDataNotAvailable = 'ASSET_META_DATA_NOT_AVAILABLE',
InsufficientETH = 'INSUFFICIENT_ETH',
+ CouldNotSubmitTransaction = 'COULD_NOT_SUBMIT_TRANSACTION',
}
export type SimpleHandler = () => void;
@@ -97,6 +108,7 @@ export interface AffiliateInfo {
export interface ProviderState {
name: string;
+ displayName: string;
provider: Provider;
assetBuyer: AssetBuyer;
web3Wrapper: Web3Wrapper;
@@ -149,6 +161,11 @@ export enum Browser {
Other = 'OTHER',
}
+export enum WalletSuggestion {
+ CoinbaseWallet = 'Coinbase Wallet',
+ MetaMask = 'MetaMask',
+}
+
export enum OperatingSystem {
Android = 'ANDROID',
iOS = 'IOS',
@@ -165,5 +182,24 @@ export enum ProviderType {
Mist = 'MIST',
CoinbaseWallet = 'COINBASE_WALLET',
Cipher = 'CIPHER',
+ TrustWallet = 'TRUST_WALLET',
Fallback = 'FALLBACK',
}
+
+export interface ZeroExInstantRequiredBaseConfig {
+ orderSource: OrderSource;
+}
+
+export interface ZeroExInstantOptionalBaseConfig {
+ provider: Provider;
+ walletDisplayName: string;
+ availableAssetDatas: string[];
+ defaultAssetBuyAmount: number;
+ defaultSelectedAssetData: string;
+ additionalAssetMetaDataMap: ObjectMap<AssetMetaData>;
+ networkId: Network;
+ affiliateInfo: AffiliateInfo;
+ shouldDisableAnalyticsTracking: boolean;
+}
+
+export type ZeroExInstantBaseConfig = ZeroExInstantRequiredBaseConfig & Partial<ZeroExInstantOptionalBaseConfig>;
diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts
index 2ffaac1dd..4faeaaf5a 100644
--- a/packages/instant/src/util/analytics.ts
+++ b/packages/instant/src/util/analytics.ts
@@ -1,25 +1,73 @@
-import { ObjectMap } from '@0x/types';
+import { BuyQuote } from '@0x/asset-buyer';
+import { BigNumber } from '@0x/utils';
+import * as _ from 'lodash';
-import { heapUtil } from './heap';
+import { GIT_SHA, HEAP_ENABLED, INSTANT_DISCHARGE_TARGET, NODE_ENV, NPM_PACKAGE_VERSION } from '../constants';
+import {
+ AffiliateInfo,
+ Asset,
+ BaseCurrency,
+ Network,
+ OrderProcessState,
+ OrderSource,
+ ProviderState,
+ QuoteFetchOrigin,
+ WalletSuggestion,
+} from '../types';
-let isDisabled = false;
+import { EventProperties, heapUtil } from './heap';
+
+let isDisabledViaConfig = false;
export const disableAnalytics = (shouldDisableAnalytics: boolean) => {
- isDisabled = shouldDisableAnalytics;
+ isDisabledViaConfig = shouldDisableAnalytics;
};
export const evaluateIfEnabled = (fnCall: () => void) => {
- if (isDisabled) {
+ if (isDisabledViaConfig) {
return;
}
- fnCall();
+ if (HEAP_ENABLED) {
+ fnCall();
+ }
};
enum EventNames {
INSTANT_OPENED = 'Instant - Opened',
- WALLET_READY = 'Wallet - Ready',
+ INSTANT_CLOSED = 'Instant - Closed',
+ ACCOUNT_LOCKED = 'Account - Locked',
+ ACCOUNT_READY = 'Account - Ready',
+ ACCOUNT_UNLOCK_REQUESTED = 'Account - Unlock Requested',
+ ACCOUNT_UNLOCK_DENIED = 'Account - Unlock Denied',
+ ACCOUNT_ADDRESS_CHANGED = 'Account - Address Changed',
+ BASE_CURRENCY_CHANGED = 'Base Currency - Changed',
+ PAYMENT_METHOD_DROPDOWN_OPENED = 'Payment Method - Dropdown Opened',
+ PAYMENT_METHOD_OPENED_ETHERSCAN = 'Payment Method - Opened Etherscan',
+ PAYMENT_METHOD_COPIED_ADDRESS = 'Payment Method - Copied Address',
+ BUY_NOT_ENOUGH_ETH = 'Buy - Not Enough Eth',
+ BUY_STARTED = 'Buy - Started',
+ BUY_SIGNATURE_DENIED = 'Buy - Signature Denied',
+ BUY_SIMULATION_FAILED = 'Buy - Simulation Failed',
+ BUY_UNKNOWN_ERROR = 'Buy - Unknown Error',
+ BUY_TX_SUBMITTED = 'Buy - Tx Submitted',
+ BUY_TX_SUCCEEDED = 'Buy - Tx Succeeded',
+ BUY_TX_FAILED = 'Buy - Tx Failed',
+ USD_PRICE_FETCH_FAILED = 'USD Price - Fetch Failed',
+ INSTALL_WALLET_CLICKED = 'Install Wallet - Clicked',
+ INSTALL_WALLET_MODAL_OPENED = 'Install Wallet - Modal - Opened',
+ INSTALL_WALLET_MODAL_CLICKED_EXPLANATION = 'Install Wallet - Modal - Clicked Explanation',
+ INSTALL_WALLET_MODAL_CLICKED_GET = 'Install Wallet - Modal - Clicked Get',
+ INSTALL_WALLET_MODAL_CLOSED = 'Install Wallet - Modal - Closed',
+ TOKEN_SELECTOR_OPENED = 'Token Selector - Opened',
+ TOKEN_SELECTOR_CLOSED = 'Token Selector - Closed',
+ TOKEN_SELECTOR_CHOSE = 'Token Selector - Chose',
+ TOKEN_SELECTOR_SEARCHED = 'Token Selector - Searched',
+ TRANSACTION_VIEWED = 'Transaction - Viewed',
+ QUOTE_FETCHED = 'Quote - Fetched',
+ QUOTE_ERROR = 'Quote - Error',
}
-const track = (eventName: EventNames, eventData: ObjectMap<string | number> = {}): void => {
+
+const track = (eventName: EventNames, eventProperties: EventProperties = {}): void => {
evaluateIfEnabled(() => {
- heapUtil.evaluateHeapCall(heap => heap.track(eventName, eventData));
+ heapUtil.evaluateHeapCall(heap => heap.track(eventName, eventProperties));
});
};
function trackingEventFnWithoutPayload(eventName: EventNames): () => void {
@@ -28,25 +76,57 @@ function trackingEventFnWithoutPayload(eventName: EventNames): () => void {
};
}
// tslint:disable-next-line:no-unused-variable
-function trackingEventFnWithPayload<T extends ObjectMap<string | number>>(
- eventName: EventNames,
-): (eventDataProperties: T) => void {
- return (eventDataProperties: T) => {
- track(eventName, eventDataProperties);
+function trackingEventFnWithPayload(eventName: EventNames): (eventProperties: EventProperties) => void {
+ return (eventProperties: EventProperties) => {
+ track(eventName, eventProperties);
};
}
+const buyQuoteEventProperties = (buyQuote: BuyQuote) => {
+ const assetBuyAmount = buyQuote.assetBuyAmount.toString();
+ const assetEthAmount = buyQuote.worstCaseQuoteInfo.assetEthAmount.toString();
+ const feeEthAmount = buyQuote.worstCaseQuoteInfo.feeEthAmount.toString();
+ const totalEthAmount = buyQuote.worstCaseQuoteInfo.totalEthAmount.toString();
+ const feePercentage = !_.isUndefined(buyQuote.feePercentage) ? buyQuote.feePercentage.toString() : 0;
+ const hasFeeOrders = !_.isEmpty(buyQuote.feeOrders) ? 'true' : 'false';
+ return {
+ assetBuyAmount,
+ assetEthAmount,
+ feeEthAmount,
+ totalEthAmount,
+ feePercentage,
+ hasFeeOrders,
+ };
+};
+
export interface AnalyticsUserOptions {
- ethAddress?: string;
- ethBalanceInUnitAmount?: string;
+ lastKnownEthAddress?: string;
+ lastEthBalanceInUnitAmount?: string;
}
export interface AnalyticsEventOptions {
embeddedHost?: string;
embeddedUrl?: string;
+ ethBalanceInUnitAmount?: string;
+ ethAddress?: string;
networkId?: number;
providerName?: string;
+ providerDisplayName?: string;
gitSha?: string;
npmVersion?: string;
+ instantEnvironment?: string;
+ orderSource?: string;
+ affiliateAddress?: string;
+ affiliateFeePercent?: number;
+ numberAvailableAssets?: number;
+ selectedAssetName?: string;
+ selectedAssetSymbol?: string;
+ selectedAssetData?: string;
+ selectedAssetDecimals?: number;
+ baseCurrency?: string;
+}
+export enum TokenSelectorClosedVia {
+ ClickedX = 'Clicked X',
+ TokenChose = 'Token Chose',
}
export const analytics = {
addUserProperties: (properties: AnalyticsUserOptions): void => {
@@ -59,6 +139,110 @@ export const analytics = {
heapUtil.evaluateHeapCall(heap => heap.addEventProperties(properties));
});
},
- trackWalletReady: trackingEventFnWithoutPayload(EventNames.WALLET_READY),
+ generateEventProperties: (
+ network: Network,
+ orderSource: OrderSource,
+ providerState: ProviderState,
+ window: Window,
+ selectedAsset?: Asset,
+ affiliateInfo?: AffiliateInfo,
+ baseCurrency?: BaseCurrency,
+ ): AnalyticsEventOptions => {
+ const affiliateAddress = affiliateInfo ? affiliateInfo.feeRecipient : 'none';
+ const affiliateFeePercent = affiliateInfo ? parseFloat(affiliateInfo.feePercentage.toFixed(4)) : 0;
+ const orderSourceName = typeof orderSource === 'string' ? orderSource : 'provided';
+ const eventOptions: AnalyticsEventOptions = {
+ embeddedHost: window.location.host,
+ embeddedUrl: window.location.href,
+ networkId: network,
+ providerName: providerState.name,
+ providerDisplayName: providerState.displayName,
+ gitSha: GIT_SHA,
+ npmVersion: NPM_PACKAGE_VERSION,
+ orderSource: orderSourceName,
+ affiliateAddress,
+ affiliateFeePercent,
+ selectedAssetName: selectedAsset ? selectedAsset.metaData.name : 'none',
+ selectedAssetData: selectedAsset ? selectedAsset.assetData : 'none',
+ instantEnvironment: INSTANT_DISCHARGE_TARGET || `Local ${NODE_ENV}`,
+ baseCurrency,
+ };
+ return eventOptions;
+ },
trackInstantOpened: trackingEventFnWithoutPayload(EventNames.INSTANT_OPENED),
+ trackInstantClosed: trackingEventFnWithoutPayload(EventNames.INSTANT_CLOSED),
+ trackAccountLocked: trackingEventFnWithoutPayload(EventNames.ACCOUNT_LOCKED),
+ trackAccountReady: (address: string) => trackingEventFnWithPayload(EventNames.ACCOUNT_READY)({ address }),
+ trackAccountUnlockRequested: trackingEventFnWithoutPayload(EventNames.ACCOUNT_UNLOCK_REQUESTED),
+ trackAccountUnlockDenied: trackingEventFnWithoutPayload(EventNames.ACCOUNT_UNLOCK_DENIED),
+ trackAccountAddressChanged: (address: string) =>
+ trackingEventFnWithPayload(EventNames.ACCOUNT_ADDRESS_CHANGED)({ address }),
+ trackBaseCurrencyChanged: (currencyChangedTo: BaseCurrency) =>
+ trackingEventFnWithPayload(EventNames.BASE_CURRENCY_CHANGED)({ currencyChangedTo }),
+ trackPaymentMethodDropdownOpened: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_DROPDOWN_OPENED),
+ trackPaymentMethodOpenedEtherscan: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_OPENED_ETHERSCAN),
+ trackPaymentMethodCopiedAddress: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_COPIED_ADDRESS),
+ trackBuyNotEnoughEth: (buyQuote: BuyQuote) =>
+ trackingEventFnWithPayload(EventNames.BUY_NOT_ENOUGH_ETH)(buyQuoteEventProperties(buyQuote)),
+ trackBuyStarted: (buyQuote: BuyQuote) =>
+ trackingEventFnWithPayload(EventNames.BUY_STARTED)(buyQuoteEventProperties(buyQuote)),
+ trackBuySignatureDenied: (buyQuote: BuyQuote) =>
+ trackingEventFnWithPayload(EventNames.BUY_SIGNATURE_DENIED)(buyQuoteEventProperties(buyQuote)),
+ trackBuySimulationFailed: (buyQuote: BuyQuote) =>
+ trackingEventFnWithPayload(EventNames.BUY_SIMULATION_FAILED)(buyQuoteEventProperties(buyQuote)),
+ trackBuyUnknownError: (buyQuote: BuyQuote, errorMessage: string) =>
+ trackingEventFnWithPayload(EventNames.BUY_UNKNOWN_ERROR)({
+ ...buyQuoteEventProperties(buyQuote),
+ errorMessage,
+ }),
+ trackBuyTxSubmitted: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) =>
+ trackingEventFnWithPayload(EventNames.BUY_TX_SUBMITTED)({
+ ...buyQuoteEventProperties(buyQuote),
+ txHash,
+ expectedTxTimeMs: expectedEndTimeUnix - startTimeUnix,
+ }),
+ trackBuyTxSucceeded: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) =>
+ trackingEventFnWithPayload(EventNames.BUY_TX_SUCCEEDED)({
+ ...buyQuoteEventProperties(buyQuote),
+ txHash,
+ expectedTxTimeMs: expectedEndTimeUnix - startTimeUnix,
+ actualTxTimeMs: new Date().getTime() - startTimeUnix,
+ }),
+ trackBuyTxFailed: (buyQuote: BuyQuote, txHash: string, startTimeUnix: number, expectedEndTimeUnix: number) =>
+ trackingEventFnWithPayload(EventNames.BUY_TX_FAILED)({
+ ...buyQuoteEventProperties(buyQuote),
+ txHash,
+ expectedTxTimeMs: expectedEndTimeUnix - startTimeUnix,
+ actualTxTimeMs: new Date().getTime() - startTimeUnix,
+ }),
+ trackInstallWalletClicked: (walletSuggestion: WalletSuggestion) =>
+ trackingEventFnWithPayload(EventNames.INSTALL_WALLET_CLICKED)({ walletSuggestion }),
+ trackInstallWalletModalClickedExplanation: trackingEventFnWithoutPayload(
+ EventNames.INSTALL_WALLET_MODAL_CLICKED_EXPLANATION,
+ ),
+ trackInstallWalletModalClickedGet: trackingEventFnWithoutPayload(EventNames.INSTALL_WALLET_MODAL_CLICKED_GET),
+ trackInstallWalletModalOpened: trackingEventFnWithoutPayload(EventNames.INSTALL_WALLET_MODAL_OPENED),
+ trackInstallWalletModalClosed: trackingEventFnWithoutPayload(EventNames.INSTALL_WALLET_MODAL_CLOSED),
+ trackTokenSelectorOpened: trackingEventFnWithoutPayload(EventNames.TOKEN_SELECTOR_OPENED),
+ trackTokenSelectorClosed: (closedVia: TokenSelectorClosedVia) =>
+ trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_CLOSED)({ closedVia }),
+ trackTokenSelectorChose: (payload: { assetName: string; assetData: string }) =>
+ trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_CHOSE)(payload),
+ trackTokenSelectorSearched: (searchText: string) =>
+ trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_SEARCHED)({ searchText }),
+ trackTransactionViewed: (orderProcesState: OrderProcessState) =>
+ trackingEventFnWithPayload(EventNames.TRANSACTION_VIEWED)({ orderState: orderProcesState }),
+ trackQuoteFetched: (buyQuote: BuyQuote, fetchOrigin: QuoteFetchOrigin) =>
+ trackingEventFnWithPayload(EventNames.QUOTE_FETCHED)({
+ ...buyQuoteEventProperties(buyQuote),
+ fetchOrigin,
+ }),
+ trackQuoteError: (errorMessage: string, assetBuyAmount: BigNumber, fetchOrigin: QuoteFetchOrigin) => {
+ trackingEventFnWithPayload(EventNames.QUOTE_ERROR)({
+ errorMessage,
+ assetBuyAmount: assetBuyAmount.toString(),
+ fetchOrigin,
+ });
+ },
+ trackUsdPriceFailed: trackingEventFnWithoutPayload(EventNames.USD_PRICE_FETCH_FAILED),
};
diff --git a/packages/instant/src/util/asset.ts b/packages/instant/src/util/asset.ts
index 40560d3eb..faaeb7c22 100644
--- a/packages/instant/src/util/asset.ts
+++ b/packages/instant/src/util/asset.ts
@@ -1,6 +1,8 @@
+import { AssetBuyerError } from '@0x/asset-buyer';
import { AssetProxyId, ObjectMap } from '@0x/types';
import * as _ from 'lodash';
+import { DEFAULT_UNKOWN_ASSET_NAME } from '../constants';
import { assetDataNetworkMapping } from '../data/asset_data_network_mapping';
import { Asset, AssetMetaData, ERC20Asset, Network, ZeroExInstantError } from '../types';
@@ -25,7 +27,7 @@ export const assetUtils = {
return;
}
return {
- assetData,
+ assetData: assetData.toLowerCase(),
metaData,
};
},
@@ -35,7 +37,7 @@ export const assetUtils = {
network: Network,
): Asset => {
return {
- assetData,
+ assetData: assetData.toLowerCase(),
metaData: assetUtils.getMetaDataOrThrow(assetData, assetMetaDataMap, network),
};
},
@@ -70,7 +72,7 @@ export const assetUtils = {
}
return metaData;
},
- bestNameForAsset: (asset?: Asset, defaultName: string = '???'): string => {
+ bestNameForAsset: (asset?: Asset, defaultName: string = DEFAULT_UNKOWN_ASSET_NAME): string => {
if (_.isUndefined(asset)) {
return defaultName;
}
@@ -106,4 +108,20 @@ export const assetUtils = {
);
return _.compact(erc20sOrUndefined);
},
+ assetBuyerErrorMessage: (asset: ERC20Asset, error: Error): string | undefined => {
+ if (error.message === AssetBuyerError.InsufficientAssetLiquidity) {
+ const assetName = assetUtils.bestNameForAsset(asset, 'of this asset');
+ return `Not enough ${assetName} available`;
+ } else if (error.message === AssetBuyerError.InsufficientZrxLiquidity) {
+ return 'Not enough ZRX available';
+ } else if (
+ error.message === AssetBuyerError.StandardRelayerApiError ||
+ error.message.startsWith(AssetBuyerError.AssetUnavailable)
+ ) {
+ const assetName = assetUtils.bestNameForAsset(asset, 'This asset');
+ return `${assetName} is currently unavailable`;
+ }
+
+ return undefined;
+ },
};
diff --git a/packages/instant/src/util/buy_quote_updater.ts b/packages/instant/src/util/buy_quote_updater.ts
index 2fd16d781..6191c92e3 100644
--- a/packages/instant/src/util/buy_quote_updater.ts
+++ b/packages/instant/src/util/buy_quote_updater.ts
@@ -1,4 +1,4 @@
-import { AssetBuyer, AssetBuyerError, BuyQuote } from '@0x/asset-buyer';
+import { AssetBuyer, BuyQuote } from '@0x/asset-buyer';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
@@ -6,9 +6,11 @@ import { Dispatch } from 'redux';
import { oc } from 'ts-optchain';
import { Action, actions } from '../redux/actions';
-import { AffiliateInfo, ERC20Asset } from '../types';
+import { AffiliateInfo, ERC20Asset, QuoteFetchOrigin } from '../types';
+import { analytics } from '../util/analytics';
import { assetUtils } from '../util/asset';
import { errorFlasher } from '../util/error_flasher';
+import { errorReporter } from '../util/error_reporter';
export const buyQuoteUpdater = {
updateBuyQuoteAsync: async (
@@ -16,7 +18,12 @@ export const buyQuoteUpdater = {
dispatch: Dispatch<Action>,
asset: ERC20Asset,
assetUnitAmount: BigNumber,
- options: { setPending: boolean; dispatchErrors: boolean; affiliateInfo?: AffiliateInfo },
+ fetchOrigin: QuoteFetchOrigin,
+ options: {
+ setPending: boolean;
+ dispatchErrors: boolean;
+ affiliateInfo?: AffiliateInfo;
+ },
): Promise<void> => {
// get a new buy quote.
const baseUnitValue = Web3Wrapper.toBaseUnitAmount(assetUnitAmount, asset.metaData.decimals);
@@ -29,34 +36,21 @@ export const buyQuoteUpdater = {
try {
newBuyQuote = await assetBuyer.getBuyQuoteAsync(asset.assetData, baseUnitValue, { feePercentage });
} catch (error) {
+ const errorMessage = assetUtils.assetBuyerErrorMessage(asset, error);
+
+ errorReporter.report(error);
+ analytics.trackQuoteError(error.message ? error.message : 'other', baseUnitValue, fetchOrigin);
+
if (options.dispatchErrors) {
dispatch(actions.setQuoteRequestStateFailure());
- let errorMessage;
- if (error.message === AssetBuyerError.InsufficientAssetLiquidity) {
- const assetName = assetUtils.bestNameForAsset(asset, 'of this asset');
- errorMessage = `Not enough ${assetName} available`;
- } else if (error.message === AssetBuyerError.InsufficientZrxLiquidity) {
- errorMessage = 'Not enough ZRX available';
- } else if (
- error.message === AssetBuyerError.StandardRelayerApiError ||
- error.message.startsWith(AssetBuyerError.AssetUnavailable)
- ) {
- const assetName = assetUtils.bestNameForAsset(asset, 'This asset');
- errorMessage = `${assetName} is currently unavailable`;
- }
- if (!_.isUndefined(errorMessage)) {
- errorFlasher.flashNewErrorMessage(dispatch, errorMessage);
- } else {
- throw error;
- }
+ errorFlasher.flashNewErrorMessage(dispatch, errorMessage || 'Error fetching price, please try again');
}
- // TODO: report to error reporter on else
-
return;
}
// We have a successful new buy quote
errorFlasher.clearError(dispatch);
// invalidate the last buy quote.
dispatch(actions.updateLatestBuyQuote(newBuyQuote));
+ analytics.trackQuoteFetched(newBuyQuote, fetchOrigin);
},
};
diff --git a/packages/instant/src/util/env.ts b/packages/instant/src/util/env.ts
index 4a32f9cb1..aedf4f5d6 100644
--- a/packages/instant/src/util/env.ts
+++ b/packages/instant/src/util/env.ts
@@ -44,6 +44,8 @@ export const envUtil = {
getProviderType(provider: Provider): ProviderType | undefined {
if (provider.constructor.name === 'EthereumProvider') {
return ProviderType.Mist;
+ } else if ((provider as any).isTrust) {
+ return ProviderType.TrustWallet;
} else if ((provider as any).isParity) {
return ProviderType.Parity;
} else if ((provider as any).isMetaMask) {
@@ -62,4 +64,11 @@ export const envUtil = {
}
return PROVIDER_TYPE_TO_NAME[providerTypeIfExists];
},
+ getProviderDisplayName(provider: Provider): string {
+ const providerTypeIfExists = envUtil.getProviderType(provider);
+ if (_.isUndefined(providerTypeIfExists)) {
+ return 'Wallet';
+ }
+ return PROVIDER_TYPE_TO_NAME[providerTypeIfExists];
+ },
};
diff --git a/packages/instant/src/util/error_reporter.ts b/packages/instant/src/util/error_reporter.ts
new file mode 100644
index 000000000..8d7481684
--- /dev/null
+++ b/packages/instant/src/util/error_reporter.ts
@@ -0,0 +1,79 @@
+import { logUtils } from '@0x/utils';
+import * as _ from 'lodash';
+
+import {
+ GIT_SHA,
+ HOST_DOMAINS_EXTERNAL,
+ HOST_DOMAINS_LOCAL,
+ INSTANT_DISCHARGE_TARGET,
+ NODE_ENV,
+ ROLLBAR_CLIENT_TOKEN,
+ ROLLBAR_ENABLED,
+} from '../constants';
+
+// Import version of Rollbar designed for embedded components
+// See https://docs.rollbar.com/docs/using-rollbarjs-inside-an-embedded-component
+// tslint:disable-next-line:no-var-requires
+const Rollbar = require('rollbar/dist/rollbar.noconflict.umd');
+
+const getRollbarHostDomains = (): string[] => {
+ if (NODE_ENV === 'development') {
+ return HOST_DOMAINS_EXTERNAL.concat(HOST_DOMAINS_LOCAL);
+ } else {
+ return HOST_DOMAINS_EXTERNAL;
+ }
+};
+
+let rollbar: any;
+// Configures rollbar and sets up error catching
+export const setupRollbar = (): any => {
+ if (_.isUndefined(rollbar) && ROLLBAR_CLIENT_TOKEN && ROLLBAR_ENABLED) {
+ const hostDomains = getRollbarHostDomains();
+ rollbar = new Rollbar({
+ accessToken: ROLLBAR_CLIENT_TOKEN,
+ captureUncaught: true,
+ captureUnhandledRejections: true,
+ enabled: true,
+ itemsPerMinute: 10,
+ maxItems: 500,
+ payload: {
+ environment: INSTANT_DISCHARGE_TARGET || `Local ${NODE_ENV}`,
+ client: {
+ javascript: {
+ source_map_enabled: true,
+ code_version: GIT_SHA,
+ guess_uncaught_frames: true,
+ },
+ },
+ },
+ hostWhiteList: hostDomains,
+ uncaughtErrorLevel: 'error',
+ ignoredMessages: [
+ // Errors from the third-party scripts
+ 'Script error',
+ // Network errors or ad-blockers
+ 'TypeError: Failed to fetch',
+ 'Exchange has not been deployed to detected network (network/artifact mismatch)',
+ // Source: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-discuss/7VU0_VvC7mE
+ "undefined is not an object (evaluating '__gCrWeb.autofill.extractForms')",
+ // Source: http://stackoverflow.com/questions/43399818/securityerror-from-facebook-and-cross-domain-messaging
+ 'SecurityError (DOM Exception 18)',
+ ],
+ });
+ }
+};
+
+export const errorReporter = {
+ report(err: Error): void {
+ if (!rollbar) {
+ logUtils.log('Not reporting to rollbar because not configured', err);
+ return;
+ }
+
+ rollbar.error(err, (rollbarErr: Error) => {
+ if (rollbarErr) {
+ logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`);
+ }
+ });
+ },
+};
diff --git a/packages/instant/src/util/format.ts b/packages/instant/src/util/format.ts
index e9c432b2f..4adb63e21 100644
--- a/packages/instant/src/util/format.ts
+++ b/packages/instant/src/util/format.ts
@@ -2,7 +2,7 @@ import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
-import { ETH_DECIMALS } from '../constants';
+import { BIG_NUMBER_ZERO, ETH_DECIMALS } from '../constants';
export const format = {
ethBaseUnitAmount: (
@@ -20,24 +20,38 @@ export const format = {
ethUnitAmount?: BigNumber,
decimalPlaces: number = 4,
defaultText: React.ReactNode = '0 ETH',
+ minUnitAmountToDisplay: BigNumber = new BigNumber('0.00001'),
): React.ReactNode => {
if (_.isUndefined(ethUnitAmount)) {
return defaultText;
}
- const roundedAmount = ethUnitAmount.round(decimalPlaces).toDigits(decimalPlaces);
- return `${roundedAmount} ETH`;
+ let roundedAmount = ethUnitAmount.round(decimalPlaces).toDigits(decimalPlaces);
+
+ if (roundedAmount.eq(BIG_NUMBER_ZERO) && ethUnitAmount.greaterThan(BIG_NUMBER_ZERO)) {
+ // Sometimes for small ETH amounts (i.e. 0.000045) the amount rounded to 4 decimalPlaces is 0
+ // If that is the case, show to 1 significant digit
+ roundedAmount = new BigNumber(ethUnitAmount.toPrecision(1));
+ }
+
+ const displayAmount =
+ roundedAmount.greaterThan(BIG_NUMBER_ZERO) && roundedAmount.lessThan(minUnitAmountToDisplay)
+ ? `< ${minUnitAmountToDisplay.toString()}`
+ : roundedAmount.toString();
+
+ return `${displayAmount} ETH`;
},
ethBaseUnitAmountInUsd: (
ethBaseUnitAmount?: BigNumber,
ethUsdPrice?: BigNumber,
decimalPlaces: number = 2,
defaultText: React.ReactNode = '$0.00',
+ minUnitAmountToDisplay: BigNumber = new BigNumber('0.00001'),
): React.ReactNode => {
if (_.isUndefined(ethBaseUnitAmount) || _.isUndefined(ethUsdPrice)) {
return defaultText;
}
const ethUnitAmount = Web3Wrapper.toUnitAmount(ethBaseUnitAmount, ETH_DECIMALS);
- return format.ethUnitAmountInUsd(ethUnitAmount, ethUsdPrice, decimalPlaces);
+ return format.ethUnitAmountInUsd(ethUnitAmount, ethUsdPrice, decimalPlaces, minUnitAmountToDisplay);
},
ethUnitAmountInUsd: (
ethUnitAmount?: BigNumber,
@@ -48,7 +62,13 @@ export const format = {
if (_.isUndefined(ethUnitAmount) || _.isUndefined(ethUsdPrice)) {
return defaultText;
}
- return `$${ethUnitAmount.mul(ethUsdPrice).toFixed(decimalPlaces)}`;
+ const rawUsdPrice = ethUnitAmount.mul(ethUsdPrice);
+ const roundedUsdPrice = rawUsdPrice.toFixed(decimalPlaces);
+ if (roundedUsdPrice === '0.00' && rawUsdPrice.gt(BIG_NUMBER_ZERO)) {
+ return '<$0.01';
+ } else {
+ return `$${roundedUsdPrice}`;
+ }
},
ethAddress: (address: string): string => {
return `0x${address.slice(2, 7)}…${address.slice(-5)}`;
diff --git a/packages/instant/src/util/gas_price_estimator.ts b/packages/instant/src/util/gas_price_estimator.ts
index 6b15809a3..332c8d00a 100644
--- a/packages/instant/src/util/gas_price_estimator.ts
+++ b/packages/instant/src/util/gas_price_estimator.ts
@@ -7,6 +7,8 @@ import {
GWEI_IN_WEI,
} from '../constants';
+import { errorReporter } from './error_reporter';
+
interface EthGasStationResult {
average: number;
fastestWait: number;
@@ -42,8 +44,9 @@ export class GasPriceEstimator {
let fetchedAmount: GasInfo | undefined;
try {
fetchedAmount = await fetchFastAmountInWeiAsync();
- } catch {
+ } catch (e) {
fetchedAmount = undefined;
+ errorReporter.report(e);
}
if (fetchedAmount) {
diff --git a/packages/instant/src/util/heap.ts b/packages/instant/src/util/heap.ts
index 78ec3b3cc..279ff3059 100644
--- a/packages/instant/src/util/heap.ts
+++ b/packages/instant/src/util/heap.ts
@@ -5,12 +5,15 @@ import * as _ from 'lodash';
import { HEAP_ANALYTICS_ID } from '../constants';
import { AnalyticsEventOptions, AnalyticsUserOptions } from './analytics';
+import { errorReporter } from './error_reporter';
+
+export type EventProperties = ObjectMap<string | number>;
export interface HeapAnalytics {
loaded: boolean;
appid: string;
identify(id: string, idType: string): void;
- track(eventName: string, eventProperties?: ObjectMap<string | number>): void;
+ track(eventName: string, eventProperties?: EventProperties): void;
resetIdentity(): void;
addUserProperties(properties: AnalyticsUserOptions): void;
addEventProperties(properties: AnalyticsEventOptions): void;
@@ -105,8 +108,8 @@ export const heapUtil = {
heapFunctionCall(curHeap);
} catch (e) {
// We never want analytics to crash our React component
- // TODO(sk): error reporter here
logUtils.log('Analytics error', e);
+ errorReporter.report(e);
}
}
},
diff --git a/packages/instant/src/util/heartbeater_factory.ts b/packages/instant/src/util/heartbeater_factory.ts
index 2b852fb0d..cf29bf3ea 100644
--- a/packages/instant/src/util/heartbeater_factory.ts
+++ b/packages/instant/src/util/heartbeater_factory.ts
@@ -1,5 +1,6 @@
import { asyncData } from '../redux/async_data';
import { Store } from '../redux/store';
+import { QuoteFetchOrigin } from '../types';
import { Heartbeater } from './heartbeater';
@@ -17,8 +18,13 @@ export const generateAccountHeartbeater = (options: HeartbeatFactoryOptions): He
export const generateBuyQuoteHeartbeater = (options: HeartbeatFactoryOptions): Heartbeater => {
const { store, shouldPerformImmediatelyOnStart } = options;
return new Heartbeater(async () => {
- await asyncData.fetchCurrentBuyQuoteAndDispatchToStore(store.getState(), store.dispatch, {
- updateSilently: true,
- });
+ await asyncData.fetchCurrentBuyQuoteAndDispatchToStore(
+ store.getState(),
+ store.dispatch,
+ QuoteFetchOrigin.Heartbeat,
+ {
+ updateSilently: true,
+ },
+ );
}, shouldPerformImmediatelyOnStart);
};
diff --git a/packages/instant/src/util/provider_state_factory.ts b/packages/instant/src/util/provider_state_factory.ts
index 7c788dff2..bd2d6dad5 100644
--- a/packages/instant/src/util/provider_state_factory.ts
+++ b/packages/instant/src/util/provider_state_factory.ts
@@ -10,27 +10,40 @@ import { assetBuyerFactory } from './asset_buyer_factory';
import { providerFactory } from './provider_factory';
export const providerStateFactory = {
- getInitialProviderState: (orderSource: OrderSource, network: Network, provider?: Provider): ProviderState => {
+ getInitialProviderState: (
+ orderSource: OrderSource,
+ network: Network,
+ provider?: Provider,
+ walletDisplayName?: string,
+ ): ProviderState => {
if (!_.isUndefined(provider)) {
- return providerStateFactory.getInitialProviderStateFromProvider(orderSource, network, provider);
+ return providerStateFactory.getInitialProviderStateFromProvider(
+ orderSource,
+ network,
+ provider,
+ walletDisplayName,
+ );
}
const providerStateFromWindowIfExits = providerStateFactory.getInitialProviderStateFromWindowIfExists(
orderSource,
network,
+ walletDisplayName,
);
if (providerStateFromWindowIfExits) {
return providerStateFromWindowIfExits;
} else {
- return providerStateFactory.getInitialProviderStateFallback(orderSource, network);
+ return providerStateFactory.getInitialProviderStateFallback(orderSource, network, walletDisplayName);
}
},
getInitialProviderStateFromProvider: (
orderSource: OrderSource,
network: Network,
provider: Provider,
+ walletDisplayName?: string,
): ProviderState => {
const providerState: ProviderState = {
name: envUtil.getProviderName(provider),
+ displayName: walletDisplayName || envUtil.getProviderDisplayName(provider),
provider,
web3Wrapper: new Web3Wrapper(provider),
assetBuyer: assetBuyerFactory.getAssetBuyer(provider, orderSource, network),
@@ -38,11 +51,16 @@ export const providerStateFactory = {
};
return providerState;
},
- getInitialProviderStateFromWindowIfExists: (orderSource: OrderSource, network: Network): Maybe<ProviderState> => {
+ getInitialProviderStateFromWindowIfExists: (
+ orderSource: OrderSource,
+ network: Network,
+ walletDisplayName?: string,
+ ): Maybe<ProviderState> => {
const injectedProviderIfExists = providerFactory.getInjectedProviderIfExists();
if (!_.isUndefined(injectedProviderIfExists)) {
const providerState: ProviderState = {
name: envUtil.getProviderName(injectedProviderIfExists),
+ displayName: walletDisplayName || envUtil.getProviderDisplayName(injectedProviderIfExists),
provider: injectedProviderIfExists,
web3Wrapper: new Web3Wrapper(injectedProviderIfExists),
assetBuyer: assetBuyerFactory.getAssetBuyer(injectedProviderIfExists, orderSource, network),
@@ -53,10 +71,15 @@ export const providerStateFactory = {
return undefined;
}
},
- getInitialProviderStateFallback: (orderSource: OrderSource, network: Network): ProviderState => {
+ getInitialProviderStateFallback: (
+ orderSource: OrderSource,
+ network: Network,
+ walletDisplayName?: string,
+ ): ProviderState => {
const provider = providerFactory.getFallbackNoSigningProvider(network);
const providerState: ProviderState = {
name: 'Fallback',
+ displayName: walletDisplayName || envUtil.getProviderDisplayName(provider),
provider,
web3Wrapper: new Web3Wrapper(provider),
assetBuyer: assetBuyerFactory.getAssetBuyer(provider, orderSource, network),
diff --git a/packages/instant/test/util/asset.test.ts b/packages/instant/test/util/asset.test.ts
index 4229b24ed..fc4e4e2e4 100644
--- a/packages/instant/test/util/asset.test.ts
+++ b/packages/instant/test/util/asset.test.ts
@@ -1,6 +1,7 @@
+import { AssetBuyerError } from '@0x/asset-buyer';
import { AssetProxyId, ObjectMap } from '@0x/types';
-import { Asset, AssetMetaData, ERC20AssetMetaData, Network, ZeroExInstantError } from '../../src/types';
+import { Asset, AssetMetaData, ERC20Asset, ERC20AssetMetaData, Network, ZeroExInstantError } from '../../src/types';
import { assetUtils } from '../../src/util/asset';
const ZRX_ASSET_DATA = '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498';
@@ -11,7 +12,7 @@ const ZRX_META_DATA: ERC20AssetMetaData = {
decimals: 18,
name: '0x',
};
-const ZRX_ASSET: Asset = {
+const ZRX_ASSET: ERC20Asset = {
assetData: ZRX_ASSET_DATA,
metaData: ZRX_META_DATA,
};
@@ -45,4 +46,32 @@ describe('assetDataUtil', () => {
).toThrowError(ZeroExInstantError.AssetMetaDataNotAvailable);
});
});
+ describe('assetBuyerErrorMessage', () => {
+ it('should return message for InsufficientAssetLiquidity', () => {
+ const insufficientAssetError = new Error(AssetBuyerError.InsufficientAssetLiquidity);
+ expect(assetUtils.assetBuyerErrorMessage(ZRX_ASSET, insufficientAssetError)).toEqual(
+ 'Not enough ZRX available',
+ );
+ });
+ it('should return message for InsufficientAssetLiquidity', () => {
+ const insufficientZrxError = new Error(AssetBuyerError.InsufficientZrxLiquidity);
+ expect(assetUtils.assetBuyerErrorMessage(ZRX_ASSET, insufficientZrxError)).toEqual(
+ 'Not enough ZRX available',
+ );
+ });
+ it('should message for StandardRelayerApiError', () => {
+ const standardRelayerError = new Error(AssetBuyerError.StandardRelayerApiError);
+ expect(assetUtils.assetBuyerErrorMessage(ZRX_ASSET, standardRelayerError)).toEqual(
+ 'ZRX is currently unavailable',
+ );
+ });
+ it('should return error for AssetUnavailable error', () => {
+ const assetUnavailableError = new Error(
+ `${AssetBuyerError.AssetUnavailable}: For assetData ${ZRX_ASSET_DATA}`,
+ );
+ expect(assetUtils.assetBuyerErrorMessage(ZRX_ASSET, assetUnavailableError)).toEqual(
+ 'ZRX is currently unavailable',
+ );
+ });
+ });
});
diff --git a/packages/instant/test/util/format.test.ts b/packages/instant/test/util/format.test.ts
index fe0a63e6e..38bf356ec 100644
--- a/packages/instant/test/util/format.test.ts
+++ b/packages/instant/test/util/format.test.ts
@@ -41,6 +41,18 @@ describe('format', () => {
it('converts BigNumber(5.3014059295032) to the string `5.301 ETH`', () => {
expect(format.ethUnitAmount(BIG_NUMBER_IRRATIONAL)).toBe('5.301 ETH');
});
+ it('shows 1 significant digit when rounded amount would be 0', () => {
+ expect(format.ethUnitAmount(new BigNumber(0.00003))).toBe('0.00003 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.000034))).toBe('0.00003 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.000035))).toBe('0.00004 ETH');
+ });
+ it('shows < 0.00001 when hits threshold', () => {
+ expect(format.ethUnitAmount(new BigNumber(0.000011))).toBe('0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.00001))).toBe('0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.000009))).toBe('< 0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0.0000000009))).toBe('< 0.00001 ETH');
+ expect(format.ethUnitAmount(new BigNumber(0))).toBe('0 ETH');
+ });
it('returns defaultText param when ethUnitAmount is not defined', () => {
const defaultText = 'defaultText';
expect(format.ethUnitAmount(undefined, 4, defaultText)).toBe(defaultText);
@@ -86,6 +98,12 @@ describe('format', () => {
it('correctly formats 5.3014059295032 ETH to usd according to some price', () => {
expect(format.ethUnitAmountInUsd(BIG_NUMBER_IRRATIONAL, BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('$13.43');
});
+ it('correctly formats amount that is less than 1 cent', () => {
+ expect(format.ethUnitAmountInUsd(new BigNumber(0.000001), BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('<$0.01');
+ });
+ it('correctly formats exactly 1 cent', () => {
+ expect(format.ethUnitAmountInUsd(new BigNumber(0.0039), BIG_NUMBER_FAKE_ETH_USD_PRICE)).toBe('$0.01');
+ });
it('returns defaultText param when ethUnitAmountInUsd or ethUsdPrice is not defined', () => {
const defaultText = 'defaultText';
expect(format.ethUnitAmountInUsd(undefined, undefined, 2, defaultText)).toBe(defaultText);
diff --git a/packages/instant/tsconfig.json b/packages/instant/tsconfig.json
index 28a6190b8..2b3c11c9f 100644
--- a/packages/instant/tsconfig.json
+++ b/packages/instant/tsconfig.json
@@ -2,16 +2,13 @@
"extends": "../../tsconfig",
"compilerOptions": {
"outDir": "lib",
- "rootDir": ".",
+ "rootDir": "src",
"jsx": "react",
- "allowSyntheticDefaultImports": true,
"noImplicitAny": true,
- "module": "ESNext",
- "moduleResolution": "node",
- "lib": ["es2015", "dom"],
- "target": "es5",
- "sourceMap": true
+ "allowSyntheticDefaultImports": true,
+ "declaration": false,
+ "declarationMap": false,
+ "composite": false
},
- "include": ["./src/**/*", "./test/**/*"],
- "exclude": ["./src/index.umd.ts"]
+ "include": ["./src/**/*"]
}
diff --git a/packages/instant/webpack.config.js b/packages/instant/webpack.config.js
index 41276809c..e74cf36d9 100644
--- a/packages/instant/webpack.config.js
+++ b/packages/instant/webpack.config.js
@@ -1,32 +1,119 @@
const childProcess = require('child_process');
const ip = require('ip');
const path = require('path');
+const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');
const webpack = require('webpack');
-// The common js bundle (not this one) is built using tsc.
-// The umd bundle (this one) has a different entrypoint.
-
const GIT_SHA = childProcess
.execSync('git rev-parse HEAD')
.toString()
.trim();
-const HEAP_PRODUCTION_ENV_VAR_NAME = 'INSTANT_HEAP_ANALYTICS_ID_PRODUCTION';
-const HEAP_DEVELOPMENT_ENV_VAR_NAME = 'INSTANT_HEAP_ANALYTICS_ID_DEVELOPMENT';
-const getHeapAnalyticsId = modeName => {
- if (modeName === 'production') {
- return process.env[HEAP_PRODUCTION_ENV_VAR_NAME];
+const DISCHARGE_TARGETS_THAT_REQUIRED_HEAP = ['production', 'staging', 'dogfood'];
+const getHeapConfigForDischargeTarget = dischargeTarget => {
+ return {
+ heapAnalyticsIdEnvName:
+ dischargeTarget === 'production'
+ ? 'INSTANT_HEAP_ANALYTICS_ID_PRODUCTION'
+ : 'INSTANT_HEAP_ANALYTICS_ID_DEVELOPMENT',
+ heapAnalyticsIdRequired: DISCHARGE_TARGETS_THAT_REQUIRED_HEAP.includes(dischargeTarget),
+ };
+};
+
+const DISCHARGE_TARGETS_THAT_REQUIRE_ROLLBAR = ['production', 'staging', 'dogfood'];
+const getRollbarConfigForDischargeTarget = dischargeTarget => {
+ if (DISCHARGE_TARGETS_THAT_REQUIRE_ROLLBAR.includes(dischargeTarget)) {
+ const rollbarSourceMapPublicPath =
+ dischargeTarget === 'production'
+ ? 'https://instant.0xproject.com'
+ : `http://0x-instant-${dischargeTarget}.s3-website-us-east-1.amazonaws.com`;
+
+ return {
+ rollbarSourceMapPublicPath,
+ rollbarRequired: true,
+ };
}
- if (modeName === 'development') {
- return process.env[HEAP_DEVELOPMENT_ENV_VAR_NAME];
+ return {
+ rollbarRequired: false,
+ };
+};
+
+const ROLLBAR_CLIENT_TOKEN_ENV_VAR_NAME = 'INSTANT_ROLLBAR_CLIENT_TOKEN';
+const ROLLBAR_PUBLISH_TOKEN_ENV_VAR_NAME = 'INSTANT_ROLLBAR_PUBLISH_TOKEN';
+const getRollbarTokens = (dischargeTarget, rollbarRequired) => {
+ const clientToken = process.env[ROLLBAR_CLIENT_TOKEN_ENV_VAR_NAME];
+ const publishToken = process.env[ROLLBAR_PUBLISH_TOKEN_ENV_VAR_NAME];
+
+ if (rollbarRequired) {
+ if (!clientToken) {
+ throw new Error(
+ `Rollbar client token required for ${dischargeTarget}, please set env var ${ROLLBAR_CLIENT_TOKEN_ENV_VAR_NAME}`,
+ );
+ }
+ if (!publishToken) {
+ throw new Error(
+ `Rollbar publish token required for ${dischargeTarget}, please set env var ${ROLLBAR_PUBLISH_TOKEN_ENV_VAR_NAME}`,
+ );
+ }
}
- return undefined;
+ return { clientToken, publishToken };
};
-module.exports = (env, argv) => {
+const generateConfig = (dischargeTarget, heapConfigOptions, rollbarConfigOptions, nodeEnv) => {
const outputPath = process.env.WEBPACK_OUTPUT_PATH || 'umd';
+
+ const { heapAnalyticsIdEnvName, heapAnalyticsIdRequired } = heapConfigOptions;
+ const heapAnalyticsId = process.env[heapAnalyticsIdEnvName];
+ if (heapAnalyticsIdRequired && !heapAnalyticsId) {
+ throw new Error(
+ `Must define heap analytics id in ENV var ${heapAnalyticsIdEnvName} when building for ${dischargeTarget}`,
+ );
+ }
+ const heapEnabled = heapAnalyticsId && (nodeEnv !== 'development' || process.env.INSTANT_HEAP_FORCE_DEVELOPMENT);
+
+ const rollbarTokens = getRollbarTokens(dischargeTarget, rollbarConfigOptions.rollbarRequired);
+ const rollbarEnabled =
+ rollbarTokens.clientToken && (nodeEnv !== 'development' || process.env.INSTANT_ROLLBAR_FORCE_DEVELOPMENT);
+
+ let rollbarPlugin;
+ if (rollbarConfigOptions.rollbarRequired) {
+ if (!rollbarEnabled || !rollbarTokens.publishToken || !rollbarConfigOptions.rollbarSourceMapPublicPath) {
+ throw new Error(`Rollbar required for ${dischargeTarget} but not configured`);
+ }
+ rollbarPlugin = new RollbarSourceMapPlugin({
+ accessToken: rollbarTokens.publishToken,
+ version: GIT_SHA,
+ publicPath: rollbarConfigOptions.rollbarSourceMapPublicPath,
+ });
+ }
+
+ const envVars = {
+ GIT_SHA: JSON.stringify(GIT_SHA),
+ NPM_PACKAGE_VERSION: JSON.stringify(process.env.npm_package_version),
+ ROLLBAR_ENABLED: rollbarEnabled,
+ HEAP_ENABLED: heapEnabled
+ };
+ if (dischargeTarget) {
+ envVars.INSTANT_DISCHARGE_TARGET = JSON.stringify(dischargeTarget);
+ }
+ if (heapAnalyticsId) {
+ envVars.HEAP_ANALYTICS_ID = JSON.stringify(heapAnalyticsId);
+ }
+ if (rollbarTokens.clientToken) {
+ envVars.ROLLBAR_CLIENT_TOKEN = JSON.stringify(rollbarTokens.clientToken);
+ }
+
+ const plugins = [
+ new webpack.DefinePlugin({
+ 'process.env': envVars,
+ }),
+ ];
+ if (rollbarPlugin) {
+ plugins.push(rollbarPlugin);
+ }
+
const config = {
entry: {
instant: './src/index.umd.ts',
@@ -37,15 +124,7 @@ module.exports = (env, argv) => {
library: 'zeroExInstant',
libraryTarget: 'umd',
},
- plugins: [
- new webpack.DefinePlugin({
- 'process.env': {
- GIT_SHA: JSON.stringify(GIT_SHA),
- HEAP_ANALYTICS_ID: getHeapAnalyticsId(argv.mode),
- NPM_PACKAGE_VERSION: JSON.stringify(process.env.npm_package_version),
- },
- }),
- ],
+ plugins,
devtool: 'source-map',
resolve: {
extensions: ['.js', '.json', '.ts', '.tsx'],
@@ -60,6 +139,15 @@ module.exports = (env, argv) => {
test: /\.svg$/,
loader: 'svg-react-loader',
},
+ {
+ test: /\.js$/,
+ loader: 'source-map-loader',
+ exclude: [
+ // instead of /\/node_modules\//
+ path.join(process.cwd(), 'node_modules'),
+ path.join(process.cwd(), '../..', 'node_modules'),
+ ],
+ },
],
},
devServer: {
@@ -79,3 +167,10 @@ module.exports = (env, argv) => {
};
return config;
};
+
+module.exports = (env, argv) => {
+ const dischargeTarget = env ? env.discharge_target : undefined;
+ const heapConfigOptions = getHeapConfigForDischargeTarget(dischargeTarget);
+ const rollbarConfigOptions = getRollbarConfigForDischargeTarget(dischargeTarget);
+ return generateConfig(dischargeTarget, heapConfigOptions, rollbarConfigOptions, argv.mode);
+};
diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json
index bf815e523..201190145 100644
--- a/packages/json-schemas/CHANGELOG.json
+++ b/packages/json-schemas/CHANGELOG.json
@@ -1,5 +1,32 @@
[
{
+ "version": "2.1.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.1.3",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "2.1.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "2.1.1",
"changes": [
diff --git a/packages/json-schemas/CHANGELOG.md b/packages/json-schemas/CHANGELOG.md
index dc412bded..7e407bdda 100644
--- a/packages/json-schemas/CHANGELOG.md
+++ b/packages/json-schemas/CHANGELOG.md
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.1.4 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.1.3 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v2.1.2 - _November 21, 2018_
+
+ * Dependencies updated
+
## v2.1.1 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json
index fb89a2d5b..57dd9dc00 100644
--- a/packages/json-schemas/package.json
+++ b/packages/json-schemas/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/json-schemas",
- "version": "2.1.1",
+ "version": "2.1.4",
"engines": {
"node": ">=6.12"
},
@@ -39,14 +39,14 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md",
"dependencies": {
- "@0x/typescript-typings": "^3.0.4",
+ "@0x/typescript-typings": "^3.0.6",
"@types/node": "*",
"jsonschema": "^1.2.0",
"lodash.values": "^4.3.0"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
- "@0x/utils": "^2.0.5",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/utils": "^2.0.8",
"@types/lodash.foreach": "^4.5.3",
"@types/lodash.values": "^4.3.3",
"@types/mocha": "^2.2.42",
diff --git a/packages/json-schemas/schemas/asset_pairs_request_opts_schema.json b/packages/json-schemas/schemas/asset_pairs_request_opts_schema.json
index 174a8fdc3..fad0bd371 100644
--- a/packages/json-schemas/schemas/asset_pairs_request_opts_schema.json
+++ b/packages/json-schemas/schemas/asset_pairs_request_opts_schema.json
@@ -1,5 +1,5 @@
{
- "id": "/AssetPairsRequestOpts",
+ "id": "/AssetPairsRequestOptsSchema",
"type": "object",
"properties": {
"assetDataA": { "$ref": "/hexSchema" },
diff --git a/packages/json-schemas/schemas/call_data_schema.json b/packages/json-schemas/schemas/call_data_schema.json
index c5972e8c1..e5e6e3282 100644
--- a/packages/json-schemas/schemas/call_data_schema.json
+++ b/packages/json-schemas/schemas/call_data_schema.json
@@ -4,13 +4,13 @@
"from": { "$ref": "/addressSchema" },
"to": { "$ref": "/addressSchema" },
"value": {
- "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }]
},
"gas": {
- "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }]
},
"gasPrice": {
- "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }]
},
"data": {
"type": "string",
diff --git a/packages/json-schemas/schemas/ec_signature_schema.json b/packages/json-schemas/schemas/ec_signature_schema.json
index bc79ca5e9..52ccfe7bb 100644
--- a/packages/json-schemas/schemas/ec_signature_schema.json
+++ b/packages/json-schemas/schemas/ec_signature_schema.json
@@ -1,5 +1,5 @@
{
- "id": "/ECSignature",
+ "id": "/ecSignatureSchema",
"properties": {
"v": {
"type": "number",
diff --git a/packages/json-schemas/schemas/js_number.json b/packages/json-schemas/schemas/js_number.json
deleted file mode 100644
index 6a72d92c0..000000000
--- a/packages/json-schemas/schemas/js_number.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "id": "/jsNumber",
- "type": "number",
- "minimum": 0
-}
diff --git a/packages/json-schemas/schemas/js_number_schema.json b/packages/json-schemas/schemas/js_number_schema.json
new file mode 100644
index 000000000..7df1c4747
--- /dev/null
+++ b/packages/json-schemas/schemas/js_number_schema.json
@@ -0,0 +1,5 @@
+{
+ "id": "/jsNumberSchema",
+ "type": "number",
+ "minimum": 0
+}
diff --git a/packages/json-schemas/schemas/order_config_request_schema.json b/packages/json-schemas/schemas/order_config_request_schema.json
index ca9b2e30e..19b043e7f 100644
--- a/packages/json-schemas/schemas/order_config_request_schema.json
+++ b/packages/json-schemas/schemas/order_config_request_schema.json
@@ -1,5 +1,5 @@
{
- "id": "/OrderConfigRequest",
+ "id": "/OrderConfigRequestSchema",
"type": "object",
"properties": {
"makerAddress": { "$ref": "/addressSchema" },
diff --git a/packages/json-schemas/schemas/order_watcher_web_socket_request_schema.json b/packages/json-schemas/schemas/order_watcher_web_socket_request_schema.json
new file mode 100644
index 000000000..b0c419f94
--- /dev/null
+++ b/packages/json-schemas/schemas/order_watcher_web_socket_request_schema.json
@@ -0,0 +1,52 @@
+{
+ "id": "/orderWatcherWebSocketRequestSchema",
+ "type": "object",
+ "definitions": {
+ "signedOrderParam": {
+ "type": "object",
+ "properties": {
+ "signedOrder": { "$ref": "/signedOrderSchema" }
+ },
+ "required": ["signedOrder"]
+ },
+ "orderHashParam": {
+ "type": "object",
+ "properties": {
+ "orderHash": { "$ref": "/hexSchema" }
+ },
+ "required": ["orderHash"]
+ }
+ },
+ "oneOf": [
+ {
+ "type": "object",
+ "properties": {
+ "id": { "type": "number" },
+ "jsonrpc": { "type": "string" },
+ "method": { "enum": ["ADD_ORDER"] },
+ "params": { "$ref": "#/definitions/signedOrderParam" }
+ },
+ "required": ["id", "jsonrpc", "method", "params"]
+ },
+ {
+ "type": "object",
+ "properties": {
+ "id": { "type": "number" },
+ "jsonrpc": { "type": "string" },
+ "method": { "enum": ["REMOVE_ORDER"] },
+ "params": { "$ref": "#/definitions/orderHashParam" }
+ },
+ "required": ["id", "jsonrpc", "method", "params"]
+ },
+ {
+ "type": "object",
+ "properties": {
+ "id": { "type": "number" },
+ "jsonrpc": { "type": "string" },
+ "method": { "enum": ["GET_STATS"] },
+ "params": {}
+ },
+ "required": ["id", "jsonrpc", "method"]
+ }
+ ]
+} \ No newline at end of file
diff --git a/packages/json-schemas/schemas/order_watcher_web_socket_utf8_message_schema.json b/packages/json-schemas/schemas/order_watcher_web_socket_utf8_message_schema.json
new file mode 100644
index 000000000..154d6d754
--- /dev/null
+++ b/packages/json-schemas/schemas/order_watcher_web_socket_utf8_message_schema.json
@@ -0,0 +1,10 @@
+{
+ "id": "/orderWatcherWebSocketUtf8MessageSchema",
+ "properties": {
+ "utf8Data": { "type": "string" }
+ },
+ "required": [
+ "utf8Data"
+ ],
+ "type": "object"
+}
diff --git a/packages/json-schemas/schemas/orderbook_request_schema.json b/packages/json-schemas/schemas/orderbook_request_schema.json
index 27848bdcb..5ce6e8ab0 100644
--- a/packages/json-schemas/schemas/orderbook_request_schema.json
+++ b/packages/json-schemas/schemas/orderbook_request_schema.json
@@ -1,9 +1,9 @@
{
- "id": "/OrderBookRequest",
+ "id": "/OrderbookRequestSchema",
"type": "object",
"properties": {
"baseAssetData": { "$ref": "/hexSchema" },
"quoteAssetData": { "$ref": "/hexSchema" }
},
"required": ["baseAssetData", "quoteAssetData"]
-} \ No newline at end of file
+}
diff --git a/packages/json-schemas/schemas/orders_request_opts_schema.json b/packages/json-schemas/schemas/orders_request_opts_schema.json
index 10da51060..4c1b9b4e9 100644
--- a/packages/json-schemas/schemas/orders_request_opts_schema.json
+++ b/packages/json-schemas/schemas/orders_request_opts_schema.json
@@ -1,5 +1,5 @@
{
- "id": "/OrdersRequestOpts",
+ "id": "/OrdersRequestOptsSchema",
"type": "object",
"properties": {
"makerAssetProxyId": { "$ref": "/hexSchema" },
diff --git a/packages/json-schemas/schemas/paged_request_opts_schema.json b/packages/json-schemas/schemas/paged_request_opts_schema.json
index 7cfc73947..f143c28b0 100644
--- a/packages/json-schemas/schemas/paged_request_opts_schema.json
+++ b/packages/json-schemas/schemas/paged_request_opts_schema.json
@@ -1,5 +1,5 @@
{
- "id": "/PagedRequestOpts",
+ "id": "/PagedRequestOptsSchema",
"type": "object",
"properties": {
"page": { "type": "number" },
diff --git a/packages/json-schemas/schemas/request_opts_schema.json b/packages/json-schemas/schemas/request_opts_schema.json
index b50547d18..2206f5016 100644
--- a/packages/json-schemas/schemas/request_opts_schema.json
+++ b/packages/json-schemas/schemas/request_opts_schema.json
@@ -1,5 +1,5 @@
{
- "id": "/RequestOpts",
+ "id": "/RequestOptsSchema",
"type": "object",
"properties": {
"networkId": { "type": "number" }
diff --git a/packages/json-schemas/schemas/tx_data_schema.json b/packages/json-schemas/schemas/tx_data_schema.json
index 4643521ce..8c3daba4e 100644
--- a/packages/json-schemas/schemas/tx_data_schema.json
+++ b/packages/json-schemas/schemas/tx_data_schema.json
@@ -4,13 +4,13 @@
"from": { "$ref": "/addressSchema" },
"to": { "$ref": "/addressSchema" },
"value": {
- "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }]
},
"gas": {
- "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }]
},
"gasPrice": {
- "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumber" }]
+ "oneOf": [{ "$ref": "/numberSchema" }, { "$ref": "/jsNumberSchema" }]
},
"data": {
"type": "string",
diff --git a/packages/json-schemas/src/schema_validator.ts b/packages/json-schemas/src/schema_validator.ts
index 3f303137b..43647b594 100644
--- a/packages/json-schemas/src/schema_validator.ts
+++ b/packages/json-schemas/src/schema_validator.ts
@@ -8,12 +8,18 @@ import { schemas } from './schemas';
*/
export class SchemaValidator {
private readonly _validator: Validator;
+ private static _assertSchemaDefined(schema: Schema): void {
+ if (schema === undefined) {
+ throw new Error(`Cannot add undefined schema`);
+ }
+ }
/**
* Instantiates a SchemaValidator instance
*/
constructor() {
this._validator = new Validator();
for (const schema of values(schemas)) {
+ SchemaValidator._assertSchemaDefined(schema);
this._validator.addSchema(schema, schema.id);
}
}
@@ -24,6 +30,7 @@ export class SchemaValidator {
* @param schema The schema to add
*/
public addSchema(schema: Schema): void {
+ SchemaValidator._assertSchemaDefined(schema);
this._validator.addSchema(schema, schema.id);
}
// In order to validate a complex JS object using jsonschema, we must replace any complex
@@ -37,6 +44,7 @@ export class SchemaValidator {
* @returns The results of the validation
*/
public validate(instance: any, schema: Schema): ValidatorResult {
+ SchemaValidator._assertSchemaDefined(schema);
const jsonSchemaCompatibleObject = JSON.parse(JSON.stringify(instance));
return this._validator.validate(jsonSchemaCompatibleObject, schema);
}
diff --git a/packages/json-schemas/src/schemas.ts b/packages/json-schemas/src/schemas.ts
index 21a6f424c..9e8eb6959 100644
--- a/packages/json-schemas/src/schemas.ts
+++ b/packages/json-schemas/src/schemas.ts
@@ -8,7 +8,7 @@ import * as ecSignatureSchema from '../schemas/ec_signature_schema.json';
import * as eip712TypedDataSchema from '../schemas/eip712_typed_data_schema.json';
import * as hexSchema from '../schemas/hex_schema.json';
import * as indexFilterValuesSchema from '../schemas/index_filter_values_schema.json';
-import * as jsNumber from '../schemas/js_number.json';
+import * as jsNumber from '../schemas/js_number_schema.json';
import * as numberSchema from '../schemas/number_schema.json';
import * as orderCancellationRequestsSchema from '../schemas/order_cancel_schema.json';
import * as orderConfigRequestSchema from '../schemas/order_config_request_schema.json';
@@ -16,6 +16,8 @@ import * as orderFillOrKillRequestsSchema from '../schemas/order_fill_or_kill_re
import * as orderFillRequestsSchema from '../schemas/order_fill_requests_schema.json';
import * as orderHashSchema from '../schemas/order_hash_schema.json';
import * as orderSchema from '../schemas/order_schema.json';
+import * as orderWatcherWebSocketRequestSchema from '../schemas/order_watcher_web_socket_request_schema.json';
+import * as orderWatcherWebSocketUtf8MessageSchema from '../schemas/order_watcher_web_socket_utf8_message_schema.json';
import * as orderBookRequestSchema from '../schemas/orderbook_request_schema.json';
import * as ordersRequestOptsSchema from '../schemas/orders_request_opts_schema.json';
import * as ordersSchema from '../schemas/orders_schema.json';
@@ -66,6 +68,8 @@ export const schemas = {
jsNumber,
requestOptsSchema,
pagedRequestOptsSchema,
+ orderWatcherWebSocketRequestSchema,
+ orderWatcherWebSocketUtf8MessageSchema,
ordersRequestOptsSchema,
orderBookRequestSchema,
orderConfigRequestSchema,
diff --git a/packages/json-schemas/tsconfig.json b/packages/json-schemas/tsconfig.json
index a79d54385..7d7ce1d7e 100644
--- a/packages/json-schemas/tsconfig.json
+++ b/packages/json-schemas/tsconfig.json
@@ -23,6 +23,8 @@
"./schemas/order_schema.json",
"./schemas/signed_order_schema.json",
"./schemas/orders_schema.json",
+ "./schemas/order_watcher_web_socket_request_schema.json",
+ "./schemas/order_watcher_web_socket_utf8_message_schema.json",
"./schemas/paginated_collection_schema.json",
"./schemas/relayer_api_asset_data_pairs_response_schema.json",
"./schemas/relayer_api_asset_data_pairs_schema.json",
@@ -40,7 +42,7 @@
"./schemas/relayer_api_orders_schema.json",
"./schemas/signed_orders_schema.json",
"./schemas/token_schema.json",
- "./schemas/js_number.json",
+ "./schemas/js_number_schema.json",
"./schemas/zero_ex_transaction_schema.json",
"./schemas/tx_data_schema.json",
"./schemas/index_filter_values_schema.json",
diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json
index f990db6b0..0e9fa4920 100644
--- a/packages/metacoin/package.json
+++ b/packages/metacoin/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/metacoin",
- "version": "0.0.28",
+ "version": "0.0.32",
"engines": {
"node": ">=6.12"
},
@@ -18,7 +18,7 @@
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
"test:profile": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --bail --exit --timeout 10000",
- "generate_contract_wrappers": "abi-gen --abis 'artifacts/Metacoin.json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers --backend ethers",
+ "generate_contract_wrappers": "abi-gen --abis 'artifacts/Metacoin.json' --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output src/contract_wrappers --backend ethers",
"coverage:report:text": "istanbul report text",
"coverage:report:html": "istanbul report html && open coverage/index.html",
"profiler:report:html": "istanbul report html && open coverage/index.html",
@@ -29,25 +29,26 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
- "@0x/abi-gen": "^1.0.16",
- "@0x/base-contract": "^3.0.6",
- "@0x/sol-cov": "^2.1.12",
- "@0x/subproviders": "^2.1.4",
- "@0x/tslint-config": "^1.0.10",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/abi-gen": "^1.0.19",
+ "@0x/abi-gen-templates": "^1.0.1",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/sol-cov": "^2.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/mocha": "^5.2.2",
"copyfiles": "^2.0.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"run-s": "^0.0.0"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.17",
- "@0x/sol-compiler": "^1.1.12",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.1",
diff --git a/packages/migrations/.gitignore b/packages/migrations/.gitignore
new file mode 100644
index 000000000..4de81c5a8
--- /dev/null
+++ b/packages/migrations/.gitignore
@@ -0,0 +1,2 @@
+*.zip
+0x_ganache_snapshot
diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json
index 5b0d58909..cee64a69f 100644
--- a/packages/migrations/CHANGELOG.json
+++ b/packages/migrations/CHANGELOG.json
@@ -1,5 +1,61 @@
[
{
+ "version": "2.3.0",
+ "changes": [
+ {
+ "note": "Added migrations for Dutch Auction contract",
+ "pr": 1465
+ }
+ ]
+ },
+ {
+ "version": "2.2.2",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.2.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "version": "2.2.0",
+ "changes": [
+ {
+ "note": "Add CLI `0x-migrate` for running the 0x migrations in a language-agnostic way",
+ "pr": 1324
+ },
+ {
+ "note": "Deploy testnet Exchange arfitact. Previously mainnet Exchange artifact was deployed.",
+ "pr": 1309
+ },
+ {
+ "note": "Fund the Forwarder with ZRX for fees.",
+ "pr": 1309
+ }
+ ],
+ "timestamp": 1543401373
+ },
+ {
+ "version": "2.1.0",
+ "changes": [
+ {
+ "note":
+ "Export all type declarations used by the public interface, as well as the `ContractAddresses` mapping",
+ "pr": 1301
+ }
+ ],
+ "timestamp": 1542821676
+ },
+ {
"timestamp": 1542208198,
"version": "2.0.4",
"changes": [
diff --git a/packages/migrations/CHANGELOG.md b/packages/migrations/CHANGELOG.md
index 87d0b25ca..0b7b9a364 100644
--- a/packages/migrations/CHANGELOG.md
+++ b/packages/migrations/CHANGELOG.md
@@ -5,6 +5,24 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.2.2 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.2.1 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v2.2.0 - _November 28, 2018_
+
+ * Add CLI `0x-migrate` for running the 0x migrations in a language-agnostic way (#1324)
+ * Deploy testnet Exchange arfitact. Previously mainnet Exchange artifact was deployed. (#1309)
+ * Fund the Forwarder with ZRX for fees. (#1309)
+
+## v2.1.0 - _November 21, 2018_
+
+ * Export all type declarations used by the public interface, as well as the `ContractAddresses` mapping (#1301)
+
## v2.0.4 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/migrations/Dockerfile b/packages/migrations/Dockerfile
new file mode 100644
index 000000000..c4d6128c2
--- /dev/null
+++ b/packages/migrations/Dockerfile
@@ -0,0 +1,15 @@
+FROM mhart/alpine-node:10
+
+WORKDIR /usr/src/app
+
+RUN npm install -g ganache-cli@6.1.6
+
+ENV MNEMONIC "concert load couple harbor equip island argue ramp clarify fence smart topic"
+ENV NETWORK_ID 50
+ENV VERSION "latest"
+ENV SNAPSHOT_HOST "http://ganache-snapshots.0x.org.s3-website.us-east-2.amazonaws.com"
+ENV SNAPSHOT_NAME "0x_ganache_snapshot"
+EXPOSE 8545
+
+CMD [ "sh", "-c", "wget $SNAPSHOT_HOST/$SNAPSHOT_NAME-$VERSION.zip -O snapshot.zip && unzip snapshot.zip && ganache-cli --gasLimit 10000000 --db $SNAPSHOT_NAME --noVMErrorsOnRPCResponse -p 8545 --networkId \"$NETWORK_ID\" -m \"$MNEMONIC\" -h 0.0.0.0"]
+
diff --git a/packages/migrations/README.md b/packages/migrations/README.md
index b90d730eb..1e8b92bf8 100644
--- a/packages/migrations/README.md
+++ b/packages/migrations/README.md
@@ -57,3 +57,44 @@ In order to migrate the V2 0x smart contracts to TestRPC/Ganache running at `htt
```bash
yarn migrate:v2
```
+
+### Publish
+
+#### 0x Ganache Snapshot
+
+The 0x Ganache snapshot can be generated and published in this package. In order to build the snapshot for this version of migrations run:
+
+```bash
+yarn build:snapshot
+```
+
+This will run the migrations in Ganache and output a zip file to be uploaded to the s3 bucket. For example, after running this command you will have created `0x_ganache_snapshot-2.2.2.zip`. To publish the zip file to the s3 bucket run:
+
+```bash
+yarn publish:snapshot
+```
+
+This snapshot will now be publicly available at http://ganache-snapshots.0x.org.s3.amazonaws.com/0x_ganache_snapshot-latest.zip and also versioned with the package.json version.
+
+#### 0x Ganache Docker Image
+
+We also publish a simple docker image which downloads the latest snapshot, extracts and runs Ganache. This is not required to be built when migrations change as it always downloads and runs the latest zip file. If you have made changes to the Dockerfile then a publish of the image is required. To do this run:
+
+```bash
+yarn build:snapshot:docker
+yarn publish:snapshot:docker
+```
+
+The result is a published docker image to the 0xorg docker registry. To start the docker image run:
+
+```bash
+docker run -p 8545:8545 -ti 0xorg/ganache-cli:latest
+```
+
+This will pull the latest zip in the s3 bucket, extract and start Ganache with the snapshot.
+
+In the event you need a specific version of the published Ganache snapshot run the following specifying the VERSION environment variable:
+
+```bash
+docker run -e VERSION=2.2.2 -p 8545:8545 -ti 0xorg/ganache-cli:latest
+```
diff --git a/packages/migrations/bin/0x-migrate.js b/packages/migrations/bin/0x-migrate.js
new file mode 100755
index 000000000..59778c0fc
--- /dev/null
+++ b/packages/migrations/bin/0x-migrate.js
@@ -0,0 +1,2 @@
+#!/usr/bin/env node
+require('../lib/cli.js');
diff --git a/packages/migrations/package.json b/packages/migrations/package.json
index 8eaae96ba..0d6ad037c 100644
--- a/packages/migrations/package.json
+++ b/packages/migrations/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/migrations",
- "version": "2.0.4",
+ "version": "2.2.2",
"engines": {
"node": ">=6.12"
},
@@ -10,37 +10,56 @@
"scripts": {
"build": "tsc -b",
"build:ci": "yarn build",
- "clean": "shx rm -rf lib",
+ "clean": "shx rm -rf lib ${npm_package_config_snapshot_name} ${npm_package_config_snapshot_name}-*.zip",
"lint": "tslint --format stylish --project .",
"migrate:v2": "run-s build script:migrate:v2",
- "script:migrate:v2": "node ./lib/migrate.js --contracts-version 2.0.0"
+ "migrate:v2:snapshot": "run-s build script:migrate:v2:snapshot",
+ "script:migrate:v2": "node ./lib/migrate.js",
+ "script:migrate:v2:snapshot": "node ./lib/migrate_snapshot.js",
+ "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES",
+ "build:snapshot": "rm -rf ${npm_package_config_snapshot_name} && yarn migrate:v2:snapshot && zip -r \"${npm_package_config_snapshot_name}-${npm_package_version}.zip\" ${npm_package_config_snapshot_name}",
+ "build:snapshot:docker": "docker build --tag ${npm_package_config_docker_snapshot_name}:${npm_package_version} --tag ${npm_package_config_docker_snapshot_name}:latest .",
+ "publish:snapshot": "aws s3 cp ${npm_package_config_snapshot_name}-${npm_package_version}.zip ${npm_package_config_s3_snapshot_bucket} && aws s3 cp ${npm_package_config_s3_snapshot_bucket}/${npm_package_config_snapshot_name}-${npm_package_version}.zip ${npm_package_config_s3_snapshot_bucket}/${npm_package_config_snapshot_name}-latest.zip",
+ "publish:snapshot:docker": "docker push ${npm_package_config_docker_snapshot_name}:latest"
+ },
+ "config": {
+ "s3_snapshot_bucket": "s3://ganache-snapshots.0x.org",
+ "docker_snapshot_name": "0xorg/ganache-cli",
+ "snapshot_name": "0x_ganache_snapshot",
+ "postpublish": {
+ "assets": []
+ }
+ },
+ "bin": {
+ "0x-migrate": "bin/0x-migrate.js"
},
"license": "Apache-2.0",
"devDependencies": {
- "@0x/dev-utils": "^1.0.17",
- "@0x/tslint-config": "^1.0.10",
- "@0x/types": "^1.2.1",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/types": "^1.4.1",
"@types/yargs": "^10.0.0",
"make-promises-safe": "^1.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"tslint": "5.11.0",
+ "typedoc": "0.13.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^1.0.5",
- "@0x/base-contract": "^3.0.6",
- "@0x/contract-addresses": "^1.1.0",
- "@0x/contract-artifacts": "^1.1.0",
- "@0x/order-utils": "^3.0.2",
- "@0x/sol-compiler": "^1.1.12",
- "@0x/subproviders": "^2.1.4",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contract-addresses": "^2.0.0",
+ "@0x/contract-artifacts": "^1.1.2",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@ledgerhq/hw-app-eth": "^4.3.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5"
},
diff --git a/packages/migrations/src/cli.ts b/packages/migrations/src/cli.ts
new file mode 100644
index 000000000..2404e7921
--- /dev/null
+++ b/packages/migrations/src/cli.ts
@@ -0,0 +1,38 @@
+#!/usr/bin/env node
+import { RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
+import { logUtils } from '@0x/utils';
+import * as yargs from 'yargs';
+
+import { runMigrationsAsync } from './migration';
+
+const args = yargs
+ .option('rpc-url', {
+ describe: 'Endpoint where backing Ethereum JSON RPC interface is available',
+ type: 'string',
+ demandOption: false,
+ default: 'http://localhost:8545',
+ })
+ .option('from', {
+ describe: 'Ethereum address from which to deploy the contracts',
+ type: 'string',
+ demandOption: true,
+ })
+ .example(
+ '$0 --rpc-url http://localhost:8545 --from 0x5409ed021d9299bf6814279a6a1411a7e866a631',
+ 'Full usage example',
+ ).argv;
+
+(async () => {
+ const rpcSubprovider = new RPCSubprovider(args['rpc-url']);
+ const provider = new Web3ProviderEngine();
+ provider.addProvider(rpcSubprovider);
+ provider.start();
+ const txDefaults = {
+ from: args.from,
+ };
+ await runMigrationsAsync(provider, txDefaults);
+ process.exit(0);
+})().catch(err => {
+ logUtils.log(err);
+ process.exit(1);
+});
diff --git a/packages/migrations/src/index.ts b/packages/migrations/src/index.ts
index 8f629a24b..4f22c30b9 100644
--- a/packages/migrations/src/index.ts
+++ b/packages/migrations/src/index.ts
@@ -1 +1,11 @@
+export {
+ Provider,
+ TxData,
+ JSONRPCRequestPayload,
+ JSONRPCErrorCallback,
+ TxDataPayable,
+ JSONRPCResponsePayload,
+ JSONRPCResponseError,
+} from 'ethereum-types';
+export { ContractAddresses } from '@0x/contract-addresses';
export { runMigrationsAsync, runMigrationsOnceAsync } from './migration';
diff --git a/packages/migrations/src/migrate_snapshot.ts b/packages/migrations/src/migrate_snapshot.ts
new file mode 100644
index 000000000..13fb063da
--- /dev/null
+++ b/packages/migrations/src/migrate_snapshot.ts
@@ -0,0 +1,32 @@
+#!/usr/bin/env node
+import { devConstants, web3Factory } from '@0x/dev-utils';
+import { logUtils } from '@0x/utils';
+import { Provider } from 'ethereum-types';
+import * as fs from 'fs';
+import * as _ from 'lodash';
+import * as path from 'path';
+
+import { runMigrationsAsync } from './migration';
+
+(async () => {
+ let providerConfigs;
+ let provider: Provider;
+ let txDefaults;
+ const packageJsonPath = path.join(__dirname, '..', 'package.json');
+ const packageJsonString = fs.readFileSync(packageJsonPath, 'utf8');
+ const packageJson = JSON.parse(packageJsonString);
+ if (_.isUndefined(packageJson.config) || _.isUndefined(packageJson.config.snapshot_name)) {
+ throw new Error(`Did not find 'snapshot_name' key in package.json config`);
+ }
+
+ providerConfigs = { shouldUseInProcessGanache: true, ganacheDatabasePath: packageJson.config.snapshot_name };
+ provider = web3Factory.getRpcProvider(providerConfigs);
+ txDefaults = {
+ from: devConstants.TESTRPC_FIRST_ADDRESS,
+ };
+ await runMigrationsAsync(provider, txDefaults);
+ process.exit(0);
+})().catch(err => {
+ logUtils.log(err);
+ process.exit(1);
+});
diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts
index 86c76a54b..99d1719f1 100644
--- a/packages/migrations/src/migration.ts
+++ b/packages/migrations/src/migration.ts
@@ -11,10 +11,9 @@ import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info';
/**
* Creates and deploys all the contracts that are required for the latest
- * version of the 0x protocol. Custom migrations can be defined here. This will
- * be called with the CLI 'migrate:v2' command.
- * @param provider Web3 provider instance.
- * @param txDefaults Default transaction values to use when deploying contracts.
+ * version of the 0x protocol.
+ * @param provider Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to.
+ * @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
* @returns The addresses of the contracts that were deployed.
*/
export async function runMigrationsAsync(provider: Provider, txDefaults: Partial<TxData>): Promise<ContractAddresses> {
@@ -48,6 +47,7 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
artifacts.Exchange,
provider,
txDefaults,
+ zrxAssetData,
);
// Multisigs
@@ -141,6 +141,21 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
zrxAssetData,
);
+ // DutchAuction
+ const dutchAuction = await wrappers.DutchAuctionContract.deployFrom0xArtifactAsync(
+ artifacts.DutchAuction,
+ provider,
+ txDefaults,
+ exchange.address,
+ );
+
+ // Fund the Forwarder with ZRX
+ const zrxDecimals = await zrxToken.decimals.callAsync();
+ const zrxForwarderAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5000), zrxDecimals);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await zrxToken.transfer.sendTransactionAsync(forwarder.address, zrxForwarderAmount, txDefaults),
+ );
+
return {
erc20Proxy: erc20Proxy.address,
erc721Proxy: erc721Proxy.address,
@@ -150,6 +165,7 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
assetProxyOwner: assetProxyOwner.address,
forwarder: forwarder.address,
orderValidator: orderValidator.address,
+ dutchAuction: dutchAuction.address,
};
}
@@ -159,8 +175,8 @@ let _cachedContractAddresses: ContractAddresses;
* Exactly like runMigrationsAsync but will only run the migrations the first
* time it is called. Any subsequent calls will return the cached contract
* addresses.
- * @param provider Web3 provider instance.
- * @param txDefaults Default transaction values to use when deploying contracts.
+ * @param provider Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to.
+ * @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
* @returns The addresses of the contracts that were deployed.
*/
export async function runMigrationsOnceAsync(
diff --git a/packages/migrations/typedoc-tsconfig.json b/packages/migrations/typedoc-tsconfig.json
new file mode 100644
index 000000000..c9b0af1ae
--- /dev/null
+++ b/packages/migrations/typedoc-tsconfig.json
@@ -0,0 +1,7 @@
+{
+ "extends": "../../typedoc-tsconfig",
+ "compilerOptions": {
+ "outDir": "lib"
+ },
+ "include": ["./src/**/*", "./test/**/*"]
+}
diff --git a/packages/monorepo-scripts/CHANGELOG.json b/packages/monorepo-scripts/CHANGELOG.json
index 170a97a33..cebe7ec72 100644
--- a/packages/monorepo-scripts/CHANGELOG.json
+++ b/packages/monorepo-scripts/CHANGELOG.json
@@ -13,6 +13,14 @@
{
"note": "Add ForwarderError to the IGNORED_EXCESSIVE_TYPES array",
"pr": 1147
+ },
+ {
+ "note": "Fix a bug when hardcoded CHANGELOG paths cause fetching release notes to fail",
+ "pr": 1311
+ },
+ {
+ "note": "Added DutchAuctionWrapper to the CLASSES_WITH_HIDDEN_CONSTRUCTORS array",
+ "pr": 1465
}
]
},
diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json
index a31085014..0483e87c8 100644
--- a/packages/monorepo-scripts/package.json
+++ b/packages/monorepo-scripts/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@0x/monorepo-scripts",
- "version": "1.0.13",
+ "version": "1.0.15",
"engines": {
"node": ">=6.12"
},
diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts
index 7a14f8664..dfbe98028 100644
--- a/packages/monorepo-scripts/src/doc_gen_configs.ts
+++ b/packages/monorepo-scripts/src/doc_gen_configs.ts
@@ -37,6 +37,7 @@ export const docGenConfigs: DocGenConfigs = {
// and getting confused. Any class name in this list will not have it's constructor rendered in our docs.
CLASSES_WITH_HIDDEN_CONSTRUCTORS: [
'AssetBuyer',
+ 'DutchAuctionWrapper',
'ERC20ProxyWrapper',
'ERC20TokenWrapper',
'ERC721ProxyWrapper',
diff --git a/packages/monorepo-scripts/src/prepublish_checks.ts b/packages/monorepo-scripts/src/prepublish_checks.ts
index fc550cf3a..36e61714b 100644
--- a/packages/monorepo-scripts/src/prepublish_checks.ts
+++ b/packages/monorepo-scripts/src/prepublish_checks.ts
@@ -17,7 +17,6 @@ async function prepublishChecksAsync(): Promise<void> {
await checkChangelogFormatAsync(updatedPublicPackages);
await checkGitTagsForNextVersionAndDeleteIfExistAsync(updatedPublicPackages);
await checkPublishRequiredSetupAsync();
- checkRequiredEnvVariables();
}
async function checkGitTagsForNextVersionAndDeleteIfExistAsync(updatedPublicPackages: Package[]): Promise<void> {
@@ -184,17 +183,7 @@ async function checkPublishRequiredSetupAsync(): Promise<void> {
}
}
-const checkRequiredEnvVariables = () => {
- utils.log('Checking required environment variables...');
- const requiredEnvVars = ['INSTANT_HEAP_ANALYTICS_ID_PRODUCTION'];
- requiredEnvVars.forEach(requiredEnvVarName => {
- if (_.isUndefined(process.env[requiredEnvVarName])) {
- throw new Error(`Must have ${requiredEnvVarName} set`);
- }
- });
-};
-
prepublishChecksAsync().catch(err => {
- utils.log(err.message);
+ utils.log(err);
process.exit(1);
});
diff --git a/packages/monorepo-scripts/src/test_installation.ts b/packages/monorepo-scripts/src/test_installation.ts
index 96875d0f9..5ae13b198 100644
--- a/packages/monorepo-scripts/src/test_installation.ts
+++ b/packages/monorepo-scripts/src/test_installation.ts
@@ -98,7 +98,7 @@ async function testInstallPackageAsync(
const lastChangelogVersion = JSON.parse(fs.readFileSync(changelogPath).toString())[0].version;
const packageName = installablePackage.packageJson.name;
utils.log(`Testing ${packageName}@${lastChangelogVersion}`);
- const packageDirName = path.join(...(packageName + '-test').split('/'));
+ const packageDirName = path.join(...`${packageName}-test`.split('/'));
// NOTE(fabio): The `testDirectory` needs to be somewhere **outside** the monorepo root directory.
// Otherwise, it will have access to the hoisted `node_modules` directory and the Typescript missing
// type errors will not be caught.
diff --git a/packages/monorepo-scripts/src/utils/github_release_utils.ts b/packages/monorepo-scripts/src/utils/github_release_utils.ts
index 7434d397e..e63244b46 100644
--- a/packages/monorepo-scripts/src/utils/github_release_utils.ts
+++ b/packages/monorepo-scripts/src/utils/github_release_utils.ts
@@ -41,7 +41,7 @@ export async function publishReleaseNotesAsync(packagesToPublish: Package[], isD
let assets: string[] = [];
let aggregateNotes = '';
_.each(packagesToPublish, pkg => {
- aggregateNotes += getReleaseNotesForPackage(pkg.packageJson.name);
+ aggregateNotes += getReleaseNotesForPackage(pkg.location, pkg.packageJson.name);
const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets');
if (!_.isUndefined(packageAssets)) {
@@ -88,14 +88,8 @@ function adjustAssetPaths(assets: string[]): string[] {
return finalAssets;
}
-function getReleaseNotesForPackage(packageName: string): string {
- const packageNameWithoutNamespace = packageName.replace('@0x/', '');
- const changelogJSONPath = path.join(
- constants.monorepoRootPath,
- 'packages',
- packageNameWithoutNamespace,
- 'CHANGELOG.json',
- );
+function getReleaseNotesForPackage(packageLocation: string, packageName: string): string {
+ const changelogJSONPath = path.join(packageLocation, 'CHANGELOG.json');
const changelogJSON = readFileSync(changelogJSONPath, 'utf-8');
const changelogs = JSON.parse(changelogJSON);
const latestLog = changelogs[0];
diff --git a/packages/monorepo-scripts/src/utils/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts
index 44ff971e8..95b187cc2 100644
--- a/packages/monorepo-scripts/src/utils/utils.ts
+++ b/packages/monorepo-scripts/src/utils/utils.ts
@@ -91,6 +91,7 @@ export const utils = {
const changelog = changelogUtils.getChangelogOrCreateIfMissing(packageName, packageLocation);
if (_.isEmpty(changelog)) {
nextVersionIfValid = semver.inc(currentVersion, 'patch');
+ return nextVersionIfValid as string;
}
const lastEntry = changelog[0];
if (semver.gt(currentVersion, lastEntry.version)) {
diff --git a/packages/order-utils/CHANGELOG.json b/packages/order-utils/CHANGELOG.json
index 55e7defda..292f7a57b 100644
--- a/packages/order-utils/CHANGELOG.json
+++ b/packages/order-utils/CHANGELOG.json
@@ -1,5 +1,61 @@
[
{
+ "version": "3.1.0",
+ "changes": [
+ {
+ "note":
+ "Use new ABI encoder, add encoding/decoding logic for MultiAsset assetData, and add information to return values in orderStateUtils",
+ "pr": 1363
+ }
+ ]
+ },
+ {
+ "version": "3.0.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "3.0.6",
+ "changes": [
+ {
+ "note": "Fix bug in wallet signature type verification",
+ "pr": 1414
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1544482891,
+ "version": "3.0.5",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "3.0.4",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "3.0.3",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "3.0.2",
"changes": [
diff --git a/packages/order-utils/CHANGELOG.md b/packages/order-utils/CHANGELOG.md
index edf1569a7..bc8b48767 100644
--- a/packages/order-utils/CHANGELOG.md
+++ b/packages/order-utils/CHANGELOG.md
@@ -5,6 +5,26 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.7 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.0.6 - _December 11, 2018_
+
+ * Fix bug in wallet signature type verification (#1414)
+
+## v3.0.5 - _December 10, 2018_
+
+ * Dependencies updated
+
+## v3.0.4 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v3.0.3 - _November 21, 2018_
+
+ * Dependencies updated
+
## v3.0.2 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json
index fe5ea70b1..400c9b66f 100644
--- a/packages/order-utils/package.json
+++ b/packages/order-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/order-utils",
- "version": "3.0.2",
+ "version": "3.0.7",
"engines": {
"node": ">=6.12"
},
@@ -35,8 +35,8 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md",
"devDependencies": {
- "@0x/dev-utils": "^1.0.17",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
"chai": "^4.0.1",
@@ -53,18 +53,18 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^1.0.5",
- "@0x/assert": "^1.0.17",
- "@0x/base-contract": "^3.0.6",
- "@0x/contract-artifacts": "^1.1.0",
- "@0x/json-schemas": "^2.1.1",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/assert": "^1.0.20",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contract-artifacts": "^1.1.2",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/node": "*",
"bn.js": "^4.11.8",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-abi": "0.6.5",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
diff --git a/packages/order-utils/src/asset_data_utils.ts b/packages/order-utils/src/asset_data_utils.ts
index 9bbef3a23..f314891e2 100644
--- a/packages/order-utils/src/asset_data_utils.ts
+++ b/packages/order-utils/src/asset_data_utils.ts
@@ -1,10 +1,19 @@
-import { AssetData, AssetProxyId, ERC20AssetData, ERC721AssetData } from '@0x/types';
-import { BigNumber } from '@0x/utils';
-import ethAbi = require('ethereumjs-abi');
-import ethUtil = require('ethereumjs-util');
+import {
+ AssetProxyId,
+ ERC20AssetData,
+ ERC721AssetData,
+ MultiAssetData,
+ MultiAssetDataWithRecursiveDecoding,
+ SingleAssetData,
+} from '@0x/types';
+import { AbiEncoder, BigNumber } from '@0x/utils';
+import * as _ from 'lodash';
import { constants } from './constants';
+const encodingRules: AbiEncoder.EncodingRules = { shouldOptimize: true };
+const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
+
export const assetDataUtils = {
/**
* Encodes an ERC20 token address into a hex encoded assetData string, usable in the makerAssetData or
@@ -13,7 +22,10 @@ export const assetDataUtils = {
* @return The hex encoded assetData string
*/
encodeERC20AssetData(tokenAddress: string): string {
- return ethUtil.bufferToHex(ethAbi.simpleEncode('ERC20Token(address)', tokenAddress));
+ const abiEncoder = new AbiEncoder.Method(constants.ERC20_METHOD_ABI);
+ const args = [tokenAddress];
+ const assetData = abiEncoder.encode(args, encodingRules);
+ return assetData;
},
/**
* Decodes an ERC20 assetData hex string into it's corresponding ERC20 tokenAddress & assetProxyId
@@ -21,26 +33,14 @@ export const assetDataUtils = {
* @return An object containing the decoded tokenAddress & assetProxyId
*/
decodeERC20AssetData(assetData: string): ERC20AssetData {
- const data = ethUtil.toBuffer(assetData);
- if (data.byteLength < constants.ERC20_ASSET_DATA_BYTE_LENGTH) {
- throw new Error(
- `Could not decode ERC20 Proxy Data. Expected length of encoded data to be at least ${
- constants.ERC20_ASSET_DATA_BYTE_LENGTH
- }. Got ${data.byteLength}`,
- );
- }
- const assetProxyId = ethUtil.bufferToHex(data.slice(0, constants.SELECTOR_LENGTH));
- if (assetProxyId !== AssetProxyId.ERC20) {
- throw new Error(
- `Could not decode ERC20 Proxy Data. Expected Asset Proxy Id to be ERC20 (${
- AssetProxyId.ERC20
- }), but got ${assetProxyId}`,
- );
- }
- const [tokenAddress] = ethAbi.rawDecode(['address'], data.slice(constants.SELECTOR_LENGTH));
+ assetDataUtils.assertIsERC20AssetData(assetData);
+ const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ const abiEncoder = new AbiEncoder.Method(constants.ERC20_METHOD_ABI);
+ const decodedAssetData = abiEncoder.decode(assetData, decodingRules);
return {
assetProxyId,
- tokenAddress: ethUtil.addHexPrefix(tokenAddress),
+ // TODO(abandeali1): fix return types for `AbiEncoder.Method.decode` so that we can remove type assertion
+ tokenAddress: (decodedAssetData as any).tokenContract,
};
},
/**
@@ -51,14 +51,10 @@ export const assetDataUtils = {
* @return The hex encoded assetData string
*/
encodeERC721AssetData(tokenAddress: string, tokenId: BigNumber): string {
- // TODO: Pass `tokendId` as a BigNumber.
- return ethUtil.bufferToHex(
- ethAbi.simpleEncode(
- 'ERC721Token(address,uint256)',
- tokenAddress,
- `0x${tokenId.toString(constants.BASE_16)}`,
- ),
- );
+ const abiEncoder = new AbiEncoder.Method(constants.ERC721_METHOD_ABI);
+ const args = [tokenAddress, tokenId];
+ const assetData = abiEncoder.encode(args, encodingRules);
+ return assetData;
},
/**
* Decodes an ERC721 assetData hex string into it's corresponding ERC721 tokenAddress, tokenId & assetProxyId
@@ -66,27 +62,99 @@ export const assetDataUtils = {
* @return An object containing the decoded tokenAddress, tokenId & assetProxyId
*/
decodeERC721AssetData(assetData: string): ERC721AssetData {
- const data = ethUtil.toBuffer(assetData);
- if (data.byteLength < constants.ERC721_ASSET_DATA_MINIMUM_BYTE_LENGTH) {
+ assetDataUtils.assertIsERC721AssetData(assetData);
+ const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ const abiEncoder = new AbiEncoder.Method(constants.ERC721_METHOD_ABI);
+ const decodedAssetData = abiEncoder.decode(assetData, decodingRules);
+ return {
+ assetProxyId,
+ // TODO(abandeali1): fix return types for `AbiEncoder.Method.decode` so that we can remove type assertion
+ tokenAddress: (decodedAssetData as any).tokenContract,
+ tokenId: (decodedAssetData as any).tokenId,
+ };
+ },
+ /**
+ * Encodes assetData for multiple AssetProxies into a single hex encoded assetData string, usable in the makerAssetData or
+ * takerAssetData fields in a 0x order.
+ * @param amounts Amounts of each asset that correspond to a single unit within an order.
+ * @param nestedAssetData assetData strings that correspond to a valid assetProxyId.
+ * @return The hex encoded assetData string
+ */
+ encodeMultiAssetData(amounts: BigNumber[], nestedAssetData: string[]): string {
+ if (amounts.length !== nestedAssetData.length) {
throw new Error(
- `Could not decode ERC721 Asset Data. Expected length of encoded data to be at least ${
- constants.ERC721_ASSET_DATA_MINIMUM_BYTE_LENGTH
- }. Got ${data.byteLength}`,
+ `Invalid MultiAsset arguments. Expected length of 'amounts' (${
+ amounts.length
+ }) to equal length of 'nestedAssetData' (${nestedAssetData.length})`,
);
}
- const assetProxyId = ethUtil.bufferToHex(data.slice(0, constants.SELECTOR_LENGTH));
- if (assetProxyId !== AssetProxyId.ERC721) {
+ _.forEach(nestedAssetData, assetDataElement => assetDataUtils.validateAssetDataOrThrow(assetDataElement));
+ const abiEncoder = new AbiEncoder.Method(constants.MULTI_ASSET_METHOD_ABI);
+ const args = [amounts, nestedAssetData];
+ const assetData = abiEncoder.encode(args, encodingRules);
+ return assetData;
+ },
+ /**
+ * Decodes a MultiAsset assetData hex string into it's corresponding amounts and nestedAssetData
+ * @param assetData Hex encoded assetData string to decode
+ * @return An object containing the decoded amounts and nestedAssetData
+ */
+ decodeMultiAssetData(assetData: string): MultiAssetData {
+ assetDataUtils.assertIsMultiAssetData(assetData);
+ const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ const abiEncoder = new AbiEncoder.Method(constants.MULTI_ASSET_METHOD_ABI);
+ const decodedAssetData = abiEncoder.decode(assetData, decodingRules);
+ // TODO(abandeali1): fix return types for `AbiEncoder.Method.decode` so that we can remove type assertion
+ const amounts = (decodedAssetData as any).amounts;
+ const nestedAssetData = (decodedAssetData as any).nestedAssetData;
+ if (amounts.length !== nestedAssetData.length) {
throw new Error(
- `Could not decode ERC721 Asset Data. Expected Asset Proxy Id to be ERC721 (${
- AssetProxyId.ERC721
- }), but got ${assetProxyId}`,
+ `Invalid MultiAsset assetData. Expected length of 'amounts' (${
+ amounts.length
+ }) to equal length of 'nestedAssetData' (${nestedAssetData.length})`,
);
}
- const [tokenAddress, tokenId] = ethAbi.rawDecode(['address', 'uint256'], data.slice(constants.SELECTOR_LENGTH));
return {
assetProxyId,
- tokenAddress: ethUtil.addHexPrefix(tokenAddress),
- tokenId: new BigNumber(tokenId.toString()),
+ amounts,
+ nestedAssetData,
+ };
+ },
+ /**
+ * Decodes a MultiAsset assetData hex string into it's corresponding amounts and decoded nestedAssetData elements (all nested elements are flattened)
+ * @param assetData Hex encoded assetData string to decode
+ * @return An object containing the decoded amounts and nestedAssetData
+ */
+ decodeMultiAssetDataRecursively(assetData: string): MultiAssetDataWithRecursiveDecoding {
+ const decodedAssetData = assetDataUtils.decodeMultiAssetData(assetData);
+ const amounts: any[] = [];
+ const decodedNestedAssetData = _.map(
+ decodedAssetData.nestedAssetData as string[],
+ (nestedAssetDataElement, index) => {
+ const decodedNestedAssetDataElement = assetDataUtils.decodeAssetDataOrThrow(nestedAssetDataElement);
+ if (decodedNestedAssetDataElement.assetProxyId === AssetProxyId.MultiAsset) {
+ const recursivelyDecodedAssetData = assetDataUtils.decodeMultiAssetDataRecursively(
+ nestedAssetDataElement,
+ );
+ amounts.push(
+ _.map(recursivelyDecodedAssetData.amounts, amountElement =>
+ amountElement.times(decodedAssetData.amounts[index]),
+ ),
+ );
+ return recursivelyDecodedAssetData.nestedAssetData;
+ } else {
+ amounts.push(decodedAssetData.amounts[index]);
+ return decodedNestedAssetDataElement as SingleAssetData;
+ }
+ },
+ );
+ const flattenedAmounts = _.flattenDeep(amounts);
+ const flattenedDecodedNestedAssetData = _.flattenDeep(decodedNestedAssetData);
+ return {
+ assetProxyId: decodedAssetData.assetProxyId,
+ amounts: flattenedAmounts,
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ nestedAssetData: flattenedDecodedNestedAssetData as SingleAssetData[],
};
},
/**
@@ -95,24 +163,133 @@ export const assetDataUtils = {
* @return The assetProxyId
*/
decodeAssetProxyId(assetData: string): AssetProxyId {
- const encodedAssetData = ethUtil.toBuffer(assetData);
- if (encodedAssetData.byteLength < constants.SELECTOR_LENGTH) {
+ if (assetData.length < constants.SELECTOR_CHAR_LENGTH_WITH_PREFIX) {
throw new Error(
- `Could not decode assetData. Expected length of encoded data to be at least 4. Got ${
- encodedAssetData.byteLength
+ `Could not decode assetData. Expected length of encoded data to be at least 10. Got ${
+ assetData.length
}`,
);
}
- const encodedAssetProxyId = encodedAssetData.slice(0, constants.SELECTOR_LENGTH);
- const assetProxyId = decodeAssetProxyId(encodedAssetProxyId);
+ const assetProxyId = assetData.slice(0, constants.SELECTOR_CHAR_LENGTH_WITH_PREFIX);
+ if (
+ assetProxyId !== AssetProxyId.ERC20 &&
+ assetProxyId !== AssetProxyId.ERC721 &&
+ assetProxyId !== AssetProxyId.MultiAsset
+ ) {
+ throw new Error(`Invalid assetProxyId: ${assetProxyId}`);
+ }
return assetProxyId;
},
/**
+ * Checks if the decoded asset data is valid ERC20 data
+ * @param decodedAssetData The decoded asset data to check
+ */
+ isERC20AssetData(decodedAssetData: SingleAssetData | MultiAssetData): decodedAssetData is ERC20AssetData {
+ return decodedAssetData.assetProxyId === AssetProxyId.ERC20;
+ },
+ /**
+ * Checks if the decoded asset data is valid ERC721 data
+ * @param decodedAssetData The decoded asset data to check
+ */
+ isERC721AssetData(decodedAssetData: SingleAssetData | MultiAssetData): decodedAssetData is ERC721AssetData {
+ return decodedAssetData.assetProxyId === AssetProxyId.ERC721;
+ },
+ /**
+ * Checks if the decoded asset data is valid MultiAsset data
+ * @param decodedAssetData The decoded asset data to check
+ */
+ isMultiAssetData(decodedAssetData: SingleAssetData | MultiAssetData): decodedAssetData is MultiAssetData {
+ return decodedAssetData.assetProxyId === AssetProxyId.MultiAsset;
+ },
+ /**
+ * Throws if the length or assetProxyId are invalid for the ERC20Proxy.
+ * @param assetData Hex encoded assetData string
+ */
+ assertIsERC20AssetData(assetData: string): void {
+ if (assetData.length < constants.ERC20_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX) {
+ throw new Error(
+ `Could not decode ERC20 Proxy Data. Expected length of encoded data to be at least ${
+ constants.ERC20_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX
+ }. Got ${assetData.length}`,
+ );
+ }
+ const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ if (assetProxyId !== AssetProxyId.ERC20) {
+ throw new Error(
+ `Could not decode ERC20 assetData. Expected assetProxyId to be ERC20 (${
+ AssetProxyId.ERC20
+ }), but got ${assetProxyId}`,
+ );
+ }
+ },
+ /**
+ * Throws if the length or assetProxyId are invalid for the ERC721Proxy.
+ * @param assetData Hex encoded assetData string
+ */
+ assertIsERC721AssetData(assetData: string): void {
+ if (assetData.length < constants.ERC721_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX) {
+ throw new Error(
+ `Could not decode ERC721 assetData. Expected length of encoded data to be at least ${
+ constants.ERC721_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX
+ }. Got ${assetData.length}`,
+ );
+ }
+ const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ if (assetProxyId !== AssetProxyId.ERC721) {
+ throw new Error(
+ `Could not decode ERC721 assetData. Expected assetProxyId to be ERC721 (${
+ AssetProxyId.ERC721
+ }), but got ${assetProxyId}`,
+ );
+ }
+ },
+ /**
+ * Throws if the length or assetProxyId are invalid for the MultiAssetProxy.
+ * @param assetData Hex encoded assetData string
+ */
+ assertIsMultiAssetData(assetData: string): void {
+ if (assetData.length < constants.MULTI_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX) {
+ throw new Error(
+ `Could not decode MultiAsset assetData. Expected length of encoded data to be at least ${
+ constants.MULTI_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX
+ }. Got ${assetData.length}`,
+ );
+ }
+ const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ if (assetProxyId !== AssetProxyId.MultiAsset) {
+ throw new Error(
+ `Could not decode MultiAsset assetData. Expected assetProxyId to be MultiAsset (${
+ AssetProxyId.MultiAsset
+ }), but got ${assetProxyId}`,
+ );
+ }
+ },
+ /**
+ * Throws if the length or assetProxyId are invalid for the corresponding AssetProxy.
+ * @param assetData Hex encoded assetData string
+ */
+ validateAssetDataOrThrow(assetData: string): void {
+ const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ switch (assetProxyId) {
+ case AssetProxyId.ERC20:
+ assetDataUtils.assertIsERC20AssetData(assetData);
+ break;
+ case AssetProxyId.ERC721:
+ assetDataUtils.assertIsERC721AssetData(assetData);
+ break;
+ case AssetProxyId.MultiAsset:
+ assetDataUtils.assertIsMultiAssetData(assetData);
+ break;
+ default:
+ throw new Error(`Unrecognized asset proxy id: ${assetProxyId}`);
+ }
+ },
+ /**
* Decode any assetData into it's corresponding assetData object
* @param assetData Hex encoded assetData string to decode
* @return Either a ERC20 or ERC721 assetData object
*/
- decodeAssetDataOrThrow(assetData: string): AssetData {
+ decodeAssetDataOrThrow(assetData: string): SingleAssetData | MultiAssetData {
const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
switch (assetProxyId) {
case AssetProxyId.ERC20:
@@ -121,19 +298,11 @@ export const assetDataUtils = {
case AssetProxyId.ERC721:
const erc721AssetData = assetDataUtils.decodeERC721AssetData(assetData);
return erc721AssetData;
+ case AssetProxyId.MultiAsset:
+ const multiAssetData = assetDataUtils.decodeMultiAssetData(assetData);
+ return multiAssetData;
default:
throw new Error(`Unrecognized asset proxy id: ${assetProxyId}`);
}
},
};
-
-function decodeAssetProxyId(encodedAssetProxyId: Buffer): AssetProxyId {
- const hexString = ethUtil.bufferToHex(encodedAssetProxyId);
- if (hexString === AssetProxyId.ERC20) {
- return AssetProxyId.ERC20;
- }
- if (hexString === AssetProxyId.ERC721) {
- return AssetProxyId.ERC721;
- }
- throw new Error(`Invalid ProxyId: ${hexString}`);
-}
diff --git a/packages/order-utils/src/constants.ts b/packages/order-utils/src/constants.ts
index 10029dcc3..a9a687719 100644
--- a/packages/order-utils/src/constants.ts
+++ b/packages/order-utils/src/constants.ts
@@ -1,16 +1,71 @@
import { BigNumber } from '@0x/utils';
+import { MethodAbi } from 'ethereum-types';
+
+const ERC20_METHOD_ABI: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'tokenContract',
+ type: 'address',
+ },
+ ],
+ name: 'ERC20Token',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+const ERC721_METHOD_ABI: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'tokenContract',
+ type: 'address',
+ },
+ {
+ name: 'tokenId',
+ type: 'uint256',
+ },
+ ],
+ name: 'ERC721Token',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+const MULTI_ASSET_METHOD_ABI: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'amounts',
+ type: 'uint256[]',
+ },
+ {
+ name: 'nestedAssetData',
+ type: 'bytes[]',
+ },
+ ],
+ name: 'MultiAsset',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
export const constants = {
NULL_ADDRESS: '0x0000000000000000000000000000000000000000',
NULL_BYTES: '0x',
+ NULL_ERC20_ASSET_DATA: '0xf47261b00000000000000000000000000000000000000000000000000000000000000000',
// tslint:disable-next-line:custom-no-magic-numbers
UNLIMITED_ALLOWANCE_IN_BASE_UNITS: new BigNumber(2).pow(256).minus(1),
TESTRPC_NETWORK_ID: 50,
ADDRESS_LENGTH: 20,
- ERC20_ASSET_DATA_BYTE_LENGTH: 36,
- ERC721_ASSET_DATA_MINIMUM_BYTE_LENGTH: 53,
- SELECTOR_LENGTH: 4,
- BASE_16: 16,
+ ERC20_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 74,
+ ERC721_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 136,
+ MULTI_ASSET_DATA_MIN_CHAR_LENGTH_WITH_PREFIX: 266,
+ SELECTOR_CHAR_LENGTH_WITH_PREFIX: 10,
INFINITE_TIMESTAMP_SEC: new BigNumber(2524604400), // Close to infinite
ZERO_AMOUNT: new BigNumber(0),
EIP712_DOMAIN_NAME: '0x Protocol',
@@ -48,4 +103,7 @@ export const constants = {
{ name: 'data', type: 'bytes' },
],
},
+ ERC20_METHOD_ABI,
+ ERC721_METHOD_ABI,
+ MULTI_ASSET_METHOD_ABI,
};
diff --git a/packages/order-utils/src/exchange_transfer_simulator.ts b/packages/order-utils/src/exchange_transfer_simulator.ts
index 7a38b35df..06621fd9e 100644
--- a/packages/order-utils/src/exchange_transfer_simulator.ts
+++ b/packages/order-utils/src/exchange_transfer_simulator.ts
@@ -1,7 +1,8 @@
-import { ExchangeContractErrs } from '@0x/types';
+import { AssetProxyId, ExchangeContractErrs } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { AbstractBalanceAndProxyAllowanceLazyStore } from './abstract/abstract_balance_and_proxy_allowance_lazy_store';
+import { assetDataUtils } from './asset_data_utils';
import { constants } from './constants';
import { TradeSide, TransferType } from './types';
@@ -74,24 +75,51 @@ export class ExchangeTransferSimulator {
tradeSide: TradeSide,
transferType: TransferType,
): Promise<void> {
- // HACK: When simulating an open order (e.g taker is NULL_ADDRESS), we don't want to adjust balances/
- // allowances for the taker. We do however, want to increase the balance of the maker since the maker
- // might be relying on those funds to fill subsequent orders or pay the order's fees.
- if (from === constants.NULL_ADDRESS && tradeSide === TradeSide.Taker) {
- await this._increaseBalanceAsync(assetData, to, amountInBaseUnits);
- return;
+ const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ switch (assetProxyId) {
+ case AssetProxyId.ERC20:
+ case AssetProxyId.ERC721:
+ // HACK: When simulating an open order (e.g taker is NULL_ADDRESS), we don't want to adjust balances/
+ // allowances for the taker. We do however, want to increase the balance of the maker since the maker
+ // might be relying on those funds to fill subsequent orders or pay the order's fees.
+ if (from === constants.NULL_ADDRESS && tradeSide === TradeSide.Taker) {
+ await this._increaseBalanceAsync(assetData, to, amountInBaseUnits);
+ return;
+ }
+ const balance = await this._store.getBalanceAsync(assetData, from);
+ const proxyAllowance = await this._store.getProxyAllowanceAsync(assetData, from);
+ if (proxyAllowance.lessThan(amountInBaseUnits)) {
+ ExchangeTransferSimulator._throwValidationError(
+ FailureReason.ProxyAllowance,
+ tradeSide,
+ transferType,
+ );
+ }
+ if (balance.lessThan(amountInBaseUnits)) {
+ ExchangeTransferSimulator._throwValidationError(FailureReason.Balance, tradeSide, transferType);
+ }
+ await this._decreaseProxyAllowanceAsync(assetData, from, amountInBaseUnits);
+ await this._decreaseBalanceAsync(assetData, from, amountInBaseUnits);
+ await this._increaseBalanceAsync(assetData, to, amountInBaseUnits);
+ break;
+ case AssetProxyId.MultiAsset:
+ const decodedAssetData = assetDataUtils.decodeMultiAssetData(assetData);
+ for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
+ const amountsElement = decodedAssetData.amounts[index];
+ const totalAmount = amountInBaseUnits.times(amountsElement);
+ await this.transferFromAsync(
+ nestedAssetDataElement,
+ from,
+ to,
+ totalAmount,
+ tradeSide,
+ transferType,
+ );
+ }
+ break;
+ default:
+ break;
}
- const balance = await this._store.getBalanceAsync(assetData, from);
- const proxyAllowance = await this._store.getProxyAllowanceAsync(assetData, from);
- if (proxyAllowance.lessThan(amountInBaseUnits)) {
- ExchangeTransferSimulator._throwValidationError(FailureReason.ProxyAllowance, tradeSide, transferType);
- }
- if (balance.lessThan(amountInBaseUnits)) {
- ExchangeTransferSimulator._throwValidationError(FailureReason.Balance, tradeSide, transferType);
- }
- await this._decreaseProxyAllowanceAsync(assetData, from, amountInBaseUnits);
- await this._decreaseBalanceAsync(assetData, from, amountInBaseUnits);
- await this._increaseBalanceAsync(assetData, to, amountInBaseUnits);
}
private async _decreaseProxyAllowanceAsync(
assetData: string,
diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts
index e70d43efb..2150a02e4 100644
--- a/packages/order-utils/src/index.ts
+++ b/packages/order-utils/src/index.ts
@@ -34,11 +34,14 @@ export {
OrderRelevantState,
OrderState,
ECSignature,
- AssetData,
+ SingleAssetData,
ERC20AssetData,
ERC721AssetData,
+ MultiAssetData,
+ MultiAssetDataWithRecursiveDecoding,
AssetProxyId,
SignatureType,
+ ObjectMap,
OrderStateValid,
OrderStateInvalid,
ExchangeContractErrs,
diff --git a/packages/order-utils/src/order_state_utils.ts b/packages/order-utils/src/order_state_utils.ts
index fe0d6c773..389419587 100644
--- a/packages/order-utils/src/order_state_utils.ts
+++ b/packages/order-utils/src/order_state_utils.ts
@@ -1,5 +1,6 @@
import {
ExchangeContractErrs,
+ ObjectMap,
OrderRelevantState,
OrderState,
OrderStateInvalid,
@@ -7,9 +8,11 @@ import {
SignedOrder,
} from '@0x/types';
import { BigNumber } from '@0x/utils';
+import * as _ from 'lodash';
import { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher';
import { AbstractOrderFilledCancelledFetcher } from './abstract/abstract_order_filled_cancelled_fetcher';
+import { assetDataUtils } from './asset_data_utils';
import { orderHashUtils } from './order_hash';
import { OrderValidationUtils } from './order_validation_utils';
import { RemainingFillableCalculator } from './remaining_fillable_calculator';
@@ -18,7 +21,9 @@ import { utils } from './utils';
interface SidedOrderRelevantState {
isMakerSide: boolean;
traderBalance: BigNumber;
+ traderIndividualBalances: ObjectMap<BigNumber>;
traderProxyAllowance: BigNumber;
+ traderIndividualProxyAllowances: ObjectMap<BigNumber>;
traderFeeBalance: BigNumber;
traderFeeProxyAllowance: BigNumber;
filledTakerAssetAmount: BigNumber;
@@ -121,7 +126,9 @@ export class OrderStateUtils {
const sidedOrderRelevantState = {
isMakerSide: true,
traderBalance: orderRelevantState.makerBalance,
+ traderIndividualBalances: orderRelevantState.makerIndividualBalances,
traderProxyAllowance: orderRelevantState.makerProxyAllowance,
+ traderIndividualProxyAllowances: orderRelevantState.makerIndividualProxyAllowances,
traderFeeBalance: orderRelevantState.makerFeeBalance,
traderFeeProxyAllowance: orderRelevantState.makerFeeProxyAllowance,
filledTakerAssetAmount: orderRelevantState.filledTakerAssetAmount,
@@ -165,7 +172,9 @@ export class OrderStateUtils {
const orderRelevantState = {
makerBalance: sidedOrderRelevantState.traderBalance,
+ makerIndividualBalances: sidedOrderRelevantState.traderIndividualBalances,
makerProxyAllowance: sidedOrderRelevantState.traderProxyAllowance,
+ makerIndividualProxyAllowances: sidedOrderRelevantState.traderIndividualProxyAllowances,
makerFeeBalance: sidedOrderRelevantState.traderFeeBalance,
makerFeeProxyAllowance: sidedOrderRelevantState.traderFeeProxyAllowance,
filledTakerAssetAmount: sidedOrderRelevantState.filledTakerAssetAmount,
@@ -236,10 +245,12 @@ export class OrderStateUtils {
const isAssetZRX = assetData === zrxAssetData;
const traderBalance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync(assetData, traderAddress);
+ const traderIndividualBalances = await this._getAssetBalancesAsync(assetData, traderAddress);
const traderProxyAllowance = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync(
assetData,
traderAddress,
);
+ const traderIndividualProxyAllowances = await this._getAssetProxyAllowancesAsync(assetData, traderAddress);
const traderFeeBalance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync(
zrxAssetData,
traderAddress,
@@ -278,7 +289,9 @@ export class OrderStateUtils {
const sidedOrderRelevantState = {
isMakerSide,
traderBalance,
+ traderIndividualBalances,
traderProxyAllowance,
+ traderIndividualProxyAllowances,
traderFeeBalance,
traderFeeProxyAllowance,
filledTakerAssetAmount,
@@ -287,4 +300,47 @@ export class OrderStateUtils {
};
return sidedOrderRelevantState;
}
+ private async _getAssetBalancesAsync(
+ assetData: string,
+ traderAddress: string,
+ initialBalances: ObjectMap<BigNumber> = {},
+ ): Promise<ObjectMap<BigNumber>> {
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
+ let balances: ObjectMap<BigNumber> = { ...initialBalances };
+ if (assetDataUtils.isERC20AssetData(decodedAssetData) || assetDataUtils.isERC721AssetData(decodedAssetData)) {
+ const balance = await this._balanceAndProxyAllowanceFetcher.getBalanceAsync(assetData, traderAddress);
+ const tokenAddress = decodedAssetData.tokenAddress;
+ balances[tokenAddress] = _.isUndefined(initialBalances[tokenAddress])
+ ? balance
+ : balances[tokenAddress].add(balance);
+ } else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
+ for (const assetDataElement of decodedAssetData.nestedAssetData) {
+ balances = await this._getAssetBalancesAsync(assetDataElement, traderAddress, balances);
+ }
+ }
+ return balances;
+ }
+ private async _getAssetProxyAllowancesAsync(
+ assetData: string,
+ traderAddress: string,
+ initialAllowances: ObjectMap<BigNumber> = {},
+ ): Promise<ObjectMap<BigNumber>> {
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
+ let allowances: ObjectMap<BigNumber> = { ...initialAllowances };
+ if (assetDataUtils.isERC20AssetData(decodedAssetData) || assetDataUtils.isERC721AssetData(decodedAssetData)) {
+ const allowance = await this._balanceAndProxyAllowanceFetcher.getProxyAllowanceAsync(
+ assetData,
+ traderAddress,
+ );
+ const tokenAddress = decodedAssetData.tokenAddress;
+ allowances[tokenAddress] = _.isUndefined(initialAllowances[tokenAddress])
+ ? allowance
+ : allowances[tokenAddress].add(allowance);
+ } else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
+ for (const assetDataElement of decodedAssetData.nestedAssetData) {
+ allowances = await this._getAssetBalancesAsync(assetDataElement, traderAddress, allowances);
+ }
+ }
+ return allowances;
+ }
}
diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts
index 96d90e21a..131144d48 100644
--- a/packages/order-utils/src/signature_utils.ts
+++ b/packages/order-utils/src/signature_utils.ts
@@ -115,7 +115,7 @@ export const signatureUtils = {
assert.isHexString('signature', signature);
assert.isETHAddressHex('signerAddress', signerAddress);
// tslint:disable-next-line:custom-no-magic-numbers
- const signatureWithoutType = signature.slice(-2);
+ const signatureWithoutType = signature.slice(0, -2);
const walletContract = new IWalletContract(artifacts.IWallet.compilerOutput.abi, signerAddress, provider);
const isValid = await walletContract.isValidSignature.callAsync(data, signatureWithoutType);
return isValid;
diff --git a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
index f42a76d0c..ae3e36238 100644
--- a/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
+++ b/packages/order-utils/src/store/balance_and_proxy_allowance_lazy_store.ts
@@ -119,7 +119,7 @@ export class BalanceAndProxyAllowanceLazyStore implements AbstractBalanceAndProx
public deleteAllERC721ProxyAllowance(tokenAddress: string, userAddress: string): void {
for (const assetData in this._proxyAllowance) {
if (this._proxyAllowance.hasOwnProperty(assetData)) {
- const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
+ const decodedAssetData = assetDataUtils.decodeERC721AssetData(assetData);
if (
decodedAssetData.assetProxyId === AssetProxyId.ERC721 &&
decodedAssetData.tokenAddress === tokenAddress &&
diff --git a/packages/order-utils/test/asset_data_utils_test.ts b/packages/order-utils/test/asset_data_utils_test.ts
index f175b7a38..c498c5a00 100644
--- a/packages/order-utils/test/asset_data_utils_test.ts
+++ b/packages/order-utils/test/asset_data_utils_test.ts
@@ -1,6 +1,6 @@
import * as chai from 'chai';
-import { ERC20AssetData, ERC721AssetData } from '@0x/types';
+import { AssetProxyId, ERC721AssetData } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { assetDataUtils } from '../src/asset_data_utils';
@@ -10,41 +10,101 @@ import { chaiSetup } from './utils/chai_setup';
chaiSetup.configure();
const expect = chai.expect;
-const KNOWN_ENCODINGS = [
- {
- address: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48',
- assetData: '0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48',
- },
- {
- address: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48',
- tokenId: new BigNumber(1),
- assetData:
- '0x025717920000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c480000000000000000000000000000000000000000000000000000000000000001',
- },
-];
-
-const ERC20_ASSET_PROXY_ID = '0xf47261b0';
-const ERC721_ASSET_PROXY_ID = '0x02571792';
+const KNOWN_ERC20_ENCODING = {
+ address: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48',
+ assetData: '0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48',
+};
+const KNOWN_ERC721_ENCODING = {
+ address: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48',
+ tokenId: new BigNumber(1),
+ assetData:
+ '0x025717920000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c480000000000000000000000000000000000000000000000000000000000000001',
+};
+const KNOWN_MULTI_ASSET_ENCODING = {
+ amounts: [new BigNumber(1), new BigNumber(1)],
+ nestedAssetData: [KNOWN_ERC20_ENCODING.assetData, KNOWN_ERC721_ENCODING.assetData],
+ assetData:
+ '0x94cfcdd7000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000024f47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044025717920000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000',
+};
describe('assetDataUtils', () => {
it('should encode ERC20', () => {
- const assetData = assetDataUtils.encodeERC20AssetData(KNOWN_ENCODINGS[0].address);
- expect(assetData).to.equal(KNOWN_ENCODINGS[0].assetData);
+ const assetData = assetDataUtils.encodeERC20AssetData(KNOWN_ERC20_ENCODING.address);
+ expect(assetData).to.equal(KNOWN_ERC20_ENCODING.assetData);
});
it('should decode ERC20', () => {
- const assetData: ERC20AssetData = assetDataUtils.decodeERC20AssetData(KNOWN_ENCODINGS[0].assetData);
- expect(assetData.tokenAddress).to.equal(KNOWN_ENCODINGS[0].address);
- expect(assetData.assetProxyId).to.equal(ERC20_ASSET_PROXY_ID);
+ const decodedAssetData = assetDataUtils.decodeERC20AssetData(KNOWN_ERC20_ENCODING.assetData);
+ expect(decodedAssetData.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address);
+ expect(decodedAssetData.assetProxyId).to.equal(AssetProxyId.ERC20);
});
it('should encode ERC721', () => {
- const assetData = assetDataUtils.encodeERC721AssetData(KNOWN_ENCODINGS[1].address, KNOWN_ENCODINGS[1]
- .tokenId as BigNumber);
- expect(assetData).to.equal(KNOWN_ENCODINGS[1].assetData);
+ const assetData = assetDataUtils.encodeERC721AssetData(
+ KNOWN_ERC721_ENCODING.address,
+ KNOWN_ERC721_ENCODING.tokenId,
+ );
+ expect(assetData).to.equal(KNOWN_ERC721_ENCODING.assetData);
});
it('should decode ERC721', () => {
- const assetData: ERC721AssetData = assetDataUtils.decodeERC721AssetData(KNOWN_ENCODINGS[1].assetData);
- expect(assetData.tokenAddress).to.equal(KNOWN_ENCODINGS[1].address);
- expect(assetData.assetProxyId).to.equal(ERC721_ASSET_PROXY_ID);
- expect(assetData.tokenId).to.be.bignumber.equal(KNOWN_ENCODINGS[1].tokenId);
+ const decodedAssetData = assetDataUtils.decodeERC721AssetData(KNOWN_ERC721_ENCODING.assetData);
+ expect(decodedAssetData.tokenAddress).to.equal(KNOWN_ERC721_ENCODING.address);
+ expect(decodedAssetData.assetProxyId).to.equal(AssetProxyId.ERC721);
+ expect(decodedAssetData.tokenId).to.be.bignumber.equal(KNOWN_ERC721_ENCODING.tokenId);
+ });
+ it('should encode ERC20 and ERC721 multiAssetData', () => {
+ const assetData = assetDataUtils.encodeMultiAssetData(
+ KNOWN_MULTI_ASSET_ENCODING.amounts,
+ KNOWN_MULTI_ASSET_ENCODING.nestedAssetData,
+ );
+ expect(assetData).to.equal(KNOWN_MULTI_ASSET_ENCODING.assetData);
+ });
+ it('should decode ERC20 and ERC721 multiAssetData', () => {
+ const decodedAssetData = assetDataUtils.decodeMultiAssetData(KNOWN_MULTI_ASSET_ENCODING.assetData);
+ expect(decodedAssetData.assetProxyId).to.equal(AssetProxyId.MultiAsset);
+ expect(decodedAssetData.amounts).to.deep.equal(KNOWN_MULTI_ASSET_ENCODING.amounts);
+ expect(decodedAssetData.nestedAssetData).to.deep.equal(KNOWN_MULTI_ASSET_ENCODING.nestedAssetData);
+ });
+ it('should recursively decode ERC20 and ERC721 multiAssetData', () => {
+ const decodedAssetData = assetDataUtils.decodeMultiAssetDataRecursively(KNOWN_MULTI_ASSET_ENCODING.assetData);
+ expect(decodedAssetData.assetProxyId).to.equal(AssetProxyId.MultiAsset);
+ expect(decodedAssetData.amounts).to.deep.equal(KNOWN_MULTI_ASSET_ENCODING.amounts);
+ const decodedErc20AssetData = decodedAssetData.nestedAssetData[0];
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const decodedErc721AssetData = decodedAssetData.nestedAssetData[1] as ERC721AssetData;
+ expect(decodedErc20AssetData.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address);
+ expect(decodedErc20AssetData.assetProxyId).to.equal(AssetProxyId.ERC20);
+ expect(decodedErc721AssetData.tokenAddress).to.equal(KNOWN_ERC721_ENCODING.address);
+ expect(decodedErc721AssetData.assetProxyId).to.equal(AssetProxyId.ERC721);
+ expect(decodedErc721AssetData.tokenId).to.be.bignumber.equal(KNOWN_ERC721_ENCODING.tokenId);
+ });
+ it('should recursively decode nested assetData within multiAssetData', () => {
+ const amounts = [new BigNumber(1), new BigNumber(1), new BigNumber(2)];
+ const nestedAssetData = [
+ KNOWN_ERC20_ENCODING.assetData,
+ KNOWN_ERC721_ENCODING.assetData,
+ KNOWN_MULTI_ASSET_ENCODING.assetData,
+ ];
+ const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
+ const decodedAssetData = assetDataUtils.decodeMultiAssetDataRecursively(assetData);
+ expect(decodedAssetData.assetProxyId).to.equal(AssetProxyId.MultiAsset);
+ const expectedAmounts = [new BigNumber(1), new BigNumber(1), new BigNumber(2), new BigNumber(2)];
+ expect(decodedAssetData.amounts).to.deep.equal(expectedAmounts);
+ const expectedLength = 4;
+ expect(decodedAssetData.nestedAssetData.length).to.be.equal(expectedLength);
+ const decodedErc20AssetData1 = decodedAssetData.nestedAssetData[0];
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const decodedErc721AssetData1 = decodedAssetData.nestedAssetData[1] as ERC721AssetData;
+ const decodedErc20AssetData2 = decodedAssetData.nestedAssetData[2];
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const decodedErc721AssetData2 = decodedAssetData.nestedAssetData[3] as ERC721AssetData;
+ expect(decodedErc20AssetData1.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address);
+ expect(decodedErc20AssetData1.assetProxyId).to.equal(AssetProxyId.ERC20);
+ expect(decodedErc721AssetData1.tokenAddress).to.equal(KNOWN_ERC721_ENCODING.address);
+ expect(decodedErc721AssetData1.assetProxyId).to.equal(AssetProxyId.ERC721);
+ expect(decodedErc721AssetData1.tokenId).to.be.bignumber.equal(KNOWN_ERC721_ENCODING.tokenId);
+ expect(decodedErc20AssetData2.tokenAddress).to.equal(KNOWN_ERC20_ENCODING.address);
+ expect(decodedErc20AssetData2.assetProxyId).to.equal(AssetProxyId.ERC20);
+ expect(decodedErc721AssetData2.tokenAddress).to.equal(KNOWN_ERC721_ENCODING.address);
+ expect(decodedErc721AssetData2.assetProxyId).to.equal(AssetProxyId.ERC721);
+ expect(decodedErc721AssetData2.tokenId).to.be.bignumber.equal(KNOWN_ERC721_ENCODING.tokenId);
});
});
diff --git a/packages/order-utils/test/order_hash_test.ts b/packages/order-utils/test/order_hash_test.ts
index a85d4c81a..30fb15a37 100644
--- a/packages/order-utils/test/order_hash_test.ts
+++ b/packages/order-utils/test/order_hash_test.ts
@@ -70,7 +70,7 @@ describe('Order hashing', () => {
});
it('returns true if order hash is correct', () => {
const orderHashLength = 65;
- const isValid = orderHashUtils.isValidOrderHash('0x' + Array(orderHashLength).join('0'));
+ const isValid = orderHashUtils.isValidOrderHash(`0x${Array(orderHashLength).join('0')}`);
expect(isValid).to.be.true();
});
});
diff --git a/packages/order-utils/test/utils/test_order_factory.ts b/packages/order-utils/test/utils/test_order_factory.ts
index 145332674..4efe0b38e 100644
--- a/packages/order-utils/test/utils/test_order_factory.ts
+++ b/packages/order-utils/test/utils/test_order_factory.ts
@@ -7,9 +7,9 @@ import { orderFactory } from '../../src/order_factory';
const BASE_TEST_ORDER: Order = orderFactory.createOrder(
constants.NULL_ADDRESS,
constants.ZERO_AMOUNT,
- constants.NULL_ADDRESS,
+ constants.NULL_ERC20_ASSET_DATA,
constants.ZERO_AMOUNT,
- constants.NULL_ADDRESS,
+ constants.NULL_ERC20_ASSET_DATA,
constants.NULL_ADDRESS,
);
const BASE_TEST_SIGNED_ORDER: SignedOrder = {
diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json
index b4d7a1501..4cfecd034 100644
--- a/packages/order-watcher/CHANGELOG.json
+++ b/packages/order-watcher/CHANGELOG.json
@@ -1,5 +1,60 @@
[
{
+ "version": "2.4.0",
+ "changes": [
+ {
+ "note": "Add support for `MultiAssetProxy`",
+ "pr": 1363
+ }
+ ]
+ },
+ {
+ "version": "2.3.0",
+ "changes": [
+ {
+ "note":
+ "Added a WebSocket interface to OrderWatcher so that it can be used by a client written in any language",
+ "pr": 1427
+ }
+ ]
+ },
+ {
+ "version": "2.2.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.2.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "2.2.6",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "2.2.5",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "2.2.4",
"changes": [
{
diff --git a/packages/order-watcher/CHANGELOG.md b/packages/order-watcher/CHANGELOG.md
index c7003f759..4e49b4637 100644
--- a/packages/order-watcher/CHANGELOG.md
+++ b/packages/order-watcher/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.2.8 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.2.7 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v2.2.6 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v2.2.5 - _November 21, 2018_
+
+ * Dependencies updated
+
## v2.2.4 - _November 14, 2018_
* Fix the bug when order watcher was throwing an error on order removal when maker token was ZRX (#1259)
diff --git a/packages/order-watcher/Dockerfile b/packages/order-watcher/Dockerfile
new file mode 100644
index 000000000..3ffa1b72f
--- /dev/null
+++ b/packages/order-watcher/Dockerfile
@@ -0,0 +1,13 @@
+FROM node
+
+WORKDIR /order-watcher
+
+COPY package.json .
+RUN npm i
+RUN npm install forever -g
+
+COPY . .
+
+EXPOSE 8080
+
+CMD ["forever", "./lib/src/server.js"]
diff --git a/packages/order-watcher/README.md b/packages/order-watcher/README.md
index c0b99b272..385fe4715 100644
--- a/packages/order-watcher/README.md
+++ b/packages/order-watcher/README.md
@@ -4,6 +4,9 @@ An order watcher daemon that watches for order validity.
#### Read the wiki [article](https://0xproject.com/wiki#0x-OrderWatcher).
+OrderWatcher also comes with a WebSocket server to provide language-agnostic access
+to order watching functionality. We used the [WebSocket Client and Server Implementation for Node](https://www.npmjs.com/package/websocket). The server sends and receives messages that conform to the [JSON RPC specifications](https://www.jsonrpc.org/specification).
+
## Installation
**Install**
@@ -26,6 +29,91 @@ If your project is in [TypeScript](https://www.typescriptlang.org/), add the fol
}
```
+## Using the WebSocket Server
+
+**Setup**
+
+**Environmental Variables**
+Several environmental variables can be set to configure the server:
+
+* `ORDER_WATCHER_HTTP_PORT` specifies the port that the http server will listen on
+ and accept connections from. When this is not set, we default to 8080.
+
+**Requests**
+The server accepts three types of requests: `ADD_ORDER`, `REMOVE_ORDER` and `GET_STATS`. These mirror what the underlying OrderWatcher does. You can read more in the [wiki](https://0xproject.com/wiki#0x-OrderWatcher). Unlike the OrderWatcher, it does not expose any `subscribe` or `unsubscribe` functionality because the WebSocket server keeps a single subscription open for all clients.
+
+The first step for making a request is establishing a connection with the server. In Javascript:
+
+```
+var W3CWebSocket = require('websocket').w3cwebsocket;
+wsClient = new W3CWebSocket('ws://127.0.0.1:8080');
+```
+
+In Python, you could use the [websocket-client library](http://pypi.python.org/pypi/websocket-client/) and run:
+
+```
+from websocket import create_connection
+wsClient = create_connection("ws://127.0.0.1:8080")
+```
+
+With the connection established, you prepare the payload for your request. The payload is a json object with a format established by the [JSON RPC specification](https://www.jsonrpc.org/specification):
+
+* `id`: All requests require you to specify a numerical `id`. When the server responds to the request, the response will have the same `id` as the one supplied with your request.
+* `jsonrpc`: This is always the string `'2.0'`.
+* `method`: This specifies the OrderWatcher method you want to call. I.e., `'ADD_ORDER'`, `'REMOVE_ORDER'` or `'GET_STATS'`.
+* `params`: These contain the parameters needed by OrderWatcher to execute the method you called. For `ADD_ORDER`, provide `{ signedOrder: <your signedOrder> }`. For `REMOVE_ORDER`, provide `{ orderHash: <your orderHash> }`. For `GET_STATS`, no parameters are needed, so you may leave this empty.
+
+Next, convert the payload to a string and send it through the connection.
+In Javascript:
+
+```
+const addOrderPayload = {
+ id: 1,
+ jsonrpc: '2.0',
+ method: 'ADD_ORDER',
+ params: { signedOrder: <your signedOrder> },
+};
+wsClient.send(JSON.stringify(addOrderPayload));
+```
+
+In Python:
+
+```
+import json
+remove_order_payload = {
+ 'id': 1,
+ 'jsonrpc': '2.0',
+ 'method': 'REMOVE_ORDER',
+ 'params': {'orderHash': '0x6edc16bf37fde79f5012088c33784c730e2f103d9ab1caf73060c386ad107b7e'},
+}
+wsClient.send(json.dumps(remove_order_payload));
+```
+
+**Response**
+The server responds to all requests in a similar format. In the data field, you'll find another object containing the following fields:
+
+* `id`: The id corresponding to the request that the server is responding to. `UPDATE` responses are not based on any requests so the `id` field is omitted`.
+* `jsonrpc`: Always `'2.0'`.
+* `method`: The method the server is responding to. Eg. `ADD_ORDER`. When order states change the server may also initiate a response. In this case, method will be listed as `UPDATE`.
+* `result`: This field varies based on the method. `UPDATE` responses contain the new order state. `GET_STATS` responses contain the current order count. When there are errors, this field is omitted.
+* `error`: When there is an error executing a request, the [JSON RPC](https://www.jsonrpc.org/specification) error object is listed here. When the server responds successfully, this field is omitted.
+
+In Javascript, the responses can be parsed using the `onmessage` callback:
+
+```
+wsClient.onmessage = (msg) => {
+ const responseData = JSON.parse(msg.data);
+ const method = responseData.method
+};
+```
+
+In Python, `recv` is a lightweight way to receive a response:
+
+```
+result = wsClient.recv()
+method = result.method
+```
+
## Contributing
We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json
index af88a120e..c4a56c982 100644
--- a/packages/order-watcher/package.json
+++ b/packages/order-watcher/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/order-watcher",
- "version": "2.2.4",
+ "version": "2.2.8",
"description": "An order watcher daemon that watches for order validity",
"keywords": [
"0x",
@@ -33,9 +33,10 @@
"node": ">=6.0.0"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.17",
- "@0x/migrations": "^2.0.4",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/migrations": "^2.2.2",
+ "@0x/tslint-config": "^2.0.0",
+ "@0x/subproviders": "^2.1.8",
"@types/bintrees": "^1.0.2",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -57,24 +58,25 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/abi-gen-wrappers": "^1.0.5",
- "@0x/assert": "^1.0.17",
- "@0x/base-contract": "^3.0.6",
- "@0x/contract-addresses": "^1.1.0",
- "@0x/contract-artifacts": "^1.1.0",
- "@0x/contract-wrappers": "^4.0.2",
- "@0x/fill-scenarios": "^1.0.12",
- "@0x/json-schemas": "^2.1.1",
- "@0x/order-utils": "^3.0.2",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/abi-gen-wrappers": "^2.0.2",
+ "@0x/assert": "^1.0.20",
+ "@0x/base-contract": "^3.0.10",
+ "@0x/contract-addresses": "^2.0.0",
+ "@0x/contract-artifacts": "^1.1.2",
+ "@0x/contract-wrappers": "^4.1.3",
+ "@0x/fill-scenarios": "^1.0.16",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"bintrees": "^1.0.2",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-blockstream": "6.0.0",
"ethers": "~4.0.4",
- "lodash": "^4.17.5"
+ "lodash": "^4.17.5",
+ "websocket": "^1.0.25"
},
"publishConfig": {
"access": "public"
diff --git a/packages/order-watcher/src/index.ts b/packages/order-watcher/src/index.ts
index 5eeba3e87..1f4e5eff1 100644
--- a/packages/order-watcher/src/index.ts
+++ b/packages/order-watcher/src/index.ts
@@ -1,4 +1,5 @@
export { OrderWatcher } from './order_watcher/order_watcher';
+export { OrderWatcherWebSocketServer } from './order_watcher/order_watcher_web_socket_server';
export { ExpirationWatcher } from './order_watcher/expiration_watcher';
export {
@@ -6,6 +7,7 @@ export {
OrderStateInvalid,
OrderState,
ExchangeContractErrs,
+ ObjectMap,
OrderRelevantState,
Stats,
} from '@0x/types';
diff --git a/packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts b/packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts
index a956a94db..d1085014c 100644
--- a/packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts
+++ b/packages/order-watcher/src/order_watcher/dependent_order_hashes_tracker.ts
@@ -1,6 +1,5 @@
-// tslint:disable:no-unnecessary-type-assertion
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
-import { AssetProxyId, ERC20AssetData, ERC721AssetData, SignedOrder } from '@0x/types';
+import { AssetProxyId, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
@@ -62,35 +61,18 @@ export class DependentOrderHashesTracker {
return dependentOrderHashes;
}
public addToDependentOrderHashes(signedOrder: SignedOrder): void {
- const decodedMakerAssetData = assetDataUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
- if (decodedMakerAssetData.assetProxyId === AssetProxyId.ERC20) {
- this._addToERC20DependentOrderHashes(signedOrder, (decodedMakerAssetData as ERC20AssetData).tokenAddress);
- } else {
- this._addToERC721DependentOrderHashes(
- signedOrder,
- (decodedMakerAssetData as ERC721AssetData).tokenAddress,
- (decodedMakerAssetData as ERC721AssetData).tokenId,
- );
- }
+ this._addAssetDataToDependentOrderHashes(signedOrder, signedOrder.makerAssetData);
this._addToERC20DependentOrderHashes(signedOrder, this._zrxTokenAddress);
this._addToMakerDependentOrderHashes(signedOrder);
}
public removeFromDependentOrderHashes(signedOrder: SignedOrder): void {
- const decodedMakerAssetData = assetDataUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
- if (decodedMakerAssetData.assetProxyId === AssetProxyId.ERC20) {
- this._removeFromERC20DependentOrderhashes(
- signedOrder,
- (decodedMakerAssetData as ERC20AssetData).tokenAddress,
- );
- } else {
- this._removeFromERC721DependentOrderhashes(
- signedOrder,
- (decodedMakerAssetData as ERC721AssetData).tokenAddress,
- (decodedMakerAssetData as ERC721AssetData).tokenId,
- );
- }
+ this._removeAssetDataFromDependentOrderHashes(signedOrder, signedOrder.makerAssetData);
// If makerToken === ZRX then we already removed it and we don't need to remove it again.
- if ((decodedMakerAssetData as ERC20AssetData).tokenAddress !== this._zrxTokenAddress) {
+ const decodedMakerAssetData = assetDataUtils.decodeAssetDataOrThrow(signedOrder.makerAssetData);
+ if (
+ assetDataUtils.isERC20AssetData(decodedMakerAssetData) &&
+ decodedMakerAssetData.tokenAddress !== this._zrxTokenAddress
+ ) {
this._removeFromERC20DependentOrderhashes(signedOrder, this._zrxTokenAddress);
}
this._removeFromMakerDependentOrderhashes(signedOrder);
@@ -167,6 +149,18 @@ export class DependentOrderHashesTracker {
tokenId.toString()
].add(orderHash);
}
+ private _addAssetDataToDependentOrderHashes(signedOrder: SignedOrder, assetData: string): void {
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
+ if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
+ this._addToERC20DependentOrderHashes(signedOrder, decodedAssetData.tokenAddress);
+ } else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
+ this._addToERC721DependentOrderHashes(signedOrder, decodedAssetData.tokenAddress, decodedAssetData.tokenId);
+ } else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
+ _.each(decodedAssetData.nestedAssetData, nestedAssetDataElement =>
+ this._addAssetDataToDependentOrderHashes(signedOrder, nestedAssetDataElement),
+ );
+ }
+ }
private _addToMakerDependentOrderHashes(signedOrder: SignedOrder): void {
const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
if (_.isUndefined(this._orderHashesByMakerAddress[signedOrder.makerAddress])) {
@@ -230,4 +224,20 @@ export class DependentOrderHashesTracker {
delete this._orderHashesByMakerAddress[signedOrder.makerAddress];
}
}
+ private _removeAssetDataFromDependentOrderHashes(signedOrder: SignedOrder, assetData: string): void {
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
+ if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
+ this._removeFromERC20DependentOrderhashes(signedOrder, decodedAssetData.tokenAddress);
+ } else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
+ this._removeFromERC721DependentOrderhashes(
+ signedOrder,
+ decodedAssetData.tokenAddress,
+ decodedAssetData.tokenId,
+ );
+ } else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
+ _.each(decodedAssetData.nestedAssetData, nestedAssetDataElement =>
+ this._removeAssetDataFromDependentOrderHashes(signedOrder, nestedAssetDataElement),
+ );
+ }
+ }
}
diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts
index 96c5ca7b4..a06fd0cfe 100644
--- a/packages/order-watcher/src/order_watcher/order_watcher.ts
+++ b/packages/order-watcher/src/order_watcher/order_watcher.ts
@@ -161,14 +161,7 @@ export class OrderWatcher {
this._dependentOrderHashesTracker.addToDependentOrderHashes(signedOrder);
const orderAssetDatas = [signedOrder.makerAssetData, signedOrder.takerAssetData];
- _.each(orderAssetDatas, assetData => {
- const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
- if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
- this._collisionResistantAbiDecoder.addERC20Token(decodedAssetData.tokenAddress);
- } else if (decodedAssetData.assetProxyId === AssetProxyId.ERC721) {
- this._collisionResistantAbiDecoder.addERC721Token(decodedAssetData.tokenAddress);
- }
- });
+ _.each(orderAssetDatas, assetData => this._addAssetDataToAbiDecoder(assetData));
}
/**
* Removes an order from the orderWatcher
@@ -236,31 +229,71 @@ export class OrderWatcher {
await this._emitRevalidateOrdersAsync([orderHash]);
}
}
+ private _addAssetDataToAbiDecoder(assetData: string): void {
+ const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
+ if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
+ this._collisionResistantAbiDecoder.addERC20Token(decodedAssetData.tokenAddress);
+ } else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
+ this._collisionResistantAbiDecoder.addERC721Token(decodedAssetData.tokenAddress);
+ } else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
+ _.each(decodedAssetData.nestedAssetData, nestedAssetDataElement =>
+ this._addAssetDataToAbiDecoder(nestedAssetDataElement),
+ );
+ }
+ }
+ private _deleteLazyStoreBalance(assetData: string, userAddress: string): void {
+ const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ switch (assetProxyId) {
+ case AssetProxyId.ERC20:
+ case AssetProxyId.ERC721:
+ this._balanceAndProxyAllowanceLazyStore.deleteBalance(assetData, userAddress);
+ break;
+ case AssetProxyId.MultiAsset:
+ const decodedAssetData = assetDataUtils.decodeMultiAssetData(assetData);
+ _.each(decodedAssetData.nestedAssetData, nestedAssetDataElement =>
+ this._deleteLazyStoreBalance(nestedAssetDataElement, userAddress),
+ );
+ break;
+ default:
+ break;
+ }
+ }
+ private _deleteLazyStoreProxyAllowance(assetData: string, userAddress: string): void {
+ const assetProxyId = assetDataUtils.decodeAssetProxyId(assetData);
+ switch (assetProxyId) {
+ case AssetProxyId.ERC20:
+ case AssetProxyId.ERC721:
+ this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(assetData, userAddress);
+ break;
+ case AssetProxyId.MultiAsset:
+ const decodedAssetData = assetDataUtils.decodeMultiAssetData(assetData);
+ _.each(decodedAssetData.nestedAssetData, nestedAssetDataElement =>
+ this._deleteLazyStoreProxyAllowance(nestedAssetDataElement, userAddress),
+ );
+ break;
+ default:
+ break;
+ }
+ }
private _cleanupOrderRelatedState(orderHash: string): void {
const signedOrder = this._orderByOrderHash[orderHash];
this._orderFilledCancelledLazyStore.deleteFilledTakerAmount(orderHash);
this._orderFilledCancelledLazyStore.deleteIsCancelled(orderHash);
- this._balanceAndProxyAllowanceLazyStore.deleteBalance(signedOrder.makerAssetData, signedOrder.makerAddress);
- this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(
- signedOrder.makerAssetData,
- signedOrder.makerAddress,
- );
- this._balanceAndProxyAllowanceLazyStore.deleteBalance(signedOrder.takerAssetData, signedOrder.takerAddress);
- this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(
- signedOrder.takerAssetData,
- signedOrder.takerAddress,
- );
+ this._deleteLazyStoreBalance(signedOrder.makerAssetData, signedOrder.makerAddress);
+ this._deleteLazyStoreProxyAllowance(signedOrder.makerAssetData, signedOrder.makerAddress);
+ this._deleteLazyStoreBalance(signedOrder.takerAssetData, signedOrder.takerAddress);
+ this._deleteLazyStoreProxyAllowance(signedOrder.takerAssetData, signedOrder.takerAddress);
const zrxAssetData = this._orderFilledCancelledLazyStore.getZRXAssetData();
if (!signedOrder.makerFee.isZero()) {
- this._balanceAndProxyAllowanceLazyStore.deleteBalance(zrxAssetData, signedOrder.makerAddress);
- this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(zrxAssetData, signedOrder.makerAddress);
+ this._deleteLazyStoreBalance(zrxAssetData, signedOrder.makerAddress);
+ this._deleteLazyStoreProxyAllowance(zrxAssetData, signedOrder.makerAddress);
}
if (!signedOrder.takerFee.isZero()) {
- this._balanceAndProxyAllowanceLazyStore.deleteBalance(zrxAssetData, signedOrder.takerAddress);
- this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(zrxAssetData, signedOrder.takerAddress);
+ this._deleteLazyStoreBalance(zrxAssetData, signedOrder.takerAddress);
+ this._deleteLazyStoreProxyAllowance(zrxAssetData, signedOrder.takerAddress);
}
}
private _onOrderExpired(orderHash: string): void {
@@ -302,7 +335,7 @@ export class OrderWatcher {
// Invalidate cache
const args = decodedLog.args as ERC20TokenApprovalEventArgs;
const tokenAssetData = assetDataUtils.encodeERC20AssetData(decodedLog.address);
- this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(tokenAssetData, args._owner);
+ this._deleteLazyStoreProxyAllowance(tokenAssetData, args._owner);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
args._owner,
@@ -315,7 +348,7 @@ export class OrderWatcher {
// Invalidate cache
const args = decodedLog.args as ERC721TokenApprovalEventArgs;
const tokenAssetData = assetDataUtils.encodeERC721AssetData(decodedLog.address, args._tokenId);
- this._balanceAndProxyAllowanceLazyStore.deleteProxyAllowance(tokenAssetData, args._owner);
+ this._deleteLazyStoreProxyAllowance(tokenAssetData, args._owner);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
args._owner,
@@ -333,8 +366,8 @@ export class OrderWatcher {
// Invalidate cache
const args = decodedLog.args as ERC20TokenTransferEventArgs;
const tokenAssetData = assetDataUtils.encodeERC20AssetData(decodedLog.address);
- this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._from);
- this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._to);
+ this._deleteLazyStoreBalance(tokenAssetData, args._from);
+ this._deleteLazyStoreBalance(tokenAssetData, args._to);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
args._from,
@@ -347,8 +380,8 @@ export class OrderWatcher {
// Invalidate cache
const args = decodedLog.args as ERC721TokenTransferEventArgs;
const tokenAssetData = assetDataUtils.encodeERC721AssetData(decodedLog.address, args._tokenId);
- this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._from);
- this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._to);
+ this._deleteLazyStoreBalance(tokenAssetData, args._from);
+ this._deleteLazyStoreBalance(tokenAssetData, args._to);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
args._from,
@@ -375,7 +408,7 @@ export class OrderWatcher {
// Invalidate cache
const args = decodedLog.args as WETH9DepositEventArgs;
const tokenAssetData = assetDataUtils.encodeERC20AssetData(decodedLog.address);
- this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._owner);
+ this._deleteLazyStoreBalance(tokenAssetData, args._owner);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
args._owner,
@@ -388,7 +421,7 @@ export class OrderWatcher {
// Invalidate cache
const args = decodedLog.args as WETH9WithdrawalEventArgs;
const tokenAssetData = assetDataUtils.encodeERC20AssetData(decodedLog.address);
- this._balanceAndProxyAllowanceLazyStore.deleteBalance(tokenAssetData, args._owner);
+ this._deleteLazyStoreBalance(tokenAssetData, args._owner);
// Revalidate orders
const orderHashes = this._dependentOrderHashesTracker.getDependentOrderHashesByAssetDataByMaker(
args._owner,
diff --git a/packages/order-watcher/src/order_watcher/order_watcher_web_socket_server.ts b/packages/order-watcher/src/order_watcher/order_watcher_web_socket_server.ts
new file mode 100644
index 000000000..b75b07603
--- /dev/null
+++ b/packages/order-watcher/src/order_watcher/order_watcher_web_socket_server.ts
@@ -0,0 +1,200 @@
+import { ContractAddresses } from '@0x/contract-addresses';
+import { schemas } from '@0x/json-schemas';
+import { OrderStateInvalid, OrderStateValid, SignedOrder } from '@0x/types';
+import { BigNumber, logUtils } from '@0x/utils';
+import { Provider } from 'ethereum-types';
+import * as http from 'http';
+import * as WebSocket from 'websocket';
+
+import { GetStatsResult, OrderWatcherConfig, OrderWatcherMethod, WebSocketRequest, WebSocketResponse } from '../types';
+import { assert } from '../utils/assert';
+
+import { OrderWatcher } from './order_watcher';
+
+const DEFAULT_HTTP_PORT = 8080;
+const JSON_RPC_VERSION = '2.0';
+
+// Wraps the OrderWatcher functionality in a WebSocket server. Motivations:
+// 1) Users can watch orders via non-typescript programs.
+// 2) Better encapsulation so that users can work
+export class OrderWatcherWebSocketServer {
+ private readonly _orderWatcher: OrderWatcher;
+ private readonly _httpServer: http.Server;
+ private readonly _connectionStore: Set<WebSocket.connection>;
+ private readonly _wsServer: WebSocket.server;
+ private readonly _isVerbose: boolean;
+ /**
+ * Recover types lost when the payload is stringified.
+ */
+ private static _parseSignedOrder(rawRequest: any): SignedOrder {
+ const bigNumberFields = [
+ 'salt',
+ 'makerFee',
+ 'takerFee',
+ 'makerAssetAmount',
+ 'takerAssetAmount',
+ 'expirationTimeSeconds',
+ ];
+ for (const field of bigNumberFields) {
+ rawRequest[field] = new BigNumber(rawRequest[field]);
+ }
+ return rawRequest;
+ }
+
+ /**
+ * Instantiate a new WebSocket server which provides OrderWatcher functionality
+ * @param provider Web3 provider to use for JSON RPC calls.
+ * @param networkId NetworkId to watch orders on.
+ * @param contractAddresses Optional contract addresses. Defaults to known
+ * addresses based on networkId.
+ * @param orderWatcherConfig OrderWatcher configurations. isVerbose sets the verbosity for the WebSocket server aswell.
+ * @param isVerbose Whether to enable verbose logging. Defaults to true.
+ */
+ constructor(
+ provider: Provider,
+ networkId: number,
+ contractAddresses?: ContractAddresses,
+ orderWatcherConfig?: Partial<OrderWatcherConfig>,
+ ) {
+ this._isVerbose =
+ orderWatcherConfig !== undefined && orderWatcherConfig.isVerbose !== undefined
+ ? orderWatcherConfig.isVerbose
+ : true;
+ this._orderWatcher = new OrderWatcher(provider, networkId, contractAddresses, orderWatcherConfig);
+ this._connectionStore = new Set();
+ this._httpServer = http.createServer();
+ this._wsServer = new WebSocket.server({
+ httpServer: this._httpServer,
+ // Avoid setting autoAcceptConnections to true as it defeats all
+ // standard cross-origin protection facilities built into the protocol
+ // and the browser.
+ // Source: https://www.npmjs.com/package/websocket#server-example
+ // Also ensures that a request event is emitted by
+ // the server whenever a new WebSocket request is made.
+ autoAcceptConnections: false,
+ });
+
+ this._wsServer.on('request', async (request: any) => {
+ // Designed for usage pattern where client and server are run on the same
+ // machine by the same user. As such, no security checks are in place.
+ const connection: WebSocket.connection = request.accept(null, request.origin);
+ this._log(`${new Date()} [Server] Accepted connection from origin ${request.origin}.`);
+ connection.on('message', this._onMessageCallbackAsync.bind(this, connection));
+ connection.on('close', this._onCloseCallback.bind(this, connection));
+ this._connectionStore.add(connection);
+ });
+ }
+
+ /**
+ * Activates the WebSocket server by subscribing to the OrderWatcher and
+ * starting the WebSocket's HTTP server
+ */
+ public start(): void {
+ // Have the WebSocket server subscribe to the OrderWatcher to receive updates.
+ // These updates are then broadcast to clients in the _connectionStore.
+ this._orderWatcher.subscribe(this._broadcastCallback.bind(this));
+
+ const port = process.env.ORDER_WATCHER_HTTP_PORT || DEFAULT_HTTP_PORT;
+ this._httpServer.listen(port, () => {
+ this._log(`${new Date()} [Server] Listening on port ${port}`);
+ });
+ }
+
+ /**
+ * Deactivates the WebSocket server by stopping the HTTP server from accepting
+ * new connections and unsubscribing from the OrderWatcher
+ */
+ public stop(): void {
+ this._httpServer.close();
+ this._orderWatcher.unsubscribe();
+ }
+
+ private _log(...args: any[]): void {
+ if (this._isVerbose) {
+ logUtils.log(...args);
+ }
+ }
+
+ private async _onMessageCallbackAsync(connection: WebSocket.connection, message: any): Promise<void> {
+ let response: WebSocketResponse;
+ let id: number | null = null;
+ try {
+ assert.doesConformToSchema('message', message, schemas.orderWatcherWebSocketUtf8MessageSchema);
+ const request: WebSocketRequest = JSON.parse(message.utf8Data);
+ id = request.id;
+ assert.doesConformToSchema('request', request, schemas.orderWatcherWebSocketRequestSchema);
+ assert.isString(request.jsonrpc, JSON_RPC_VERSION);
+ response = {
+ id,
+ jsonrpc: JSON_RPC_VERSION,
+ method: request.method,
+ result: await this._routeRequestAsync(request),
+ };
+ } catch (err) {
+ response = {
+ id,
+ jsonrpc: JSON_RPC_VERSION,
+ method: null,
+ error: err.toString(),
+ };
+ }
+ this._log(`${new Date()} [Server] OrderWatcher output: ${JSON.stringify(response)}`);
+ connection.sendUTF(JSON.stringify(response));
+ }
+
+ private _onCloseCallback(connection: WebSocket.connection): void {
+ this._connectionStore.delete(connection);
+ this._log(`${new Date()} [Server] Client ${connection.remoteAddress} disconnected.`);
+ }
+
+ private async _routeRequestAsync(request: WebSocketRequest): Promise<GetStatsResult | undefined> {
+ this._log(`${new Date()} [Server] Request received: ${request.method}`);
+ switch (request.method) {
+ case OrderWatcherMethod.AddOrder: {
+ const signedOrder: SignedOrder = OrderWatcherWebSocketServer._parseSignedOrder(
+ request.params.signedOrder,
+ );
+ await this._orderWatcher.addOrderAsync(signedOrder);
+ break;
+ }
+ case OrderWatcherMethod.RemoveOrder: {
+ this._orderWatcher.removeOrder(request.params.orderHash || 'undefined');
+ break;
+ }
+ case OrderWatcherMethod.GetStats: {
+ return this._orderWatcher.getStats();
+ }
+ default:
+ // Should never reach here. Should be caught by JSON schema check.
+ throw new Error(`Unexpected default case hit for request.method`);
+ }
+ return undefined;
+ }
+
+ /**
+ * Broadcasts OrderState changes to ALL connected clients. At the moment,
+ * we do not support clients subscribing to only a subset of orders. As such,
+ * Client B will be notified of changes to an order that Client A added.
+ */
+ private _broadcastCallback(err: Error | null, orderState?: OrderStateValid | OrderStateInvalid | undefined): void {
+ const method = OrderWatcherMethod.Update;
+ const response =
+ err === null
+ ? {
+ jsonrpc: JSON_RPC_VERSION,
+ method,
+ result: orderState,
+ }
+ : {
+ jsonrpc: JSON_RPC_VERSION,
+ method,
+ error: {
+ code: -32000,
+ message: err.message,
+ },
+ };
+ this._connectionStore.forEach((connection: WebSocket.connection) => {
+ connection.sendUTF(JSON.stringify(response));
+ });
+ }
+}
diff --git a/packages/order-watcher/src/server.ts b/packages/order-watcher/src/server.ts
new file mode 100644
index 000000000..1d31e87ab
--- /dev/null
+++ b/packages/order-watcher/src/server.ts
@@ -0,0 +1,44 @@
+import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
+import { RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
+import * as _ from 'lodash';
+
+import { OrderWatcherWebSocketServer } from './order_watcher/order_watcher_web_socket_server';
+
+const GANACHE_NETWORK_ID = 50;
+const DEFAULT_RPC_URL = 'http://localhost:8545';
+
+const provider = new Web3ProviderEngine();
+const jsonRpcUrl = process.env.JSON_RPC_URL || DEFAULT_RPC_URL;
+const rpcSubprovider = new RPCSubprovider(jsonRpcUrl);
+provider.addProvider(rpcSubprovider);
+provider.start();
+
+const networkId = process.env.NETWORK_ID !== undefined ? _.parseInt(process.env.NETWORK_ID) : GANACHE_NETWORK_ID;
+
+const contractAddressesString = process.env.contractAddresses;
+const contractAddressesIfExists =
+ contractAddressesString === undefined
+ ? getContractAddressesForNetworkOrThrow(networkId)
+ : JSON.parse(contractAddressesString);
+
+const orderWatcherConfig: any = {
+ isVerbose: process.env.IS_VERBOSE === 'true',
+};
+const orderExpirationCheckingIntervalMs = process.env.ORDER_EXPIRATION_CHECKING_INTERVAL_MS;
+if (orderExpirationCheckingIntervalMs !== undefined) {
+ orderWatcherConfig.orderExpirationCheckingIntervalMs = _.parseInt(orderExpirationCheckingIntervalMs);
+}
+const eventPollingIntervalMs = process.env.EVENT_POLLING_INTERVAL_MS;
+if (eventPollingIntervalMs !== undefined) {
+ orderWatcherConfig.eventPollingIntervalMs = _.parseInt(eventPollingIntervalMs);
+}
+const expirationMarginMs = process.env.EXPIRATION_MARGIN_MS;
+if (expirationMarginMs !== undefined) {
+ orderWatcherConfig.expirationMarginMs = _.parseInt(expirationMarginMs);
+}
+const cleanupJobIntervalMs = process.env.CLEANUP_JOB_INTERVAL_MS;
+if (cleanupJobIntervalMs !== undefined) {
+ orderWatcherConfig.cleanupJobIntervalMs = _.parseInt(cleanupJobIntervalMs);
+}
+const wsServer = new OrderWatcherWebSocketServer(provider, networkId, contractAddressesIfExists, orderWatcherConfig);
+wsServer.start();
diff --git a/packages/order-watcher/src/types.ts b/packages/order-watcher/src/types.ts
index 8078dd971..2b529a939 100644
--- a/packages/order-watcher/src/types.ts
+++ b/packages/order-watcher/src/types.ts
@@ -1,4 +1,4 @@
-import { OrderState } from '@0x/types';
+import { OrderState, SignedOrder } from '@0x/types';
import { LogEntryEvent } from 'ethereum-types';
export enum OrderWatcherError {
@@ -31,3 +31,67 @@ export enum InternalOrderWatcherError {
ZrxNotInTokenRegistry = 'ZRX_NOT_IN_TOKEN_REGISTRY',
WethNotInTokenRegistry = 'WETH_NOT_IN_TOKEN_REGISTRY',
}
+
+export enum OrderWatcherMethod {
+ // Methods initiated by the user.
+ GetStats = 'GET_STATS',
+ AddOrder = 'ADD_ORDER',
+ RemoveOrder = 'REMOVE_ORDER',
+ // These are spontaneous; they are primarily orderstate changes.
+ Update = 'UPDATE',
+ // `subscribe` and `unsubscribe` are methods of OrderWatcher, but we don't
+ // need to expose them to the WebSocket server user because the user implicitly
+ // subscribes and unsubscribes by connecting and disconnecting from the server.
+}
+
+// Users have to create a json object of this format and attach it to
+// the data field of their WebSocket message to interact with the server.
+export type WebSocketRequest = AddOrderRequest | RemoveOrderRequest | GetStatsRequest;
+
+export interface AddOrderRequest {
+ id: number;
+ jsonrpc: string;
+ method: OrderWatcherMethod.AddOrder;
+ params: { signedOrder: SignedOrder };
+}
+
+export interface RemoveOrderRequest {
+ id: number;
+ jsonrpc: string;
+ method: OrderWatcherMethod.RemoveOrder;
+ params: { orderHash: string };
+}
+
+export interface GetStatsRequest {
+ id: number;
+ jsonrpc: string;
+ method: OrderWatcherMethod.GetStats;
+}
+
+// Users should expect a json object of this format in the data field
+// of the WebSocket messages that the server sends out.
+export type WebSocketResponse = SuccessfulWebSocketResponse | ErrorWebSocketResponse;
+
+export interface SuccessfulWebSocketResponse {
+ id: number;
+ jsonrpc: string;
+ method: OrderWatcherMethod;
+ result: OrderState | GetStatsResult | undefined; // result is undefined for ADD_ORDER and REMOVE_ORDER
+}
+
+export interface ErrorWebSocketResponse {
+ id: number | null;
+ jsonrpc: string;
+ method: null;
+ error: JSONRPCError;
+}
+
+export interface JSONRPCError {
+ code: number;
+ message: string;
+ data?: string | object;
+}
+
+export interface GetStatsResult {
+ orderCount: number;
+}
diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts
index 271e5dec5..41dc884d5 100644
--- a/packages/order-watcher/test/order_watcher_test.ts
+++ b/packages/order-watcher/test/order_watcher_test.ts
@@ -675,5 +675,213 @@ describe('OrderWatcher', () => {
})().catch(done);
});
});
+ describe('multiAsset', async () => {
+ const tokenId = new BigNumber(42);
+ const [makerErc721TokenAddress] = tokenUtils.getDummyERC721TokenAddresses();
+ const makerErc721AssetData = assetDataUtils.encodeERC721AssetData(makerErc721TokenAddress, tokenId);
+ const fillableErc721Amount = new BigNumber(1);
+ const [makerErc20TokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
+ const makerErc20AssetData = assetDataUtils.encodeERC20AssetData(makerErc20TokenAddress);
+ const fillableErc20Amount = new BigNumber(2);
+ const multiAssetAmounts = [fillableErc721Amount, fillableErc20Amount];
+ const nestedAssetData = [makerErc721AssetData, makerErc20AssetData];
+ const makerMultiAssetData = assetDataUtils.encodeMultiAssetData(multiAssetAmounts, nestedAssetData);
+ it('should emit orderStateInvalid when maker allowance of ERC721 token set to 0 for watched order', (done: DoneCallback) => {
+ (async () => {
+ signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerMultiAssetData,
+ takerAssetData,
+ makerAddress,
+ takerAddress,
+ fillableErc721Amount,
+ );
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ await orderWatcher.addOrderAsync(signedOrder);
+ const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
+ expect(orderState.isValid).to.be.false();
+ const invalidOrderState = orderState as OrderStateInvalid;
+ expect(invalidOrderState.orderHash).to.be.equal(orderHash);
+ expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerAllowance);
+ });
+ orderWatcher.subscribe(callback);
+ await contractWrappers.erc721Token.setApprovalAsync(
+ makerErc721TokenAddress,
+ constants.NULL_ADDRESS,
+ tokenId,
+ );
+ })().catch(done);
+ });
+ it('should emit orderStateInvalid when maker allowance for all of ERC721 token set to 0 for watched order', (done: DoneCallback) => {
+ (async () => {
+ signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerMultiAssetData,
+ takerAssetData,
+ makerAddress,
+ takerAddress,
+ fillableErc721Amount,
+ );
+ await contractWrappers.erc721Token.setApprovalAsync(
+ makerErc721TokenAddress,
+ constants.NULL_ADDRESS,
+ tokenId,
+ );
+ let isApproved = true;
+ await contractWrappers.erc721Token.setProxyApprovalForAllAsync(
+ makerErc721TokenAddress,
+ makerAddress,
+ isApproved,
+ );
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ await orderWatcher.addOrderAsync(signedOrder);
+ const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
+ expect(orderState.isValid).to.be.false();
+ const invalidOrderState = orderState as OrderStateInvalid;
+ expect(invalidOrderState.orderHash).to.be.equal(orderHash);
+ expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerAllowance);
+ });
+ orderWatcher.subscribe(callback);
+ isApproved = false;
+ await contractWrappers.erc721Token.setProxyApprovalForAllAsync(
+ makerErc721TokenAddress,
+ makerAddress,
+ isApproved,
+ );
+ })().catch(done);
+ });
+ it('should emit orderStateInvalid when maker moves ERC721 backing watched order', (done: DoneCallback) => {
+ (async () => {
+ signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerMultiAssetData,
+ takerAssetData,
+ makerAddress,
+ takerAddress,
+ fillableErc721Amount,
+ );
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ await orderWatcher.addOrderAsync(signedOrder);
+ const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
+ expect(orderState.isValid).to.be.false();
+ const invalidOrderState = orderState as OrderStateInvalid;
+ expect(invalidOrderState.orderHash).to.be.equal(orderHash);
+ expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerBalance);
+ });
+ orderWatcher.subscribe(callback);
+ await contractWrappers.erc721Token.transferFromAsync(
+ makerErc721TokenAddress,
+ coinbase,
+ makerAddress,
+ tokenId,
+ );
+ })().catch(done);
+ });
+ it('should emit orderStateInvalid when maker allowance of ERC20 token set to 0 for watched order', (done: DoneCallback) => {
+ (async () => {
+ signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerMultiAssetData,
+ takerAssetData,
+ makerAddress,
+ takerAddress,
+ fillableErc721Amount,
+ );
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ await orderWatcher.addOrderAsync(signedOrder);
+ const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
+ expect(orderState.isValid).to.be.false();
+ const invalidOrderState = orderState as OrderStateInvalid;
+ expect(invalidOrderState.orderHash).to.be.equal(orderHash);
+ expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerAllowance);
+ });
+ orderWatcher.subscribe(callback);
+ await contractWrappers.erc20Token.setProxyAllowanceAsync(
+ makerErc20TokenAddress,
+ makerAddress,
+ new BigNumber(0),
+ );
+ })().catch(done);
+ });
+ it('should not emit an orderState event when irrelevant ERC20 Transfer event received', (done: DoneCallback) => {
+ (async () => {
+ signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerMultiAssetData,
+ takerAssetData,
+ makerAddress,
+ takerAddress,
+ fillableAmount,
+ );
+ await orderWatcher.addOrderAsync(signedOrder);
+ const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((_orderState: OrderState) => {
+ throw new Error('OrderState callback fired for irrelevant order');
+ });
+ orderWatcher.subscribe(callback);
+ const notTheMaker = userAddresses[0];
+ const anyRecipient = takerAddress;
+ const transferAmount = new BigNumber(2);
+ await contractWrappers.erc20Token.transferAsync(
+ makerTokenAddress,
+ notTheMaker,
+ anyRecipient,
+ transferAmount,
+ );
+ setTimeout(() => {
+ done();
+ }, TIMEOUT_MS);
+ })().catch(done);
+ });
+ it('should emit orderStateInvalid when makerAddress moves ERC20 balance backing watched order', (done: DoneCallback) => {
+ (async () => {
+ signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerMultiAssetData,
+ takerAssetData,
+ makerAddress,
+ takerAddress,
+ fillableAmount,
+ );
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ await orderWatcher.addOrderAsync(signedOrder);
+ const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
+ expect(orderState.isValid).to.be.false();
+ const invalidOrderState = orderState as OrderStateInvalid;
+ expect(invalidOrderState.orderHash).to.be.equal(orderHash);
+ expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.InsufficientMakerBalance);
+ });
+ orderWatcher.subscribe(callback);
+ const anyRecipient = takerAddress;
+ const makerBalance = await contractWrappers.erc20Token.getBalanceAsync(
+ makerTokenAddress,
+ makerAddress,
+ );
+ await contractWrappers.erc20Token.transferAsync(
+ makerTokenAddress,
+ makerAddress,
+ anyRecipient,
+ makerBalance,
+ );
+ })().catch(done);
+ });
+ // TODO(abandeali1): The following test will fail until the MAP has been deployed and activated.
+ it.skip('should emit orderStateInvalid when watched order fully filled', (done: DoneCallback) => {
+ (async () => {
+ signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerMultiAssetData,
+ takerAssetData,
+ makerAddress,
+ takerAddress,
+ fillableAmount,
+ );
+ const orderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ await orderWatcher.addOrderAsync(signedOrder);
+
+ const callback = callbackErrorReporter.reportNodeCallbackErrors(done)((orderState: OrderState) => {
+ expect(orderState.isValid).to.be.false();
+ const invalidOrderState = orderState as OrderStateInvalid;
+ expect(invalidOrderState.orderHash).to.be.equal(orderHash);
+ expect(invalidOrderState.error).to.be.equal(ExchangeContractErrs.OrderRemainingFillAmountZero);
+ });
+ orderWatcher.subscribe(callback);
+
+ await contractWrappers.exchange.fillOrderAsync(signedOrder, fillableAmount, takerAddress);
+ })().catch(done);
+ });
+ });
});
}); // tslint:disable:max-file-line-count
diff --git a/packages/order-watcher/test/order_watcher_web_socket_server_test.ts b/packages/order-watcher/test/order_watcher_web_socket_server_test.ts
new file mode 100644
index 000000000..36135f65c
--- /dev/null
+++ b/packages/order-watcher/test/order_watcher_web_socket_server_test.ts
@@ -0,0 +1,312 @@
+import { ContractAddresses } from '@0x/contract-addresses';
+import { ContractWrappers } from '@0x/contract-wrappers';
+import { tokenUtils } from '@0x/contract-wrappers/lib/test/utils/token_utils';
+import { BlockchainLifecycle } from '@0x/dev-utils';
+import { FillScenarios } from '@0x/fill-scenarios';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { ExchangeContractErrs, OrderStateInvalid, SignedOrder } from '@0x/types';
+import { BigNumber, logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as chai from 'chai';
+import 'mocha';
+import * as WebSocket from 'websocket';
+
+import { OrderWatcherWebSocketServer } from '../src/order_watcher/order_watcher_web_socket_server';
+import { AddOrderRequest, OrderWatcherMethod, RemoveOrderRequest } from '../src/types';
+
+import { chaiSetup } from './utils/chai_setup';
+import { constants } from './utils/constants';
+import { migrateOnceAsync } from './utils/migrate';
+import { provider, web3Wrapper } from './utils/web3_wrapper';
+
+chaiSetup.configure();
+const expect = chai.expect;
+const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
+
+interface WsMessage {
+ data: string;
+}
+
+describe('OrderWatcherWebSocketServer', async () => {
+ let contractWrappers: ContractWrappers;
+ let wsServer: OrderWatcherWebSocketServer;
+ let wsClient: WebSocket.w3cwebsocket;
+ let wsClientTwo: WebSocket.w3cwebsocket;
+ let fillScenarios: FillScenarios;
+ let userAddresses: string[];
+ let makerAssetData: string;
+ let takerAssetData: string;
+ let makerTokenAddress: string;
+ let takerTokenAddress: string;
+ let makerAddress: string;
+ let takerAddress: string;
+ let zrxTokenAddress: string;
+ let signedOrder: SignedOrder;
+ let orderHash: string;
+ let addOrderPayload: AddOrderRequest;
+ let removeOrderPayload: RemoveOrderRequest;
+ let networkId: number;
+ let contractAddresses: ContractAddresses;
+ const decimals = constants.ZRX_DECIMALS;
+ const fillableAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5), decimals);
+
+ before(async () => {
+ // Set up constants
+ contractAddresses = await migrateOnceAsync();
+ await blockchainLifecycle.startAsync();
+ networkId = constants.TESTRPC_NETWORK_ID;
+ const config = {
+ networkId,
+ contractAddresses,
+ };
+ contractWrappers = new ContractWrappers(provider, config);
+ userAddresses = await web3Wrapper.getAvailableAddressesAsync();
+ zrxTokenAddress = contractAddresses.zrxToken;
+ [makerAddress, takerAddress] = userAddresses;
+ [makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
+ [makerAssetData, takerAssetData] = [
+ assetDataUtils.encodeERC20AssetData(makerTokenAddress),
+ assetDataUtils.encodeERC20AssetData(takerTokenAddress),
+ ];
+ fillScenarios = new FillScenarios(
+ provider,
+ userAddresses,
+ zrxTokenAddress,
+ contractAddresses.exchange,
+ contractAddresses.erc20Proxy,
+ contractAddresses.erc721Proxy,
+ );
+ signedOrder = await fillScenarios.createFillableSignedOrderAsync(
+ makerAssetData,
+ takerAssetData,
+ makerAddress,
+ takerAddress,
+ fillableAmount,
+ );
+ orderHash = orderHashUtils.getOrderHashHex(signedOrder);
+ addOrderPayload = {
+ id: 1,
+ jsonrpc: '2.0',
+ method: OrderWatcherMethod.AddOrder,
+ params: { signedOrder },
+ };
+ removeOrderPayload = {
+ id: 1,
+ jsonrpc: '2.0',
+ method: OrderWatcherMethod.RemoveOrder,
+ params: { orderHash },
+ };
+ });
+ after(async () => {
+ await blockchainLifecycle.revertAsync();
+ });
+ beforeEach(async () => {
+ // Prepare OrderWatcher WebSocket server
+ const orderWatcherConfig = {
+ isVerbose: true,
+ };
+ wsServer = new OrderWatcherWebSocketServer(provider, networkId, contractAddresses, orderWatcherConfig);
+ wsServer.start();
+ await blockchainLifecycle.startAsync();
+ wsClient = new WebSocket.w3cwebsocket('ws://127.0.0.1:8080/');
+ logUtils.log(`${new Date()} [Client] Connected.`);
+ });
+ afterEach(async () => {
+ wsClient.close();
+ await blockchainLifecycle.revertAsync();
+ wsServer.stop();
+ logUtils.log(`${new Date()} [Client] Closed.`);
+ });
+
+ it('responds to getStats requests correctly', (done: any) => {
+ const payload = {
+ id: 1,
+ jsonrpc: '2.0',
+ method: 'GET_STATS',
+ };
+ wsClient.onopen = () => wsClient.send(JSON.stringify(payload));
+ wsClient.onmessage = (msg: any) => {
+ const responseData = JSON.parse(msg.data);
+ expect(responseData.id).to.be.eq(1);
+ expect(responseData.jsonrpc).to.be.eq('2.0');
+ expect(responseData.method).to.be.eq('GET_STATS');
+ expect(responseData.result.orderCount).to.be.eq(0);
+ done();
+ };
+ });
+
+ it('throws an error when an invalid method is attempted', async () => {
+ const invalidMethodPayload = {
+ id: 1,
+ jsonrpc: '2.0',
+ method: 'BAD_METHOD',
+ };
+ wsClient.onopen = () => wsClient.send(JSON.stringify(invalidMethodPayload));
+ const errorMsg = await onMessageAsync(wsClient, null);
+ const errorData = JSON.parse(errorMsg.data);
+ // tslint:disable-next-line:no-unused-expression
+ expect(errorData.id).to.be.null;
+ // tslint:disable-next-line:no-unused-expression
+ expect(errorData.method).to.be.null;
+ expect(errorData.jsonrpc).to.be.eq('2.0');
+ expect(errorData.error).to.match(/^Error: Expected request to conform to schema/);
+ });
+
+ it('throws an error when jsonrpc field missing from request', async () => {
+ const noJsonRpcPayload = {
+ id: 1,
+ method: 'GET_STATS',
+ };
+ wsClient.onopen = () => wsClient.send(JSON.stringify(noJsonRpcPayload));
+ const errorMsg = await onMessageAsync(wsClient, null);
+ const errorData = JSON.parse(errorMsg.data);
+ // tslint:disable-next-line:no-unused-expression
+ expect(errorData.method).to.be.null;
+ expect(errorData.jsonrpc).to.be.eq('2.0');
+ expect(errorData.error).to.match(/^Error: Expected request to conform to schema/);
+ });
+
+ it('throws an error when we try to add an order without a signedOrder', async () => {
+ const noSignedOrderAddOrderPayload = {
+ id: 1,
+ jsonrpc: '2.0',
+ method: 'ADD_ORDER',
+ orderHash: '0x7337e2f2a9aa2ed6afe26edc2df7ad79c3ffa9cf9b81a964f707ea63f5272355',
+ };
+ wsClient.onopen = () => wsClient.send(JSON.stringify(noSignedOrderAddOrderPayload));
+ const errorMsg = await onMessageAsync(wsClient, null);
+ const errorData = JSON.parse(errorMsg.data);
+ // tslint:disable-next-line:no-unused-expression
+ expect(errorData.id).to.be.null;
+ // tslint:disable-next-line:no-unused-expression
+ expect(errorData.method).to.be.null;
+ expect(errorData.jsonrpc).to.be.eq('2.0');
+ expect(errorData.error).to.match(/^Error: Expected request to conform to schema/);
+ });
+
+ it('throws an error when we try to add a bad signedOrder', async () => {
+ const invalidAddOrderPayload = {
+ id: 1,
+ jsonrpc: '2.0',
+ method: 'ADD_ORDER',
+ signedOrder: {
+ makerAddress: '0x0',
+ },
+ };
+ wsClient.onopen = () => wsClient.send(JSON.stringify(invalidAddOrderPayload));
+ const errorMsg = await onMessageAsync(wsClient, null);
+ const errorData = JSON.parse(errorMsg.data);
+ // tslint:disable-next-line:no-unused-expression
+ expect(errorData.id).to.be.null;
+ // tslint:disable-next-line:no-unused-expression
+ expect(errorData.method).to.be.null;
+ expect(errorData.error).to.match(/^Error: Expected request to conform to schema/);
+ });
+
+ it('executes addOrder and removeOrder requests correctly', async () => {
+ wsClient.onopen = () => wsClient.send(JSON.stringify(addOrderPayload));
+ const addOrderMsg = await onMessageAsync(wsClient, OrderWatcherMethod.AddOrder);
+ const addOrderData = JSON.parse(addOrderMsg.data);
+ expect(addOrderData.method).to.be.eq('ADD_ORDER');
+ expect((wsServer as any)._orderWatcher._orderByOrderHash).to.deep.include({
+ [orderHash]: signedOrder,
+ });
+
+ const clientOnMessagePromise = onMessageAsync(wsClient, OrderWatcherMethod.RemoveOrder);
+ wsClient.send(JSON.stringify(removeOrderPayload));
+ const removeOrderMsg = await clientOnMessagePromise;
+ const removeOrderData = JSON.parse(removeOrderMsg.data);
+ expect(removeOrderData.method).to.be.eq('REMOVE_ORDER');
+ expect((wsServer as any)._orderWatcher._orderByOrderHash).to.not.deep.include({
+ [orderHash]: signedOrder,
+ });
+ });
+
+ it('broadcasts orderStateInvalid message when makerAddress allowance set to 0 for watched order', async () => {
+ // Add the regular order
+ wsClient.onopen = () => wsClient.send(JSON.stringify(addOrderPayload));
+
+ // We register the onMessage callback before calling `setProxyAllowanceAsync` which we
+ // expect will cause a message to be emitted. We do now "await" here, since we want to
+ // check for messages _after_ calling `setProxyAllowanceAsync`
+ const clientOnMessagePromise = onMessageAsync(wsClient, OrderWatcherMethod.Update);
+
+ // Set the allowance to 0
+ await contractWrappers.erc20Token.setProxyAllowanceAsync(makerTokenAddress, makerAddress, new BigNumber(0));
+
+ // We now await the `onMessage` promise to check for the message
+ const orderWatcherUpdateMsg = await clientOnMessagePromise;
+ const orderWatcherUpdateData = JSON.parse(orderWatcherUpdateMsg.data);
+ expect(orderWatcherUpdateData.method).to.be.eq('UPDATE');
+ const invalidOrderState = orderWatcherUpdateData.result as OrderStateInvalid;
+ expect(invalidOrderState.isValid).to.be.false();
+ expect(invalidOrderState.orderHash).to.be.eq(orderHash);
+ expect(invalidOrderState.error).to.be.eq(ExchangeContractErrs.InsufficientMakerAllowance);
+ });
+
+ it('broadcasts to multiple clients when an order backing ZRX allowance changes', async () => {
+ // Prepare order
+ const makerFee = Web3Wrapper.toBaseUnitAmount(new BigNumber(2), decimals);
+ const takerFee = Web3Wrapper.toBaseUnitAmount(new BigNumber(0), decimals);
+ const nonZeroMakerFeeSignedOrder = await fillScenarios.createFillableSignedOrderWithFeesAsync(
+ makerAssetData,
+ takerAssetData,
+ makerFee,
+ takerFee,
+ makerAddress,
+ takerAddress,
+ fillableAmount,
+ takerAddress,
+ );
+ const nonZeroMakerFeeOrderPayload = {
+ id: 1,
+ jsonrpc: '2.0',
+ method: 'ADD_ORDER',
+ params: {
+ signedOrder: nonZeroMakerFeeSignedOrder,
+ },
+ };
+
+ // Set up a second client and have it add the order
+ wsClientTwo = new WebSocket.w3cwebsocket('ws://127.0.0.1:8080/');
+ logUtils.log(`${new Date()} [Client] Connected.`);
+ wsClientTwo.onopen = () => wsClientTwo.send(JSON.stringify(nonZeroMakerFeeOrderPayload));
+
+ // Setup the onMessage callbacks, but don't await them yet
+ const clientOneOnMessagePromise = onMessageAsync(wsClient, OrderWatcherMethod.Update);
+ const clientTwoOnMessagePromise = onMessageAsync(wsClientTwo, OrderWatcherMethod.Update);
+
+ // Change the allowance
+ await contractWrappers.erc20Token.setProxyAllowanceAsync(zrxTokenAddress, makerAddress, new BigNumber(0));
+
+ // Check that both clients receive the emitted event by awaiting the onMessageAsync promises
+ let updateMsg = await clientOneOnMessagePromise;
+ let updateData = JSON.parse(updateMsg.data);
+ let orderState = updateData.result as OrderStateInvalid;
+ expect(orderState.isValid).to.be.false();
+ expect(orderState.error).to.be.eq('INSUFFICIENT_MAKER_FEE_ALLOWANCE');
+
+ updateMsg = await clientTwoOnMessagePromise;
+ updateData = JSON.parse(updateMsg.data);
+ orderState = updateData.result as OrderStateInvalid;
+ expect(orderState.isValid).to.be.false();
+ expect(orderState.error).to.be.eq('INSUFFICIENT_MAKER_FEE_ALLOWANCE');
+
+ wsClientTwo.close();
+ logUtils.log(`${new Date()} [Client] Closed.`);
+ });
+});
+
+// HACK: createFillableSignedOrderAsync is Promise-based, which forces us
+// to use Promises instead of the done() callbacks for tests.
+// onmessage callback must thus be wrapped as a Promise.
+async function onMessageAsync(client: WebSocket.w3cwebsocket, method: string | null): Promise<WsMessage> {
+ return new Promise<WsMessage>(resolve => {
+ client.onmessage = (msg: WsMessage) => {
+ const data = JSON.parse(msg.data);
+ if (data.method === method) {
+ resolve(msg);
+ }
+ };
+ });
+}
diff --git a/packages/pipeline/.npmignore b/packages/pipeline/.npmignore
new file mode 100644
index 000000000..89302c908
--- /dev/null
+++ b/packages/pipeline/.npmignore
@@ -0,0 +1,7 @@
+.*
+yarn-error.log
+/scripts/
+/generated_docs/
+/src/
+tsconfig.json
+/lib/monorepo_scripts/
diff --git a/packages/pipeline/README.md b/packages/pipeline/README.md
new file mode 100644
index 000000000..794488cac
--- /dev/null
+++ b/packages/pipeline/README.md
@@ -0,0 +1,166 @@
+## @0xproject/pipeline
+
+This repository contains scripts used for scraping data from the Ethereum blockchain into SQL tables for analysis by the 0x team.
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install dependencies:
+
+```bash
+yarn install
+```
+
+### Build
+
+```bash
+yarn build
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Migrations
+
+Create a new migration: `yarn migrate:create --name MigrationNameInCamelCase`
+Run migrations: `yarn migrate:run`
+Revert the most recent migration (CAUTION: may result in data loss!): `yarn migrate:revert`
+
+## Testing
+
+There are several test scripts in **package.json**. You can run all the tests
+with `yarn test:all` or run certain tests seprately by following the
+instructions below. Some tests may not work out of the box on certain platforms
+or operating systems (see the "Database tests" section below).
+
+### Unit tests
+
+The unit tests can be run with `yarn test`. These tests don't depend on any
+services or databases and will run in any environment that can run Node.
+
+### Database tests
+
+Database integration tests can be run with `yarn test:db`. These tests will
+attempt to automatically spin up a Postgres database via Docker. If this doesn't
+work you have two other options:
+
+1. Set the `DOCKER_SOCKET` environment variable to a valid socket path to use
+ for communicating with Docker.
+2. Start Postgres manually and set the `ZEROEX_DATA_PIPELINE_TEST_DB_URL`
+ environment variable. If this is set, the tests will use your existing
+ Postgres database instead of trying to create one with Docker.
+
+## Running locally
+
+`pipeline` requires access to a PostgreSQL database. The easiest way to start
+Postgres is via Docker. Depending on your platform, you may need to prepend
+`sudo` to the following command:
+
+```
+docker run --rm -d -p 5432:5432 --name pipeline_postgres postgres:11-alpine
+```
+
+This will start a Postgres server with the default username and database name
+(`postgres` and `postgres`). You should set the environment variable as follows:
+
+```
+export ZEROEX_DATA_PIPELINE_DB_URL=postgresql://postgres@localhost/postgres
+```
+
+First thing you will need to do is run the migrations:
+
+```
+yarn migrate:run
+```
+
+Now you can run scripts locally:
+
+```
+node packages/pipeline/lib/src/scripts/pull_radar_relay_orders.js
+```
+
+To stop the Postgres server (you may need to add `sudo`):
+
+```
+docker stop pipeline_postgres
+```
+
+This will remove all data from the database.
+
+If you prefer, you can also install Postgres with e.g.,
+[Homebrew](https://wiki.postgresql.org/wiki/Homebrew) or
+[Postgress.app](https://postgresapp.com/). Keep in mind that you will need to
+set the`ZEROEX_DATA_PIPELINE_DB_URL` environment variable to a valid
+[PostgreSQL connection url](https://stackoverflow.com/questions/3582552/postgresql-connection-url)
+
+## Directory structure
+
+```
+.
+├── lib: Code generated by the TypeScript compiler. Don't edit this directly.
+├── migrations: Code for creating and updating database schemas.
+├── node_modules:
+├── src: All TypeScript source code.
+│   ├── data_sources: Code responsible for getting raw data, typically from a third-party source.
+│   ├── entities: TypeORM entities which closely mirror our database schemas. Some other ORMs call these "models".
+│   ├── parsers: Code for converting raw data into entities.
+│   ├── scripts: Executable scripts which put all the pieces together.
+│   └── utils: Various utils used across packages/files.
+├── test: All tests go here and are organized in the same way as the folder/file that they test.
+```
+
+## Adding new data to the pipeline
+
+1. Create an entity in the _entities_ directory. Entities directly mirror our
+ database schemas. We follow the practice of having "dumb" entities, so
+ entity classes should typically not have any methods.
+2. Create a migration using the `yarn migrate:create` command. Create/update
+ tables as needed. Remember to fill in both the `up` and `down` methods. Try
+ to avoid data loss as much as possible in your migrations.
+3. Add basic tests for your entity and migrations to the **test/entities/**
+ directory.
+4. Create a class or function in the **data_sources/** directory for getting
+ raw data. This code should abstract away pagination and rate-limiting as
+ much as possible.
+5. Create a class or function in the **parsers/** directory for converting the
+ raw data into an entity. Also add tests in the **tests/** directory to test
+ the parser.
+6. Create an executable script in the **scripts/** directory for putting
+ everything together. Your script can accept environment variables for things
+ like API keys. It should pull the data, parse it, and save it to the
+ database. Scripts should be idempotent and atomic (when possible). What this
+ means is that your script may be responsible for determining _which_ data
+ needs to be updated. For example, you may need to query the database to find
+ the most recent block number that we have already pulled, then pull new data
+ starting from that block number.
+7. Run the migrations and then run your new script locally and verify it works
+ as expected.
+
+#### Additional guidelines and tips:
+
+* Table names should be plural and separated by underscores (e.g.,
+ `exchange_fill_events`).
+* Any table which contains data which comes directly from a third-party source
+ should be namespaced in the `raw` PostgreSQL schema.
+* Column names in the database should be separated by underscores (e.g.,
+ `maker_asset_type`).
+* Field names in entity classes (like any other fields in TypeScript) should
+ be camel-cased (e.g., `makerAssetType`).
+* All timestamps should be stored as milliseconds since the Unix Epoch.
+* Use the `BigNumber` type for TypeScript code which deals with 256-bit
+ numbers from smart contracts or for any case where we are dealing with large
+ floating point numbers.
+* [TypeORM documentation](http://typeorm.io/#/) is pretty robust and can be a
+ helpful resource.
diff --git a/python-packages/order_utils/stubs/jsonschema/exceptions.pyi b/packages/pipeline/coverage/.gitkeep
index e69de29bb..e69de29bb 100644
--- a/python-packages/order_utils/stubs/jsonschema/exceptions.pyi
+++ b/packages/pipeline/coverage/.gitkeep
diff --git a/packages/pipeline/migrations/1542070840010-InitialSchema.ts b/packages/pipeline/migrations/1542070840010-InitialSchema.ts
new file mode 100644
index 000000000..895f9e6c9
--- /dev/null
+++ b/packages/pipeline/migrations/1542070840010-InitialSchema.ts
@@ -0,0 +1,187 @@
+import { MigrationInterface, QueryRunner, Table } from 'typeorm';
+
+const blocks = new Table({
+ name: 'raw.blocks',
+ columns: [
+ { name: 'number', type: 'bigint', isPrimary: true },
+ { name: 'hash', type: 'varchar', isPrimary: true },
+ { name: 'timestamp', type: 'bigint' },
+ ],
+});
+
+const exchange_cancel_events = new Table({
+ name: 'raw.exchange_cancel_events',
+ columns: [
+ { name: 'contract_address', type: 'char(42)', isPrimary: true },
+ { name: 'log_index', type: 'integer', isPrimary: true },
+ { name: 'block_number', type: 'bigint', isPrimary: true },
+
+ { name: 'raw_data', type: 'varchar' },
+
+ { name: 'transaction_hash', type: 'varchar' },
+ { name: 'maker_address', type: 'char(42)' },
+ { name: 'taker_address', type: 'char(42)' },
+ { name: 'fee_recipient_address', type: 'char(42)' },
+ { name: 'sender_address', type: 'char(42)' },
+ { name: 'order_hash', type: 'varchar' },
+
+ { name: 'raw_maker_asset_data', type: 'varchar' },
+ { name: 'maker_asset_type', type: 'varchar' },
+ { name: 'maker_asset_proxy_id', type: 'varchar' },
+ { name: 'maker_token_address', type: 'char(42)' },
+ { name: 'maker_token_id', type: 'varchar', isNullable: true },
+ { name: 'raw_taker_asset_data', type: 'varchar' },
+ { name: 'taker_asset_type', type: 'varchar' },
+ { name: 'taker_asset_proxy_id', type: 'varchar' },
+ { name: 'taker_token_address', type: 'char(42)' },
+ { name: 'taker_token_id', type: 'varchar', isNullable: true },
+ ],
+});
+
+const exchange_cancel_up_to_events = new Table({
+ name: 'raw.exchange_cancel_up_to_events',
+ columns: [
+ { name: 'contract_address', type: 'char(42)', isPrimary: true },
+ { name: 'log_index', type: 'integer', isPrimary: true },
+ { name: 'block_number', type: 'bigint', isPrimary: true },
+
+ { name: 'raw_data', type: 'varchar' },
+
+ { name: 'transaction_hash', type: 'varchar' },
+ { name: 'maker_address', type: 'char(42)' },
+ { name: 'sender_address', type: 'char(42)' },
+ { name: 'order_epoch', type: 'varchar' },
+ ],
+});
+
+const exchange_fill_events = new Table({
+ name: 'raw.exchange_fill_events',
+ columns: [
+ { name: 'contract_address', type: 'char(42)', isPrimary: true },
+ { name: 'log_index', type: 'integer', isPrimary: true },
+ { name: 'block_number', type: 'bigint', isPrimary: true },
+
+ { name: 'raw_data', type: 'varchar' },
+
+ { name: 'transaction_hash', type: 'varchar' },
+ { name: 'maker_address', type: 'char(42)' },
+ { name: 'taker_address', type: 'char(42)' },
+ { name: 'fee_recipient_address', type: 'char(42)' },
+ { name: 'sender_address', type: 'char(42)' },
+ { name: 'maker_asset_filled_amount', type: 'varchar' },
+ { name: 'taker_asset_filled_amount', type: 'varchar' },
+ { name: 'maker_fee_paid', type: 'varchar' },
+ { name: 'taker_fee_paid', type: 'varchar' },
+ { name: 'order_hash', type: 'varchar' },
+
+ { name: 'raw_maker_asset_data', type: 'varchar' },
+ { name: 'maker_asset_type', type: 'varchar' },
+ { name: 'maker_asset_proxy_id', type: 'varchar' },
+ { name: 'maker_token_address', type: 'char(42)' },
+ { name: 'maker_token_id', type: 'varchar', isNullable: true },
+ { name: 'raw_taker_asset_data', type: 'varchar' },
+ { name: 'taker_asset_type', type: 'varchar' },
+ { name: 'taker_asset_proxy_id', type: 'varchar' },
+ { name: 'taker_token_address', type: 'char(42)' },
+ { name: 'taker_token_id', type: 'varchar', isNullable: true },
+ ],
+});
+
+const relayers = new Table({
+ name: 'raw.relayers',
+ columns: [
+ { name: 'uuid', type: 'varchar', isPrimary: true },
+ { name: 'name', type: 'varchar' },
+ { name: 'sra_http_endpoint', type: 'varchar', isNullable: true },
+ { name: 'sra_ws_endpoint', type: 'varchar', isNullable: true },
+ { name: 'app_url', type: 'varchar', isNullable: true },
+ { name: 'fee_recipient_addresses', type: 'char(42)', isArray: true },
+ { name: 'taker_addresses', type: 'char(42)', isArray: true },
+ ],
+});
+
+const sra_orders = new Table({
+ name: 'raw.sra_orders',
+ columns: [
+ { name: 'exchange_address', type: 'char(42)', isPrimary: true },
+ { name: 'order_hash_hex', type: 'varchar', isPrimary: true },
+
+ { name: 'source_url', type: 'varchar' },
+ { name: 'last_updated_timestamp', type: 'bigint' },
+ { name: 'first_seen_timestamp', type: 'bigint' },
+
+ { name: 'maker_address', type: 'char(42)' },
+ { name: 'taker_address', type: 'char(42)' },
+ { name: 'fee_recipient_address', type: 'char(42)' },
+ { name: 'sender_address', type: 'char(42)' },
+ { name: 'maker_asset_filled_amount', type: 'varchar' },
+ { name: 'taker_asset_filled_amount', type: 'varchar' },
+ { name: 'maker_fee', type: 'varchar' },
+ { name: 'taker_fee', type: 'varchar' },
+ { name: 'expiration_time_seconds', type: 'int' },
+ { name: 'salt', type: 'varchar' },
+ { name: 'signature', type: 'varchar' },
+
+ { name: 'raw_maker_asset_data', type: 'varchar' },
+ { name: 'maker_asset_type', type: 'varchar' },
+ { name: 'maker_asset_proxy_id', type: 'varchar' },
+ { name: 'maker_token_address', type: 'char(42)' },
+ { name: 'maker_token_id', type: 'varchar', isNullable: true },
+ { name: 'raw_taker_asset_data', type: 'varchar' },
+ { name: 'taker_asset_type', type: 'varchar' },
+ { name: 'taker_asset_proxy_id', type: 'varchar' },
+ { name: 'taker_token_address', type: 'char(42)' },
+ { name: 'taker_token_id', type: 'varchar', isNullable: true },
+
+ { name: 'metadata_json', type: 'varchar' },
+ ],
+});
+
+const token_on_chain_metadata = new Table({
+ name: 'raw.token_on_chain_metadata',
+ columns: [
+ { name: 'address', type: 'char(42)', isPrimary: true },
+ { name: 'decimals', type: 'integer' },
+ { name: 'symbol', type: 'varchar' },
+ { name: 'name', type: 'varchar' },
+ ],
+});
+
+const transactions = new Table({
+ name: 'raw.transactions',
+ columns: [
+ { name: 'block_number', type: 'bigint', isPrimary: true },
+ { name: 'block_hash', type: 'varchar', isPrimary: true },
+ { name: 'transaction_hash', type: 'varchar', isPrimary: true },
+ { name: 'gas_used', type: 'bigint' },
+ { name: 'gas_price', type: 'bigint' },
+ ],
+});
+
+export class InitialSchema1542070840010 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.createSchema('raw');
+
+ await queryRunner.createTable(blocks);
+ await queryRunner.createTable(exchange_cancel_events);
+ await queryRunner.createTable(exchange_cancel_up_to_events);
+ await queryRunner.createTable(exchange_fill_events);
+ await queryRunner.createTable(relayers);
+ await queryRunner.createTable(sra_orders);
+ await queryRunner.createTable(token_on_chain_metadata);
+ await queryRunner.createTable(transactions);
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.dropTable(blocks.name);
+ await queryRunner.dropTable(exchange_cancel_events.name);
+ await queryRunner.dropTable(exchange_cancel_up_to_events.name);
+ await queryRunner.dropTable(exchange_fill_events.name);
+ await queryRunner.dropTable(relayers.name);
+ await queryRunner.dropTable(sra_orders.name);
+ await queryRunner.dropTable(token_on_chain_metadata.name);
+ await queryRunner.dropTable(transactions.name);
+
+ await queryRunner.dropSchema('raw');
+ }
+}
diff --git a/packages/pipeline/migrations/1542147915364-NewSraOrderTimestampFormat.ts b/packages/pipeline/migrations/1542147915364-NewSraOrderTimestampFormat.ts
new file mode 100644
index 000000000..5a8f3fec8
--- /dev/null
+++ b/packages/pipeline/migrations/1542147915364-NewSraOrderTimestampFormat.ts
@@ -0,0 +1,48 @@
+import { MigrationInterface, QueryRunner, Table } from 'typeorm';
+
+export class NewSraOrderTimestampFormat1542147915364 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.sra_orders
+ DROP CONSTRAINT "PK_09bfb9980715329563bd53d667e",
+ ADD PRIMARY KEY (order_hash_hex, exchange_address, source_url);
+ `,
+ );
+
+ await queryRunner.query(
+ `CREATE TABLE raw.sra_orders_observed_timestamps (
+ order_hash_hex varchar NOT NULL,
+ exchange_address varchar NOT NULL,
+ source_url varchar NOT NULL,
+ observed_timestamp bigint NOT NULL,
+ FOREIGN KEY
+ (order_hash_hex, exchange_address, source_url)
+ REFERENCES raw.sra_orders (order_hash_hex, exchange_address, source_url),
+ PRIMARY KEY (order_hash_hex, exchange_address, source_url, observed_timestamp)
+ );`,
+ );
+
+ await queryRunner.query(
+ `ALTER TABLE raw.sra_orders
+ DROP COLUMN last_updated_timestamp,
+ DROP COLUMN first_seen_timestamp;`,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.dropTable('raw.sra_orders_observed_timestamps');
+
+ await queryRunner.query(
+ `ALTER TABLE raw.sra_orders
+ ADD COLUMN last_updated_timestamp bigint NOT NULL DEFAULT 0,
+ ADD COLUMN first_seen_timestamp bigint NOT NULL DEFAULT 0;`,
+ );
+
+ await queryRunner.query(
+ `ALTER TABLE raw.sra_orders
+ DROP CONSTRAINT sra_orders_pkey,
+ ADD CONSTRAINT "PK_09bfb9980715329563bd53d667e" PRIMARY KEY ("exchange_address", "order_hash_hex");
+ `,
+ );
+ }
+}
diff --git a/packages/pipeline/migrations/1542152278484-RenameSraOrdersFilledAmounts.ts b/packages/pipeline/migrations/1542152278484-RenameSraOrdersFilledAmounts.ts
new file mode 100644
index 000000000..a13e3efa5
--- /dev/null
+++ b/packages/pipeline/migrations/1542152278484-RenameSraOrdersFilledAmounts.ts
@@ -0,0 +1,13 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+
+export class RenameSraOrdersFilledAmounts1542152278484 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.renameColumn('raw.sra_orders', 'maker_asset_filled_amount', 'maker_asset_amount');
+ await queryRunner.renameColumn('raw.sra_orders', 'taker_asset_filled_amount', 'taker_asset_amount');
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.renameColumn('raw.sra_orders', 'maker_asset_amount', 'maker_asset_filled_amount');
+ await queryRunner.renameColumn('raw.sra_orders', 'taker_asset_amount', 'taker_asset_filled_amount');
+ }
+}
diff --git a/packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts b/packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts
new file mode 100644
index 000000000..5200ef7cc
--- /dev/null
+++ b/packages/pipeline/migrations/1542234704666-ConvertBigNumberToNumeric.ts
@@ -0,0 +1,53 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+
+export class ConvertBigNumberToNumeric1542234704666 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.exchange_fill_events
+ ALTER COLUMN maker_asset_filled_amount TYPE numeric USING maker_asset_filled_amount::numeric,
+ ALTER COLUMN taker_asset_filled_amount TYPE numeric USING taker_asset_filled_amount::numeric,
+ ALTER COLUMN maker_fee_paid TYPE numeric USING maker_fee_paid::numeric,
+ ALTER COLUMN taker_fee_paid TYPE numeric USING taker_fee_paid::numeric;`,
+ );
+
+ await queryRunner.query(
+ `ALTER TABLE raw.exchange_cancel_up_to_events
+ ALTER COLUMN order_epoch TYPE numeric USING order_epoch::numeric;`,
+ );
+
+ await queryRunner.query(
+ `ALTER TABLE raw.sra_orders
+ ALTER COLUMN maker_asset_amount TYPE numeric USING maker_asset_amount::numeric,
+ ALTER COLUMN taker_asset_amount TYPE numeric USING taker_asset_amount::numeric,
+ ALTER COLUMN maker_fee TYPE numeric USING maker_fee::numeric,
+ ALTER COLUMN taker_fee TYPE numeric USING taker_fee::numeric,
+ ALTER COLUMN expiration_time_seconds TYPE numeric USING expiration_time_seconds::numeric,
+ ALTER COLUMN salt TYPE numeric USING salt::numeric;`,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.sra_orders
+ ALTER COLUMN maker_asset_amount TYPE varchar USING maker_asset_amount::varchar,
+ ALTER COLUMN taker_asset_amount TYPE varchar USING taker_asset_amount::varchar,
+ ALTER COLUMN maker_fee TYPE varchar USING maker_fee::varchar,
+ ALTER COLUMN taker_fee TYPE varchar USING taker_fee::varchar,
+ ALTER COLUMN expiration_time_seconds TYPE varchar USING expiration_time_seconds::varchar,
+ ALTER COLUMN salt TYPE varchar USING salt::varchar;`,
+ );
+
+ await queryRunner.query(
+ `ALTER TABLE raw.exchange_cancel_up_to_events
+ ALTER COLUMN order_epoch TYPE varchar USING order_epoch::varchar;`,
+ );
+
+ await queryRunner.query(
+ `ALTER TABLE raw.exchange_fill_events
+ ALTER COLUMN maker_asset_filled_amount TYPE varchar USING maker_asset_filled_amount::varchar,
+ ALTER COLUMN taker_asset_filled_amount TYPE varchar USING taker_asset_filled_amount::varchar,
+ ALTER COLUMN maker_fee_paid TYPE varchar USING maker_fee_paid::varchar,
+ ALTER COLUMN taker_fee_paid TYPE varchar USING taker_fee_paid::varchar;`,
+ );
+ }
+}
diff --git a/packages/pipeline/migrations/1542249766882-AddHomepageUrlToRelayers.ts b/packages/pipeline/migrations/1542249766882-AddHomepageUrlToRelayers.ts
new file mode 100644
index 000000000..9a4811ad5
--- /dev/null
+++ b/packages/pipeline/migrations/1542249766882-AddHomepageUrlToRelayers.ts
@@ -0,0 +1,14 @@
+import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';
+
+export class AddHomepageUrlToRelayers1542249766882 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.addColumn(
+ 'raw.relayers',
+ new TableColumn({ name: 'homepage_url', type: 'varchar', default: `'unknown'` }),
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.dropColumn('raw.relayers', 'homepage_url');
+ }
+}
diff --git a/packages/pipeline/migrations/1542401122477-MakeTakerAddressNullable.ts b/packages/pipeline/migrations/1542401122477-MakeTakerAddressNullable.ts
new file mode 100644
index 000000000..957c85a36
--- /dev/null
+++ b/packages/pipeline/migrations/1542401122477-MakeTakerAddressNullable.ts
@@ -0,0 +1,17 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+
+export class MakeTakerAddressNullable1542401122477 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.exchange_cancel_events
+ ALTER COLUMN taker_address DROP NOT NULL;`,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.exchange_cancel_events
+ ALTER COLUMN taker_address SET NOT NULL;`,
+ );
+ }
+}
diff --git a/packages/pipeline/migrations/1542655823221-NewMetadataAndOHLCVTables.ts b/packages/pipeline/migrations/1542655823221-NewMetadataAndOHLCVTables.ts
new file mode 100644
index 000000000..838f5ba9c
--- /dev/null
+++ b/packages/pipeline/migrations/1542655823221-NewMetadataAndOHLCVTables.ts
@@ -0,0 +1,60 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+
+export class NewMetadataAndOHLCVTables1542655823221 implements MigrationInterface {
+ // tslint:disable-next-line
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(`
+ CREATE TABLE raw.token_metadata (
+ address VARCHAR NOT NULL,
+ authority VARCHAR NOT NULL,
+ decimals INT NULL,
+ symbol VARCHAR NULL,
+ name VARCHAR NULL,
+
+ PRIMARY KEY (address, authority)
+ );
+ `);
+
+ await queryRunner.dropTable('raw.token_on_chain_metadata');
+
+ await queryRunner.query(`
+ CREATE TABLE raw.ohlcv_external (
+ exchange VARCHAR NOT NULL,
+ from_symbol VARCHAR NOT NULL,
+ to_symbol VARCHAR NOT NULL,
+ start_time BIGINT NOT NULL,
+ end_time BIGINT NOT NULL,
+
+ open DOUBLE PRECISION NOT NULL,
+ close DOUBLE PRECISION NOT NULL,
+ low DOUBLE PRECISION NOT NULL,
+ high DOUBLE PRECISION NOT NULL,
+ volume_from DOUBLE PRECISION NOT NULL,
+ volume_to DOUBLE PRECISION NOT NULL,
+
+ source VARCHAR NOT NULL,
+ observed_timestamp BIGINT NOT NULL,
+
+ PRIMARY KEY (exchange, from_symbol, to_symbol, start_time, end_time, source, observed_timestamp)
+ );
+ `);
+ }
+
+ // tslint:disable-next-line
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(`
+ CREATE TABLE raw.token_on_chain_metadata (
+ address VARCHAR NOT NULL,
+ decimals INT NULL,
+ symbol VARCHAR NULL,
+ name VARCHAR NULL,
+
+ PRIMARY KEY (address)
+ );
+ `);
+
+ await queryRunner.dropTable('raw.token_metadata');
+
+ await queryRunner.dropTable('raw.ohlcv_external');
+ }
+}
diff --git a/packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts b/packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts
new file mode 100644
index 000000000..a7117c753
--- /dev/null
+++ b/packages/pipeline/migrations/1543434472116-TokenOrderbookSnapshots.ts
@@ -0,0 +1,30 @@
+import { MigrationInterface, QueryRunner, Table } from 'typeorm';
+
+const tokenOrderbookSnapshots = new Table({
+ name: 'raw.token_orderbook_snapshots',
+ columns: [
+ { name: 'observed_timestamp', type: 'bigint', isPrimary: true },
+ { name: 'source', type: 'varchar', isPrimary: true },
+ { name: 'order_type', type: 'order_t' },
+ { name: 'price', type: 'numeric', isPrimary: true },
+
+ { name: 'base_asset_symbol', type: 'varchar', isPrimary: true },
+ { name: 'base_asset_address', type: 'char(42)' },
+ { name: 'base_volume', type: 'numeric' },
+
+ { name: 'quote_asset_symbol', type: 'varchar', isPrimary: true },
+ { name: 'quote_asset_address', type: 'char(42)' },
+ { name: 'quote_volume', type: 'numeric' },
+ ],
+});
+
+export class TokenOrderbookSnapshots1543434472116 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(`CREATE TYPE order_t AS enum('bid', 'ask');`);
+ await queryRunner.createTable(tokenOrderbookSnapshots);
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.dropTable(tokenOrderbookSnapshots.name);
+ }
+}
diff --git a/packages/pipeline/migrations/1543446690436-CreateDexTrades.ts b/packages/pipeline/migrations/1543446690436-CreateDexTrades.ts
new file mode 100644
index 000000000..267cf144b
--- /dev/null
+++ b/packages/pipeline/migrations/1543446690436-CreateDexTrades.ts
@@ -0,0 +1,41 @@
+import { MigrationInterface, QueryRunner, Table } from 'typeorm';
+
+const dexTrades = new Table({
+ name: 'raw.dex_trades',
+ columns: [
+ { name: 'source_url', type: 'varchar', isPrimary: true },
+ { name: 'tx_hash', type: 'varchar', isPrimary: true },
+
+ { name: 'tx_timestamp', type: 'bigint' },
+ { name: 'tx_date', type: 'varchar' },
+ { name: 'tx_sender', type: 'varchar(42)' },
+ { name: 'smart_contract_id', type: 'bigint' },
+ { name: 'smart_contract_address', type: 'varchar(42)' },
+ { name: 'contract_type', type: 'varchar' },
+ { name: 'maker', type: 'varchar(42)' },
+ { name: 'taker', type: 'varchar(42)' },
+ { name: 'amount_buy', type: 'numeric' },
+ { name: 'maker_fee_amount', type: 'numeric' },
+ { name: 'buy_currency_id', type: 'bigint' },
+ { name: 'buy_symbol', type: 'varchar' },
+ { name: 'amount_sell', type: 'numeric' },
+ { name: 'taker_fee_amount', type: 'numeric' },
+ { name: 'sell_currency_id', type: 'bigint' },
+ { name: 'sell_symbol', type: 'varchar' },
+ { name: 'maker_annotation', type: 'varchar' },
+ { name: 'taker_annotation', type: 'varchar' },
+ { name: 'protocol', type: 'varchar' },
+ { name: 'buy_address', type: 'varchar(42)', isNullable: true },
+ { name: 'sell_address', type: 'varchar(42)', isNullable: true },
+ ],
+});
+
+export class CreateDexTrades1543446690436 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.createTable(dexTrades);
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.dropTable(dexTrades);
+ }
+}
diff --git a/packages/pipeline/migrations/1543980079179-ConvertTokenMetadataDecimalsToBigNumber.ts b/packages/pipeline/migrations/1543980079179-ConvertTokenMetadataDecimalsToBigNumber.ts
new file mode 100644
index 000000000..351bc7eb8
--- /dev/null
+++ b/packages/pipeline/migrations/1543980079179-ConvertTokenMetadataDecimalsToBigNumber.ts
@@ -0,0 +1,17 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+
+export class ConvertTokenMetadataDecimalsToBigNumber1543980079179 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.token_metadata
+ ALTER COLUMN decimals TYPE numeric USING decimals::numeric;`,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.token_metadata
+ ALTER COLUMN decimals TYPE numeric USING decimals::integer;`,
+ );
+ }
+}
diff --git a/packages/pipeline/migrations/1543983324954-ConvertTransactionGasPriceToBigNumber.ts b/packages/pipeline/migrations/1543983324954-ConvertTransactionGasPriceToBigNumber.ts
new file mode 100644
index 000000000..dcb0fd727
--- /dev/null
+++ b/packages/pipeline/migrations/1543983324954-ConvertTransactionGasPriceToBigNumber.ts
@@ -0,0 +1,19 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+
+export class ConvertTransactionGasPriceToBigNumber1543983324954 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.transactions
+ ALTER COLUMN gas_price TYPE numeric USING gas_price::numeric,
+ ALTER COLUMN gas_used TYPE numeric USING gas_used::numeric;`,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.transactions
+ ALTER COLUMN gas_price TYPE numeric USING gas_price::bigint,
+ ALTER COLUMN gas_used TYPE numeric USING gas_used::bigint;`,
+ );
+ }
+}
diff --git a/packages/pipeline/migrations/1544131464368-CreateERC20ApprovalEvents.ts b/packages/pipeline/migrations/1544131464368-CreateERC20ApprovalEvents.ts
new file mode 100644
index 000000000..2e84e0ec8
--- /dev/null
+++ b/packages/pipeline/migrations/1544131464368-CreateERC20ApprovalEvents.ts
@@ -0,0 +1,26 @@
+import { MigrationInterface, QueryRunner, Table } from 'typeorm';
+
+const erc20ApprovalEvents = new Table({
+ name: 'raw.erc20_approval_events',
+ columns: [
+ { name: 'token_address', type: 'varchar(42)', isPrimary: true },
+ { name: 'log_index', type: 'integer', isPrimary: true },
+ { name: 'block_number', type: 'bigint', isPrimary: true },
+
+ { name: 'raw_data', type: 'varchar' },
+ { name: 'transaction_hash', type: 'varchar' },
+ { name: 'owner_address', type: 'varchar(42)' },
+ { name: 'spender_address', type: 'varchar(42)' },
+ { name: 'amount', type: 'numeric' },
+ ],
+});
+
+export class CreateERC20TokenApprovalEvents1544131464368 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.createTable(erc20ApprovalEvents);
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.dropTable(erc20ApprovalEvents);
+ }
+}
diff --git a/packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts b/packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts
new file mode 100644
index 000000000..a501ec6d8
--- /dev/null
+++ b/packages/pipeline/migrations/1544131658904-TokenOrderbookSnapshotAddOrderType.ts
@@ -0,0 +1,33 @@
+import { MigrationInterface, QueryRunner } from 'typeorm';
+
+export class TokenOrderbookSnapshotAddOrderType1544131658904 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ DROP CONSTRAINT "PK_8a16487e7cb6862ec5a84ed3495",
+ ADD PRIMARY KEY (observed_timestamp, source, order_type, price, base_asset_symbol, quote_asset_symbol);
+ `,
+ );
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ ALTER COLUMN quote_asset_address DROP NOT NULL,
+ ALTER COLUMN base_asset_address DROP NOT NULL;
+ `,
+ );
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ ALTER COLUMN quote_asset_address SET NOT NULL,
+ ALTER COLUMN base_asset_address SET NOT NULL;
+ `,
+ );
+ await queryRunner.query(
+ `ALTER TABLE raw.token_orderbook_snapshots
+ DROP CONSTRAINT token_orderbook_snapshots_pkey,
+ ADD CONSTRAINT "PK_8a16487e7cb6862ec5a84ed3495" PRIMARY KEY (observed_timestamp, source, price, base_asset_symbol, quote_asset_symbol);
+ `,
+ );
+ }
+}
diff --git a/packages/pipeline/migrations/1545440485644-CreateCopperTables.ts b/packages/pipeline/migrations/1545440485644-CreateCopperTables.ts
new file mode 100644
index 000000000..64bf70af4
--- /dev/null
+++ b/packages/pipeline/migrations/1545440485644-CreateCopperTables.ts
@@ -0,0 +1,103 @@
+import { MigrationInterface, QueryRunner, Table } from 'typeorm';
+
+const leads = new Table({
+ name: 'raw.copper_leads',
+ columns: [
+ { name: 'id', type: 'bigint', isPrimary: true },
+ { name: 'name', type: 'varchar', isNullable: true },
+ { name: 'first_name', type: 'varchar', isNullable: true },
+ { name: 'last_name', type: 'varchar', isNullable: true },
+ { name: 'middle_name', type: 'varchar', isNullable: true },
+ { name: 'assignee_id', type: 'bigint', isNullable: true },
+ { name: 'company_name', type: 'varchar', isNullable: true },
+ { name: 'customer_source_id', type: 'bigint', isNullable: true },
+ { name: 'monetary_value', type: 'integer', isNullable: true },
+ { name: 'status', type: 'varchar' },
+ { name: 'status_id', type: 'bigint' },
+ { name: 'title', type: 'varchar', isNullable: true },
+ { name: 'date_created', type: 'bigint' },
+ { name: 'date_modified', type: 'bigint', isPrimary: true },
+ ],
+});
+const activities = new Table({
+ name: 'raw.copper_activities',
+ columns: [
+ { name: 'id', type: 'bigint', isPrimary: true },
+ { name: 'parent_id', type: 'bigint' },
+ { name: 'parent_type', type: 'varchar' },
+ { name: 'type_id', type: 'bigint' },
+ { name: 'type_category', type: 'varchar' },
+ { name: 'type_name', type: 'varchar', isNullable: true },
+ { name: 'user_id', type: 'bigint' },
+ { name: 'old_value_id', type: 'bigint', isNullable: true },
+ { name: 'old_value_name', type: 'varchar', isNullable: true },
+ { name: 'new_value_id', type: 'bigint', isNullable: true },
+ { name: 'new_value_name', type: 'varchar', isNullable: true },
+ { name: 'date_created', type: 'bigint' },
+ { name: 'date_modified', type: 'bigint', isPrimary: true },
+ ],
+});
+
+const opportunities = new Table({
+ name: 'raw.copper_opportunities',
+ columns: [
+ { name: 'id', type: 'bigint', isPrimary: true },
+ { name: 'name', type: 'varchar' },
+ { name: 'assignee_id', isNullable: true, type: 'bigint' },
+ { name: 'close_date', isNullable: true, type: 'varchar' },
+ { name: 'company_id', isNullable: true, type: 'bigint' },
+ { name: 'company_name', isNullable: true, type: 'varchar' },
+ { name: 'customer_source_id', isNullable: true, type: 'bigint' },
+ { name: 'loss_reason_id', isNullable: true, type: 'bigint' },
+ { name: 'pipeline_id', type: 'bigint' },
+ { name: 'pipeline_stage_id', type: 'bigint' },
+ { name: 'primary_contact_id', isNullable: true, type: 'bigint' },
+ { name: 'priority', isNullable: true, type: 'varchar' },
+ { name: 'status', type: 'varchar' },
+ { name: 'interaction_count', type: 'bigint' },
+ { name: 'monetary_value', isNullable: true, type: 'integer' },
+ { name: 'win_probability', isNullable: true, type: 'integer' },
+ { name: 'date_created', type: 'bigint' },
+ { name: 'date_modified', type: 'bigint', isPrimary: true },
+ { name: 'custom_fields', type: 'jsonb' },
+ ],
+});
+
+const activityTypes = new Table({
+ name: 'raw.copper_activity_types',
+ columns: [
+ { name: 'id', type: 'bigint', isPrimary: true },
+ { name: 'category', type: 'varchar' },
+ { name: 'name', type: 'varchar' },
+ { name: 'is_disabled', type: 'boolean', isNullable: true },
+ { name: 'count_as_interaction', type: 'boolean', isNullable: true },
+ ],
+});
+
+const customFields = new Table({
+ name: 'raw.copper_custom_fields',
+ columns: [
+ { name: 'id', type: 'bigint', isPrimary: true },
+ { name: 'name', type: 'varchar' },
+ { name: 'data_type', type: 'varchar' },
+ { name: 'field_type', type: 'varchar', isNullable: true },
+ ],
+});
+
+export class CreateCopperTables1544055699284 implements MigrationInterface {
+ public async up(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.createTable(leads);
+ await queryRunner.createTable(activities);
+ await queryRunner.createTable(opportunities);
+ await queryRunner.createTable(activityTypes);
+ await queryRunner.createTable(customFields);
+ }
+
+ public async down(queryRunner: QueryRunner): Promise<any> {
+ await queryRunner.dropTable(leads.name);
+ await queryRunner.dropTable(activities.name);
+ await queryRunner.dropTable(opportunities.name);
+ await queryRunner.dropTable(activityTypes.name);
+ await queryRunner.dropTable(customFields.name);
+ }
+}
diff --git a/packages/pipeline/package.json b/packages/pipeline/package.json
new file mode 100644
index 000000000..cb3763362
--- /dev/null
+++ b/packages/pipeline/package.json
@@ -0,0 +1,66 @@
+{
+ "name": "@0x/pipeline",
+ "version": "1.0.2",
+ "private": true,
+ "description": "Data pipeline for offline analysis",
+ "scripts": {
+ "build": "yarn tsc -b",
+ "build:ci": "yarn build",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test:all",
+ "test:db": "yarn run_mocha:db",
+ "test:all": "run-s test test:db",
+ "test:circleci": "yarn test:coverage",
+ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/!(entities)/**/*_test.js' --bail --exit",
+ "run_mocha:db": "mocha --require source-map-support/register --require make-promises-safe lib/test/db_global_hooks.js 'lib/test/entities/*_test.js' --bail --exit --timeout 60000",
+ "test:coverage": "nyc npm run test:all --all && yarn coverage:report:lcov",
+ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
+ "clean": "shx rm -rf lib",
+ "lint": "tslint --project . --format stylish --exclude ./migrations/**/* --exclude ./test/fixtures/**/**/*.json",
+ "migrate:run": "yarn typeorm migration:run --config ./lib/src/ormconfig",
+ "migrate:revert": "yarn typeorm migration:revert --config ./lib/src/ormconfig",
+ "migrate:create": "yarn typeorm migration:create --config ./lib/src/ormconfig --dir migrations"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo"
+ },
+ "license": "Apache-2.0",
+ "devDependencies": {
+ "@0x/tslint-config": "^2.0.0",
+ "@types/axios": "^0.14.0",
+ "@types/ramda": "^0.25.38",
+ "chai": "^4.1.2",
+ "chai-as-promised": "^7.1.1",
+ "chai-bignumber": "^2.0.2",
+ "dirty-chai": "^2.0.1",
+ "mocha": "^5.2.0",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1"
+ },
+ "dependencies": {
+ "@0x/connect": "^3.0.10",
+ "@0x/contract-addresses": "^2.0.0",
+ "@0x/contract-artifacts": "^1.0.1",
+ "@0x/contract-wrappers": "^3.0.0",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/order-utils": "^3.0.7",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/types": "^1.4.1",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
+ "@types/dockerode": "^2.5.9",
+ "@types/p-limit": "^2.0.0",
+ "async-parallel": "^1.2.3",
+ "axios": "^0.18.0",
+ "bottleneck": "^2.13.2",
+ "dockerode": "^2.5.7",
+ "ethereum-types": "^1.1.4",
+ "pg": "^7.5.0",
+ "prettier": "^1.15.3",
+ "ramda": "^0.25.0",
+ "reflect-metadata": "^0.1.12",
+ "sqlite3": "^4.0.2",
+ "typeorm": "^0.2.7"
+ }
+}
diff --git a/packages/pipeline/src/data_sources/bloxy/index.ts b/packages/pipeline/src/data_sources/bloxy/index.ts
new file mode 100644
index 000000000..94468d25a
--- /dev/null
+++ b/packages/pipeline/src/data_sources/bloxy/index.ts
@@ -0,0 +1,133 @@
+import axios from 'axios';
+import * as R from 'ramda';
+
+// URL to use for getting dex trades from Bloxy.
+export const BLOXY_DEX_TRADES_URL = 'https://bloxy.info/api/dex/trades';
+// Number of trades to get at once. Must be less than or equal to MAX_OFFSET.
+const TRADES_PER_QUERY = 10000;
+// Maximum offset supported by the Bloxy API.
+const MAX_OFFSET = 100000;
+// Buffer to subtract from offset. This means we will request some trades twice
+// but we have less chance on missing out on any data.
+const OFFSET_BUFFER = 1000;
+// Maximum number of days supported by the Bloxy API.
+const MAX_DAYS = 30;
+// Buffer used for comparing the last seen timestamp to the last returned
+// timestamp. Increasing this reduces chances of data loss but also creates more
+// redundancy and can impact performance.
+// tslint:disable-next-line:custom-no-magic-numbers
+const LAST_SEEN_TIMESTAMP_BUFFER_MS = 1000 * 60 * 30; // 30 minutes
+
+// tslint:disable-next-line:custom-no-magic-numbers
+const millisecondsPerDay = 1000 * 60 * 60 * 24; // ms/d = ms/s * s/m * m/h * h/d
+
+export interface BloxyTrade {
+ tx_hash: string;
+ tx_time: string;
+ tx_date: string;
+ tx_sender: string;
+ smart_contract_id: number;
+ smart_contract_address: string;
+ contract_type: string;
+ maker: string;
+ taker: string;
+ amountBuy: number;
+ makerFee: number;
+ buyCurrencyId: number;
+ buySymbol: string;
+ amountSell: number;
+ takerFee: number;
+ sellCurrencyId: number;
+ sellSymbol: string;
+ maker_annotation: string;
+ taker_annotation: string;
+ protocol: string;
+ buyAddress: string | null;
+ sellAddress: string | null;
+}
+
+interface BloxyError {
+ error: string;
+}
+
+type BloxyResponse<T> = T | BloxyError;
+type BloxyTradeResponse = BloxyResponse<BloxyTrade[]>;
+
+function isError<T>(response: BloxyResponse<T>): response is BloxyError {
+ return (response as BloxyError).error !== undefined;
+}
+
+export class BloxySource {
+ private readonly _apiKey: string;
+
+ constructor(apiKey: string) {
+ this._apiKey = apiKey;
+ }
+
+ /**
+ * Gets all latest trades between the lastSeenTimestamp (minus some buffer)
+ * and the current time. Note that because the Bloxy API has some hard
+ * limits it might not always be possible to get *all* the trades in the
+ * desired time range.
+ * @param lastSeenTimestamp The latest timestamp for trades that have
+ * already been seen.
+ */
+ public async getDexTradesAsync(lastSeenTimestamp: number): Promise<BloxyTrade[]> {
+ let allTrades: BloxyTrade[] = [];
+
+ // Clamp numberOfDays so that it is always between 1 and MAX_DAYS (inclusive)
+ const numberOfDays = R.clamp(1, MAX_DAYS, getDaysSinceTimestamp(lastSeenTimestamp));
+
+ // Keep getting trades until we hit one of the following conditions:
+ //
+ // 1. Offset hits MAX_OFFSET (we can't go back any further).
+ // 2. There are no more trades in the response.
+ // 3. We see a tx_time equal to or earlier than lastSeenTimestamp (plus
+ // some buffer).
+ //
+ for (let offset = 0; offset <= MAX_OFFSET; offset += TRADES_PER_QUERY - OFFSET_BUFFER) {
+ const trades = await this._getTradesWithOffsetAsync(numberOfDays, offset);
+ if (trades.length === 0) {
+ // There are no more trades left for the days we are querying.
+ // This means we are done.
+ return filterDuplicateTrades(allTrades);
+ }
+ const sortedTrades = R.reverse(R.sortBy(trade => trade.tx_time, trades));
+ allTrades = allTrades.concat(sortedTrades);
+
+ // Check if lastReturnedTimestamp < lastSeenTimestamp
+ const lastReturnedTimestamp = new Date(sortedTrades[0].tx_time).getTime();
+ if (lastReturnedTimestamp < lastSeenTimestamp - LAST_SEEN_TIMESTAMP_BUFFER_MS) {
+ // We are at the point where we have already seen trades for the
+ // timestamp range that is being returned. We're done.
+ return filterDuplicateTrades(allTrades);
+ }
+ }
+ return filterDuplicateTrades(allTrades);
+ }
+
+ private async _getTradesWithOffsetAsync(numberOfDays: number, offset: number): Promise<BloxyTrade[]> {
+ const resp = await axios.get<BloxyTradeResponse>(BLOXY_DEX_TRADES_URL, {
+ params: {
+ key: this._apiKey,
+ days: numberOfDays,
+ limit: TRADES_PER_QUERY,
+ offset,
+ },
+ });
+ if (isError(resp.data)) {
+ throw new Error(`Error in Bloxy API response: ${resp.data.error}`);
+ }
+ return resp.data;
+ }
+}
+
+// Computes the number of days between the given timestamp and the current
+// timestamp (rounded up).
+function getDaysSinceTimestamp(timestamp: number): number {
+ const msSinceTimestamp = Date.now() - timestamp;
+ const daysSinceTimestamp = msSinceTimestamp / millisecondsPerDay;
+ return Math.ceil(daysSinceTimestamp);
+}
+
+const filterDuplicateTrades = R.uniqBy((trade: BloxyTrade) => trade.tx_hash);
diff --git a/packages/pipeline/src/data_sources/contract-wrappers/erc20_events.ts b/packages/pipeline/src/data_sources/contract-wrappers/erc20_events.ts
new file mode 100644
index 000000000..e0098122f
--- /dev/null
+++ b/packages/pipeline/src/data_sources/contract-wrappers/erc20_events.ts
@@ -0,0 +1,45 @@
+import {
+ ContractWrappers,
+ ERC20TokenApprovalEventArgs,
+ ERC20TokenEvents,
+ ERC20TokenWrapper,
+} from '@0x/contract-wrappers';
+import { Web3ProviderEngine } from '@0x/subproviders';
+import { LogWithDecodedArgs } from 'ethereum-types';
+
+import { GetEventsFunc, getEventsWithPaginationAsync } from './utils';
+
+export class ERC20EventsSource {
+ private readonly _erc20Wrapper: ERC20TokenWrapper;
+ private readonly _tokenAddress: string;
+ constructor(provider: Web3ProviderEngine, networkId: number, tokenAddress: string) {
+ const contractWrappers = new ContractWrappers(provider, { networkId });
+ this._erc20Wrapper = contractWrappers.erc20Token;
+ this._tokenAddress = tokenAddress;
+ }
+
+ public async getApprovalEventsAsync(
+ startBlock: number,
+ endBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<ERC20TokenApprovalEventArgs>>> {
+ return getEventsWithPaginationAsync(
+ this._getApprovalEventsForRangeAsync.bind(this) as GetEventsFunc<ERC20TokenApprovalEventArgs>,
+ startBlock,
+ endBlock,
+ );
+ }
+
+ // Gets all approval events of for a specific sub-range. This getter
+ // function will be called during each step of pagination.
+ private async _getApprovalEventsForRangeAsync(
+ fromBlock: number,
+ toBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<ERC20TokenApprovalEventArgs>>> {
+ return this._erc20Wrapper.getLogsAsync<ERC20TokenApprovalEventArgs>(
+ this._tokenAddress,
+ ERC20TokenEvents.Approval,
+ { fromBlock, toBlock },
+ {},
+ );
+ }
+}
diff --git a/packages/pipeline/src/data_sources/contract-wrappers/exchange_events.ts b/packages/pipeline/src/data_sources/contract-wrappers/exchange_events.ts
new file mode 100644
index 000000000..58691e2ab
--- /dev/null
+++ b/packages/pipeline/src/data_sources/contract-wrappers/exchange_events.ts
@@ -0,0 +1,59 @@
+import {
+ ContractWrappers,
+ ExchangeCancelEventArgs,
+ ExchangeCancelUpToEventArgs,
+ ExchangeEventArgs,
+ ExchangeEvents,
+ ExchangeFillEventArgs,
+ ExchangeWrapper,
+} from '@0x/contract-wrappers';
+import { Web3ProviderEngine } from '@0x/subproviders';
+import { LogWithDecodedArgs } from 'ethereum-types';
+
+import { GetEventsFunc, getEventsWithPaginationAsync } from './utils';
+
+export class ExchangeEventsSource {
+ private readonly _exchangeWrapper: ExchangeWrapper;
+ constructor(provider: Web3ProviderEngine, networkId: number) {
+ const contractWrappers = new ContractWrappers(provider, { networkId });
+ this._exchangeWrapper = contractWrappers.exchange;
+ }
+
+ public async getFillEventsAsync(
+ startBlock: number,
+ endBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<ExchangeFillEventArgs>>> {
+ const getFillEventsForRangeAsync = this._makeGetterFuncForEventType<ExchangeFillEventArgs>(ExchangeEvents.Fill);
+ return getEventsWithPaginationAsync(getFillEventsForRangeAsync, startBlock, endBlock);
+ }
+
+ public async getCancelEventsAsync(
+ startBlock: number,
+ endBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<ExchangeCancelEventArgs>>> {
+ const getCancelEventsForRangeAsync = this._makeGetterFuncForEventType<ExchangeCancelEventArgs>(
+ ExchangeEvents.Cancel,
+ );
+ return getEventsWithPaginationAsync(getCancelEventsForRangeAsync, startBlock, endBlock);
+ }
+
+ public async getCancelUpToEventsAsync(
+ startBlock: number,
+ endBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<ExchangeCancelUpToEventArgs>>> {
+ const getCancelUpToEventsForRangeAsync = this._makeGetterFuncForEventType<ExchangeCancelUpToEventArgs>(
+ ExchangeEvents.CancelUpTo,
+ );
+ return getEventsWithPaginationAsync(getCancelUpToEventsForRangeAsync, startBlock, endBlock);
+ }
+
+ // Returns a getter function which gets all events of a specific type for a
+ // specific sub-range. This getter function will be called during each step
+ // of pagination.
+ private _makeGetterFuncForEventType<ArgsType extends ExchangeEventArgs>(
+ eventType: ExchangeEvents,
+ ): GetEventsFunc<ArgsType> {
+ return async (fromBlock: number, toBlock: number) =>
+ this._exchangeWrapper.getLogsAsync<ArgsType>(eventType, { fromBlock, toBlock }, {});
+ }
+}
diff --git a/packages/pipeline/src/data_sources/contract-wrappers/utils.ts b/packages/pipeline/src/data_sources/contract-wrappers/utils.ts
new file mode 100644
index 000000000..67660a37e
--- /dev/null
+++ b/packages/pipeline/src/data_sources/contract-wrappers/utils.ts
@@ -0,0 +1,67 @@
+import { DecodedLogArgs, LogWithDecodedArgs } from 'ethereum-types';
+
+const NUM_BLOCKS_PER_QUERY = 10000; // Number of blocks to query for events at a time.
+const NUM_RETRIES = 3; // Number of retries if a request fails or times out.
+
+export type GetEventsFunc<ArgsType extends DecodedLogArgs> = (
+ fromBlock: number,
+ toBlock: number,
+) => Promise<Array<LogWithDecodedArgs<ArgsType>>>;
+
+/**
+ * Gets all events between the given startBlock and endBlock by querying for
+ * NUM_BLOCKS_PER_QUERY at a time. Accepts a getter function in order to
+ * maximize code re-use and allow for getting different types of events for
+ * different contracts. If the getter function throws with a retryable error,
+ * it will automatically be retried up to NUM_RETRIES times.
+ * @param getEventsAsync A getter function which will be called for each step during pagination.
+ * @param startBlock The start of the entire block range to get events for.
+ * @param endBlock The end of the entire block range to get events for.
+ */
+export async function getEventsWithPaginationAsync<ArgsType extends DecodedLogArgs>(
+ getEventsAsync: GetEventsFunc<ArgsType>,
+ startBlock: number,
+ endBlock: number,
+): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
+ let events: Array<LogWithDecodedArgs<ArgsType>> = [];
+ for (let fromBlock = startBlock; fromBlock <= endBlock; fromBlock += NUM_BLOCKS_PER_QUERY) {
+ const toBlock = Math.min(fromBlock + NUM_BLOCKS_PER_QUERY - 1, endBlock);
+ const eventsInRange = await _getEventsWithRetriesAsync(getEventsAsync, NUM_RETRIES, fromBlock, toBlock);
+ events = events.concat(eventsInRange);
+ }
+ return events;
+}
+
+/**
+ * Calls the getEventsAsync function and retries up to numRetries times if it
+ * throws with an error that is considered retryable.
+ * @param getEventsAsync a function that will be called on each iteration.
+ * @param numRetries the maximum number times to retry getEventsAsync if it fails with a retryable error.
+ * @param fromBlock the start of the sub-range of blocks we are getting events for.
+ * @param toBlock the end of the sub-range of blocks we are getting events for.
+ */
+export async function _getEventsWithRetriesAsync<ArgsType extends DecodedLogArgs>(
+ getEventsAsync: GetEventsFunc<ArgsType>,
+ numRetries: number,
+ fromBlock: number,
+ toBlock: number,
+): Promise<Array<LogWithDecodedArgs<ArgsType>>> {
+ let eventsInRange: Array<LogWithDecodedArgs<ArgsType>> = [];
+ for (let i = 0; i <= numRetries; i++) {
+ try {
+ eventsInRange = await getEventsAsync(fromBlock, toBlock);
+ } catch (err) {
+ if (isErrorRetryable(err) && i < numRetries) {
+ continue;
+ } else {
+ throw err;
+ }
+ }
+ break;
+ }
+ return eventsInRange;
+}
+
+function isErrorRetryable(err: Error): boolean {
+ return err.message.includes('network timeout');
+}
diff --git a/packages/pipeline/src/data_sources/copper/index.ts b/packages/pipeline/src/data_sources/copper/index.ts
new file mode 100644
index 000000000..15df2fd7d
--- /dev/null
+++ b/packages/pipeline/src/data_sources/copper/index.ts
@@ -0,0 +1,126 @@
+import { fetchAsync } from '@0x/utils';
+import Bottleneck from 'bottleneck';
+
+import {
+ CopperActivityTypeCategory,
+ CopperActivityTypeResponse,
+ CopperCustomFieldResponse,
+ CopperSearchResponse,
+} from '../../parsers/copper';
+
+const HTTP_OK_STATUS = 200;
+const COPPER_URI = 'https://api.prosperworks.com/developer_api/v1';
+
+const DEFAULT_PAGINATION_PARAMS = {
+ page_size: 200,
+ sort_by: 'date_modified',
+ sort_direction: 'desc',
+};
+
+export type CopperSearchParams = CopperLeadSearchParams | CopperActivitySearchParams | CopperOpportunitySearchParams;
+export interface CopperLeadSearchParams {
+ page_number?: number;
+}
+
+export interface CopperActivitySearchParams {
+ minimum_activity_date: number;
+ page_number?: number;
+}
+
+export interface CopperOpportunitySearchParams {
+ sort_by: string; // must override the default 'date_modified' for this endpoint
+ page_number?: number;
+}
+export enum CopperEndpoint {
+ Leads = '/leads/search',
+ Opportunities = '/opportunities/search',
+ Activities = '/activities/search',
+}
+const ONE_SECOND = 1000;
+
+function httpErrorCheck(response: Response): void {
+ if (response.status !== HTTP_OK_STATUS) {
+ throw new Error(`HTTP error while scraping Copper: [${JSON.stringify(response)}]`);
+ }
+}
+export class CopperSource {
+ private readonly _accessToken: string;
+ private readonly _userEmail: string;
+ private readonly _defaultHeaders: any;
+ private readonly _limiter: Bottleneck;
+
+ constructor(maxConcurrentRequests: number, accessToken: string, userEmail: string) {
+ this._accessToken = accessToken;
+ this._userEmail = userEmail;
+ this._defaultHeaders = {
+ 'Content-Type': 'application/json',
+ 'X-PW-AccessToken': this._accessToken,
+ 'X-PW-Application': 'developer_api',
+ 'X-PW-UserEmail': this._userEmail,
+ };
+ this._limiter = new Bottleneck({
+ minTime: ONE_SECOND / maxConcurrentRequests,
+ reservoir: 30,
+ reservoirRefreshAmount: 30,
+ reservoirRefreshInterval: maxConcurrentRequests,
+ });
+ }
+
+ public async fetchNumberOfPagesAsync(endpoint: CopperEndpoint, searchParams?: CopperSearchParams): Promise<number> {
+ const resp = await this._limiter.schedule(() =>
+ fetchAsync(COPPER_URI + endpoint, {
+ method: 'POST',
+ body: JSON.stringify({ ...DEFAULT_PAGINATION_PARAMS, ...searchParams }),
+ headers: this._defaultHeaders,
+ }),
+ );
+
+ httpErrorCheck(resp);
+
+ // total number of records that match the request parameters
+ if (resp.headers.has('X-Pw-Total')) {
+ const totalRecords: number = parseInt(resp.headers.get('X-Pw-Total') as string, 10); // tslint:disable-line:custom-no-magic-numbers
+ return Math.ceil(totalRecords / DEFAULT_PAGINATION_PARAMS.page_size);
+ } else {
+ return 1;
+ }
+ }
+ public async fetchSearchResultsAsync<T extends CopperSearchResponse>(
+ endpoint: CopperEndpoint,
+ searchParams?: CopperSearchParams,
+ ): Promise<T[]> {
+ const request = { ...DEFAULT_PAGINATION_PARAMS, ...searchParams };
+ const response = await this._limiter.schedule(() =>
+ fetchAsync(COPPER_URI + endpoint, {
+ method: 'POST',
+ body: JSON.stringify(request),
+ headers: this._defaultHeaders,
+ }),
+ );
+ httpErrorCheck(response);
+ const json: T[] = await response.json();
+ return json;
+ }
+
+ public async fetchActivityTypesAsync(): Promise<Map<CopperActivityTypeCategory, CopperActivityTypeResponse[]>> {
+ const response = await this._limiter.schedule(() =>
+ fetchAsync(`${COPPER_URI}/activity_types`, {
+ method: 'GET',
+ headers: this._defaultHeaders,
+ }),
+ );
+ httpErrorCheck(response);
+ return response.json();
+ }
+
+ public async fetchCustomFieldsAsync(): Promise<CopperCustomFieldResponse[]> {
+ const response = await this._limiter.schedule(() =>
+ fetchAsync(`${COPPER_URI}/custom_field_definitions`, {
+ method: 'GET',
+ headers: this._defaultHeaders,
+ }),
+ );
+ httpErrorCheck(response);
+ return response.json();
+ }
+}
diff --git a/packages/pipeline/src/data_sources/ddex/index.ts b/packages/pipeline/src/data_sources/ddex/index.ts
new file mode 100644
index 000000000..2bbd8c29b
--- /dev/null
+++ b/packages/pipeline/src/data_sources/ddex/index.ts
@@ -0,0 +1,78 @@
+import { fetchAsync, logUtils } from '@0x/utils';
+
+const DDEX_BASE_URL = 'https://api.ddex.io/v2';
+const ACTIVE_MARKETS_URL = `${DDEX_BASE_URL}/markets`;
+const NO_AGGREGATION_LEVEL = 3; // See https://docs.ddex.io/#get-orderbook
+const ORDERBOOK_ENDPOINT = `/orderbook?level=${NO_AGGREGATION_LEVEL}`;
+export const DDEX_SOURCE = 'ddex';
+
+export interface DdexActiveMarketsResponse {
+ status: number;
+ desc: string;
+ data: {
+ markets: DdexMarket[];
+ };
+}
+
+export interface DdexMarket {
+ id: string;
+ quoteToken: string;
+ quoteTokenDecimals: number;
+ quoteTokenAddress: string;
+ baseToken: string;
+ baseTokenDecimals: number;
+ baseTokenAddress: string;
+ minOrderSize: string;
+ maxOrderSize: string;
+ pricePrecision: number;
+ priceDecimals: number;
+ amountDecimals: number;
+}
+
+export interface DdexOrderbookResponse {
+ status: number;
+ desc: string;
+ data: {
+ orderBook: DdexOrderbook;
+ };
+}
+
+export interface DdexOrderbook {
+ marketId: string;
+ bids: DdexOrder[];
+ asks: DdexOrder[];
+}
+
+export interface DdexOrder {
+ price: string;
+ amount: string;
+ orderId: string;
+}
+
+// tslint:disable:prefer-function-over-method
+// ^ Keep consistency with other sources and help logical organization
+export class DdexSource {
+ /**
+ * Call Ddex API to find out which markets they are maintaining orderbooks for.
+ */
+ public async getActiveMarketsAsync(): Promise<DdexMarket[]> {
+ logUtils.log('Getting all active DDEX markets');
+ const resp = await fetchAsync(ACTIVE_MARKETS_URL);
+ const respJson: DdexActiveMarketsResponse = await resp.json();
+ const markets = respJson.data.markets;
+ logUtils.log(`Got ${markets.length} markets.`);
+ return markets;
+ }
+
+ /**
+ * Retrieve orderbook from Ddex API for a given market.
+ * @param marketId String identifying the market we want data for. Eg. 'REP/AUG'
+ */
+ public async getMarketOrderbookAsync(marketId: string): Promise<DdexOrderbook> {
+ logUtils.log(`${marketId}: Retrieving orderbook.`);
+ const marketOrderbookUrl = `${ACTIVE_MARKETS_URL}/${marketId}${ORDERBOOK_ENDPOINT}`;
+ const resp = await fetchAsync(marketOrderbookUrl);
+ const respJson: DdexOrderbookResponse = await resp.json();
+ return respJson.data.orderBook;
+ }
+}
diff --git a/packages/pipeline/src/data_sources/idex/index.ts b/packages/pipeline/src/data_sources/idex/index.ts
new file mode 100644
index 000000000..c1e53c08d
--- /dev/null
+++ b/packages/pipeline/src/data_sources/idex/index.ts
@@ -0,0 +1,82 @@
+import { fetchAsync } from '@0x/utils';
+
+const IDEX_BASE_URL = 'https://api.idex.market';
+const MARKETS_URL = `${IDEX_BASE_URL}/returnTicker`;
+const ORDERBOOK_URL = `${IDEX_BASE_URL}/returnOrderBook`;
+const MAX_ORDER_COUNT = 100; // Maximum based on https://github.com/AuroraDAO/idex-api-docs#returnorderbook
+export const IDEX_SOURCE = 'idex';
+
+export interface IdexMarketsResponse {
+ [marketName: string]: IdexMarket;
+}
+
+export interface IdexMarket {
+ last: string;
+ high: string;
+ low: string;
+ lowestAsk: string;
+ highestBid: string;
+ percentChange: string;
+ baseVolume: string;
+ quoteVolume: string;
+}
+
+export interface IdexOrderbook {
+ asks: IdexOrder[];
+ bids: IdexOrder[];
+}
+
+export interface IdexOrder {
+ price: string;
+ amount: string;
+ total: string;
+ orderHash: string;
+ params: IdexOrderParam;
+}
+
+export interface IdexOrderParam {
+ tokenBuy: string;
+ buySymbol: string;
+ buyPrecision: number;
+ amountBuy: string;
+ tokenSell: string;
+ sellSymbol: string;
+ sellPrecision: number;
+ amountSell: string;
+ expires: number;
+ nonce: number;
+ user: string;
+}
+
+// tslint:disable:prefer-function-over-method
+// ^ Keep consistency with other sources and help logical organization
+export class IdexSource {
+ /**
+ * Call Idex API to find out which markets they are maintaining orderbooks for.
+ */
+ public async getMarketsAsync(): Promise<string[]> {
+ const params = { method: 'POST' };
+ const resp = await fetchAsync(MARKETS_URL, params);
+ const respJson: IdexMarketsResponse = await resp.json();
+ const markets: string[] = Object.keys(respJson);
+ return markets;
+ }
+
+ /**
+ * Retrieve orderbook from Idex API for a given market.
+ * @param marketId String identifying the market we want data for. Eg. 'REP_AUG'
+ */
+ public async getMarketOrderbookAsync(marketId: string): Promise<IdexOrderbook> {
+ const params = {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({
+ market: marketId,
+ count: MAX_ORDER_COUNT,
+ }),
+ };
+ const resp = await fetchAsync(ORDERBOOK_URL, params);
+ const respJson: IdexOrderbook = await resp.json();
+ return respJson;
+ }
+}
diff --git a/packages/pipeline/src/data_sources/oasis/index.ts b/packages/pipeline/src/data_sources/oasis/index.ts
new file mode 100644
index 000000000..3b30e9dfd
--- /dev/null
+++ b/packages/pipeline/src/data_sources/oasis/index.ts
@@ -0,0 +1,103 @@
+import { fetchAsync } from '@0x/utils';
+
+const OASIS_BASE_URL = 'https://data.makerdao.com/v1';
+const OASIS_MARKET_QUERY = `query {
+ oasisMarkets(period: "1 week") {
+ nodes {
+ id
+ base
+ quote
+ buyVol
+ sellVol
+ price
+ high
+ low
+ }
+ }
+}`;
+const OASIS_ORDERBOOK_QUERY = `query ($market: String!) {
+ allOasisOrders(condition: { market: $market }) {
+ totalCount
+ nodes {
+ market
+ offerId
+ price
+ amount
+ act
+ }
+ }
+}`;
+export const OASIS_SOURCE = 'oasis';
+
+export interface OasisMarket {
+ id: string; // market symbol e.g MKRDAI
+ base: string; // base symbol e.g MKR
+ quote: string; // quote symbol e.g DAI
+ buyVol: number; // total buy volume (base)
+ sellVol: number; // total sell volume (base)
+ price: number; // volume weighted price (quote)
+ high: number; // max sell price
+ low: number; // min buy price
+}
+
+export interface OasisMarketResponse {
+ data: {
+ oasisMarkets: {
+ nodes: OasisMarket[];
+ };
+ };
+}
+
+export interface OasisOrder {
+ offerId: number; // Offer Id
+ market: string; // Market symbol (base/quote)
+ price: string; // Offer price (quote)
+ amount: string; // Offer amount (base)
+ act: string; // Action (ask|bid)
+}
+
+export interface OasisOrderbookResponse {
+ data: {
+ allOasisOrders: {
+ totalCount: number;
+ nodes: OasisOrder[];
+ };
+ };
+}
+
+// tslint:disable:prefer-function-over-method
+// ^ Keep consistency with other sources and help logical organization
+export class OasisSource {
+ /**
+ * Call Ddex API to find out which markets they are maintaining orderbooks for.
+ */
+ public async getActiveMarketsAsync(): Promise<OasisMarket[]> {
+ const params = {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ query: OASIS_MARKET_QUERY }),
+ };
+ const resp = await fetchAsync(OASIS_BASE_URL, params);
+ const respJson: OasisMarketResponse = await resp.json();
+ const markets = respJson.data.oasisMarkets.nodes;
+ return markets;
+ }
+
+ /**
+ * Retrieve orderbook from Oasis API for a given market.
+ * @param marketId String identifying the market we want data for. Eg. 'REPAUG'.
+ */
+ public async getMarketOrderbookAsync(marketId: string): Promise<OasisOrder[]> {
+ const input = {
+ market: marketId,
+ };
+ const params = {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ query: OASIS_ORDERBOOK_QUERY, variables: input }),
+ };
+ const resp = await fetchAsync(OASIS_BASE_URL, params);
+ const respJson: OasisOrderbookResponse = await resp.json();
+ return respJson.data.allOasisOrders.nodes;
+ }
+}
diff --git a/packages/pipeline/src/data_sources/ohlcv_external/crypto_compare.ts b/packages/pipeline/src/data_sources/ohlcv_external/crypto_compare.ts
new file mode 100644
index 000000000..85042501b
--- /dev/null
+++ b/packages/pipeline/src/data_sources/ohlcv_external/crypto_compare.ts
@@ -0,0 +1,110 @@
+// tslint:disable:no-duplicate-imports
+import { fetchAsync } from '@0x/utils';
+import Bottleneck from 'bottleneck';
+import { stringify } from 'querystring';
+import * as R from 'ramda';
+
+import { TradingPair } from '../../utils/get_ohlcv_trading_pairs';
+
+export interface CryptoCompareOHLCVResponse {
+ Data: CryptoCompareOHLCVRecord[];
+ Response: string;
+ Message: string;
+ Type: number;
+}
+
+export interface CryptoCompareOHLCVRecord {
+ time: number; // in seconds, not milliseconds
+ close: number;
+ high: number;
+ low: number;
+ open: number;
+ volumefrom: number;
+ volumeto: number;
+}
+
+export interface CryptoCompareOHLCVParams {
+ fsym: string;
+ tsym: string;
+ e?: string;
+ aggregate?: string;
+ aggregatePredictableTimePeriods?: boolean;
+ limit?: number;
+ toTs?: number;
+}
+
+const ONE_HOUR = 60 * 60 * 1000; // tslint:disable-line:custom-no-magic-numbers
+const ONE_SECOND = 1000;
+const ONE_HOUR_AGO = new Date().getTime() - ONE_HOUR;
+const HTTP_OK_STATUS = 200;
+const CRYPTO_COMPARE_VALID_EMPTY_RESPONSE_TYPE = 96;
+const MAX_PAGE_SIZE = 2000;
+
+export class CryptoCompareOHLCVSource {
+ public readonly intervalBetweenRecords = ONE_HOUR;
+ public readonly defaultExchange = 'CCCAGG';
+ public readonly interval = this.intervalBetweenRecords * MAX_PAGE_SIZE; // the hourly API returns data for one interval at a time
+ private readonly _url: string = 'https://min-api.cryptocompare.com/data/histohour?';
+
+ // rate-limit for all API calls through this class instance
+ private readonly _limiter: Bottleneck;
+ constructor(maxReqsPerSecond: number) {
+ this._limiter = new Bottleneck({
+ minTime: ONE_SECOND / maxReqsPerSecond,
+ reservoir: 30,
+ reservoirRefreshAmount: 30,
+ reservoirRefreshInterval: ONE_SECOND,
+ });
+ }
+
+ // gets OHLCV records starting from pair.latest
+ public async getHourlyOHLCVAsync(pair: TradingPair): Promise<CryptoCompareOHLCVRecord[]> {
+ const params = {
+ e: this.defaultExchange,
+ fsym: pair.fromSymbol,
+ tsym: pair.toSymbol,
+ limit: MAX_PAGE_SIZE,
+ toTs: Math.floor((pair.latestSavedTime + this.interval) / ONE_SECOND), // CryptoCompare uses timestamp in seconds. not ms
+ };
+ const url = this._url + stringify(params);
+ const response = await this._limiter.schedule(() => fetchAsync(url));
+ if (response.status !== HTTP_OK_STATUS) {
+ throw new Error(`HTTP error while scraping Crypto Compare: [${response}]`);
+ }
+ const json: CryptoCompareOHLCVResponse = await response.json();
+ if (
+ (json.Response === 'Error' || json.Data.length === 0) &&
+ json.Type !== CRYPTO_COMPARE_VALID_EMPTY_RESPONSE_TYPE
+ ) {
+ throw new Error(JSON.stringify(json));
+ }
+ return json.Data.filter(rec => {
+ return (
+ // Crypto Compare takes ~30 mins to finalise records
+ rec.time * ONE_SECOND < ONE_HOUR_AGO && rec.time * ONE_SECOND > pair.latestSavedTime && hasData(rec)
+ );
+ });
+ }
+ public generateBackfillIntervals(pair: TradingPair): TradingPair[] {
+ const now = new Date().getTime();
+ const f = (p: TradingPair): false | [TradingPair, TradingPair] => {
+ if (p.latestSavedTime > now) {
+ return false;
+ } else {
+ return [p, R.merge(p, { latestSavedTime: p.latestSavedTime + this.interval })];
+ }
+ };
+ return R.unfold(f, pair);
+ }
+}
+
+function hasData(record: CryptoCompareOHLCVRecord): boolean {
+ return (
+ record.close !== 0 ||
+ record.open !== 0 ||
+ record.high !== 0 ||
+ record.low !== 0 ||
+ record.volumefrom !== 0 ||
+ record.volumeto !== 0
+ );
+}
diff --git a/packages/pipeline/src/data_sources/paradex/index.ts b/packages/pipeline/src/data_sources/paradex/index.ts
new file mode 100644
index 000000000..46d448f4b
--- /dev/null
+++ b/packages/pipeline/src/data_sources/paradex/index.ts
@@ -0,0 +1,92 @@
+import { fetchAsync, logUtils } from '@0x/utils';
+
+const PARADEX_BASE_URL = 'https://api.paradex.io/consumer/v0';
+const ACTIVE_MARKETS_URL = `${PARADEX_BASE_URL}/markets`;
+const ORDERBOOK_ENDPOINT = `${PARADEX_BASE_URL}/orderbook`;
+const TOKEN_INFO_ENDPOINT = `${PARADEX_BASE_URL}/tokens`;
+export const PARADEX_SOURCE = 'paradex';
+
+export type ParadexActiveMarketsResponse = ParadexMarket[];
+
+export interface ParadexMarket {
+ id: string;
+ symbol: string;
+ baseToken: string;
+ quoteToken: string;
+ minOrderSize: string;
+ maxOrderSize: string;
+ priceMaxDecimals: number;
+ amountMaxDecimals: number;
+ // These are not native to the Paradex API response. We tag them on later
+ // by calling the token endpoint and joining on symbol.
+ baseTokenAddress?: string;
+ quoteTokenAddress?: string;
+}
+
+export interface ParadexOrderbookResponse {
+ marketId: number;
+ marketSymbol: string;
+ bids: ParadexOrder[];
+ asks: ParadexOrder[];
+}
+
+export interface ParadexOrder {
+ amount: string;
+ price: string;
+}
+
+export type ParadexTokenInfoResponse = ParadexTokenInfo[];
+
+export interface ParadexTokenInfo {
+ name: string;
+ symbol: string;
+ address: string;
+}
+
+export class ParadexSource {
+ private readonly _apiKey: string;
+
+ constructor(apiKey: string) {
+ this._apiKey = apiKey;
+ }
+
+ /**
+ * Call Paradex API to find out which markets they are maintaining orderbooks for.
+ */
+ public async getActiveMarketsAsync(): Promise<ParadexActiveMarketsResponse> {
+ logUtils.log('Getting all active Paradex markets.');
+ const resp = await fetchAsync(ACTIVE_MARKETS_URL, {
+ headers: { 'API-KEY': this._apiKey },
+ });
+ const markets: ParadexActiveMarketsResponse = await resp.json();
+ logUtils.log(`Got ${markets.length} markets.`);
+ return markets;
+ }
+
+ /**
+ * Call Paradex API to find out their token information.
+ */
+ public async getTokenInfoAsync(): Promise<ParadexTokenInfoResponse> {
+ logUtils.log('Getting token information from Paradex.');
+ const resp = await fetchAsync(TOKEN_INFO_ENDPOINT, {
+ headers: { 'API-KEY': this._apiKey },
+ });
+ const tokens: ParadexTokenInfoResponse = await resp.json();
+ logUtils.log(`Got information for ${tokens.length} tokens.`);
+ return tokens;
+ }
+
+ /**
+ * Retrieve orderbook from Paradex API for a given market.
+ * @param marketSymbol String representing the market we want data for.
+ */
+ public async getMarketOrderbookAsync(marketSymbol: string): Promise<ParadexOrderbookResponse> {
+ logUtils.log(`${marketSymbol}: Retrieving orderbook.`);
+ const marketOrderbookUrl = `${ORDERBOOK_ENDPOINT}?market=${marketSymbol}`;
+ const resp = await fetchAsync(marketOrderbookUrl, {
+ headers: { 'API-KEY': this._apiKey },
+ });
+ const orderbookResponse: ParadexOrderbookResponse = await resp.json();
+ return orderbookResponse;
+ }
+}
diff --git a/packages/pipeline/src/data_sources/relayer-registry/index.ts b/packages/pipeline/src/data_sources/relayer-registry/index.ts
new file mode 100644
index 000000000..8133f5eae
--- /dev/null
+++ b/packages/pipeline/src/data_sources/relayer-registry/index.ts
@@ -0,0 +1,33 @@
+import axios from 'axios';
+
+export interface RelayerResponse {
+ name: string;
+ homepage_url: string;
+ app_url: string;
+ header_img: string;
+ logo_img: string;
+ networks: RelayerResponseNetwork[];
+}
+
+export interface RelayerResponseNetwork {
+ networkId: number;
+ sra_http_endpoint?: string;
+ sra_ws_endpoint?: string;
+ static_order_fields?: {
+ fee_recipient_addresses?: string[];
+ taker_addresses?: string[];
+ };
+}
+
+export class RelayerRegistrySource {
+ private readonly _url: string;
+
+ constructor(url: string) {
+ this._url = url;
+ }
+
+ public async getRelayerInfoAsync(): Promise<Map<string, RelayerResponse>> {
+ const resp = await axios.get<Map<string, RelayerResponse>>(this._url);
+ return resp.data;
+ }
+}
diff --git a/packages/pipeline/src/data_sources/trusted_tokens/index.ts b/packages/pipeline/src/data_sources/trusted_tokens/index.ts
new file mode 100644
index 000000000..552739fb9
--- /dev/null
+++ b/packages/pipeline/src/data_sources/trusted_tokens/index.ts
@@ -0,0 +1,29 @@
+import axios from 'axios';
+
+export interface ZeroExTrustedTokenMeta {
+ address: string;
+ name: string;
+ symbol: string;
+ decimals: number;
+}
+
+export interface MetamaskTrustedTokenMeta {
+ address: string;
+ name: string;
+ erc20: boolean;
+ symbol: string;
+ decimals: number;
+}
+
+export class TrustedTokenSource<T> {
+ private readonly _url: string;
+
+ constructor(url: string) {
+ this._url = url;
+ }
+
+ public async getTrustedTokenMetaAsync(): Promise<T> {
+ const resp = await axios.get<T>(this._url);
+ return resp.data;
+ }
+}
diff --git a/packages/pipeline/src/data_sources/web3/index.ts b/packages/pipeline/src/data_sources/web3/index.ts
new file mode 100644
index 000000000..45a9ea161
--- /dev/null
+++ b/packages/pipeline/src/data_sources/web3/index.ts
@@ -0,0 +1,22 @@
+import { Web3ProviderEngine } from '@0x/subproviders';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import { BlockWithoutTransactionData, Transaction } from 'ethereum-types';
+
+export class Web3Source {
+ private readonly _web3Wrapper: Web3Wrapper;
+ constructor(provider: Web3ProviderEngine) {
+ this._web3Wrapper = new Web3Wrapper(provider);
+ }
+
+ public async getBlockInfoAsync(blockNumber: number): Promise<BlockWithoutTransactionData> {
+ const block = await this._web3Wrapper.getBlockIfExistsAsync(blockNumber);
+ if (block == null) {
+ return Promise.reject(new Error(`Could not find block for given block number: ${blockNumber}`));
+ }
+ return block;
+ }
+
+ public async getTransactionInfoAsync(txHash: string): Promise<Transaction> {
+ return this._web3Wrapper.getTransactionByHashAsync(txHash);
+ }
+}
diff --git a/packages/pipeline/src/entities/block.ts b/packages/pipeline/src/entities/block.ts
new file mode 100644
index 000000000..398946622
--- /dev/null
+++ b/packages/pipeline/src/entities/block.ts
@@ -0,0 +1,13 @@
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'blocks', schema: 'raw' })
+export class Block {
+ @PrimaryColumn() public hash!: string;
+ @PrimaryColumn({ transformer: numberToBigIntTransformer })
+ public number!: number;
+
+ @Column({ name: 'timestamp', transformer: numberToBigIntTransformer })
+ public timestamp!: number;
+}
diff --git a/packages/pipeline/src/entities/copper_activity.ts b/packages/pipeline/src/entities/copper_activity.ts
new file mode 100644
index 000000000..cbc034285
--- /dev/null
+++ b/packages/pipeline/src/entities/copper_activity.ts
@@ -0,0 +1,41 @@
+import { Column, Entity, Index, PrimaryColumn } from 'typeorm';
+
+import { numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'copper_activities', schema: 'raw' })
+export class CopperActivity {
+ @PrimaryColumn({ type: 'bigint', transformer: numberToBigIntTransformer })
+ public id!: number;
+
+ @Index()
+ @Column({ name: 'parent_id', type: 'bigint', transformer: numberToBigIntTransformer })
+ public parentId!: number;
+ @Column({ name: 'parent_type', type: 'varchar' })
+ public parentType!: string;
+
+ // join with CopperActivityType
+ @Index()
+ @Column({ name: 'type_id', type: 'bigint', transformer: numberToBigIntTransformer })
+ public typeId!: number;
+ @Column({ name: 'type_category', type: 'varchar' })
+ public typeCategory!: string;
+ @Column({ name: 'type_name', type: 'varchar', nullable: true })
+ public typeName?: string;
+
+ @Column({ name: 'user_id', type: 'bigint', transformer: numberToBigIntTransformer })
+ public userId!: number;
+ @Column({ name: 'old_value_id', type: 'bigint', nullable: true, transformer: numberToBigIntTransformer })
+ public oldValueId?: number;
+ @Column({ name: 'old_value_name', type: 'varchar', nullable: true })
+ public oldValueName?: string;
+ @Column({ name: 'new_value_id', type: 'bigint', nullable: true, transformer: numberToBigIntTransformer })
+ public newValueId?: number;
+ @Column({ name: 'new_value_name', type: 'varchar', nullable: true })
+ public newValueName?: string;
+
+ @Index()
+ @Column({ name: 'date_created', type: 'bigint', transformer: numberToBigIntTransformer })
+ public dateCreated!: number;
+ @PrimaryColumn({ name: 'date_modified', type: 'bigint', transformer: numberToBigIntTransformer })
+ public dateModified!: number;
+}
diff --git a/packages/pipeline/src/entities/copper_activity_type.ts b/packages/pipeline/src/entities/copper_activity_type.ts
new file mode 100644
index 000000000..8fb2dcf70
--- /dev/null
+++ b/packages/pipeline/src/entities/copper_activity_type.ts
@@ -0,0 +1,17 @@
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'copper_activity_types', schema: 'raw' })
+export class CopperActivityType {
+ @PrimaryColumn({ type: 'bigint', transformer: numberToBigIntTransformer })
+ public id!: number;
+ @Column({ name: 'category', type: 'varchar' })
+ public category!: string;
+ @Column({ name: 'name', type: 'varchar' })
+ public name!: string;
+ @Column({ name: 'is_disabled', type: 'boolean', nullable: true })
+ public isDisabled?: boolean;
+ @Column({ name: 'count_as_interaction', type: 'boolean', nullable: true })
+ public countAsInteraction?: boolean;
+}
diff --git a/packages/pipeline/src/entities/copper_custom_field.ts b/packages/pipeline/src/entities/copper_custom_field.ts
new file mode 100644
index 000000000..f23f6ab22
--- /dev/null
+++ b/packages/pipeline/src/entities/copper_custom_field.ts
@@ -0,0 +1,15 @@
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'copper_custom_fields', schema: 'raw' })
+export class CopperCustomField {
+ @PrimaryColumn({ type: 'bigint', transformer: numberToBigIntTransformer })
+ public id!: number;
+ @Column({ name: 'data_type', type: 'varchar' })
+ public dataType!: string;
+ @Column({ name: 'field_type', type: 'varchar', nullable: true })
+ public fieldType?: string;
+ @Column({ name: 'name', type: 'varchar' })
+ public name!: string;
+}
diff --git a/packages/pipeline/src/entities/copper_lead.ts b/packages/pipeline/src/entities/copper_lead.ts
new file mode 100644
index 000000000..c51ccd761
--- /dev/null
+++ b/packages/pipeline/src/entities/copper_lead.ts
@@ -0,0 +1,38 @@
+import { Column, Entity, Index, PrimaryColumn } from 'typeorm';
+
+import { numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'copper_leads', schema: 'raw' })
+export class CopperLead {
+ @PrimaryColumn({ type: 'bigint', transformer: numberToBigIntTransformer })
+ public id!: number;
+
+ @Column({ name: 'name', type: 'varchar', nullable: true })
+ public name?: string;
+ @Column({ name: 'first_name', type: 'varchar', nullable: true })
+ public firstName?: string;
+ @Column({ name: 'last_name', type: 'varchar', nullable: true })
+ public lastName?: string;
+ @Column({ name: 'middle_name', type: 'varchar', nullable: true })
+ public middleName?: string;
+ @Column({ name: 'assignee_id', type: 'bigint', transformer: numberToBigIntTransformer, nullable: true })
+ public assigneeId?: number;
+ @Column({ name: 'company_name', type: 'varchar', nullable: true })
+ public companyName?: string;
+ @Column({ name: 'customer_source_id', type: 'bigint', transformer: numberToBigIntTransformer, nullable: true })
+ public customerSourceId?: number;
+ @Column({ name: 'monetary_value', type: 'integer', nullable: true })
+ public monetaryValue?: number;
+ @Column({ name: 'status', type: 'varchar' })
+ public status!: string;
+ @Column({ name: 'status_id', type: 'bigint', transformer: numberToBigIntTransformer })
+ public statusId!: number;
+ @Column({ name: 'title', type: 'varchar', nullable: true })
+ public title?: string;
+
+ @Index()
+ @Column({ name: 'date_created', type: 'bigint', transformer: numberToBigIntTransformer })
+ public dateCreated!: number;
+ @PrimaryColumn({ name: 'date_modified', type: 'bigint', transformer: numberToBigIntTransformer })
+ public dateModified!: number;
+}
diff --git a/packages/pipeline/src/entities/copper_opportunity.ts b/packages/pipeline/src/entities/copper_opportunity.ts
new file mode 100644
index 000000000..e12bd69ce
--- /dev/null
+++ b/packages/pipeline/src/entities/copper_opportunity.ts
@@ -0,0 +1,45 @@
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'copper_opportunities', schema: 'raw' })
+export class CopperOpportunity {
+ @PrimaryColumn({ name: 'id', type: 'bigint', transformer: numberToBigIntTransformer })
+ public id!: number;
+ @Column({ name: 'name', type: 'varchar' })
+ public name!: string;
+ @Column({ name: 'assignee_id', nullable: true, type: 'bigint', transformer: numberToBigIntTransformer })
+ public assigneeId?: number;
+ @Column({ name: 'close_date', nullable: true, type: 'varchar' })
+ public closeDate?: string;
+ @Column({ name: 'company_id', nullable: true, type: 'bigint', transformer: numberToBigIntTransformer })
+ public companyId?: number;
+ @Column({ name: 'company_name', nullable: true, type: 'varchar' })
+ public companyName?: string;
+ @Column({ name: 'customer_source_id', nullable: true, type: 'bigint', transformer: numberToBigIntTransformer })
+ public customerSourceId?: number;
+ @Column({ name: 'loss_reason_id', nullable: true, type: 'bigint', transformer: numberToBigIntTransformer })
+ public lossReasonId?: number;
+ @Column({ name: 'pipeline_id', type: 'bigint', transformer: numberToBigIntTransformer })
+ public pipelineId!: number;
+ @Column({ name: 'pipeline_stage_id', type: 'bigint', transformer: numberToBigIntTransformer })
+ public pipelineStageId!: number;
+ @Column({ name: 'primary_contact_id', nullable: true, type: 'bigint', transformer: numberToBigIntTransformer })
+ public primaryContactId?: number;
+ @Column({ name: 'priority', nullable: true, type: 'varchar' })
+ public priority?: string;
+ @Column({ name: 'status', type: 'varchar' })
+ public status!: string;
+ @Column({ name: 'interaction_count', type: 'bigint', transformer: numberToBigIntTransformer })
+ public interactionCount!: number;
+ @Column({ name: 'monetary_value', nullable: true, type: 'integer' })
+ public monetaryValue?: number;
+ @Column({ name: 'win_probability', nullable: true, type: 'integer' })
+ public winProbability?: number;
+ @Column({ name: 'date_created', type: 'bigint', transformer: numberToBigIntTransformer })
+ public dateCreated!: number;
+ @PrimaryColumn({ name: 'date_modified', type: 'bigint', transformer: numberToBigIntTransformer })
+ public dateModified!: number;
+ @Column({ name: 'custom_fields', type: 'jsonb' })
+ public customFields!: { [key: number]: number };
+}
diff --git a/packages/pipeline/src/entities/dex_trade.ts b/packages/pipeline/src/entities/dex_trade.ts
new file mode 100644
index 000000000..9d288cb51
--- /dev/null
+++ b/packages/pipeline/src/entities/dex_trade.ts
@@ -0,0 +1,54 @@
+import { BigNumber } from '@0x/utils';
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { bigNumberTransformer, numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'dex_trades', schema: 'raw' })
+export class DexTrade {
+ @PrimaryColumn({ name: 'source_url' })
+ public sourceUrl!: string;
+ @PrimaryColumn({ name: 'tx_hash' })
+ public txHash!: string;
+
+ @Column({ name: 'tx_timestamp', type: 'bigint', transformer: numberToBigIntTransformer })
+ public txTimestamp!: number;
+ @Column({ name: 'tx_date' })
+ public txDate!: string;
+ @Column({ name: 'tx_sender' })
+ public txSender!: string;
+ @Column({ name: 'smart_contract_id', type: 'bigint', transformer: numberToBigIntTransformer })
+ public smartContractId!: number;
+ @Column({ name: 'smart_contract_address' })
+ public smartContractAddress!: string;
+ @Column({ name: 'contract_type' })
+ public contractType!: string;
+ @Column({ type: 'varchar' })
+ public maker!: string;
+ @Column({ type: 'varchar' })
+ public taker!: string;
+ @Column({ name: 'amount_buy', type: 'numeric', transformer: bigNumberTransformer })
+ public amountBuy!: BigNumber;
+ @Column({ name: 'maker_fee_amount', type: 'numeric', transformer: bigNumberTransformer })
+ public makerFeeAmount!: BigNumber;
+ @Column({ name: 'buy_currency_id', type: 'bigint', transformer: numberToBigIntTransformer })
+ public buyCurrencyId!: number;
+ @Column({ name: 'buy_symbol' })
+ public buySymbol!: string;
+ @Column({ name: 'amount_sell', type: 'numeric', transformer: bigNumberTransformer })
+ public amountSell!: BigNumber;
+ @Column({ name: 'taker_fee_amount', type: 'numeric', transformer: bigNumberTransformer })
+ public takerFeeAmount!: BigNumber;
+ @Column({ name: 'sell_currency_id', type: 'bigint', transformer: numberToBigIntTransformer })
+ public sellCurrencyId!: number;
+ @Column({ name: 'sell_symbol' })
+ public sellSymbol!: string;
+ @Column({ name: 'maker_annotation' })
+ public makerAnnotation!: string;
+ @Column({ name: 'taker_annotation' })
+ public takerAnnotation!: string;
+ @Column() public protocol!: string;
+ @Column({ name: 'buy_address', type: 'varchar', nullable: true })
+ public buyAddress!: string | null;
+ @Column({ name: 'sell_address', type: 'varchar', nullable: true })
+ public sellAddress!: string | null;
+}
diff --git a/packages/pipeline/src/entities/erc20_approval_event.ts b/packages/pipeline/src/entities/erc20_approval_event.ts
new file mode 100644
index 000000000..69cdfcb0b
--- /dev/null
+++ b/packages/pipeline/src/entities/erc20_approval_event.ts
@@ -0,0 +1,26 @@
+import { BigNumber } from '@0x/utils';
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { bigNumberTransformer, numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'erc20_approval_events', schema: 'raw' })
+export class ERC20ApprovalEvent {
+ @PrimaryColumn({ name: 'token_address' })
+ public tokenAddress!: string;
+ @PrimaryColumn({ name: 'log_index' })
+ public logIndex!: number;
+ @PrimaryColumn({ name: 'block_number', transformer: numberToBigIntTransformer })
+ public blockNumber!: number;
+
+ @Column({ name: 'raw_data' })
+ public rawData!: string;
+
+ @Column({ name: 'transaction_hash' })
+ public transactionHash!: string;
+ @Column({ name: 'owner_address' })
+ public ownerAddress!: string;
+ @Column({ name: 'spender_address' })
+ public spenderAddress!: string;
+ @Column({ name: 'amount', type: 'numeric', transformer: bigNumberTransformer })
+ public amount!: BigNumber;
+}
diff --git a/packages/pipeline/src/entities/exchange_cancel_event.ts b/packages/pipeline/src/entities/exchange_cancel_event.ts
new file mode 100644
index 000000000..38f99c903
--- /dev/null
+++ b/packages/pipeline/src/entities/exchange_cancel_event.ts
@@ -0,0 +1,51 @@
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { AssetType } from '../types';
+import { numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'exchange_cancel_events', schema: 'raw' })
+export class ExchangeCancelEvent {
+ @PrimaryColumn({ name: 'contract_address' })
+ public contractAddress!: string;
+ @PrimaryColumn({ name: 'log_index' })
+ public logIndex!: number;
+ @PrimaryColumn({ name: 'block_number', transformer: numberToBigIntTransformer })
+ public blockNumber!: number;
+
+ @Column({ name: 'raw_data' })
+ public rawData!: string;
+
+ @Column({ name: 'transaction_hash' })
+ public transactionHash!: string;
+ @Column({ name: 'maker_address' })
+ public makerAddress!: string;
+ @Column({ nullable: true, type: String, name: 'taker_address' })
+ public takerAddress!: string;
+ @Column({ name: 'fee_recipient_address' })
+ public feeRecipientAddress!: string;
+ @Column({ name: 'sender_address' })
+ public senderAddress!: string;
+ @Column({ name: 'order_hash' })
+ public orderHash!: string;
+
+ @Column({ name: 'raw_maker_asset_data' })
+ public rawMakerAssetData!: string;
+ @Column({ name: 'maker_asset_type' })
+ public makerAssetType!: AssetType;
+ @Column({ name: 'maker_asset_proxy_id' })
+ public makerAssetProxyId!: string;
+ @Column({ name: 'maker_token_address' })
+ public makerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'maker_token_id' })
+ public makerTokenId!: string | null;
+ @Column({ name: 'raw_taker_asset_data' })
+ public rawTakerAssetData!: string;
+ @Column({ name: 'taker_asset_type' })
+ public takerAssetType!: AssetType;
+ @Column({ name: 'taker_asset_proxy_id' })
+ public takerAssetProxyId!: string;
+ @Column({ name: 'taker_token_address' })
+ public takerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'taker_token_id' })
+ public takerTokenId!: string | null;
+}
diff --git a/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts
new file mode 100644
index 000000000..27580305e
--- /dev/null
+++ b/packages/pipeline/src/entities/exchange_cancel_up_to_event.ts
@@ -0,0 +1,26 @@
+import { BigNumber } from '@0x/utils';
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { bigNumberTransformer, numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'exchange_cancel_up_to_events', schema: 'raw' })
+export class ExchangeCancelUpToEvent {
+ @PrimaryColumn({ name: 'contract_address' })
+ public contractAddress!: string;
+ @PrimaryColumn({ name: 'log_index' })
+ public logIndex!: number;
+ @PrimaryColumn({ name: 'block_number', transformer: numberToBigIntTransformer })
+ public blockNumber!: number;
+
+ @Column({ name: 'raw_data' })
+ public rawData!: string;
+
+ @Column({ name: 'transaction_hash' })
+ public transactionHash!: string;
+ @Column({ name: 'maker_address' })
+ public makerAddress!: string;
+ @Column({ name: 'sender_address' })
+ public senderAddress!: string;
+ @Column({ name: 'order_epoch', type: 'numeric', transformer: bigNumberTransformer })
+ public orderEpoch!: BigNumber;
+}
diff --git a/packages/pipeline/src/entities/exchange_fill_event.ts b/packages/pipeline/src/entities/exchange_fill_event.ts
new file mode 100644
index 000000000..9b7727615
--- /dev/null
+++ b/packages/pipeline/src/entities/exchange_fill_event.ts
@@ -0,0 +1,60 @@
+import { BigNumber } from '@0x/utils';
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { AssetType } from '../types';
+import { bigNumberTransformer, numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'exchange_fill_events', schema: 'raw' })
+export class ExchangeFillEvent {
+ @PrimaryColumn({ name: 'contract_address' })
+ public contractAddress!: string;
+ @PrimaryColumn({ name: 'log_index' })
+ public logIndex!: number;
+ @PrimaryColumn({ name: 'block_number', transformer: numberToBigIntTransformer })
+ public blockNumber!: number;
+
+ @Column({ name: 'raw_data' })
+ public rawData!: string;
+
+ @Column({ name: 'transaction_hash' })
+ public transactionHash!: string;
+ @Column({ name: 'maker_address' })
+ public makerAddress!: string;
+ @Column({ name: 'taker_address' })
+ public takerAddress!: string;
+ @Column({ name: 'fee_recipient_address' })
+ public feeRecipientAddress!: string;
+ @Column({ name: 'sender_address' })
+ public senderAddress!: string;
+ @Column({ name: 'maker_asset_filled_amount', type: 'numeric', transformer: bigNumberTransformer })
+ public makerAssetFilledAmount!: BigNumber;
+ @Column({ name: 'taker_asset_filled_amount', type: 'numeric', transformer: bigNumberTransformer })
+ public takerAssetFilledAmount!: BigNumber;
+ @Column({ name: 'maker_fee_paid', type: 'numeric', transformer: bigNumberTransformer })
+ public makerFeePaid!: BigNumber;
+ @Column({ name: 'taker_fee_paid', type: 'numeric', transformer: bigNumberTransformer })
+ public takerFeePaid!: BigNumber;
+ @Column({ name: 'order_hash' })
+ public orderHash!: string;
+
+ @Column({ name: 'raw_maker_asset_data' })
+ public rawMakerAssetData!: string;
+ @Column({ name: 'maker_asset_type' })
+ public makerAssetType!: AssetType;
+ @Column({ name: 'maker_asset_proxy_id' })
+ public makerAssetProxyId!: string;
+ @Column({ name: 'maker_token_address' })
+ public makerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'maker_token_id' })
+ public makerTokenId!: string | null;
+ @Column({ name: 'raw_taker_asset_data' })
+ public rawTakerAssetData!: string;
+ @Column({ name: 'taker_asset_type' })
+ public takerAssetType!: AssetType;
+ @Column({ name: 'taker_asset_proxy_id' })
+ public takerAssetProxyId!: string;
+ @Column({ name: 'taker_token_address' })
+ public takerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'taker_token_id' })
+ public takerTokenId!: string | null;
+}
diff --git a/packages/pipeline/src/entities/index.ts b/packages/pipeline/src/entities/index.ts
new file mode 100644
index 000000000..27c153c07
--- /dev/null
+++ b/packages/pipeline/src/entities/index.ts
@@ -0,0 +1,25 @@
+import { ExchangeCancelEvent } from './exchange_cancel_event';
+import { ExchangeCancelUpToEvent } from './exchange_cancel_up_to_event';
+import { ExchangeFillEvent } from './exchange_fill_event';
+
+export { Block } from './block';
+export { DexTrade } from './dex_trade';
+export { ExchangeCancelEvent } from './exchange_cancel_event';
+export { ExchangeCancelUpToEvent } from './exchange_cancel_up_to_event';
+export { ExchangeFillEvent } from './exchange_fill_event';
+export { OHLCVExternal } from './ohlcv_external';
+export { Relayer } from './relayer';
+export { SraOrder } from './sra_order';
+export { SraOrdersObservedTimeStamp, createObservedTimestampForOrder } from './sra_order_observed_timestamp';
+export { TokenMetadata } from './token_metadata';
+export { TokenOrderbookSnapshot } from './token_order';
+export { Transaction } from './transaction';
+export { ERC20ApprovalEvent } from './erc20_approval_event';
+
+export { CopperLead } from './copper_lead';
+export { CopperActivity } from './copper_activity';
+export { CopperOpportunity } from './copper_opportunity';
+export { CopperActivityType } from './copper_activity_type';
+export { CopperCustomField } from './copper_custom_field';
+
+export type ExchangeEvent = ExchangeFillEvent | ExchangeCancelEvent | ExchangeCancelUpToEvent;
diff --git a/packages/pipeline/src/entities/ohlcv_external.ts b/packages/pipeline/src/entities/ohlcv_external.ts
new file mode 100644
index 000000000..4f55dd930
--- /dev/null
+++ b/packages/pipeline/src/entities/ohlcv_external.ts
@@ -0,0 +1,30 @@
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'ohlcv_external', schema: 'raw' })
+export class OHLCVExternal {
+ @PrimaryColumn() public exchange!: string;
+
+ @PrimaryColumn({ name: 'from_symbol', type: 'varchar' })
+ public fromSymbol!: string;
+ @PrimaryColumn({ name: 'to_symbol', type: 'varchar' })
+ public toSymbol!: string;
+ @PrimaryColumn({ name: 'start_time', transformer: numberToBigIntTransformer })
+ public startTime!: number;
+ @PrimaryColumn({ name: 'end_time', transformer: numberToBigIntTransformer })
+ public endTime!: number;
+
+ @Column() public open!: number;
+ @Column() public close!: number;
+ @Column() public low!: number;
+ @Column() public high!: number;
+ @Column({ name: 'volume_from' })
+ public volumeFrom!: number;
+ @Column({ name: 'volume_to' })
+ public volumeTo!: number;
+
+ @PrimaryColumn() public source!: string;
+ @PrimaryColumn({ name: 'observed_timestamp', transformer: numberToBigIntTransformer })
+ public observedTimestamp!: number;
+}
diff --git a/packages/pipeline/src/entities/relayer.ts b/packages/pipeline/src/entities/relayer.ts
new file mode 100644
index 000000000..5af8578b4
--- /dev/null
+++ b/packages/pipeline/src/entities/relayer.ts
@@ -0,0 +1,21 @@
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+@Entity({ name: 'relayers', schema: 'raw' })
+export class Relayer {
+ @PrimaryColumn() public uuid!: string;
+
+ @Column() public name!: string;
+ @Column({ name: 'homepage_url', type: 'varchar' })
+ public homepageUrl!: string;
+ @Column({ name: 'sra_http_endpoint', type: 'varchar', nullable: true })
+ public sraHttpEndpoint!: string | null;
+ @Column({ name: 'sra_ws_endpoint', type: 'varchar', nullable: true })
+ public sraWsEndpoint!: string | null;
+ @Column({ name: 'app_url', type: 'varchar', nullable: true })
+ public appUrl!: string | null;
+
+ @Column({ name: 'fee_recipient_addresses', type: 'varchar', array: true })
+ public feeRecipientAddresses!: string[];
+ @Column({ name: 'taker_addresses', type: 'varchar', array: true })
+ public takerAddresses!: string[];
+}
diff --git a/packages/pipeline/src/entities/sra_order.ts b/packages/pipeline/src/entities/sra_order.ts
new file mode 100644
index 000000000..9c730a0bb
--- /dev/null
+++ b/packages/pipeline/src/entities/sra_order.ts
@@ -0,0 +1,63 @@
+import { BigNumber } from '@0x/utils';
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { AssetType } from '../types';
+import { bigNumberTransformer } from '../utils';
+
+@Entity({ name: 'sra_orders', schema: 'raw' })
+export class SraOrder {
+ @PrimaryColumn({ name: 'exchange_address' })
+ public exchangeAddress!: string;
+ @PrimaryColumn({ name: 'order_hash_hex' })
+ public orderHashHex!: string;
+ @PrimaryColumn({ name: 'source_url' })
+ public sourceUrl!: string;
+
+ @Column({ name: 'maker_address' })
+ public makerAddress!: string;
+ @Column({ name: 'taker_address' })
+ public takerAddress!: string;
+ @Column({ name: 'fee_recipient_address' })
+ public feeRecipientAddress!: string;
+ @Column({ name: 'sender_address' })
+ public senderAddress!: string;
+ @Column({ name: 'maker_asset_amount', type: 'numeric', transformer: bigNumberTransformer })
+ public makerAssetAmount!: BigNumber;
+ @Column({ name: 'taker_asset_amount', type: 'numeric', transformer: bigNumberTransformer })
+ public takerAssetAmount!: BigNumber;
+ @Column({ name: 'maker_fee', type: 'numeric', transformer: bigNumberTransformer })
+ public makerFee!: BigNumber;
+ @Column({ name: 'taker_fee', type: 'numeric', transformer: bigNumberTransformer })
+ public takerFee!: BigNumber;
+ @Column({ name: 'expiration_time_seconds', type: 'numeric', transformer: bigNumberTransformer })
+ public expirationTimeSeconds!: BigNumber;
+ @Column({ name: 'salt', type: 'numeric', transformer: bigNumberTransformer })
+ public salt!: BigNumber;
+ @Column({ name: 'signature' })
+ public signature!: string;
+
+ @Column({ name: 'raw_maker_asset_data' })
+ public rawMakerAssetData!: string;
+ @Column({ name: 'maker_asset_type' })
+ public makerAssetType!: AssetType;
+ @Column({ name: 'maker_asset_proxy_id' })
+ public makerAssetProxyId!: string;
+ @Column({ name: 'maker_token_address' })
+ public makerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'maker_token_id' })
+ public makerTokenId!: string | null;
+ @Column({ name: 'raw_taker_asset_data' })
+ public rawTakerAssetData!: string;
+ @Column({ name: 'taker_asset_type' })
+ public takerAssetType!: AssetType;
+ @Column({ name: 'taker_asset_proxy_id' })
+ public takerAssetProxyId!: string;
+ @Column({ name: 'taker_token_address' })
+ public takerTokenAddress!: string;
+ @Column({ nullable: true, type: String, name: 'taker_token_id' })
+ public takerTokenId!: string | null;
+
+ // TODO(albrow): Make this optional?
+ @Column({ name: 'metadata_json' })
+ public metadataJson!: string;
+}
diff --git a/packages/pipeline/src/entities/sra_order_observed_timestamp.ts b/packages/pipeline/src/entities/sra_order_observed_timestamp.ts
new file mode 100644
index 000000000..cbec1c6d0
--- /dev/null
+++ b/packages/pipeline/src/entities/sra_order_observed_timestamp.ts
@@ -0,0 +1,35 @@
+import { Entity, PrimaryColumn } from 'typeorm';
+
+import { numberToBigIntTransformer } from '../utils';
+
+import { SraOrder } from './sra_order';
+
+@Entity({ name: 'sra_orders_observed_timestamps', schema: 'raw' })
+export class SraOrdersObservedTimeStamp {
+ @PrimaryColumn({ name: 'exchange_address' })
+ public exchangeAddress!: string;
+ @PrimaryColumn({ name: 'order_hash_hex' })
+ public orderHashHex!: string;
+ @PrimaryColumn({ name: 'source_url' })
+ public sourceUrl!: string;
+
+ @PrimaryColumn({ name: 'observed_timestamp', transformer: numberToBigIntTransformer })
+ public observedTimestamp!: number;
+}
+
+/**
+ * Returns a new SraOrdersObservedTimeStamp for the given order based on the
+ * current time.
+ * @param order The order to generate a timestamp for.
+ */
+export function createObservedTimestampForOrder(
+ order: SraOrder,
+ observedTimestamp: number,
+): SraOrdersObservedTimeStamp {
+ const observed = new SraOrdersObservedTimeStamp();
+ observed.exchangeAddress = order.exchangeAddress;
+ observed.orderHashHex = order.orderHashHex;
+ observed.sourceUrl = order.sourceUrl;
+ observed.observedTimestamp = observedTimestamp;
+ return observed;
+}
diff --git a/packages/pipeline/src/entities/token_metadata.ts b/packages/pipeline/src/entities/token_metadata.ts
new file mode 100644
index 000000000..911b53972
--- /dev/null
+++ b/packages/pipeline/src/entities/token_metadata.ts
@@ -0,0 +1,22 @@
+import { BigNumber } from '@0x/utils';
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { bigNumberTransformer } from '../utils/transformers';
+
+@Entity({ name: 'token_metadata', schema: 'raw' })
+export class TokenMetadata {
+ @PrimaryColumn({ type: 'varchar', nullable: false })
+ public address!: string;
+
+ @PrimaryColumn({ type: 'varchar', nullable: false })
+ public authority!: string;
+
+ @Column({ type: 'numeric', transformer: bigNumberTransformer, nullable: true })
+ public decimals!: BigNumber | null;
+
+ @Column({ type: 'varchar', nullable: true })
+ public symbol!: string | null;
+
+ @Column({ type: 'varchar', nullable: true })
+ public name!: string | null;
+}
diff --git a/packages/pipeline/src/entities/token_order.ts b/packages/pipeline/src/entities/token_order.ts
new file mode 100644
index 000000000..2709747cb
--- /dev/null
+++ b/packages/pipeline/src/entities/token_order.ts
@@ -0,0 +1,28 @@
+import { BigNumber } from '@0x/utils';
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { bigNumberTransformer, numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'token_orderbook_snapshots', schema: 'raw' })
+export class TokenOrderbookSnapshot {
+ @PrimaryColumn({ name: 'observed_timestamp', type: 'bigint', transformer: numberToBigIntTransformer })
+ public observedTimestamp!: number;
+ @PrimaryColumn({ name: 'source' })
+ public source!: string;
+ @PrimaryColumn({ name: 'order_type' })
+ public orderType!: string;
+ @PrimaryColumn({ name: 'price', type: 'numeric', transformer: bigNumberTransformer })
+ public price!: BigNumber;
+ @PrimaryColumn({ name: 'base_asset_symbol' })
+ public baseAssetSymbol!: string;
+ @Column({ nullable: true, type: String, name: 'base_asset_address' })
+ public baseAssetAddress!: string | null;
+ @Column({ name: 'base_volume', type: 'numeric', transformer: bigNumberTransformer })
+ public baseVolume!: BigNumber;
+ @PrimaryColumn({ name: 'quote_asset_symbol' })
+ public quoteAssetSymbol!: string;
+ @Column({ nullable: true, type: String, name: 'quote_asset_address' })
+ public quoteAssetAddress!: string | null;
+ @Column({ name: 'quote_volume', type: 'numeric', transformer: bigNumberTransformer })
+ public quoteVolume!: BigNumber;
+}
diff --git a/packages/pipeline/src/entities/transaction.ts b/packages/pipeline/src/entities/transaction.ts
new file mode 100644
index 000000000..742050177
--- /dev/null
+++ b/packages/pipeline/src/entities/transaction.ts
@@ -0,0 +1,19 @@
+import { BigNumber } from '@0x/utils';
+import { Column, Entity, PrimaryColumn } from 'typeorm';
+
+import { bigNumberTransformer, numberToBigIntTransformer } from '../utils';
+
+@Entity({ name: 'transactions', schema: 'raw' })
+export class Transaction {
+ @PrimaryColumn({ name: 'transaction_hash' })
+ public transactionHash!: string;
+ @PrimaryColumn({ name: 'block_hash' })
+ public blockHash!: string;
+ @PrimaryColumn({ name: 'block_number', transformer: numberToBigIntTransformer })
+ public blockNumber!: number;
+
+ @Column({ type: 'numeric', name: 'gas_used', transformer: bigNumberTransformer })
+ public gasUsed!: BigNumber;
+ @Column({ type: 'numeric', name: 'gas_price', transformer: bigNumberTransformer })
+ public gasPrice!: BigNumber;
+}
diff --git a/packages/pipeline/src/ormconfig.ts b/packages/pipeline/src/ormconfig.ts
new file mode 100644
index 000000000..2700714cd
--- /dev/null
+++ b/packages/pipeline/src/ormconfig.ts
@@ -0,0 +1,54 @@
+import { ConnectionOptions } from 'typeorm';
+
+import {
+ Block,
+ CopperActivity,
+ CopperActivityType,
+ CopperCustomField,
+ CopperLead,
+ CopperOpportunity,
+ DexTrade,
+ ERC20ApprovalEvent,
+ ExchangeCancelEvent,
+ ExchangeCancelUpToEvent,
+ ExchangeFillEvent,
+ OHLCVExternal,
+ Relayer,
+ SraOrder,
+ SraOrdersObservedTimeStamp,
+ TokenMetadata,
+ TokenOrderbookSnapshot,
+ Transaction,
+} from './entities';
+
+const entities = [
+ Block,
+ CopperOpportunity,
+ CopperActivity,
+ CopperActivityType,
+ CopperCustomField,
+ CopperLead,
+ DexTrade,
+ ExchangeCancelEvent,
+ ExchangeCancelUpToEvent,
+ ExchangeFillEvent,
+ ERC20ApprovalEvent,
+ OHLCVExternal,
+ Relayer,
+ SraOrder,
+ SraOrdersObservedTimeStamp,
+ TokenMetadata,
+ TokenOrderbookSnapshot,
+ Transaction,
+];
+
+const config: ConnectionOptions = {
+ type: 'postgres',
+ url: process.env.ZEROEX_DATA_PIPELINE_DB_URL,
+ synchronize: false,
+ logging: ['error'],
+ entities,
+ migrations: ['./lib/migrations/**/*.js'],
+};
+
+module.exports = config;
diff --git a/packages/pipeline/src/parsers/bloxy/index.ts b/packages/pipeline/src/parsers/bloxy/index.ts
new file mode 100644
index 000000000..caa55d289
--- /dev/null
+++ b/packages/pipeline/src/parsers/bloxy/index.ts
@@ -0,0 +1,53 @@
+import { BigNumber } from '@0x/utils';
+import * as R from 'ramda';
+
+import { BLOXY_DEX_TRADES_URL, BloxyTrade } from '../../data_sources/bloxy';
+import { DexTrade } from '../../entities';
+
+/**
+ * Parses a raw trades response from the Bloxy Dex API and returns an array of
+ * DexTrade entities.
+ * @param rawTrades A raw order response from an SRA endpoint.
+ */
+export function parseBloxyTrades(rawTrades: BloxyTrade[]): DexTrade[] {
+ return R.map(_parseBloxyTrade, rawTrades);
+}
+
+/**
+ * Converts a single Bloxy trade into a DexTrade entity.
+ * @param rawTrade A single trade from the response from the Bloxy API.
+ */
+export function _parseBloxyTrade(rawTrade: BloxyTrade): DexTrade {
+ const dexTrade = new DexTrade();
+ dexTrade.sourceUrl = BLOXY_DEX_TRADES_URL;
+ dexTrade.txHash = rawTrade.tx_hash;
+ dexTrade.txTimestamp = new Date(rawTrade.tx_time).getTime();
+ dexTrade.txDate = rawTrade.tx_date;
+ dexTrade.txSender = rawTrade.tx_sender;
+ dexTrade.smartContractId = rawTrade.smart_contract_id;
+ dexTrade.smartContractAddress = rawTrade.smart_contract_address;
+ dexTrade.contractType = rawTrade.contract_type;
+ dexTrade.maker = rawTrade.maker;
+ dexTrade.taker = rawTrade.taker;
+ // TODO(albrow): The Bloxy API returns amounts and fees as a `number` type
+ // but some of their values have too many significant digits to be
+ // represented that way. Ideally they will switch to using strings and then
+ // we can update this code.
+ dexTrade.amountBuy = new BigNumber(rawTrade.amountBuy.toString());
+ dexTrade.makerFeeAmount = new BigNumber(rawTrade.makerFee.toString());
+ dexTrade.buyCurrencyId = rawTrade.buyCurrencyId;
+ dexTrade.buySymbol = filterNullCharacters(rawTrade.buySymbol);
+ dexTrade.amountSell = new BigNumber(rawTrade.amountSell.toString());
+ dexTrade.takerFeeAmount = new BigNumber(rawTrade.takerFee.toString());
+ dexTrade.sellCurrencyId = rawTrade.sellCurrencyId;
+ dexTrade.sellSymbol = filterNullCharacters(rawTrade.sellSymbol);
+ dexTrade.makerAnnotation = rawTrade.maker_annotation;
+ dexTrade.takerAnnotation = rawTrade.taker_annotation;
+ dexTrade.protocol = rawTrade.protocol;
+ dexTrade.buyAddress = rawTrade.buyAddress;
+ dexTrade.sellAddress = rawTrade.sellAddress;
+ return dexTrade;
+}
+
+// Works with any form of escaped null character (e.g., '\0' and '\u0000').
+const filterNullCharacters = R.replace(/\0/g, '');
diff --git a/packages/pipeline/src/parsers/copper/index.ts b/packages/pipeline/src/parsers/copper/index.ts
new file mode 100644
index 000000000..6c0c5abd5
--- /dev/null
+++ b/packages/pipeline/src/parsers/copper/index.ts
@@ -0,0 +1,259 @@
+import * as R from 'ramda';
+
+import { CopperActivity, CopperActivityType, CopperCustomField, CopperLead, CopperOpportunity } from '../../entities';
+
+const ONE_SECOND = 1000;
+export type CopperSearchResponse = CopperLeadResponse | CopperActivityResponse | CopperOpportunityResponse;
+export interface CopperLeadResponse {
+ id: number;
+ name?: string;
+ first_name?: string;
+ last_name?: string;
+ middle_name?: string;
+ assignee_id?: number;
+ company_name?: string;
+ customer_source_id?: number;
+ monetary_value?: number;
+ status: string;
+ status_id: number;
+ title?: string;
+ date_created: number; // in seconds
+ date_modified: number; // in seconds
+}
+
+export interface CopperActivityResponse {
+ id: number;
+ parent: CopperActivityParentResponse;
+ type: CopperActivityTypeResponse;
+ user_id: number;
+ activity_date: number;
+ old_value: CopperActivityValueResponse;
+ new_value: CopperActivityValueResponse;
+ date_created: number; // in seconds
+ date_modified: number; // in seconds
+}
+
+export interface CopperActivityValueResponse {
+ id: number;
+ name: string;
+}
+export interface CopperActivityParentResponse {
+ id: number;
+ type: string;
+}
+
+// custom activity types
+export enum CopperActivityTypeCategory {
+ user = 'user',
+ system = 'system',
+}
+export interface CopperActivityTypeResponse {
+ id: number;
+ category: CopperActivityTypeCategory;
+ name: string;
+ is_disabled?: boolean;
+ count_as_interaction?: boolean;
+}
+
+export interface CopperOpportunityResponse {
+ id: number;
+ name: string;
+ assignee_id?: number;
+ close_date?: string;
+ company_id?: number;
+ company_name?: string;
+ customer_source_id?: number;
+ loss_reason_id?: number;
+ pipeline_id: number;
+ pipeline_stage_id: number;
+ primary_contact_id?: number;
+ priority?: string;
+ status: string;
+ tags: string[];
+ interaction_count: number;
+ monetary_value?: number;
+ win_probability?: number;
+ date_created: number; // in seconds
+ date_modified: number; // in seconds
+ custom_fields: CopperNestedCustomFieldResponse[];
+}
+interface CopperNestedCustomFieldResponse {
+ custom_field_definition_id: number;
+ value: number | number[] | null;
+}
+// custom fields
+export enum CopperCustomFieldType {
+ String = 'String',
+ Text = 'Text',
+ Dropdown = 'Dropdown',
+ MultiSelect = 'MultiSelect', // not in API documentation but shows up in results
+ Date = 'Date',
+ Checkbox = 'Checkbox',
+ Float = 'Float',
+ URL = 'URL',
+ Percentage = 'Percentage',
+ Currency = 'Currency',
+ Connect = 'Connect',
+}
+export interface CopperCustomFieldOptionResponse {
+ id: number;
+ name: string;
+}
+export interface CopperCustomFieldResponse {
+ id: number;
+ name: string;
+ data_type: CopperCustomFieldType;
+ options?: CopperCustomFieldOptionResponse[];
+}
+/**
+ * Parse response from Copper API /search/leads/
+ *
+ * @param leads - The array of leads returned from the API
+ * @returns Returns an array of Copper Lead entities
+ */
+export function parseLeads(leads: CopperLeadResponse[]): CopperLead[] {
+ return leads.map(lead => {
+ const entity = new CopperLead();
+ entity.id = lead.id;
+ entity.name = lead.name || undefined;
+ entity.firstName = lead.first_name || undefined;
+ entity.lastName = lead.last_name || undefined;
+ entity.middleName = lead.middle_name || undefined;
+ entity.assigneeId = lead.assignee_id || undefined;
+ entity.companyName = lead.company_name || undefined;
+ entity.customerSourceId = lead.customer_source_id || undefined;
+ entity.monetaryValue = lead.monetary_value || undefined;
+ entity.status = lead.status;
+ entity.statusId = lead.status_id;
+ entity.title = lead.title || undefined;
+ entity.dateCreated = lead.date_created * ONE_SECOND;
+ entity.dateModified = lead.date_modified * ONE_SECOND;
+ return entity;
+ });
+}
+
+/**
+ * Parse response from Copper API /search/activities/
+ *
+ * @param activities - The array of activities returned from the API
+ * @returns Returns an array of Copper Activity entities
+ */
+export function parseActivities(activities: CopperActivityResponse[]): CopperActivity[] {
+ return activities.map(activity => {
+ const entity = new CopperActivity();
+ entity.id = activity.id;
+
+ entity.parentId = activity.parent.id;
+ entity.parentType = activity.parent.type;
+
+ entity.typeId = activity.type.id;
+ entity.typeCategory = activity.type.category.toString();
+ entity.typeName = activity.type.name;
+
+ entity.userId = activity.user_id;
+ entity.dateCreated = activity.date_created * ONE_SECOND;
+ entity.dateModified = activity.date_modified * ONE_SECOND;
+
+ // nested nullable fields
+ entity.oldValueId = R.path(['old_value', 'id'], activity);
+ entity.oldValueName = R.path(['old_value', 'name'], activity);
+ entity.newValueId = R.path(['new_value', 'id'], activity);
+ entity.newValueName = R.path(['new_value', 'name'], activity);
+
+ return entity;
+ });
+}
+
+/**
+ * Parse response from Copper API /search/opportunities/
+ *
+ * @param opportunities - The array of opportunities returned from the API
+ * @returns Returns an array of Copper Opportunity entities
+ */
+export function parseOpportunities(opportunities: CopperOpportunityResponse[]): CopperOpportunity[] {
+ return opportunities.map(opp => {
+ const customFields: { [key: number]: number } = opp.custom_fields
+ .filter(f => f.value !== null)
+ .map(f => ({
+ ...f,
+ value: ([] as number[]).concat(f.value || []), // normalise all values to number[]
+ }))
+ .map(f => f.value.map(val => [f.custom_field_definition_id, val] as [number, number])) // pair each value with the custom_field_definition_id
+ .reduce((acc, pair) => acc.concat(pair)) // flatten
+ .reduce<{ [key: number]: number }>((obj, [key, value]) => {
+ // transform into object literal
+ obj[key] = value;
+ return obj;
+ }, {});
+
+ const entity = new CopperOpportunity();
+ entity.id = opp.id;
+ entity.name = opp.name;
+ entity.assigneeId = opp.assignee_id || undefined;
+ entity.closeDate = opp.close_date || undefined;
+ entity.companyId = opp.company_id || undefined;
+ entity.companyName = opp.company_name || undefined;
+ entity.customerSourceId = opp.customer_source_id || undefined;
+ entity.lossReasonId = opp.loss_reason_id || undefined;
+ entity.pipelineId = opp.pipeline_id;
+ entity.pipelineStageId = opp.pipeline_stage_id;
+ entity.primaryContactId = opp.primary_contact_id || undefined;
+ entity.priority = opp.priority || undefined;
+ entity.status = opp.status;
+ entity.interactionCount = opp.interaction_count;
+ entity.monetaryValue = opp.monetary_value || undefined;
+ entity.winProbability = opp.win_probability === null ? undefined : opp.win_probability;
+ entity.dateCreated = opp.date_created * ONE_SECOND;
+ entity.dateModified = opp.date_modified * ONE_SECOND;
+ entity.customFields = customFields;
+ return entity;
+ });
+}
+
+/**
+ * Parse response from Copper API /activity_types/
+ *
+ * @param activityTypeResponse - Activity Types response from the API, keyed by "user" or "system"
+ * @returns Returns an array of Copper Activity Type entities
+ */
+export function parseActivityTypes(
+ activityTypeResponse: Map<CopperActivityTypeCategory, CopperActivityTypeResponse[]>,
+): CopperActivityType[] {
+ const values: CopperActivityTypeResponse[] = R.flatten(Object.values(activityTypeResponse));
+ return values.map(activityType => ({
+ id: activityType.id,
+ name: activityType.name,
+ category: activityType.category.toString(),
+ isDisabled: activityType.is_disabled,
+ countAsInteraction: activityType.count_as_interaction,
+ }));
+}
+
+/**
+ * Parse response from Copper API /custom_field_definitions/
+ *
+ * @param customFieldResponse - array of custom field definitions returned from the API, consisting of top-level fields and nested fields
+ * @returns Returns an array of Copper Custom Field entities
+ */
+export function parseCustomFields(customFieldResponse: CopperCustomFieldResponse[]): CopperCustomField[] {
+ function parseTopLevelField(field: CopperCustomFieldResponse): CopperCustomField[] {
+ const topLevelField: CopperCustomField = {
+ id: field.id,
+ name: field.name,
+ dataType: field.data_type.toString(),
+ };
+
+ if (field.options !== undefined) {
+ const nestedFields: CopperCustomField[] = field.options.map(option => ({
+ id: option.id,
+ name: option.name,
+ dataType: field.name,
+ fieldType: 'option',
+ }));
+ return nestedFields.concat(topLevelField);
+ } else {
+ return [topLevelField];
+ }
+ }
+ return R.chain(parseTopLevelField, customFieldResponse);
+}
diff --git a/packages/pipeline/src/parsers/ddex_orders/index.ts b/packages/pipeline/src/parsers/ddex_orders/index.ts
new file mode 100644
index 000000000..eeb9c9d5b
--- /dev/null
+++ b/packages/pipeline/src/parsers/ddex_orders/index.ts
@@ -0,0 +1,71 @@
+import { BigNumber } from '@0x/utils';
+
+import { aggregateOrders } from '../utils';
+
+import { DdexMarket, DdexOrderbook } from '../../data_sources/ddex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../entities';
+import { OrderType } from '../../types';
+
+/**
+ * Marque function of this file.
+ * 1) Takes in orders from an orderbook,
+ * other information attached.
+ * @param ddexOrderbook A raw orderbook that we pull from the Ddex API.
+ * @param ddexMarket An object containing market data also directly from the API.
+ * @param observedTimestamp Time at which the orders for the market were pulled.
+ * @param source The exchange where these orders are placed. In this case 'ddex'.
+ */
+export function parseDdexOrders(
+ ddexOrderbook: DdexOrderbook,
+ ddexMarket: DdexMarket,
+ observedTimestamp: number,
+ source: string,
+): TokenOrder[] {
+ const aggregatedBids = aggregateOrders(ddexOrderbook.bids);
+ const aggregatedAsks = aggregateOrders(ddexOrderbook.asks);
+ const parsedBids = aggregatedBids.map(order =>
+ parseDdexOrder(ddexMarket, observedTimestamp, OrderType.Bid, source, order),
+ );
+ const parsedAsks = aggregatedAsks.map(order =>
+ parseDdexOrder(ddexMarket, observedTimestamp, OrderType.Ask, source, order),
+ );
+ return parsedBids.concat(parsedAsks);
+}
+
+/**
+ * Parse a single aggregated Ddex order in order to form a tokenOrder entity
+ * which can be saved into the database.
+ * @param ddexMarket An object containing information about the market where these
+ * trades have been placed.
+ * @param observedTimestamp The time when the API response returned back to us.
+ * @param orderType 'bid' or 'ask' enum.
+ * @param source Exchange where these orders were placed.
+ * @param ddexOrder A <price, amount> tuple which we will convert to volume-basis.
+ */
+export function parseDdexOrder(
+ ddexMarket: DdexMarket,
+ observedTimestamp: number,
+ orderType: OrderType,
+ source: string,
+ ddexOrder: [string, BigNumber],
+): TokenOrder {
+ const tokenOrder = new TokenOrder();
+ const price = new BigNumber(ddexOrder[0]);
+ const amount = ddexOrder[1];
+
+ tokenOrder.source = source;
+ tokenOrder.observedTimestamp = observedTimestamp;
+ tokenOrder.orderType = orderType;
+ tokenOrder.price = price;
+
+ // ddex currently confuses quote and base assets.
+ // We switch them here to maintain our internal consistency.
+ tokenOrder.baseAssetSymbol = ddexMarket.quoteToken;
+ tokenOrder.baseAssetAddress = ddexMarket.quoteTokenAddress;
+ tokenOrder.baseVolume = amount;
+
+ tokenOrder.quoteAssetSymbol = ddexMarket.baseToken;
+ tokenOrder.quoteAssetAddress = ddexMarket.baseTokenAddress;
+ tokenOrder.quoteVolume = price.times(amount);
+ return tokenOrder;
+}
diff --git a/packages/pipeline/src/parsers/events/erc20_events.ts b/packages/pipeline/src/parsers/events/erc20_events.ts
new file mode 100644
index 000000000..caf9984d0
--- /dev/null
+++ b/packages/pipeline/src/parsers/events/erc20_events.ts
@@ -0,0 +1,34 @@
+import { ERC20TokenApprovalEventArgs } from '@0x/contract-wrappers';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import * as R from 'ramda';
+
+import { ERC20ApprovalEvent } from '../../entities';
+
+/**
+ * Parses raw event logs for an ERC20 approval event and returns an array of
+ * ERC20ApprovalEvent entities.
+ * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
+ */
+export const parseERC20ApprovalEvents: (
+ eventLogs: Array<LogWithDecodedArgs<ERC20TokenApprovalEventArgs>>,
+) => ERC20ApprovalEvent[] = R.map(_convertToERC20ApprovalEvent);
+
+/**
+ * Converts a raw event log for an ERC20 approval event into an
+ * ERC20ApprovalEvent entity.
+ * @param eventLog Raw event log (e.g. returned from contract-wrappers).
+ */
+export function _convertToERC20ApprovalEvent(
+ eventLog: LogWithDecodedArgs<ERC20TokenApprovalEventArgs>,
+): ERC20ApprovalEvent {
+ const erc20ApprovalEvent = new ERC20ApprovalEvent();
+ erc20ApprovalEvent.tokenAddress = eventLog.address as string;
+ erc20ApprovalEvent.blockNumber = eventLog.blockNumber as number;
+ erc20ApprovalEvent.logIndex = eventLog.logIndex as number;
+ erc20ApprovalEvent.rawData = eventLog.data as string;
+ erc20ApprovalEvent.transactionHash = eventLog.transactionHash;
+ erc20ApprovalEvent.ownerAddress = eventLog.args._owner;
+ erc20ApprovalEvent.spenderAddress = eventLog.args._spender;
+ erc20ApprovalEvent.amount = eventLog.args._value;
+ return erc20ApprovalEvent;
+}
diff --git a/packages/pipeline/src/parsers/events/exchange_events.ts b/packages/pipeline/src/parsers/events/exchange_events.ts
new file mode 100644
index 000000000..9c4a5f89a
--- /dev/null
+++ b/packages/pipeline/src/parsers/events/exchange_events.ts
@@ -0,0 +1,145 @@
+import { ExchangeCancelEventArgs, ExchangeCancelUpToEventArgs, ExchangeFillEventArgs } from '@0x/contract-wrappers';
+import { assetDataUtils } from '@0x/order-utils';
+import { AssetProxyId, ERC721AssetData } from '@0x/types';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import * as R from 'ramda';
+
+import { ExchangeCancelEvent, ExchangeCancelUpToEvent, ExchangeFillEvent } from '../../entities';
+import { bigNumbertoStringOrNull, convertAssetProxyIdToType } from '../../utils';
+
+/**
+ * Parses raw event logs for a fill event and returns an array of
+ * ExchangeFillEvent entities.
+ * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
+ */
+export const parseExchangeFillEvents: (
+ eventLogs: Array<LogWithDecodedArgs<ExchangeFillEventArgs>>,
+) => ExchangeFillEvent[] = R.map(_convertToExchangeFillEvent);
+
+/**
+ * Parses raw event logs for a cancel event and returns an array of
+ * ExchangeCancelEvent entities.
+ * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
+ */
+export const parseExchangeCancelEvents: (
+ eventLogs: Array<LogWithDecodedArgs<ExchangeCancelEventArgs>>,
+) => ExchangeCancelEvent[] = R.map(_convertToExchangeCancelEvent);
+
+/**
+ * Parses raw event logs for a CancelUpTo event and returns an array of
+ * ExchangeCancelUpToEvent entities.
+ * @param eventLogs Raw event logs (e.g. returned from contract-wrappers).
+ */
+export const parseExchangeCancelUpToEvents: (
+ eventLogs: Array<LogWithDecodedArgs<ExchangeCancelUpToEventArgs>>,
+) => ExchangeCancelUpToEvent[] = R.map(_convertToExchangeCancelUpToEvent);
+
+/**
+ * Converts a raw event log for a fill event into an ExchangeFillEvent entity.
+ * @param eventLog Raw event log (e.g. returned from contract-wrappers).
+ */
+export function _convertToExchangeFillEvent(eventLog: LogWithDecodedArgs<ExchangeFillEventArgs>): ExchangeFillEvent {
+ const makerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.makerAssetData);
+ const takerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.takerAssetData);
+ const exchangeFillEvent = new ExchangeFillEvent();
+ exchangeFillEvent.contractAddress = eventLog.address as string;
+ exchangeFillEvent.blockNumber = eventLog.blockNumber as number;
+ exchangeFillEvent.logIndex = eventLog.logIndex as number;
+ exchangeFillEvent.rawData = eventLog.data as string;
+ exchangeFillEvent.transactionHash = eventLog.transactionHash;
+ exchangeFillEvent.makerAddress = eventLog.args.makerAddress;
+ exchangeFillEvent.takerAddress = eventLog.args.takerAddress;
+ exchangeFillEvent.feeRecipientAddress = eventLog.args.feeRecipientAddress;
+ exchangeFillEvent.senderAddress = eventLog.args.senderAddress;
+ exchangeFillEvent.makerAssetFilledAmount = eventLog.args.makerAssetFilledAmount;
+ exchangeFillEvent.takerAssetFilledAmount = eventLog.args.takerAssetFilledAmount;
+ exchangeFillEvent.makerFeePaid = eventLog.args.makerFeePaid;
+ exchangeFillEvent.takerFeePaid = eventLog.args.takerFeePaid;
+ exchangeFillEvent.orderHash = eventLog.args.orderHash;
+ exchangeFillEvent.rawMakerAssetData = eventLog.args.makerAssetData;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeFillEvent.makerAssetType = convertAssetProxyIdToType(makerAssetData.assetProxyId as AssetProxyId);
+ exchangeFillEvent.makerAssetProxyId = makerAssetData.assetProxyId;
+ // HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
+ exchangeFillEvent.makerTokenAddress = assetDataUtils.isMultiAssetData(makerAssetData)
+ ? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.makerAssetData).nestedAssetData[0].tokenAddress
+ : makerAssetData.tokenAddress;
+ // tslint has a false positive here. Type assertion is required.
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeFillEvent.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
+ exchangeFillEvent.rawTakerAssetData = eventLog.args.takerAssetData;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeFillEvent.takerAssetType = convertAssetProxyIdToType(takerAssetData.assetProxyId as AssetProxyId);
+ exchangeFillEvent.takerAssetProxyId = takerAssetData.assetProxyId;
+ // HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
+ exchangeFillEvent.takerTokenAddress = assetDataUtils.isMultiAssetData(takerAssetData)
+ ? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.takerAssetData).nestedAssetData[0].tokenAddress
+ : takerAssetData.tokenAddress;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeFillEvent.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
+ return exchangeFillEvent;
+}
+
+/**
+ * Converts a raw event log for a cancel event into an ExchangeCancelEvent
+ * entity.
+ * @param eventLog Raw event log (e.g. returned from contract-wrappers).
+ */
+export function _convertToExchangeCancelEvent(
+ eventLog: LogWithDecodedArgs<ExchangeCancelEventArgs>,
+): ExchangeCancelEvent {
+ const makerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.makerAssetData);
+ const takerAssetData = assetDataUtils.decodeAssetDataOrThrow(eventLog.args.takerAssetData);
+ const exchangeCancelEvent = new ExchangeCancelEvent();
+ exchangeCancelEvent.contractAddress = eventLog.address as string;
+ exchangeCancelEvent.blockNumber = eventLog.blockNumber as number;
+ exchangeCancelEvent.logIndex = eventLog.logIndex as number;
+ exchangeCancelEvent.rawData = eventLog.data as string;
+ exchangeCancelEvent.transactionHash = eventLog.transactionHash;
+ exchangeCancelEvent.makerAddress = eventLog.args.makerAddress;
+ exchangeCancelEvent.takerAddress = eventLog.args.takerAddress;
+ exchangeCancelEvent.feeRecipientAddress = eventLog.args.feeRecipientAddress;
+ exchangeCancelEvent.senderAddress = eventLog.args.senderAddress;
+ exchangeCancelEvent.orderHash = eventLog.args.orderHash;
+ exchangeCancelEvent.rawMakerAssetData = eventLog.args.makerAssetData;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeCancelEvent.makerAssetType = convertAssetProxyIdToType(makerAssetData.assetProxyId as AssetProxyId);
+ exchangeCancelEvent.makerAssetProxyId = makerAssetData.assetProxyId;
+ // HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
+ exchangeCancelEvent.makerTokenAddress = assetDataUtils.isMultiAssetData(makerAssetData)
+ ? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.makerAssetData).nestedAssetData[0].tokenAddress
+ : makerAssetData.tokenAddress;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeCancelEvent.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
+ exchangeCancelEvent.rawTakerAssetData = eventLog.args.takerAssetData;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeCancelEvent.takerAssetType = convertAssetProxyIdToType(takerAssetData.assetProxyId as AssetProxyId);
+ exchangeCancelEvent.takerAssetProxyId = takerAssetData.assetProxyId;
+ // HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
+ exchangeCancelEvent.takerTokenAddress = assetDataUtils.isMultiAssetData(takerAssetData)
+ ? assetDataUtils.decodeMultiAssetDataRecursively(eventLog.args.takerAssetData).nestedAssetData[0].tokenAddress
+ : takerAssetData.tokenAddress;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ exchangeCancelEvent.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
+ return exchangeCancelEvent;
+}
+
+/**
+ * Converts a raw event log for a cancelUpTo event into an
+ * ExchangeCancelUpToEvent entity.
+ * @param eventLog Raw event log (e.g. returned from contract-wrappers).
+ */
+export function _convertToExchangeCancelUpToEvent(
+ eventLog: LogWithDecodedArgs<ExchangeCancelUpToEventArgs>,
+): ExchangeCancelUpToEvent {
+ const exchangeCancelUpToEvent = new ExchangeCancelUpToEvent();
+ exchangeCancelUpToEvent.contractAddress = eventLog.address as string;
+ exchangeCancelUpToEvent.blockNumber = eventLog.blockNumber as number;
+ exchangeCancelUpToEvent.logIndex = eventLog.logIndex as number;
+ exchangeCancelUpToEvent.rawData = eventLog.data as string;
+ exchangeCancelUpToEvent.transactionHash = eventLog.transactionHash;
+ exchangeCancelUpToEvent.makerAddress = eventLog.args.makerAddress;
+ exchangeCancelUpToEvent.senderAddress = eventLog.args.senderAddress;
+ exchangeCancelUpToEvent.orderEpoch = eventLog.args.orderEpoch;
+ return exchangeCancelUpToEvent;
+}
diff --git a/packages/pipeline/src/parsers/events/index.ts b/packages/pipeline/src/parsers/events/index.ts
new file mode 100644
index 000000000..3f9915e8b
--- /dev/null
+++ b/packages/pipeline/src/parsers/events/index.ts
@@ -0,0 +1,2 @@
+export { parseExchangeCancelEvents, parseExchangeCancelUpToEvents, parseExchangeFillEvents } from './exchange_events';
+export { parseERC20ApprovalEvents } from './erc20_events';
diff --git a/packages/pipeline/src/parsers/idex_orders/index.ts b/packages/pipeline/src/parsers/idex_orders/index.ts
new file mode 100644
index 000000000..14b871195
--- /dev/null
+++ b/packages/pipeline/src/parsers/idex_orders/index.ts
@@ -0,0 +1,81 @@
+import { BigNumber } from '@0x/utils';
+
+import { aggregateOrders } from '../utils';
+
+import { IdexOrderbook, IdexOrderParam } from '../../data_sources/idex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../entities';
+import { OrderType } from '../../types';
+
+/**
+ * Marque function of this file.
+ * 1) Takes in orders from an orderbook,
+ * 2) Aggregates them by price point,
+ * 3) Parses them into entities which are then saved into the database.
+ * @param idexOrderbook raw orderbook that we pull from the Idex API.
+ * @param observedTimestamp Time at which the orders for the market were pulled.
+ * @param source The exchange where these orders are placed. In this case 'idex'.
+ */
+export function parseIdexOrders(idexOrderbook: IdexOrderbook, observedTimestamp: number, source: string): TokenOrder[] {
+ const aggregatedBids = aggregateOrders(idexOrderbook.bids);
+ // Any of the bid orders' params will work
+ const idexBidOrder = idexOrderbook.bids[0];
+ const parsedBids =
+ aggregatedBids.length > 0
+ ? aggregatedBids.map(order =>
+ parseIdexOrder(idexBidOrder.params, observedTimestamp, OrderType.Bid, source, order),
+ )
+ : [];
+
+ const aggregatedAsks = aggregateOrders(idexOrderbook.asks);
+ // Any of the ask orders' params will work
+ const idexAskOrder = idexOrderbook.asks[0];
+ const parsedAsks =
+ aggregatedAsks.length > 0
+ ? aggregatedAsks.map(order =>
+ parseIdexOrder(idexAskOrder.params, observedTimestamp, OrderType.Ask, source, order),
+ )
+ : [];
+ return parsedBids.concat(parsedAsks);
+}
+
+/**
+ * Parse a single aggregated Idex order in order to form a tokenOrder entity
+ * which can be saved into the database.
+ * @param idexOrderParam An object containing information about the market where these
+ * trades have been placed.
+ * @param observedTimestamp The time when the API response returned back to us.
+ * @param orderType 'bid' or 'ask' enum.
+ * @param source Exchange where these orders were placed.
+ * @param idexOrder A <price, amount> tuple which we will convert to volume-basis.
+ */
+export function parseIdexOrder(
+ idexOrderParam: IdexOrderParam,
+ observedTimestamp: number,
+ orderType: OrderType,
+ source: string,
+ idexOrder: [string, BigNumber],
+): TokenOrder {
+ const tokenOrder = new TokenOrder();
+ const price = new BigNumber(idexOrder[0]);
+ const amount = idexOrder[1];
+
+ tokenOrder.source = source;
+ tokenOrder.observedTimestamp = observedTimestamp;
+ tokenOrder.orderType = orderType;
+ tokenOrder.price = price;
+ tokenOrder.baseVolume = amount;
+ tokenOrder.quoteVolume = price.times(amount);
+
+ if (orderType === OrderType.Bid) {
+ tokenOrder.baseAssetSymbol = idexOrderParam.buySymbol;
+ tokenOrder.baseAssetAddress = idexOrderParam.tokenBuy;
+ tokenOrder.quoteAssetSymbol = idexOrderParam.sellSymbol;
+ tokenOrder.quoteAssetAddress = idexOrderParam.tokenSell;
+ } else {
+ tokenOrder.baseAssetSymbol = idexOrderParam.sellSymbol;
+ tokenOrder.baseAssetAddress = idexOrderParam.tokenSell;
+ tokenOrder.quoteAssetSymbol = idexOrderParam.buySymbol;
+ tokenOrder.quoteAssetAddress = idexOrderParam.tokenBuy;
+ }
+ return tokenOrder;
+}
diff --git a/packages/pipeline/src/parsers/oasis_orders/index.ts b/packages/pipeline/src/parsers/oasis_orders/index.ts
new file mode 100644
index 000000000..b71fb65b9
--- /dev/null
+++ b/packages/pipeline/src/parsers/oasis_orders/index.ts
@@ -0,0 +1,71 @@
+import { BigNumber } from '@0x/utils';
+import * as R from 'ramda';
+
+import { aggregateOrders } from '../utils';
+
+import { OasisMarket, OasisOrder } from '../../data_sources/oasis';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../entities';
+import { OrderType } from '../../types';
+
+/**
+ * Marque function of this file.
+ * 1) Takes in orders from an orderbook,
+ * 2) Aggregates them according to price point,
+ * 3) Builds TokenOrder entity with other information attached.
+ * @param oasisOrderbook A raw orderbook that we pull from the Oasis API.
+ * @param oasisMarket An object containing market data also directly from the API.
+ * @param observedTimestamp Time at which the orders for the market were pulled.
+ * @param source The exchange where these orders are placed. In this case 'oasis'.
+ */
+export function parseOasisOrders(
+ oasisOrderbook: OasisOrder[],
+ oasisMarket: OasisMarket,
+ observedTimestamp: number,
+ source: string,
+): TokenOrder[] {
+ const aggregatedBids = aggregateOrders(R.filter(R.propEq('act', OrderType.Bid), oasisOrderbook));
+ const aggregatedAsks = aggregateOrders(R.filter(R.propEq('act', OrderType.Ask), oasisOrderbook));
+ const parsedBids = aggregatedBids.map(order =>
+ parseOasisOrder(oasisMarket, observedTimestamp, OrderType.Bid, source, order),
+ );
+ const parsedAsks = aggregatedAsks.map(order =>
+ parseOasisOrder(oasisMarket, observedTimestamp, OrderType.Ask, source, order),
+ );
+ return parsedBids.concat(parsedAsks);
+}
+
+/**
+ * Parse a single aggregated Oasis order to form a tokenOrder entity
+ * which can be saved into the database.
+ * @param oasisMarket An object containing information about the market where these
+ * trades have been placed.
+ * @param observedTimestamp The time when the API response returned back to us.
+ * @param orderType 'bid' or 'ask' enum.
+ * @param source Exchange where these orders were placed.
+ * @param oasisOrder A <price, amount> tuple which we will convert to volume-basis.
+ */
+export function parseOasisOrder(
+ oasisMarket: OasisMarket,
+ observedTimestamp: number,
+ orderType: OrderType,
+ source: string,
+ oasisOrder: [string, BigNumber],
+): TokenOrder {
+ const tokenOrder = new TokenOrder();
+ const price = new BigNumber(oasisOrder[0]);
+ const amount = oasisOrder[1];
+
+ tokenOrder.source = source;
+ tokenOrder.observedTimestamp = observedTimestamp;
+ tokenOrder.orderType = orderType;
+ tokenOrder.price = price;
+
+ tokenOrder.baseAssetSymbol = oasisMarket.base;
+ tokenOrder.baseAssetAddress = null; // Oasis doesn't provide address information
+ tokenOrder.baseVolume = amount;
+
+ tokenOrder.quoteAssetSymbol = oasisMarket.quote;
+ tokenOrder.quoteAssetAddress = null; // Oasis doesn't provide address information
+ tokenOrder.quoteVolume = price.times(amount);
+ return tokenOrder;
+}
diff --git a/packages/pipeline/src/parsers/ohlcv_external/crypto_compare.ts b/packages/pipeline/src/parsers/ohlcv_external/crypto_compare.ts
new file mode 100644
index 000000000..3efb90384
--- /dev/null
+++ b/packages/pipeline/src/parsers/ohlcv_external/crypto_compare.ts
@@ -0,0 +1,38 @@
+import { CryptoCompareOHLCVRecord } from '../../data_sources/ohlcv_external/crypto_compare';
+import { OHLCVExternal } from '../../entities';
+
+const ONE_SECOND = 1000; // Crypto Compare uses timestamps in seconds instead of milliseconds
+
+export interface OHLCVMetadata {
+ exchange: string;
+ fromSymbol: string;
+ toSymbol: string;
+ source: string;
+ observedTimestamp: number;
+ interval: number;
+}
+/**
+ * Parses OHLCV records from Crypto Compare into an array of OHLCVExternal entities
+ * @param rawRecords an array of OHLCV records from Crypto Compare (not the full response)
+ */
+export function parseRecords(rawRecords: CryptoCompareOHLCVRecord[], metadata: OHLCVMetadata): OHLCVExternal[] {
+ return rawRecords.map(rec => {
+ const ohlcvRecord = new OHLCVExternal();
+ ohlcvRecord.exchange = metadata.exchange;
+ ohlcvRecord.fromSymbol = metadata.fromSymbol;
+ ohlcvRecord.toSymbol = metadata.toSymbol;
+ ohlcvRecord.startTime = rec.time * ONE_SECOND - metadata.interval;
+ ohlcvRecord.endTime = rec.time * ONE_SECOND;
+
+ ohlcvRecord.open = rec.open;
+ ohlcvRecord.close = rec.close;
+ ohlcvRecord.low = rec.low;
+ ohlcvRecord.high = rec.high;
+ ohlcvRecord.volumeFrom = rec.volumefrom;
+ ohlcvRecord.volumeTo = rec.volumeto;
+
+ ohlcvRecord.source = metadata.source;
+ ohlcvRecord.observedTimestamp = metadata.observedTimestamp;
+ return ohlcvRecord;
+ });
+}
diff --git a/packages/pipeline/src/parsers/paradex_orders/index.ts b/packages/pipeline/src/parsers/paradex_orders/index.ts
new file mode 100644
index 000000000..85990dae4
--- /dev/null
+++ b/packages/pipeline/src/parsers/paradex_orders/index.ts
@@ -0,0 +1,66 @@
+import { BigNumber } from '@0x/utils';
+
+import { ParadexMarket, ParadexOrder, ParadexOrderbookResponse } from '../../data_sources/paradex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../entities';
+import { OrderType } from '../../types';
+
+/**
+ * Marque function of this file.
+ * 1) Takes in orders from an orderbook (orders are already aggregated by price point),
+ * 2) For each aggregated order, forms a TokenOrder entity with market data and
+ * other information attached.
+ * @param paradexOrderbookResponse An orderbook response from the Paradex API.
+ * @param paradexMarket An object containing market data also directly from the API.
+ * @param observedTimestamp Time at which the orders for the market were pulled.
+ * @param source The exchange where these orders are placed. In this case 'paradex'.
+ */
+export function parseParadexOrders(
+ paradexOrderbookResponse: ParadexOrderbookResponse,
+ paradexMarket: ParadexMarket,
+ observedTimestamp: number,
+ source: string,
+): TokenOrder[] {
+ const parsedBids = paradexOrderbookResponse.bids.map(order =>
+ parseParadexOrder(paradexMarket, observedTimestamp, OrderType.Bid, source, order),
+ );
+ const parsedAsks = paradexOrderbookResponse.asks.map(order =>
+ parseParadexOrder(paradexMarket, observedTimestamp, OrderType.Ask, source, order),
+ );
+ return parsedBids.concat(parsedAsks);
+}
+
+/**
+ * Parse a single aggregated Ddex order in order to form a tokenOrder entity
+ * which can be saved into the database.
+ * @param paradexMarket An object containing information about the market where these
+ * orders have been placed.
+ * @param observedTimestamp The time when the API response returned back to us.
+ * @param orderType 'bid' or 'ask' enum.
+ * @param source Exchange where these orders were placed.
+ * @param paradexOrder A ParadexOrder object; basically price, amount tuple.
+ */
+export function parseParadexOrder(
+ paradexMarket: ParadexMarket,
+ observedTimestamp: number,
+ orderType: OrderType,
+ source: string,
+ paradexOrder: ParadexOrder,
+): TokenOrder {
+ const tokenOrder = new TokenOrder();
+ const price = new BigNumber(paradexOrder.price);
+ const amount = new BigNumber(paradexOrder.amount);
+
+ tokenOrder.source = source;
+ tokenOrder.observedTimestamp = observedTimestamp;
+ tokenOrder.orderType = orderType;
+ tokenOrder.price = price;
+
+ tokenOrder.baseAssetSymbol = paradexMarket.baseToken;
+ tokenOrder.baseAssetAddress = paradexMarket.baseTokenAddress as string;
+ tokenOrder.baseVolume = amount;
+
+ tokenOrder.quoteAssetSymbol = paradexMarket.quoteToken;
+ tokenOrder.quoteAssetAddress = paradexMarket.quoteTokenAddress as string;
+ tokenOrder.quoteVolume = price.times(amount);
+ return tokenOrder;
+}
diff --git a/packages/pipeline/src/parsers/relayer_registry/index.ts b/packages/pipeline/src/parsers/relayer_registry/index.ts
new file mode 100644
index 000000000..9723880a4
--- /dev/null
+++ b/packages/pipeline/src/parsers/relayer_registry/index.ts
@@ -0,0 +1,37 @@
+import * as R from 'ramda';
+
+import { RelayerResponse, RelayerResponseNetwork } from '../../data_sources/relayer-registry';
+import { Relayer } from '../../entities';
+
+/**
+ * Parses a raw relayer registry response into an array of Relayer entities.
+ * @param rawResp raw response from the relayer-registry json file.
+ */
+export function parseRelayers(rawResp: Map<string, RelayerResponse>): Relayer[] {
+ const parsedAsObject = R.mapObjIndexed(parseRelayer, rawResp);
+ return R.values(parsedAsObject);
+}
+
+function parseRelayer(relayerResp: RelayerResponse, uuid: string): Relayer {
+ const relayer = new Relayer();
+ relayer.uuid = uuid;
+ relayer.name = relayerResp.name;
+ relayer.homepageUrl = relayerResp.homepage_url;
+ relayer.appUrl = relayerResp.app_url;
+ const mainNetworkRelayerInfo = getMainNetwork(relayerResp);
+ if (mainNetworkRelayerInfo !== undefined) {
+ relayer.sraHttpEndpoint = mainNetworkRelayerInfo.sra_http_endpoint || null;
+ relayer.sraWsEndpoint = mainNetworkRelayerInfo.sra_ws_endpoint || null;
+ relayer.feeRecipientAddresses =
+ R.path(['static_order_fields', 'fee_recipient_addresses'], mainNetworkRelayerInfo) || [];
+ relayer.takerAddresses = R.path(['static_order_fields', 'taker_addresses'], mainNetworkRelayerInfo) || [];
+ } else {
+ relayer.feeRecipientAddresses = [];
+ relayer.takerAddresses = [];
+ }
+ return relayer;
+}
+
+function getMainNetwork(relayerResp: RelayerResponse): RelayerResponseNetwork | undefined {
+ return R.find(network => network.networkId === 1, relayerResp.networks);
+}
diff --git a/packages/pipeline/src/parsers/sra_orders/index.ts b/packages/pipeline/src/parsers/sra_orders/index.ts
new file mode 100644
index 000000000..13fe632a4
--- /dev/null
+++ b/packages/pipeline/src/parsers/sra_orders/index.ts
@@ -0,0 +1,68 @@
+import { APIOrder, OrdersResponse } from '@0x/connect';
+import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
+import { AssetProxyId, ERC721AssetData } from '@0x/types';
+import * as R from 'ramda';
+
+import { SraOrder } from '../../entities';
+import { bigNumbertoStringOrNull, convertAssetProxyIdToType } from '../../utils';
+
+/**
+ * Parses a raw order response from an SRA endpoint and returns an array of
+ * SraOrder entities.
+ * @param rawOrdersResponse A raw order response from an SRA endpoint.
+ */
+export function parseSraOrders(rawOrdersResponse: OrdersResponse): SraOrder[] {
+ return R.map(_convertToEntity, rawOrdersResponse.records);
+}
+
+/**
+ * Converts a single APIOrder into an SraOrder entity.
+ * @param apiOrder A single order from the response from an SRA endpoint.
+ */
+export function _convertToEntity(apiOrder: APIOrder): SraOrder {
+ // TODO(albrow): refactor out common asset data decoding code.
+ const makerAssetData = assetDataUtils.decodeAssetDataOrThrow(apiOrder.order.makerAssetData);
+ const takerAssetData = assetDataUtils.decodeAssetDataOrThrow(apiOrder.order.takerAssetData);
+
+ const sraOrder = new SraOrder();
+ sraOrder.exchangeAddress = apiOrder.order.exchangeAddress;
+ sraOrder.orderHashHex = orderHashUtils.getOrderHashHex(apiOrder.order);
+
+ sraOrder.makerAddress = apiOrder.order.makerAddress;
+ sraOrder.takerAddress = apiOrder.order.takerAddress;
+ sraOrder.feeRecipientAddress = apiOrder.order.feeRecipientAddress;
+ sraOrder.senderAddress = apiOrder.order.senderAddress;
+ sraOrder.makerAssetAmount = apiOrder.order.makerAssetAmount;
+ sraOrder.takerAssetAmount = apiOrder.order.takerAssetAmount;
+ sraOrder.makerFee = apiOrder.order.makerFee;
+ sraOrder.takerFee = apiOrder.order.takerFee;
+ sraOrder.expirationTimeSeconds = apiOrder.order.expirationTimeSeconds;
+ sraOrder.salt = apiOrder.order.salt;
+ sraOrder.signature = apiOrder.order.signature;
+
+ sraOrder.rawMakerAssetData = apiOrder.order.makerAssetData;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ sraOrder.makerAssetType = convertAssetProxyIdToType(makerAssetData.assetProxyId as AssetProxyId);
+ sraOrder.makerAssetProxyId = makerAssetData.assetProxyId;
+ // HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
+ sraOrder.makerTokenAddress = assetDataUtils.isMultiAssetData(makerAssetData)
+ ? assetDataUtils.decodeMultiAssetDataRecursively(apiOrder.order.makerAssetData).nestedAssetData[0].tokenAddress
+ : makerAssetData.tokenAddress;
+ // tslint has a false positive here. Type assertion is required.
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ sraOrder.makerTokenId = bigNumbertoStringOrNull((makerAssetData as ERC721AssetData).tokenId);
+ sraOrder.rawTakerAssetData = apiOrder.order.takerAssetData;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ sraOrder.takerAssetType = convertAssetProxyIdToType(takerAssetData.assetProxyId as AssetProxyId);
+ sraOrder.takerAssetProxyId = takerAssetData.assetProxyId;
+ // HACK(abandeali1): this event schema currently does not support multiple maker/taker assets, so we store the first token address from the MultiAssetProxy assetData
+ sraOrder.takerTokenAddress = assetDataUtils.isMultiAssetData(takerAssetData)
+ ? assetDataUtils.decodeMultiAssetDataRecursively(apiOrder.order.takerAssetData).nestedAssetData[0].tokenAddress
+ : takerAssetData.tokenAddress;
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ sraOrder.takerTokenId = bigNumbertoStringOrNull((takerAssetData as ERC721AssetData).tokenId);
+
+ sraOrder.metadataJson = JSON.stringify(apiOrder.metaData);
+
+ return sraOrder;
+}
diff --git a/packages/pipeline/src/parsers/token_metadata/index.ts b/packages/pipeline/src/parsers/token_metadata/index.ts
new file mode 100644
index 000000000..65e0aaa6e
--- /dev/null
+++ b/packages/pipeline/src/parsers/token_metadata/index.ts
@@ -0,0 +1,46 @@
+import * as R from 'ramda';
+
+import { MetamaskTrustedTokenMeta, ZeroExTrustedTokenMeta } from '../../data_sources/trusted_tokens';
+import { TokenMetadata } from '../../entities';
+import { toBigNumberOrNull } from '../../utils';
+
+/**
+ * Parses Metamask's trusted tokens list.
+ * @param rawResp raw response from the metamask json file.
+ */
+export function parseMetamaskTrustedTokens(rawResp: Map<string, MetamaskTrustedTokenMeta>): TokenMetadata[] {
+ const parsedAsObject = R.mapObjIndexed(parseMetamaskTrustedToken, rawResp);
+ return R.values(parsedAsObject);
+}
+
+/**
+ * Parses 0x's trusted tokens list.
+ * @param rawResp raw response from the 0x trusted tokens file.
+ */
+export function parseZeroExTrustedTokens(rawResp: ZeroExTrustedTokenMeta[]): TokenMetadata[] {
+ return R.map(parseZeroExTrustedToken, rawResp);
+}
+
+function parseMetamaskTrustedToken(resp: MetamaskTrustedTokenMeta, address: string): TokenMetadata {
+ const trustedToken = new TokenMetadata();
+
+ trustedToken.address = address;
+ trustedToken.decimals = toBigNumberOrNull(resp.decimals);
+ trustedToken.symbol = resp.symbol;
+ trustedToken.name = resp.name;
+ trustedToken.authority = 'metamask';
+
+ return trustedToken;
+}
+
+function parseZeroExTrustedToken(resp: ZeroExTrustedTokenMeta): TokenMetadata {
+ const trustedToken = new TokenMetadata();
+
+ trustedToken.address = resp.address;
+ trustedToken.decimals = toBigNumberOrNull(resp.decimals);
+ trustedToken.symbol = resp.symbol;
+ trustedToken.name = resp.name;
+ trustedToken.authority = '0x';
+
+ return trustedToken;
+}
diff --git a/packages/pipeline/src/parsers/utils.ts b/packages/pipeline/src/parsers/utils.ts
new file mode 100644
index 000000000..860729e9f
--- /dev/null
+++ b/packages/pipeline/src/parsers/utils.ts
@@ -0,0 +1,28 @@
+import { BigNumber } from '@0x/utils';
+
+export interface GenericRawOrder {
+ price: string;
+ amount: string;
+}
+
+/**
+ * Aggregates individual orders by price point. Filters zero amount orders.
+ * @param rawOrders An array of objects that have price and amount information.
+ */
+export function aggregateOrders(rawOrders: GenericRawOrder[]): Array<[string, BigNumber]> {
+ const aggregatedOrders = new Map<string, BigNumber>();
+ rawOrders.forEach(order => {
+ const amount = new BigNumber(order.amount);
+ if (amount.isZero()) {
+ return;
+ }
+ // Use string instead of BigNum to aggregate by value instead of variable.
+ // Convert to BigNumber first to consolidate different string
+ // representations of the same number. Eg. '0.0' and '0.00'.
+ const price = new BigNumber(order.price).toString();
+
+ const existingAmount = aggregatedOrders.get(price) || new BigNumber(0);
+ aggregatedOrders.set(price, amount.plus(existingAmount));
+ });
+ return Array.from(aggregatedOrders.entries());
+}
diff --git a/packages/pipeline/src/parsers/web3/index.ts b/packages/pipeline/src/parsers/web3/index.ts
new file mode 100644
index 000000000..f986efc59
--- /dev/null
+++ b/packages/pipeline/src/parsers/web3/index.ts
@@ -0,0 +1,49 @@
+import { BigNumber } from '@0x/utils';
+import { BlockWithoutTransactionData, Transaction as EthTransaction } from 'ethereum-types';
+
+import { Block, Transaction } from '../../entities';
+
+const MILLISECONDS_PER_SECOND = 1000;
+
+/**
+ * Parses a raw block and returns a Block entity.
+ * @param rawBlock a raw block (e.g. returned from web3-wrapper).
+ */
+export function parseBlock(rawBlock: BlockWithoutTransactionData): Block {
+ if (rawBlock.hash == null) {
+ throw new Error('Tried to parse raw block but hash was null');
+ }
+ if (rawBlock.number == null) {
+ throw new Error('Tried to parse raw block but number was null');
+ }
+
+ const block = new Block();
+ block.hash = rawBlock.hash;
+ block.number = rawBlock.number;
+ // Block timestamps are in seconds, but we use milliseconds everywhere else.
+ block.timestamp = rawBlock.timestamp * MILLISECONDS_PER_SECOND;
+ return block;
+}
+
+/**
+ * Parses a raw transaction and returns a Transaction entity.
+ * @param rawBlock a raw transaction (e.g. returned from web3-wrapper).
+ */
+export function parseTransaction(rawTransaction: EthTransaction): Transaction {
+ if (rawTransaction.blockHash == null) {
+ throw new Error('Tried to parse raw transaction but blockHash was null');
+ }
+ if (rawTransaction.blockNumber == null) {
+ throw new Error('Tried to parse raw transaction but blockNumber was null');
+ }
+
+ const tx = new Transaction();
+ tx.transactionHash = rawTransaction.hash;
+ tx.blockHash = rawTransaction.blockHash;
+ tx.blockNumber = rawTransaction.blockNumber;
+
+ tx.gasUsed = new BigNumber(rawTransaction.gas);
+ tx.gasPrice = rawTransaction.gasPrice;
+
+ return tx;
+}
diff --git a/packages/pipeline/src/scripts/pull_competing_dex_trades.ts b/packages/pipeline/src/scripts/pull_competing_dex_trades.ts
new file mode 100644
index 000000000..1478d5615
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_competing_dex_trades.ts
@@ -0,0 +1,51 @@
+// tslint:disable:no-console
+import 'reflect-metadata';
+import { Connection, ConnectionOptions, createConnection, Repository } from 'typeorm';
+
+import { BloxySource } from '../data_sources/bloxy';
+import { DexTrade } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseBloxyTrades } from '../parsers/bloxy';
+import { handleError } from '../utils';
+
+// Number of trades to save at once.
+const BATCH_SAVE_SIZE = 1000;
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ await getAndSaveTradesAsync();
+ process.exit(0);
+})().catch(handleError);
+
+async function getAndSaveTradesAsync(): Promise<void> {
+ const apiKey = process.env.BLOXY_API_KEY;
+ if (apiKey === undefined) {
+ throw new Error('Missing required env var: BLOXY_API_KEY');
+ }
+ const bloxySource = new BloxySource(apiKey);
+ const tradesRepository = connection.getRepository(DexTrade);
+ const lastSeenTimestamp = await getLastSeenTimestampAsync(tradesRepository);
+ console.log(`Last seen timestamp: ${lastSeenTimestamp === 0 ? 'none' : lastSeenTimestamp}`);
+ console.log('Getting latest dex trades...');
+ const rawTrades = await bloxySource.getDexTradesAsync(lastSeenTimestamp);
+ console.log(`Parsing ${rawTrades.length} trades...`);
+ const trades = parseBloxyTrades(rawTrades);
+ console.log(`Saving ${trades.length} trades...`);
+ await tradesRepository.save(trades, { chunk: Math.ceil(trades.length / BATCH_SAVE_SIZE) });
+ console.log('Done saving trades.');
+}
+
+async function getLastSeenTimestampAsync(tradesRepository: Repository<DexTrade>): Promise<number> {
+ if ((await tradesRepository.count()) === 0) {
+ return 0;
+ }
+ const response = (await connection.query(
+ 'SELECT tx_timestamp FROM raw.dex_trades ORDER BY tx_timestamp DESC LIMIT 1',
+ )) as Array<{ tx_timestamp: number }>;
+ if (response.length === 0) {
+ return 0;
+ }
+ return response[0].tx_timestamp;
+}
diff --git a/packages/pipeline/src/scripts/pull_copper.ts b/packages/pipeline/src/scripts/pull_copper.ts
new file mode 100644
index 000000000..69814f209
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_copper.ts
@@ -0,0 +1,129 @@
+// tslint:disable:no-console
+import * as R from 'ramda';
+import { Connection, ConnectionOptions, createConnection, Repository } from 'typeorm';
+
+import { CopperEndpoint, CopperSearchParams, CopperSource } from '../data_sources/copper';
+import { CopperActivity, CopperActivityType, CopperCustomField, CopperLead, CopperOpportunity } from '../entities';
+import * as ormConfig from '../ormconfig';
+import {
+ CopperSearchResponse,
+ parseActivities,
+ parseActivityTypes,
+ parseCustomFields,
+ parseLeads,
+ parseOpportunities,
+} from '../parsers/copper';
+import { handleError } from '../utils';
+const ONE_SECOND = 1000;
+const COPPER_RATE_LIMIT = 10;
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+
+ const accessToken = process.env.COPPER_ACCESS_TOKEN;
+ const userEmail = process.env.COPPER_USER_EMAIL;
+ if (accessToken === undefined || userEmail === undefined) {
+ throw new Error('Missing required env var: COPPER_ACCESS_TOKEN and/or COPPER_USER_EMAIL');
+ }
+ const source = new CopperSource(COPPER_RATE_LIMIT, accessToken, userEmail);
+
+ const fetchPromises = [
+ fetchAndSaveLeadsAsync(source),
+ fetchAndSaveOpportunitiesAsync(source),
+ fetchAndSaveActivitiesAsync(source),
+ fetchAndSaveCustomFieldsAsync(source),
+ fetchAndSaveActivityTypesAsync(source),
+ ];
+ fetchPromises.forEach(async fn => {
+ await fn;
+ });
+})().catch(handleError);
+
+async function fetchAndSaveLeadsAsync(source: CopperSource): Promise<void> {
+ const repository = connection.getRepository(CopperLead);
+ const startTime = await getMaxAsync(connection, 'date_modified', 'raw.copper_leads');
+ console.log(`Fetching Copper leads starting from ${startTime}...`);
+ await fetchAndSaveAsync(CopperEndpoint.Leads, source, startTime, {}, parseLeads, repository);
+}
+
+async function fetchAndSaveOpportunitiesAsync(source: CopperSource): Promise<void> {
+ const repository = connection.getRepository(CopperOpportunity);
+ const startTime = await getMaxAsync(connection, 'date_modified', 'raw.copper_opportunities');
+ console.log(`Fetching Copper opportunities starting from ${startTime}...`);
+ await fetchAndSaveAsync(
+ CopperEndpoint.Opportunities,
+ source,
+ startTime,
+ { sort_by: 'name' },
+ parseOpportunities,
+ repository,
+ );
+}
+
+async function fetchAndSaveActivitiesAsync(source: CopperSource): Promise<void> {
+ const repository = connection.getRepository(CopperActivity);
+ const startTime = await getMaxAsync(connection, 'date_modified', 'raw.copper_activities');
+ const searchParams = {
+ minimum_activity_date: Math.floor(startTime / ONE_SECOND),
+ };
+ console.log(`Fetching Copper activities starting from ${startTime}...`);
+ await fetchAndSaveAsync(CopperEndpoint.Activities, source, startTime, searchParams, parseActivities, repository);
+}
+
+async function getMaxAsync(conn: Connection, sortColumn: string, tableName: string): Promise<number> {
+ const queryResult = await conn.query(`SELECT MAX(${sortColumn}) as _max from ${tableName};`);
+ if (R.isEmpty(queryResult)) {
+ return 0;
+ } else {
+ return queryResult[0]._max;
+ }
+}
+
+// (Xianny): Copper API doesn't allow queries to filter by date. To ensure that we are filling in ascending chronological
+// order and not missing any records, we are scraping all available pages. If Copper data gets larger,
+// it would make sense to search for and start filling from the first page that contains a new record.
+// This search would increase our network calls and is not efficient to implement with our current small volume
+// of Copper records.
+async function fetchAndSaveAsync<T extends CopperSearchResponse, E>(
+ endpoint: CopperEndpoint,
+ source: CopperSource,
+ startTime: number,
+ searchParams: CopperSearchParams,
+ parseFn: (recs: T[]) => E[],
+ repository: Repository<E>,
+): Promise<void> {
+ let saved = 0;
+ const numPages = await source.fetchNumberOfPagesAsync(endpoint);
+ try {
+ for (let i = numPages; i > 0; i--) {
+ console.log(`Fetching page ${i}/${numPages} of ${endpoint}...`);
+ const raw = await source.fetchSearchResultsAsync<T>(endpoint, {
+ ...searchParams,
+ page_number: i,
+ });
+ const newRecords = raw.filter(rec => rec.date_modified * ONE_SECOND > startTime);
+ const parsed = parseFn(newRecords);
+ await repository.save<any>(parsed);
+ saved += newRecords.length;
+ }
+ } catch (err) {
+ console.log(`Error fetching ${endpoint}, stopping: ${err.stack}`);
+ } finally {
+ console.log(`Saved ${saved} items from ${endpoint}, done.`);
+ }
+}
+
+async function fetchAndSaveActivityTypesAsync(source: CopperSource): Promise<void> {
+ console.log(`Fetching Copper activity types...`);
+ const activityTypes = await source.fetchActivityTypesAsync();
+ const repository = connection.getRepository(CopperActivityType);
+ await repository.save(parseActivityTypes(activityTypes));
+}
+
+async function fetchAndSaveCustomFieldsAsync(source: CopperSource): Promise<void> {
+ console.log(`Fetching Copper custom fields...`);
+ const customFields = await source.fetchCustomFieldsAsync();
+ const repository = connection.getRepository(CopperCustomField);
+ await repository.save(parseCustomFields(customFields));
+}
diff --git a/packages/pipeline/src/scripts/pull_ddex_orderbook_snapshots.ts b/packages/pipeline/src/scripts/pull_ddex_orderbook_snapshots.ts
new file mode 100644
index 000000000..4e00f258f
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_ddex_orderbook_snapshots.ts
@@ -0,0 +1,55 @@
+import { logUtils } from '@0x/utils';
+import * as R from 'ramda';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import { DDEX_SOURCE, DdexMarket, DdexSource } from '../data_sources/ddex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseDdexOrders } from '../parsers/ddex_orders';
+import { handleError } from '../utils';
+
+// Number of orders to save at once.
+const BATCH_SAVE_SIZE = 1000;
+
+// Number of markets to retrieve orderbooks for at once.
+const MARKET_ORDERBOOK_REQUEST_BATCH_SIZE = 50;
+
+// Delay between market orderbook requests.
+const MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY = 5000;
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const ddexSource = new DdexSource();
+ const markets = await ddexSource.getActiveMarketsAsync();
+ for (const marketsChunk of R.splitEvery(MARKET_ORDERBOOK_REQUEST_BATCH_SIZE, markets)) {
+ await Promise.all(
+ marketsChunk.map(async (market: DdexMarket) => getAndSaveMarketOrderbookAsync(ddexSource, market)),
+ );
+ await new Promise<void>(resolve => setTimeout(resolve, MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY));
+ }
+ process.exit(0);
+})().catch(handleError);
+
+/**
+ * Retrieve orderbook from Ddex API for a given market. Parse orders and insert
+ * them into our database.
+ * @param ddexSource Data source which can query Ddex API.
+ * @param market Object from Ddex API containing market data.
+ */
+async function getAndSaveMarketOrderbookAsync(ddexSource: DdexSource, market: DdexMarket): Promise<void> {
+ const orderBook = await ddexSource.getMarketOrderbookAsync(market.id);
+ const observedTimestamp = Date.now();
+
+ logUtils.log(`${market.id}: Parsing orders.`);
+ const orders = parseDdexOrders(orderBook, market, observedTimestamp, DDEX_SOURCE);
+
+ if (orders.length > 0) {
+ logUtils.log(`${market.id}: Saving ${orders.length} orders.`);
+ const TokenOrderRepository = connection.getRepository(TokenOrder);
+ await TokenOrderRepository.save(orders, { chunk: Math.ceil(orders.length / BATCH_SAVE_SIZE) });
+ } else {
+ logUtils.log(`${market.id}: 0 orders to save.`);
+ }
+}
diff --git a/packages/pipeline/src/scripts/pull_erc20_events.ts b/packages/pipeline/src/scripts/pull_erc20_events.ts
new file mode 100644
index 000000000..bd520c610
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_erc20_events.ts
@@ -0,0 +1,96 @@
+import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
+import { web3Factory } from '@0x/dev-utils';
+import { Web3ProviderEngine } from '@0x/subproviders';
+import { logUtils } from '@0x/utils';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import 'reflect-metadata';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import { ERC20EventsSource } from '../data_sources/contract-wrappers/erc20_events';
+import { ERC20ApprovalEvent } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseERC20ApprovalEvents } from '../parsers/events';
+import { handleError, INFURA_ROOT_URL } from '../utils';
+
+const NETWORK_ID = 1;
+const START_BLOCK_OFFSET = 100; // Number of blocks before the last known block to consider when updating fill events.
+const BATCH_SAVE_SIZE = 1000; // Number of events to save at once.
+const BLOCK_FINALITY_THRESHOLD = 10; // When to consider blocks as final. Used to compute default endBlock.
+
+let connection: Connection;
+
+interface Token {
+ // name is used for logging only.
+ name: string;
+ address: string;
+ defaultStartBlock: number;
+}
+
+const tokensToGetApprovalEvents: Token[] = [
+ {
+ name: 'WETH',
+ address: getContractAddressesForNetworkOrThrow(NETWORK_ID).etherToken,
+ defaultStartBlock: 4719568, // Block when the WETH contract was deployed.
+ },
+ {
+ name: 'ZRX',
+ address: getContractAddressesForNetworkOrThrow(NETWORK_ID).zrxToken,
+ defaultStartBlock: 4145415, // Block when the ZRX contract was deployed.
+ },
+ {
+ name: 'DAI',
+ address: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
+ defaultStartBlock: 4752008, // Block when the DAI contract was deployed.
+ },
+];
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const provider = web3Factory.getRpcProvider({
+ rpcUrl: INFURA_ROOT_URL,
+ });
+ const endBlock = await calculateEndBlockAsync(provider);
+ for (const token of tokensToGetApprovalEvents) {
+ await getAndSaveApprovalEventsAsync(provider, token, endBlock);
+ }
+ process.exit(0);
+})().catch(handleError);
+
+async function getAndSaveApprovalEventsAsync(
+ provider: Web3ProviderEngine,
+ token: Token,
+ endBlock: number,
+): Promise<void> {
+ logUtils.log(`Getting approval events for ${token.name}...`);
+ logUtils.log('Checking existing approval events...');
+ const repository = connection.getRepository(ERC20ApprovalEvent);
+ const startBlock = (await getStartBlockAsync(token)) || token.defaultStartBlock;
+
+ logUtils.log(`Getting approval events starting at ${startBlock}...`);
+ const eventsSource = new ERC20EventsSource(provider, NETWORK_ID, token.address);
+ const eventLogs = await eventsSource.getApprovalEventsAsync(startBlock, endBlock);
+
+ logUtils.log(`Parsing ${eventLogs.length} approval events...`);
+ const events = parseERC20ApprovalEvents(eventLogs);
+ logUtils.log(`Retrieved and parsed ${events.length} total approval events.`);
+ await repository.save(events, { chunk: Math.ceil(events.length / BATCH_SAVE_SIZE) });
+}
+
+async function calculateEndBlockAsync(provider: Web3ProviderEngine): Promise<number> {
+ const web3Wrapper = new Web3Wrapper(provider);
+ const currentBlock = await web3Wrapper.getBlockNumberAsync();
+ return currentBlock - BLOCK_FINALITY_THRESHOLD;
+}
+
+async function getStartBlockAsync(token: Token): Promise<number | null> {
+ const queryResult = await connection.query(
+ `SELECT block_number FROM raw.erc20_approval_events WHERE token_address = $1 ORDER BY block_number DESC LIMIT 1`,
+ [token.address],
+ );
+ if (queryResult.length === 0) {
+ logUtils.log(`No existing approval events found for ${token.name}.`);
+ return null;
+ }
+ const lastKnownBlock = queryResult[0].block_number;
+ return lastKnownBlock - START_BLOCK_OFFSET;
+}
diff --git a/packages/pipeline/src/scripts/pull_exchange_events.ts b/packages/pipeline/src/scripts/pull_exchange_events.ts
new file mode 100644
index 000000000..e98fc6629
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_exchange_events.ts
@@ -0,0 +1,146 @@
+// tslint:disable:no-console
+import { web3Factory } from '@0x/dev-utils';
+import { Web3ProviderEngine } from '@0x/subproviders';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import R = require('ramda');
+import 'reflect-metadata';
+import { Connection, ConnectionOptions, createConnection, Repository } from 'typeorm';
+
+import { ExchangeEventsSource } from '../data_sources/contract-wrappers/exchange_events';
+import { ExchangeCancelEvent, ExchangeCancelUpToEvent, ExchangeEvent, ExchangeFillEvent } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseExchangeCancelEvents, parseExchangeCancelUpToEvents, parseExchangeFillEvents } from '../parsers/events';
+import { EXCHANGE_START_BLOCK, handleError, INFURA_ROOT_URL } from '../utils';
+
+const START_BLOCK_OFFSET = 100; // Number of blocks before the last known block to consider when updating fill events.
+const BATCH_SAVE_SIZE = 1000; // Number of events to save at once.
+const BLOCK_FINALITY_THRESHOLD = 10; // When to consider blocks as final. Used to compute default endBlock.
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const provider = web3Factory.getRpcProvider({
+ rpcUrl: INFURA_ROOT_URL,
+ });
+ const endBlock = await calculateEndBlockAsync(provider);
+ const eventsSource = new ExchangeEventsSource(provider, 1);
+ await getFillEventsAsync(eventsSource, endBlock);
+ await getCancelEventsAsync(eventsSource, endBlock);
+ await getCancelUpToEventsAsync(eventsSource, endBlock);
+ process.exit(0);
+})().catch(handleError);
+
+async function getFillEventsAsync(eventsSource: ExchangeEventsSource, endBlock: number): Promise<void> {
+ console.log('Checking existing fill events...');
+ const repository = connection.getRepository(ExchangeFillEvent);
+ const startBlock = await getStartBlockAsync(repository);
+ console.log(`Getting fill events starting at ${startBlock}...`);
+ const eventLogs = await eventsSource.getFillEventsAsync(startBlock, endBlock);
+ console.log('Parsing fill events...');
+ const events = parseExchangeFillEvents(eventLogs);
+ console.log(`Retrieved and parsed ${events.length} total fill events.`);
+ await saveEventsAsync(startBlock === EXCHANGE_START_BLOCK, repository, events);
+}
+
+async function getCancelEventsAsync(eventsSource: ExchangeEventsSource, endBlock: number): Promise<void> {
+ console.log('Checking existing cancel events...');
+ const repository = connection.getRepository(ExchangeCancelEvent);
+ const startBlock = await getStartBlockAsync(repository);
+ console.log(`Getting cancel events starting at ${startBlock}...`);
+ const eventLogs = await eventsSource.getCancelEventsAsync(startBlock, endBlock);
+ console.log('Parsing cancel events...');
+ const events = parseExchangeCancelEvents(eventLogs);
+ console.log(`Retrieved and parsed ${events.length} total cancel events.`);
+ await saveEventsAsync(startBlock === EXCHANGE_START_BLOCK, repository, events);
+}
+
+async function getCancelUpToEventsAsync(eventsSource: ExchangeEventsSource, endBlock: number): Promise<void> {
+ console.log('Checking existing CancelUpTo events...');
+ const repository = connection.getRepository(ExchangeCancelUpToEvent);
+ const startBlock = await getStartBlockAsync(repository);
+ console.log(`Getting CancelUpTo events starting at ${startBlock}...`);
+ const eventLogs = await eventsSource.getCancelUpToEventsAsync(startBlock, endBlock);
+ console.log('Parsing CancelUpTo events...');
+ const events = parseExchangeCancelUpToEvents(eventLogs);
+ console.log(`Retrieved and parsed ${events.length} total CancelUpTo events.`);
+ await saveEventsAsync(startBlock === EXCHANGE_START_BLOCK, repository, events);
+}
+
+const tableNameRegex = /^[a-zA-Z_]*$/;
+
+async function getStartBlockAsync<T extends ExchangeEvent>(repository: Repository<T>): Promise<number> {
+ const fillEventCount = await repository.count();
+ if (fillEventCount === 0) {
+ console.log(`No existing ${repository.metadata.name}s found.`);
+ return EXCHANGE_START_BLOCK;
+ }
+ const tableName = repository.metadata.tableName;
+ if (!tableNameRegex.test(tableName)) {
+ throw new Error(`Unexpected special character in table name: ${tableName}`);
+ }
+ const queryResult = await connection.query(
+ `SELECT block_number FROM raw.${tableName} ORDER BY block_number DESC LIMIT 1`,
+ );
+ const lastKnownBlock = queryResult[0].block_number;
+ return lastKnownBlock - START_BLOCK_OFFSET;
+}
+
+async function saveEventsAsync<T extends ExchangeEvent>(
+ isInitialPull: boolean,
+ repository: Repository<T>,
+ events: T[],
+): Promise<void> {
+ console.log(`Saving ${repository.metadata.name}s...`);
+ if (isInitialPull) {
+ // Split data into numChunks pieces of maximum size BATCH_SAVE_SIZE
+ // each.
+ for (const eventsBatch of R.splitEvery(BATCH_SAVE_SIZE, events)) {
+ await repository.insert(eventsBatch);
+ }
+ } else {
+ // If we possibly have some overlap where we need to update some
+ // existing events, we need to use our workaround/fallback.
+ await saveIndividuallyWithFallbackAsync(repository, events);
+ }
+ const totalEvents = await repository.count();
+ console.log(`Done saving events. There are now ${totalEvents} total ${repository.metadata.name}s.`);
+}
+
+async function saveIndividuallyWithFallbackAsync<T extends ExchangeEvent>(
+ repository: Repository<T>,
+ events: T[],
+): Promise<void> {
+ // Note(albrow): This is a temporary hack because `save` is not working as
+ // documented and is causing a foreign key constraint violation. Hopefully
+ // can remove later because this "poor man's upsert" implementation operates
+ // on one event at a time and is therefore much slower.
+ for (const event of events) {
+ try {
+ // First try an insert.
+ await repository.insert(event);
+ } catch {
+ // If it fails, assume it was a foreign key constraint error and try
+ // doing an update instead.
+ // Note(albrow): Unfortunately the `as any` hack here seems
+ // required. I can't figure out how to convince the type-checker
+ // that the criteria and the entity itself are the correct type for
+ // the given repository. If we can remove the `save` hack then this
+ // will probably no longer be necessary.
+ await repository.update(
+ {
+ contractAddress: event.contractAddress,
+ blockNumber: event.blockNumber,
+ logIndex: event.logIndex,
+ } as any,
+ event as any,
+ );
+ }
+ }
+}
+
+async function calculateEndBlockAsync(provider: Web3ProviderEngine): Promise<number> {
+ const web3Wrapper = new Web3Wrapper(provider);
+ const currentBlock = await web3Wrapper.getBlockNumberAsync();
+ return currentBlock - BLOCK_FINALITY_THRESHOLD;
+}
diff --git a/packages/pipeline/src/scripts/pull_idex_orderbook_snapshots.ts b/packages/pipeline/src/scripts/pull_idex_orderbook_snapshots.ts
new file mode 100644
index 000000000..490b17766
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_idex_orderbook_snapshots.ts
@@ -0,0 +1,63 @@
+import { logUtils } from '@0x/utils';
+import * as R from 'ramda';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import { IDEX_SOURCE, IdexSource } from '../data_sources/idex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseIdexOrders } from '../parsers/idex_orders';
+import { handleError } from '../utils';
+
+// Number of orders to save at once.
+const BATCH_SAVE_SIZE = 1000;
+
+// Number of markets to retrieve orderbooks for at once.
+const MARKET_ORDERBOOK_REQUEST_BATCH_SIZE = 100;
+
+// Delay between market orderbook requests.
+const MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY = 2000;
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const idexSource = new IdexSource();
+ logUtils.log('Getting all IDEX markets');
+ const markets = await idexSource.getMarketsAsync();
+ logUtils.log(`Got ${markets.length} markets.`);
+ for (const marketsChunk of R.splitEvery(MARKET_ORDERBOOK_REQUEST_BATCH_SIZE, markets)) {
+ await Promise.all(
+ marketsChunk.map(async (marketId: string) => getAndSaveMarketOrderbookAsync(idexSource, marketId)),
+ );
+ await new Promise<void>(resolve => setTimeout(resolve, MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY));
+ }
+ process.exit(0);
+})().catch(handleError);
+
+/**
+ * Retrieve orderbook from Idex API for a given market. Parse orders and insert
+ * them into our database.
+ * @param idexSource Data source which can query Idex API.
+ * @param marketId String representing market of interest, eg. 'ETH_TIC'.
+ */
+async function getAndSaveMarketOrderbookAsync(idexSource: IdexSource, marketId: string): Promise<void> {
+ logUtils.log(`${marketId}: Retrieving orderbook.`);
+ const orderBook = await idexSource.getMarketOrderbookAsync(marketId);
+ const observedTimestamp = Date.now();
+
+ if (!R.has('bids', orderBook) || !R.has('asks', orderBook)) {
+ logUtils.warn(`${marketId}: Orderbook faulty.`);
+ return;
+ }
+
+ logUtils.log(`${marketId}: Parsing orders.`);
+ const orders = parseIdexOrders(orderBook, observedTimestamp, IDEX_SOURCE);
+
+ if (orders.length > 0) {
+ logUtils.log(`${marketId}: Saving ${orders.length} orders.`);
+ const TokenOrderRepository = connection.getRepository(TokenOrder);
+ await TokenOrderRepository.save(orders, { chunk: Math.ceil(orders.length / BATCH_SAVE_SIZE) });
+ } else {
+ logUtils.log(`${marketId}: 0 orders to save.`);
+ }
+}
diff --git a/packages/pipeline/src/scripts/pull_missing_blocks.ts b/packages/pipeline/src/scripts/pull_missing_blocks.ts
new file mode 100644
index 000000000..ced9d99eb
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_missing_blocks.ts
@@ -0,0 +1,90 @@
+// tslint:disable:no-console
+import { web3Factory } from '@0x/dev-utils';
+import * as Parallel from 'async-parallel';
+import R = require('ramda');
+import 'reflect-metadata';
+import { Connection, ConnectionOptions, createConnection, Repository } from 'typeorm';
+
+import { Web3Source } from '../data_sources/web3';
+import { Block } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseBlock } from '../parsers/web3';
+import { handleError, INFURA_ROOT_URL } from '../utils';
+
+// Number of blocks to save at once.
+const BATCH_SAVE_SIZE = 1000;
+// Maximum number of requests to send at once.
+const MAX_CONCURRENCY = 20;
+// Maximum number of blocks to query for at once. This is also the maximum
+// number of blocks we will hold in memory prior to being saved to the database.
+const MAX_BLOCKS_PER_QUERY = 1000;
+
+let connection: Connection;
+
+const tablesWithMissingBlocks = [
+ 'raw.exchange_fill_events',
+ 'raw.exchange_cancel_events',
+ 'raw.exchange_cancel_up_to_events',
+ 'raw.erc20_approval_events',
+];
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const provider = web3Factory.getRpcProvider({
+ rpcUrl: INFURA_ROOT_URL,
+ });
+ const web3Source = new Web3Source(provider);
+ for (const tableName of tablesWithMissingBlocks) {
+ await getAllMissingBlocksAsync(web3Source, tableName);
+ }
+ process.exit(0);
+})().catch(handleError);
+
+interface MissingBlocksResponse {
+ block_number: string;
+}
+
+async function getAllMissingBlocksAsync(web3Source: Web3Source, tableName: string): Promise<void> {
+ const blocksRepository = connection.getRepository(Block);
+ while (true) {
+ console.log(`Checking for missing blocks in ${tableName}...`);
+ const blockNumbers = await getMissingBlockNumbersAsync(tableName);
+ if (blockNumbers.length === 0) {
+ // There are no more missing blocks. We're done.
+ break;
+ }
+ await getAndSaveBlocksAsync(web3Source, blocksRepository, blockNumbers);
+ }
+ const totalBlocks = await blocksRepository.count();
+ console.log(`Done saving blocks for ${tableName}. There are now ${totalBlocks} total blocks.`);
+}
+
+async function getMissingBlockNumbersAsync(tableName: string): Promise<number[]> {
+ // This query returns up to `MAX_BLOCKS_PER_QUERY` distinct block numbers
+ // which are present in `tableName` but not in `raw.blocks`.
+ const response = (await connection.query(
+ `SELECT DISTINCT(block_number) FROM ${tableName} LEFT JOIN raw.blocks ON ${tableName}.block_number = raw.blocks.number WHERE number IS NULL LIMIT $1;`,
+ [MAX_BLOCKS_PER_QUERY],
+ )) as MissingBlocksResponse[];
+ const blockNumberStrings = R.pluck('block_number', response);
+ const blockNumbers = R.map(parseInt, blockNumberStrings);
+ console.log(`Found ${blockNumbers.length} missing blocks.`);
+ return blockNumbers;
+}
+
+async function getAndSaveBlocksAsync(
+ web3Source: Web3Source,
+ blocksRepository: Repository<Block>,
+ blockNumbers: number[],
+): Promise<void> {
+ console.log(`Getting block data for ${blockNumbers.length} blocks...`);
+ Parallel.setConcurrency(MAX_CONCURRENCY);
+ const rawBlocks = await Parallel.map(blockNumbers, async (blockNumber: number) =>
+ web3Source.getBlockInfoAsync(blockNumber),
+ );
+ console.log(`Parsing ${rawBlocks.length} blocks...`);
+ const blocks = R.map(parseBlock, rawBlocks);
+ console.log(`Saving ${blocks.length} blocks...`);
+ await blocksRepository.save(blocks, { chunk: Math.ceil(blocks.length / BATCH_SAVE_SIZE) });
+ console.log('Done saving this batch of blocks');
+}
diff --git a/packages/pipeline/src/scripts/pull_oasis_orderbook_snapshots.ts b/packages/pipeline/src/scripts/pull_oasis_orderbook_snapshots.ts
new file mode 100644
index 000000000..c4dcf6c83
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_oasis_orderbook_snapshots.ts
@@ -0,0 +1,58 @@
+import { logUtils } from '@0x/utils';
+import * as R from 'ramda';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import { OASIS_SOURCE, OasisMarket, OasisSource } from '../data_sources/oasis';
+import { TokenOrderbookSnapshot as TokenOrder } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseOasisOrders } from '../parsers/oasis_orders';
+import { handleError } from '../utils';
+
+// Number of orders to save at once.
+const BATCH_SAVE_SIZE = 1000;
+
+// Number of markets to retrieve orderbooks for at once.
+const MARKET_ORDERBOOK_REQUEST_BATCH_SIZE = 50;
+
+// Delay between market orderbook requests.
+const MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY = 1000;
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const oasisSource = new OasisSource();
+ logUtils.log('Getting all active Oasis markets');
+ const markets = await oasisSource.getActiveMarketsAsync();
+ logUtils.log(`Got ${markets.length} markets.`);
+ for (const marketsChunk of R.splitEvery(MARKET_ORDERBOOK_REQUEST_BATCH_SIZE, markets)) {
+ await Promise.all(
+ marketsChunk.map(async (market: OasisMarket) => getAndSaveMarketOrderbookAsync(oasisSource, market)),
+ );
+ await new Promise<void>(resolve => setTimeout(resolve, MILLISEC_MARKET_ORDERBOOK_REQUEST_DELAY));
+ }
+ process.exit(0);
+})().catch(handleError);
+
+/**
+ * Retrieve orderbook from Oasis API for a given market. Parse orders and insert
+ * them into our database.
+ * @param oasisSource Data source which can query Oasis API.
+ * @param marketId String identifying market we want data for. eg. 'REPAUG'.
+ */
+async function getAndSaveMarketOrderbookAsync(oasisSource: OasisSource, market: OasisMarket): Promise<void> {
+ logUtils.log(`${market.id}: Retrieving orderbook.`);
+ const orderBook = await oasisSource.getMarketOrderbookAsync(market.id);
+ const observedTimestamp = Date.now();
+
+ logUtils.log(`${market.id}: Parsing orders.`);
+ const orders = parseOasisOrders(orderBook, market, observedTimestamp, OASIS_SOURCE);
+
+ if (orders.length > 0) {
+ logUtils.log(`${market.id}: Saving ${orders.length} orders.`);
+ const TokenOrderRepository = connection.getRepository(TokenOrder);
+ await TokenOrderRepository.save(orders, { chunk: Math.ceil(orders.length / BATCH_SAVE_SIZE) });
+ } else {
+ logUtils.log(`${market.id}: 0 orders to save.`);
+ }
+}
diff --git a/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts b/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts
new file mode 100644
index 000000000..d44eb5cc6
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts
@@ -0,0 +1,95 @@
+// tslint:disable:no-console
+import { Connection, ConnectionOptions, createConnection, Repository } from 'typeorm';
+
+import { CryptoCompareOHLCVSource } from '../data_sources/ohlcv_external/crypto_compare';
+import { OHLCVExternal } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { OHLCVMetadata, parseRecords } from '../parsers/ohlcv_external/crypto_compare';
+import { handleError } from '../utils';
+import { fetchOHLCVTradingPairsAsync, TradingPair } from '../utils/get_ohlcv_trading_pairs';
+
+const SOURCE_NAME = 'CryptoCompare';
+const TWO_HOURS_AGO = new Date().getTime() - 2 * 60 * 60 * 1000; // tslint:disable-line:custom-no-magic-numbers
+
+const MAX_REQS_PER_SECOND = parseInt(process.env.CRYPTOCOMPARE_MAX_REQS_PER_SECOND || '15', 10); // tslint:disable-line:custom-no-magic-numbers
+const EARLIEST_BACKFILL_DATE = process.env.OHLCV_EARLIEST_BACKFILL_DATE || '2014-06-01';
+const EARLIEST_BACKFILL_TIME = new Date(EARLIEST_BACKFILL_DATE).getTime();
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const repository = connection.getRepository(OHLCVExternal);
+ const source = new CryptoCompareOHLCVSource(MAX_REQS_PER_SECOND);
+
+ const jobTime = new Date().getTime();
+ const tradingPairs = await fetchOHLCVTradingPairsAsync(connection, SOURCE_NAME, EARLIEST_BACKFILL_TIME);
+ console.log(`Starting ${tradingPairs.length} job(s) to scrape Crypto Compare for OHLCV records...`);
+
+ const fetchAndSavePromises = tradingPairs.map(async pair => {
+ const pairs = source.generateBackfillIntervals(pair);
+ return fetchAndSaveAsync(source, repository, jobTime, pairs);
+ });
+ await Promise.all(fetchAndSavePromises);
+ console.log(`Finished scraping OHLCV records from Crypto Compare, exiting...`);
+ process.exit(0);
+})().catch(handleError);
+
+async function fetchAndSaveAsync(
+ source: CryptoCompareOHLCVSource,
+ repository: Repository<OHLCVExternal>,
+ jobTime: number,
+ pairs: TradingPair[],
+): Promise<void> {
+ const sortAscTimestamp = (a: TradingPair, b: TradingPair): number => {
+ if (a.latestSavedTime < b.latestSavedTime) {
+ return -1;
+ } else if (a.latestSavedTime > b.latestSavedTime) {
+ return 1;
+ } else {
+ return 0;
+ }
+ };
+ pairs.sort(sortAscTimestamp);
+
+ let i = 0;
+ while (i < pairs.length) {
+ const pair = pairs[i];
+ if (pair.latestSavedTime > TWO_HOURS_AGO) {
+ break;
+ }
+ try {
+ const records = await source.getHourlyOHLCVAsync(pair);
+ console.log(`Retrieved ${records.length} records for ${JSON.stringify(pair)}`);
+ if (records.length > 0) {
+ const metadata: OHLCVMetadata = {
+ exchange: source.defaultExchange,
+ fromSymbol: pair.fromSymbol,
+ toSymbol: pair.toSymbol,
+ source: SOURCE_NAME,
+ observedTimestamp: jobTime,
+ interval: source.intervalBetweenRecords,
+ };
+ const parsedRecords = parseRecords(records, metadata);
+ await saveRecordsAsync(repository, parsedRecords);
+ }
+ i++;
+ } catch (err) {
+ console.log(`Error scraping OHLCVRecords, stopping task for ${JSON.stringify(pair)} [${err}]`);
+ break;
+ }
+ }
+ return Promise.resolve();
+}
+
+async function saveRecordsAsync(repository: Repository<OHLCVExternal>, records: OHLCVExternal[]): Promise<void> {
+ const metadata = [
+ records[0].fromSymbol,
+ records[0].toSymbol,
+ new Date(records[0].startTime),
+ new Date(records[records.length - 1].endTime),
+ ];
+
+ console.log(`Saving ${records.length} records to ${repository.metadata.name}... ${JSON.stringify(metadata)}`);
+ await repository.save(records);
+}
diff --git a/packages/pipeline/src/scripts/pull_paradex_orderbook_snapshots.ts b/packages/pipeline/src/scripts/pull_paradex_orderbook_snapshots.ts
new file mode 100644
index 000000000..34345f355
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_paradex_orderbook_snapshots.ts
@@ -0,0 +1,87 @@
+import { logUtils } from '@0x/utils';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import {
+ PARADEX_SOURCE,
+ ParadexActiveMarketsResponse,
+ ParadexMarket,
+ ParadexSource,
+ ParadexTokenInfoResponse,
+} from '../data_sources/paradex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseParadexOrders } from '../parsers/paradex_orders';
+import { handleError } from '../utils';
+
+// Number of orders to save at once.
+const BATCH_SAVE_SIZE = 1000;
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ const apiKey = process.env.PARADEX_DATA_PIPELINE_API_KEY;
+ if (apiKey === undefined) {
+ throw new Error('Missing required env var: PARADEX_DATA_PIPELINE_API_KEY');
+ }
+ const paradexSource = new ParadexSource(apiKey);
+ const markets = await paradexSource.getActiveMarketsAsync();
+ const tokenInfoResponse = await paradexSource.getTokenInfoAsync();
+ const extendedMarkets = addTokenAddresses(markets, tokenInfoResponse);
+ await Promise.all(
+ extendedMarkets.map(async (market: ParadexMarket) => getAndSaveMarketOrderbookAsync(paradexSource, market)),
+ );
+ process.exit(0);
+})().catch(handleError);
+
+/**
+ * Extend the default ParadexMarket objects with token addresses.
+ * @param markets An array of ParadexMarket objects.
+ * @param tokenInfoResponse An array of ParadexTokenInfo containing the addresses.
+ */
+function addTokenAddresses(
+ markets: ParadexActiveMarketsResponse,
+ tokenInfoResponse: ParadexTokenInfoResponse,
+): ParadexMarket[] {
+ const symbolAddressMapping = new Map<string, string>();
+ tokenInfoResponse.forEach(tokenInfo => symbolAddressMapping.set(tokenInfo.symbol, tokenInfo.address));
+
+ markets.forEach((market: ParadexMarket) => {
+ if (symbolAddressMapping.has(market.baseToken)) {
+ market.baseTokenAddress = symbolAddressMapping.get(market.baseToken);
+ } else {
+ market.quoteTokenAddress = '';
+ logUtils.warn(`${market.baseToken}: No address found.`);
+ }
+
+ if (symbolAddressMapping.has(market.quoteToken)) {
+ market.quoteTokenAddress = symbolAddressMapping.get(market.quoteToken);
+ } else {
+ market.quoteTokenAddress = '';
+ logUtils.warn(`${market.quoteToken}: No address found.`);
+ }
+ });
+ return markets;
+}
+
+/**
+ * Retrieve orderbook from Paradex API for a given market. Parse orders and insert
+ * them into our database.
+ * @param paradexSource Data source which can query the Paradex API.
+ * @param market Object from the Paradex API with information about the market in question.
+ */
+async function getAndSaveMarketOrderbookAsync(paradexSource: ParadexSource, market: ParadexMarket): Promise<void> {
+ const paradexOrderbookResponse = await paradexSource.getMarketOrderbookAsync(market.symbol);
+ const observedTimestamp = Date.now();
+
+ logUtils.log(`${market.symbol}: Parsing orders.`);
+ const orders = parseParadexOrders(paradexOrderbookResponse, market, observedTimestamp, PARADEX_SOURCE);
+
+ if (orders.length > 0) {
+ logUtils.log(`${market.symbol}: Saving ${orders.length} orders.`);
+ const tokenOrderRepository = connection.getRepository(TokenOrder);
+ await tokenOrderRepository.save(orders, { chunk: Math.ceil(orders.length / BATCH_SAVE_SIZE) });
+ } else {
+ logUtils.log(`${market.symbol}: 0 orders to save.`);
+ }
+}
diff --git a/packages/pipeline/src/scripts/pull_radar_relay_orders.ts b/packages/pipeline/src/scripts/pull_radar_relay_orders.ts
new file mode 100644
index 000000000..40bb6fc97
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_radar_relay_orders.ts
@@ -0,0 +1,54 @@
+// tslint:disable:no-console
+import { HttpClient } from '@0x/connect';
+import * as R from 'ramda';
+import 'reflect-metadata';
+import { Connection, ConnectionOptions, createConnection, EntityManager } from 'typeorm';
+
+import { createObservedTimestampForOrder, SraOrder } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseSraOrders } from '../parsers/sra_orders';
+import { handleError } from '../utils';
+
+const RADAR_RELAY_URL = 'https://api.radarrelay.com/0x/v2';
+const ORDERS_PER_PAGE = 10000; // Number of orders to get per request.
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ await getOrderbookAsync();
+ process.exit(0);
+})().catch(handleError);
+
+async function getOrderbookAsync(): Promise<void> {
+ console.log('Getting all orders...');
+ const connectClient = new HttpClient(RADAR_RELAY_URL);
+ const rawOrders = await connectClient.getOrdersAsync({
+ perPage: ORDERS_PER_PAGE,
+ });
+ console.log(`Got ${rawOrders.records.length} orders.`);
+ console.log('Parsing orders...');
+ // Parse the sra orders, then add source url to each.
+ const orders = R.pipe(parseSraOrders, R.map(setSourceUrl(RADAR_RELAY_URL)))(rawOrders);
+ // Save all the orders and update the observed time stamps in a single
+ // transaction.
+ console.log('Saving orders and updating timestamps...');
+ const observedTimestamp = Date.now();
+ await connection.transaction(async (manager: EntityManager): Promise<void> => {
+ for (const order of orders) {
+ await manager.save(SraOrder, order);
+ const orderObservation = createObservedTimestampForOrder(order, observedTimestamp);
+ await manager.save(orderObservation);
+ }
+ });
+}
+
+const sourceUrlProp = R.lensProp('sourceUrl');
+
+/**
+ * Sets the source url for a single order. Returns a new order instead of
+ * mutating the given one.
+ */
+const setSourceUrl = R.curry((sourceURL: string, order: SraOrder): SraOrder => {
+ return R.set(sourceUrlProp, sourceURL, order);
+});
diff --git a/packages/pipeline/src/scripts/pull_trusted_tokens.ts b/packages/pipeline/src/scripts/pull_trusted_tokens.ts
new file mode 100644
index 000000000..5906deee6
--- /dev/null
+++ b/packages/pipeline/src/scripts/pull_trusted_tokens.ts
@@ -0,0 +1,52 @@
+import 'reflect-metadata';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import { MetamaskTrustedTokenMeta, TrustedTokenSource, ZeroExTrustedTokenMeta } from '../data_sources/trusted_tokens';
+import { TokenMetadata } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseMetamaskTrustedTokens, parseZeroExTrustedTokens } from '../parsers/token_metadata';
+import { handleError } from '../utils';
+
+const METAMASK_TRUSTED_TOKENS_URL =
+ 'https://raw.githubusercontent.com/MetaMask/eth-contract-metadata/d45916c533116510cc8e9e048a8b5fc3732a6b6d/contract-map.json';
+
+const ZEROEX_TRUSTED_TOKENS_URL = 'https://website-api.0xproject.com/tokens';
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ await getMetamaskTrustedTokensAsync();
+ await getZeroExTrustedTokensAsync();
+ process.exit(0);
+})().catch(handleError);
+
+async function getMetamaskTrustedTokensAsync(): Promise<void> {
+ // tslint:disable-next-line:no-console
+ console.log('Getting latest metamask trusted tokens list ...');
+ const trustedTokensRepository = connection.getRepository(TokenMetadata);
+ const trustedTokensSource = new TrustedTokenSource<Map<string, MetamaskTrustedTokenMeta>>(
+ METAMASK_TRUSTED_TOKENS_URL,
+ );
+ const resp = await trustedTokensSource.getTrustedTokenMetaAsync();
+ const trustedTokens = parseMetamaskTrustedTokens(resp);
+ // tslint:disable-next-line:no-console
+ console.log('Saving metamask trusted tokens list');
+ await trustedTokensRepository.save(trustedTokens);
+ // tslint:disable-next-line:no-console
+ console.log('Done saving metamask trusted tokens.');
+}
+
+async function getZeroExTrustedTokensAsync(): Promise<void> {
+ // tslint:disable-next-line:no-console
+ console.log('Getting latest 0x trusted tokens list ...');
+ const trustedTokensRepository = connection.getRepository(TokenMetadata);
+ const trustedTokensSource = new TrustedTokenSource<ZeroExTrustedTokenMeta[]>(ZEROEX_TRUSTED_TOKENS_URL);
+ const resp = await trustedTokensSource.getTrustedTokenMetaAsync();
+ const trustedTokens = parseZeroExTrustedTokens(resp);
+ // tslint:disable-next-line:no-console
+ console.log('Saving metamask trusted tokens list');
+ await trustedTokensRepository.save(trustedTokens);
+ // tslint:disable-next-line:no-console
+ console.log('Done saving metamask trusted tokens.');
+}
diff --git a/packages/pipeline/src/scripts/update_relayer_info.ts b/packages/pipeline/src/scripts/update_relayer_info.ts
new file mode 100644
index 000000000..41d29b385
--- /dev/null
+++ b/packages/pipeline/src/scripts/update_relayer_info.ts
@@ -0,0 +1,33 @@
+// tslint:disable:no-console
+import 'reflect-metadata';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import { RelayerRegistrySource } from '../data_sources/relayer-registry';
+import { Relayer } from '../entities';
+import * as ormConfig from '../ormconfig';
+import { parseRelayers } from '../parsers/relayer_registry';
+import { handleError } from '../utils';
+
+// NOTE(albrow): We need to manually update this URL for now. Fix this when we
+// have the relayer-registry behind semantic versioning.
+const RELAYER_REGISTRY_URL =
+ 'https://raw.githubusercontent.com/0xProject/0x-relayer-registry/4701c85677d161ea729a466aebbc1826c6aa2c0b/relayers.json';
+
+let connection: Connection;
+
+(async () => {
+ connection = await createConnection(ormConfig as ConnectionOptions);
+ await getRelayersAsync();
+ process.exit(0);
+})().catch(handleError);
+
+async function getRelayersAsync(): Promise<void> {
+ console.log('Getting latest relayer info...');
+ const relayerRepository = connection.getRepository(Relayer);
+ const relayerSource = new RelayerRegistrySource(RELAYER_REGISTRY_URL);
+ const relayersResp = await relayerSource.getRelayerInfoAsync();
+ const relayers = parseRelayers(relayersResp);
+ console.log('Saving relayer info...');
+ await relayerRepository.save(relayers);
+ console.log('Done saving relayer info.');
+}
diff --git a/packages/pipeline/src/types.ts b/packages/pipeline/src/types.ts
new file mode 100644
index 000000000..5f2121807
--- /dev/null
+++ b/packages/pipeline/src/types.ts
@@ -0,0 +1,9 @@
+export enum AssetType {
+ ERC20 = 'erc20',
+ ERC721 = 'erc721',
+ MultiAsset = 'multiAsset',
+}
+export enum OrderType {
+ Bid = 'bid',
+ Ask = 'ask',
+}
diff --git a/packages/pipeline/src/utils/constants.ts b/packages/pipeline/src/utils/constants.ts
new file mode 100644
index 000000000..56f3e82d8
--- /dev/null
+++ b/packages/pipeline/src/utils/constants.ts
@@ -0,0 +1,3 @@
+// Block number when the Exchange contract was deployed to mainnet.
+export const EXCHANGE_START_BLOCK = 6271590;
+export const INFURA_ROOT_URL = 'https://mainnet.infura.io';
diff --git a/packages/pipeline/src/utils/get_ohlcv_trading_pairs.ts b/packages/pipeline/src/utils/get_ohlcv_trading_pairs.ts
new file mode 100644
index 000000000..19f81344e
--- /dev/null
+++ b/packages/pipeline/src/utils/get_ohlcv_trading_pairs.ts
@@ -0,0 +1,116 @@
+import { fetchAsync } from '@0x/utils';
+import * as R from 'ramda';
+import { Connection } from 'typeorm';
+
+export interface TradingPair {
+ fromSymbol: string;
+ toSymbol: string;
+ latestSavedTime: number;
+}
+
+const COINLIST_API = 'https://min-api.cryptocompare.com/data/all/coinlist?BuiltOn=7605';
+
+interface CryptoCompareCoinListResp {
+ Data: Map<string, CryptoCompareCoin>;
+}
+
+interface CryptoCompareCoin {
+ Symbol: string;
+ BuiltOn: string;
+ SmartContractAddress: string;
+}
+
+const TO_CURRENCIES = ['USD', 'EUR', 'ETH', 'USDT'];
+const ETHEREUM_IDENTIFIER = '7605';
+const HTTP_OK_STATUS = 200;
+
+interface StaticPair {
+ fromSymbol: string;
+ toSymbol: string;
+}
+const SPECIAL_CASES: StaticPair[] = [
+ {
+ fromSymbol: 'ETH',
+ toSymbol: 'USD',
+ },
+];
+
+/**
+ * Get trading pairs with latest scraped time for OHLCV records
+ * @param conn a typeorm Connection to postgres
+ */
+export async function fetchOHLCVTradingPairsAsync(
+ conn: Connection,
+ source: string,
+ earliestBackfillTime: number,
+): Promise<TradingPair[]> {
+ // fetch existing ohlcv records
+ const latestTradingPairs: Array<{
+ from_symbol: string;
+ to_symbol: string;
+ latest: string;
+ }> = await conn.query(`SELECT
+ MAX(end_time) as latest,
+ from_symbol,
+ to_symbol
+ FROM raw.ohlcv_external
+ GROUP BY from_symbol, to_symbol;`);
+
+ // build addressable index: { fromsym: { tosym: time }}
+ const latestTradingPairsIndex: { [fromSym: string]: { [toSym: string]: number } } = {};
+ latestTradingPairs.forEach(pair => {
+ const latestIndex: { [toSym: string]: number } = latestTradingPairsIndex[pair.from_symbol] || {};
+ latestIndex[pair.to_symbol] = parseInt(pair.latest, 10); // tslint:disable-line:custom-no-magic-numbers
+ latestTradingPairsIndex[pair.from_symbol] = latestIndex;
+ });
+
+ // match time to special cases
+ const specialCases: TradingPair[] = SPECIAL_CASES.map(pair => {
+ const latestSavedTime =
+ R.path<number>([pair.fromSymbol, pair.toSymbol], latestTradingPairsIndex) || earliestBackfillTime;
+ return R.assoc('latestSavedTime', latestSavedTime, pair);
+ });
+
+ // get token symbols used by Crypto Compare
+ const allCoinsResp = await fetchAsync(COINLIST_API);
+ if (allCoinsResp.status !== HTTP_OK_STATUS) {
+ return [];
+ }
+ const allCoins: CryptoCompareCoinListResp = await allCoinsResp.json();
+ const erc20CoinsIndex: Map<string, string> = new Map();
+ Object.entries(allCoins.Data).forEach(pair => {
+ const [symbol, coinData] = pair;
+ if (coinData.BuiltOn === ETHEREUM_IDENTIFIER && coinData.SmartContractAddress !== 'N/A') {
+ erc20CoinsIndex.set(coinData.SmartContractAddress.toLowerCase(), symbol);
+ }
+ });
+
+ // fetch all tokens that are traded on 0x
+ const rawEventTokenAddresses: Array<{ tokenaddress: string }> = await conn.query(
+ `SELECT DISTINCT(maker_token_address) as tokenaddress FROM raw.exchange_fill_events UNION
+ SELECT DISTINCT(taker_token_address) as tokenaddress FROM raw.exchange_fill_events`,
+ );
+
+ // tslint:disable-next-line:no-unbound-method
+ const eventTokenAddresses = R.pluck('tokenaddress', rawEventTokenAddresses).map(R.toLower);
+
+ // join token addresses with CC symbols
+ const eventTokenSymbols: string[] = eventTokenAddresses
+ .filter(tokenAddress => erc20CoinsIndex.has(tokenAddress))
+ .map(tokenAddress => erc20CoinsIndex.get(tokenAddress) as string);
+
+ // join traded tokens with fiat and latest backfill time
+ const eventTradingPairs: TradingPair[] = R.chain(sym => {
+ return TO_CURRENCIES.map(fiat => {
+ const pair = {
+ fromSymbol: sym,
+ toSymbol: fiat,
+ latestSavedTime: R.path<number>([sym, fiat], latestTradingPairsIndex) || earliestBackfillTime,
+ };
+ return pair;
+ });
+ }, eventTokenSymbols);
+
+ // join with special cases
+ return R.concat(eventTradingPairs, specialCases);
+}
diff --git a/packages/pipeline/src/utils/index.ts b/packages/pipeline/src/utils/index.ts
new file mode 100644
index 000000000..094c0178e
--- /dev/null
+++ b/packages/pipeline/src/utils/index.ts
@@ -0,0 +1,53 @@
+import { BigNumber } from '@0x/utils';
+export * from './transformers';
+export * from './constants';
+
+/**
+ * If the given BigNumber is not null, returns the string representation of that
+ * number. Otherwise, returns null.
+ * @param n The number to convert.
+ */
+export function bigNumbertoStringOrNull(n: BigNumber): string | null {
+ if (n == null) {
+ return null;
+ }
+ return n.toString();
+}
+
+/**
+ * If value is null or undefined, returns null. Otherwise converts value to a
+ * BigNumber.
+ * @param value A string or number to be converted to a BigNumber
+ */
+export function toBigNumberOrNull(value: string | number | null): BigNumber | null {
+ switch (value) {
+ case null:
+ case undefined:
+ return null;
+ default:
+ return new BigNumber(value);
+ }
+}
+
+/**
+ * Logs an error by intelligently checking for `message` and `stack` properties.
+ * Intended for use with top-level immediately invoked asynchronous functions.
+ * @param e the error to log.
+ */
+export function handleError(e: any): void {
+ if (e.message != null) {
+ // tslint:disable-next-line:no-console
+ console.error(e.message);
+ } else {
+ // tslint:disable-next-line:no-console
+ console.error('Unknown error');
+ }
+ if (e.stack != null) {
+ // tslint:disable-next-line:no-console
+ console.error(e.stack);
+ } else {
+ // tslint:disable-next-line:no-console
+ console.error('(No stack trace)');
+ }
+ process.exit(1);
+}
diff --git a/packages/pipeline/src/utils/transformers/asset_proxy_id_types.ts b/packages/pipeline/src/utils/transformers/asset_proxy_id_types.ts
new file mode 100644
index 000000000..2cd05a616
--- /dev/null
+++ b/packages/pipeline/src/utils/transformers/asset_proxy_id_types.ts
@@ -0,0 +1,20 @@
+import { AssetProxyId } from '@0x/types';
+
+import { AssetType } from '../../types';
+
+/**
+ * Converts an assetProxyId to its string equivalent
+ * @param assetProxyId Id of AssetProxy
+ */
+export function convertAssetProxyIdToType(assetProxyId: AssetProxyId): AssetType {
+ switch (assetProxyId) {
+ case AssetProxyId.ERC20:
+ return AssetType.ERC20;
+ case AssetProxyId.ERC721:
+ return AssetType.ERC721;
+ case AssetProxyId.MultiAsset:
+ return AssetType.MultiAsset;
+ default:
+ throw new Error(`${assetProxyId} not a supported assetProxyId`);
+ }
+}
diff --git a/packages/pipeline/src/utils/transformers/big_number.ts b/packages/pipeline/src/utils/transformers/big_number.ts
new file mode 100644
index 000000000..5f2e4d565
--- /dev/null
+++ b/packages/pipeline/src/utils/transformers/big_number.ts
@@ -0,0 +1,16 @@
+import { BigNumber } from '@0x/utils';
+import { ValueTransformer } from 'typeorm/decorator/options/ValueTransformer';
+
+export class BigNumberTransformer implements ValueTransformer {
+ // tslint:disable-next-line:prefer-function-over-method
+ public to(value: BigNumber | null): string | null {
+ return value === null ? null : value.toString();
+ }
+
+ // tslint:disable-next-line:prefer-function-over-method
+ public from(value: string | null): BigNumber | null {
+ return value === null ? null : new BigNumber(value);
+ }
+}
+
+export const bigNumberTransformer = new BigNumberTransformer();
diff --git a/packages/pipeline/src/utils/transformers/index.ts b/packages/pipeline/src/utils/transformers/index.ts
new file mode 100644
index 000000000..31a4c9223
--- /dev/null
+++ b/packages/pipeline/src/utils/transformers/index.ts
@@ -0,0 +1,3 @@
+export * from './big_number';
+export * from './number_to_bigint';
+export * from './asset_proxy_id_types';
diff --git a/packages/pipeline/src/utils/transformers/number_to_bigint.ts b/packages/pipeline/src/utils/transformers/number_to_bigint.ts
new file mode 100644
index 000000000..9736d7c18
--- /dev/null
+++ b/packages/pipeline/src/utils/transformers/number_to_bigint.ts
@@ -0,0 +1,31 @@
+import { BigNumber } from '@0x/utils';
+import { ValueTransformer } from 'typeorm/decorator/options/ValueTransformer';
+
+const decimalRadix = 10;
+
+// Can be used to convert a JavaScript number type to a Postgres bigint type and
+// vice versa. By default TypeORM will silently convert number types to string
+// if the corresponding Postgres type is bigint. See
+// https://github.com/typeorm/typeorm/issues/2400 for more information.
+export class NumberToBigIntTransformer implements ValueTransformer {
+ // tslint:disable-next-line:prefer-function-over-method
+ public to(value: number): string | null {
+ if (value === null || value === undefined) {
+ return null;
+ } else {
+ return value.toString();
+ }
+ }
+
+ // tslint:disable-next-line:prefer-function-over-method
+ public from(value: string): number {
+ if (new BigNumber(value).greaterThan(Number.MAX_SAFE_INTEGER)) {
+ throw new Error(
+ `Attempted to convert PostgreSQL bigint value (${value}) to JavaScript number type but it is too big to safely convert`,
+ );
+ }
+ return Number.parseInt(value, decimalRadix);
+ }
+}
+
+export const numberToBigIntTransformer = new NumberToBigIntTransformer();
diff --git a/packages/pipeline/test/data_sources/contract-wrappers/utils_test.ts b/packages/pipeline/test/data_sources/contract-wrappers/utils_test.ts
new file mode 100644
index 000000000..06f1a5e86
--- /dev/null
+++ b/packages/pipeline/test/data_sources/contract-wrappers/utils_test.ts
@@ -0,0 +1,109 @@
+// tslint:disable:custom-no-magic-numbers
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import 'mocha';
+
+import { _getEventsWithRetriesAsync } from '../../../src/data_sources/contract-wrappers/utils';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+const retryableMessage = 'network timeout: (simulated network timeout error)';
+const retryableError = new Error(retryableMessage);
+
+describe('data_sources/contract-wrappers/utils', () => {
+ describe('_getEventsWithRetriesAsync', () => {
+ it('sends a single request if it was successful', async () => {
+ // Pre-declare values for the fromBlock and toBlock arguments.
+ const expectedFromBlock = 100;
+ const expectedToBlock = 200;
+ const expectedLogs: Array<LogWithDecodedArgs<any>> = [
+ {
+ logIndex: 123,
+ transactionIndex: 456,
+ transactionHash: '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd33657fe',
+ blockHash: '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd33657ff',
+ blockNumber: 789,
+ address: '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd3365800',
+ data: 'fake raw data',
+ topics: [],
+ event: 'TEST_EVENT',
+ args: [1, 2, 3],
+ },
+ ];
+
+ // mockGetEventsAsync checks its arguments, increments `callCount`
+ // and returns `expectedLogs`.
+ let callCount = 0;
+ const mockGetEventsAsync = async (
+ fromBlock: number,
+ toBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<any>>> => {
+ expect(fromBlock).equals(expectedFromBlock);
+ expect(toBlock).equals(expectedToBlock);
+ callCount += 1;
+ return expectedLogs;
+ };
+
+ // Make sure that we get what we expected and that the mock function
+ // was called exactly once.
+ const gotLogs = await _getEventsWithRetriesAsync(mockGetEventsAsync, 3, expectedFromBlock, expectedToBlock);
+ expect(gotLogs).deep.equals(expectedLogs);
+ expect(callCount).equals(
+ 1,
+ 'getEventsAsync function was called more than once even though it was successful',
+ );
+ });
+ it('retries and eventually succeeds', async () => {
+ const numRetries = 5;
+ let callCount = 0;
+ // mockGetEventsAsync throws unless callCount == numRetries + 1.
+ const mockGetEventsAsync = async (
+ _fromBlock: number,
+ _toBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<any>>> => {
+ callCount += 1;
+ if (callCount === numRetries + 1) {
+ return [];
+ }
+ throw retryableError;
+ };
+ await _getEventsWithRetriesAsync(mockGetEventsAsync, numRetries, 100, 300);
+ expect(callCount).equals(numRetries + 1, 'getEventsAsync function was called the wrong number of times');
+ });
+ it('throws for non-retryable errors', async () => {
+ const numRetries = 5;
+ const expectedMessage = 'Non-retryable error';
+ // mockGetEventsAsync always throws a non-retryable error.
+ const mockGetEventsAsync = async (
+ _fromBlock: number,
+ _toBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<any>>> => {
+ throw new Error(expectedMessage);
+ };
+ // Note(albrow): This does actually return a promise (or at least a
+ // "promise-like object" and is a false positive in TSLint.
+ // tslint:disable-next-line:await-promise
+ await expect(_getEventsWithRetriesAsync(mockGetEventsAsync, numRetries, 100, 300)).to.be.rejectedWith(
+ expectedMessage,
+ );
+ });
+ it('throws after too many retries', async () => {
+ const numRetries = 5;
+ // mockGetEventsAsync always throws a retryable error.
+ const mockGetEventsAsync = async (
+ _fromBlock: number,
+ _toBlock: number,
+ ): Promise<Array<LogWithDecodedArgs<any>>> => {
+ throw retryableError;
+ };
+ // Note(albrow): This does actually return a promise (or at least a
+ // "promise-like object" and is a false positive in TSLint.
+ // tslint:disable-next-line:await-promise
+ await expect(_getEventsWithRetriesAsync(mockGetEventsAsync, numRetries, 100, 300)).to.be.rejectedWith(
+ retryableMessage,
+ );
+ });
+ });
+});
diff --git a/packages/pipeline/test/data_sources/ohlcv_external/crypto_compare_test.ts b/packages/pipeline/test/data_sources/ohlcv_external/crypto_compare_test.ts
new file mode 100644
index 000000000..2efe3f5ec
--- /dev/null
+++ b/packages/pipeline/test/data_sources/ohlcv_external/crypto_compare_test.ts
@@ -0,0 +1,47 @@
+import * as chai from 'chai';
+import 'mocha';
+import * as R from 'ramda';
+
+import { CryptoCompareOHLCVSource } from '../../../src/data_sources/ohlcv_external/crypto_compare';
+import { TradingPair } from '../../../src/utils/get_ohlcv_trading_pairs';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('ohlcv_external data source (Crypto Compare)', () => {
+ describe('generateBackfillIntervals', () => {
+ it('generates pairs with intervals to query', () => {
+ const source = new CryptoCompareOHLCVSource(20);
+ const pair: TradingPair = {
+ fromSymbol: 'ETH',
+ toSymbol: 'ZRX',
+ latestSavedTime: new Date().getTime() - source.interval * 2,
+ };
+
+ const expected = [
+ pair,
+ R.merge(pair, { latestSavedTime: pair.latestSavedTime + source.interval }),
+ R.merge(pair, { latestSavedTime: pair.latestSavedTime + source.interval * 2 }),
+ ];
+
+ const actual = source.generateBackfillIntervals(pair);
+ expect(actual).deep.equal(expected);
+ });
+
+ it('returns single pair if no backfill is needed', () => {
+ const source = new CryptoCompareOHLCVSource(20);
+ const pair: TradingPair = {
+ fromSymbol: 'ETH',
+ toSymbol: 'ZRX',
+ latestSavedTime: new Date().getTime() - source.interval + 5000,
+ };
+
+ const expected = [pair];
+
+ const actual = source.generateBackfillIntervals(pair);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/db_global_hooks.ts b/packages/pipeline/test/db_global_hooks.ts
new file mode 100644
index 000000000..dfee02c45
--- /dev/null
+++ b/packages/pipeline/test/db_global_hooks.ts
@@ -0,0 +1,9 @@
+import { setUpDbAsync, tearDownDbAsync } from './db_setup';
+
+before('set up database', async () => {
+ await setUpDbAsync();
+});
+
+after('tear down database', async () => {
+ await tearDownDbAsync();
+});
diff --git a/packages/pipeline/test/db_setup.ts b/packages/pipeline/test/db_setup.ts
new file mode 100644
index 000000000..bf31d15b6
--- /dev/null
+++ b/packages/pipeline/test/db_setup.ts
@@ -0,0 +1,174 @@
+import * as Docker from 'dockerode';
+import * as fs from 'fs';
+import * as R from 'ramda';
+import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+
+import * as ormConfig from '../src/ormconfig';
+
+// The name of the image to pull and use for the container. This also affects
+// which version of Postgres we use.
+const DOCKER_IMAGE_NAME = 'postgres:11-alpine';
+// The name to use for the Docker container which will run Postgres.
+const DOCKER_CONTAINER_NAME = '0x_pipeline_postgres_test';
+// The port which will be exposed on the Docker container.
+const POSTGRES_HOST_PORT = '15432';
+// Number of milliseconds to wait for postgres to finish initializing after
+// starting the docker container.
+const POSTGRES_SETUP_DELAY_MS = 5000;
+
+/**
+ * Sets up the database for testing purposes. If the
+ * ZEROEX_DATA_PIPELINE_TEST_DB_URL env var is specified, it will create a
+ * connection using that url. Otherwise it will spin up a new Docker container
+ * with a Postgres database and then create a connection to that database.
+ */
+export async function setUpDbAsync(): Promise<void> {
+ const connection = await createDbConnectionOnceAsync();
+ await connection.runMigrations({ transaction: true });
+}
+
+/**
+ * Tears down the database used for testing. This completely destroys any data.
+ * If a docker container was created, it destroys that container too.
+ */
+export async function tearDownDbAsync(): Promise<void> {
+ const connection = await createDbConnectionOnceAsync();
+ for (const _ of connection.migrations) {
+ await connection.undoLastMigration({ transaction: true });
+ }
+ if (needsDocker()) {
+ const docker = initDockerOnce();
+ const postgresContainer = docker.getContainer(DOCKER_CONTAINER_NAME);
+ await postgresContainer.kill();
+ await postgresContainer.remove();
+ }
+}
+
+let savedConnection: Connection;
+
+/**
+ * The first time this is run, it creates and returns a new TypeORM connection.
+ * Each subsequent time, it returns the existing connection. This is helpful
+ * because only one TypeORM connection can be active at a time.
+ */
+export async function createDbConnectionOnceAsync(): Promise<Connection> {
+ if (savedConnection !== undefined) {
+ return savedConnection;
+ }
+
+ if (needsDocker()) {
+ await initContainerAsync();
+ }
+ const testDbUrl =
+ process.env.ZEROEX_DATA_PIPELINE_TEST_DB_URL ||
+ `postgresql://postgres@localhost:${POSTGRES_HOST_PORT}/postgres`;
+ const testOrmConfig = R.merge(ormConfig, { url: testDbUrl }) as ConnectionOptions;
+
+ savedConnection = await createConnection(testOrmConfig);
+ return savedConnection;
+}
+
+async function sleepAsync(ms: number): Promise<{}> {
+ return new Promise<{}>(resolve => setTimeout(resolve, ms));
+}
+
+let savedDocker: Docker;
+
+function initDockerOnce(): Docker {
+ if (savedDocker !== undefined) {
+ return savedDocker;
+ }
+
+ // Note(albrow): Code for determining the right socket path is partially
+ // based on https://github.com/apocas/dockerode/blob/8f3aa85311fab64d58eca08fef49aa1da5b5f60b/test/spec_helper.js
+ const isWin = require('os').type() === 'Windows_NT';
+ const socketPath = process.env.DOCKER_SOCKET || (isWin ? '//./pipe/docker_engine' : '/var/run/docker.sock');
+ const isSocket = fs.existsSync(socketPath) ? fs.statSync(socketPath).isSocket() : false;
+ if (!isSocket) {
+ throw new Error(`Failed to connect to Docker using socket path: "${socketPath}".
+
+The database integration tests need to be able to connect to a Postgres database. Make sure that Docker is running and accessible at the expected socket path. If Docker isn't working you have two options:
+
+ 1) Set the DOCKER_SOCKET environment variable to a socket path that can be used to connect to Docker or
+ 2) Set the ZEROEX_DATA_PIPELINE_TEST_DB_URL environment variable to connect directly to an existing Postgres database instead of trying to start Postgres via Docker
+`);
+ }
+ savedDocker = new Docker({
+ socketPath,
+ });
+ return savedDocker;
+}
+
+// Creates the container, waits for it to initialize, and returns it.
+async function initContainerAsync(): Promise<Docker.Container> {
+ const docker = initDockerOnce();
+
+ // Tear down any existing containers with the same name.
+ await tearDownExistingContainerIfAnyAsync();
+
+ // Pull the image we need.
+ await pullImageAsync(docker, DOCKER_IMAGE_NAME);
+
+ // Create the container.
+ const postgresContainer = await docker.createContainer({
+ name: DOCKER_CONTAINER_NAME,
+ Image: DOCKER_IMAGE_NAME,
+ ExposedPorts: {
+ '5432': {},
+ },
+ HostConfig: {
+ PortBindings: {
+ '5432': [
+ {
+ HostPort: POSTGRES_HOST_PORT,
+ },
+ ],
+ },
+ },
+ });
+ await postgresContainer.start();
+ await sleepAsync(POSTGRES_SETUP_DELAY_MS);
+ return postgresContainer;
+}
+
+async function tearDownExistingContainerIfAnyAsync(): Promise<void> {
+ const docker = initDockerOnce();
+
+ // Check if a container with the desired name already exists. If so, this
+ // probably means we didn't clean up properly on the last test run.
+ const existingContainer = docker.getContainer(DOCKER_CONTAINER_NAME);
+ if (existingContainer != null) {
+ try {
+ await existingContainer.kill();
+ } catch {
+ // If this fails, it's fine. The container was probably already
+ // killed.
+ }
+ try {
+ await existingContainer.remove();
+ } catch {
+ // If this fails, it's fine. The container was probably already
+ // removed.
+ }
+ }
+}
+
+function needsDocker(): boolean {
+ return process.env.ZEROEX_DATA_PIPELINE_TEST_DB_URL === undefined;
+}
+
+// Note(albrow): This is partially based on
+// https://stackoverflow.com/questions/38258263/how-do-i-wait-for-a-pull
+async function pullImageAsync(docker: Docker, imageName: string): Promise<void> {
+ return new Promise<void>((resolve, reject) => {
+ docker.pull(imageName, {}, (err, stream) => {
+ if (err != null) {
+ reject(err);
+ return;
+ }
+ docker.modem.followProgress(stream, () => {
+ resolve();
+ });
+ });
+ });
+}
diff --git a/packages/pipeline/test/entities/block_test.ts b/packages/pipeline/test/entities/block_test.ts
new file mode 100644
index 000000000..503f284f0
--- /dev/null
+++ b/packages/pipeline/test/entities/block_test.ts
@@ -0,0 +1,23 @@
+import 'mocha';
+import 'reflect-metadata';
+
+import { Block } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+// tslint:disable:custom-no-magic-numbers
+describe('Block entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const block = new Block();
+ block.hash = '0x12345';
+ block.number = 1234567;
+ block.timestamp = 5432154321;
+ const blocksRepository = connection.getRepository(Block);
+ await testSaveAndFindEntityAsync(blocksRepository, block);
+ });
+});
diff --git a/packages/pipeline/test/entities/copper_test.ts b/packages/pipeline/test/entities/copper_test.ts
new file mode 100644
index 000000000..2543364e6
--- /dev/null
+++ b/packages/pipeline/test/entities/copper_test.ts
@@ -0,0 +1,54 @@
+import 'mocha';
+import 'reflect-metadata';
+
+import {
+ CopperActivity,
+ CopperActivityType,
+ CopperCustomField,
+ CopperLead,
+ CopperOpportunity,
+} from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import {
+ ParsedActivities,
+ ParsedActivityTypes,
+ ParsedCustomFields,
+ ParsedLeads,
+ ParsedOpportunities,
+} from '../fixtures/copper/parsed_entities';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+describe('Copper entities', () => {
+ describe('save and find', async () => {
+ it('Copper lead', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const repository = connection.getRepository(CopperLead);
+ ParsedLeads.forEach(async entity => testSaveAndFindEntityAsync(repository, entity));
+ });
+ it('Copper activity', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const repository = connection.getRepository(CopperActivity);
+ ParsedActivities.forEach(async entity => testSaveAndFindEntityAsync(repository, entity));
+ });
+ // searching on jsonb fields is broken in typeorm
+ it.skip('Copper opportunity', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const repository = connection.getRepository(CopperOpportunity);
+ ParsedOpportunities.forEach(async entity => testSaveAndFindEntityAsync(repository, entity));
+ });
+ it('Copper activity type', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const repository = connection.getRepository(CopperActivityType);
+ ParsedActivityTypes.forEach(async entity => testSaveAndFindEntityAsync(repository, entity));
+ });
+ it('Copper custom field', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const repository = connection.getRepository(CopperCustomField);
+ ParsedCustomFields.forEach(async entity => testSaveAndFindEntityAsync(repository, entity));
+ });
+ });
+});
diff --git a/packages/pipeline/test/entities/dex_trades_test.ts b/packages/pipeline/test/entities/dex_trades_test.ts
new file mode 100644
index 000000000..83aaeec8f
--- /dev/null
+++ b/packages/pipeline/test/entities/dex_trades_test.ts
@@ -0,0 +1,60 @@
+import { BigNumber } from '@0x/utils';
+import 'mocha';
+import * as R from 'ramda';
+import 'reflect-metadata';
+
+import { DexTrade } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+const baseTrade = {
+ sourceUrl: 'https://bloxy.info/api/dex/trades',
+ txTimestamp: 1543447585938,
+ txDate: '2018-11-21',
+ txSender: '0x00923b9a074762b93650716333b3e1473a15048e',
+ smartContractId: 7091917,
+ smartContractAddress: '0x818e6fecd516ecc3849daf6845e3ec868087b755',
+ contractType: 'DEX/Kyber Network Proxy',
+ maker: '0xbf2179859fc6d5bee9bf9158632dc51678a4100c',
+ taker: '0xbf2179859fc6d5bee9bf9158632dc51678a4100d',
+ amountBuy: new BigNumber('1.011943163078103'),
+ makerFeeAmount: new BigNumber(0),
+ buyCurrencyId: 1,
+ buySymbol: 'ETH',
+ amountSell: new BigNumber('941.4997928436911'),
+ takerFeeAmount: new BigNumber(0),
+ sellCurrencyId: 16610,
+ sellSymbol: 'ELF',
+ makerAnnotation: '',
+ takerAnnotation: '',
+ protocol: 'Kyber Network Proxy',
+ sellAddress: '0xbf2179859fc6d5bee9bf9158632dc51678a4100e',
+};
+
+const tradeWithNullAddresses: DexTrade = R.merge(baseTrade, {
+ txHash: '0xb93a7faf92efbbb5405c9a73cd4efd99702fe27c03ff22baee1f1b1e37b3a0bf',
+ buyAddress: '0xbf2179859fc6d5bee9bf9158632dc51678a4100e',
+ sellAddress: '0xbf2179859fc6d5bee9bf9158632dc51678a4100f',
+});
+
+const tradeWithNonNullAddresses: DexTrade = R.merge(baseTrade, {
+ txHash: '0xb93a7faf92efbbb5405c9a73cd4efd99702fe27c03ff22baee1f1b1e37b3a0be',
+ buyAddress: null,
+ sellAddress: null,
+});
+
+// tslint:disable:custom-no-magic-numbers
+describe('DexTrade entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const trades = [tradeWithNullAddresses, tradeWithNonNullAddresses];
+ const tradesRepository = connection.getRepository(DexTrade);
+ for (const trade of trades) {
+ await testSaveAndFindEntityAsync(tradesRepository, trade);
+ }
+ });
+});
diff --git a/packages/pipeline/test/entities/erc20_approval_events_test.ts b/packages/pipeline/test/entities/erc20_approval_events_test.ts
new file mode 100644
index 000000000..1ecf41ee5
--- /dev/null
+++ b/packages/pipeline/test/entities/erc20_approval_events_test.ts
@@ -0,0 +1,29 @@
+import { BigNumber } from '@0x/utils';
+import 'mocha';
+import 'reflect-metadata';
+
+import { ERC20ApprovalEvent } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+// tslint:disable:custom-no-magic-numbers
+describe('ERC20ApprovalEvent entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const event = new ERC20ApprovalEvent();
+ event.tokenAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
+ event.blockNumber = 6281577;
+ event.rawData = '0x000000000000000000000000000000000000000000000002b9cba5ee21ad3df9';
+ event.logIndex = 43;
+ event.transactionHash = '0xcb46b19c786376a0a0140d51e3e606a4c4f926d8ca5434e96d2f69d04d8d9c7f';
+ event.ownerAddress = '0x0b65c5f6f3a05d6be5588a72b603360773b3fe04';
+ event.spenderAddress = '0x448a5065aebb8e423f0896e6c5d525c040f59af3';
+ event.amount = new BigNumber('50281464906893835769');
+ const blocksRepository = connection.getRepository(ERC20ApprovalEvent);
+ await testSaveAndFindEntityAsync(blocksRepository, event);
+ });
+});
diff --git a/packages/pipeline/test/entities/exchange_cancel_event_test.ts b/packages/pipeline/test/entities/exchange_cancel_event_test.ts
new file mode 100644
index 000000000..f3b306d69
--- /dev/null
+++ b/packages/pipeline/test/entities/exchange_cancel_event_test.ts
@@ -0,0 +1,57 @@
+import 'mocha';
+import * as R from 'ramda';
+import 'reflect-metadata';
+
+import { ExchangeCancelEvent } from '../../src/entities';
+import { AssetType } from '../../src/types';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+const baseCancelEvent = {
+ contractAddress: '0x4f833a24e1f95d70f028921e27040ca56e09ab0b',
+ logIndex: 1234,
+ blockNumber: 6276262,
+ rawData: '0x000000000000000000000000f6da68519f78b0d0bc93c701e86affcb75c92428',
+ transactionHash: '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd33657fe',
+ makerAddress: '0xf6da68519f78b0d0bc93c701e86affcb75c92428',
+ takerAddress: '0xf6da68519f78b0d0bc93c701e86affcb75c92428',
+ feeRecipientAddress: '0xc370d2a5920344aa6b7d8d11250e3e861434cbdd',
+ senderAddress: '0xf6da68519f78b0d0bc93c701e86affcb75c92428',
+ orderHash: '0xab12ed2cbaa5615ab690b9da75a46e53ddfcf3f1a68655b5fe0d94c75a1aac4a',
+ rawMakerAssetData: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ makerAssetProxyId: '0xf47261b0',
+ makerTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ rawTakerAssetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498',
+ takerAssetProxyId: '0xf47261b0',
+ takerTokenAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+};
+
+const erc20CancelEvent = R.merge(baseCancelEvent, {
+ makerAssetType: 'erc20' as AssetType,
+ makerTokenId: null,
+ takerAssetType: 'erc20' as AssetType,
+ takerTokenId: null,
+});
+
+const erc721CancelEvent = R.merge(baseCancelEvent, {
+ makerAssetType: 'erc721' as AssetType,
+ makerTokenId: '19378573',
+ takerAssetType: 'erc721' as AssetType,
+ takerTokenId: '63885673888',
+});
+
+// tslint:disable:custom-no-magic-numbers
+describe('ExchangeCancelEvent entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const events = [erc20CancelEvent, erc721CancelEvent];
+ const cancelEventRepository = connection.getRepository(ExchangeCancelEvent);
+ for (const event of events) {
+ await testSaveAndFindEntityAsync(cancelEventRepository, event);
+ }
+ });
+});
diff --git a/packages/pipeline/test/entities/exchange_cancel_up_to_event_test.ts b/packages/pipeline/test/entities/exchange_cancel_up_to_event_test.ts
new file mode 100644
index 000000000..aa34f8c1c
--- /dev/null
+++ b/packages/pipeline/test/entities/exchange_cancel_up_to_event_test.ts
@@ -0,0 +1,29 @@
+import { BigNumber } from '@0x/utils';
+import 'mocha';
+import 'reflect-metadata';
+
+import { ExchangeCancelUpToEvent } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+// tslint:disable:custom-no-magic-numbers
+describe('ExchangeCancelUpToEvent entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const cancelUpToEventRepository = connection.getRepository(ExchangeCancelUpToEvent);
+ const cancelUpToEvent = new ExchangeCancelUpToEvent();
+ cancelUpToEvent.blockNumber = 6276262;
+ cancelUpToEvent.contractAddress = '0x4f833a24e1f95d70f028921e27040ca56e09ab0b';
+ cancelUpToEvent.logIndex = 42;
+ cancelUpToEvent.makerAddress = '0xf6da68519f78b0d0bc93c701e86affcb75c92428';
+ cancelUpToEvent.orderEpoch = new BigNumber('123456789123456789');
+ cancelUpToEvent.rawData = '0x000000000000000000000000f6da68519f78b0d0bc93c701e86affcb75c92428';
+ cancelUpToEvent.senderAddress = '0xf6da68519f78b0d0bc93c701e86affcb75c92428';
+ cancelUpToEvent.transactionHash = '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd33657fe';
+ await testSaveAndFindEntityAsync(cancelUpToEventRepository, cancelUpToEvent);
+ });
+});
diff --git a/packages/pipeline/test/entities/exchange_fill_event_test.ts b/packages/pipeline/test/entities/exchange_fill_event_test.ts
new file mode 100644
index 000000000..b2cb8c5e0
--- /dev/null
+++ b/packages/pipeline/test/entities/exchange_fill_event_test.ts
@@ -0,0 +1,62 @@
+import { BigNumber } from '@0x/utils';
+import 'mocha';
+import * as R from 'ramda';
+import 'reflect-metadata';
+
+import { ExchangeFillEvent } from '../../src/entities';
+import { AssetType } from '../../src/types';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+const baseFillEvent = {
+ contractAddress: '0x4f833a24e1f95d70f028921e27040ca56e09ab0b',
+ blockNumber: 6276262,
+ logIndex: 102,
+ rawData: '0x000000000000000000000000f6da68519f78b0d0bc93c701e86affcb75c92428',
+ transactionHash: '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd33657fe',
+ makerAddress: '0xf6da68519f78b0d0bc93c701e86affcb75c92428',
+ takerAddress: '0xf6da68519f78b0d0bc93c701e86affcb75c92428',
+ feeRecipientAddress: '0xc370d2a5920344aa6b7d8d11250e3e861434cbdd',
+ senderAddress: '0xf6da68519f78b0d0bc93c701e86affcb75c92428',
+ makerAssetFilledAmount: new BigNumber('10000000000000000'),
+ takerAssetFilledAmount: new BigNumber('100000000000000000'),
+ makerFeePaid: new BigNumber('0'),
+ takerFeePaid: new BigNumber('12345'),
+ orderHash: '0xab12ed2cbaa5615ab690b9da75a46e53ddfcf3f1a68655b5fe0d94c75a1aac4a',
+ rawMakerAssetData: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ makerAssetProxyId: '0xf47261b0',
+ makerTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ rawTakerAssetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498',
+ takerAssetProxyId: '0xf47261b0',
+ takerTokenAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+};
+
+const erc20FillEvent = R.merge(baseFillEvent, {
+ makerAssetType: 'erc20' as AssetType,
+ makerTokenId: null,
+ takerAssetType: 'erc20' as AssetType,
+ takerTokenId: null,
+});
+
+const erc721FillEvent = R.merge(baseFillEvent, {
+ makerAssetType: 'erc721' as AssetType,
+ makerTokenId: '19378573',
+ takerAssetType: 'erc721' as AssetType,
+ takerTokenId: '63885673888',
+});
+
+// tslint:disable:custom-no-magic-numbers
+describe('ExchangeFillEvent entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const events = [erc20FillEvent, erc721FillEvent];
+ const fillEventsRepository = connection.getRepository(ExchangeFillEvent);
+ for (const event of events) {
+ await testSaveAndFindEntityAsync(fillEventsRepository, event);
+ }
+ });
+});
diff --git a/packages/pipeline/test/entities/ohlcv_external_test.ts b/packages/pipeline/test/entities/ohlcv_external_test.ts
new file mode 100644
index 000000000..8b995db50
--- /dev/null
+++ b/packages/pipeline/test/entities/ohlcv_external_test.ts
@@ -0,0 +1,35 @@
+import 'mocha';
+import 'reflect-metadata';
+
+import { OHLCVExternal } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+const ohlcvExternal: OHLCVExternal = {
+ exchange: 'CCCAGG',
+ fromSymbol: 'ETH',
+ toSymbol: 'ZRX',
+ startTime: 1543352400000,
+ endTime: 1543356000000,
+ open: 307.41,
+ close: 310.08,
+ low: 304.6,
+ high: 310.27,
+ volumeFrom: 904.6,
+ volumeTo: 278238.5,
+ source: 'Crypto Compare',
+ observedTimestamp: 1543442338074,
+};
+
+// tslint:disable:custom-no-magic-numbers
+describe('OHLCVExternal entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const repository = connection.getRepository(OHLCVExternal);
+ await testSaveAndFindEntityAsync(repository, ohlcvExternal);
+ });
+});
diff --git a/packages/pipeline/test/entities/relayer_test.ts b/packages/pipeline/test/entities/relayer_test.ts
new file mode 100644
index 000000000..760ffb6f9
--- /dev/null
+++ b/packages/pipeline/test/entities/relayer_test.ts
@@ -0,0 +1,55 @@
+import 'mocha';
+import * as R from 'ramda';
+import 'reflect-metadata';
+
+import { Relayer } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+const baseRelayer = {
+ uuid: 'e8d27d8d-ddf6-48b1-9663-60b0a3ddc716',
+ name: 'Radar Relay',
+ homepageUrl: 'https://radarrelay.com',
+ appUrl: null,
+ sraHttpEndpoint: null,
+ sraWsEndpoint: null,
+ feeRecipientAddresses: [],
+ takerAddresses: [],
+};
+
+const relayerWithUrls = R.merge(baseRelayer, {
+ uuid: 'e8d27d8d-ddf6-48b1-9663-60b0a3ddc717',
+ appUrl: 'https://app.radarrelay.com',
+ sraHttpEndpoint: 'https://api.radarrelay.com/0x/v2/',
+ sraWsEndpoint: 'wss://ws.radarrelay.com/0x/v2',
+});
+
+const relayerWithAddresses = R.merge(baseRelayer, {
+ uuid: 'e8d27d8d-ddf6-48b1-9663-60b0a3ddc718',
+ feeRecipientAddresses: [
+ '0xa258b39954cef5cb142fd567a46cddb31a670124',
+ '0xa258b39954cef5cb142fd567a46cddb31a670125',
+ '0xa258b39954cef5cb142fd567a46cddb31a670126',
+ ],
+ takerAddresses: [
+ '0xa258b39954cef5cb142fd567a46cddb31a670127',
+ '0xa258b39954cef5cb142fd567a46cddb31a670128',
+ '0xa258b39954cef5cb142fd567a46cddb31a670129',
+ ],
+});
+
+// tslint:disable:custom-no-magic-numbers
+describe('Relayer entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const relayers = [baseRelayer, relayerWithUrls, relayerWithAddresses];
+ const relayerRepository = connection.getRepository(Relayer);
+ for (const relayer of relayers) {
+ await testSaveAndFindEntityAsync(relayerRepository, relayer);
+ }
+ });
+});
diff --git a/packages/pipeline/test/entities/sra_order_test.ts b/packages/pipeline/test/entities/sra_order_test.ts
new file mode 100644
index 000000000..c43de8ce8
--- /dev/null
+++ b/packages/pipeline/test/entities/sra_order_test.ts
@@ -0,0 +1,84 @@
+import { BigNumber } from '@0x/utils';
+import 'mocha';
+import * as R from 'ramda';
+import 'reflect-metadata';
+import { Repository } from 'typeorm';
+
+import { SraOrder, SraOrdersObservedTimeStamp } from '../../src/entities';
+import { AssetType } from '../../src/types';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+const baseOrder = {
+ sourceUrl: 'https://api.radarrelay.com/0x/v2',
+ exchangeAddress: '0x4f833a24e1f95d70f028921e27040ca56e09ab0b',
+ makerAddress: '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81',
+ takerAddress: '0x0000000000000000000000000000000000000000',
+ feeRecipientAddress: '0xa258b39954cef5cb142fd567a46cddb31a670124',
+ senderAddress: '0x0000000000000000000000000000000000000000',
+ makerAssetAmount: new BigNumber('1619310371000000000'),
+ takerAssetAmount: new BigNumber('8178335207070707070707'),
+ makerFee: new BigNumber('100'),
+ takerFee: new BigNumber('200'),
+ expirationTimeSeconds: new BigNumber('1538529488'),
+ salt: new BigNumber('1537924688891'),
+ signature: '0x1b5a5d672b0d647b5797387ccbb89d8',
+ rawMakerAssetData: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ makerAssetProxyId: '0xf47261b0',
+ makerTokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ rawTakerAssetData: '0xf47261b000000000000000000000000042d6622dece394b54999fbd73d108123806f6a18',
+ takerAssetProxyId: '0xf47261b0',
+ takerTokenAddress: '0x42d6622dece394b54999fbd73d108123806f6a18',
+ metadataJson: '{"isThisArbitraryData":true,"powerLevel":9001}',
+};
+
+const erc20Order = R.merge(baseOrder, {
+ orderHashHex: '0x1bdbeb0d088a33da28b9ee6d94e8771452f90f4a69107da2fa75195d61b9a1c9',
+ makerAssetType: 'erc20' as AssetType,
+ makerTokenId: null,
+ takerAssetType: 'erc20' as AssetType,
+ takerTokenId: null,
+});
+
+const erc721Order = R.merge(baseOrder, {
+ orderHashHex: '0x1bdbeb0d088a33da28b9ee6d94e8771452f90f4a69107da2fa75195d61b9a1d0',
+ makerAssetType: 'erc721' as AssetType,
+ makerTokenId: '19378573',
+ takerAssetType: 'erc721' as AssetType,
+ takerTokenId: '63885673888',
+});
+
+// tslint:disable:custom-no-magic-numbers
+describe('SraOrder and SraOrdersObservedTimeStamp entities', () => {
+ // Note(albrow): SraOrder and SraOrdersObservedTimeStamp are tightly coupled
+ // and timestamps have a foreign key constraint such that they have to point
+ // to an existing SraOrder. For these reasons, we are testing them together
+ // in the same test.
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const orderRepository = connection.getRepository(SraOrder);
+ const timestampRepository = connection.getRepository(SraOrdersObservedTimeStamp);
+ const orders = [erc20Order, erc721Order];
+ for (const order of orders) {
+ await testOrderWithTimestampAsync(orderRepository, timestampRepository, order);
+ }
+ });
+});
+
+async function testOrderWithTimestampAsync(
+ orderRepository: Repository<SraOrder>,
+ timestampRepository: Repository<SraOrdersObservedTimeStamp>,
+ order: SraOrder,
+): Promise<void> {
+ await testSaveAndFindEntityAsync(orderRepository, order);
+ const timestamp = new SraOrdersObservedTimeStamp();
+ timestamp.exchangeAddress = order.exchangeAddress;
+ timestamp.orderHashHex = order.orderHashHex;
+ timestamp.sourceUrl = order.sourceUrl;
+ timestamp.observedTimestamp = 1543377376153;
+ await testSaveAndFindEntityAsync(timestampRepository, timestamp);
+}
diff --git a/packages/pipeline/test/entities/token_metadata_test.ts b/packages/pipeline/test/entities/token_metadata_test.ts
new file mode 100644
index 000000000..48e656644
--- /dev/null
+++ b/packages/pipeline/test/entities/token_metadata_test.ts
@@ -0,0 +1,39 @@
+import { BigNumber } from '@0x/utils';
+import 'mocha';
+import 'reflect-metadata';
+
+import { TokenMetadata } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+const metadataWithoutNullFields: TokenMetadata = {
+ address: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ authority: 'https://website-api.0xproject.com/tokens',
+ decimals: new BigNumber(18),
+ symbol: 'ZRX',
+ name: '0x',
+};
+
+const metadataWithNullFields: TokenMetadata = {
+ address: '0xe41d2489571d322189246dafa5ebde1f4699f499',
+ authority: 'https://website-api.0xproject.com/tokens',
+ decimals: null,
+ symbol: null,
+ name: null,
+};
+
+// tslint:disable:custom-no-magic-numbers
+describe('TokenMetadata entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const tokenMetadata = [metadataWithoutNullFields, metadataWithNullFields];
+ const tokenMetadataRepository = connection.getRepository(TokenMetadata);
+ for (const tokenMetadatum of tokenMetadata) {
+ await testSaveAndFindEntityAsync(tokenMetadataRepository, tokenMetadatum);
+ }
+ });
+});
diff --git a/packages/pipeline/test/entities/token_order_test.ts b/packages/pipeline/test/entities/token_order_test.ts
new file mode 100644
index 000000000..c6057f5aa
--- /dev/null
+++ b/packages/pipeline/test/entities/token_order_test.ts
@@ -0,0 +1,31 @@
+import { BigNumber } from '@0x/utils';
+import 'mocha';
+
+import { TokenOrderbookSnapshot } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+const tokenOrderbookSnapshot: TokenOrderbookSnapshot = {
+ source: 'ddextest',
+ observedTimestamp: Date.now(),
+ orderType: 'bid',
+ price: new BigNumber(10.1),
+ baseAssetSymbol: 'ETH',
+ baseAssetAddress: '0x818e6fecd516ecc3849daf6845e3ec868087b755',
+ baseVolume: new BigNumber(143),
+ quoteAssetSymbol: 'ABC',
+ quoteAssetAddress: '0x00923b9a074762b93650716333b3e1473a15048e',
+ quoteVolume: new BigNumber(12.3234234),
+};
+
+describe('TokenOrderbookSnapshot entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const tokenOrderbookSnapshotRepository = connection.getRepository(TokenOrderbookSnapshot);
+ await testSaveAndFindEntityAsync(tokenOrderbookSnapshotRepository, tokenOrderbookSnapshot);
+ });
+});
diff --git a/packages/pipeline/test/entities/transaction_test.ts b/packages/pipeline/test/entities/transaction_test.ts
new file mode 100644
index 000000000..634844544
--- /dev/null
+++ b/packages/pipeline/test/entities/transaction_test.ts
@@ -0,0 +1,26 @@
+import { BigNumber } from '@0x/utils';
+import 'mocha';
+import 'reflect-metadata';
+
+import { Transaction } from '../../src/entities';
+import { createDbConnectionOnceAsync } from '../db_setup';
+import { chaiSetup } from '../utils/chai_setup';
+
+import { testSaveAndFindEntityAsync } from './util';
+
+chaiSetup.configure();
+
+// tslint:disable:custom-no-magic-numbers
+describe('Transaction entity', () => {
+ it('save/find', async () => {
+ const connection = await createDbConnectionOnceAsync();
+ const transactionRepository = connection.getRepository(Transaction);
+ const transaction = new Transaction();
+ transaction.blockHash = '0x6ff106d00b6c3746072fc06bae140fb2549036ba7bcf9184ae19a42fd33657fd';
+ transaction.blockNumber = 6276262;
+ transaction.gasPrice = new BigNumber(3000000);
+ transaction.gasUsed = new BigNumber(125000);
+ transaction.transactionHash = '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd33657fe';
+ await testSaveAndFindEntityAsync(transactionRepository, transaction);
+ });
+});
diff --git a/packages/pipeline/test/entities/util.ts b/packages/pipeline/test/entities/util.ts
new file mode 100644
index 000000000..42df23a4a
--- /dev/null
+++ b/packages/pipeline/test/entities/util.ts
@@ -0,0 +1,25 @@
+import * as chai from 'chai';
+import 'mocha';
+
+import { Repository } from 'typeorm';
+
+const expect = chai.expect;
+
+/**
+ * First saves the given entity to the database, then finds it and makes sure
+ * that the found entity is exactly equal to the original one. This is a bare
+ * minimum basic test to make sure that the entity type definition and our
+ * database schema are aligned and that it is possible to save and find the
+ * entity.
+ * @param repository A TypeORM repository corresponding with the type of the entity.
+ * @param entity An instance of a TypeORM entity which will be saved/retrieved from the database.
+ */
+export async function testSaveAndFindEntityAsync<T>(repository: Repository<T>, entity: T): Promise<void> {
+ // Note(albrow): We are forced to use an 'any' hack here because
+ // TypeScript complains about stack depth when checking the types.
+ await repository.save<any>(entity);
+ const gotEntity = await repository.findOneOrFail({
+ where: entity,
+ });
+ expect(gotEntity).deep.equal(entity);
+}
diff --git a/packages/pipeline/test/fixtures/copper/api_v1_activity_types.json b/packages/pipeline/test/fixtures/copper/api_v1_activity_types.json
new file mode 100644
index 000000000..dbd39c31b
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/api_v1_activity_types.json
@@ -0,0 +1,24 @@
+{
+ "user": [
+ { "id": 0, "category": "user", "name": "Note", "is_disabled": false, "count_as_interaction": false },
+ { "id": 660496, "category": "user", "name": "To Do", "is_disabled": false, "count_as_interaction": false },
+ { "id": 660495, "category": "user", "name": "Meeting", "is_disabled": false, "count_as_interaction": true },
+ { "id": 660494, "category": "user", "name": "Phone Call", "is_disabled": false, "count_as_interaction": true }
+ ],
+ "system": [
+ {
+ "id": 1,
+ "category": "system",
+ "name": "Property Changed",
+ "is_disabled": false,
+ "count_as_interaction": false
+ },
+ {
+ "id": 3,
+ "category": "system",
+ "name": "Pipeline Stage Changed",
+ "is_disabled": false,
+ "count_as_interaction": false
+ }
+ ]
+}
diff --git a/packages/pipeline/test/fixtures/copper/api_v1_activity_types.ts b/packages/pipeline/test/fixtures/copper/api_v1_activity_types.ts
new file mode 100644
index 000000000..fd2d62a6c
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/api_v1_activity_types.ts
@@ -0,0 +1,16 @@
+import { CopperActivityType } from '../../../src/entities';
+const ParsedActivityTypes: CopperActivityType[] = [
+ { id: 0, name: 'Note', category: 'user', isDisabled: false, countAsInteraction: false },
+ { id: 660496, name: 'To Do', category: 'user', isDisabled: false, countAsInteraction: false },
+ { id: 660495, name: 'Meeting', category: 'user', isDisabled: false, countAsInteraction: true },
+ { id: 660494, name: 'Phone Call', category: 'user', isDisabled: false, countAsInteraction: true },
+ { id: 1, name: 'Property Changed', category: 'system', isDisabled: false, countAsInteraction: false },
+ {
+ id: 3,
+ name: 'Pipeline Stage Changed',
+ category: 'system',
+ isDisabled: false,
+ countAsInteraction: false,
+ },
+];
+export { ParsedActivityTypes };
diff --git a/packages/pipeline/test/fixtures/copper/api_v1_custom_field_definitions.json b/packages/pipeline/test/fixtures/copper/api_v1_custom_field_definitions.json
new file mode 100644
index 000000000..c6665cb0f
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/api_v1_custom_field_definitions.json
@@ -0,0 +1,38 @@
+[
+ {
+ "id": 261066,
+ "name": "Integration Type",
+ "canonical_name": null,
+ "data_type": "MultiSelect",
+ "available_on": ["opportunity", "company", "person"],
+ "options": [
+ { "id": 394020, "name": "Strategic Relationship", "rank": 7 },
+ { "id": 394013, "name": "ERC-20 Exchange", "rank": 0 },
+ { "id": 394014, "name": "ERC-721 Marketplace", "rank": 1 },
+ { "id": 394015, "name": "Trade Widget", "rank": 2 },
+ { "id": 394016, "name": "Prediction Market Exchange", "rank": 3 },
+ { "id": 394017, "name": "Security Token Exchange", "rank": 4 },
+ { "id": 394018, "name": "Complementary Company", "rank": 5 },
+ { "id": 394019, "name": "Service Provider", "rank": 6 }
+ ]
+ },
+ {
+ "id": 261067,
+ "name": "Company Type",
+ "canonical_name": null,
+ "data_type": "Dropdown",
+ "available_on": ["company", "opportunity", "person"],
+ "options": [
+ { "id": 394129, "name": "Market Maker", "rank": 6 },
+ { "id": 394130, "name": "Events", "rank": 2 },
+ { "id": 394023, "name": "Exchange", "rank": 3 },
+ { "id": 394024, "name": "Investor", "rank": 5 },
+ { "id": 394026, "name": "Service Provider", "rank": 8 },
+ { "id": 394027, "name": "Wallet", "rank": 9 },
+ { "id": 394134, "name": "Game", "rank": 4 },
+ { "id": 394025, "name": "OTC", "rank": 7 },
+ { "id": 394021, "name": "Blockchain/Protocol", "rank": 0 },
+ { "id": 394022, "name": "dApp", "rank": 1 }
+ ]
+ }
+]
diff --git a/packages/pipeline/test/fixtures/copper/api_v1_custom_field_definitions.ts b/packages/pipeline/test/fixtures/copper/api_v1_custom_field_definitions.ts
new file mode 100644
index 000000000..a44bbd2c3
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/api_v1_custom_field_definitions.ts
@@ -0,0 +1,39 @@
+import { CopperCustomField } from '../../../src/entities';
+const ParsedCustomFields: CopperCustomField[] = [
+ {
+ id: 394020,
+ name: 'Strategic Relationship',
+ dataType: 'Integration Type',
+ fieldType: 'option',
+ },
+ { id: 394013, name: 'ERC-20 Exchange', dataType: 'Integration Type', fieldType: 'option' },
+ { id: 394014, name: 'ERC-721 Marketplace', dataType: 'Integration Type', fieldType: 'option' },
+ { id: 394015, name: 'Trade Widget', dataType: 'Integration Type', fieldType: 'option' },
+ {
+ id: 394016,
+ name: 'Prediction Market Exchange',
+ dataType: 'Integration Type',
+ fieldType: 'option',
+ },
+ {
+ id: 394017,
+ name: 'Security Token Exchange',
+ dataType: 'Integration Type',
+ fieldType: 'option',
+ },
+ { id: 394018, name: 'Complementary Company', dataType: 'Integration Type', fieldType: 'option' },
+ { id: 394019, name: 'Service Provider', dataType: 'Integration Type', fieldType: 'option' },
+ { id: 261066, name: 'Integration Type', dataType: 'MultiSelect' },
+ { id: 394129, name: 'Market Maker', dataType: 'Company Type', fieldType: 'option' },
+ { id: 394130, name: 'Events', dataType: 'Company Type', fieldType: 'option' },
+ { id: 394023, name: 'Exchange', dataType: 'Company Type', fieldType: 'option' },
+ { id: 394024, name: 'Investor', dataType: 'Company Type', fieldType: 'option' },
+ { id: 394026, name: 'Service Provider', dataType: 'Company Type', fieldType: 'option' },
+ { id: 394027, name: 'Wallet', dataType: 'Company Type', fieldType: 'option' },
+ { id: 394134, name: 'Game', dataType: 'Company Type', fieldType: 'option' },
+ { id: 394025, name: 'OTC', dataType: 'Company Type', fieldType: 'option' },
+ { id: 394021, name: 'Blockchain/Protocol', dataType: 'Company Type', fieldType: 'option' },
+ { id: 394022, name: 'dApp', dataType: 'Company Type', fieldType: 'option' },
+ { id: 261067, name: 'Company Type', dataType: 'Dropdown' },
+];
+export { ParsedCustomFields };
diff --git a/packages/pipeline/test/fixtures/copper/api_v1_list_activities.json b/packages/pipeline/test/fixtures/copper/api_v1_list_activities.json
new file mode 100644
index 000000000..a726111ac
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/api_v1_list_activities.json
@@ -0,0 +1,242 @@
+[
+ {
+ "id": 5015299552,
+ "parent": { "id": 14667512, "type": "opportunity" },
+ "type": { "id": 3, "category": "system", "name": "Stage Change" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1545329595,
+ "old_value": { "id": 2392929, "name": "Evaluation" },
+ "new_value": { "id": 2392931, "name": "Integration Started" },
+ "date_created": 1545329595,
+ "date_modified": 1545329595
+ },
+ {
+ "id": 5010214065,
+ "parent": { "id": 14978865, "type": "opportunity" },
+ "type": { "id": 3, "category": "system", "name": "Stage Change" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1545245706,
+ "old_value": { "id": 2392928, "name": "Intro" },
+ "new_value": { "id": 2392929, "name": "Evaluation" },
+ "date_created": 1545245706,
+ "date_modified": 1545245706
+ },
+ {
+ "id": 5006149111,
+ "parent": { "id": 70430977, "type": "person" },
+ "type": { "id": 660495, "category": "user" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1545166908,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1545168280,
+ "date_modified": 1545166908
+ },
+ {
+ "id": 5005314622,
+ "parent": { "id": 27778968, "type": "company" },
+ "type": { "id": 660495, "category": "user" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1545080504,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1545160479,
+ "date_modified": 1545080504
+ },
+ {
+ "id": 5000006802,
+ "parent": { "id": 14956518, "type": "opportunity" },
+ "type": { "id": 660495, "category": "user" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1545071374,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1545071500,
+ "date_modified": 1545071374
+ },
+ {
+ "id": 4985504199,
+ "parent": { "id": 14912790, "type": "opportunity" },
+ "type": { "id": 660495, "category": "user" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544644058,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1544644661,
+ "date_modified": 1544644058
+ },
+ {
+ "id": 4985456147,
+ "parent": { "id": 14912790, "type": "opportunity" },
+ "type": { "id": 660495, "category": "user" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544644048,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1544644053,
+ "date_modified": 1544644048
+ },
+ {
+ "id": 4980975996,
+ "parent": { "id": 14902828, "type": "opportunity" },
+ "type": { "id": 660495, "category": "user" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544563171,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1544563224,
+ "date_modified": 1544563171
+ },
+ {
+ "id": 4980910331,
+ "parent": { "id": 14902828, "type": "opportunity" },
+ "type": { "id": 3, "category": "system", "name": "Stage Change" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544562495,
+ "old_value": { "id": 2392928, "name": "Intro" },
+ "new_value": { "id": 2392931, "name": "Integration Started" },
+ "date_created": 1544562495,
+ "date_modified": 1544562495
+ },
+ {
+ "id": 4980872220,
+ "parent": { "id": 14888910, "type": "opportunity" },
+ "type": { "id": 660495, "category": "user" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544559279,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1544562118,
+ "date_modified": 1544559279
+ },
+ {
+ "id": 4980508097,
+ "parent": { "id": 14050167, "type": "opportunity" },
+ "type": { "id": 1, "category": "system", "name": "Status Change" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544558077,
+ "old_value": "Open",
+ "new_value": "Won",
+ "date_created": 1544558077,
+ "date_modified": 1544558077
+ },
+ {
+ "id": 4980508095,
+ "parent": { "id": 66538237, "type": "person" },
+ "type": { "id": 1, "category": "system" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544558077,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1544558077,
+ "date_modified": 1544558077
+ },
+ {
+ "id": 4980508092,
+ "parent": { "id": 27779020, "type": "company" },
+ "type": { "id": 1, "category": "system" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544558077,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1544558077,
+ "date_modified": 1544558077
+ },
+ {
+ "id": 4980507507,
+ "parent": { "id": 14050167, "type": "opportunity" },
+ "type": { "id": 3, "category": "system", "name": "Stage Change" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544558071,
+ "old_value": { "id": 2392931, "name": "Integration Started" },
+ "new_value": { "id": 2405442, "name": "Integration Complete" },
+ "date_created": 1544558071,
+ "date_modified": 1544558071
+ },
+ {
+ "id": 4980479684,
+ "parent": { "id": 14901232, "type": "opportunity" },
+ "type": { "id": 3, "category": "system", "name": "Stage Change" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544557777,
+ "old_value": { "id": 2392928, "name": "Intro" },
+ "new_value": { "id": 2392929, "name": "Evaluation" },
+ "date_created": 1544557777,
+ "date_modified": 1544557777
+ },
+ {
+ "id": 4980327164,
+ "parent": { "id": 14901232, "type": "opportunity" },
+ "type": { "id": 660495, "category": "user" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544554864,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1544556132,
+ "date_modified": 1544554864
+ },
+ {
+ "id": 4975270470,
+ "parent": { "id": 14888744, "type": "opportunity" },
+ "type": { "id": 3, "category": "system", "name": "Stage Change" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544469501,
+ "old_value": { "id": 2392928, "name": "Intro" },
+ "new_value": { "id": 2392931, "name": "Integration Started" },
+ "date_created": 1544469501,
+ "date_modified": 1544469501
+ },
+ {
+ "id": 4975255523,
+ "parent": { "id": 64713448, "type": "person" },
+ "type": { "id": 1, "category": "system" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544469389,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1544469389,
+ "date_modified": 1544469389
+ },
+ {
+ "id": 4975255519,
+ "parent": { "id": 13735617, "type": "opportunity" },
+ "type": { "id": 1, "category": "system", "name": "Status Change" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544469388,
+ "old_value": "Open",
+ "new_value": "Won",
+ "date_created": 1544469388,
+ "date_modified": 1544469388
+ },
+ {
+ "id": 4975255514,
+ "parent": { "id": 27778968, "type": "company" },
+ "type": { "id": 1, "category": "system" },
+ "user_id": 680302,
+ "details": "blah blah",
+ "activity_date": 1544469388,
+ "old_value": null,
+ "new_value": null,
+ "date_created": 1544469388,
+ "date_modified": 1544469388
+ }
+]
diff --git a/packages/pipeline/test/fixtures/copper/api_v1_list_activities.ts b/packages/pipeline/test/fixtures/copper/api_v1_list_activities.ts
new file mode 100644
index 000000000..51ee9ced3
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/api_v1_list_activities.ts
@@ -0,0 +1,305 @@
+import { CopperActivity } from '../../../src/entities';
+
+const ParsedActivities: CopperActivity[] = [
+ {
+ id: 5015299552,
+ parentId: 14667512,
+ parentType: 'opportunity',
+ typeId: 3,
+ typeCategory: 'system',
+ typeName: 'Stage Change',
+ userId: 680302,
+ dateCreated: 1545329595000,
+ dateModified: 1545329595000,
+ oldValueId: 2392929,
+ oldValueName: 'Evaluation',
+ newValueId: 2392931,
+ newValueName: 'Integration Started',
+ },
+ {
+ id: 5010214065,
+ parentId: 14978865,
+ parentType: 'opportunity',
+ typeId: 3,
+ typeCategory: 'system',
+ typeName: 'Stage Change',
+ userId: 680302,
+ dateCreated: 1545245706000,
+ dateModified: 1545245706000,
+ oldValueId: 2392928,
+ oldValueName: 'Intro',
+ newValueId: 2392929,
+ newValueName: 'Evaluation',
+ },
+ {
+ id: 5006149111,
+ parentId: 70430977,
+ parentType: 'person',
+ typeId: 660495,
+ typeCategory: 'user',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1545168280000,
+ dateModified: 1545166908000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 5005314622,
+ parentId: 27778968,
+ parentType: 'company',
+ typeId: 660495,
+ typeCategory: 'user',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1545160479000,
+ dateModified: 1545080504000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 5000006802,
+ parentId: 14956518,
+ parentType: 'opportunity',
+ typeId: 660495,
+ typeCategory: 'user',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1545071500000,
+ dateModified: 1545071374000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4985504199,
+ parentId: 14912790,
+ parentType: 'opportunity',
+ typeId: 660495,
+ typeCategory: 'user',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1544644661000,
+ dateModified: 1544644058000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4985456147,
+ parentId: 14912790,
+ parentType: 'opportunity',
+ typeId: 660495,
+ typeCategory: 'user',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1544644053000,
+ dateModified: 1544644048000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4980975996,
+ parentId: 14902828,
+ parentType: 'opportunity',
+ typeId: 660495,
+ typeCategory: 'user',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1544563224000,
+ dateModified: 1544563171000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4980910331,
+ parentId: 14902828,
+ parentType: 'opportunity',
+ typeId: 3,
+ typeCategory: 'system',
+ typeName: 'Stage Change',
+ userId: 680302,
+ dateCreated: 1544562495000,
+ dateModified: 1544562495000,
+ oldValueId: 2392928,
+ oldValueName: 'Intro',
+ newValueId: 2392931,
+ newValueName: 'Integration Started',
+ },
+ {
+ id: 4980872220,
+ parentId: 14888910,
+ parentType: 'opportunity',
+ typeId: 660495,
+ typeCategory: 'user',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1544562118000,
+ dateModified: 1544559279000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4980508097,
+ parentId: 14050167,
+ parentType: 'opportunity',
+ typeId: 1,
+ typeCategory: 'system',
+ typeName: 'Status Change',
+ userId: 680302,
+ dateCreated: 1544558077000,
+ dateModified: 1544558077000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4980508095,
+ parentId: 66538237,
+ parentType: 'person',
+ typeId: 1,
+ typeCategory: 'system',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1544558077000,
+ dateModified: 1544558077000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4980508092,
+ parentId: 27779020,
+ parentType: 'company',
+ typeId: 1,
+ typeCategory: 'system',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1544558077000,
+ dateModified: 1544558077000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4980507507,
+ parentId: 14050167,
+ parentType: 'opportunity',
+ typeId: 3,
+ typeCategory: 'system',
+ typeName: 'Stage Change',
+ userId: 680302,
+ dateCreated: 1544558071000,
+ dateModified: 1544558071000,
+ oldValueId: 2392931,
+ oldValueName: 'Integration Started',
+ newValueId: 2405442,
+ newValueName: 'Integration Complete',
+ },
+ {
+ id: 4980479684,
+ parentId: 14901232,
+ parentType: 'opportunity',
+ typeId: 3,
+ typeCategory: 'system',
+ typeName: 'Stage Change',
+ userId: 680302,
+ dateCreated: 1544557777000,
+ dateModified: 1544557777000,
+ oldValueId: 2392928,
+ oldValueName: 'Intro',
+ newValueId: 2392929,
+ newValueName: 'Evaluation',
+ },
+ {
+ id: 4980327164,
+ parentId: 14901232,
+ parentType: 'opportunity',
+ typeId: 660495,
+ typeCategory: 'user',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1544556132000,
+ dateModified: 1544554864000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4975270470,
+ parentId: 14888744,
+ parentType: 'opportunity',
+ typeId: 3,
+ typeCategory: 'system',
+ typeName: 'Stage Change',
+ userId: 680302,
+ dateCreated: 1544469501000,
+ dateModified: 1544469501000,
+ oldValueId: 2392928,
+ oldValueName: 'Intro',
+ newValueId: 2392931,
+ newValueName: 'Integration Started',
+ },
+ {
+ id: 4975255523,
+ parentId: 64713448,
+ parentType: 'person',
+ typeId: 1,
+ typeCategory: 'system',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1544469389000,
+ dateModified: 1544469389000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4975255519,
+ parentId: 13735617,
+ parentType: 'opportunity',
+ typeId: 1,
+ typeCategory: 'system',
+ typeName: 'Status Change',
+ userId: 680302,
+ dateCreated: 1544469388000,
+ dateModified: 1544469388000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+ {
+ id: 4975255514,
+ parentId: 27778968,
+ parentType: 'company',
+ typeId: 1,
+ typeCategory: 'system',
+ typeName: undefined,
+ userId: 680302,
+ dateCreated: 1544469388000,
+ dateModified: 1544469388000,
+ oldValueId: undefined,
+ oldValueName: undefined,
+ newValueId: undefined,
+ newValueName: undefined,
+ },
+];
+export { ParsedActivities };
diff --git a/packages/pipeline/test/fixtures/copper/api_v1_list_leads.json b/packages/pipeline/test/fixtures/copper/api_v1_list_leads.json
new file mode 100644
index 000000000..5223976f9
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/api_v1_list_leads.json
@@ -0,0 +1,583 @@
+[
+ {
+ "id": 9150547,
+ "name": "My Contact",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Contact",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mycontact@noemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value": null
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": null
+ }
+ ],
+ "date_created": 1490045162,
+ "date_modified": 1490045162
+ },
+ {
+ "id": 9150552,
+ "name": "My Contact",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Contact",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": null,
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [
+ {
+ "number": "415-123-45678",
+ "category": "mobile"
+ }
+ ],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value": null
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": null
+ }
+ ],
+ "date_created": 1490045237,
+ "date_modified": 1490045237
+ },
+ {
+ "id": 9150578,
+ "name": "My Contact",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Contact",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": null,
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [
+ {
+ "number": "415-123-45678",
+ "category": "mobile"
+ }
+ ],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value": null
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": null
+ }
+ ],
+ "date_created": 1490045279,
+ "date_modified": 1490045279
+ },
+ {
+ "id": 8982554,
+ "name": "My Lead",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mylead@noemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value": null
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": null
+ }
+ ],
+ "date_created": 1489528899,
+ "date_modified": 1489528899
+ },
+ {
+ "id": 8982702,
+ "name": "My Lead",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mylead@gmail.test",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value": null
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": null
+ }
+ ],
+ "date_created": 1489531171,
+ "date_modified": 1489531171
+ },
+ {
+ "id": 9094361,
+ "name": "My Lead",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mylead@noemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value": null
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": null
+ }
+ ],
+ "date_created": 1489791225,
+ "date_modified": 1489791225
+ },
+ {
+ "id": 9094364,
+ "name": "My Lead",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mylead@noemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value": "123456789012345678901234567890"
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": "123456789012345678901234567890"
+ }
+ ],
+ "date_created": 1489791283,
+ "date_modified": 1489791283
+ },
+ {
+ "id": 9094371,
+ "name": "My Lead",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mylead@noemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value":
+ "|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------"
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": "123456789012345678901234567890"
+ }
+ ],
+ "date_created": 1489791417,
+ "date_modified": 1489791417
+ },
+ {
+ "id": 9094372,
+ "name": "My Lead",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mylead@noemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value":
+ "|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5-----"
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": "123456789012345678901234567890"
+ }
+ ],
+ "date_created": 1489791453,
+ "date_modified": 1489791453
+ },
+ {
+ "id": 9094373,
+ "name": "My Lead",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mylead@noemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value":
+ "|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5-----"
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value":
+ "|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------"
+ }
+ ],
+ "date_created": 1489791470,
+ "date_modified": 1489791470
+ },
+ {
+ "id": 9094383,
+ "name": "My Lead",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mylead@noemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value":
+ "|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5-----"
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value":
+ "|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------|--------1---------2---------3---------4---------5---------6---------7---------8---------9---------"
+ }
+ ],
+ "date_created": 1489791672,
+ "date_modified": 1489791672
+ },
+ {
+ "id": 9174441,
+ "name": "My Lead",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mylead@noemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value": "Text fields are 255 chars or less!"
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": "text \n text"
+ }
+ ],
+ "date_created": 1490112942,
+ "date_modified": 1490112942
+ },
+ {
+ "id": 9174443,
+ "name": "My Lead",
+ "prefix": null,
+ "first_name": "My",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": null,
+ "assignee_id": null,
+ "company_name": null,
+ "customer_source_id": null,
+ "details": null,
+ "email": {
+ "email": "mylead@noemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": null,
+ "socials": [],
+ "status": "New",
+ "status_id": 208231,
+ "tags": [],
+ "title": null,
+ "websites": [],
+ "phone_numbers": [],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value": "Text fields are 255 chars or less!"
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": "text /n text"
+ }
+ ],
+ "date_created": 1490112953,
+ "date_modified": 1490112953
+ },
+ {
+ "id": 8894157,
+ "name": "Test Lead",
+ "prefix": null,
+ "first_name": "Test",
+ "last_name": "Lead",
+ "middle_name": null,
+ "suffix": null,
+ "address": {
+ "street": "301 Howard St Ste 600",
+ "city": "San Francisco",
+ "state": "CA",
+ "postal_code": "94105",
+ "country": "US"
+ },
+ "assignee_id": 137658,
+ "company_name": "Lead's Company",
+ "customer_source_id": 331241,
+ "details": "This is an update",
+ "email": {
+ "email": "address@workemail.com",
+ "category": "work"
+ },
+ "interaction_count": 0,
+ "monetary_value": 100,
+ "socials": [
+ {
+ "url": "facebook.com/test_lead",
+ "category": "facebook"
+ }
+ ],
+ "status": "New",
+ "status_id": 208231,
+ "tags": ["tag 1", "tag 2"],
+ "title": "Title",
+ "websites": [
+ {
+ "url": "www.workwebsite.com",
+ "category": "work"
+ }
+ ],
+ "phone_numbers": [
+ {
+ "number": "415-999-4321",
+ "category": "mobile"
+ },
+ {
+ "number": "415-555-1234",
+ "category": "work"
+ }
+ ],
+ "custom_fields": [
+ {
+ "custom_field_definition_id": 100764,
+ "value": null
+ },
+ {
+ "custom_field_definition_id": 103481,
+ "value": null
+ }
+ ],
+ "date_created": 1489018784,
+ "date_modified": 1496692911
+ }
+]
diff --git a/packages/pipeline/test/fixtures/copper/api_v1_list_leads.ts b/packages/pipeline/test/fixtures/copper/api_v1_list_leads.ts
new file mode 100644
index 000000000..b1f00cba7
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/api_v1_list_leads.ts
@@ -0,0 +1,229 @@
+import { CopperLead } from '../../../src/entities';
+const ParsedLeads: CopperLead[] = [
+ {
+ id: 9150547,
+ name: 'My Contact',
+ firstName: 'My',
+ lastName: 'Contact',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1490045162000,
+ dateModified: 1490045162000,
+ },
+ {
+ id: 9150552,
+ name: 'My Contact',
+ firstName: 'My',
+ lastName: 'Contact',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1490045237000,
+ dateModified: 1490045237000,
+ },
+ {
+ id: 9150578,
+ name: 'My Contact',
+ firstName: 'My',
+ lastName: 'Contact',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1490045279000,
+ dateModified: 1490045279000,
+ },
+ {
+ id: 8982554,
+ name: 'My Lead',
+ firstName: 'My',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1489528899000,
+ dateModified: 1489528899000,
+ },
+ {
+ id: 8982702,
+ name: 'My Lead',
+ firstName: 'My',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1489531171000,
+ dateModified: 1489531171000,
+ },
+ {
+ id: 9094361,
+ name: 'My Lead',
+ firstName: 'My',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1489791225000,
+ dateModified: 1489791225000,
+ },
+ {
+ id: 9094364,
+ name: 'My Lead',
+ firstName: 'My',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1489791283000,
+ dateModified: 1489791283000,
+ },
+ {
+ id: 9094371,
+ name: 'My Lead',
+ firstName: 'My',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1489791417000,
+ dateModified: 1489791417000,
+ },
+ {
+ id: 9094372,
+ name: 'My Lead',
+ firstName: 'My',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1489791453000,
+ dateModified: 1489791453000,
+ },
+ {
+ id: 9094373,
+ name: 'My Lead',
+ firstName: 'My',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1489791470000,
+ dateModified: 1489791470000,
+ },
+ {
+ id: 9094383,
+ name: 'My Lead',
+ firstName: 'My',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1489791672000,
+ dateModified: 1489791672000,
+ },
+ {
+ id: 9174441,
+ name: 'My Lead',
+ firstName: 'My',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1490112942000,
+ dateModified: 1490112942000,
+ },
+ {
+ id: 9174443,
+ name: 'My Lead',
+ firstName: 'My',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: undefined,
+ companyName: undefined,
+ customerSourceId: undefined,
+ monetaryValue: undefined,
+ status: 'New',
+ statusId: 208231,
+ title: undefined,
+ dateCreated: 1490112953000,
+ dateModified: 1490112953000,
+ },
+ {
+ id: 8894157,
+ name: 'Test Lead',
+ firstName: 'Test',
+ lastName: 'Lead',
+ middleName: undefined,
+ assigneeId: 137658,
+ companyName: "Lead's Company",
+ customerSourceId: 331241,
+ monetaryValue: 100,
+ status: 'New',
+ statusId: 208231,
+ title: 'Title',
+ dateCreated: 1489018784000,
+ dateModified: 1496692911000,
+ },
+];
+
+export { ParsedLeads };
diff --git a/packages/pipeline/test/fixtures/copper/api_v1_list_opportunities.json b/packages/pipeline/test/fixtures/copper/api_v1_list_opportunities.json
new file mode 100644
index 000000000..34ac58c30
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/api_v1_list_opportunities.json
@@ -0,0 +1,662 @@
+[
+ {
+ "id": 14050269,
+ "name": "8Base RaaS",
+ "assignee_id": 680302,
+ "close_date": "11/19/2018",
+ "company_id": 27778962,
+ "company_name": "8base",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2405442,
+ "primary_contact_id": 66088850,
+ "priority": "None",
+ "status": "Won",
+ "tags": [],
+ "interaction_count": 81,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1542653860,
+ "date_last_contacted": 1544757550,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1538414159,
+ "date_modified": 1544769562,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394013, 394018] },
+ { "custom_field_definition_id": 261067, "value": 394026 }
+ ]
+ },
+ {
+ "id": 14631430,
+ "name": "Alice.si TW + ERC 20 Marketplace",
+ "assignee_id": 680302,
+ "close_date": "12/15/2018",
+ "company_id": 30238847,
+ "company_name": "Alice SI",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392929,
+ "primary_contact_id": 69354024,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 4,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1542304481,
+ "date_last_contacted": 1542304800,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1542304481,
+ "date_modified": 1542304943,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394013, 394015] },
+ { "custom_field_definition_id": 261067, "value": 394023 }
+ ]
+ },
+ {
+ "id": 14632057,
+ "name": "Altcoin.io Relayer",
+ "assignee_id": 680302,
+ "close_date": "12/15/2018",
+ "company_id": 29936486,
+ "company_name": "Altcoin.io",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392929,
+ "primary_contact_id": 68724646,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 22,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1542310909,
+ "date_last_contacted": 1543864597,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1542306827,
+ "date_modified": 1543864667,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394013, 394017] },
+ { "custom_field_definition_id": 261067, "value": 394023 }
+ ]
+ },
+ {
+ "id": 14667523,
+ "name": "Altcoin.io Relayer",
+ "assignee_id": 680302,
+ "close_date": "12/19/2018",
+ "company_id": 29936486,
+ "company_name": "Altcoin.io",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392929,
+ "primary_contact_id": 68724646,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 21,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1542657437,
+ "date_last_contacted": 1543864597,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1542657437,
+ "date_modified": 1543864667,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394013, 394017] },
+ { "custom_field_definition_id": 261067, "value": 394023 }
+ ]
+ },
+ {
+ "id": 14666706,
+ "name": "Amadeus Relayer",
+ "assignee_id": 680302,
+ "close_date": "11/19/2018",
+ "company_id": 29243209,
+ "company_name": "Amadeus",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2405442,
+ "primary_contact_id": 66912020,
+ "priority": "None",
+ "status": "Won",
+ "tags": [],
+ "interaction_count": 11,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1542654284,
+ "date_last_contacted": 1543264254,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1542654284,
+ "date_modified": 1543277520,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394013] },
+ { "custom_field_definition_id": 261067, "value": 394023 }
+ ]
+ },
+ {
+ "id": 14666718,
+ "name": "Ambo Relayer",
+ "assignee_id": 680302,
+ "close_date": "11/19/2018",
+ "company_id": 29249190,
+ "company_name": "Ambo",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2405442,
+ "primary_contact_id": 66927869,
+ "priority": "None",
+ "status": "Won",
+ "tags": [],
+ "interaction_count": 126,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1542654352,
+ "date_last_contacted": 1545252349,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1542654352,
+ "date_modified": 1545253761,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394013] },
+ { "custom_field_definition_id": 261067, "value": 394023 }
+ ]
+ },
+ {
+ "id": 14164318,
+ "name": "Augur TW",
+ "assignee_id": 680302,
+ "close_date": "12/10/2018",
+ "company_id": 27778967,
+ "company_name": "Augur",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2405442,
+ "primary_contact_id": 67248692,
+ "priority": "None",
+ "status": "Won",
+ "tags": [],
+ "interaction_count": 22,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1544469362,
+ "date_last_contacted": 1544491567,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1539204858,
+ "date_modified": 1544653867,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394015] },
+ { "custom_field_definition_id": 261067, "value": 394021 }
+ ]
+ },
+ {
+ "id": 14666626,
+ "name": "Autonio",
+ "assignee_id": 680302,
+ "close_date": "12/19/2018",
+ "company_id": 27920701,
+ "company_name": "Auton",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392931,
+ "primary_contact_id": 64742640,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 54,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1542653834,
+ "date_last_contacted": 1542658568,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1542653834,
+ "date_modified": 1542658808,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394013, 394019] },
+ { "custom_field_definition_id": 261067, "value": 394023 }
+ ]
+ },
+ {
+ "id": 14050921,
+ "name": "Axie Infinity 721 Marketplace",
+ "assignee_id": 680302,
+ "close_date": "11/1/2018",
+ "company_id": 27779033,
+ "company_name": "Axie Infinity",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392931,
+ "primary_contact_id": 66499254,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 4,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1543861025,
+ "date_last_contacted": 1539024738,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1538416687,
+ "date_modified": 1543861025,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394014] },
+ { "custom_field_definition_id": 261067, "value": 394134 }
+ ]
+ },
+ {
+ "id": 13735617,
+ "name": "Balance TW",
+ "assignee_id": 680302,
+ "close_date": "12/10/2018",
+ "company_id": 27778968,
+ "company_name": "Balance",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2405442,
+ "primary_contact_id": 64713448,
+ "priority": "None",
+ "status": "Won",
+ "tags": [],
+ "interaction_count": 34,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1544469382,
+ "date_last_contacted": 1545082200,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1535668009,
+ "date_modified": 1545082454,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394015] },
+ { "custom_field_definition_id": 261067, "value": 394027 }
+ ]
+ },
+ {
+ "id": 14667112,
+ "name": "Bamboo Relayer",
+ "assignee_id": 680302,
+ "close_date": "11/19/2018",
+ "company_id": 29243795,
+ "company_name": "Bamboo Relay",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2405442,
+ "primary_contact_id": 66914687,
+ "priority": "None",
+ "status": "Won",
+ "tags": [],
+ "interaction_count": 46,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1542655143,
+ "date_last_contacted": 1545252349,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1542655143,
+ "date_modified": 1545253761,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394013] },
+ { "custom_field_definition_id": 261067, "value": 394023 }
+ ]
+ },
+ {
+ "id": 13627309,
+ "name": "Ben TW",
+ "assignee_id": 680302,
+ "close_date": "1/1/2019",
+ "company_id": 27702348,
+ "company_name": "Ben",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392929,
+ "primary_contact_id": 64262622,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 64,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1541527279,
+ "date_last_contacted": 1541639882,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1534887789,
+ "date_modified": 1541651395,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394015] },
+ { "custom_field_definition_id": 261067, "value": 394027 }
+ ]
+ },
+ {
+ "id": 14808512,
+ "name": "Bit2Me Relayer",
+ "assignee_id": 680302,
+ "close_date": "12/3/2018",
+ "company_id": 30793050,
+ "company_name": "Bit2Me",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2405442,
+ "primary_contact_id": 70267217,
+ "priority": "None",
+ "status": "Won",
+ "tags": [],
+ "interaction_count": 0,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1543861167,
+ "date_last_contacted": null,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1543861167,
+ "date_modified": 1543861189,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394013] },
+ { "custom_field_definition_id": 261067, "value": 394023 }
+ ]
+ },
+ {
+ "id": 14050312,
+ "name": "Bitcoin.tax Reporting Integration",
+ "assignee_id": 680302,
+ "close_date": "11/1/2018",
+ "company_id": 27957614,
+ "company_name": "Bitcoin",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392928,
+ "primary_contact_id": 66539479,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 5,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1538414308,
+ "date_last_contacted": 1536766098,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1538414308,
+ "date_modified": 1538414314,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394019] },
+ { "custom_field_definition_id": 261067, "value": 394026 }
+ ]
+ },
+ {
+ "id": 14331463,
+ "name": "Bitpie TW",
+ "assignee_id": 680302,
+ "close_date": "11/19/2018",
+ "company_id": 27779026,
+ "company_name": "Bitpie",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392929,
+ "primary_contact_id": 67700943,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 9,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1539984566,
+ "date_last_contacted": 1541529947,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1539984566,
+ "date_modified": 1541530233,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394015] },
+ { "custom_field_definition_id": 261067, "value": 394027 }
+ ]
+ },
+ {
+ "id": 14331481,
+ "name": "Bitski Wallet SDK TW",
+ "assignee_id": 680302,
+ "close_date": "11/19/2018",
+ "company_id": 29489300,
+ "company_name": "Bitski",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392929,
+ "primary_contact_id": 67697528,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 23,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1539984735,
+ "date_last_contacted": 1544811399,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1539984735,
+ "date_modified": 1544818605,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394015] },
+ { "custom_field_definition_id": 261067, "value": 394026 }
+ ]
+ },
+ {
+ "id": 14531554,
+ "name": "BitUniverse TW",
+ "assignee_id": 680302,
+ "close_date": "12/6/2018",
+ "company_id": 29901805,
+ "company_name": "BitUniverse Co., Ltd (Cryptocurrency Portfolio)",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392929,
+ "primary_contact_id": 68692107,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 15,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1543861104,
+ "date_last_contacted": 1544803276,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1541527110,
+ "date_modified": 1544812979,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394015] },
+ { "custom_field_definition_id": 261067, "value": 394026 }
+ ]
+ },
+ {
+ "id": 14050895,
+ "name": "BlitzPredict PMR",
+ "assignee_id": 680302,
+ "close_date": "11/1/2018",
+ "company_id": 28758258,
+ "company_name": "BlitzPredict",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392929,
+ "primary_contact_id": 66378659,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 32,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1539985501,
+ "date_last_contacted": 1544830560,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1538416597,
+ "date_modified": 1544830709,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394016] },
+ { "custom_field_definition_id": 261067, "value": 394023 }
+ ]
+ },
+ {
+ "id": 14209841,
+ "name": "Blockfolio TW",
+ "assignee_id": 680302,
+ "close_date": "11/15/2018",
+ "company_id": 29332516,
+ "company_name": "Blockfolio",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2405443,
+ "primary_contact_id": 67247027,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 20,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1539984098,
+ "date_last_contacted": 1539977661,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1539624801,
+ "date_modified": 1539984098,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394015] },
+ { "custom_field_definition_id": 261067, "value": 394026 }
+ ]
+ },
+ {
+ "id": 14633220,
+ "name": "BlockSwap 721 / 1155 Conversational Marketplace",
+ "assignee_id": 680302,
+ "close_date": "12/15/2018",
+ "company_id": 30210921,
+ "company_name": "BlockSwap",
+ "customer_source_id": null,
+ "details": "blah blah",
+ "loss_reason_id": null,
+ "pipeline_id": 512676,
+ "pipeline_stage_id": 2392929,
+ "primary_contact_id": 69296220,
+ "priority": "None",
+ "status": "Open",
+ "tags": [],
+ "interaction_count": 82,
+ "monetary_unit": null,
+ "monetary_value": null,
+ "converted_unit": null,
+ "converted_value": null,
+ "win_probability": 0,
+ "date_stage_changed": 1542311056,
+ "date_last_contacted": 1543536442,
+ "leads_converted_from": [],
+ "date_lead_created": null,
+ "date_created": 1542311056,
+ "date_modified": 1543557877,
+ "custom_fields": [
+ { "custom_field_definition_id": 261066, "value": [394014] },
+ { "custom_field_definition_id": 261067, "value": 394023 }
+ ]
+ }
+]
diff --git a/packages/pipeline/test/fixtures/copper/api_v1_list_opportunities.ts b/packages/pipeline/test/fixtures/copper/api_v1_list_opportunities.ts
new file mode 100644
index 000000000..3c2d4ae5e
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/api_v1_list_opportunities.ts
@@ -0,0 +1,425 @@
+// tslint:disable:custom-no-magic-numbers
+import { CopperOpportunity } from '../../../src/entities';
+const ParsedOpportunities: CopperOpportunity[] = [
+ {
+ id: 14050269,
+ name: '8Base RaaS',
+ assigneeId: 680302,
+ closeDate: '11/19/2018',
+ companyId: 27778962,
+ companyName: '8base',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2405442,
+ primaryContactId: 66088850,
+ priority: 'None',
+ status: 'Won',
+ interactionCount: 81,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1538414159000,
+ dateModified: 1544769562000,
+ customFields: { '261066': 394018, '261067': 394026 },
+ },
+ {
+ id: 14631430,
+ name: 'Alice.si TW + ERC 20 Marketplace',
+ assigneeId: 680302,
+ closeDate: '12/15/2018',
+ companyId: 30238847,
+ companyName: 'Alice SI',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392929,
+ primaryContactId: 69354024,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 4,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1542304481000,
+ dateModified: 1542304943000,
+ customFields: { '261066': 394015, '261067': 394023 },
+ },
+ {
+ id: 14632057,
+ name: 'Altcoin.io Relayer',
+ assigneeId: 680302,
+ closeDate: '12/15/2018',
+ companyId: 29936486,
+ companyName: 'Altcoin.io',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392929,
+ primaryContactId: 68724646,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 22,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1542306827000,
+ dateModified: 1543864667000,
+ customFields: { '261066': 394017, '261067': 394023 },
+ },
+ {
+ id: 14667523,
+ name: 'Altcoin.io Relayer',
+ assigneeId: 680302,
+ closeDate: '12/19/2018',
+ companyId: 29936486,
+ companyName: 'Altcoin.io',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392929,
+ primaryContactId: 68724646,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 21,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1542657437000,
+ dateModified: 1543864667000,
+ customFields: { '261066': 394017, '261067': 394023 },
+ },
+ {
+ id: 14666706,
+ name: 'Amadeus Relayer',
+ assigneeId: 680302,
+ closeDate: '11/19/2018',
+ companyId: 29243209,
+ companyName: 'Amadeus',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2405442,
+ primaryContactId: 66912020,
+ priority: 'None',
+ status: 'Won',
+ interactionCount: 11,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1542654284000,
+ dateModified: 1543277520000,
+ customFields: { '261066': 394013, '261067': 394023 },
+ },
+ {
+ id: 14666718,
+ name: 'Ambo Relayer',
+ assigneeId: 680302,
+ closeDate: '11/19/2018',
+ companyId: 29249190,
+ companyName: 'Ambo',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2405442,
+ primaryContactId: 66927869,
+ priority: 'None',
+ status: 'Won',
+ interactionCount: 126,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1542654352000,
+ dateModified: 1545253761000,
+ customFields: { '261066': 394013, '261067': 394023 },
+ },
+ {
+ id: 14164318,
+ name: 'Augur TW',
+ assigneeId: 680302,
+ closeDate: '12/10/2018',
+ companyId: 27778967,
+ companyName: 'Augur',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2405442,
+ primaryContactId: 67248692,
+ priority: 'None',
+ status: 'Won',
+ interactionCount: 22,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1539204858000,
+ dateModified: 1544653867000,
+ customFields: { '261066': 394015, '261067': 394021 },
+ },
+ {
+ id: 14666626,
+ name: 'Autonio',
+ assigneeId: 680302,
+ closeDate: '12/19/2018',
+ companyId: 27920701,
+ companyName: 'Auton',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392931,
+ primaryContactId: 64742640,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 54,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1542653834000,
+ dateModified: 1542658808000,
+ customFields: { '261066': 394019, '261067': 394023 },
+ },
+ {
+ id: 14050921,
+ name: 'Axie Infinity 721 Marketplace',
+ assigneeId: 680302,
+ closeDate: '11/1/2018',
+ companyId: 27779033,
+ companyName: 'Axie Infinity',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392931,
+ primaryContactId: 66499254,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 4,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1538416687000,
+ dateModified: 1543861025000,
+ customFields: { '261066': 394014, '261067': 394134 },
+ },
+ {
+ id: 13735617,
+ name: 'Balance TW',
+ assigneeId: 680302,
+ closeDate: '12/10/2018',
+ companyId: 27778968,
+ companyName: 'Balance',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2405442,
+ primaryContactId: 64713448,
+ priority: 'None',
+ status: 'Won',
+ interactionCount: 34,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1535668009000,
+ dateModified: 1545082454000,
+ customFields: { '261066': 394015, '261067': 394027 },
+ },
+ {
+ id: 14667112,
+ name: 'Bamboo Relayer',
+ assigneeId: 680302,
+ closeDate: '11/19/2018',
+ companyId: 29243795,
+ companyName: 'Bamboo Relay',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2405442,
+ primaryContactId: 66914687,
+ priority: 'None',
+ status: 'Won',
+ interactionCount: 46,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1542655143000,
+ dateModified: 1545253761000,
+ customFields: { '261066': 394013, '261067': 394023 },
+ },
+ {
+ id: 13627309,
+ name: 'Ben TW',
+ assigneeId: 680302,
+ closeDate: '1/1/2019',
+ companyId: 27702348,
+ companyName: 'Ben',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392929,
+ primaryContactId: 64262622,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 64,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1534887789000,
+ dateModified: 1541651395000,
+ customFields: { '261066': 394015, '261067': 394027 },
+ },
+ {
+ id: 14808512,
+ name: 'Bit2Me Relayer',
+ assigneeId: 680302,
+ closeDate: '12/3/2018',
+ companyId: 30793050,
+ companyName: 'Bit2Me',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2405442,
+ primaryContactId: 70267217,
+ priority: 'None',
+ status: 'Won',
+ interactionCount: 0,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1543861167000,
+ dateModified: 1543861189000,
+ customFields: { '261066': 394013, '261067': 394023 },
+ },
+ {
+ id: 14050312,
+ name: 'Bitcoin.tax Reporting Integration',
+ assigneeId: 680302,
+ closeDate: '11/1/2018',
+ companyId: 27957614,
+ companyName: 'Bitcoin',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392928,
+ primaryContactId: 66539479,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 5,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1538414308000,
+ dateModified: 1538414314000,
+ customFields: { '261066': 394019, '261067': 394026 },
+ },
+ {
+ id: 14331463,
+ name: 'Bitpie TW',
+ assigneeId: 680302,
+ closeDate: '11/19/2018',
+ companyId: 27779026,
+ companyName: 'Bitpie',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392929,
+ primaryContactId: 67700943,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 9,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1539984566000,
+ dateModified: 1541530233000,
+ customFields: { '261066': 394015, '261067': 394027 },
+ },
+ {
+ id: 14331481,
+ name: 'Bitski Wallet SDK TW',
+ assigneeId: 680302,
+ closeDate: '11/19/2018',
+ companyId: 29489300,
+ companyName: 'Bitski',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392929,
+ primaryContactId: 67697528,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 23,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1539984735000,
+ dateModified: 1544818605000,
+ customFields: { '261066': 394015, '261067': 394026 },
+ },
+ {
+ id: 14531554,
+ name: 'BitUniverse TW',
+ assigneeId: 680302,
+ closeDate: '12/6/2018',
+ companyId: 29901805,
+ companyName: 'BitUniverse Co., Ltd (Cryptocurrency Portfolio)',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392929,
+ primaryContactId: 68692107,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 15,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1541527110000,
+ dateModified: 1544812979000,
+ customFields: { '261066': 394015, '261067': 394026 },
+ },
+ {
+ id: 14050895,
+ name: 'BlitzPredict PMR',
+ assigneeId: 680302,
+ closeDate: '11/1/2018',
+ companyId: 28758258,
+ companyName: 'BlitzPredict',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392929,
+ primaryContactId: 66378659,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 32,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1538416597000,
+ dateModified: 1544830709000,
+ customFields: { '261066': 394016, '261067': 394023 },
+ },
+ {
+ id: 14209841,
+ name: 'Blockfolio TW',
+ assigneeId: 680302,
+ closeDate: '11/15/2018',
+ companyId: 29332516,
+ companyName: 'Blockfolio',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2405443,
+ primaryContactId: 67247027,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 20,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1539624801000,
+ dateModified: 1539984098000,
+ customFields: { '261066': 394015, '261067': 394026 },
+ },
+ {
+ id: 14633220,
+ name: 'BlockSwap 721 / 1155 Conversational Marketplace',
+ assigneeId: 680302,
+ closeDate: '12/15/2018',
+ companyId: 30210921,
+ companyName: 'BlockSwap',
+ customerSourceId: undefined,
+ lossReasonId: undefined,
+ pipelineId: 512676,
+ pipelineStageId: 2392929,
+ primaryContactId: 69296220,
+ priority: 'None',
+ status: 'Open',
+ interactionCount: 82,
+ monetaryValue: undefined,
+ winProbability: 0,
+ dateCreated: 1542311056000,
+ dateModified: 1543557877000,
+ customFields: { '261066': 394014, '261067': 394023 },
+ },
+];
+export { ParsedOpportunities };
diff --git a/packages/pipeline/test/fixtures/copper/parsed_entities.ts b/packages/pipeline/test/fixtures/copper/parsed_entities.ts
new file mode 100644
index 000000000..1f49d38ed
--- /dev/null
+++ b/packages/pipeline/test/fixtures/copper/parsed_entities.ts
@@ -0,0 +1,5 @@
+export { ParsedActivityTypes } from './api_v1_activity_types';
+export { ParsedCustomFields } from './api_v1_custom_field_definitions';
+export { ParsedActivities } from './api_v1_list_activities';
+export { ParsedLeads } from './api_v1_list_leads';
+export { ParsedOpportunities } from './api_v1_list_opportunities';
diff --git a/packages/pipeline/test/parsers/bloxy/index_test.ts b/packages/pipeline/test/parsers/bloxy/index_test.ts
new file mode 100644
index 000000000..6aabb091d
--- /dev/null
+++ b/packages/pipeline/test/parsers/bloxy/index_test.ts
@@ -0,0 +1,98 @@
+// tslint:disable:custom-no-magic-numbers
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+import * as R from 'ramda';
+
+import { BLOXY_DEX_TRADES_URL, BloxyTrade } from '../../../src/data_sources/bloxy';
+import { DexTrade } from '../../../src/entities';
+import { _parseBloxyTrade } from '../../../src/parsers/bloxy';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+const baseInput: BloxyTrade = {
+ tx_hash: '0xb93a7faf92efbbb5405c9a73cd4efd99702fe27c03ff22baee1f1b1e37b3a0bf',
+ tx_time: '2018-11-21T09:06:28.000+00:00',
+ tx_date: '2018-11-21',
+ tx_sender: '0x00923b9a074762b93650716333b3e1473a15048e',
+ smart_contract_id: 7091917,
+ smart_contract_address: '0x818e6fecd516ecc3849daf6845e3ec868087b755',
+ contract_type: 'DEX/Kyber Network Proxy',
+ maker: '0x0000000000000000000000000000000000000001',
+ taker: '0x0000000000000000000000000000000000000002',
+ amountBuy: 1.011943163078103,
+ makerFee: 38.912083,
+ buyCurrencyId: 1,
+ buySymbol: 'ETH',
+ amountSell: 941.4997928436911,
+ takerFee: 100.39,
+ sellCurrencyId: 16610,
+ sellSymbol: 'ELF',
+ maker_annotation: 'random annotation',
+ taker_annotation: 'random other annotation',
+ protocol: 'Kyber Network Proxy',
+ buyAddress: '0xbf2179859fc6d5bee9bf9158632dc51678a4100d',
+ sellAddress: '0xbf2179859fc6d5bee9bf9158632dc51678a4100e',
+};
+
+const baseExpected: DexTrade = {
+ sourceUrl: BLOXY_DEX_TRADES_URL,
+ txHash: '0xb93a7faf92efbbb5405c9a73cd4efd99702fe27c03ff22baee1f1b1e37b3a0bf',
+ txTimestamp: 1542791188000,
+ txDate: '2018-11-21',
+ txSender: '0x00923b9a074762b93650716333b3e1473a15048e',
+ smartContractId: 7091917,
+ smartContractAddress: '0x818e6fecd516ecc3849daf6845e3ec868087b755',
+ contractType: 'DEX/Kyber Network Proxy',
+ maker: '0x0000000000000000000000000000000000000001',
+ taker: '0x0000000000000000000000000000000000000002',
+ amountBuy: new BigNumber('1.011943163078103'),
+ makerFeeAmount: new BigNumber('38.912083'),
+ buyCurrencyId: 1,
+ buySymbol: 'ETH',
+ amountSell: new BigNumber('941.4997928436911'),
+ takerFeeAmount: new BigNumber('100.39'),
+ sellCurrencyId: 16610,
+ sellSymbol: 'ELF',
+ makerAnnotation: 'random annotation',
+ takerAnnotation: 'random other annotation',
+ protocol: 'Kyber Network Proxy',
+ buyAddress: '0xbf2179859fc6d5bee9bf9158632dc51678a4100d',
+ sellAddress: '0xbf2179859fc6d5bee9bf9158632dc51678a4100e',
+};
+
+interface TestCase {
+ input: BloxyTrade;
+ expected: DexTrade;
+}
+
+const testCases: TestCase[] = [
+ {
+ input: baseInput,
+ expected: baseExpected,
+ },
+ {
+ input: R.merge(baseInput, { buyAddress: null, sellAddress: null }),
+ expected: R.merge(baseExpected, { buyAddress: null, sellAddress: null }),
+ },
+ {
+ input: R.merge(baseInput, {
+ buySymbol:
+ 'RING\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000',
+ }),
+ expected: R.merge(baseExpected, { buySymbol: 'RING' }),
+ },
+];
+
+describe('bloxy', () => {
+ describe('_parseBloxyTrade', () => {
+ for (const [i, testCase] of testCases.entries()) {
+ it(`converts BloxyTrade to DexTrade entity (${i + 1}/${testCases.length})`, () => {
+ const actual = _parseBloxyTrade(testCase.input);
+ expect(actual).deep.equal(testCase.expected);
+ });
+ }
+ });
+});
diff --git a/packages/pipeline/test/parsers/copper/index_test.ts b/packages/pipeline/test/parsers/copper/index_test.ts
new file mode 100644
index 000000000..bb8e70da1
--- /dev/null
+++ b/packages/pipeline/test/parsers/copper/index_test.ts
@@ -0,0 +1,87 @@
+import * as chai from 'chai';
+import 'mocha';
+
+import {
+ CopperActivity,
+ CopperActivityType,
+ CopperCustomField,
+ CopperLead,
+ CopperOpportunity,
+} from '../../../src/entities';
+import {
+ CopperActivityResponse,
+ CopperActivityTypeCategory,
+ CopperActivityTypeResponse,
+ CopperCustomFieldResponse,
+ CopperSearchResponse,
+ parseActivities,
+ parseActivityTypes,
+ parseCustomFields,
+ parseLeads,
+ parseOpportunities,
+} from '../../../src/parsers/copper';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+type CopperResponse = CopperSearchResponse | CopperCustomFieldResponse;
+type CopperEntity = CopperLead | CopperActivity | CopperOpportunity | CopperActivityType | CopperCustomField;
+
+import * as activityTypesApiResponse from '../../fixtures/copper/api_v1_activity_types.json';
+import * as customFieldsApiResponse from '../../fixtures/copper/api_v1_custom_field_definitions.json';
+import * as listActivitiesApiResponse from '../../fixtures/copper/api_v1_list_activities.json';
+import * as listLeadsApiResponse from '../../fixtures/copper/api_v1_list_leads.json';
+import * as listOpportunitiesApiResponse from '../../fixtures/copper/api_v1_list_opportunities.json';
+import {
+ ParsedActivities,
+ ParsedActivityTypes,
+ ParsedCustomFields,
+ ParsedLeads,
+ ParsedOpportunities,
+} from '../../fixtures/copper/parsed_entities';
+
+interface TestCase {
+ input: CopperResponse[];
+ expected: CopperEntity[];
+ parseFn(input: CopperResponse[]): CopperEntity[];
+}
+const testCases: TestCase[] = [
+ {
+ input: listLeadsApiResponse,
+ expected: ParsedLeads,
+ parseFn: parseLeads,
+ },
+ {
+ input: (listActivitiesApiResponse as unknown) as CopperActivityResponse[],
+ expected: ParsedActivities,
+ parseFn: parseActivities,
+ },
+ {
+ input: listOpportunitiesApiResponse,
+ expected: ParsedOpportunities,
+ parseFn: parseOpportunities,
+ },
+ {
+ input: customFieldsApiResponse,
+ expected: ParsedCustomFields,
+ parseFn: parseCustomFields,
+ },
+];
+describe('Copper parser', () => {
+ it('parses API responses', () => {
+ testCases.forEach(testCase => {
+ const actual: CopperEntity[] = testCase.parseFn(testCase.input);
+ expect(actual).deep.equal(testCase.expected);
+ });
+ });
+
+ // special case because the API response is not an array
+ it('parses activity types API response', () => {
+ const actual: CopperActivityType[] = parseActivityTypes((activityTypesApiResponse as unknown) as Map<
+ CopperActivityTypeCategory,
+ CopperActivityTypeResponse[]
+ >);
+ expect(actual).deep.equal(ParsedActivityTypes);
+ });
+});
diff --git a/packages/pipeline/test/parsers/ddex_orders/index_test.ts b/packages/pipeline/test/parsers/ddex_orders/index_test.ts
new file mode 100644
index 000000000..f30e86b02
--- /dev/null
+++ b/packages/pipeline/test/parsers/ddex_orders/index_test.ts
@@ -0,0 +1,55 @@
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+
+import { DdexMarket } from '../../../src/data_sources/ddex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../../src/entities';
+import { parseDdexOrder } from '../../../src/parsers/ddex_orders';
+import { OrderType } from '../../../src/types';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('ddex_orders', () => {
+ describe('parseDdexOrder', () => {
+ it('converts ddexOrder to TokenOrder entity', () => {
+ const ddexOrder: [string, BigNumber] = ['0.5', new BigNumber(10)];
+ const ddexMarket: DdexMarket = {
+ id: 'ABC-DEF',
+ quoteToken: 'ABC',
+ quoteTokenDecimals: 5,
+ quoteTokenAddress: '0x0000000000000000000000000000000000000000',
+ baseToken: 'DEF',
+ baseTokenDecimals: 2,
+ baseTokenAddress: '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81',
+ minOrderSize: '0.1',
+ maxOrderSize: '1000',
+ pricePrecision: 1,
+ priceDecimals: 1,
+ amountDecimals: 0,
+ };
+ const observedTimestamp: number = Date.now();
+ const orderType: OrderType = OrderType.Bid;
+ const source: string = 'ddex';
+
+ const expected = new TokenOrder();
+ expected.source = 'ddex';
+ expected.observedTimestamp = observedTimestamp;
+ expected.orderType = OrderType.Bid;
+ expected.price = new BigNumber(0.5);
+ // ddex currently confuses base and quote assets.
+ // Switch them to maintain our internal consistency.
+ expected.baseAssetSymbol = 'ABC';
+ expected.baseAssetAddress = '0x0000000000000000000000000000000000000000';
+ expected.baseVolume = new BigNumber(10);
+ expected.quoteAssetSymbol = 'DEF';
+ expected.quoteAssetAddress = '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81';
+ expected.quoteVolume = new BigNumber(5);
+
+ const actual = parseDdexOrder(ddexMarket, observedTimestamp, orderType, source, ddexOrder);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/events/erc20_events_test.ts b/packages/pipeline/test/parsers/events/erc20_events_test.ts
new file mode 100644
index 000000000..962c50f98
--- /dev/null
+++ b/packages/pipeline/test/parsers/events/erc20_events_test.ts
@@ -0,0 +1,54 @@
+import { ERC20TokenApprovalEventArgs } from '@0x/contract-wrappers';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import 'mocha';
+
+import { ERC20ApprovalEvent } from '../../../src/entities';
+import { _convertToERC20ApprovalEvent } from '../../../src/parsers/events/erc20_events';
+import { _convertToExchangeFillEvent } from '../../../src/parsers/events/exchange_events';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('erc20_events', () => {
+ describe('_convertToERC20ApprovalEvent', () => {
+ it('converts LogWithDecodedArgs to ERC20ApprovalEvent entity', () => {
+ const input: LogWithDecodedArgs<ERC20TokenApprovalEventArgs> = {
+ address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ blockHash: '0xd2d7aafaa7102aec0bca8ef026d5a85133e87892334c46ee1e92e42912991c9b',
+ blockNumber: 6281577,
+ data: '0x000000000000000000000000000000000000000000000002b9cba5ee21ad3df9',
+ logIndex: 43,
+ topics: [
+ '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925',
+ '0x0000000000000000000000000b65c5f6f3a05d6be5588a72b603360773b3fe04',
+ '0x000000000000000000000000448a5065aebb8e423f0896e6c5d525c040f59af3',
+ ],
+ transactionHash: '0xcb46b19c786376a0a0140d51e3e606a4c4f926d8ca5434e96d2f69d04d8d9c7f',
+ transactionIndex: 103,
+ event: 'Approval',
+ args: {
+ _owner: '0x0b65c5f6f3a05d6be5588a72b603360773b3fe04',
+ _spender: '0x448a5065aebb8e423f0896e6c5d525c040f59af3',
+ _value: new BigNumber('50281464906893835769'),
+ },
+ };
+
+ const expected = new ERC20ApprovalEvent();
+ expected.tokenAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
+ expected.blockNumber = 6281577;
+ expected.rawData = '0x000000000000000000000000000000000000000000000002b9cba5ee21ad3df9';
+ expected.logIndex = 43;
+ expected.transactionHash = '0xcb46b19c786376a0a0140d51e3e606a4c4f926d8ca5434e96d2f69d04d8d9c7f';
+ expected.ownerAddress = '0x0b65c5f6f3a05d6be5588a72b603360773b3fe04';
+ expected.spenderAddress = '0x448a5065aebb8e423f0896e6c5d525c040f59af3';
+ expected.amount = new BigNumber('50281464906893835769');
+
+ const actual = _convertToERC20ApprovalEvent(input);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/events/exchange_events_test.ts b/packages/pipeline/test/parsers/events/exchange_events_test.ts
new file mode 100644
index 000000000..956ad9ef8
--- /dev/null
+++ b/packages/pipeline/test/parsers/events/exchange_events_test.ts
@@ -0,0 +1,79 @@
+import { ExchangeFillEventArgs } from '@0x/contract-wrappers';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import { LogWithDecodedArgs } from 'ethereum-types';
+import 'mocha';
+
+import { ExchangeFillEvent } from '../../../src/entities';
+import { _convertToExchangeFillEvent } from '../../../src/parsers/events/exchange_events';
+import { AssetType } from '../../../src/types';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('exchange_events', () => {
+ describe('_convertToExchangeFillEvent', () => {
+ it('converts LogWithDecodedArgs to ExchangeFillEvent entity', () => {
+ const input: LogWithDecodedArgs<ExchangeFillEventArgs> = {
+ logIndex: 102,
+ transactionIndex: 38,
+ transactionHash: '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd33657fe',
+ blockHash: '',
+ blockNumber: 6276262,
+ address: '0x4f833a24e1f95d70f028921e27040ca56e09ab0b',
+ data:
+ '0x000000000000000000000000f6da68519f78b0d0bc93c701e86affcb75c92428000000000000000000000000f6da68519f78b0d0bc93c701e86affcb75c92428000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000024f47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f49800000000000000000000000000000000000000000000000000000000',
+ topics: [
+ '0x0bcc4c97732e47d9946f229edb95f5b6323f601300e4690de719993f3c371129',
+ '0x000000000000000000000000f6da68519f78b0d0bc93c701e86affcb75c92428',
+ '0x000000000000000000000000c370d2a5920344aa6b7d8d11250e3e861434cbdd',
+ '0xab12ed2cbaa5615ab690b9da75a46e53ddfcf3f1a68655b5fe0d94c75a1aac4a',
+ ],
+ event: 'Fill',
+ args: {
+ makerAddress: '0xf6da68519f78b0d0bc93c701e86affcb75c92428',
+ feeRecipientAddress: '0xc370d2a5920344aa6b7d8d11250e3e861434cbdd',
+ takerAddress: '0xf6da68519f78b0d0bc93c701e86affcb75c92428',
+ senderAddress: '0xf6da68519f78b0d0bc93c701e86affcb75c92428',
+ makerAssetFilledAmount: new BigNumber('10000000000000000'),
+ takerAssetFilledAmount: new BigNumber('100000000000000000'),
+ makerFeePaid: new BigNumber('0'),
+ takerFeePaid: new BigNumber('12345'),
+ orderHash: '0xab12ed2cbaa5615ab690b9da75a46e53ddfcf3f1a68655b5fe0d94c75a1aac4a',
+ makerAssetData: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ takerAssetData: '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498',
+ },
+ };
+ const expected = new ExchangeFillEvent();
+ expected.contractAddress = '0x4f833a24e1f95d70f028921e27040ca56e09ab0b';
+ expected.blockNumber = 6276262;
+ expected.logIndex = 102;
+ expected.rawData =
+ '0x000000000000000000000000f6da68519f78b0d0bc93c701e86affcb75c92428000000000000000000000000f6da68519f78b0d0bc93c701e86affcb75c92428000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000024f47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024f47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f49800000000000000000000000000000000000000000000000000000000';
+ expected.transactionHash = '0x6dd106d002873746072fc5e496dd0fb2541b68c77bcf9184ae19a42fd33657fe';
+ expected.makerAddress = '0xf6da68519f78b0d0bc93c701e86affcb75c92428';
+ expected.takerAddress = '0xf6da68519f78b0d0bc93c701e86affcb75c92428';
+ expected.feeRecipientAddress = '0xc370d2a5920344aa6b7d8d11250e3e861434cbdd';
+ expected.senderAddress = '0xf6da68519f78b0d0bc93c701e86affcb75c92428';
+ expected.makerAssetFilledAmount = new BigNumber('10000000000000000');
+ expected.takerAssetFilledAmount = new BigNumber('100000000000000000');
+ expected.makerFeePaid = new BigNumber('0');
+ expected.takerFeePaid = new BigNumber('12345');
+ expected.orderHash = '0xab12ed2cbaa5615ab690b9da75a46e53ddfcf3f1a68655b5fe0d94c75a1aac4a';
+ expected.rawMakerAssetData = '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
+ expected.makerAssetType = AssetType.ERC20;
+ expected.makerAssetProxyId = '0xf47261b0';
+ expected.makerTokenAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
+ expected.makerTokenId = null;
+ expected.rawTakerAssetData = '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498';
+ expected.takerAssetType = AssetType.ERC20;
+ expected.takerAssetProxyId = '0xf47261b0';
+ expected.takerTokenAddress = '0xe41d2489571d322189246dafa5ebde1f4699f498';
+ expected.takerTokenId = null;
+ const actual = _convertToExchangeFillEvent(input);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/idex_orders/index_test.ts b/packages/pipeline/test/parsers/idex_orders/index_test.ts
new file mode 100644
index 000000000..48b019732
--- /dev/null
+++ b/packages/pipeline/test/parsers/idex_orders/index_test.ts
@@ -0,0 +1,87 @@
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+
+import { IdexOrderParam } from '../../../src/data_sources/idex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../../src/entities';
+import { parseIdexOrder } from '../../../src/parsers/idex_orders';
+import { OrderType } from '../../../src/types';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('idex_orders', () => {
+ describe('parseIdexOrder', () => {
+ // for market listed as 'DEF_ABC'.
+ it('correctly converts bid type idexOrder to TokenOrder entity', () => {
+ const idexOrder: [string, BigNumber] = ['0.5', new BigNumber(10)];
+ const idexOrderParam: IdexOrderParam = {
+ tokenBuy: '0x0000000000000000000000000000000000000000',
+ buySymbol: 'ABC',
+ buyPrecision: 2,
+ amountBuy: '10',
+ tokenSell: '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81',
+ sellSymbol: 'DEF',
+ sellPrecision: 2,
+ amountSell: '5',
+ expires: Date.now() + 100000,
+ nonce: 1,
+ user: '0x212345667543456435324564345643453453333',
+ };
+ const observedTimestamp: number = Date.now();
+ const orderType: OrderType = OrderType.Bid;
+ const source: string = 'idex';
+
+ const expected = new TokenOrder();
+ expected.source = 'idex';
+ expected.observedTimestamp = observedTimestamp;
+ expected.orderType = OrderType.Bid;
+ expected.price = new BigNumber(0.5);
+ expected.baseAssetSymbol = 'ABC';
+ expected.baseAssetAddress = '0x0000000000000000000000000000000000000000';
+ expected.baseVolume = new BigNumber(10);
+ expected.quoteAssetSymbol = 'DEF';
+ expected.quoteAssetAddress = '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81';
+ expected.quoteVolume = new BigNumber(5);
+
+ const actual = parseIdexOrder(idexOrderParam, observedTimestamp, orderType, source, idexOrder);
+ expect(actual).deep.equal(expected);
+ });
+ it('correctly converts ask type idexOrder to TokenOrder entity', () => {
+ const idexOrder: [string, BigNumber] = ['0.5', new BigNumber(10)];
+ const idexOrderParam: IdexOrderParam = {
+ tokenBuy: '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81',
+ buySymbol: 'DEF',
+ buyPrecision: 2,
+ amountBuy: '5',
+ tokenSell: '0x0000000000000000000000000000000000000000',
+ sellSymbol: 'ABC',
+ sellPrecision: 2,
+ amountSell: '10',
+ expires: Date.now() + 100000,
+ nonce: 1,
+ user: '0x212345667543456435324564345643453453333',
+ };
+ const observedTimestamp: number = Date.now();
+ const orderType: OrderType = OrderType.Ask;
+ const source: string = 'idex';
+
+ const expected = new TokenOrder();
+ expected.source = 'idex';
+ expected.observedTimestamp = observedTimestamp;
+ expected.orderType = OrderType.Ask;
+ expected.price = new BigNumber(0.5);
+ expected.baseAssetSymbol = 'ABC';
+ expected.baseAssetAddress = '0x0000000000000000000000000000000000000000';
+ expected.baseVolume = new BigNumber(10);
+ expected.quoteAssetSymbol = 'DEF';
+ expected.quoteAssetAddress = '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81';
+ expected.quoteVolume = new BigNumber(5);
+
+ const actual = parseIdexOrder(idexOrderParam, observedTimestamp, orderType, source, idexOrder);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/oasis_orders/index_test.ts b/packages/pipeline/test/parsers/oasis_orders/index_test.ts
new file mode 100644
index 000000000..401fedff8
--- /dev/null
+++ b/packages/pipeline/test/parsers/oasis_orders/index_test.ts
@@ -0,0 +1,49 @@
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+
+import { OasisMarket } from '../../../src/data_sources/oasis';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../../src/entities';
+import { parseOasisOrder } from '../../../src/parsers/oasis_orders';
+import { OrderType } from '../../../src/types';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('oasis_orders', () => {
+ describe('parseOasisOrder', () => {
+ it('converts oasisOrder to TokenOrder entity', () => {
+ const oasisOrder: [string, BigNumber] = ['0.5', new BigNumber(10)];
+ const oasisMarket: OasisMarket = {
+ id: 'ABCDEF',
+ base: 'DEF',
+ quote: 'ABC',
+ buyVol: 100,
+ sellVol: 200,
+ price: 1,
+ high: 1,
+ low: 0,
+ };
+ const observedTimestamp: number = Date.now();
+ const orderType: OrderType = OrderType.Bid;
+ const source: string = 'oasis';
+
+ const expected = new TokenOrder();
+ expected.source = 'oasis';
+ expected.observedTimestamp = observedTimestamp;
+ expected.orderType = OrderType.Bid;
+ expected.price = new BigNumber(0.5);
+ expected.baseAssetSymbol = 'DEF';
+ expected.baseAssetAddress = null;
+ expected.baseVolume = new BigNumber(10);
+ expected.quoteAssetSymbol = 'ABC';
+ expected.quoteAssetAddress = null;
+ expected.quoteVolume = new BigNumber(5);
+
+ const actual = parseOasisOrder(oasisMarket, observedTimestamp, orderType, source, oasisOrder);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/ohlcv_external/crypto_compare_test.ts b/packages/pipeline/test/parsers/ohlcv_external/crypto_compare_test.ts
new file mode 100644
index 000000000..118cafc5e
--- /dev/null
+++ b/packages/pipeline/test/parsers/ohlcv_external/crypto_compare_test.ts
@@ -0,0 +1,62 @@
+import * as chai from 'chai';
+import 'mocha';
+import * as R from 'ramda';
+
+import { CryptoCompareOHLCVRecord } from '../../../src/data_sources/ohlcv_external/crypto_compare';
+import { OHLCVExternal } from '../../../src/entities';
+import { OHLCVMetadata, parseRecords } from '../../../src/parsers/ohlcv_external/crypto_compare';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('ohlcv_external parser (Crypto Compare)', () => {
+ describe('parseRecords', () => {
+ const record: CryptoCompareOHLCVRecord = {
+ time: 200,
+ close: 100,
+ high: 101,
+ low: 99,
+ open: 98,
+ volumefrom: 1234,
+ volumeto: 4321,
+ };
+
+ const metadata: OHLCVMetadata = {
+ fromSymbol: 'ETH',
+ toSymbol: 'ZRX',
+ exchange: 'CCCAGG',
+ source: 'CryptoCompare',
+ observedTimestamp: new Date().getTime(),
+ interval: 100000,
+ };
+
+ const entity = new OHLCVExternal();
+ entity.exchange = metadata.exchange;
+ entity.fromSymbol = metadata.fromSymbol;
+ entity.toSymbol = metadata.toSymbol;
+ entity.startTime = 100000;
+ entity.endTime = 200000;
+ entity.open = record.open;
+ entity.close = record.close;
+ entity.low = record.low;
+ entity.high = record.high;
+ entity.volumeFrom = record.volumefrom;
+ entity.volumeTo = record.volumeto;
+ entity.source = metadata.source;
+ entity.observedTimestamp = metadata.observedTimestamp;
+
+ it('converts Crypto Compare OHLCV records to OHLCVExternal entity', () => {
+ const input = [record, R.merge(record, { time: 300 }), R.merge(record, { time: 400 })];
+ const expected = [
+ entity,
+ R.merge(entity, { startTime: 200000, endTime: 300000 }),
+ R.merge(entity, { startTime: 300000, endTime: 400000 }),
+ ];
+
+ const actual = parseRecords(input, metadata);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/paradex_orders/index_test.ts b/packages/pipeline/test/parsers/paradex_orders/index_test.ts
new file mode 100644
index 000000000..c5dd8751b
--- /dev/null
+++ b/packages/pipeline/test/parsers/paradex_orders/index_test.ts
@@ -0,0 +1,54 @@
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+
+import { ParadexMarket, ParadexOrder } from '../../../src/data_sources/paradex';
+import { TokenOrderbookSnapshot as TokenOrder } from '../../../src/entities';
+import { parseParadexOrder } from '../../../src/parsers/paradex_orders';
+import { OrderType } from '../../../src/types';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('paradex_orders', () => {
+ describe('parseParadexOrder', () => {
+ it('converts ParadexOrder to TokenOrder entity', () => {
+ const paradexOrder: ParadexOrder = {
+ amount: '412',
+ price: '0.1245',
+ };
+ const paradexMarket: ParadexMarket = {
+ id: '2',
+ symbol: 'ABC/DEF',
+ baseToken: 'DEF',
+ quoteToken: 'ABC',
+ minOrderSize: '0.1',
+ maxOrderSize: '1000',
+ priceMaxDecimals: 5,
+ amountMaxDecimals: 5,
+ baseTokenAddress: '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81',
+ quoteTokenAddress: '0x0000000000000000000000000000000000000000',
+ };
+ const observedTimestamp: number = Date.now();
+ const orderType: OrderType = OrderType.Bid;
+ const source: string = 'paradex';
+
+ const expected = new TokenOrder();
+ expected.source = 'paradex';
+ expected.observedTimestamp = observedTimestamp;
+ expected.orderType = OrderType.Bid;
+ expected.price = new BigNumber(0.1245);
+ expected.baseAssetSymbol = 'DEF';
+ expected.baseAssetAddress = '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81';
+ expected.baseVolume = new BigNumber(412);
+ expected.quoteAssetSymbol = 'ABC';
+ expected.quoteAssetAddress = '0x0000000000000000000000000000000000000000';
+ expected.quoteVolume = new BigNumber(412 * 0.1245);
+
+ const actual = parseParadexOrder(paradexMarket, observedTimestamp, orderType, source, paradexOrder);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/sra_orders/index_test.ts b/packages/pipeline/test/parsers/sra_orders/index_test.ts
new file mode 100644
index 000000000..838171a72
--- /dev/null
+++ b/packages/pipeline/test/parsers/sra_orders/index_test.ts
@@ -0,0 +1,69 @@
+import { APIOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+
+import { SraOrder } from '../../../src/entities';
+import { _convertToEntity } from '../../../src/parsers/sra_orders';
+import { AssetType } from '../../../src/types';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('sra_orders', () => {
+ describe('_convertToEntity', () => {
+ it('converts ApiOrder to SraOrder entity', () => {
+ const input: APIOrder = {
+ order: {
+ makerAddress: '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81',
+ takerAddress: '0x0000000000000000000000000000000000000000',
+ feeRecipientAddress: '0xa258b39954cef5cb142fd567a46cddb31a670124',
+ senderAddress: '0x0000000000000000000000000000000000000000',
+ makerAssetAmount: new BigNumber('1619310371000000000'),
+ takerAssetAmount: new BigNumber('8178335207070707070707'),
+ makerFee: new BigNumber('0'),
+ takerFee: new BigNumber('0'),
+ exchangeAddress: '0x4f833a24e1f95d70f028921e27040ca56e09ab0b',
+ expirationTimeSeconds: new BigNumber('1538529488'),
+ signature:
+ '0x1b5a5d672b0d647b5797387ccbb89d822d5d2e873346b014f4ff816ff0783f2a7a0d2824d2d7042ec8ea375bc7f870963e1cb8248f1db03ddf125e27b5963aa11f03',
+ salt: new BigNumber('1537924688891'),
+ makerAssetData: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
+ takerAssetData: '0xf47261b000000000000000000000000042d6622dece394b54999fbd73d108123806f6a18',
+ },
+ metaData: { isThisArbitraryData: true, powerLevel: 9001 },
+ };
+ const expected = new SraOrder();
+ expected.exchangeAddress = '0x4f833a24e1f95d70f028921e27040ca56e09ab0b';
+ expected.orderHashHex = '0x1bdbeb0d088a33da28b9ee6d94e8771452f90f4a69107da2fa75195d61b9a1c9';
+ expected.makerAddress = '0xb45df06e38540a675fdb5b598abf2c0dbe9d6b81';
+ expected.takerAddress = '0x0000000000000000000000000000000000000000';
+ expected.feeRecipientAddress = '0xa258b39954cef5cb142fd567a46cddb31a670124';
+ expected.senderAddress = '0x0000000000000000000000000000000000000000';
+ expected.makerAssetAmount = new BigNumber('1619310371000000000');
+ expected.takerAssetAmount = new BigNumber('8178335207070707070707');
+ expected.makerFee = new BigNumber('0');
+ expected.takerFee = new BigNumber('0');
+ expected.expirationTimeSeconds = new BigNumber('1538529488');
+ expected.salt = new BigNumber('1537924688891');
+ expected.signature =
+ '0x1b5a5d672b0d647b5797387ccbb89d822d5d2e873346b014f4ff816ff0783f2a7a0d2824d2d7042ec8ea375bc7f870963e1cb8248f1db03ddf125e27b5963aa11f03';
+ expected.rawMakerAssetData = '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
+ expected.makerAssetType = AssetType.ERC20;
+ expected.makerAssetProxyId = '0xf47261b0';
+ expected.makerTokenAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
+ expected.makerTokenId = null;
+ expected.rawTakerAssetData = '0xf47261b000000000000000000000000042d6622dece394b54999fbd73d108123806f6a18';
+ expected.takerAssetType = AssetType.ERC20;
+ expected.takerAssetProxyId = '0xf47261b0';
+ expected.takerTokenAddress = '0x42d6622dece394b54999fbd73d108123806f6a18';
+ expected.takerTokenId = null;
+ expected.metadataJson = '{"isThisArbitraryData":true,"powerLevel":9001}';
+
+ const actual = _convertToEntity(input);
+ expect(actual).deep.equal(expected);
+ });
+ });
+});
diff --git a/packages/pipeline/test/parsers/utils/index_test.ts b/packages/pipeline/test/parsers/utils/index_test.ts
new file mode 100644
index 000000000..5a0d0f182
--- /dev/null
+++ b/packages/pipeline/test/parsers/utils/index_test.ts
@@ -0,0 +1,30 @@
+import { BigNumber } from '@0x/utils';
+import * as chai from 'chai';
+import 'mocha';
+
+import { aggregateOrders, GenericRawOrder } from '../../../src/parsers/utils';
+import { chaiSetup } from '../../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+// tslint:disable:custom-no-magic-numbers
+describe('aggregateOrders', () => {
+ it('aggregates order by price point', () => {
+ const input = [
+ { price: '1', amount: '20', orderHash: 'testtest', total: '20' },
+ { price: '1', amount: '30', orderHash: 'testone', total: '30' },
+ { price: '2', amount: '100', orderHash: 'testtwo', total: '200' },
+ ];
+ const expected = [['1', new BigNumber(50)], ['2', new BigNumber(100)]];
+ const actual = aggregateOrders(input);
+ expect(actual).deep.equal(expected);
+ });
+
+ it('handles empty orders gracefully', () => {
+ const input: GenericRawOrder[] = [];
+ const expected: Array<[string, BigNumber]> = [];
+ const actual = aggregateOrders(input);
+ expect(actual).deep.equal(expected);
+ });
+});
diff --git a/packages/pipeline/test/utils/chai_setup.ts b/packages/pipeline/test/utils/chai_setup.ts
new file mode 100644
index 000000000..1a8733093
--- /dev/null
+++ b/packages/pipeline/test/utils/chai_setup.ts
@@ -0,0 +1,13 @@
+import * as chai from 'chai';
+import chaiAsPromised = require('chai-as-promised');
+import ChaiBigNumber = require('chai-bignumber');
+import * as dirtyChai from 'dirty-chai';
+
+export const chaiSetup = {
+ configure(): void {
+ chai.config.includeStack = true;
+ chai.use(ChaiBigNumber());
+ chai.use(dirtyChai);
+ chai.use(chaiAsPromised);
+ },
+};
diff --git a/packages/pipeline/tsconfig.json b/packages/pipeline/tsconfig.json
new file mode 100644
index 000000000..45e07374c
--- /dev/null
+++ b/packages/pipeline/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./migrations/**/*"],
+ "files": [
+ "./test/fixtures/copper/api_v1_activity_types.json",
+ "./test/fixtures/copper/api_v1_custom_field_definitions.json",
+ "./test/fixtures/copper/api_v1_list_activities.json",
+ "./test/fixtures/copper/api_v1_list_leads.json",
+ "./test/fixtures/copper/api_v1_list_opportunities.json"
+ ]
+}
diff --git a/packages/pipeline/tslint.json b/packages/pipeline/tslint.json
new file mode 100644
index 000000000..dd9053357
--- /dev/null
+++ b/packages/pipeline/tslint.json
@@ -0,0 +1,3 @@
+{
+ "extends": ["@0x/tslint-config"]
+}
diff --git a/packages/pipeline/typedoc-tsconfig.json b/packages/pipeline/typedoc-tsconfig.json
new file mode 100644
index 000000000..8b0ff51c1
--- /dev/null
+++ b/packages/pipeline/typedoc-tsconfig.json
@@ -0,0 +1,10 @@
+{
+ "extends": "../../typedoc-tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./migrations/**/*"]
+}
diff --git a/packages/react-docs/CHANGELOG.json b/packages/react-docs/CHANGELOG.json
index 0e9afc32a..9d8b5bc88 100644
--- a/packages/react-docs/CHANGELOG.json
+++ b/packages/react-docs/CHANGELOG.json
@@ -1,5 +1,41 @@
[
{
+ "version": "1.0.22",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.21",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "1.0.20",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "1.0.19",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "1.0.18",
"changes": [
diff --git a/packages/react-docs/CHANGELOG.md b/packages/react-docs/CHANGELOG.md
index db574e41b..5c702d562 100644
--- a/packages/react-docs/CHANGELOG.md
+++ b/packages/react-docs/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.22 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.21 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v1.0.20 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v1.0.19 - _November 21, 2018_
+
+ * Dependencies updated
+
## v1.0.18 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json
index 3e77a9a07..f58a51c90 100644
--- a/packages/react-docs/package.json
+++ b/packages/react-docs/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/react-docs",
- "version": "1.0.18",
+ "version": "1.0.22",
"engines": {
"node": ">=6.12"
},
@@ -24,8 +24,8 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.17",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/tslint-config": "^2.0.0",
"@types/compare-versions": "^3.0.0",
"@types/styled-components": "^4.0.0",
"make-promises-safe": "^1.1.0",
@@ -34,9 +34,9 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/react-shared": "^1.0.21",
- "@0x/types": "^1.2.1",
- "@0x/utils": "^2.0.5",
+ "@0x/react-shared": "^1.0.25",
+ "@0x/types": "^1.4.1",
+ "@0x/utils": "^2.0.8",
"@types/lodash": "4.14.104",
"@types/material-ui": "^0.20.0",
"@types/node": "*",
diff --git a/packages/react-shared/CHANGELOG.json b/packages/react-shared/CHANGELOG.json
index cb8ae1bf0..9ef0d079f 100644
--- a/packages/react-shared/CHANGELOG.json
+++ b/packages/react-shared/CHANGELOG.json
@@ -1,5 +1,51 @@
[
{
+ "version": "1.1.0",
+ "changes": [
+ {
+ "note":
+ "Change implementation to use react-router-dom NavLink instead of Link. Expose `activeStyle` prop.",
+ "pr": 1448
+ }
+ ]
+ },
+ {
+ "version": "1.0.25",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.24",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "1.0.23",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "1.0.22",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "1.0.21",
"changes": [
diff --git a/packages/react-shared/CHANGELOG.md b/packages/react-shared/CHANGELOG.md
index 0ecb66a27..8afa94e04 100644
--- a/packages/react-shared/CHANGELOG.md
+++ b/packages/react-shared/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.25 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.24 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v1.0.23 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v1.0.22 - _November 21, 2018_
+
+ * Dependencies updated
+
## v1.0.21 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json
index d2a00ca9c..17defe35a 100644
--- a/packages/react-shared/package.json
+++ b/packages/react-shared/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/react-shared",
- "version": "1.0.21",
+ "version": "1.0.25",
"engines": {
"node": ">=6.12"
},
@@ -25,15 +25,15 @@
"url": "https://github.com/0xProject/0x-monorepo.git"
},
"devDependencies": {
- "@0x/dev-utils": "^1.0.17",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/tslint-config": "^2.0.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
"tslint": "^5.9.1",
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/types": "^1.2.1",
+ "@0x/types": "^1.4.1",
"@material-ui/core": "^3.0.1",
"@types/is-mobile": "0.3.0",
"@types/lodash": "4.14.104",
diff --git a/packages/react-shared/src/components/link.tsx b/packages/react-shared/src/components/link.tsx
index 089e6e2ba..2fb19ac11 100644
--- a/packages/react-shared/src/components/link.tsx
+++ b/packages/react-shared/src/components/link.tsx
@@ -1,13 +1,13 @@
import * as _ from 'lodash';
import * as React from 'react';
-import { Link as ReactRounterLink } from 'react-router-dom';
+import { NavLink as ReactRounterLink } from 'react-router-dom';
import { Link as ScrollLink } from 'react-scroll';
import * as validUrl from 'valid-url';
import { LinkType } from '../types';
import { constants } from '../utils/constants';
-interface BaseLinkProps {
+export interface BaseLinkProps {
to: string;
shouldOpenInNewTab?: boolean;
className?: string;
@@ -18,11 +18,15 @@ interface BaseLinkProps {
fontColor?: string;
}
-interface ScrollLinkProps extends BaseLinkProps {
+export interface ScrollLinkProps extends BaseLinkProps {
onActivityChanged?: (isActive: boolean) => void;
}
-type LinkProps = BaseLinkProps & ScrollLinkProps;
+export interface ReactLinkProps extends BaseLinkProps {
+ activeStyle?: React.CSSProperties;
+}
+
+export type LinkProps = ReactLinkProps & ScrollLinkProps;
export interface LinkState {}
@@ -94,6 +98,7 @@ export class Link extends React.Component<LinkProps, LinkState> {
onMouseOver={this.props.onMouseOver}
onMouseEnter={this.props.onMouseEnter}
onMouseLeave={this.props.onMouseLeave}
+ activeStyle={this.props.activeStyle}
>
{this.props.children}
</ReactRounterLink>
diff --git a/packages/react-shared/src/index.ts b/packages/react-shared/src/index.ts
index a693f2a36..285e1c6b4 100644
--- a/packages/react-shared/src/index.ts
+++ b/packages/react-shared/src/index.ts
@@ -3,7 +3,7 @@ export { MarkdownLinkBlock } from './components/markdown_link_block';
export { MarkdownCodeBlock } from './components/markdown_code_block';
export { MarkdownSection } from './components/markdown_section';
export { SectionHeader } from './components/section_header';
-export { Link } from './components/link';
+export { Link, LinkProps } from './components/link';
export { HeaderSizes, Styles, EtherscanLinkSuffixes, Networks, ALink } from './types';
diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json
index fc39106dc..8548fd73f 100644
--- a/packages/sol-compiler/CHANGELOG.json
+++ b/packages/sol-compiler/CHANGELOG.json
@@ -1,5 +1,55 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Add sol-compiler watch mode with -w flag",
+ "pr": 1461
+ },
+ {
+ "note": "Make error and warning colouring more visually pleasant and consistent with other compilers",
+ "pr": 1461
+ }
+ ]
+ },
+ {
+ "version": "1.1.16",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.1.15",
+ "changes": [
+ {
+ "note": "Fix bug where we were appending base path to absolute imports (e.g NPM imports)",
+ "pr": 1311
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "1.1.14",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "1.1.13",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "1.1.12",
"changes": [
diff --git a/packages/sol-compiler/CHANGELOG.md b/packages/sol-compiler/CHANGELOG.md
index b69976cdc..b2066448d 100644
--- a/packages/sol-compiler/CHANGELOG.md
+++ b/packages/sol-compiler/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.1.16 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.1.15 - _December 11, 2018_
+
+ * Fix bug where we were appending base path to absolute imports (e.g NPM imports) (#1311)
+
+## v1.1.14 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v1.1.13 - _November 21, 2018_
+
+ * Dependencies updated
+
## v1.1.12 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json
index 2904cfd23..86167a603 100644
--- a/packages/sol-compiler/package.json
+++ b/packages/sol-compiler/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-compiler",
- "version": "1.1.12",
+ "version": "1.1.16",
"engines": {
"node": ">=6.12"
},
@@ -42,9 +42,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-compiler/README.md",
"devDependencies": {
- "@0x/dev-utils": "^1.0.17",
- "@0x/tslint-config": "^1.0.10",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/tslint-config": "^2.0.0",
+ "@types/chokidar": "^1.7.5",
"@types/mkdirp": "^0.5.2",
+ "@types/pluralize": "^0.0.29",
"@types/require-from-string": "^1.2.0",
"@types/semver": "^5.5.0",
"chai": "^4.0.1",
@@ -65,19 +67,21 @@
"zeppelin-solidity": "1.8.0"
},
"dependencies": {
- "@0x/assert": "^1.0.17",
- "@0x/json-schemas": "^2.1.1",
- "@0x/sol-resolver": "^1.0.16",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/assert": "^1.0.20",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/sol-resolver": "^1.1.1",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/yargs": "^11.0.0",
"chalk": "^2.3.0",
- "ethereum-types": "^1.1.2",
+ "chokidar": "^2.0.4",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5",
"mkdirp": "^0.5.1",
+ "pluralize": "^7.0.0",
"require-from-string": "^2.0.1",
"semver": "5.5.0",
"solc": "^0.4.23",
diff --git a/packages/sol-compiler/src/cli.ts b/packages/sol-compiler/src/cli.ts
index 0a9db6e05..18cc68aaf 100644
--- a/packages/sol-compiler/src/cli.ts
+++ b/packages/sol-compiler/src/cli.ts
@@ -25,6 +25,10 @@ const SEPARATOR = ',';
type: 'string',
description: 'comma separated list of contracts to compile',
})
+ .option('watch', {
+ alias: 'w',
+ default: false,
+ })
.help().argv;
const contracts = _.isUndefined(argv.contracts)
? undefined
@@ -37,7 +41,11 @@ const SEPARATOR = ',';
contracts,
};
const compiler = new Compiler(opts);
- await compiler.compileAsync();
+ if (argv.watch) {
+ await compiler.watchAsync();
+ } else {
+ await compiler.compileAsync();
+ }
})().catch(err => {
logUtils.log(err);
process.exit(1);
diff --git a/packages/sol-compiler/src/compiler.ts b/packages/sol-compiler/src/compiler.ts
index 8ee7fa4a9..d38ccbf39 100644
--- a/packages/sol-compiler/src/compiler.ts
+++ b/packages/sol-compiler/src/compiler.ts
@@ -6,26 +6,29 @@ import {
NPMResolver,
RelativeFSResolver,
Resolver,
+ SpyResolver,
URLResolver,
} from '@0x/sol-resolver';
-import { fetchAsync, logUtils } from '@0x/utils';
-import chalk from 'chalk';
+import { logUtils } from '@0x/utils';
+import * as chokidar from 'chokidar';
import { CompilerOptions, ContractArtifact, ContractVersionData, StandardOutput } from 'ethereum-types';
-import * as ethUtil from 'ethereumjs-util';
import * as fs from 'fs';
import * as _ from 'lodash';
import * as path from 'path';
-import * as requireFromString from 'require-from-string';
+import * as pluralize from 'pluralize';
import * as semver from 'semver';
import solc = require('solc');
import { compilerOptionsSchema } from './schemas/compiler_options_schema';
import { binPaths } from './solc/bin_paths';
import {
+ addHexPrefixToContractBytecode,
+ compile,
createDirIfDoesNotExistAsync,
getContractArtifactIfExistsAsync,
- getNormalizedErrMsg,
- parseDependencies,
+ getSolcAsync,
+ getSourcesWithDependencies,
+ getSourceTreeHash,
parseSolidityVersionRange,
} from './utils/compiler';
import { constants } from './utils/constants';
@@ -35,7 +38,6 @@ import { utils } from './utils/utils';
type TYPE_ALL_FILES_IDENTIFIER = '*';
const ALL_CONTRACTS_IDENTIFIER = '*';
const ALL_FILES_IDENTIFIER = '*';
-const SOLC_BIN_DIR = path.join(__dirname, '..', '..', 'solc_bin');
const DEFAULT_CONTRACTS_DIR = path.resolve('contracts');
const DEFAULT_ARTIFACTS_DIR = path.resolve('artifacts');
// Solc compiler settings cannot be configured from the commandline.
@@ -82,49 +84,6 @@ export class Compiler {
private readonly _artifactsDir: string;
private readonly _solcVersionIfExists: string | undefined;
private readonly _specifiedContracts: string[] | TYPE_ALL_FILES_IDENTIFIER;
- private static async _getSolcAsync(
- solcVersion: string,
- ): Promise<{ solcInstance: solc.SolcInstance; fullSolcVersion: string }> {
- const fullSolcVersion = binPaths[solcVersion];
- if (_.isUndefined(fullSolcVersion)) {
- throw new Error(`${solcVersion} is not a known compiler version`);
- }
- const compilerBinFilename = path.join(SOLC_BIN_DIR, fullSolcVersion);
- let solcjs: string;
- if (await fsWrapper.doesFileExistAsync(compilerBinFilename)) {
- solcjs = (await fsWrapper.readFileAsync(compilerBinFilename)).toString();
- } else {
- logUtils.warn(`Downloading ${fullSolcVersion}...`);
- const url = `${constants.BASE_COMPILER_URL}${fullSolcVersion}`;
- const response = await fetchAsync(url);
- const SUCCESS_STATUS = 200;
- if (response.status !== SUCCESS_STATUS) {
- throw new Error(`Failed to load ${fullSolcVersion}`);
- }
- solcjs = await response.text();
- await fsWrapper.writeFileAsync(compilerBinFilename, solcjs);
- }
- if (solcjs.length === 0) {
- throw new Error('No compiler available');
- }
- const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
- return { solcInstance, fullSolcVersion };
- }
- private static _addHexPrefixToContractBytecode(compiledContract: solc.StandardContractOutput): void {
- if (!_.isUndefined(compiledContract.evm)) {
- if (!_.isUndefined(compiledContract.evm.bytecode) && !_.isUndefined(compiledContract.evm.bytecode.object)) {
- compiledContract.evm.bytecode.object = ethUtil.addHexPrefix(compiledContract.evm.bytecode.object);
- }
- if (
- !_.isUndefined(compiledContract.evm.deployedBytecode) &&
- !_.isUndefined(compiledContract.evm.deployedBytecode.object)
- ) {
- compiledContract.evm.deployedBytecode.object = ethUtil.addHexPrefix(
- compiledContract.evm.deployedBytecode.object,
- );
- }
- }
- }
/**
* Instantiates a new instance of the Compiler class.
* @param opts Optional compiler options
@@ -158,7 +117,7 @@ export class Compiler {
*/
public async compileAsync(): Promise<void> {
await createDirIfDoesNotExistAsync(this._artifactsDir);
- await createDirIfDoesNotExistAsync(SOLC_BIN_DIR);
+ await createDirIfDoesNotExistAsync(constants.SOLC_BIN_DIR);
await this._compileContractsAsync(this._getContractNamesToCompile(), true);
}
/**
@@ -173,6 +132,54 @@ export class Compiler {
const promisedOutputs = this._compileContractsAsync(this._getContractNamesToCompile(), false);
return promisedOutputs;
}
+ public async watchAsync(): Promise<void> {
+ console.clear(); // tslint:disable-line:no-console
+ logUtils.logWithTime('Starting compilation in watch mode...');
+ const MATCH_NOTHING_REGEX = '^$';
+ const IGNORE_DOT_FILES_REGEX = /(^|[\/\\])\../;
+ // Initially we watch nothing. We'll add the paths later.
+ const watcher = chokidar.watch(MATCH_NOTHING_REGEX, { ignored: IGNORE_DOT_FILES_REGEX });
+ const onFileChangedAsync = async () => {
+ watcher.unwatch('*'); // Stop watching
+ try {
+ await this.compileAsync();
+ logUtils.logWithTime('Found 0 errors. Watching for file changes.');
+ } catch (err) {
+ if (err.typeName === 'CompilationError') {
+ logUtils.logWithTime(
+ `Found ${err.errorsCount} ${pluralize('error', err.errorsCount)}. Watching for file changes.`,
+ );
+ } else {
+ logUtils.logWithTime('Found errors. Watching for file changes.');
+ }
+ }
+
+ const pathsToWatch = this._getPathsToWatch();
+ watcher.add(pathsToWatch);
+ };
+ await onFileChangedAsync();
+ watcher.on('change', (changedFilePath: string) => {
+ console.clear(); // tslint:disable-line:no-console
+ logUtils.logWithTime('File change detected. Starting incremental compilation...');
+ // NOTE: We can't await it here because that's a callback.
+ // Instead we stop watching inside of it and start it again when we're finished.
+ onFileChangedAsync(); // tslint:disable-line no-floating-promises
+ });
+ }
+ private _getPathsToWatch(): string[] {
+ const contractNames = this._getContractNamesToCompile();
+ const spyResolver = new SpyResolver(this._resolver);
+ for (const contractName of contractNames) {
+ const contractSource = spyResolver.resolve(contractName);
+ // NOTE: We ignore the return value here. We don't want to compute the source tree hash.
+ // We just want to call a SpyResolver on each contracts and it's dependencies and
+ // this is a convenient way to reuse the existing code that does that.
+ // We can then get all the relevant paths from the `spyResolver` below.
+ getSourceTreeHash(spyResolver, contractSource.path);
+ }
+ const pathsToWatch = _.uniq(spyResolver.resolvedContractSources.map(cs => cs.absolutePath));
+ return pathsToWatch;
+ }
private _getContractNamesToCompile(): string[] {
let contractNamesToCompile;
if (this._specifiedContracts === ALL_CONTRACTS_IDENTIFIER) {
@@ -201,12 +208,14 @@ export class Compiler {
for (const contractName of contractNames) {
const contractSource = this._resolver.resolve(contractName);
+ const sourceTreeHashHex = getSourceTreeHash(
+ this._resolver,
+ path.join(this._contractsDir, contractSource.path),
+ ).toString('hex');
const contractData = {
contractName,
currentArtifactIfExists: await getContractArtifactIfExistsAsync(this._artifactsDir, contractName),
- sourceTreeHashHex: `0x${this._getSourceTreeHash(
- path.join(this._contractsDir, contractSource.path),
- ).toString('hex')}`,
+ sourceTreeHashHex: `0x${sourceTreeHashHex}`,
};
if (!this._shouldCompile(contractData)) {
continue;
@@ -244,9 +253,8 @@ export class Compiler {
}) with Solidity v${solcVersion}...`,
);
- const { solcInstance, fullSolcVersion } = await Compiler._getSolcAsync(solcVersion);
-
- const compilerOutput = this._compile(solcInstance, input.standardInput);
+ const { solcInstance, fullSolcVersion } = await getSolcAsync(solcVersion);
+ const compilerOutput = compile(this._resolver, solcInstance, input.standardInput);
compilerOutputs.push(compilerOutput);
for (const contractPath of input.contractsToCompile) {
@@ -259,7 +267,7 @@ export class Compiler {
);
}
- Compiler._addHexPrefixToContractBytecode(compiledContract);
+ addHexPrefixToContractBytecode(compiledContract);
if (shouldPersist) {
await this._persistCompiledContractAsync(
@@ -298,10 +306,14 @@ export class Compiler {
const compiledContract = compilerOutput.contracts[contractPath][contractName];
// need to gather sourceCodes for this artifact, but compilerOutput.sources (the list of contract modules)
- // contains listings for for every contract compiled during the compiler invocation that compiled the contract
+ // contains listings for every contract compiled during the compiler invocation that compiled the contract
// to be persisted, which could include many that are irrelevant to the contract at hand. So, gather up only
// the relevant sources:
- const { sourceCodes, sources } = this._getSourcesWithDependencies(contractPath, compilerOutput.sources);
+ const { sourceCodes, sources } = getSourcesWithDependencies(
+ this._resolver,
+ contractPath,
+ compilerOutput.sources,
+ );
const contractVersion: ContractVersionData = {
compilerOutput: compiledContract,
@@ -336,123 +348,4 @@ export class Compiler {
await fsWrapper.writeFileAsync(currentArtifactPath, artifactString);
logUtils.warn(`${contractName} artifact saved!`);
}
- /**
- * For the given @param contractPath, populates JSON objects to be used in the ContractVersionData interface's
- * properties `sources` (source code file names mapped to ID numbers) and `sourceCodes` (source code content of
- * contracts) for that contract. The source code pointed to by contractPath is read and parsed directly (via
- * `this._resolver.resolve().source`), as are its imports, recursively. The ID numbers for @return `sources` are
- * taken from the corresponding ID's in @param fullSources, and the content for @return sourceCodes is read from
- * disk (via the aforementioned `resolver.source`).
- */
- private _getSourcesWithDependencies(
- contractPath: string,
- fullSources: { [sourceName: string]: { id: number } },
- ): { sourceCodes: { [sourceName: string]: string }; sources: { [sourceName: string]: { id: number } } } {
- const sources = { [contractPath]: { id: fullSources[contractPath].id } };
- const sourceCodes = { [contractPath]: this._resolver.resolve(contractPath).source };
- this._recursivelyGatherDependencySources(
- contractPath,
- sourceCodes[contractPath],
- fullSources,
- sources,
- sourceCodes,
- );
- return { sourceCodes, sources };
- }
- private _recursivelyGatherDependencySources(
- contractPath: string,
- contractSource: string,
- fullSources: { [sourceName: string]: { id: number } },
- sourcesToAppendTo: { [sourceName: string]: { id: number } },
- sourceCodesToAppendTo: { [sourceName: string]: string },
- ): void {
- const importStatementMatches = contractSource.match(/\nimport[^;]*;/g);
- if (importStatementMatches === null) {
- return;
- }
- for (const importStatementMatch of importStatementMatches) {
- const importPathMatches = importStatementMatch.match(/\"([^\"]*)\"/);
- if (importPathMatches === null || importPathMatches.length === 0) {
- continue;
- }
-
- let importPath = importPathMatches[1];
- // HACK(ablrow): We have, e.g.:
- //
- // importPath = "../../utils/LibBytes/LibBytes.sol"
- // contractPath = "2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol"
- //
- // Resolver doesn't understand "../" so we want to pass
- // "2.0.0/utils/LibBytes/LibBytes.sol" to resolver.
- //
- // This hack involves using path.resolve. But path.resolve returns
- // absolute directories by default. We trick it into thinking that
- // contractPath is a root directory by prepending a '/' and then
- // removing the '/' the end.
- //
- // path.resolve("/a/b/c", ""../../d/e") === "/a/d/e"
- //
- const lastPathSeparatorPos = contractPath.lastIndexOf('/');
- const contractFolder = lastPathSeparatorPos === -1 ? '' : contractPath.slice(0, lastPathSeparatorPos + 1);
- importPath = path.resolve('/' + contractFolder, importPath).replace('/', '');
-
- if (_.isUndefined(sourcesToAppendTo[importPath])) {
- sourcesToAppendTo[importPath] = { id: fullSources[importPath].id };
- sourceCodesToAppendTo[importPath] = this._resolver.resolve(importPath).source;
-
- this._recursivelyGatherDependencySources(
- importPath,
- this._resolver.resolve(importPath).source,
- fullSources,
- sourcesToAppendTo,
- sourceCodesToAppendTo,
- );
- }
- }
- }
- private _compile(solcInstance: solc.SolcInstance, standardInput: solc.StandardInput): solc.StandardOutput {
- const compiled: solc.StandardOutput = JSON.parse(
- solcInstance.compileStandardWrapper(JSON.stringify(standardInput), importPath => {
- const sourceCodeIfExists = this._resolver.resolve(importPath);
- return { contents: sourceCodeIfExists.source };
- }),
- );
- if (!_.isUndefined(compiled.errors)) {
- const SOLIDITY_WARNING = 'warning';
- const errors = _.filter(compiled.errors, entry => entry.severity !== SOLIDITY_WARNING);
- const warnings = _.filter(compiled.errors, entry => entry.severity === SOLIDITY_WARNING);
- if (!_.isEmpty(errors)) {
- errors.forEach(error => {
- const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message);
- logUtils.warn(chalk.red(normalizedErrMsg));
- });
- throw new Error('Compilation errors encountered');
- } else {
- warnings.forEach(warning => {
- const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message);
- logUtils.warn(chalk.yellow(normalizedWarningMsg));
- });
- }
- }
- return compiled;
- }
- /**
- * Gets the source tree hash for a file and its dependencies.
- * @param fileName Name of contract file.
- */
- private _getSourceTreeHash(importPath: string): Buffer {
- const contractSource = this._resolver.resolve(importPath);
- const dependencies = parseDependencies(contractSource);
- const sourceHash = ethUtil.sha3(contractSource.source);
- if (dependencies.length === 0) {
- return sourceHash;
- } else {
- const dependencySourceTreeHashes = _.map(dependencies, (dependency: string) =>
- this._getSourceTreeHash(dependency),
- );
- const sourceTreeHashesBuffer = Buffer.concat([sourceHash, ...dependencySourceTreeHashes]);
- const sourceTreeHash = ethUtil.sha3(sourceTreeHashesBuffer);
- return sourceTreeHash;
- }
- }
}
diff --git a/packages/sol-compiler/src/utils/compiler.ts b/packages/sol-compiler/src/utils/compiler.ts
index cda67a414..db308f2b5 100644
--- a/packages/sol-compiler/src/utils/compiler.ts
+++ b/packages/sol-compiler/src/utils/compiler.ts
@@ -1,10 +1,18 @@
-import { ContractSource } from '@0x/sol-resolver';
-import { logUtils } from '@0x/utils';
+import { ContractSource, Resolver } from '@0x/sol-resolver';
+import { fetchAsync, logUtils } from '@0x/utils';
+import chalk from 'chalk';
import { ContractArtifact } from 'ethereum-types';
+import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import * as path from 'path';
+import * as requireFromString from 'require-from-string';
+import * as solc from 'solc';
+import { binPaths } from '../solc/bin_paths';
+
+import { constants } from './constants';
import { fsWrapper } from './fs_wrapper';
+import { CompilationError } from './types';
/**
* Gets contract data on network or returns if an artifact does not exist.
@@ -106,3 +114,208 @@ export function parseDependencies(contractSource: ContractSource): string[] {
});
return dependencies;
}
+
+/**
+ * Compiles the contracts and prints errors/warnings
+ * @param resolver Resolver
+ * @param solcInstance Instance of a solc compiler
+ * @param standardInput Solidity standard JSON input
+ */
+export function compile(
+ resolver: Resolver,
+ solcInstance: solc.SolcInstance,
+ standardInput: solc.StandardInput,
+): solc.StandardOutput {
+ const standardInputStr = JSON.stringify(standardInput);
+ const standardOutputStr = solcInstance.compileStandardWrapper(standardInputStr, importPath => {
+ const sourceCodeIfExists = resolver.resolve(importPath);
+ return { contents: sourceCodeIfExists.source };
+ });
+ const compiled: solc.StandardOutput = JSON.parse(standardOutputStr);
+ if (!_.isUndefined(compiled.errors)) {
+ printCompilationErrorsAndWarnings(compiled.errors);
+ }
+ return compiled;
+}
+/**
+ * Separates errors from warnings, formats the messages and prints them. Throws if there is any compilation error (not warning).
+ * @param solcErrors The errors field of standard JSON output that contains errors and warnings.
+ */
+function printCompilationErrorsAndWarnings(solcErrors: solc.SolcError[]): void {
+ const SOLIDITY_WARNING = 'warning';
+ const errors = _.filter(solcErrors, entry => entry.severity !== SOLIDITY_WARNING);
+ const warnings = _.filter(solcErrors, entry => entry.severity === SOLIDITY_WARNING);
+ if (!_.isEmpty(errors)) {
+ errors.forEach(error => {
+ const normalizedErrMsg = getNormalizedErrMsg(error.formattedMessage || error.message);
+ logUtils.log(chalk.red('error'), normalizedErrMsg);
+ });
+ throw new CompilationError(errors.length);
+ } else {
+ warnings.forEach(warning => {
+ const normalizedWarningMsg = getNormalizedErrMsg(warning.formattedMessage || warning.message);
+ logUtils.log(chalk.yellow('warning'), normalizedWarningMsg);
+ });
+ }
+}
+
+/**
+ * Gets the source tree hash for a file and its dependencies.
+ * @param fileName Name of contract file.
+ */
+export function getSourceTreeHash(resolver: Resolver, importPath: string): Buffer {
+ const contractSource = resolver.resolve(importPath);
+ const dependencies = parseDependencies(contractSource);
+ const sourceHash = ethUtil.sha3(contractSource.source);
+ if (dependencies.length === 0) {
+ return sourceHash;
+ } else {
+ const dependencySourceTreeHashes = _.map(dependencies, (dependency: string) =>
+ getSourceTreeHash(resolver, dependency),
+ );
+ const sourceTreeHashesBuffer = Buffer.concat([sourceHash, ...dependencySourceTreeHashes]);
+ const sourceTreeHash = ethUtil.sha3(sourceTreeHashesBuffer);
+ return sourceTreeHash;
+ }
+}
+
+/**
+ * For the given @param contractPath, populates JSON objects to be used in the ContractVersionData interface's
+ * properties `sources` (source code file names mapped to ID numbers) and `sourceCodes` (source code content of
+ * contracts) for that contract. The source code pointed to by contractPath is read and parsed directly (via
+ * `resolver.resolve().source`), as are its imports, recursively. The ID numbers for @return `sources` are
+ * taken from the corresponding ID's in @param fullSources, and the content for @return sourceCodes is read from
+ * disk (via the aforementioned `resolver.source`).
+ */
+export function getSourcesWithDependencies(
+ resolver: Resolver,
+ contractPath: string,
+ fullSources: { [sourceName: string]: { id: number } },
+): { sourceCodes: { [sourceName: string]: string }; sources: { [sourceName: string]: { id: number } } } {
+ const sources = { [contractPath]: { id: fullSources[contractPath].id } };
+ const sourceCodes = { [contractPath]: resolver.resolve(contractPath).source };
+ recursivelyGatherDependencySources(
+ resolver,
+ contractPath,
+ sourceCodes[contractPath],
+ fullSources,
+ sources,
+ sourceCodes,
+ );
+ return { sourceCodes, sources };
+}
+
+function recursivelyGatherDependencySources(
+ resolver: Resolver,
+ contractPath: string,
+ contractSource: string,
+ fullSources: { [sourceName: string]: { id: number } },
+ sourcesToAppendTo: { [sourceName: string]: { id: number } },
+ sourceCodesToAppendTo: { [sourceName: string]: string },
+): void {
+ const importStatementMatches = contractSource.match(/\nimport[^;]*;/g);
+ if (importStatementMatches === null) {
+ return;
+ }
+ for (const importStatementMatch of importStatementMatches) {
+ const importPathMatches = importStatementMatch.match(/\"([^\"]*)\"/);
+ if (importPathMatches === null || importPathMatches.length === 0) {
+ continue;
+ }
+
+ let importPath = importPathMatches[1];
+ // HACK(albrow): We have, e.g.:
+ //
+ // importPath = "../../utils/LibBytes/LibBytes.sol"
+ // contractPath = "2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol"
+ //
+ // Resolver doesn't understand "../" so we want to pass
+ // "2.0.0/utils/LibBytes/LibBytes.sol" to resolver.
+ //
+ // This hack involves using path.resolve. But path.resolve returns
+ // absolute directories by default. We trick it into thinking that
+ // contractPath is a root directory by prepending a '/' and then
+ // removing the '/' the end.
+ //
+ // path.resolve("/a/b/c", ""../../d/e") === "/a/d/e"
+ //
+ const lastPathSeparatorPos = contractPath.lastIndexOf('/');
+ const contractFolder = lastPathSeparatorPos === -1 ? '' : contractPath.slice(0, lastPathSeparatorPos + 1);
+ if (importPath.startsWith('.')) {
+ /**
+ * Some imports path are relative ("../Token.sol", "./Wallet.sol")
+ * while others are absolute ("Token.sol", "@0x/contracts/Wallet.sol")
+ * And we need to append the base path for relative imports.
+ */
+ importPath = path.resolve(`/${contractFolder}`, importPath).replace('/', '');
+ }
+
+ if (_.isUndefined(sourcesToAppendTo[importPath])) {
+ sourcesToAppendTo[importPath] = { id: fullSources[importPath].id };
+ sourceCodesToAppendTo[importPath] = resolver.resolve(importPath).source;
+
+ recursivelyGatherDependencySources(
+ resolver,
+ importPath,
+ resolver.resolve(importPath).source,
+ fullSources,
+ sourcesToAppendTo,
+ sourceCodesToAppendTo,
+ );
+ }
+ }
+}
+
+/**
+ * Gets the solidity compiler instance and full version name. If the compiler is already cached - gets it from FS,
+ * otherwise - fetches it and caches it.
+ * @param solcVersion The compiler version. e.g. 0.5.0
+ */
+export async function getSolcAsync(
+ solcVersion: string,
+): Promise<{ solcInstance: solc.SolcInstance; fullSolcVersion: string }> {
+ const fullSolcVersion = binPaths[solcVersion];
+ if (_.isUndefined(fullSolcVersion)) {
+ throw new Error(`${solcVersion} is not a known compiler version`);
+ }
+ const compilerBinFilename = path.join(constants.SOLC_BIN_DIR, fullSolcVersion);
+ let solcjs: string;
+ if (await fsWrapper.doesFileExistAsync(compilerBinFilename)) {
+ solcjs = (await fsWrapper.readFileAsync(compilerBinFilename)).toString();
+ } else {
+ logUtils.warn(`Downloading ${fullSolcVersion}...`);
+ const url = `${constants.BASE_COMPILER_URL}${fullSolcVersion}`;
+ const response = await fetchAsync(url);
+ const SUCCESS_STATUS = 200;
+ if (response.status !== SUCCESS_STATUS) {
+ throw new Error(`Failed to load ${fullSolcVersion}`);
+ }
+ solcjs = await response.text();
+ await fsWrapper.writeFileAsync(compilerBinFilename, solcjs);
+ }
+ if (solcjs.length === 0) {
+ throw new Error('No compiler available');
+ }
+ const solcInstance = solc.setupMethods(requireFromString(solcjs, compilerBinFilename));
+ return { solcInstance, fullSolcVersion };
+}
+
+/**
+ * Solidity compiler emits the bytecode without a 0x prefix for a hex. This function fixes it if bytecode is present.
+ * @param compiledContract The standard JSON output section for a contract. Geth modified in place.
+ */
+export function addHexPrefixToContractBytecode(compiledContract: solc.StandardContractOutput): void {
+ if (!_.isUndefined(compiledContract.evm)) {
+ if (!_.isUndefined(compiledContract.evm.bytecode) && !_.isUndefined(compiledContract.evm.bytecode.object)) {
+ compiledContract.evm.bytecode.object = ethUtil.addHexPrefix(compiledContract.evm.bytecode.object);
+ }
+ if (
+ !_.isUndefined(compiledContract.evm.deployedBytecode) &&
+ !_.isUndefined(compiledContract.evm.deployedBytecode.object)
+ ) {
+ compiledContract.evm.deployedBytecode.object = ethUtil.addHexPrefix(
+ compiledContract.evm.deployedBytecode.object,
+ );
+ }
+ }
+}
diff --git a/packages/sol-compiler/src/utils/constants.ts b/packages/sol-compiler/src/utils/constants.ts
index df2ddb3b2..433897f8a 100644
--- a/packages/sol-compiler/src/utils/constants.ts
+++ b/packages/sol-compiler/src/utils/constants.ts
@@ -1,5 +1,8 @@
+import * as path from 'path';
+
export const constants = {
SOLIDITY_FILE_EXTENSION: '.sol',
BASE_COMPILER_URL: 'https://ethereum.github.io/solc-bin/bin/',
LATEST_ARTIFACT_VERSION: '2.0.0',
+ SOLC_BIN_DIR: path.join(__dirname, '..', '..', 'solc_bin'),
};
diff --git a/packages/sol-compiler/src/utils/types.ts b/packages/sol-compiler/src/utils/types.ts
index b211cfcbc..64328899d 100644
--- a/packages/sol-compiler/src/utils/types.ts
+++ b/packages/sol-compiler/src/utils/types.ts
@@ -29,3 +29,12 @@ export interface Token {
}
export type DoneCallback = (err?: Error) => void;
+
+export class CompilationError extends Error {
+ public errorsCount: number;
+ public typeName = 'CompilationError';
+ constructor(errorsCount: number) {
+ super('Compilation errors encountered');
+ this.errorsCount = errorsCount;
+ }
+}
diff --git a/packages/sol-compiler/test/compiler_utils_test.ts b/packages/sol-compiler/test/compiler_utils_test.ts
index 4fe7b994e..b8c18110c 100644
--- a/packages/sol-compiler/test/compiler_utils_test.ts
+++ b/packages/sol-compiler/test/compiler_utils_test.ts
@@ -52,7 +52,7 @@ describe('Compiler utils', () => {
const source = await fsWrapper.readFileAsync(path, {
encoding: 'utf8',
});
- const dependencies = parseDependencies({ source, path });
+ const dependencies = parseDependencies({ source, path, absolutePath: path });
const expectedDependencies = [
'zeppelin-solidity/contracts/token/ERC20/ERC20.sol',
'packages/sol-compiler/lib/test/fixtures/contracts/TokenTransferProxy.sol',
@@ -68,7 +68,7 @@ describe('Compiler utils', () => {
const source = await fsWrapper.readFileAsync(path, {
encoding: 'utf8',
});
- expect(parseDependencies({ source, path })).to.be.deep.equal([
+ expect(parseDependencies({ source, path, absolutePath: path })).to.be.deep.equal([
'zeppelin-solidity/contracts/ownership/Ownable.sol',
'zeppelin-solidity/contracts/token/ERC20/ERC20.sol',
]);
@@ -77,7 +77,7 @@ describe('Compiler utils', () => {
it.skip('correctly parses commented out dependencies', async () => {
const path = '';
const source = `// import "./TokenTransferProxy.sol";`;
- expect(parseDependencies({ path, source })).to.be.deep.equal([]);
+ expect(parseDependencies({ path, source, absolutePath: path })).to.be.deep.equal([]);
});
});
});
diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json
index bdeda8a96..b7973c135 100644
--- a/packages/sol-cov/CHANGELOG.json
+++ b/packages/sol-cov/CHANGELOG.json
@@ -1,5 +1,41 @@
[
{
+ "version": "2.1.16",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.1.15",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "2.1.14",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "2.1.13",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "2.1.12",
"changes": [
diff --git a/packages/sol-cov/CHANGELOG.md b/packages/sol-cov/CHANGELOG.md
index 906c0dd52..879ef9c95 100644
--- a/packages/sol-cov/CHANGELOG.md
+++ b/packages/sol-cov/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.1.16 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.1.15 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v2.1.14 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v2.1.13 - _November 21, 2018_
+
+ * Dependencies updated
+
## v2.1.12 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json
index 159a2207d..3ade51c80 100644
--- a/packages/sol-cov/package.json
+++ b/packages/sol-cov/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-cov",
- "version": "2.1.12",
+ "version": "2.1.16",
"engines": {
"node": ">=6.12"
},
@@ -42,14 +42,14 @@
},
"homepage": "https://github.com/0xProject/0x.js/packages/sol-cov/README.md",
"dependencies": {
- "@0x/dev-utils": "^1.0.17",
- "@0x/sol-compiler": "^1.1.12",
- "@0x/subproviders": "^2.1.4",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/dev-utils": "^1.0.21",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@types/solidity-parser-antlr": "^0.2.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"glob": "^7.1.2",
"istanbul": "^0.4.5",
@@ -61,7 +61,7 @@
"solidity-parser-antlr": "^0.2.12"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/istanbul": "^0.4.30",
"@types/loglevel": "^1.5.3",
"@types/mkdirp": "^0.5.1",
diff --git a/packages/sol-doc/CHANGELOG.json b/packages/sol-doc/CHANGELOG.json
index a9547c883..e8fef746e 100644
--- a/packages/sol-doc/CHANGELOG.json
+++ b/packages/sol-doc/CHANGELOG.json
@@ -1,5 +1,41 @@
[
{
+ "version": "1.0.11",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.10",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "1.0.9",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "1.0.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "1.0.7",
"changes": [
diff --git a/packages/sol-doc/CHANGELOG.md b/packages/sol-doc/CHANGELOG.md
index 74a736c75..1b4a938af 100644
--- a/packages/sol-doc/CHANGELOG.md
+++ b/packages/sol-doc/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.11 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.10 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v1.0.9 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v1.0.8 - _November 21, 2018_
+
+ * Dependencies updated
+
## v1.0.7 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/sol-doc/package.json b/packages/sol-doc/package.json
index e56408f98..c83c122df 100644
--- a/packages/sol-doc/package.json
+++ b/packages/sol-doc/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-doc",
- "version": "1.0.7",
+ "version": "1.0.11",
"description": "Solidity documentation generator",
"main": "lib/src/index.js",
"types": "lib/src/index.d.js",
@@ -25,16 +25,16 @@
"author": "F. Eugene Aumson",
"license": "Apache-2.0",
"dependencies": {
- "@0x/sol-compiler": "^1.1.12",
- "@0x/types": "^1.2.1",
- "@0x/utils": "^2.0.5",
- "ethereum-types": "^1.1.2",
+ "@0x/sol-compiler": "^1.1.16",
+ "@0x/types": "^1.4.1",
+ "@0x/utils": "^2.0.8",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.10",
"yargs": "^12.0.2"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.0",
"chai-bignumber": "^2.0.2",
diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json
index a6ff84237..74c4d39c5 100644
--- a/packages/sol-resolver/CHANGELOG.json
+++ b/packages/sol-resolver/CHANGELOG.json
@@ -1,5 +1,46 @@
[
{
+ "version": "1.2.1",
+ "changes": [
+ {
+ "note": "Add `absolutePath` to `ContractSource` type",
+ "pr": 1461
+ },
+ {
+ "note": "Add `SpyResolver` that records all resolved contracts data",
+ "pr": 1461
+ }
+ ]
+ },
+ {
+ "version": "1.1.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.1.0",
+ "changes": [
+ {
+ "note": "NPMResolver now supports scoped packages",
+ "pr": 1311
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "1.0.17",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"version": "1.0.16",
"changes": [
{
diff --git a/packages/sol-resolver/CHANGELOG.md b/packages/sol-resolver/CHANGELOG.md
index f8c5a7692..98435be19 100644
--- a/packages/sol-resolver/CHANGELOG.md
+++ b/packages/sol-resolver/CHANGELOG.md
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.1.1 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.1.0 - _December 11, 2018_
+
+ * NPMResolver now supports scoped packages (#1311)
+
+## v1.0.17 - _November 21, 2018_
+
+ * Dependencies updated
+
## v1.0.16 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json
index 7572072c4..0163765d9 100644
--- a/packages/sol-resolver/package.json
+++ b/packages/sol-resolver/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sol-resolver",
- "version": "1.0.16",
+ "version": "1.1.1",
"engines": {
"node": ">=6.12"
},
@@ -23,15 +23,15 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/resolver/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
"tslint": "5.11.0",
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
"lodash": "^4.17.5"
},
"publishConfig": {
diff --git a/packages/sol-resolver/src/index.ts b/packages/sol-resolver/src/index.ts
index a86053259..f55aca070 100644
--- a/packages/sol-resolver/src/index.ts
+++ b/packages/sol-resolver/src/index.ts
@@ -5,5 +5,6 @@ export { NPMResolver } from './resolvers/npm_resolver';
export { FSResolver } from './resolvers/fs_resolver';
export { RelativeFSResolver } from './resolvers/relative_fs_resolver';
export { NameResolver } from './resolvers/name_resolver';
+export { SpyResolver } from './resolvers/spy_resolver';
export { EnumerableResolver } from './resolvers/enumerable_resolver';
export { Resolver } from './resolvers/resolver';
diff --git a/packages/sol-resolver/src/resolvers/fs_resolver.ts b/packages/sol-resolver/src/resolvers/fs_resolver.ts
index 63fc3448e..86128023d 100644
--- a/packages/sol-resolver/src/resolvers/fs_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/fs_resolver.ts
@@ -9,10 +9,7 @@ export class FSResolver extends Resolver {
public resolveIfExists(importPath: string): ContractSource | undefined {
if (fs.existsSync(importPath) && fs.lstatSync(importPath).isFile()) {
const fileContent = fs.readFileSync(importPath).toString();
- return {
- source: fileContent,
- path: importPath,
- };
+ return { source: fileContent, path: importPath, absolutePath: importPath };
}
return undefined;
}
diff --git a/packages/sol-resolver/src/resolvers/name_resolver.ts b/packages/sol-resolver/src/resolvers/name_resolver.ts
index d6ac6a499..aee326fb7 100644
--- a/packages/sol-resolver/src/resolvers/name_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/name_resolver.ts
@@ -20,10 +20,7 @@ export class NameResolver extends EnumerableResolver {
if (contractName === lookupContractName) {
const absoluteContractPath = path.join(this._contractsDir, filePath);
const source = fs.readFileSync(absoluteContractPath).toString();
- contractSource = {
- source,
- path: filePath,
- };
+ contractSource = { source, path: filePath, absolutePath: absoluteContractPath };
return true;
}
return undefined;
@@ -36,10 +33,7 @@ export class NameResolver extends EnumerableResolver {
const onFile = (filePath: string) => {
const absoluteContractPath = path.join(this._contractsDir, filePath);
const source = fs.readFileSync(absoluteContractPath).toString();
- const contractSource = {
- source,
- path: filePath,
- };
+ const contractSource = { source, path: filePath, absolutePath: absoluteContractPath };
contractSources.push(contractSource);
};
this._traverseContractsDir(this._contractsDir, onFile);
diff --git a/packages/sol-resolver/src/resolvers/npm_resolver.ts b/packages/sol-resolver/src/resolvers/npm_resolver.ts
index a2df0dcad..3c1d09557 100644
--- a/packages/sol-resolver/src/resolvers/npm_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/npm_resolver.ts
@@ -1,4 +1,5 @@
import * as fs from 'fs';
+import * as _ from 'lodash';
import * as path from 'path';
import { ContractSource } from '../types';
@@ -13,18 +14,25 @@ export class NPMResolver extends Resolver {
}
public resolveIfExists(importPath: string): ContractSource | undefined {
if (!importPath.startsWith('/')) {
- const [packageName, ...other] = importPath.split('/');
+ let packageName;
+ let packageScopeIfExists;
+ let other;
+ if (_.startsWith(importPath, '@')) {
+ [packageScopeIfExists, packageName, ...other] = importPath.split('/');
+ } else {
+ [packageName, ...other] = importPath.split('/');
+ }
const pathWithinPackage = path.join(...other);
let currentPath = this._packagePath;
const ROOT_PATH = '/';
while (currentPath !== ROOT_PATH) {
- const lookupPath = path.join(currentPath, 'node_modules', packageName, pathWithinPackage);
+ const packagePath = _.isUndefined(packageScopeIfExists)
+ ? packageName
+ : path.join(packageScopeIfExists, packageName);
+ const lookupPath = path.join(currentPath, 'node_modules', packagePath, pathWithinPackage);
if (fs.existsSync(lookupPath) && fs.lstatSync(lookupPath).isFile()) {
const fileContent = fs.readFileSync(lookupPath).toString();
- return {
- source: fileContent,
- path: lookupPath,
- };
+ return { source: fileContent, path: importPath, absolutePath: lookupPath };
}
currentPath = path.dirname(currentPath);
}
diff --git a/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts b/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts
index ed96040d3..cfff145f9 100644
--- a/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/relative_fs_resolver.ts
@@ -13,13 +13,10 @@ export class RelativeFSResolver extends Resolver {
}
// tslint:disable-next-line:prefer-function-over-method
public resolveIfExists(importPath: string): ContractSource | undefined {
- const filePath = path.join(this._contractsDir, importPath);
+ const filePath = path.resolve(path.join(this._contractsDir, importPath));
if (fs.existsSync(filePath) && !fs.lstatSync(filePath).isDirectory()) {
const fileContent = fs.readFileSync(filePath).toString();
- return {
- source: fileContent,
- path: importPath,
- };
+ return { source: fileContent, path: importPath, absolutePath: filePath };
}
return undefined;
}
diff --git a/packages/sol-resolver/src/resolvers/spy_resolver.ts b/packages/sol-resolver/src/resolvers/spy_resolver.ts
new file mode 100644
index 000000000..5582d771a
--- /dev/null
+++ b/packages/sol-resolver/src/resolvers/spy_resolver.ts
@@ -0,0 +1,25 @@
+import * as _ from 'lodash';
+
+import { ContractSource } from '../types';
+
+import { Resolver } from './resolver';
+
+/**
+ * This resolver is a passthrough proxy to any resolver that records all the resolved contracts sources.
+ * You can access them later using the `resolvedContractSources` public field.
+ */
+export class SpyResolver extends Resolver {
+ public resolvedContractSources: ContractSource[] = [];
+ private readonly _resolver: Resolver;
+ constructor(resolver: Resolver) {
+ super();
+ this._resolver = resolver;
+ }
+ public resolveIfExists(importPath: string): ContractSource | undefined {
+ const contractSourceIfExists = this._resolver.resolveIfExists(importPath);
+ if (!_.isUndefined(contractSourceIfExists)) {
+ this.resolvedContractSources.push(contractSourceIfExists);
+ }
+ return contractSourceIfExists;
+ }
+}
diff --git a/packages/sol-resolver/src/resolvers/url_resolver.ts b/packages/sol-resolver/src/resolvers/url_resolver.ts
index 180b0c9f6..ef300e6db 100644
--- a/packages/sol-resolver/src/resolvers/url_resolver.ts
+++ b/packages/sol-resolver/src/resolvers/url_resolver.ts
@@ -11,10 +11,7 @@ export class URLResolver extends Resolver {
if (importPath.startsWith(FILE_URL_PREXIF)) {
const filePath = importPath.substr(FILE_URL_PREXIF.length);
const fileContent = fs.readFileSync(filePath).toString();
- return {
- source: fileContent,
- path: importPath,
- };
+ return { source: fileContent, path: importPath, absolutePath: filePath };
}
return undefined;
}
diff --git a/packages/sol-resolver/src/types.ts b/packages/sol-resolver/src/types.ts
index 41492622d..b4ba164c8 100644
--- a/packages/sol-resolver/src/types.ts
+++ b/packages/sol-resolver/src/types.ts
@@ -1,6 +1,7 @@
export interface ContractSource {
source: string;
path: string;
+ absolutePath: string;
}
export interface ContractSources {
diff --git a/packages/sra-spec/CHANGELOG.json b/packages/sra-spec/CHANGELOG.json
index 3cc917e5a..393054465 100644
--- a/packages/sra-spec/CHANGELOG.json
+++ b/packages/sra-spec/CHANGELOG.json
@@ -1,5 +1,32 @@
[
{
+ "version": "1.0.13",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.0.12",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "1.0.11",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "1.0.10",
"changes": [
diff --git a/packages/sra-spec/CHANGELOG.md b/packages/sra-spec/CHANGELOG.md
index 8b2b7747b..fd673b837 100644
--- a/packages/sra-spec/CHANGELOG.md
+++ b/packages/sra-spec/CHANGELOG.md
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.0.13 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.0.12 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v1.0.11 - _November 21, 2018_
+
+ * Dependencies updated
+
## v1.0.10 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json
index fac5a5a4b..3a6ee96d3 100644
--- a/packages/sra-spec/package.json
+++ b/packages/sra-spec/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/sra-spec",
- "version": "1.0.10",
+ "version": "1.0.13",
"engines": {
"node": ">=6.12"
},
@@ -35,11 +35,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/sra-spec/README.md",
"dependencies": {
- "@0x/json-schemas": "^2.1.1",
+ "@0x/json-schemas": "^2.1.4",
"@loopback/openapi-v3-types": "^0.8.2"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/mocha": "^2.2.42",
"@types/node": "^10.5.3",
"chai": "^4.0.1",
diff --git a/packages/sra-spec/public/index.html b/packages/sra-spec/public/index.html
index e75ae7f04..5271b50c6 100644
--- a/packages/sra-spec/public/index.html
+++ b/packages/sra-spec/public/index.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <title>ReDoc</title>
+ <title>0x Standard Relayer API</title>
<!-- needed for adaptive design -->
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -21,4 +21,4 @@
<redoc spec-url='http://sra-spec.s3-website-us-east-1.amazonaws.com/api.json'></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json
index cdc150c3a..938b2a717 100644
--- a/packages/subproviders/CHANGELOG.json
+++ b/packages/subproviders/CHANGELOG.json
@@ -1,5 +1,41 @@
[
{
+ "version": "2.1.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.1.7",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1543401373,
+ "version": "2.1.6",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "2.1.5",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "2.1.4",
"changes": [
diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md
index eda76bd2f..002c76395 100644
--- a/packages/subproviders/CHANGELOG.md
+++ b/packages/subproviders/CHANGELOG.md
@@ -5,6 +5,22 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.1.8 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.1.7 - _December 11, 2018_
+
+ * Dependencies updated
+
+## v2.1.6 - _November 28, 2018_
+
+ * Dependencies updated
+
+## v2.1.5 - _November 21, 2018_
+
+ * Dependencies updated
+
## v2.1.4 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index d249e4d6d..90ef6b677 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/subproviders",
- "version": "2.1.4",
+ "version": "2.1.8",
"engines": {
"node": ">=6.12"
},
@@ -29,11 +29,11 @@
}
},
"dependencies": {
- "@0x/assert": "^1.0.17",
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/assert": "^1.0.20",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"@ledgerhq/hw-app-eth": "^4.3.0",
"@ledgerhq/hw-transport-u2f": "4.24.0",
"@types/eth-lightwallet": "^3.0.0",
@@ -43,7 +43,7 @@
"bip39": "^2.5.0",
"bn.js": "^4.11.8",
"eth-lightwallet": "^3.0.1",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-tx": "^1.3.5",
"ethereumjs-util": "^5.1.1",
"ganache-core": "^2.2.1",
@@ -54,7 +54,7 @@
"web3-provider-engine": "14.0.6"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/bip39": "^2.4.0",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-tx": "^1.0.0",
diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json
index ac720a748..70d785c74 100644
--- a/packages/testnet-faucets/package.json
+++ b/packages/testnet-faucets/package.json
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@0x/testnet-faucets",
- "version": "1.0.56",
+ "version": "1.0.60",
"engines": {
"node": ">=6.12"
},
@@ -18,13 +18,13 @@
"author": "Fabio Berger",
"license": "Apache-2.0",
"dependencies": {
- "0x.js": "^2.0.4",
- "@0x/subproviders": "^2.1.4",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "0x.js": "^2.0.8",
+ "@0x/subproviders": "^2.1.8",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "@0x/web3-wrapper": "^3.2.1",
"body-parser": "^1.17.1",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-tx": "^1.3.5",
"ethereumjs-util": "^5.1.1",
"express": "^4.15.2",
@@ -32,7 +32,7 @@
"rollbar": "^0.6.5"
},
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/body-parser": "^1.16.1",
"@types/express": "^4.0.35",
"@types/lodash": "4.14.104",
diff --git a/packages/tslint-config/CHANGELOG.json b/packages/tslint-config/CHANGELOG.json
index 9f504216c..0070a5b81 100644
--- a/packages/tslint-config/CHANGELOG.json
+++ b/packages/tslint-config/CHANGELOG.json
@@ -1,5 +1,15 @@
[
{
+ "version": "2.0.0",
+ "changes": [
+ {
+ "note": "Improve async-suffix rule to check functions too, not just methods",
+ "pr": 1425
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
"version": "1.0.10",
"changes": [
{
diff --git a/packages/tslint-config/CHANGELOG.md b/packages/tslint-config/CHANGELOG.md
index f5cacb5d1..3cebb1e95 100644
--- a/packages/tslint-config/CHANGELOG.md
+++ b/packages/tslint-config/CHANGELOG.md
@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.0 - _December 13, 2018_
+
+ * Improve async-suffix rule to check functions too, not just methods (#1425)
+
## v1.0.10 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json
index 2914f31e2..64ec1e967 100644
--- a/packages/tslint-config/package.json
+++ b/packages/tslint-config/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/tslint-config",
- "version": "1.0.10",
+ "version": "2.0.0",
"engines": {
"node": ">=6.12"
},
diff --git a/packages/tslint-config/rules/walkers/async_suffix.ts b/packages/tslint-config/rules/walkers/async_suffix.ts
index eaec9c5f6..4e12152e8 100644
--- a/packages/tslint-config/rules/walkers/async_suffix.ts
+++ b/packages/tslint-config/rules/walkers/async_suffix.ts
@@ -3,24 +3,33 @@ import * as Lint from 'tslint';
import * as ts from 'typescript';
export class AsyncSuffixWalker extends Lint.RuleWalker {
- public static FAILURE_STRING = 'async functions must have an Async suffix';
+ public static FAILURE_STRING = 'async functions/methods must have an Async suffix';
+ public visitFunctionDeclaration(node: ts.FunctionDeclaration): void {
+ this._visitFunctionOrMethodDeclaration(node);
+ super.visitFunctionDeclaration(node);
+ }
public visitMethodDeclaration(node: ts.MethodDeclaration): void {
- const methodNameNode = node.name;
- const methodName = methodNameNode.getText();
- if (!_.isUndefined(node.type)) {
- if (node.type.kind === ts.SyntaxKind.TypeReference) {
- // tslint:disable-next-line:no-unnecessary-type-assertion
- const returnTypeName = (node.type as ts.TypeReferenceNode).typeName.getText();
- if (returnTypeName === 'Promise' && !methodName.endsWith('Async')) {
- const failure = this.createFailure(
- methodNameNode.getStart(),
- methodNameNode.getWidth(),
- AsyncSuffixWalker.FAILURE_STRING,
- );
- this.addFailure(failure);
+ this._visitFunctionOrMethodDeclaration(node);
+ super.visitMethodDeclaration(node);
+ }
+ private _visitFunctionOrMethodDeclaration(node: ts.MethodDeclaration | ts.FunctionDeclaration): void {
+ const nameNode = node.name;
+ if (!_.isUndefined(nameNode)) {
+ const name = nameNode.getText();
+ if (!_.isUndefined(node.type)) {
+ if (node.type.kind === ts.SyntaxKind.TypeReference) {
+ // tslint:disable-next-line:no-unnecessary-type-assertion
+ const returnTypeName = (node.type as ts.TypeReferenceNode).typeName.getText();
+ if (returnTypeName === 'Promise' && !name.endsWith('Async')) {
+ const failure = this.createFailure(
+ nameNode.getStart(),
+ nameNode.getWidth(),
+ AsyncSuffixWalker.FAILURE_STRING,
+ );
+ this.addFailure(failure);
+ }
}
}
}
- super.visitMethodDeclaration(node);
}
}
diff --git a/packages/tslint-config/tslint.json b/packages/tslint-config/tslint.json
index fd1849dd0..e8de6221e 100644
--- a/packages/tslint-config/tslint.json
+++ b/packages/tslint-config/tslint.json
@@ -92,6 +92,7 @@
"prefer-function-over-method": true,
"prefer-object-spread": true,
"prefer-readonly": true,
+ "prefer-template": true,
"promise-function-async": true,
"quotemark": [true, "single", "avoid-escape", "jsx-double"],
"restrict-plus-operands": true,
diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json
index 6d9f83c57..7094953cb 100644
--- a/packages/types/CHANGELOG.json
+++ b/packages/types/CHANGELOG.json
@@ -1,5 +1,52 @@
[
{
+ "version": "1.5.0",
+ "changes": [
+ {
+ "note": "Added types for Dutch Auction contract",
+ "pr": 1465
+ }
+ ]
+ },
+ {
+ "version": "1.4.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "1.4.0",
+ "changes": [
+ {
+ "note": "Add `LengthMismatch` and `LengthGreaterThan3Required` revert reasons",
+ "pr": 1224
+ },
+ {
+ "note": "Add RevertReasons for DutchAuction contract",
+ "pr": 1225
+ },
+ {
+ "note": "Add MultiAsset types",
+ "pr": 1363
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "version": "1.3.0",
+ "changes": [
+ {
+ "note":
+ "Add the `SimpleContractArtifact` type, which describes the artifact format published in the `@0x/contract-artifacts` package",
+ "pr": 1298
+ }
+ ],
+ "timestamp": 1542821676
+ },
+ {
"version": "1.2.1",
"changes": [
{
diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md
index 556bf1799..5170eb4db 100644
--- a/packages/types/CHANGELOG.md
+++ b/packages/types/CHANGELOG.md
@@ -5,6 +5,19 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v1.4.1 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v1.4.0 - _December 11, 2018_
+
+ * Add `LengthMismatch` and `LengthGreaterThan3Required` revert reasons (#1224)
+ * Add RevertReasons for DutchAuction contract (#1225)
+
+## v1.3.0 - _November 21, 2018_
+
+ * Add the `SimpleContractArtifact` type, which describes the artifact format published in the `@0x/contract-artifacts` package (#1298)
+
## v1.2.1 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/types/package.json b/packages/types/package.json
index c32e9a6f7..3c4bb6fe6 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/types",
- "version": "1.2.1",
+ "version": "1.4.1",
"engines": {
"node": ">=6.12"
},
@@ -23,7 +23,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/types/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"make-promises-safe": "^1.1.0",
"shx": "^0.2.2",
"tslint": "5.11.0",
@@ -32,7 +32,7 @@
"dependencies": {
"@types/node": "*",
"bignumber.js": "~4.1.0",
- "ethereum-types": "^1.1.2"
+ "ethereum-types": "^1.1.4"
},
"publishConfig": {
"access": "public"
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index 3c9b6bbc5..49f788fb0 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -1,7 +1,7 @@
// tslint:disable:max-file-line-count
import { BigNumber } from 'bignumber.js';
-import { ContractAbi } from 'ethereum-types';
+import { ContractAbi, ContractNetworks, DevdocOutput } from 'ethereum-types';
// HACK: Rather then extending from OrderWithoutExchangeAddress
// we don't, because our docs don't expand inherited types, and it's unnecessarily
@@ -110,7 +110,9 @@ export type DoneCallback = (err?: Error) => void;
export interface OrderRelevantState {
makerBalance: BigNumber;
+ makerIndividualBalances: ObjectMap<BigNumber>;
makerProxyAllowance: BigNumber;
+ makerIndividualProxyAllowances: ObjectMap<BigNumber>;
makerFeeBalance: BigNumber;
makerFeeProxyAllowance: BigNumber;
filledTakerAssetAmount: BigNumber;
@@ -155,6 +157,7 @@ export enum SignatureType {
export enum AssetProxyId {
ERC20 = '0xf47261b0',
ERC721 = '0x02571792',
+ MultiAsset = '0x94cfcdd7',
}
export interface ERC20AssetData {
@@ -168,7 +171,21 @@ export interface ERC721AssetData {
tokenId: BigNumber;
}
-export type AssetData = ERC20AssetData | ERC721AssetData;
+export type SingleAssetData = ERC20AssetData | ERC721AssetData;
+
+export interface MultiAssetData {
+ assetProxyId: string;
+ amounts: BigNumber[];
+ nestedAssetData: string[];
+}
+
+export interface MultiAssetDataWithRecursiveDecoding {
+ assetProxyId: string;
+ amounts: BigNumber[];
+ nestedAssetData: SingleAssetData[];
+}
+
+export type AssetData = SingleAssetData | MultiAssetData | MultiAssetDataWithRecursiveDecoding;
// TODO: DRY. These should be extracted from contract code.
export enum RevertReason {
@@ -195,6 +212,7 @@ export enum RevertReason {
FailedExecution = 'FAILED_EXECUTION',
AssetProxyAlreadyExists = 'ASSET_PROXY_ALREADY_EXISTS',
LengthGreaterThan0Required = 'LENGTH_GREATER_THAN_0_REQUIRED',
+ LengthGreaterThan3Required = 'LENGTH_GREATER_THAN_3_REQUIRED',
LengthGreaterThan131Required = 'LENGTH_GREATER_THAN_131_REQUIRED',
Length0Required = 'LENGTH_0_REQUIRED',
Length65Required = 'LENGTH_65_REQUIRED',
@@ -209,6 +227,7 @@ export enum RevertReason {
MakerNotWhitelisted = 'MAKER_NOT_WHITELISTED',
TakerNotWhitelisted = 'TAKER_NOT_WHITELISTED',
AssetProxyDoesNotExist = 'ASSET_PROXY_DOES_NOT_EXIST',
+ LengthMismatch = 'LENGTH_MISMATCH',
LibBytesGreaterThanZeroLengthRequired = 'GREATER_THAN_ZERO_LENGTH_REQUIRED',
LibBytesGreaterOrEqualTo4LengthRequired = 'GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED',
LibBytesGreaterOrEqualTo20LengthRequired = 'GREATER_OR_EQUAL_TO_20_LENGTH_REQUIRED',
@@ -235,6 +254,16 @@ export enum RevertReason {
TxFullyConfirmed = 'TX_FULLY_CONFIRMED',
TxNotFullyConfirmed = 'TX_NOT_FULLY_CONFIRMED',
TimeLockIncomplete = 'TIME_LOCK_INCOMPLETE',
+ // DutchAuction
+ AuctionInvalidAmount = 'INVALID_AMOUNT',
+ AuctionExpired = 'AUCTION_EXPIRED',
+ AuctionNotStarted = 'AUCTION_NOT_STARTED',
+ AuctionInvalidBeginTime = 'INVALID_BEGIN_TIME',
+ InvalidAssetData = 'INVALID_ASSET_DATA',
+ // Balance Threshold Filter
+ InvalidOrBlockedExchangeSelector = 'INVALID_OR_BLOCKED_EXCHANGE_SELECTOR',
+ BalanceQueryFailed = 'BALANCE_QUERY_FAILED',
+ AtLeastOneAddressDoesNotMeetBalanceThreshold = 'AT_LEAST_ONE_ADDRESS_DOES_NOT_MEET_BALANCE_THRESHOLD',
}
export enum StatusCodes {
@@ -626,3 +655,33 @@ export interface EIP712TypedData {
export interface Stats {
orderCount: number;
}
+
+export interface SimpleContractArtifact {
+ schemaVersion: string;
+ contractName: string;
+ compilerOutput: SimpleStandardContractOutput;
+ networks: ContractNetworks;
+}
+
+export interface SimpleStandardContractOutput {
+ abi: ContractAbi;
+ evm: SimpleEvmOutput;
+ devdoc?: DevdocOutput;
+}
+
+export interface SimpleEvmOutput {
+ bytecode: SimpleEvmBytecodeOutput;
+}
+
+export interface SimpleEvmBytecodeOutput {
+ object: string;
+}
+
+export interface DutchAuctionDetails {
+ beginTimeSeconds: BigNumber;
+ endTimeSeconds: BigNumber;
+ beginAmount: BigNumber;
+ endAmount: BigNumber;
+ currentAmount: BigNumber;
+ currentTimeSeconds: BigNumber;
+}
diff --git a/packages/typescript-typings/CHANGELOG.json b/packages/typescript-typings/CHANGELOG.json
index 5653b397d..fadf5ad14 100644
--- a/packages/typescript-typings/CHANGELOG.json
+++ b/packages/typescript-typings/CHANGELOG.json
@@ -1,5 +1,23 @@
[
{
+ "version": "3.0.6",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "3.0.5",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
"version": "3.0.4",
"changes": [
{
diff --git a/packages/typescript-typings/CHANGELOG.md b/packages/typescript-typings/CHANGELOG.md
index 62e6665be..1663d40af 100644
--- a/packages/typescript-typings/CHANGELOG.md
+++ b/packages/typescript-typings/CHANGELOG.md
@@ -5,6 +5,14 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.0.6 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.0.5 - _December 11, 2018_
+
+ * Dependencies updated
+
## v3.0.4 - _November 9, 2018_
* Dependencies updated
diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json
index 9dbbe1370..c67b660c8 100644
--- a/packages/typescript-typings/package.json
+++ b/packages/typescript-typings/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/typescript-typings",
- "version": "3.0.4",
+ "version": "3.0.6",
"engines": {
"node": ">=6.12"
},
@@ -27,7 +27,7 @@
"@types/bn.js": "^4.11.0",
"@types/react": "*",
"bignumber.js": "~4.1.0",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"popper.js": "1.14.3"
},
"devDependencies": {
diff --git a/packages/typescript-typings/tsconfig.json b/packages/typescript-typings/tsconfig.json
index 7f0fe2f7a..8ea3bfb0c 100644
--- a/packages/typescript-typings/tsconfig.json
+++ b/packages/typescript-typings/tsconfig.json
@@ -3,5 +3,6 @@
"compilerOptions": {
"outDir": "lib",
"rootDir": "."
- }
+ },
+ "include": ["types"]
}
diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json
index 1ef16e112..eb94da8d6 100644
--- a/packages/utils/CHANGELOG.json
+++ b/packages/utils/CHANGELOG.json
@@ -1,5 +1,51 @@
[
{
+ "version": "2.1.1",
+ "changes": [
+ {
+ "note": "Add `should` prefix to names of properties in EncodingRules and DecodingRules",
+ "pr": 1363
+ }
+ ]
+ },
+ {
+ "version": "2.1.0",
+ "changes": [
+ {
+ "note": "Add `logWithTime` to `logUtils`",
+ "pr": 1461
+ }
+ ]
+ },
+ {
+ "version": "2.0.8",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "2.0.7",
+ "changes": [
+ {
+ "note":
+ "Optimized ABI Encoder/Decoder. Generates compressed calldata to save gas. Generates human-readable calldata to aid development."
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "timestamp": 1542821676,
+ "version": "2.0.6",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ]
+ },
+ {
"timestamp": 1542208198,
"version": "2.0.5",
"changes": [
diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md
index 9846dd344..c0437392d 100644
--- a/packages/utils/CHANGELOG.md
+++ b/packages/utils/CHANGELOG.md
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v2.0.8 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v2.0.7 - _December 11, 2018_
+
+ * Optimized ABI Encoder/Decoder. Generates compressed calldata to save gas. Generates human-readable calldata to aid development.
+
+## v2.0.6 - _November 21, 2018_
+
+ * Dependencies updated
+
## v2.0.5 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 4b924226f..5ffec049a 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/utils",
- "version": "2.0.5",
+ "version": "2.0.8",
"engines": {
"node": ">=6.12"
},
@@ -28,11 +28,14 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/utils/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/detect-node": "2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
"make-promises-safe": "^1.1.0",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
@@ -41,13 +44,14 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/types": "^1.2.1",
- "@0x/typescript-typings": "^3.0.4",
+ "@0x/types": "^1.4.1",
+ "@0x/typescript-typings": "^3.0.6",
"@types/node": "*",
"abortcontroller-polyfill": "^1.1.9",
"bignumber.js": "~4.1.0",
+ "chalk": "^2.4.1",
"detect-node": "2.0.3",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
"isomorphic-fetch": "^2.2.1",
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts b/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts
new file mode 100644
index 000000000..13cc87e2a
--- /dev/null
+++ b/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts
@@ -0,0 +1,58 @@
+import { DataItem } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { Calldata } from '../calldata/calldata';
+import { CalldataBlock } from '../calldata/calldata_block';
+import { RawCalldata } from '../calldata/raw_calldata';
+import { constants } from '../utils/constants';
+import { DecodingRules, EncodingRules } from '../utils/rules';
+
+import { DataTypeFactory } from './interfaces';
+
+export abstract class DataType {
+ private readonly _dataItem: DataItem;
+ private readonly _factory: DataTypeFactory;
+
+ constructor(dataItem: DataItem, factory: DataTypeFactory) {
+ this._dataItem = dataItem;
+ this._factory = factory;
+ }
+
+ public getDataItem(): DataItem {
+ return this._dataItem;
+ }
+
+ public getFactory(): DataTypeFactory {
+ return this._factory;
+ }
+
+ public encode(value: any, rules?: EncodingRules, selector?: string): string {
+ const rules_ = _.isUndefined(rules) ? constants.DEFAULT_ENCODING_RULES : rules;
+ const calldata = new Calldata(rules_);
+ if (!_.isUndefined(selector)) {
+ calldata.setSelector(selector);
+ }
+ const block = this.generateCalldataBlock(value);
+ calldata.setRoot(block);
+ const encodedCalldata = calldata.toString();
+ return encodedCalldata;
+ }
+
+ public decode(calldata: string, rules?: DecodingRules, selector?: string): any {
+ if (!_.isUndefined(selector) && !_.startsWith(calldata, selector)) {
+ throw new Error(
+ `Tried to decode calldata, but it was missing the function selector. Expected prefix '${selector}'. Got '${calldata}'.`,
+ );
+ }
+ const hasSelector = !_.isUndefined(selector);
+ const rawCalldata = new RawCalldata(calldata, hasSelector);
+ const rules_ = _.isUndefined(rules) ? constants.DEFAULT_DECODING_RULES : rules;
+ const value = this.generateValue(rawCalldata, rules_);
+ return value;
+ }
+
+ public abstract generateCalldataBlock(value: any, parentBlock?: CalldataBlock): CalldataBlock;
+ public abstract generateValue(calldata: RawCalldata, rules: DecodingRules): any;
+ public abstract getSignature(): string;
+ public abstract isStatic(): boolean;
+}
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/interfaces.ts b/packages/utils/src/abi_encoder/abstract_data_types/interfaces.ts
new file mode 100644
index 000000000..2f2f60871
--- /dev/null
+++ b/packages/utils/src/abi_encoder/abstract_data_types/interfaces.ts
@@ -0,0 +1,19 @@
+import { DataItem } from 'ethereum-types';
+
+import { RawCalldata } from '../calldata/raw_calldata';
+
+import { DataType } from './data_type';
+
+export interface DataTypeFactory {
+ create: (dataItem: DataItem, parentDataType?: DataType) => DataType;
+}
+
+export interface DataTypeStaticInterface {
+ matchType: (type: string) => boolean;
+ encodeValue: (value: any) => Buffer;
+ decodeValue: (rawCalldata: RawCalldata) => any;
+}
+
+export interface MemberIndexByName {
+ [key: string]: number;
+}
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts
new file mode 100644
index 000000000..a091e55b9
--- /dev/null
+++ b/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts
@@ -0,0 +1,40 @@
+import { DataItem } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { BlobCalldataBlock } from '../../calldata/blocks/blob';
+import { CalldataBlock } from '../../calldata/calldata_block';
+import { RawCalldata } from '../../calldata/raw_calldata';
+import { DecodingRules } from '../../utils/rules';
+
+import { DataType } from '../data_type';
+import { DataTypeFactory } from '../interfaces';
+
+export abstract class AbstractBlobDataType extends DataType {
+ protected _sizeKnownAtCompileTime: boolean;
+
+ public constructor(dataItem: DataItem, factory: DataTypeFactory, sizeKnownAtCompileTime: boolean) {
+ super(dataItem, factory);
+ this._sizeKnownAtCompileTime = sizeKnownAtCompileTime;
+ }
+
+ public generateCalldataBlock(value: any, parentBlock?: CalldataBlock): BlobCalldataBlock {
+ const encodedValue = this.encodeValue(value);
+ const name = this.getDataItem().name;
+ const signature = this.getSignature();
+ const parentName = _.isUndefined(parentBlock) ? '' : parentBlock.getName();
+ const block = new BlobCalldataBlock(name, signature, parentName, encodedValue);
+ return block;
+ }
+
+ public generateValue(calldata: RawCalldata, rules: DecodingRules): any {
+ const value = this.decodeValue(calldata);
+ return value;
+ }
+
+ public isStatic(): boolean {
+ return this._sizeKnownAtCompileTime;
+ }
+
+ public abstract encodeValue(value: any): Buffer;
+ public abstract decodeValue(calldata: RawCalldata): any;
+}
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts
new file mode 100644
index 000000000..0f3c55280
--- /dev/null
+++ b/packages/utils/src/abi_encoder/abstract_data_types/types/pointer.ts
@@ -0,0 +1,54 @@
+import { DataItem } from 'ethereum-types';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { PointerCalldataBlock } from '../../calldata/blocks/pointer';
+import { CalldataBlock } from '../../calldata/calldata_block';
+import { RawCalldata } from '../../calldata/raw_calldata';
+import { constants } from '../../utils/constants';
+import { DecodingRules } from '../../utils/rules';
+
+import { DataType } from '../data_type';
+import { DataTypeFactory } from '../interfaces';
+
+export abstract class AbstractPointerDataType extends DataType {
+ protected _destination: DataType;
+ protected _parent: DataType;
+
+ public constructor(dataItem: DataItem, factory: DataTypeFactory, destination: DataType, parent: DataType) {
+ super(dataItem, factory);
+ this._destination = destination;
+ this._parent = parent;
+ }
+
+ public generateCalldataBlock(value: any, parentBlock?: CalldataBlock): PointerCalldataBlock {
+ if (_.isUndefined(parentBlock)) {
+ throw new Error(`DependentDataType requires a parent block to generate its block`);
+ }
+ const destinationBlock = this._destination.generateCalldataBlock(value, parentBlock);
+ const name = this.getDataItem().name;
+ const signature = this.getSignature();
+ const parentName = parentBlock.getName();
+ const block = new PointerCalldataBlock(name, signature, parentName, destinationBlock, parentBlock);
+ return block;
+ }
+
+ public generateValue(calldata: RawCalldata, rules: DecodingRules): any {
+ const destinationOffsetBuf = calldata.popWord();
+ const destinationOffsetHex = ethUtil.bufferToHex(destinationOffsetBuf);
+ const destinationOffsetRelative = parseInt(destinationOffsetHex, constants.HEX_BASE);
+ const destinationOffsetAbsolute = calldata.toAbsoluteOffset(destinationOffsetRelative);
+ const currentOffset = calldata.getOffset();
+ calldata.setOffset(destinationOffsetAbsolute);
+ const value = this._destination.generateValue(calldata, rules);
+ calldata.setOffset(currentOffset);
+ return value;
+ }
+
+ // Disable prefer-function-over-method for inherited abstract method.
+ /* tslint:disable prefer-function-over-method */
+ public isStatic(): boolean {
+ return true;
+ }
+ /* tslint:enable prefer-function-over-method */
+}
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
new file mode 100644
index 000000000..00059a4b6
--- /dev/null
+++ b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
@@ -0,0 +1,218 @@
+import { DataItem } from 'ethereum-types';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { BigNumber } from '../../../configured_bignumber';
+import { SetCalldataBlock } from '../../calldata/blocks/set';
+import { CalldataBlock } from '../../calldata/calldata_block';
+import { RawCalldata } from '../../calldata/raw_calldata';
+import { constants } from '../../utils/constants';
+import { DecodingRules } from '../../utils/rules';
+
+import { DataType } from '../data_type';
+import { DataTypeFactory, MemberIndexByName } from '../interfaces';
+
+import { AbstractPointerDataType } from './pointer';
+
+export abstract class AbstractSetDataType extends DataType {
+ protected readonly _arrayLength: number | undefined;
+ protected readonly _arrayElementType: string | undefined;
+ private readonly _memberIndexByName: MemberIndexByName;
+ private readonly _members: DataType[];
+ private readonly _isArray: boolean;
+
+ public constructor(
+ dataItem: DataItem,
+ factory: DataTypeFactory,
+ isArray: boolean = false,
+ arrayLength?: number,
+ arrayElementType?: string,
+ ) {
+ super(dataItem, factory);
+ this._memberIndexByName = {};
+ this._members = [];
+ this._isArray = isArray;
+ this._arrayLength = arrayLength;
+ this._arrayElementType = arrayElementType;
+ if (isArray && !_.isUndefined(arrayLength)) {
+ [this._members, this._memberIndexByName] = this._createMembersWithLength(dataItem, arrayLength);
+ } else if (!isArray) {
+ [this._members, this._memberIndexByName] = this._createMembersWithKeys(dataItem);
+ }
+ }
+
+ public generateCalldataBlock(value: any[] | object, parentBlock?: CalldataBlock): SetCalldataBlock {
+ const block =
+ value instanceof Array
+ ? this._generateCalldataBlockFromArray(value, parentBlock)
+ : this._generateCalldataBlockFromObject(value, parentBlock);
+ return block;
+ }
+
+ public generateValue(calldata: RawCalldata, rules: DecodingRules): any[] | object {
+ let members = this._members;
+ // Case 1: This is an array of undefined length, which means that `this._members` was not
+ // populated in the constructor. So we must construct the set of members now.
+ if (this._isArray && _.isUndefined(this._arrayLength)) {
+ const arrayLengthBuf = calldata.popWord();
+ const arrayLengthHex = ethUtil.bufferToHex(arrayLengthBuf);
+ const arrayLength = new BigNumber(arrayLengthHex, constants.HEX_BASE);
+ [members] = this._createMembersWithLength(this.getDataItem(), arrayLength.toNumber());
+ }
+ // Create a new scope in the calldata, before descending into the members of this set.
+ calldata.startScope();
+ let value: any[] | object;
+ if (rules.shouldConvertStructsToObjects && !this._isArray) {
+ // Construct an object with values for each member of the set.
+ value = {};
+ _.each(this._memberIndexByName, (idx: number, key: string) => {
+ const member = this._members[idx];
+ const memberValue = member.generateValue(calldata, rules);
+ (value as { [key: string]: any })[key] = memberValue;
+ });
+ } else {
+ // Construct an array with values for each member of the set.
+ value = [];
+ _.each(members, (member: DataType, idx: number) => {
+ const memberValue = member.generateValue(calldata, rules);
+ (value as any[]).push(memberValue);
+ });
+ }
+ // Close this scope and return tetheh value.
+ calldata.endScope();
+ return value;
+ }
+
+ public isStatic(): boolean {
+ // An array with an undefined length is never static.
+ if (this._isArray && _.isUndefined(this._arrayLength)) {
+ return false;
+ }
+ // If any member of the set is a pointer then the set is not static.
+ const dependentMember = _.find(this._members, (member: DataType) => {
+ return member instanceof AbstractPointerDataType;
+ });
+ const isStatic = _.isUndefined(dependentMember);
+ return isStatic;
+ }
+
+ protected _generateCalldataBlockFromArray(value: any[], parentBlock?: CalldataBlock): SetCalldataBlock {
+ // Sanity check: if the set has a defined length then `value` must have the same length.
+ if (!_.isUndefined(this._arrayLength) && value.length !== this._arrayLength) {
+ throw new Error(
+ `Expected array of ${JSON.stringify(
+ this._arrayLength,
+ )} elements, but got array of length ${JSON.stringify(value.length)}`,
+ );
+ }
+ // Create a new calldata block for this set.
+ const parentName = _.isUndefined(parentBlock) ? '' : parentBlock.getName();
+ const block = new SetCalldataBlock(this.getDataItem().name, this.getSignature(), parentName);
+ // If this set has an undefined length then set its header to be the number of elements.
+ let members = this._members;
+ if (this._isArray && _.isUndefined(this._arrayLength)) {
+ [members] = this._createMembersWithLength(this.getDataItem(), value.length);
+ const lenBuf = ethUtil.setLengthLeft(
+ ethUtil.toBuffer(`0x${value.length.toString(constants.HEX_BASE)}`),
+ constants.EVM_WORD_WIDTH_IN_BYTES,
+ );
+ block.setHeader(lenBuf);
+ }
+ // Create blocks for members of set.
+ const memberCalldataBlocks: CalldataBlock[] = [];
+ _.each(members, (member: DataType, idx: number) => {
+ const memberBlock = member.generateCalldataBlock(value[idx], block);
+ memberCalldataBlocks.push(memberBlock);
+ });
+ block.setMembers(memberCalldataBlocks);
+ return block;
+ }
+
+ protected _generateCalldataBlockFromObject(obj: object, parentBlock?: CalldataBlock): SetCalldataBlock {
+ // Create a new calldata block for this set.
+ const parentName = _.isUndefined(parentBlock) ? '' : parentBlock.getName();
+ const block = new SetCalldataBlock(this.getDataItem().name, this.getSignature(), parentName);
+ // Create blocks for members of set.
+ const memberCalldataBlocks: CalldataBlock[] = [];
+ const childMap = _.cloneDeep(this._memberIndexByName);
+ _.forOwn(obj, (value: any, key: string) => {
+ if (!(key in childMap)) {
+ throw new Error(
+ `Could not assign tuple to object: unrecognized key '${key}' in object ${this.getDataItem().name}`,
+ );
+ }
+ const memberBlock = this._members[this._memberIndexByName[key]].generateCalldataBlock(value, block);
+ memberCalldataBlocks.push(memberBlock);
+ delete childMap[key];
+ });
+ // Sanity check that all members have been included.
+ if (Object.keys(childMap).length !== 0) {
+ throw new Error(`Could not assign tuple to object: missing keys ${Object.keys(childMap)}`);
+ }
+ // Associate member blocks with Set block.
+ block.setMembers(memberCalldataBlocks);
+ return block;
+ }
+
+ protected _computeSignatureOfMembers(): string {
+ // Compute signature of members
+ let signature = `(`;
+ _.each(this._members, (member: DataType, i: number) => {
+ signature += member.getSignature();
+ if (i < this._members.length - 1) {
+ signature += ',';
+ }
+ });
+ signature += ')';
+ return signature;
+ }
+
+ private _createMembersWithKeys(dataItem: DataItem): [DataType[], MemberIndexByName] {
+ // Sanity check
+ if (_.isUndefined(dataItem.components)) {
+ throw new Error(
+ `Tried to create a set using key/value pairs, but no components were defined by the input DataItem '${
+ dataItem.name
+ }'.`,
+ );
+ }
+ // Create one member for each component of `dataItem`
+ const members: DataType[] = [];
+ const memberIndexByName: MemberIndexByName = {};
+ _.each(dataItem.components, (memberItem: DataItem) => {
+ const childDataItem: DataItem = {
+ type: memberItem.type,
+ name: `${dataItem.name}.${memberItem.name}`,
+ };
+ const components = memberItem.components;
+ if (!_.isUndefined(components)) {
+ childDataItem.components = components;
+ }
+ const child = this.getFactory().create(childDataItem, this);
+ memberIndexByName[memberItem.name] = members.length;
+ members.push(child);
+ });
+ return [members, memberIndexByName];
+ }
+
+ private _createMembersWithLength(dataItem: DataItem, length: number): [DataType[], MemberIndexByName] {
+ // Create `length` members, deriving the type from `dataItem`
+ const members: DataType[] = [];
+ const memberIndexByName: MemberIndexByName = {};
+ const range = _.range(length);
+ _.each(range, (idx: number) => {
+ const memberDataItem: DataItem = {
+ type: _.isUndefined(this._arrayElementType) ? '' : this._arrayElementType,
+ name: `${dataItem.name}[${idx.toString(constants.DEC_BASE)}]`,
+ };
+ const components = dataItem.components;
+ if (!_.isUndefined(components)) {
+ memberDataItem.components = components;
+ }
+ const memberType = this.getFactory().create(memberDataItem, this);
+ memberIndexByName[idx.toString(constants.DEC_BASE)] = members.length;
+ members.push(memberType);
+ });
+ return [members, memberIndexByName];
+ }
+}
diff --git a/packages/utils/src/abi_encoder/calldata/blocks/blob.ts b/packages/utils/src/abi_encoder/calldata/blocks/blob.ts
new file mode 100644
index 000000000..219ea6c61
--- /dev/null
+++ b/packages/utils/src/abi_encoder/calldata/blocks/blob.ts
@@ -0,0 +1,20 @@
+import { CalldataBlock } from '../calldata_block';
+
+export class BlobCalldataBlock extends CalldataBlock {
+ private readonly _blob: Buffer;
+
+ constructor(name: string, signature: string, parentName: string, blob: Buffer) {
+ const headerSizeInBytes = 0;
+ const bodySizeInBytes = blob.byteLength;
+ super(name, signature, parentName, headerSizeInBytes, bodySizeInBytes);
+ this._blob = blob;
+ }
+
+ public toBuffer(): Buffer {
+ return this._blob;
+ }
+
+ public getRawData(): Buffer {
+ return this._blob;
+ }
+}
diff --git a/packages/utils/src/abi_encoder/calldata/blocks/pointer.ts b/packages/utils/src/abi_encoder/calldata/blocks/pointer.ts
new file mode 100644
index 000000000..72d6a3173
--- /dev/null
+++ b/packages/utils/src/abi_encoder/calldata/blocks/pointer.ts
@@ -0,0 +1,61 @@
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { constants } from '../../utils/constants';
+
+import { CalldataBlock } from '../calldata_block';
+
+export class PointerCalldataBlock extends CalldataBlock {
+ public static readonly RAW_DATA_START = new Buffer('<');
+ public static readonly RAW_DATA_END = new Buffer('>');
+ private static readonly _DEPENDENT_PAYLOAD_SIZE_IN_BYTES = 32;
+ private static readonly _EMPTY_HEADER_SIZE = 0;
+ private readonly _parent: CalldataBlock;
+ private readonly _dependency: CalldataBlock;
+ private _aliasFor: CalldataBlock | undefined;
+
+ constructor(name: string, signature: string, parentName: string, dependency: CalldataBlock, parent: CalldataBlock) {
+ const headerSizeInBytes = PointerCalldataBlock._EMPTY_HEADER_SIZE;
+ const bodySizeInBytes = PointerCalldataBlock._DEPENDENT_PAYLOAD_SIZE_IN_BYTES;
+ super(name, signature, parentName, headerSizeInBytes, bodySizeInBytes);
+ this._parent = parent;
+ this._dependency = dependency;
+ this._aliasFor = undefined;
+ }
+
+ public toBuffer(): Buffer {
+ const destinationOffset = !_.isUndefined(this._aliasFor)
+ ? this._aliasFor.getOffsetInBytes()
+ : this._dependency.getOffsetInBytes();
+ const parentOffset = this._parent.getOffsetInBytes();
+ const parentHeaderSize = this._parent.getHeaderSizeInBytes();
+ const pointer: number = destinationOffset - (parentOffset + parentHeaderSize);
+ const pointerHex = `0x${pointer.toString(constants.HEX_BASE)}`;
+ const pointerBuf = ethUtil.toBuffer(pointerHex);
+ const pointerBufPadded = ethUtil.setLengthLeft(pointerBuf, constants.EVM_WORD_WIDTH_IN_BYTES);
+ return pointerBufPadded;
+ }
+
+ public getDependency(): CalldataBlock {
+ return this._dependency;
+ }
+
+ public setAlias(block: CalldataBlock): void {
+ this._aliasFor = block;
+ this._setName(`${this.getName()} (alias for ${block.getName()})`);
+ }
+
+ public getAlias(): CalldataBlock | undefined {
+ return this._aliasFor;
+ }
+
+ public getRawData(): Buffer {
+ const dependencyRawData = this._dependency.getRawData();
+ const rawDataComponents: Buffer[] = [];
+ rawDataComponents.push(PointerCalldataBlock.RAW_DATA_START);
+ rawDataComponents.push(dependencyRawData);
+ rawDataComponents.push(PointerCalldataBlock.RAW_DATA_END);
+ const rawData = Buffer.concat(rawDataComponents);
+ return rawData;
+ }
+}
diff --git a/packages/utils/src/abi_encoder/calldata/blocks/set.ts b/packages/utils/src/abi_encoder/calldata/blocks/set.ts
new file mode 100644
index 000000000..d1abc4986
--- /dev/null
+++ b/packages/utils/src/abi_encoder/calldata/blocks/set.ts
@@ -0,0 +1,47 @@
+import * as _ from 'lodash';
+
+import { CalldataBlock } from '../calldata_block';
+
+export class SetCalldataBlock extends CalldataBlock {
+ private _header: Buffer | undefined;
+ private _members: CalldataBlock[];
+
+ constructor(name: string, signature: string, parentName: string) {
+ super(name, signature, parentName, 0, 0);
+ this._members = [];
+ this._header = undefined;
+ }
+
+ public getRawData(): Buffer {
+ const rawDataComponents: Buffer[] = [];
+ if (!_.isUndefined(this._header)) {
+ rawDataComponents.push(this._header);
+ }
+ _.each(this._members, (member: CalldataBlock) => {
+ const memberBuffer = member.getRawData();
+ rawDataComponents.push(memberBuffer);
+ });
+ const rawData = Buffer.concat(rawDataComponents);
+ return rawData;
+ }
+
+ public setMembers(members: CalldataBlock[]): void {
+ this._members = members;
+ }
+
+ public setHeader(header: Buffer): void {
+ this._setHeaderSize(header.byteLength);
+ this._header = header;
+ }
+
+ public toBuffer(): Buffer {
+ if (!_.isUndefined(this._header)) {
+ return this._header;
+ }
+ return new Buffer('');
+ }
+
+ public getMembers(): CalldataBlock[] {
+ return this._members;
+ }
+}
diff --git a/packages/utils/src/abi_encoder/calldata/calldata.ts b/packages/utils/src/abi_encoder/calldata/calldata.ts
new file mode 100644
index 000000000..b08fb71ce
--- /dev/null
+++ b/packages/utils/src/abi_encoder/calldata/calldata.ts
@@ -0,0 +1,245 @@
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { constants } from '../utils/constants';
+import { EncodingRules } from '../utils/rules';
+
+import { PointerCalldataBlock } from './blocks/pointer';
+import { SetCalldataBlock } from './blocks/set';
+import { CalldataBlock } from './calldata_block';
+import { CalldataIterator, ReverseCalldataIterator } from './iterator';
+
+export class Calldata {
+ private readonly _rules: EncodingRules;
+ private _selector: string;
+ private _root: CalldataBlock | undefined;
+
+ public constructor(rules: EncodingRules) {
+ this._rules = rules;
+ this._selector = '';
+ this._root = undefined;
+ }
+ /**
+ * Sets the root calldata block. This block usually corresponds to a Method.
+ */
+ public setRoot(block: CalldataBlock): void {
+ this._root = block;
+ }
+ /**
+ * Sets the selector to be prepended onto the calldata.
+ * If the root block was created by a Method then a selector will likely be set.
+ */
+ public setSelector(selector: string): void {
+ if (!_.startsWith(selector, '0x')) {
+ throw new Error(`Expected selector to be hex. Missing prefix '0x'`);
+ } else if (selector.length !== constants.HEX_SELECTOR_LENGTH_IN_CHARS) {
+ throw new Error(`Invalid selector '${selector}'`);
+ }
+ this._selector = selector;
+ }
+ /**
+ * Iterates through the calldata blocks, starting from the root block, to construct calldata as a hex string.
+ * If the `optimize` flag is set then this calldata will be condensed, to save gas.
+ * If the `annotate` flag is set then this will return human-readable calldata.
+ * If the `annotate` flag is *not* set then this will return EVM-compatible calldata.
+ */
+ public toString(): string {
+ // Sanity check: root block must be set
+ if (_.isUndefined(this._root)) {
+ throw new Error('expected root');
+ }
+ // Optimize, if flag set
+ if (this._rules.shouldOptimize) {
+ this._optimize();
+ }
+ // Set offsets
+ const iterator = new CalldataIterator(this._root);
+ let offset = 0;
+ for (const block of iterator) {
+ block.setOffset(offset);
+ offset += block.getSizeInBytes();
+ }
+ // Generate hex string
+ const hexString = this._rules.shouldAnnotate
+ ? this._toHumanReadableCallData()
+ : this._toEvmCompatibeCallDataHex();
+ return hexString;
+ }
+ /**
+ * There are three types of calldata blocks: Blob, Set and Pointer.
+ * Scenarios arise where distinct pointers resolve to identical values.
+ * We optimize by keeping only one such instance of the identical value, and redirecting all pointers here.
+ * We keep the last such duplicate value because pointers can only be positive (they cannot point backwards).
+ *
+ * Example #1:
+ * function f(string[], string[])
+ * f(["foo", "bar", "blitz"], ["foo", "bar", "blitz"])
+ * The array ["foo", "bar", "blitz"] will only be included in the calldata once.
+ *
+ * Example #2:
+ * function f(string[], string)
+ * f(["foo", "bar", "blitz"], "foo")
+ * The string "foo" will only be included in the calldata once.
+ *
+ * Example #3:
+ * function f((string, uint, bytes), string, uint, bytes)
+ * f(("foo", 5, "0x05"), "foo", 5, "0x05")
+ * The string "foo" and bytes "0x05" will only be included in the calldata once.
+ * The duplicate `uint 5` values cannot be optimized out because they are static values (no pointer points to them).
+ *
+ * @TODO #1:
+ * This optimization strategy handles blocks that are exact duplicates of one another.
+ * But what if some block is a combination of two other blocks? Or a subset of another block?
+ * This optimization problem is not much different from the current implemetation.
+ * Instead of tracking "observed" hashes, at each node we would simply do pattern-matching on the calldata.
+ * This strategy would be applied after assigning offsets to the tree, rather than before (as in this strategy).
+ * Note that one consequence of this strategy is pointers may resolve to offsets that are not word-aligned.
+ * This shouldn't be a problem but further investigation should be done.
+ *
+ * @TODO #2:
+ * To be done as a follow-up to @TODO #1.
+ * Since we optimize from the bottom-up, we could be affecting the outcome of a later potential optimization.
+ * For example, what if by removing one duplicate value we miss out on optimizing another block higher in the tree.
+ * To handle this case, at each node we can store a candidate optimization in a priority queue (sorted by calldata size).
+ * At the end of traversing the tree, the candidate at the front of the queue will be the most optimal output.
+ *
+ */
+ private _optimize(): void {
+ // Step 1/1 Create a reverse iterator (starts from the end of the calldata to the beginning)
+ if (_.isUndefined(this._root)) {
+ throw new Error('expected root');
+ }
+ const iterator = new ReverseCalldataIterator(this._root);
+ // Step 2/2 Iterate over each block, keeping track of which blocks have been seen and pruning redundant blocks.
+ const blocksByHash: { [key: string]: CalldataBlock } = {};
+ for (const block of iterator) {
+ // If a block is a pointer and its value has already been observed, then update
+ // the pointer to resolve to the existing value.
+ if (block instanceof PointerCalldataBlock) {
+ const dependencyBlockHashBuf = block.getDependency().computeHash();
+ const dependencyBlockHash = ethUtil.bufferToHex(dependencyBlockHashBuf);
+ if (dependencyBlockHash in blocksByHash) {
+ const blockWithSameHash = blocksByHash[dependencyBlockHash];
+ if (blockWithSameHash !== block.getDependency()) {
+ block.setAlias(blockWithSameHash);
+ }
+ }
+ continue;
+ }
+ // This block has not been seen. Record its hash.
+ const blockHashBuf = block.computeHash();
+ const blockHash = ethUtil.bufferToHex(blockHashBuf);
+ if (!(blockHash in blocksByHash)) {
+ blocksByHash[blockHash] = block;
+ }
+ }
+ }
+ private _toEvmCompatibeCallDataHex(): string {
+ // Sanity check: must have a root block.
+ if (_.isUndefined(this._root)) {
+ throw new Error('expected root');
+ }
+ // Construct an array of buffers (one buffer for each block).
+ const selectorBuffer = ethUtil.toBuffer(this._selector);
+ const valueBufs: Buffer[] = [selectorBuffer];
+ const iterator = new CalldataIterator(this._root);
+ for (const block of iterator) {
+ valueBufs.push(block.toBuffer());
+ }
+ // Create hex from buffer array.
+ const combinedBuffers = Buffer.concat(valueBufs);
+ const hexValue = ethUtil.bufferToHex(combinedBuffers);
+ return hexValue;
+ }
+ /**
+ * Returns human-readable calldata.
+ *
+ * Example:
+ * simpleFunction(string[], string[])
+ * strings = ["Hello", "World"]
+ * simpleFunction(strings, strings)
+ *
+ * Output:
+ * 0xbb4f12e3
+ * ### simpleFunction
+ * 0x0 0000000000000000000000000000000000000000000000000000000000000040 ptr<array1> (alias for array2)
+ * 0x20 0000000000000000000000000000000000000000000000000000000000000040 ptr<array2>
+ *
+ * 0x40 0000000000000000000000000000000000000000000000000000000000000002 ### array2
+ * 0x60 0000000000000000000000000000000000000000000000000000000000000040 ptr<array2[0]>
+ * 0x80 0000000000000000000000000000000000000000000000000000000000000080 ptr<array2[1]>
+ * 0xa0 0000000000000000000000000000000000000000000000000000000000000005 array2[0]
+ * 0xc0 48656c6c6f000000000000000000000000000000000000000000000000000000
+ * 0xe0 0000000000000000000000000000000000000000000000000000000000000005 array2[1]
+ * 0x100 576f726c64000000000000000000000000000000000000000000000000000000
+ */
+ private _toHumanReadableCallData(): string {
+ // Sanity check: must have a root block.
+ if (_.isUndefined(this._root)) {
+ throw new Error('expected root');
+ }
+ // Constants for constructing annotated string
+ const offsetPadding = 10;
+ const valuePadding = 74;
+ const namePadding = 80;
+ const evmWordStartIndex = 0;
+ const emptySize = 0;
+ // Construct annotated calldata
+ let hexValue = `${this._selector}`;
+ let offset = 0;
+ const functionName: string = this._root.getName();
+ const iterator = new CalldataIterator(this._root);
+ for (const block of iterator) {
+ // Process each block 1 word at a time
+ const size = block.getSizeInBytes();
+ const name = block.getName();
+ const parentName = block.getParentName();
+ const prettyName = name.replace(`${parentName}.`, '').replace(`${functionName}.`, '');
+ // Resulting line will be <offsetStr><valueStr><nameStr>
+ let offsetStr = '';
+ let valueStr = '';
+ let nameStr = '';
+ let lineStr = '';
+ if (size === emptySize) {
+ // This is a Set block with no header.
+ // For example, a tuple or an array with a defined length.
+ offsetStr = ' '.repeat(offsetPadding);
+ valueStr = ' '.repeat(valuePadding);
+ nameStr = `### ${prettyName.padEnd(namePadding)}`;
+ lineStr = `\n${offsetStr}${valueStr}${nameStr}`;
+ } else {
+ // This block has at least one word of value.
+ offsetStr = `0x${offset.toString(constants.HEX_BASE)}`.padEnd(offsetPadding);
+ valueStr = ethUtil
+ .stripHexPrefix(
+ ethUtil.bufferToHex(
+ block.toBuffer().slice(evmWordStartIndex, constants.EVM_WORD_WIDTH_IN_BYTES),
+ ),
+ )
+ .padEnd(valuePadding);
+ if (block instanceof SetCalldataBlock) {
+ nameStr = `### ${prettyName.padEnd(namePadding)}`;
+ lineStr = `\n${offsetStr}${valueStr}${nameStr}`;
+ } else {
+ nameStr = ` ${prettyName.padEnd(namePadding)}`;
+ lineStr = `${offsetStr}${valueStr}${nameStr}`;
+ }
+ }
+ // This block has a value that is more than 1 word.
+ for (let j = constants.EVM_WORD_WIDTH_IN_BYTES; j < size; j += constants.EVM_WORD_WIDTH_IN_BYTES) {
+ offsetStr = `0x${(offset + j).toString(constants.HEX_BASE)}`.padEnd(offsetPadding);
+ valueStr = ethUtil
+ .stripHexPrefix(
+ ethUtil.bufferToHex(block.toBuffer().slice(j, j + constants.EVM_WORD_WIDTH_IN_BYTES)),
+ )
+ .padEnd(valuePadding);
+ nameStr = ' '.repeat(namePadding);
+ lineStr = `${lineStr}\n${offsetStr}${valueStr}${nameStr}`;
+ }
+ // Append to hex value
+ hexValue = `${hexValue}\n${lineStr}`;
+ offset += size;
+ }
+ return hexValue;
+ }
+}
diff --git a/packages/utils/src/abi_encoder/calldata/calldata_block.ts b/packages/utils/src/abi_encoder/calldata/calldata_block.ts
new file mode 100644
index 000000000..35bd994e5
--- /dev/null
+++ b/packages/utils/src/abi_encoder/calldata/calldata_block.ts
@@ -0,0 +1,77 @@
+import * as ethUtil from 'ethereumjs-util';
+
+export abstract class CalldataBlock {
+ private readonly _signature: string;
+ private readonly _parentName: string;
+ private _name: string;
+ private _offsetInBytes: number;
+ private _headerSizeInBytes: number;
+ private _bodySizeInBytes: number;
+
+ constructor(
+ name: string,
+ signature: string,
+ parentName: string,
+ headerSizeInBytes: number,
+ bodySizeInBytes: number,
+ ) {
+ this._name = name;
+ this._signature = signature;
+ this._parentName = parentName;
+ this._offsetInBytes = 0;
+ this._headerSizeInBytes = headerSizeInBytes;
+ this._bodySizeInBytes = bodySizeInBytes;
+ }
+
+ protected _setHeaderSize(headerSizeInBytes: number): void {
+ this._headerSizeInBytes = headerSizeInBytes;
+ }
+
+ protected _setBodySize(bodySizeInBytes: number): void {
+ this._bodySizeInBytes = bodySizeInBytes;
+ }
+
+ protected _setName(name: string): void {
+ this._name = name;
+ }
+
+ public getName(): string {
+ return this._name;
+ }
+
+ public getParentName(): string {
+ return this._parentName;
+ }
+
+ public getSignature(): string {
+ return this._signature;
+ }
+ public getHeaderSizeInBytes(): number {
+ return this._headerSizeInBytes;
+ }
+
+ public getBodySizeInBytes(): number {
+ return this._bodySizeInBytes;
+ }
+
+ public getSizeInBytes(): number {
+ return this.getHeaderSizeInBytes() + this.getBodySizeInBytes();
+ }
+
+ public getOffsetInBytes(): number {
+ return this._offsetInBytes;
+ }
+
+ public setOffset(offsetInBytes: number): void {
+ this._offsetInBytes = offsetInBytes;
+ }
+
+ public computeHash(): Buffer {
+ const rawData = this.getRawData();
+ const hash = ethUtil.sha3(rawData);
+ return hash;
+ }
+
+ public abstract toBuffer(): Buffer;
+ public abstract getRawData(): Buffer;
+}
diff --git a/packages/utils/src/abi_encoder/calldata/iterator.ts b/packages/utils/src/abi_encoder/calldata/iterator.ts
new file mode 100644
index 000000000..333b32b4f
--- /dev/null
+++ b/packages/utils/src/abi_encoder/calldata/iterator.ts
@@ -0,0 +1,114 @@
+/* tslint:disable max-classes-per-file */
+import * as _ from 'lodash';
+
+import { Queue } from '../utils/queue';
+
+import { BlobCalldataBlock } from './blocks/blob';
+import { PointerCalldataBlock } from './blocks/pointer';
+import { SetCalldataBlock } from './blocks/set';
+import { CalldataBlock } from './calldata_block';
+
+/**
+ * Iterator class for Calldata Blocks. Blocks follows the order
+ * they should be put into calldata that is passed to he EVM.
+ *
+ * Example #1:
+ * Let root = Set {
+ * Blob{} A,
+ * Pointer {
+ * Blob{} a
+ * } B,
+ * Blob{} C
+ * }
+ * It will iterate as follows: [A, B, C, B.a]
+ *
+ * Example #2:
+ * Let root = Set {
+ * Blob{} A,
+ * Pointer {
+ * Blob{} a
+ * Pointer {
+ * Blob{} b
+ * }
+ * } B,
+ * Pointer {
+ * Blob{} c
+ * } C
+ * }
+ * It will iterate as follows: [A, B, C, B.a, B.b, C.c]
+ */
+abstract class BaseIterator implements Iterable<CalldataBlock> {
+ protected readonly _root: CalldataBlock;
+ protected readonly _queue: Queue<CalldataBlock>;
+
+ private static _createQueue(block: CalldataBlock): Queue<CalldataBlock> {
+ const queue = new Queue<CalldataBlock>();
+ // Base case
+ if (!(block instanceof SetCalldataBlock)) {
+ queue.pushBack(block);
+ return queue;
+ }
+ // This is a set; add members
+ const set = block;
+ _.eachRight(set.getMembers(), (member: CalldataBlock) => {
+ queue.mergeFront(BaseIterator._createQueue(member));
+ });
+ // Add children
+ _.each(set.getMembers(), (member: CalldataBlock) => {
+ // Traverse child if it is a unique pointer.
+ // A pointer that is an alias for another pointer is ignored.
+ if (member instanceof PointerCalldataBlock && _.isUndefined(member.getAlias())) {
+ const dependency = member.getDependency();
+ queue.mergeBack(BaseIterator._createQueue(dependency));
+ }
+ });
+ // Put set block at the front of the queue
+ queue.pushFront(set);
+ return queue;
+ }
+
+ public constructor(root: CalldataBlock) {
+ this._root = root;
+ this._queue = BaseIterator._createQueue(root);
+ }
+
+ public [Symbol.iterator](): { next: () => IteratorResult<CalldataBlock> } {
+ return {
+ next: () => {
+ const nextBlock = this.nextBlock();
+ if (!_.isUndefined(nextBlock)) {
+ return {
+ value: nextBlock,
+ done: false,
+ };
+ }
+ return {
+ done: true,
+ value: new BlobCalldataBlock('', '', '', new Buffer('')),
+ };
+ },
+ };
+ }
+
+ public abstract nextBlock(): CalldataBlock | undefined;
+}
+
+export class CalldataIterator extends BaseIterator {
+ public constructor(root: CalldataBlock) {
+ super(root);
+ }
+
+ public nextBlock(): CalldataBlock | undefined {
+ return this._queue.popFront();
+ }
+}
+
+export class ReverseCalldataIterator extends BaseIterator {
+ public constructor(root: CalldataBlock) {
+ super(root);
+ }
+
+ public nextBlock(): CalldataBlock | undefined {
+ return this._queue.popBack();
+ }
+}
diff --git a/packages/utils/src/abi_encoder/calldata/raw_calldata.ts b/packages/utils/src/abi_encoder/calldata/raw_calldata.ts
new file mode 100644
index 000000000..189841989
--- /dev/null
+++ b/packages/utils/src/abi_encoder/calldata/raw_calldata.ts
@@ -0,0 +1,82 @@
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { constants } from '../utils/constants';
+import { Queue } from '../utils/queue';
+
+export class RawCalldata {
+ private static readonly _INITIAL_OFFSET = 0;
+ private readonly _value: Buffer;
+ private readonly _selector: string;
+ private readonly _scopes: Queue<number>;
+ private _offset: number;
+
+ public constructor(value: string | Buffer, hasSelector: boolean = true) {
+ // Sanity check
+ if (typeof value === 'string' && !_.startsWith(value, '0x')) {
+ throw new Error(`Expected raw calldata to start with '0x'`);
+ }
+ // Construct initial values
+ this._value = ethUtil.toBuffer(value);
+ this._selector = '0x';
+ this._scopes = new Queue<number>();
+ this._scopes.pushBack(RawCalldata._INITIAL_OFFSET);
+ this._offset = RawCalldata._INITIAL_OFFSET;
+ // If there's a selector then slice it
+ if (hasSelector) {
+ const selectorBuf = this._value.slice(constants.HEX_SELECTOR_LENGTH_IN_BYTES);
+ this._value = this._value.slice(constants.HEX_SELECTOR_LENGTH_IN_BYTES);
+ this._selector = ethUtil.bufferToHex(selectorBuf);
+ }
+ }
+
+ public popBytes(lengthInBytes: number): Buffer {
+ const value = this._value.slice(this._offset, this._offset + lengthInBytes);
+ this.setOffset(this._offset + lengthInBytes);
+ return value;
+ }
+
+ public popWord(): Buffer {
+ const wordInBytes = 32;
+ return this.popBytes(wordInBytes);
+ }
+
+ public popWords(length: number): Buffer {
+ const wordInBytes = 32;
+ return this.popBytes(length * wordInBytes);
+ }
+
+ public readBytes(from: number, to: number): Buffer {
+ const value = this._value.slice(from, to);
+ return value;
+ }
+
+ public setOffset(offsetInBytes: number): void {
+ this._offset = offsetInBytes;
+ }
+
+ public startScope(): void {
+ this._scopes.pushFront(this._offset);
+ }
+
+ public endScope(): void {
+ this._scopes.popFront();
+ }
+
+ public getOffset(): number {
+ return this._offset;
+ }
+
+ public toAbsoluteOffset(relativeOffset: number): number {
+ const scopeOffset = this._scopes.peekFront();
+ if (_.isUndefined(scopeOffset)) {
+ throw new Error(`Tried to access undefined scope.`);
+ }
+ const absoluteOffset = relativeOffset + scopeOffset;
+ return absoluteOffset;
+ }
+
+ public getSelector(): string {
+ return this._selector;
+ }
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_type_factory.ts b/packages/utils/src/abi_encoder/evm_data_type_factory.ts
new file mode 100644
index 000000000..4cc124e0a
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_type_factory.ts
@@ -0,0 +1,132 @@
+/* tslint:disable max-classes-per-file */
+import { DataItem, MethodAbi } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { DataType } from './abstract_data_types/data_type';
+import { DataTypeFactory } from './abstract_data_types/interfaces';
+import { AddressDataType } from './evm_data_types/address';
+import { ArrayDataType } from './evm_data_types/array';
+import { BoolDataType } from './evm_data_types/bool';
+import { DynamicBytesDataType } from './evm_data_types/dynamic_bytes';
+import { IntDataType } from './evm_data_types/int';
+import { MethodDataType } from './evm_data_types/method';
+import { PointerDataType } from './evm_data_types/pointer';
+import { StaticBytesDataType } from './evm_data_types/static_bytes';
+import { StringDataType } from './evm_data_types/string';
+import { TupleDataType } from './evm_data_types/tuple';
+import { UIntDataType } from './evm_data_types/uint';
+
+export class Address extends AddressDataType {
+ public constructor(dataItem: DataItem) {
+ super(dataItem, EvmDataTypeFactory.getInstance());
+ }
+}
+
+export class Bool extends BoolDataType {
+ public constructor(dataItem: DataItem) {
+ super(dataItem, EvmDataTypeFactory.getInstance());
+ }
+}
+
+export class Int extends IntDataType {
+ public constructor(dataItem: DataItem) {
+ super(dataItem, EvmDataTypeFactory.getInstance());
+ }
+}
+
+export class UInt extends UIntDataType {
+ public constructor(dataItem: DataItem) {
+ super(dataItem, EvmDataTypeFactory.getInstance());
+ }
+}
+
+export class StaticBytes extends StaticBytesDataType {
+ public constructor(dataItem: DataItem) {
+ super(dataItem, EvmDataTypeFactory.getInstance());
+ }
+}
+
+export class DynamicBytes extends DynamicBytesDataType {
+ public constructor(dataItem: DataItem) {
+ super(dataItem, EvmDataTypeFactory.getInstance());
+ }
+}
+
+export class String extends StringDataType {
+ public constructor(dataItem: DataItem) {
+ super(dataItem, EvmDataTypeFactory.getInstance());
+ }
+}
+
+export class Pointer extends PointerDataType {
+ public constructor(destDataType: DataType, parentDataType: DataType) {
+ super(destDataType, parentDataType, EvmDataTypeFactory.getInstance());
+ }
+}
+
+export class Tuple extends TupleDataType {
+ public constructor(dataItem: DataItem) {
+ super(dataItem, EvmDataTypeFactory.getInstance());
+ }
+}
+
+export class Array extends ArrayDataType {
+ public constructor(dataItem: DataItem) {
+ super(dataItem, EvmDataTypeFactory.getInstance());
+ }
+}
+
+export class Method extends MethodDataType {
+ public constructor(abi: MethodAbi) {
+ super(abi, EvmDataTypeFactory.getInstance());
+ }
+}
+
+/* tslint:disable no-construct */
+export class EvmDataTypeFactory implements DataTypeFactory {
+ private static _instance: DataTypeFactory;
+
+ public static getInstance(): DataTypeFactory {
+ if (!EvmDataTypeFactory._instance) {
+ EvmDataTypeFactory._instance = new EvmDataTypeFactory();
+ }
+ return EvmDataTypeFactory._instance;
+ }
+
+ /* tslint:disable prefer-function-over-method */
+ public create(dataItem: DataItem, parentDataType?: DataType): DataType {
+ // Create data type
+ let dataType: undefined | DataType;
+ if (Array.matchType(dataItem.type)) {
+ dataType = new Array(dataItem);
+ } else if (Address.matchType(dataItem.type)) {
+ dataType = new Address(dataItem);
+ } else if (Bool.matchType(dataItem.type)) {
+ dataType = new Bool(dataItem);
+ } else if (Int.matchType(dataItem.type)) {
+ dataType = new Int(dataItem);
+ } else if (UInt.matchType(dataItem.type)) {
+ dataType = new UInt(dataItem);
+ } else if (StaticBytes.matchType(dataItem.type)) {
+ dataType = new StaticBytes(dataItem);
+ } else if (Tuple.matchType(dataItem.type)) {
+ dataType = new Tuple(dataItem);
+ } else if (DynamicBytes.matchType(dataItem.type)) {
+ dataType = new DynamicBytes(dataItem);
+ } else if (String.matchType(dataItem.type)) {
+ dataType = new String(dataItem);
+ }
+ // @TODO: DataTypeement Fixed/UFixed types
+ if (_.isUndefined(dataType)) {
+ throw new Error(`Unrecognized data type: '${dataItem.type}'`);
+ } else if (!_.isUndefined(parentDataType) && !dataType.isStatic()) {
+ const pointerToDataType = new Pointer(dataType, parentDataType);
+ return pointerToDataType;
+ }
+ return dataType;
+ }
+ /* tslint:enable prefer-function-over-method */
+
+ private constructor() {}
+}
+/* tslint:enable no-construct */
diff --git a/packages/utils/src/abi_encoder/evm_data_types/address.ts b/packages/utils/src/abi_encoder/evm_data_types/address.ts
new file mode 100644
index 000000000..88846b1fa
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/address.ts
@@ -0,0 +1,49 @@
+import { DataItem, SolidityTypes } from 'ethereum-types';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
+import { RawCalldata } from '../calldata/raw_calldata';
+import { constants } from '../utils/constants';
+
+export class AddressDataType extends AbstractBlobDataType {
+ private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
+ private static readonly _ADDRESS_SIZE_IN_BYTES = 20;
+ private static readonly _DECODED_ADDRESS_OFFSET_IN_BYTES = constants.EVM_WORD_WIDTH_IN_BYTES -
+ AddressDataType._ADDRESS_SIZE_IN_BYTES;
+
+ public static matchType(type: string): boolean {
+ return type === SolidityTypes.Address;
+ }
+
+ public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
+ super(dataItem, dataTypeFactory, AddressDataType._SIZE_KNOWN_AT_COMPILE_TIME);
+ if (!AddressDataType.matchType(dataItem.type)) {
+ throw new Error(`Tried to instantiate Address with bad input: ${dataItem}`);
+ }
+ }
+
+ // Disable prefer-function-over-method for inherited abstract methods.
+ /* tslint:disable prefer-function-over-method */
+ public encodeValue(value: string): Buffer {
+ if (!ethUtil.isValidAddress(value)) {
+ throw new Error(`Invalid address: '${value}'`);
+ }
+ const valueBuf = ethUtil.toBuffer(value);
+ const encodedValueBuf = ethUtil.setLengthLeft(valueBuf, constants.EVM_WORD_WIDTH_IN_BYTES);
+ return encodedValueBuf;
+ }
+
+ public decodeValue(calldata: RawCalldata): string {
+ const valueBufPadded = calldata.popWord();
+ const valueBuf = valueBufPadded.slice(AddressDataType._DECODED_ADDRESS_OFFSET_IN_BYTES);
+ const value = ethUtil.bufferToHex(valueBuf);
+ return value;
+ }
+
+ public getSignature(): string {
+ return SolidityTypes.Address;
+ }
+ /* tslint:enable prefer-function-over-method */
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/array.ts b/packages/utils/src/abi_encoder/evm_data_types/array.ts
new file mode 100644
index 000000000..7595cb667
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/array.ts
@@ -0,0 +1,64 @@
+import { DataItem } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractSetDataType } from '../abstract_data_types/types/set';
+import { constants } from '../utils/constants';
+
+export class ArrayDataType extends AbstractSetDataType {
+ private static readonly _MATCHER = RegExp('^(.+)\\[([0-9]*)\\]$');
+ private readonly _arraySignature: string;
+ private readonly _elementType: string;
+
+ public static matchType(type: string): boolean {
+ return ArrayDataType._MATCHER.test(type);
+ }
+
+ private static _decodeElementTypeAndLengthFromType(type: string): [string, undefined | number] {
+ const matches = ArrayDataType._MATCHER.exec(type);
+ if (_.isNull(matches) || matches.length !== 3) {
+ throw new Error(`Could not parse array: ${type}`);
+ } else if (_.isUndefined(matches[1])) {
+ throw new Error(`Could not parse array type: ${type}`);
+ } else if (_.isUndefined(matches[2])) {
+ throw new Error(`Could not parse array length: ${type}`);
+ }
+ const arrayElementType = matches[1];
+ const arrayLength = _.isEmpty(matches[2]) ? undefined : parseInt(matches[2], constants.DEC_BASE);
+ return [arrayElementType, arrayLength];
+ }
+
+ public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
+ // Construct parent
+ const isArray = true;
+ const [arrayElementType, arrayLength] = ArrayDataType._decodeElementTypeAndLengthFromType(dataItem.type);
+ super(dataItem, dataTypeFactory, isArray, arrayLength, arrayElementType);
+ // Set array properties
+ this._elementType = arrayElementType;
+ this._arraySignature = this._computeSignature();
+ }
+
+ public getSignature(): string {
+ return this._arraySignature;
+ }
+
+ private _computeSignature(): string {
+ // Compute signature for a single array element
+ const elementDataItem: DataItem = {
+ type: this._elementType,
+ name: 'N/A',
+ };
+ const elementComponents = this.getDataItem().components;
+ if (!_.isUndefined(elementComponents)) {
+ elementDataItem.components = elementComponents;
+ }
+ const elementDataType = this.getFactory().create(elementDataItem);
+ const elementSignature = elementDataType.getSignature();
+ // Construct signature for array of type `element`
+ if (_.isUndefined(this._arrayLength)) {
+ return `${elementSignature}[]`;
+ } else {
+ return `${elementSignature}[${this._arrayLength}]`;
+ }
+ }
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/bool.ts b/packages/utils/src/abi_encoder/evm_data_types/bool.ts
new file mode 100644
index 000000000..d713d5a94
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/bool.ts
@@ -0,0 +1,53 @@
+import { DataItem, SolidityTypes } from 'ethereum-types';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { BigNumber } from '../../configured_bignumber';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
+import { RawCalldata } from '../calldata/raw_calldata';
+import { constants } from '../utils/constants';
+
+export class BoolDataType extends AbstractBlobDataType {
+ private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
+
+ public static matchType(type: string): boolean {
+ return type === SolidityTypes.Bool;
+ }
+
+ public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
+ super(dataItem, dataTypeFactory, BoolDataType._SIZE_KNOWN_AT_COMPILE_TIME);
+ if (!BoolDataType.matchType(dataItem.type)) {
+ throw new Error(`Tried to instantiate Bool with bad input: ${dataItem}`);
+ }
+ }
+
+ // Disable prefer-function-over-method for inherited abstract methods.
+ /* tslint:disable prefer-function-over-method */
+ public encodeValue(value: boolean): Buffer {
+ const encodedValue = value ? '0x1' : '0x0';
+ const encodedValueBuf = ethUtil.setLengthLeft(
+ ethUtil.toBuffer(encodedValue),
+ constants.EVM_WORD_WIDTH_IN_BYTES,
+ );
+ return encodedValueBuf;
+ }
+
+ public decodeValue(calldata: RawCalldata): boolean {
+ const valueBuf = calldata.popWord();
+ const valueHex = ethUtil.bufferToHex(valueBuf);
+ const valueNumber = new BigNumber(valueHex, constants.HEX_BASE);
+ if (!(valueNumber.equals(0) || valueNumber.equals(1))) {
+ throw new Error(`Failed to decode boolean. Expected 0x0 or 0x1, got ${valueHex}`);
+ }
+ /* tslint:disable boolean-naming */
+ const value: boolean = !valueNumber.equals(0);
+ /* tslint:enable boolean-naming */
+ return value;
+ }
+
+ public getSignature(): string {
+ return SolidityTypes.Bool;
+ }
+ /* tslint:enable prefer-function-over-method */
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts b/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts
new file mode 100644
index 000000000..5277efd6c
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts
@@ -0,0 +1,72 @@
+import { DataItem, SolidityTypes } from 'ethereum-types';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
+import { RawCalldata } from '../calldata/raw_calldata';
+import { constants } from '../utils/constants';
+
+export class DynamicBytesDataType extends AbstractBlobDataType {
+ private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = false;
+
+ public static matchType(type: string): boolean {
+ return type === SolidityTypes.Bytes;
+ }
+
+ private static _sanityCheckValue(value: string | Buffer): void {
+ if (typeof value !== 'string') {
+ return;
+ }
+ if (!_.startsWith(value, '0x')) {
+ throw new Error(`Tried to encode non-hex value. Value must inlcude '0x' prefix.`);
+ } else if (value.length % 2 !== 0) {
+ throw new Error(`Tried to assign ${value}, which is contains a half-byte. Use full bytes only.`);
+ }
+ }
+
+ public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
+ super(dataItem, dataTypeFactory, DynamicBytesDataType._SIZE_KNOWN_AT_COMPILE_TIME);
+ if (!DynamicBytesDataType.matchType(dataItem.type)) {
+ throw new Error(`Tried to instantiate Dynamic Bytes with bad input: ${dataItem}`);
+ }
+ }
+
+ // Disable prefer-function-over-method for inherited abstract methods.
+ /* tslint:disable prefer-function-over-method */
+ public encodeValue(value: string | Buffer): Buffer {
+ // Encoded value is of the form: <length><value>, with each field padded to be word-aligned.
+ // 1/3 Construct the length
+ const valueBuf = ethUtil.toBuffer(value);
+ const wordsToStoreValuePadded = Math.ceil(valueBuf.byteLength / constants.EVM_WORD_WIDTH_IN_BYTES);
+ const bytesToStoreValuePadded = wordsToStoreValuePadded * constants.EVM_WORD_WIDTH_IN_BYTES;
+ const lengthBuf = ethUtil.toBuffer(valueBuf.byteLength);
+ const lengthBufPadded = ethUtil.setLengthLeft(lengthBuf, constants.EVM_WORD_WIDTH_IN_BYTES);
+ // 2/3 Construct the value
+ DynamicBytesDataType._sanityCheckValue(value);
+ const valueBufPadded = ethUtil.setLengthRight(valueBuf, bytesToStoreValuePadded);
+ // 3/3 Combine length and value
+ const encodedValue = Buffer.concat([lengthBufPadded, valueBufPadded]);
+ return encodedValue;
+ }
+
+ public decodeValue(calldata: RawCalldata): string {
+ // Encoded value is of the form: <length><value>, with each field padded to be word-aligned.
+ // 1/2 Decode length
+ const lengthBuf = calldata.popWord();
+ const lengthHex = ethUtil.bufferToHex(lengthBuf);
+ const length = parseInt(lengthHex, constants.HEX_BASE);
+ // 2/2 Decode value
+ const wordsToStoreValuePadded = Math.ceil(length / constants.EVM_WORD_WIDTH_IN_BYTES);
+ const valueBufPadded = calldata.popWords(wordsToStoreValuePadded);
+ const valueBuf = valueBufPadded.slice(0, length);
+ const value = ethUtil.bufferToHex(valueBuf);
+ DynamicBytesDataType._sanityCheckValue(value);
+ return value;
+ }
+
+ public getSignature(): string {
+ return SolidityTypes.Bytes;
+ }
+ /* tslint:enable prefer-function-over-method */
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/int.ts b/packages/utils/src/abi_encoder/evm_data_types/int.ts
new file mode 100644
index 000000000..f1dcf5ea1
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/int.ts
@@ -0,0 +1,59 @@
+import { DataItem, SolidityTypes } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { BigNumber } from '../../configured_bignumber';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
+import { RawCalldata } from '../calldata/raw_calldata';
+import { constants } from '../utils/constants';
+import * as EncoderMath from '../utils/math';
+
+export class IntDataType extends AbstractBlobDataType {
+ private static readonly _MATCHER = RegExp(
+ '^int(8|16|24|32|40|48|56|64|72|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256){0,1}$',
+ );
+ private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
+ private static readonly _MAX_WIDTH: number = 256;
+ private static readonly _DEFAULT_WIDTH: number = IntDataType._MAX_WIDTH;
+ private readonly _width: number;
+ private readonly _minValue: BigNumber;
+ private readonly _maxValue: BigNumber;
+
+ public static matchType(type: string): boolean {
+ return IntDataType._MATCHER.test(type);
+ }
+
+ private static _decodeWidthFromType(type: string): number {
+ const matches = IntDataType._MATCHER.exec(type);
+ const width =
+ !_.isNull(matches) && matches.length === 2 && !_.isUndefined(matches[1])
+ ? parseInt(matches[1], constants.DEC_BASE)
+ : IntDataType._DEFAULT_WIDTH;
+ return width;
+ }
+
+ public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
+ super(dataItem, dataTypeFactory, IntDataType._SIZE_KNOWN_AT_COMPILE_TIME);
+ if (!IntDataType.matchType(dataItem.type)) {
+ throw new Error(`Tried to instantiate Int with bad input: ${dataItem}`);
+ }
+ this._width = IntDataType._decodeWidthFromType(dataItem.type);
+ this._minValue = new BigNumber(2).toPower(this._width - 1).times(-1);
+ this._maxValue = new BigNumber(2).toPower(this._width - 1).sub(1);
+ }
+
+ public encodeValue(value: BigNumber | string | number): Buffer {
+ const encodedValue = EncoderMath.safeEncodeNumericValue(value, this._minValue, this._maxValue);
+ return encodedValue;
+ }
+
+ public decodeValue(calldata: RawCalldata): BigNumber {
+ const valueBuf = calldata.popWord();
+ const value = EncoderMath.safeDecodeNumericValue(valueBuf, this._minValue, this._maxValue);
+ return value;
+ }
+
+ public getSignature(): string {
+ return `${SolidityTypes.Int}${this._width}`;
+ }
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/method.ts b/packages/utils/src/abi_encoder/evm_data_types/method.ts
new file mode 100644
index 000000000..b1cd1377f
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/method.ts
@@ -0,0 +1,72 @@
+import { DataItem, MethodAbi } from 'ethereum-types';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { DataType } from '../abstract_data_types/data_type';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractSetDataType } from '../abstract_data_types/types/set';
+import { constants } from '../utils/constants';
+import { DecodingRules, EncodingRules } from '../utils/rules';
+
+import { TupleDataType } from './tuple';
+
+export class MethodDataType extends AbstractSetDataType {
+ private readonly _methodSignature: string;
+ private readonly _methodSelector: string;
+ private readonly _returnDataType: DataType;
+
+ public constructor(abi: MethodAbi, dataTypeFactory: DataTypeFactory) {
+ const methodDataItem = { type: 'method', name: abi.name, components: abi.inputs };
+ super(methodDataItem, dataTypeFactory);
+ this._methodSignature = this._computeSignature();
+ this._methodSelector = this._computeSelector();
+ const returnDataItem: DataItem = { type: 'tuple', name: abi.name, components: abi.outputs };
+ this._returnDataType = new TupleDataType(returnDataItem, this.getFactory());
+ }
+
+ public encode(value: any, rules?: EncodingRules): string {
+ const calldata = super.encode(value, rules, this._methodSelector);
+ return calldata;
+ }
+
+ public decode(calldata: string, rules?: DecodingRules): any[] | object {
+ const value = super.decode(calldata, rules, this._methodSelector);
+ return value;
+ }
+
+ public encodeReturnValues(value: any, rules?: EncodingRules): string {
+ const returnData = this._returnDataType.encode(value, rules);
+ return returnData;
+ }
+
+ public decodeReturnValues(returndata: string, rules?: DecodingRules): any {
+ const returnValues = this._returnDataType.decode(returndata, rules);
+ return returnValues;
+ }
+
+ public getSignature(): string {
+ return this._methodSignature;
+ }
+
+ public getSelector(): string {
+ return this._methodSelector;
+ }
+
+ private _computeSignature(): string {
+ const memberSignature = this._computeSignatureOfMembers();
+ const methodSignature = `${this.getDataItem().name}${memberSignature}`;
+ return methodSignature;
+ }
+
+ private _computeSelector(): string {
+ const signature = this._computeSignature();
+ const selector = ethUtil.bufferToHex(
+ ethUtil.toBuffer(
+ ethUtil
+ .sha3(signature)
+ .slice(constants.HEX_SELECTOR_BYTE_OFFSET_IN_CALLDATA, constants.HEX_SELECTOR_LENGTH_IN_BYTES),
+ ),
+ );
+ return selector;
+ }
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/pointer.ts b/packages/utils/src/abi_encoder/evm_data_types/pointer.ts
new file mode 100644
index 000000000..389e75927
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/pointer.ts
@@ -0,0 +1,17 @@
+import { DataItem } from 'ethereum-types';
+
+import { DataType } from '../abstract_data_types/data_type';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractPointerDataType } from '../abstract_data_types/types/pointer';
+
+export class PointerDataType extends AbstractPointerDataType {
+ constructor(destDataType: DataType, parentDataType: DataType, dataTypeFactory: DataTypeFactory) {
+ const destDataItem = destDataType.getDataItem();
+ const dataItem: DataItem = { name: `ptr<${destDataItem.name}>`, type: `ptr<${destDataItem.type}>` };
+ super(dataItem, dataTypeFactory, destDataType, parentDataType);
+ }
+
+ public getSignature(): string {
+ return this._destination.getSignature();
+ }
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts b/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts
new file mode 100644
index 000000000..2e371c505
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts
@@ -0,0 +1,78 @@
+import { DataItem, SolidityTypes } from 'ethereum-types';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
+import { RawCalldata } from '../calldata/raw_calldata';
+import { constants } from '../utils/constants';
+
+export class StaticBytesDataType extends AbstractBlobDataType {
+ private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
+ private static readonly _MATCHER = RegExp(
+ '^(byte|bytes(1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32))$',
+ );
+ private static readonly _DEFAULT_WIDTH = 1;
+ private readonly _width: number;
+
+ public static matchType(type: string): boolean {
+ return StaticBytesDataType._MATCHER.test(type);
+ }
+
+ private static _decodeWidthFromType(type: string): number {
+ const matches = StaticBytesDataType._MATCHER.exec(type);
+ const width =
+ !_.isNull(matches) && matches.length === 3 && !_.isUndefined(matches[2])
+ ? parseInt(matches[2], constants.DEC_BASE)
+ : StaticBytesDataType._DEFAULT_WIDTH;
+ return width;
+ }
+
+ public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
+ super(dataItem, dataTypeFactory, StaticBytesDataType._SIZE_KNOWN_AT_COMPILE_TIME);
+ if (!StaticBytesDataType.matchType(dataItem.type)) {
+ throw new Error(`Tried to instantiate Static Bytes with bad input: ${dataItem}`);
+ }
+ this._width = StaticBytesDataType._decodeWidthFromType(dataItem.type);
+ }
+
+ public getSignature(): string {
+ // Note that `byte` reduces to `bytes1`
+ return `${SolidityTypes.Bytes}${this._width}`;
+ }
+
+ public encodeValue(value: string | Buffer): Buffer {
+ // 1/2 Convert value into a buffer and do bounds checking
+ this._sanityCheckValue(value);
+ const valueBuf = ethUtil.toBuffer(value);
+ // 2/2 Store value as hex
+ const valuePadded = ethUtil.setLengthRight(valueBuf, constants.EVM_WORD_WIDTH_IN_BYTES);
+ return valuePadded;
+ }
+
+ public decodeValue(calldata: RawCalldata): string {
+ const valueBufPadded = calldata.popWord();
+ const valueBuf = valueBufPadded.slice(0, this._width);
+ const value = ethUtil.bufferToHex(valueBuf);
+ this._sanityCheckValue(value);
+ return value;
+ }
+
+ private _sanityCheckValue(value: string | Buffer): void {
+ if (typeof value === 'string') {
+ if (!_.startsWith(value, '0x')) {
+ throw new Error(`Tried to encode non-hex value. Value must inlcude '0x' prefix.`);
+ } else if (value.length % 2 !== 0) {
+ throw new Error(`Tried to assign ${value}, which is contains a half-byte. Use full bytes only.`);
+ }
+ }
+ const valueBuf = ethUtil.toBuffer(value);
+ if (valueBuf.byteLength > this._width) {
+ throw new Error(
+ `Tried to assign ${value} (${
+ valueBuf.byteLength
+ } bytes), which exceeds max bytes that can be stored in a ${this.getSignature()}`,
+ );
+ }
+ }
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/string.ts b/packages/utils/src/abi_encoder/evm_data_types/string.ts
new file mode 100644
index 000000000..91a72ad3f
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/string.ts
@@ -0,0 +1,59 @@
+import { DataItem, SolidityTypes } from 'ethereum-types';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
+import { RawCalldata } from '../calldata/raw_calldata';
+import { constants } from '../utils/constants';
+
+export class StringDataType extends AbstractBlobDataType {
+ private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = false;
+
+ public static matchType(type: string): boolean {
+ return type === SolidityTypes.String;
+ }
+
+ public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
+ super(dataItem, dataTypeFactory, StringDataType._SIZE_KNOWN_AT_COMPILE_TIME);
+ if (!StringDataType.matchType(dataItem.type)) {
+ throw new Error(`Tried to instantiate String with bad input: ${dataItem}`);
+ }
+ }
+
+ // Disable prefer-function-over-method for inherited abstract methods.
+ /* tslint:disable prefer-function-over-method */
+ public encodeValue(value: string): Buffer {
+ // Encoded value is of the form: <length><value>, with each field padded to be word-aligned.
+ // 1/3 Construct the length
+ const wordsToStoreValuePadded = Math.ceil(value.length / constants.EVM_WORD_WIDTH_IN_BYTES);
+ const bytesToStoreValuePadded = wordsToStoreValuePadded * constants.EVM_WORD_WIDTH_IN_BYTES;
+ const lengthBuf = ethUtil.toBuffer(value.length);
+ const lengthBufPadded = ethUtil.setLengthLeft(lengthBuf, constants.EVM_WORD_WIDTH_IN_BYTES);
+ // 2/3 Construct the value
+ const valueBuf = new Buffer(value);
+ const valueBufPadded = ethUtil.setLengthRight(valueBuf, bytesToStoreValuePadded);
+ // 3/3 Combine length and value
+ const encodedValue = Buffer.concat([lengthBufPadded, valueBufPadded]);
+ return encodedValue;
+ }
+
+ public decodeValue(calldata: RawCalldata): string {
+ // Encoded value is of the form: <length><value>, with each field padded to be word-aligned.
+ // 1/2 Decode length
+ const lengthBufPadded = calldata.popWord();
+ const lengthHexPadded = ethUtil.bufferToHex(lengthBufPadded);
+ const length = parseInt(lengthHexPadded, constants.HEX_BASE);
+ // 2/2 Decode value
+ const wordsToStoreValuePadded = Math.ceil(length / constants.EVM_WORD_WIDTH_IN_BYTES);
+ const valueBufPadded = calldata.popWords(wordsToStoreValuePadded);
+ const valueBuf = valueBufPadded.slice(0, length);
+ const value = valueBuf.toString('ascii');
+ return value;
+ }
+
+ public getSignature(): string {
+ return SolidityTypes.String;
+ }
+ /* tslint:enable prefer-function-over-method */
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/tuple.ts b/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
new file mode 100644
index 000000000..31593c882
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
@@ -0,0 +1,24 @@
+import { DataItem, SolidityTypes } from 'ethereum-types';
+
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractSetDataType } from '../abstract_data_types/types/set';
+
+export class TupleDataType extends AbstractSetDataType {
+ private readonly _signature: string;
+
+ public static matchType(type: string): boolean {
+ return type === SolidityTypes.Tuple;
+ }
+
+ public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
+ super(dataItem, dataTypeFactory);
+ if (!TupleDataType.matchType(dataItem.type)) {
+ throw new Error(`Tried to instantiate Tuple with bad input: ${dataItem}`);
+ }
+ this._signature = this._computeSignatureOfMembers();
+ }
+
+ public getSignature(): string {
+ return this._signature;
+ }
+}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/uint.ts b/packages/utils/src/abi_encoder/evm_data_types/uint.ts
new file mode 100644
index 000000000..5180f0cf3
--- /dev/null
+++ b/packages/utils/src/abi_encoder/evm_data_types/uint.ts
@@ -0,0 +1,58 @@
+import { DataItem, SolidityTypes } from 'ethereum-types';
+import * as _ from 'lodash';
+
+import { BigNumber } from '../../configured_bignumber';
+import { DataTypeFactory } from '../abstract_data_types/interfaces';
+import { AbstractBlobDataType } from '../abstract_data_types/types/blob';
+import { RawCalldata } from '../calldata/raw_calldata';
+import { constants } from '../utils/constants';
+import * as EncoderMath from '../utils/math';
+
+export class UIntDataType extends AbstractBlobDataType {
+ private static readonly _MATCHER = RegExp(
+ '^uint(8|16|24|32|40|48|56|64|72|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256){0,1}$',
+ );
+ private static readonly _SIZE_KNOWN_AT_COMPILE_TIME: boolean = true;
+ private static readonly _MAX_WIDTH: number = 256;
+ private static readonly _DEFAULT_WIDTH: number = UIntDataType._MAX_WIDTH;
+ private static readonly _MIN_VALUE = new BigNumber(0);
+ private readonly _width: number;
+ private readonly _maxValue: BigNumber;
+
+ public static matchType(type: string): boolean {
+ return UIntDataType._MATCHER.test(type);
+ }
+
+ private static _decodeWidthFromType(type: string): number {
+ const matches = UIntDataType._MATCHER.exec(type);
+ const width =
+ !_.isNull(matches) && matches.length === 2 && !_.isUndefined(matches[1])
+ ? parseInt(matches[1], constants.DEC_BASE)
+ : UIntDataType._DEFAULT_WIDTH;
+ return width;
+ }
+
+ public constructor(dataItem: DataItem, dataTypeFactory: DataTypeFactory) {
+ super(dataItem, dataTypeFactory, UIntDataType._SIZE_KNOWN_AT_COMPILE_TIME);
+ if (!UIntDataType.matchType(dataItem.type)) {
+ throw new Error(`Tried to instantiate UInt with bad input: ${dataItem}`);
+ }
+ this._width = UIntDataType._decodeWidthFromType(dataItem.type);
+ this._maxValue = new BigNumber(2).toPower(this._width).sub(1);
+ }
+
+ public encodeValue(value: BigNumber | string | number): Buffer {
+ const encodedValue = EncoderMath.safeEncodeNumericValue(value, UIntDataType._MIN_VALUE, this._maxValue);
+ return encodedValue;
+ }
+
+ public decodeValue(calldata: RawCalldata): BigNumber {
+ const valueBuf = calldata.popWord();
+ const value = EncoderMath.safeDecodeNumericValue(valueBuf, UIntDataType._MIN_VALUE, this._maxValue);
+ return value;
+ }
+
+ public getSignature(): string {
+ return `${SolidityTypes.Uint}${this._width}`;
+ }
+}
diff --git a/packages/utils/src/abi_encoder/index.ts b/packages/utils/src/abi_encoder/index.ts
new file mode 100644
index 000000000..baf844ac6
--- /dev/null
+++ b/packages/utils/src/abi_encoder/index.ts
@@ -0,0 +1,14 @@
+export { EncodingRules, DecodingRules } from './utils/rules';
+export {
+ Address,
+ Array,
+ Bool,
+ DynamicBytes,
+ Int,
+ Method,
+ Pointer,
+ StaticBytes,
+ String,
+ Tuple,
+ UInt,
+} from './evm_data_type_factory';
diff --git a/packages/utils/src/abi_encoder/utils/constants.ts b/packages/utils/src/abi_encoder/utils/constants.ts
new file mode 100644
index 000000000..36de2dd4f
--- /dev/null
+++ b/packages/utils/src/abi_encoder/utils/constants.ts
@@ -0,0 +1,17 @@
+import { DecodingRules, EncodingRules } from './rules';
+
+export const constants = {
+ EVM_WORD_WIDTH_IN_BYTES: 32,
+ EVM_WORD_WIDTH_IN_BITS: 256,
+ HEX_BASE: 16,
+ DEC_BASE: 10,
+ BIN_BASE: 2,
+ HEX_SELECTOR_LENGTH_IN_CHARS: 10,
+ HEX_SELECTOR_LENGTH_IN_BYTES: 4,
+ HEX_SELECTOR_BYTE_OFFSET_IN_CALLDATA: 0,
+ // Disable no-object-literal-type-assertion so we can enforce cast
+ /* tslint:disable no-object-literal-type-assertion */
+ DEFAULT_DECODING_RULES: { shouldConvertStructsToObjects: false } as DecodingRules,
+ DEFAULT_ENCODING_RULES: { shouldOptimize: true, shouldAnnotate: false } as EncodingRules,
+ /* tslint:enable no-object-literal-type-assertion */
+};
diff --git a/packages/utils/src/abi_encoder/utils/math.ts b/packages/utils/src/abi_encoder/utils/math.ts
new file mode 100644
index 000000000..d84983c5b
--- /dev/null
+++ b/packages/utils/src/abi_encoder/utils/math.ts
@@ -0,0 +1,111 @@
+import BigNumber from 'bignumber.js';
+import * as ethUtil from 'ethereumjs-util';
+import * as _ from 'lodash';
+
+import { constants } from '../utils/constants';
+
+function sanityCheckBigNumberRange(
+ value_: BigNumber | string | number,
+ minValue: BigNumber,
+ maxValue: BigNumber,
+): void {
+ const value = new BigNumber(value_, 10);
+ if (value.greaterThan(maxValue)) {
+ throw new Error(`Tried to assign value of ${value}, which exceeds max value of ${maxValue}`);
+ } else if (value.lessThan(minValue)) {
+ throw new Error(`Tried to assign value of ${value}, which exceeds min value of ${minValue}`);
+ }
+}
+function bigNumberToPaddedBuffer(value: BigNumber): Buffer {
+ const valueHex = `0x${value.toString(constants.HEX_BASE)}`;
+ const valueBuf = ethUtil.toBuffer(valueHex);
+ const valueBufPadded = ethUtil.setLengthLeft(valueBuf, constants.EVM_WORD_WIDTH_IN_BYTES);
+ return valueBufPadded;
+}
+/**
+ * Takes a numeric value and returns its ABI-encoded value
+ * @param value_ The value to encode.
+ * @return ABI Encoded value
+ */
+export function encodeNumericValue(value_: BigNumber | string | number): Buffer {
+ const value = new BigNumber(value_, 10);
+ // Case 1/2: value is non-negative
+ if (value.greaterThanOrEqualTo(0)) {
+ const encodedPositiveValue = bigNumberToPaddedBuffer(value);
+ return encodedPositiveValue;
+ }
+ // Case 2/2: Value is negative
+ // Use two's-complement to encode the value
+ // Step 1/3: Convert negative value to positive binary string
+ const valueBin = value.times(-1).toString(constants.BIN_BASE);
+ // Step 2/3: Invert binary value
+ let invertedValueBin = '1'.repeat(constants.EVM_WORD_WIDTH_IN_BITS - valueBin.length);
+ _.each(valueBin, (bit: string) => {
+ invertedValueBin += bit === '1' ? '0' : '1';
+ });
+ const invertedValue = new BigNumber(invertedValueBin, constants.BIN_BASE);
+ // Step 3/3: Add 1 to inverted value
+ const negativeValue = invertedValue.plus(1);
+ const encodedValue = bigNumberToPaddedBuffer(negativeValue);
+ return encodedValue;
+}
+/**
+ * Takes a numeric value and returns its ABI-encoded value.
+ * Performs an additional sanity check, given the min/max allowed value.
+ * @param value_ The value to encode.
+ * @return ABI Encoded value
+ */
+export function safeEncodeNumericValue(
+ value: BigNumber | string | number,
+ minValue: BigNumber,
+ maxValue: BigNumber,
+): Buffer {
+ sanityCheckBigNumberRange(value, minValue, maxValue);
+ const encodedValue = encodeNumericValue(value);
+ return encodedValue;
+}
+/**
+ * Takes an ABI-encoded numeric value and returns its decoded value as a BigNumber.
+ * @param encodedValue The encoded numeric value.
+ * @param minValue The minimum possible decoded value.
+ * @return ABI Decoded value
+ */
+export function decodeNumericValue(encodedValue: Buffer, minValue: BigNumber): BigNumber {
+ const valueHex = ethUtil.bufferToHex(encodedValue);
+ // Case 1/3: value is definitely non-negative because of numeric boundaries
+ const value = new BigNumber(valueHex, constants.HEX_BASE);
+ if (!minValue.lessThan(0)) {
+ return value;
+ }
+ // Case 2/3: value is non-negative because there is no leading 1 (encoded as two's-complement)
+ const valueBin = value.toString(constants.BIN_BASE);
+ const isValueNegative = valueBin.length === constants.EVM_WORD_WIDTH_IN_BITS && _.startsWith(valueBin[0], '1');
+ if (!isValueNegative) {
+ return value;
+ }
+ // Case 3/3: value is negative
+ // Step 1/3: Invert b inary value
+ let invertedValueBin = '';
+ _.each(valueBin, (bit: string) => {
+ invertedValueBin += bit === '1' ? '0' : '1';
+ });
+ const invertedValue = new BigNumber(invertedValueBin, constants.BIN_BASE);
+ // Step 2/3: Add 1 to inverted value
+ // The result is the two's-complement representation of the input value.
+ const positiveValue = invertedValue.plus(1);
+ // Step 3/3: Invert positive value to get the negative value
+ const negativeValue = positiveValue.times(-1);
+ return negativeValue;
+}
+/**
+ * Takes an ABI-encoded numeric value and returns its decoded value as a BigNumber.
+ * Performs an additional sanity check, given the min/max allowed value.
+ * @param encodedValue The encoded numeric value.
+ * @param minValue The minimum possible decoded value.
+ * @return ABI Decoded value
+ */
+export function safeDecodeNumericValue(encodedValue: Buffer, minValue: BigNumber, maxValue: BigNumber): BigNumber {
+ const value = decodeNumericValue(encodedValue, minValue);
+ sanityCheckBigNumberRange(value, minValue, maxValue);
+ return value;
+}
diff --git a/packages/utils/src/abi_encoder/utils/queue.ts b/packages/utils/src/abi_encoder/utils/queue.ts
new file mode 100644
index 000000000..53afb7e11
--- /dev/null
+++ b/packages/utils/src/abi_encoder/utils/queue.ts
@@ -0,0 +1,39 @@
+export class Queue<T> {
+ private _store: T[] = [];
+
+ public pushBack(val: T): void {
+ this._store.push(val);
+ }
+
+ public pushFront(val: T): void {
+ this._store.unshift(val);
+ }
+
+ public popFront(): T | undefined {
+ return this._store.shift();
+ }
+
+ public popBack(): T | undefined {
+ if (this._store.length === 0) {
+ return undefined;
+ }
+ const backElement = this._store.splice(-1, 1)[0];
+ return backElement;
+ }
+
+ public mergeBack(q: Queue<T>): void {
+ this._store = this._store.concat(q._store);
+ }
+
+ public mergeFront(q: Queue<T>): void {
+ this._store = q._store.concat(this._store);
+ }
+
+ public getStore(): T[] {
+ return this._store;
+ }
+
+ public peekFront(): T | undefined {
+ return this._store.length >= 0 ? this._store[0] : undefined;
+ }
+}
diff --git a/packages/utils/src/abi_encoder/utils/rules.ts b/packages/utils/src/abi_encoder/utils/rules.ts
new file mode 100644
index 000000000..c8d83c3ba
--- /dev/null
+++ b/packages/utils/src/abi_encoder/utils/rules.ts
@@ -0,0 +1,8 @@
+export interface DecodingRules {
+ shouldConvertStructsToObjects: boolean;
+}
+
+export interface EncodingRules {
+ shouldOptimize?: boolean;
+ shouldAnnotate?: boolean;
+}
diff --git a/packages/utils/src/abi_utils.ts b/packages/utils/src/abi_utils.ts
index 598ea5fcc..3e6fc9665 100644
--- a/packages/utils/src/abi_utils.ts
+++ b/packages/utils/src/abi_utils.ts
@@ -26,7 +26,7 @@ function parseEthersParams(params: DataItem[]): { names: ParamName[]; types: str
const result = parseEthersParams(param.components);
names.push({ name: param.name || null, names: result.names });
- types.push('tuple(' + result.types.join(',') + ')' + suffix);
+ types.push(`tuple(${result.types.join(',')})${suffix}`);
} else {
names.push(param.name || null);
types.push(param.type);
@@ -120,7 +120,7 @@ function splitTupleTypes(type: string): string[] {
if (_.endsWith(type, '[]')) {
throw new Error('Internal error: array types are not supported');
} else if (!_.startsWith(type, 'tuple(')) {
- throw new Error('Internal error: expected tuple type but got non-tuple type: ' + type);
+ throw new Error(`Internal error: expected tuple type but got non-tuple type: ${type}`);
}
// Trim the outtermost tuple().
const trimmedType = type.substring('tuple('.length, type.length - 1);
diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts
index 0723e5788..082aff6bb 100644
--- a/packages/utils/src/index.ts
+++ b/packages/utils/src/index.ts
@@ -10,3 +10,4 @@ export { NULL_BYTES } from './constants';
export { errorUtils } from './error_utils';
export { fetchAsync } from './fetch_async';
export { signTypedDataUtils } from './sign_typed_data_utils';
+export import AbiEncoder = require('./abi_encoder');
diff --git a/packages/utils/src/log_utils.ts b/packages/utils/src/log_utils.ts
index 87f8479b5..6d9996c67 100644
--- a/packages/utils/src/log_utils.ts
+++ b/packages/utils/src/log_utils.ts
@@ -1,3 +1,5 @@
+import chalk from 'chalk';
+
export const logUtils = {
log(...args: any[]): void {
console.log(...args); // tslint:disable-line:no-console
@@ -5,4 +7,7 @@ export const logUtils = {
warn(...args: any[]): void {
console.warn(...args); // tslint:disable-line:no-console
},
+ logWithTime(arg: string): void {
+ logUtils.log(`[${chalk.gray(new Date().toLocaleTimeString())}] ${arg}`);
+ },
};
diff --git a/packages/utils/test/abi_encoder/abi_samples/method_abis.ts b/packages/utils/test/abi_encoder/abi_samples/method_abis.ts
new file mode 100644
index 000000000..fc552c127
--- /dev/null
+++ b/packages/utils/test/abi_encoder/abi_samples/method_abis.ts
@@ -0,0 +1,780 @@
+/* tslint:disable max-file-line-count */
+import { MethodAbi } from 'ethereum-types';
+
+export const simpleAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'greg',
+ type: 'uint256',
+ },
+ {
+ name: 'gregStr',
+ type: 'string',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const stringAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'greg',
+ type: 'string[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const GAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'a',
+ type: 'uint256',
+ },
+ {
+ name: 'b',
+ type: 'string',
+ },
+ {
+ name: 'e',
+ type: 'bytes',
+ },
+ {
+ name: 'f',
+ type: 'address',
+ },
+ ],
+
+ name: 'f',
+ type: 'tuple',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const typesWithDefaultWidthsAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'someUint',
+ type: 'uint',
+ },
+ {
+ name: 'someInt',
+ type: 'int',
+ },
+ {
+ name: 'someByte',
+ type: 'byte',
+ },
+ {
+ name: 'someUint',
+ type: 'uint[]',
+ },
+ {
+ name: 'someInt',
+ type: 'int[]',
+ },
+ {
+ name: 'someByte',
+ type: 'byte[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const multiDimensionalArraysStaticTypeAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'a',
+ type: 'uint8[][][]',
+ },
+ {
+ name: 'b',
+ type: 'uint8[][][2]',
+ },
+ {
+ name: 'c',
+ type: 'uint8[][2][]',
+ },
+ {
+ name: 'd',
+ type: 'uint8[2][][]',
+ },
+ {
+ name: 'e',
+ type: 'uint8[][2][2]',
+ },
+ {
+ name: 'f',
+ type: 'uint8[2][2][]',
+ },
+ {
+ name: 'g',
+ type: 'uint8[2][][2]',
+ },
+ {
+ name: 'h',
+ type: 'uint8[2][2][2]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const multiDimensionalArraysDynamicTypeAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'a',
+ type: 'string[][][]',
+ },
+ {
+ name: 'b',
+ type: 'string[][][2]',
+ },
+ {
+ name: 'c',
+ type: 'string[][2][]',
+ },
+ {
+ name: 'h',
+ type: 'string[2][2][2]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const dynamicTupleAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someStr',
+ type: 'string',
+ },
+ ],
+ name: 'order',
+ type: 'tuple',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const arrayOfStaticTuplesWithDefinedLengthAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someUint2',
+ type: 'uint256',
+ },
+ ],
+ name: 'order',
+ type: 'tuple[8]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const arrayOfStaticTuplesWithDynamicLengthAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someUint2',
+ type: 'uint256',
+ },
+ ],
+ name: 'order',
+ type: 'tuple[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const arrayOfDynamicTuplesWithDefinedLengthAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someString',
+ type: 'string',
+ },
+ ],
+ name: 'order',
+ type: 'tuple[8]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const arrayOfDynamicTuplesWithUndefinedLengthAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someString',
+ type: 'string',
+ },
+ ],
+ name: 'order',
+ type: 'tuple[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const arrayOfDynamicTuplesAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someString',
+ type: 'string',
+ },
+ ],
+ name: 'order',
+ type: 'tuple[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const multidimensionalArrayOfDynamicTuplesAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someString',
+ type: 'string',
+ },
+ ],
+ name: 'order',
+ type: 'tuple[][2][]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const staticTupleAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'someUint1',
+ type: 'uint256',
+ },
+ {
+ name: 'someUint2',
+ type: 'uint256',
+ },
+ {
+ name: 'someUint3',
+ type: 'uint256',
+ },
+ {
+ name: 'someBool',
+ type: 'bool',
+ },
+ ],
+ name: 'order',
+ type: 'tuple',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const staticArrayAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'someStaticArray',
+ type: 'uint8[3]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const staticArrayDynamicMembersAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'someStaticArray',
+ type: 'string[3]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const dynamicArrayDynamicMembersAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'someStaticArray',
+ type: 'string[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const dynamicArrayStaticMembersAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'someStaticArray',
+ type: 'uint8[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const largeFlatAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'someUInt256',
+ type: 'uint256',
+ },
+ {
+ name: 'someInt256',
+ type: 'int256',
+ },
+ {
+ name: 'someInt32',
+ type: 'int32',
+ },
+ {
+ name: 'someByte',
+ type: 'byte',
+ },
+ {
+ name: 'someBytes32',
+ type: 'bytes32',
+ },
+ {
+ name: 'someBytes',
+ type: 'bytes',
+ },
+ {
+ name: 'someString',
+ type: 'string',
+ },
+ {
+ name: 'someAddress',
+ type: 'address',
+ },
+ {
+ name: 'someBool',
+ type: 'bool',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const largeNestedAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'someStaticArray',
+ type: 'uint8[3]',
+ },
+ {
+ name: 'someStaticArrayWithDynamicMembers',
+ type: 'string[2]',
+ },
+ {
+ name: 'someDynamicArrayWithDynamicMembers',
+ type: 'bytes[]',
+ },
+ {
+ name: 'some2DArray',
+ type: 'string[][]',
+ },
+ {
+ name: 'someTuple',
+ type: 'tuple',
+ components: [
+ {
+ name: 'someUint32',
+ type: 'uint32',
+ },
+ {
+ name: 'someStr',
+ type: 'string',
+ },
+ ],
+ },
+ {
+ name: 'someTupleWithDynamicTypes',
+ type: 'tuple',
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someStr',
+ type: 'string',
+ },
+ /*{
+ name: 'someStrArray',
+ type: 'string[]',
+ },*/
+ {
+ name: 'someBytes',
+ type: 'bytes',
+ },
+ {
+ name: 'someAddress',
+ type: 'address',
+ },
+ ],
+ },
+ {
+ name: 'someArrayOfTuplesWithDynamicTypes',
+ type: 'tuple[]',
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someStr',
+ type: 'string',
+ },
+ /*{
+ name: 'someStrArray',
+ type: 'string[]',
+ },*/
+ {
+ name: 'someBytes',
+ type: 'bytes',
+ },
+ {
+ name: 'someAddress',
+ type: 'address',
+ },
+ ],
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const nestedTuples: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'firstTuple',
+ type: 'tuple[1]',
+ components: [
+ {
+ name: 'someUint32',
+ type: 'uint32',
+ },
+ {
+ name: 'nestedTuple',
+ type: 'tuple',
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someAddress',
+ type: 'address',
+ },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'secondTuple',
+ type: 'tuple[]',
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someStr',
+ type: 'string',
+ },
+ {
+ name: 'nestedTuple',
+ type: 'tuple',
+ components: [
+ {
+ name: 'someUint32',
+ type: 'uint32',
+ },
+ {
+ name: 'secondNestedTuple',
+ type: 'tuple',
+ components: [
+ {
+ name: 'someUint',
+ type: 'uint256',
+ },
+ {
+ name: 'someStr',
+ type: 'string',
+ },
+ {
+ name: 'someBytes',
+ type: 'bytes',
+ },
+ {
+ name: 'someAddress',
+ type: 'address',
+ },
+ ],
+ },
+ ],
+ },
+ {
+ name: 'someBytes',
+ type: 'bytes',
+ },
+ {
+ name: 'someAddress',
+ type: 'address',
+ },
+ ],
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const simpleAbi2: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'someByte',
+ type: 'byte',
+ },
+ {
+ name: 'someBytes32',
+ type: 'bytes32',
+ },
+ {
+ name: 'someBytes',
+ type: 'bytes',
+ },
+ {
+ name: 'someString',
+ type: 'string',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const fillOrderAbi: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'makerAddress',
+ type: 'address',
+ },
+ {
+ name: 'takerAddress',
+ type: 'address',
+ },
+ {
+ name: 'feeRecipientAddress',
+ type: 'address',
+ },
+ {
+ name: 'senderAddress',
+ type: 'address',
+ },
+ {
+ name: 'makerAssetAmount',
+ type: 'uint256',
+ },
+ {
+ name: 'takerAssetAmount',
+ type: 'uint256',
+ },
+ {
+ name: 'makerFee',
+ type: 'uint256',
+ },
+ {
+ name: 'takerFee',
+ type: 'uint256',
+ },
+ {
+ name: 'expirationTimeSeconds',
+ type: 'uint256',
+ },
+ {
+ name: 'salt',
+ type: 'uint256',
+ },
+ {
+ name: 'makerAssetData',
+ type: 'bytes',
+ },
+ {
+ name: 'takerAssetData',
+ type: 'bytes',
+ },
+ ],
+ name: 'order',
+ type: 'tuple',
+ },
+ {
+ name: 'takerAssetFillAmount',
+ type: 'uint256',
+ },
+ {
+ name: 'salt',
+ type: 'uint256',
+ },
+ {
+ name: 'orderSignature',
+ type: 'bytes',
+ },
+ {
+ name: 'takerSignature',
+ type: 'bytes',
+ },
+ ],
+ name: 'fillOrder',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
diff --git a/packages/utils/test/abi_encoder/abi_samples/optimizer_abis.ts b/packages/utils/test/abi_encoder/abi_samples/optimizer_abis.ts
new file mode 100644
index 000000000..7cfd7a118
--- /dev/null
+++ b/packages/utils/test/abi_encoder/abi_samples/optimizer_abis.ts
@@ -0,0 +1,340 @@
+/* tslint:disable max-file-line-count */
+import { MethodAbi } from 'ethereum-types';
+
+export const duplicateDynamicArraysWithStaticElements: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'array1',
+ type: 'uint[]',
+ },
+ {
+ name: 'array2',
+ type: 'uint[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateDynamicArraysWithDynamicElements: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'array1',
+ type: 'string[]',
+ },
+ {
+ name: 'array2',
+ type: 'string[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateStaticArraysWithStaticElements: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'array1',
+ type: 'uint[2]',
+ },
+ {
+ name: 'array2',
+ type: 'uint[2]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateStaticArraysWithDynamicElements: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'array1',
+ type: 'string[2]',
+ },
+ {
+ name: 'array2',
+ type: 'string[2]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateArrayElements: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'array',
+ type: 'string[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateTupleFields: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'field1',
+ type: 'string',
+ },
+ {
+ name: 'field2',
+ type: 'string',
+ },
+ ],
+ name: 'Tuple',
+ type: 'tuple',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateStrings: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'string1',
+ type: 'string',
+ },
+ {
+ name: 'string2',
+ type: 'string',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateBytes: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'bytes1',
+ type: 'bytes',
+ },
+ {
+ name: 'bytes2',
+ type: 'bytes',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateTuples: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'field1',
+ type: 'string',
+ },
+ {
+ name: 'field2',
+ type: 'uint',
+ },
+ ],
+ name: 'Tuple',
+ type: 'tuple',
+ },
+ {
+ components: [
+ {
+ name: 'field1',
+ type: 'string',
+ },
+ {
+ name: 'field2',
+ type: 'uint',
+ },
+ ],
+ name: 'Tuple',
+ type: 'tuple',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateArraysNestedInTuples: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ name: 'field',
+ type: 'uint[]',
+ },
+ ],
+ name: 'Tuple1',
+ type: 'tuple',
+ },
+ {
+ components: [
+ {
+ name: 'field',
+ type: 'uint[]',
+ },
+ {
+ name: 'extraField',
+ type: 'string',
+ },
+ ],
+ name: 'Tuple2',
+ type: 'tuple',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateTuplesNestedInTuples: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ components: [
+ {
+ components: [
+ {
+ name: 'nestedField',
+ type: 'string',
+ },
+ ],
+ name: 'field',
+ type: 'tuple',
+ },
+ ],
+ name: 'Tuple1',
+ type: 'tuple',
+ },
+ {
+ components: [
+ {
+ components: [
+ {
+ name: 'nestedField',
+ type: 'string',
+ },
+ ],
+ name: 'field',
+ type: 'tuple',
+ },
+ {
+ name: 'extraField',
+ type: 'string',
+ },
+ ],
+ name: 'Tuple1',
+ type: 'tuple',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const duplicateTwoDimensionalArrays: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'array1',
+ type: 'string[][]',
+ },
+ {
+ name: 'array2',
+ type: 'string[][]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const arrayElementsDuplicatedAsSeparateParameter: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'stringArray',
+ type: 'string[]',
+ },
+ {
+ name: 'string',
+ type: 'string',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const arrayElementsDuplicatedAsTupleFields: MethodAbi = {
+ constant: false,
+ inputs: [
+ {
+ name: 'uint8Array',
+ type: 'uint8[]',
+ },
+ {
+ components: [
+ {
+ name: 'uint',
+ type: 'uint',
+ },
+ ],
+ name: 'uintTuple',
+ type: 'tuple[]',
+ },
+ ],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
diff --git a/packages/utils/test/abi_encoder/abi_samples/return_value_abis.ts b/packages/utils/test/abi_encoder/abi_samples/return_value_abis.ts
new file mode 100644
index 000000000..ac2124011
--- /dev/null
+++ b/packages/utils/test/abi_encoder/abi_samples/return_value_abis.ts
@@ -0,0 +1,99 @@
+/* tslint:disable max-file-line-count */
+import { MethodAbi } from 'ethereum-types';
+
+export const noReturnValues: MethodAbi = {
+ constant: false,
+ inputs: [],
+ name: 'simpleFunction',
+ outputs: [],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const singleStaticReturnValue: MethodAbi = {
+ constant: false,
+ inputs: [],
+ name: 'simpleFunction',
+ outputs: [
+ {
+ name: 'Bytes4',
+ type: 'bytes4',
+ },
+ ],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const multipleStaticReturnValues: MethodAbi = {
+ constant: false,
+ inputs: [],
+ name: 'simpleFunction',
+ outputs: [
+ {
+ name: 'val1',
+ type: 'bytes4',
+ },
+ {
+ name: 'val2',
+ type: 'bytes4',
+ },
+ ],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const singleDynamicReturnValue: MethodAbi = {
+ constant: false,
+ inputs: [],
+ name: 'simpleFunction',
+ outputs: [
+ {
+ name: 'val',
+ type: 'bytes',
+ },
+ ],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const multipleDynamicReturnValues: MethodAbi = {
+ constant: false,
+ inputs: [],
+ name: 'simpleFunction',
+ outputs: [
+ {
+ name: 'val1',
+ type: 'bytes',
+ },
+ {
+ name: 'val2',
+ type: 'bytes',
+ },
+ ],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
+
+export const mixedStaticAndDynamicReturnValues: MethodAbi = {
+ constant: false,
+ inputs: [],
+ name: 'simpleFunction',
+ outputs: [
+ {
+ name: 'val1',
+ type: 'bytes4',
+ },
+ {
+ name: 'val2',
+ type: 'bytes',
+ },
+ ],
+ payable: false,
+ stateMutability: 'nonpayable',
+ type: 'function',
+};
diff --git a/packages/utils/test/abi_encoder/evm_data_types_test.ts b/packages/utils/test/abi_encoder/evm_data_types_test.ts
new file mode 100644
index 000000000..55d582d10
--- /dev/null
+++ b/packages/utils/test/abi_encoder/evm_data_types_test.ts
@@ -0,0 +1,1007 @@
+/* tslint:disable max-file-line-count */
+import * as chai from 'chai';
+import * as ethUtil from 'ethereumjs-util';
+import 'mocha';
+
+import { AbiEncoder, BigNumber } from '../../src/';
+import { chaiSetup } from '../utils/chai_setup';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
+ const encodingRules: AbiEncoder.EncodingRules = { shouldOptimize: false }; // optimizer is tested separately.
+ describe('Array', () => {
+ it('Fixed size; Static elements', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'int[2]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const args = [new BigNumber(5), new BigNumber(6)];
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Dynamic size; Static elements', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'int[]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const args = [new BigNumber(5), new BigNumber(6)];
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Fixed size; Dynamic elements', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'string[2]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const args = ['Hello', 'world'];
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005776f726c64000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Dynamic size; Dynamic elements', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'string[]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const args = ['Hello', 'world'];
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005776f726c64000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Dynamic Size; Multidimensional; Dynamic Elements', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'bytes[][]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const array1 = ['0x01020304', '0x05060708', '0x09101112'];
+ const array2 = ['0x10111213', '0x14151617'];
+ const array3 = ['0x18192021'];
+ const args = [array1, array2, array3];
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000040102030400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000405060708000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004091011120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000041011121300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000414151617000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000041819202100000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Dynamic Size; Multidimensional; Static Elements', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'bytes4[][]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const array1 = ['0x01020304', '0x05060708', '0x09101112'];
+ const array2 = ['0x10111213', '0x14151617'];
+ const array3 = ['0x18192021'];
+ const args = [array1, array2, array3];
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000301020304000000000000000000000000000000000000000000000000000000000506070800000000000000000000000000000000000000000000000000000000091011120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021011121300000000000000000000000000000000000000000000000000000000141516170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011819202100000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Static Size; Multidimensional; Static Elements', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'bytes4[3][2]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const array1 = ['0x01020304', '0x05060708', '0x09101112'];
+ const array2 = ['0x10111213', '0x14151617', '0x18192021'];
+ const args = [array1, array2];
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x010203040000000000000000000000000000000000000000000000000000000005060708000000000000000000000000000000000000000000000000000000000910111200000000000000000000000000000000000000000000000000000000101112130000000000000000000000000000000000000000000000000000000014151617000000000000000000000000000000000000000000000000000000001819202100000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Static Size; Multidimensional; Dynamic Elements', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'bytes[3][2]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const array1 = ['0x01020304', '0x05060708', '0x09101112'];
+ const array2 = ['0x10111213', '0x14151617', '0x18192021'];
+ const args = [array1, array2];
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000401020304000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004050607080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040910111200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000410111213000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004141516170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041819202100000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Static size; Too Few Elements', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'string[3]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const args = ['Hello', 'world'];
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw('Expected array of 3 elements, but got array of length 2');
+ });
+ it('Static size; Too Many Elements', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'string[1]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const args = ['Hello', 'world'];
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw('Expected array of 1 elements, but got array of length 2');
+ });
+ it('Element Type Mismatch', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'testArray', type: 'uint[]' };
+ const dataType = new AbiEncoder.Array(testDataItem);
+ // Construct args to be encoded
+ const args = [new BigNumber(1), 'Bad Argument'];
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw();
+ });
+ });
+
+ describe('Tuple', () => {
+ it('Static elements only', async () => {
+ // Create DataType object
+ const testDataItem = {
+ name: 'Tuple',
+ type: 'tuple',
+ components: [{ name: 'field_1', type: 'int32' }, { name: 'field_2', type: 'bool' }],
+ };
+ const dataType = new AbiEncoder.Tuple(testDataItem);
+ // Construct args to be encoded
+ const args = { field_1: new BigNumber(-5), field_2: true };
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0000000000000000000000000000000000000000000000000000000000000001';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
+ const decodedArgs = dataType.decode(encodedArgs, decodingRules);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Dynamic elements only', async () => {
+ // Create DataType object
+ const testDataItem = {
+ name: 'Tuple',
+ type: 'tuple',
+ components: [{ name: 'field_1', type: 'string' }, { name: 'field_2', type: 'bytes' }],
+ };
+ const dataType = new AbiEncoder.Tuple(testDataItem);
+ // Construct args to be encoded
+ const args = { field_1: 'Hello, World!', field_2: '0xabcdef0123456789' };
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c6421000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008abcdef0123456789000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
+ const decodedArgs = dataType.decode(encodedArgs, decodingRules);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Nested Static Array', async () => {
+ // Create DataType object
+ const testDataItem = {
+ name: 'Tuple',
+ type: 'tuple',
+ components: [{ name: 'field', type: 'uint[2]' }],
+ };
+ const dataType = new AbiEncoder.Tuple(testDataItem);
+ // Construct args to be encoded
+ const args = { field: [new BigNumber(1), new BigNumber(2)] };
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
+ const decodedArgs = dataType.decode(encodedArgs, decodingRules);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Nested Dynamic Array', async () => {
+ // Create DataType object
+ const testDataItem = {
+ name: 'Tuple',
+ type: 'tuple',
+ components: [{ name: 'field', type: 'uint[]' }],
+ };
+ const dataType = new AbiEncoder.Tuple(testDataItem);
+ // Construct args to be encoded
+ const args = { field: [new BigNumber(1), new BigNumber(2)] };
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
+ const decodedArgs = dataType.decode(encodedArgs, decodingRules);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Nested Static Multidimensional Array', async () => {
+ // Create DataType object
+ const testDataItem = {
+ name: 'Tuple',
+ type: 'tuple',
+ components: [{ name: 'field', type: 'bytes4[2][2]' }],
+ };
+ const dataType = new AbiEncoder.Tuple(testDataItem);
+ // Construct args to be encoded
+ const array1 = ['0x01020304', '0x05060708'];
+ const array2 = ['0x09101112', '0x13141516'];
+ const args = { field: [array1, array2] };
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x0102030400000000000000000000000000000000000000000000000000000000050607080000000000000000000000000000000000000000000000000000000009101112000000000000000000000000000000000000000000000000000000001314151600000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
+ const decodedArgs = dataType.decode(encodedArgs, decodingRules);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Nested Dynamic Multidimensional Array', async () => {
+ // Create DataType object
+ const testDataItem = {
+ name: 'Tuple',
+ type: 'tuple',
+ components: [{ name: 'field', type: 'bytes[2][2]' }],
+ };
+ const dataType = new AbiEncoder.Tuple(testDataItem);
+ // Construct args to be encoded
+ const array1 = ['0x01020304', '0x05060708'];
+ const array2 = ['0x09101112', '0x13141516'];
+ const args = { field: [array1, array2] };
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004010203040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040506070800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004091011120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041314151600000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
+ const decodedArgs = dataType.decode(encodedArgs, decodingRules);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Static and dynamic elements mixed', async () => {
+ // Create DataType object
+ const testDataItem = {
+ name: 'Tuple',
+ type: 'tuple',
+ components: [
+ { name: 'field_1', type: 'int32' },
+ { name: 'field_2', type: 'string' },
+ { name: 'field_3', type: 'bool' },
+ { name: 'field_4', type: 'bytes' },
+ ],
+ };
+ const dataType = new AbiEncoder.Tuple(testDataItem);
+ // Construct args to be encoded
+ const args = {
+ field_1: new BigNumber(-5),
+ field_2: 'Hello, World!',
+ field_3: true,
+ field_4: '0xabcdef0123456789',
+ };
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c6421000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008abcdef0123456789000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
+ const decodedArgs = dataType.decode(encodedArgs, decodingRules);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Missing Key', async () => {
+ // Create DataType object
+ const testDataItem = {
+ name: 'Tuple',
+ type: 'tuple',
+ components: [{ name: 'field_1', type: 'int32' }, { name: 'field_2', type: 'bool' }],
+ };
+ const dataType = new AbiEncoder.Tuple(testDataItem);
+ // Construct args to be encoded
+ const args = { field_1: new BigNumber(-5) };
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw('Could not assign tuple to object: missing keys field_2');
+ });
+ it('Bad Key', async () => {
+ // Create DataType object
+ const testDataItem = {
+ name: 'Tuple',
+ type: 'tuple',
+ components: [{ name: 'field_1', type: 'int32' }, { name: 'field_2', type: 'bool' }],
+ };
+ const dataType = new AbiEncoder.Tuple(testDataItem);
+ // Construct args to be encoded
+ const args = { unknown_field: new BigNumber(-5) };
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw("Could not assign tuple to object: unrecognized key 'unknown_field' in object Tuple");
+ });
+ });
+
+ describe('Address', () => {
+ it('Valid Address', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Address', type: 'address' };
+ const dataType = new AbiEncoder.Address(testDataItem);
+ // Construct args to be encoded
+ const args = '0xe41d2489571d322189246dafa5ebde1f4699f498';
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Invalid Address - input is not valid hex', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Address', type: 'address' };
+ const dataType = new AbiEncoder.Address(testDataItem);
+ // Construct args to be encoded
+ const args = 'e4';
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw(`Invalid address: '${args}'`);
+ });
+ it('Invalid Address - input is not 20 bytes', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Address', type: 'address' };
+ const dataType = new AbiEncoder.Address(testDataItem);
+ // Construct args to be encoded
+ const args = '0xe4';
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw(`Invalid address: '${args}'`);
+ });
+ });
+
+ describe('Bool', () => {
+ it('True', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Boolean', type: 'bool' };
+ const dataType = new AbiEncoder.Bool(testDataItem);
+ // Construct args to be encoded
+ const args = true;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x0000000000000000000000000000000000000000000000000000000000000001';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('False', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Boolean', type: 'bool' };
+ const dataType = new AbiEncoder.Bool(testDataItem);
+ // Construct args to be encoded
+ const args = false;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x0000000000000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ });
+
+ describe('Integer', () => {
+ /* tslint:disable custom-no-magic-numbers */
+ const max256BitInteger = new BigNumber(2).pow(255).minus(1);
+ const min256BitInteger = new BigNumber(2).pow(255).times(-1);
+ const max32BitInteger = new BigNumber(2).pow(31).minus(1);
+ const min32BitInteger = new BigNumber(2).pow(31).times(-1);
+ /* tslint:enable custom-no-magic-numbers */
+
+ it('Int256 - Positive Base Case', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (256)', type: 'int' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = new BigNumber(1);
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x0000000000000000000000000000000000000000000000000000000000000001';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Int256 - Negative Base Case', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (256)', type: 'int' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = new BigNumber(-1);
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Int256 - Positive Value', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (256)', type: 'int' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = max256BitInteger;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Int256 - Negative Value', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (256)', type: 'int' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = min256BitInteger;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = `0x8000000000000000000000000000000000000000000000000000000000000000`;
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Int256 - Value too large', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (256)', type: 'int' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = max256BitInteger.plus(1);
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw();
+ });
+ it('Int256 - Value too small', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (256)', type: 'int' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = min256BitInteger.minus(1);
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw();
+ });
+ it('Int32 - Positive Base Case', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (32)', type: 'int32' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = new BigNumber(1);
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x0000000000000000000000000000000000000000000000000000000000000001';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Int32 - Negative Base Case', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (32)', type: 'int32' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = new BigNumber(-1);
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Int32 - Positive Value', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (32)', type: 'int32' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = max32BitInteger;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x000000000000000000000000000000000000000000000000000000007fffffff';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Int32 - Negative Value', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (32)', type: 'int32' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = min32BitInteger;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = `0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000000`;
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Int32 - Value too large', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (32)', type: 'int32' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = max32BitInteger.plus(1);
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw();
+ });
+ it('Int32 - Value too small', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Integer (32)', type: 'int32' };
+ const dataType = new AbiEncoder.Int(testDataItem);
+ // Construct args to be encoded
+ const args = min32BitInteger.minus(1);
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw();
+ });
+ });
+
+ describe('Unsigned Integer', () => {
+ /* tslint:disable custom-no-magic-numbers */
+ const max256BitUnsignedInteger = new BigNumber(2).pow(256).minus(1);
+ const min256BitUnsignedInteger = new BigNumber(0);
+ const max32BitUnsignedInteger = new BigNumber(2).pow(32).minus(1);
+ const min32BitUnsignedInteger = new BigNumber(0);
+ /* tslint:enable custom-no-magic-numbers */
+
+ it('UInt256 - Positive Base Case', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Unsigned Integer (256)', type: 'uint' };
+ const dataType = new AbiEncoder.UInt(testDataItem);
+ // Construct args to be encoded
+ const args = new BigNumber(1);
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x0000000000000000000000000000000000000000000000000000000000000001';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('UInt256 - Positive Value', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Unsigned Integer (256)', type: 'uint' };
+ const dataType = new AbiEncoder.UInt(testDataItem);
+ // Construct args to be encoded
+ const args = max256BitUnsignedInteger;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('UInt256 - Zero Value', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Unsigned Integer (256)', type: 'uint' };
+ const dataType = new AbiEncoder.UInt(testDataItem);
+ // Construct args to be encoded
+ const args = min256BitUnsignedInteger;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = `0x0000000000000000000000000000000000000000000000000000000000000000`;
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('UInt256 - Value too large', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Unsigned Integer (256)', type: 'uint' };
+ const dataType = new AbiEncoder.UInt(testDataItem);
+ // Construct args to be encoded
+ const args = max256BitUnsignedInteger.plus(1);
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw();
+ });
+ it('UInt256 - Value too small', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Unsigned Integer (256)', type: 'uint' };
+ const dataType = new AbiEncoder.UInt(testDataItem);
+ // Construct args to be encoded
+ const args = min256BitUnsignedInteger.minus(1);
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw();
+ });
+ it('UInt32 - Positive Base Case', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Unsigned Integer (32)', type: 'uint32' };
+ const dataType = new AbiEncoder.UInt(testDataItem);
+ // Construct args to be encoded
+ const args = new BigNumber(1);
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x0000000000000000000000000000000000000000000000000000000000000001';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('UInt32 - Positive Value', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Unsigned Integer (32)', type: 'uint32' };
+ const dataType = new AbiEncoder.UInt(testDataItem);
+ // Construct args to be encoded
+ const args = max32BitUnsignedInteger;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x00000000000000000000000000000000000000000000000000000000ffffffff';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('UInt32 - Zero Value', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Unsigned Integer (32)', type: 'uint32' };
+ const dataType = new AbiEncoder.UInt(testDataItem);
+ // Construct args to be encoded
+ const args = min32BitUnsignedInteger;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = `0x0000000000000000000000000000000000000000000000000000000000000000`;
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('UInt32 - Value too large', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Unsigned Integer (32)', type: 'uint32' };
+ const dataType = new AbiEncoder.UInt(testDataItem);
+ // Construct args to be encoded
+ const args = max32BitUnsignedInteger.plus(1);
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw();
+ });
+ it('UInt32 - Value too small', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Unsigned Integer (32)', type: 'uint32' };
+ const dataType = new AbiEncoder.UInt(testDataItem);
+ // Construct args to be encoded
+ const args = min32BitUnsignedInteger.minus(1);
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw();
+ });
+ });
+
+ describe('Static Bytes', () => {
+ it('Single Byte (byte)', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Byte', type: 'byte' };
+ const dataType = new AbiEncoder.StaticBytes(testDataItem);
+ // Construct args to be encoded
+ const args = '0x05';
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x0500000000000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Single Byte (bytes1)', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes1', type: 'bytes1' };
+ const dataType = new AbiEncoder.StaticBytes(testDataItem);
+ // Construct args to be encoded
+ const args = '0x05';
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x0500000000000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('4 Bytes (bytes4)', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes4', type: 'bytes4' };
+ const dataType = new AbiEncoder.StaticBytes(testDataItem);
+ // Construct args to be encoded
+ const args = '0x00010203';
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x0001020300000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('4 Bytes (bytes4); Encoder must pad input', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes4', type: 'bytes4' };
+ const dataType = new AbiEncoder.StaticBytes(testDataItem);
+ // Construct args to be encoded
+ // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes.
+ const args = '0x1a18';
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x1a18000000000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ const paddedArgs = '0x1a180000';
+ expect(decodedArgs).to.be.deep.equal(paddedArgs);
+ });
+ it('32 Bytes (bytes32)', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes32', type: 'bytes32' };
+ const dataType = new AbiEncoder.StaticBytes(testDataItem);
+ // Construct args to be encoded
+ const args = '0x0001020304050607080911121314151617181920212223242526272829303132';
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x0001020304050607080911121314151617181920212223242526272829303132';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('32 Bytes (bytes32); Encoder must pad input', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes32', type: 'bytes32' };
+ const dataType = new AbiEncoder.StaticBytes(testDataItem);
+ // Construct args to be encoded
+ // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes.
+ const args = '0x1a18bf61';
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs = '0x1a18bf6100000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ const paddedArgs = '0x1a18bf6100000000000000000000000000000000000000000000000000000000';
+ expect(decodedArgs).to.be.deep.equal(paddedArgs);
+ });
+ it('Should throw when pass in too many bytes (bytes4)', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes4', type: 'bytes4' };
+ const dataType = new AbiEncoder.StaticBytes(testDataItem);
+ // Construct args to be encoded
+ const args = '0x0102030405';
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw(
+ 'Tried to assign 0x0102030405 (5 bytes), which exceeds max bytes that can be stored in a bytes4',
+ );
+ });
+ it('Should throw when pass in too many bytes (bytes32)', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes32', type: 'bytes32' };
+ const dataType = new AbiEncoder.StaticBytes(testDataItem);
+ // Construct args to be encoded
+ const args = '0x010203040506070809101112131415161718192021222324252627282930313233';
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw(
+ 'Tried to assign 0x010203040506070809101112131415161718192021222324252627282930313233 (33 bytes), which exceeds max bytes that can be stored in a bytes32',
+ );
+ });
+ it('Should throw when pass in bad hex (no 0x prefix)', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes32', type: 'bytes32' };
+ const dataType = new AbiEncoder.StaticBytes(testDataItem);
+ // Construct args to be encoded
+ const args = '0102030405060708091011121314151617181920212223242526272829303132';
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw("Tried to encode non-hex value. Value must inlcude '0x' prefix.");
+ });
+ it('Should throw when pass in bad hex (include a half-byte)', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes32', type: 'bytes32' };
+ const dataType = new AbiEncoder.StaticBytes(testDataItem);
+ // Construct args to be encoded
+ const args = '0x010';
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw('Tried to assign 0x010, which is contains a half-byte. Use full bytes only.');
+ });
+ });
+
+ describe('Dynamic Bytes', () => {
+ it('Fits into one EVM word', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Dynamic Bytes', type: 'bytes' };
+ const dataType = new AbiEncoder.DynamicBytes(testDataItem);
+ // Construct args to be encoded
+ // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes.
+ const args = '0x1a18bf61';
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x00000000000000000000000000000000000000000000000000000000000000041a18bf6100000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Spans multiple EVM words', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Dynamic Bytes', type: 'bytes' };
+ const dataType = new AbiEncoder.DynamicBytes(testDataItem);
+ // Construct args to be encoded
+ // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes.
+ const bytesLength = 40;
+ const args = `0x${'61'.repeat(bytesLength)}`;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x000000000000000000000000000000000000000000000000000000000000002861616161616161616161616161616161616161616161616161616161616161616161616161616161000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Input as Buffer', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Dynamic Bytes', type: 'bytes' };
+ const dataType = new AbiEncoder.DynamicBytes(testDataItem);
+ // Construct args to be encoded
+ // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes.
+ const args = '0x1a18bf61';
+ const argsAsBuffer = ethUtil.toBuffer(args);
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(argsAsBuffer);
+ const expectedEncodedArgs =
+ '0x00000000000000000000000000000000000000000000000000000000000000041a18bf6100000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Should throw when pass in bad hex (no 0x prefix)', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes', type: 'bytes' };
+ const dataType = new AbiEncoder.DynamicBytes(testDataItem);
+ // Construct args to be encoded
+ const args = '01';
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw("Tried to encode non-hex value. Value must inlcude '0x' prefix.");
+ });
+ it('Should throw when pass in bad hex (include a half-byte)', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'Static Bytes', type: 'bytes' };
+ const dataType = new AbiEncoder.DynamicBytes(testDataItem);
+ // Construct args to be encoded
+ const args = '0x010';
+ // Encode Args and validate result
+ expect(() => {
+ dataType.encode(args, encodingRules);
+ }).to.throw('Tried to assign 0x010, which is contains a half-byte. Use full bytes only.');
+ });
+ });
+
+ describe('String', () => {
+ it('Fits into one EVM word', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'String', type: 'string' };
+ const dataType = new AbiEncoder.String(testDataItem);
+ // Construct args to be encoded
+ // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes.
+ const args = 'five';
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x00000000000000000000000000000000000000000000000000000000000000046669766500000000000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Spans multiple EVM words', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'String', type: 'string' };
+ const dataType = new AbiEncoder.String(testDataItem);
+ // Construct args to be encoded
+ // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes.
+ const bytesLength = 40;
+ const args = 'a'.repeat(bytesLength);
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x000000000000000000000000000000000000000000000000000000000000002861616161616161616161616161616161616161616161616161616161616161616161616161616161000000000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('String that begins with 0x prefix', async () => {
+ // Create DataType object
+ const testDataItem = { name: 'String', type: 'string' };
+ const dataType = new AbiEncoder.String(testDataItem);
+ // Construct args to be encoded
+ // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes.
+ const strLength = 40;
+ const args = `0x${'a'.repeat(strLength)}`;
+ // Encode Args and validate result
+ const encodedArgs = dataType.encode(args, encodingRules);
+ const expectedEncodedArgs =
+ '0x000000000000000000000000000000000000000000000000000000000000002a30786161616161616161616161616161616161616161616161616161616161616161616161616161616100000000000000000000000000000000000000000000';
+ expect(encodedArgs).to.be.equal(expectedEncodedArgs);
+ // Decode Encoded Args and validate result
+ const decodedArgs = dataType.decode(encodedArgs);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ });
+});
diff --git a/packages/utils/test/abi_encoder/methods_test.ts b/packages/utils/test/abi_encoder/methods_test.ts
new file mode 100644
index 000000000..a0525967e
--- /dev/null
+++ b/packages/utils/test/abi_encoder/methods_test.ts
@@ -0,0 +1,366 @@
+import * as chai from 'chai';
+import 'mocha';
+
+import { AbiEncoder, BigNumber } from '../../src/';
+import { chaiSetup } from '../utils/chai_setup';
+
+import * as AbiSamples from './abi_samples/method_abis';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+describe('ABI Encoder: Method Encoding / Decoding', () => {
+ const encodingRules: AbiEncoder.EncodingRules = { shouldOptimize: false }; // optimizer is tested separately.
+ it('Types with default widths', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.typesWithDefaultWidthsAbi);
+ const args = [new BigNumber(1), new BigNumber(-1), '0x56', [new BigNumber(1)], [new BigNumber(-1)], ['0x56']];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x09f2b0c30000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff560000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000015600000000000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Array of Static Tuples (Array has defined length)', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.arrayOfStaticTuplesWithDefinedLengthAbi);
+ let value = 0;
+ const arrayOfTuples = [];
+ const arrayOfTuplesLength = 8;
+ for (let i = 0; i < arrayOfTuplesLength; ++i) {
+ arrayOfTuples.push([new BigNumber(++value), new BigNumber(++value)]);
+ }
+ const args = [arrayOfTuples];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x9eb20969000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000010';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Array of Static Tuples (Array has dynamic length)', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.arrayOfStaticTuplesWithDynamicLengthAbi);
+ let value = 0;
+ const arrayOfTuples = [];
+ const arrayOfTuplesLength = 8;
+ for (let i = 0; i < arrayOfTuplesLength; ++i) {
+ arrayOfTuples.push([new BigNumber(++value), new BigNumber(++value)]);
+ }
+ const args = [arrayOfTuples];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x63275d6e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000010';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Array of Dynamic Tuples (Array has defined length)', async () => {
+ // Generate Calldata
+ const method = new AbiEncoder.Method(AbiSamples.arrayOfDynamicTuplesWithDefinedLengthAbi);
+ let value = 0;
+ const arrayOfTuples = [];
+ const arrayOfTuplesLength = 8;
+ for (let i = 0; i < arrayOfTuplesLength; ++i) {
+ arrayOfTuples.push([new BigNumber(++value), new BigNumber(++value).toString()]);
+ }
+ const args = [arrayOfTuples];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0xdeedb00f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000013400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023136000000000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Array of Dynamic Tuples (Array has dynamic length)', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.arrayOfDynamicTuplesWithUndefinedLengthAbi);
+ let value = 0;
+ const arrayOfTuples = [];
+ const arrayOfTuplesLength = 8;
+ for (let i = 0; i < arrayOfTuplesLength; ++i) {
+ arrayOfTuples.push([new BigNumber(++value), new BigNumber(++value).toString()]);
+ }
+ const args = [arrayOfTuples];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x60c847fb000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000013400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023136000000000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Multidimensional Arrays / Static Members', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.multiDimensionalArraysStaticTypeAbi);
+ // Eight 3-dimensional arrays of uint8[2][2][2]
+ let value = 0;
+ const args = [];
+ const argsLength = 8;
+ for (let i = 0; i < argsLength; ++i) {
+ args.push([
+ [[new BigNumber(++value), new BigNumber(++value)], [new BigNumber(++value), new BigNumber(++value)]],
+ [[new BigNumber(++value), new BigNumber(++value)], [new BigNumber(++value), new BigNumber(++value)]],
+ ]);
+ }
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0xc2f47d6f00000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000e600000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000210000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000370000000000000000000000000000000000000000000000000000000000000038';
+ expect(calldata).to.be.equal(expectedCalldata);
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Multidimensional Arrays / Dynamic Members', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.multiDimensionalArraysDynamicTypeAbi);
+ // Eight 3-dimensional arrays of string[2][2][2]
+ let value = 0;
+ const args = [];
+ const argsLength = 4;
+ for (let i = 0; i < argsLength; ++i) {
+ args.push([
+ [
+ [new BigNumber(++value).toString(), new BigNumber(++value).toString()],
+ [new BigNumber(++value).toString(), new BigNumber(++value).toString()],
+ ],
+ [
+ [new BigNumber(++value).toString(), new BigNumber(++value).toString()],
+ [new BigNumber(++value).toString(), new BigNumber(++value).toString()],
+ ],
+ ]);
+ }
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x81534ebd0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000013300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000137000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000139000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002313000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000023131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000231320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002313300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000231350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002313600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000231370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002313800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000023139000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000232300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000023231000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000232320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002323300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000232350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002323600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000232370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002323800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002323900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002333100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023332000000000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Fixed Length Array / Dynamic Members', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.staticArrayDynamicMembersAbi);
+ const args = [['Brave', 'New', 'World']];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x243a6e6e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000005427261766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e657700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Fixed Length Array / Dynamic Members', async () => {
+ // Generaet calldata
+ const method = new AbiEncoder.Method(AbiSamples.staticArrayDynamicMembersAbi);
+ const args = [['Brave', 'New', 'World']];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x243a6e6e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000005427261766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e657700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Unfixed Length Array / Dynamic Members ABI', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.dynamicArrayDynamicMembersAbi);
+ const args = [['Brave', 'New', 'World']];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x13e751a900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000005427261766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e657700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Unfixed Length Array / Static Members ABI', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.dynamicArrayStaticMembersAbi);
+ const args = [[new BigNumber(127), new BigNumber(14), new BigNumber(54)]];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x4fc8a83300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000036';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Fixed Length Array / Static Members ABI', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.staticArrayAbi);
+ const args = [[new BigNumber(127), new BigNumber(14), new BigNumber(54)]];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0xf68ade72000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000036';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Array ABI', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(AbiSamples.stringAbi);
+ const args = [['five', 'six', 'seven']];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x13e751a900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000046669766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000373697800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005736576656e000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Static Tuple', async () => {
+ // Generate calldata
+ // This is dynamic because it has dynamic members
+ const method = new AbiEncoder.Method(AbiSamples.staticTupleAbi);
+ const args = [[new BigNumber(5), new BigNumber(10), new BigNumber(15), false]];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0xa9125e150000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Dynamic Tuple (Array input)', async () => {
+ // Generate calldata
+ // This is dynamic because it has dynamic members
+ const method = new AbiEncoder.Method(AbiSamples.dynamicTupleAbi);
+ const args = [[new BigNumber(5), 'five']];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x5b998f3500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000046669766500000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Dynamic Tuple (Object input)', async () => {
+ // Generate Calldata
+ // This is dynamic because it has dynamic members
+ const method = new AbiEncoder.Method(AbiSamples.dynamicTupleAbi);
+ const args = [[new BigNumber(5), 'five']];
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x5b998f3500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000046669766500000000000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Large, Flat ABI', async () => {
+ // Construct calldata
+ const method = new AbiEncoder.Method(AbiSamples.largeFlatAbi);
+ const args = [
+ new BigNumber(256745454),
+ new BigNumber(-256745454),
+ new BigNumber(434244),
+ '0x43',
+ '0x0001020304050607080911121314151617181920212223242526272829303132',
+ '0x0001020304050607080911121314151617181920212223242526272829303132080911121314151617181920212223242526272829303132',
+ 'Little peter piper piped a piping pepper pot',
+ '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ true,
+ ];
+ // Validate calldata
+ const calldata = method.encode(args, encodingRules);
+ const expectedCalldata =
+ '0x312d4d42000000000000000000000000000000000000000000000000000000000f4d9feefffffffffffffffffffffffffffffffffffffffffffffffffffffffff0b26012000000000000000000000000000000000000000000000000000000000006a0444300000000000000000000000000000000000000000000000000000000000000000102030405060708091112131415161718192021222324252627282930313200000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000180000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f4980000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000003800010203040506070809111213141516171819202122232425262728293031320809111213141516171819202122232425262728293031320000000000000000000000000000000000000000000000000000000000000000000000000000002c4c6974746c65207065746572207069706572207069706564206120706970696e672070657070657220706f740000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata);
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+ it('Large, Nested ABI', async () => {
+ // Construct Calldata
+ const method = new AbiEncoder.Method(AbiSamples.largeNestedAbi);
+ const someStaticArray = [new BigNumber(127), new BigNumber(14), new BigNumber(54)];
+ const someStaticArrayWithDynamicMembers = [
+ 'the little piping piper piped a piping pipper papper',
+ 'the kid knows how to write poems, what can I say -- I guess theres a lot I could say to try to fill this line with a lot of text.',
+ ];
+ const someDynamicArrayWithDynamicMembers = [
+ '0x38745637834987324827439287423897238947239847',
+ '0x7283472398237423984723984729847248927498748974284728947239487498749847874329423743492347329847239842374892374892374892347238947289478947489374289472894738942749823743298742389472389473289472389437249823749823742893472398',
+ '0x283473298473248923749238742398742398472894729843278942374982374892374892743982',
+ ];
+ const some2DArray = [
+ [
+ 'some string',
+ 'some another string',
+ 'there are just too many stringsup in',
+ 'here',
+ 'yall ghonna make me lose my mind',
+ ],
+ [
+ 'the little piping piper piped a piping pipper papper',
+ 'the kid knows how to write poems, what can I say -- I guess theres a lot I could say to try to fill this line with a lot of text.',
+ ],
+ [],
+ ];
+ const someTuple = {
+ someUint32: new BigNumber(4037824789),
+ someStr:
+ 'the kid knows how to write poems, what can I say -- I guess theres a lot I could say to try to fill this line with a lot of text.',
+ };
+ const someTupleWithDynamicTypes = {
+ someUint: new BigNumber(4024789),
+ someStr: 'akdhjasjkdhasjkldshdjahdkjsahdajksdhsajkdhsajkdhadjkashdjksadhajkdhsajkdhsadjk',
+ someBytes: '0x29384723894723843743289742389472398473289472348927489274894738427428947389facdea',
+ someAddress: '0xe41d2489571d322189246dafa5ebde1f4699f498',
+ };
+ const someTupleWithDynamicTypes2 = {
+ someUint: new BigNumber(9024789),
+ someStr: 'ksdhsajkdhsajkdhadjkashdjksadhajkdhsajkdhsadjkakdhjasjkdhasjkldshdjahdkjsahdaj',
+ someBytes: '0x29384723894398473289472348927489272384374328974238947274894738427428947389facde1',
+ someAddress: '0x746dafa5ebde1f4699f4981d3221892e41d24895',
+ };
+ const someTupleWithDynamicTypes3 = {
+ someUint: new BigNumber(1024789),
+ someStr: 'sdhsajkdhsajkdhadjkashdjakdhjasjkdhasjkldshdjahdkjsahdajkksadhajkdhsajkdhsadjk',
+ someBytes: '0x38947238437432829384729742389472398473289472348927489274894738427428947389facdef',
+ someAddress: '0x89571d322189e415ebde1f4699f498d24246dafa',
+ };
+ const someArrayOfTuplesWithDynamicTypes = [someTupleWithDynamicTypes2, someTupleWithDynamicTypes3];
+ const args = {
+ someStaticArray,
+ someStaticArrayWithDynamicMembers,
+ someDynamicArrayWithDynamicMembers,
+ some2DArray,
+ someTuple,
+ someTupleWithDynamicTypes,
+ someArrayOfTuplesWithDynamicTypes,
+ };
+ const calldata = method.encode(args, encodingRules);
+ // Validate calldata
+ const expectedCalldata =
+ '0x4b49031c000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000036000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000440000000000000000000000000000000000000000000000000000000000000088000000000000000000000000000000000000000000000000000000000000009800000000000000000000000000000000000000000000000000000000000000ae0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000034746865206c6974746c6520706970696e67207069706572207069706564206120706970696e6720706970706572207061707065720000000000000000000000000000000000000000000000000000000000000000000000000000000000000081746865206b6964206b6e6f777320686f7720746f20777269746520706f656d732c20776861742063616e204920736179202d2d2049206775657373207468657265732061206c6f74204920636f756c642073617920746f2074727920746f2066696c6c2074686973206c696e6520776974682061206c6f74206f6620746578742e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000163874563783498732482743928742389723894723984700000000000000000000000000000000000000000000000000000000000000000000000000000000006e72834723982374239847239847298472489274987489742847289472394874987498478743294237434923473298472398423748923748923748923472389472894789474893742894728947389427498237432987423894723894732894723894372498237498237428934723980000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000027283473298473248923749238742398742398472894729843278942374982374892374892743982000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000000b736f6d6520737472696e670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013736f6d6520616e6f7468657220737472696e67000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024746865726520617265206a75737420746f6f206d616e7920737472696e6773757020696e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000046865726500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002079616c6c2067686f6e6e61206d616b65206d65206c6f7365206d79206d696e640000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000034746865206c6974746c6520706970696e67207069706572207069706564206120706970696e6720706970706572207061707065720000000000000000000000000000000000000000000000000000000000000000000000000000000000000081746865206b6964206b6e6f777320686f7720746f20777269746520706f656d732c20776861742063616e204920736179202d2d2049206775657373207468657265732061206c6f74204920636f756c642073617920746f2074727920746f2066696c6c2074686973206c696e6520776974682061206c6f74206f6620746578742e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f0ac511500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000081746865206b6964206b6e6f777320686f7720746f20777269746520706f656d732c20776861742063616e204920736179202d2d2049206775657373207468657265732061206c6f74204920636f756c642073617920746f2074727920746f2066696c6c2074686973206c696e6520776974682061206c6f74206f6620746578742e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003d69d500000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000100000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498000000000000000000000000000000000000000000000000000000000000004e616b64686a61736a6b646861736a6b6c647368646a6168646b6a73616864616a6b73646873616a6b646873616a6b646861646a6b617368646a6b73616468616a6b646873616a6b64687361646a6b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002829384723894723843743289742389472398473289472348927489274894738427428947389facdea0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000089b51500000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000100000000000000000000000000746dafa5ebde1f4699f4981d3221892e41d24895000000000000000000000000000000000000000000000000000000000000004e6b73646873616a6b646873616a6b646861646a6b617368646a6b73616468616a6b646873616a6b64687361646a6b616b64686a61736a6b646861736a6b6c647368646a6168646b6a73616864616a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002829384723894398473289472348927489272384374328974238947274894738427428947389facde100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fa3150000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000010000000000000000000000000089571d322189e415ebde1f4699f498d24246dafa000000000000000000000000000000000000000000000000000000000000004e73646873616a6b646873616a6b646861646a6b617368646a616b64686a61736a6b646861736a6b6c647368646a6168646b6a73616864616a6b6b73616468616a6b646873616a6b64687361646a6b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002838947238437432829384729742389472398473289472348927489274894738427428947389facdef000000000000000000000000000000000000000000000000';
+ expect(calldata).to.be.equal(expectedCalldata);
+ // Validate decoding
+ const decodedValue = method.decode(calldata, { shouldConvertStructsToObjects: true });
+ expect(decodedValue).to.be.deep.equal(args);
+ });
+});
diff --git a/packages/utils/test/abi_encoder/optimizer_test.ts b/packages/utils/test/abi_encoder/optimizer_test.ts
new file mode 100644
index 000000000..ee0654ec3
--- /dev/null
+++ b/packages/utils/test/abi_encoder/optimizer_test.ts
@@ -0,0 +1,262 @@
+import * as chai from 'chai';
+import 'mocha';
+
+import { AbiEncoder, BigNumber } from '../../src/';
+import { chaiSetup } from '../utils/chai_setup';
+
+import * as OptimizedAbis from './abi_samples/optimizer_abis';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
+ const encodingRules: AbiEncoder.EncodingRules = { shouldOptimize: true };
+ it('Duplicate Dynamic Arrays with Static Elements', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateDynamicArraysWithStaticElements);
+ const array1 = [new BigNumber(100), new BigNumber(150)];
+ const array2 = array1;
+ const args = [array1, array2];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x7221063300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000096';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Dynamic Arrays with Dynamic Elements', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateDynamicArraysWithDynamicElements);
+ const array1 = ['Hello', 'World'];
+ const array2 = array1;
+ const args = [array1, array2];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0xbb4f12e300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Static Arrays with Static Elements (should not optimize)', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateStaticArraysWithStaticElements);
+ const array1 = [new BigNumber(100), new BigNumber(150)];
+ const array2 = array1;
+ const args = [array1, array2];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x7f8130430000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000096';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ const unoptimizedCalldata = method.encode(args);
+ expect(optimizedCalldata).to.be.equal(unoptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Static Arrays with Dynamic Elements', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateStaticArraysWithDynamicElements);
+ const array1 = ['Hello', 'World'];
+ const array2 = array1;
+ const args = [array1, array2];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x9fe31f8e0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Array Elements (should optimize)', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateArrayElements);
+ const strings = ['Hello', 'World', 'Hello', 'World'];
+ const args = [strings];
+ // Validate calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x13e751a900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Tuple Fields', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateTupleFields);
+ const tuple = ['Hello', 'Hello'];
+ const args = [tuple];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x16780a5e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Strings', async () => {
+ // Description:
+ // Two dynamic arrays with the same values.
+ // In the optimized calldata, only one set of elements should be included.
+ // Both arrays should point to this set.
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateStrings);
+ const args = ['Hello', 'Hello'];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x07370bfa00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Bytes', async () => {
+ // Description:
+ // Two dynamic arrays with the same values.
+ // In the optimized calldata, only one set of elements should be included.
+ // Both arrays should point to this set.
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateBytes);
+ const value = '0x01020304050607080910111213141516171819202122232425262728293031323334353637383940';
+ const args = [value, value];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x6045e42900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002801020304050607080910111213141516171819202122232425262728293031323334353637383940000000000000000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Tuples', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateTuples);
+ const tuple1 = ['Hello, World!', new BigNumber(424234)];
+ const tuple2 = tuple1;
+ const args = [tuple1, tuple2];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x564f826d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000006792a000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c642100000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Fields Across Two Tuples', async () => {
+ // Description:
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateTuples);
+ const tuple1 = ['Hello, World!', new BigNumber(1)];
+ const tuple2 = [tuple1[0], new BigNumber(2)];
+ const args = [tuple1, tuple2];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x564f826d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c642100000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Arrays, Nested in Separate Tuples', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateArraysNestedInTuples);
+ const array = [new BigNumber(100), new BigNumber(150), new BigNumber(200)];
+ const tuple1 = [array];
+ const tuple2 = [array, 'extra argument to prevent exactly matching the tuples'];
+ const args = [tuple1, tuple2];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x18970a9e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000035657874726120617267756d656e7420746f2070726576656e742065786163746c79206d61746368696e6720746865207475706c65730000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Tuples, Nested in Separate Tuples', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateTuplesNestedInTuples);
+ const nestedTuple = ['Hello, World!'];
+ const tuple1 = [nestedTuple];
+ const tuple2 = [nestedTuple, 'extra argument to prevent exactly matching the tuples'];
+ const args = [tuple1, tuple2];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x0b4d2e6a000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c6421000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035657874726120617267756d656e7420746f2070726576656e742065786163746c79206d61746368696e6720746865207475706c65730000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Two-Dimensional Arrays', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateTwoDimensionalArrays);
+ const twoDimArray1 = [['Hello', 'World'], ['Foo', 'Bar', 'Zaa']];
+ const twoDimArray2 = twoDimArray1;
+ const args = [twoDimArray1, twoDimArray2];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, { shouldOptimize: false });
+ const expectedOptimizedCalldata =
+ '0x0d28c4f9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000003466f6f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003426172000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035a61610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000003466f6f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003426172000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035a61610000000000000000000000000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Duplicate Array, Nested within Separate Two-Dimensional Arrays', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.duplicateTwoDimensionalArrays);
+ const twoDimArray1 = [['Hello', 'World'], ['Foo']];
+ const twoDimArray2 = [['Hello', 'World'], ['Bar']];
+ const args = [twoDimArray1, twoDimArray2];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x0d28c4f900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003466f6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000034261720000000000000000000000000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Array Elements Duplicated as Tuple Fields', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.arrayElementsDuplicatedAsTupleFields);
+ const array = [new BigNumber(100), new BigNumber(150), new BigNumber(200), new BigNumber(225)];
+ const tuple = [[array[0]], [array[1]], [array[2]], [array[3]]];
+ const args = [array, tuple];
+ // Validata calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0x5b5c78fd0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000e1';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+ it('Array Elements Duplicated as Separate Parameter', async () => {
+ // Generate calldata
+ const method = new AbiEncoder.Method(OptimizedAbis.arrayElementsDuplicatedAsSeparateParameter);
+ const array = ['Hello', 'Hello', 'Hello', 'World'];
+ const str = 'Hello';
+ const args = [array, str];
+ // Validate calldata
+ const optimizedCalldata = method.encode(args, encodingRules);
+ const expectedOptimizedCalldata =
+ '0xe0e0d34900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000';
+ expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
+ // Validate decoding
+ const decodedArgs = method.decode(optimizedCalldata);
+ expect(decodedArgs).to.be.deep.equal(args);
+ });
+});
diff --git a/packages/utils/test/abi_encoder/return_values_test.ts b/packages/utils/test/abi_encoder/return_values_test.ts
new file mode 100644
index 000000000..104c7f5db
--- /dev/null
+++ b/packages/utils/test/abi_encoder/return_values_test.ts
@@ -0,0 +1,67 @@
+import * as chai from 'chai';
+import 'mocha';
+
+import { AbiEncoder } from '../../src/';
+import { chaiSetup } from '../utils/chai_setup';
+
+import * as ReturnValueAbis from './abi_samples/return_value_abis';
+
+chaiSetup.configure();
+const expect = chai.expect;
+
+describe('ABI Encoder: Return Value Encoding/Decoding', () => {
+ const encodingRules: AbiEncoder.EncodingRules = { shouldOptimize: false }; // optimizer is tested separately.
+ it('No Return Value', async () => {
+ // Decode return value
+ const method = new AbiEncoder.Method(ReturnValueAbis.noReturnValues);
+ const returnValue = '0x';
+ const decodedReturnValue = method.decodeReturnValues(returnValue);
+ const expectedDecodedReturnValue: any[] = [];
+ expect(decodedReturnValue).to.be.deep.equal(expectedDecodedReturnValue);
+ });
+ it('Single static return value', async () => {
+ // Generate Return Value
+ const method = new AbiEncoder.Method(ReturnValueAbis.singleStaticReturnValue);
+ const returnValue = ['0x01020304'];
+ const encodedReturnValue = method.encodeReturnValues(returnValue, encodingRules);
+ const decodedReturnValue = method.decodeReturnValues(encodedReturnValue);
+ // Validate decoded return value
+ expect(decodedReturnValue).to.be.deep.equal(returnValue);
+ });
+ it('Multiple static return values', async () => {
+ // Generate Return Value
+ const method = new AbiEncoder.Method(ReturnValueAbis.multipleStaticReturnValues);
+ const returnValue = ['0x01020304', '0x05060708'];
+ const encodedReturnValue = method.encodeReturnValues(returnValue, encodingRules);
+ const decodedReturnValue = method.decodeReturnValues(encodedReturnValue);
+ // Validate decoded return value
+ expect(decodedReturnValue).to.be.deep.equal(returnValue);
+ });
+ it('Single dynamic return value', async () => {
+ // Generate Return Value
+ const method = new AbiEncoder.Method(ReturnValueAbis.singleDynamicReturnValue);
+ const returnValue = ['0x01020304'];
+ const encodedReturnValue = method.encodeReturnValues(returnValue, encodingRules);
+ const decodedReturnValue = method.decodeReturnValues(encodedReturnValue);
+ // Validate decoded return value
+ expect(decodedReturnValue).to.be.deep.equal(returnValue);
+ });
+ it('Multiple dynamic return values', async () => {
+ // Generate Return Value
+ const method = new AbiEncoder.Method(ReturnValueAbis.multipleDynamicReturnValues);
+ const returnValue = ['0x01020304', '0x05060708'];
+ const encodedReturnValue = method.encodeReturnValues(returnValue, encodingRules);
+ const decodedReturnValue = method.decodeReturnValues(encodedReturnValue);
+ // Validate decoded return value
+ expect(decodedReturnValue).to.be.deep.equal(returnValue);
+ });
+ it('Mixed static/dynamic return values', async () => {
+ // Generate Return Value
+ const method = new AbiEncoder.Method(ReturnValueAbis.mixedStaticAndDynamicReturnValues);
+ const returnValue = ['0x01020304', '0x05060708'];
+ const encodedReturnValue = method.encodeReturnValues(returnValue, encodingRules);
+ const decodedReturnValue = method.decodeReturnValues(encodedReturnValue);
+ // Validate decoded return value
+ expect(decodedReturnValue).to.be.deep.equal(returnValue);
+ });
+});
diff --git a/packages/utils/test/utils/chai_setup.ts b/packages/utils/test/utils/chai_setup.ts
new file mode 100644
index 000000000..1a8733093
--- /dev/null
+++ b/packages/utils/test/utils/chai_setup.ts
@@ -0,0 +1,13 @@
+import * as chai from 'chai';
+import chaiAsPromised = require('chai-as-promised');
+import ChaiBigNumber = require('chai-bignumber');
+import * as dirtyChai from 'dirty-chai';
+
+export const chaiSetup = {
+ configure(): void {
+ chai.config.includeStack = true;
+ chai.use(ChaiBigNumber());
+ chai.use(dirtyChai);
+ chai.use(chaiAsPromised);
+ },
+};
diff --git a/packages/web3-wrapper/CHANGELOG.json b/packages/web3-wrapper/CHANGELOG.json
index cc65c2a7d..6b76626a9 100644
--- a/packages/web3-wrapper/CHANGELOG.json
+++ b/packages/web3-wrapper/CHANGELOG.json
@@ -1,5 +1,34 @@
[
{
+ "version": "3.2.1",
+ "changes": [
+ {
+ "note": "Dependencies updated"
+ }
+ ],
+ "timestamp": 1544739608
+ },
+ {
+ "version": "3.2.0",
+ "changes": [
+ {
+ "note": "Return `value` and `gasPrice` as BigNumbers to avoid loss of precision errors",
+ "pr": 1402
+ }
+ ],
+ "timestamp": 1544570656
+ },
+ {
+ "version": "3.1.6",
+ "changes": [
+ {
+ "note": "Unmarshall mined transaction receipts",
+ "pr": 1308
+ }
+ ],
+ "timestamp": 1543401373
+ },
+ {
"version": "3.1.5",
"changes": [
{
@@ -10,7 +39,8 @@
"note": "Return `undefined` instead of `null` if transaction receipt not found",
"pr": 1291
}
- ]
+ ],
+ "timestamp": 1542821676
},
{
"timestamp": 1542208198,
diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md
index 70a00ee1e..76ca80e69 100644
--- a/packages/web3-wrapper/CHANGELOG.md
+++ b/packages/web3-wrapper/CHANGELOG.md
@@ -5,6 +5,23 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
+## v3.2.1 - _December 13, 2018_
+
+ * Dependencies updated
+
+## v3.2.0 - _December 11, 2018_
+
+ * Return `value` and `gasPrice` as BigNumbers to avoid loss of precision errors (#1402)
+
+## v3.1.6 - _November 28, 2018_
+
+ * Unmarshall mined transaction receipts (#1308)
+
+## v3.1.5 - _November 21, 2018_
+
+ * Add unmarshalling of transaction receipts (#1291)
+ * Return `undefined` instead of `null` if transaction receipt not found (#1291)
+
## v3.1.4 - _November 14, 2018_
* Dependencies updated
diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json
index 8d4d7ec35..e5af24965 100644
--- a/packages/web3-wrapper/package.json
+++ b/packages/web3-wrapper/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/web3-wrapper",
- "version": "3.1.4",
+ "version": "3.2.1",
"engines": {
"node": ">=6.12"
},
@@ -36,7 +36,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/web3-wrapper/README.md",
"devDependencies": {
- "@0x/tslint-config": "^1.0.10",
+ "@0x/tslint-config": "^2.0.0",
"@types/ganache-core": "^2.1.0",
"@types/lodash": "4.14.104",
"chai": "^4.0.1",
@@ -54,11 +54,11 @@
"typescript": "3.0.1"
},
"dependencies": {
- "@0x/assert": "^1.0.17",
- "@0x/json-schemas": "^2.1.1",
- "@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "ethereum-types": "^1.1.2",
+ "@0x/assert": "^1.0.20",
+ "@0x/json-schemas": "^2.1.4",
+ "@0x/typescript-typings": "^3.0.6",
+ "@0x/utils": "^2.0.8",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",
"lodash": "^4.17.5"
diff --git a/packages/web3-wrapper/src/marshaller.ts b/packages/web3-wrapper/src/marshaller.ts
index 7bd274c85..4230f8eab 100644
--- a/packages/web3-wrapper/src/marshaller.ts
+++ b/packages/web3-wrapper/src/marshaller.ts
@@ -120,9 +120,11 @@ export const marshaller = {
}
const txData = {
...txDataRpc,
- value: !_.isUndefined(txDataRpc.value) ? utils.convertHexToNumber(txDataRpc.value) : undefined,
+ value: !_.isUndefined(txDataRpc.value) ? utils.convertAmountToBigNumber(txDataRpc.value) : undefined,
gas: !_.isUndefined(txDataRpc.gas) ? utils.convertHexToNumber(txDataRpc.gas) : undefined,
- gasPrice: !_.isUndefined(txDataRpc.gasPrice) ? utils.convertHexToNumber(txDataRpc.gasPrice) : undefined,
+ gasPrice: !_.isUndefined(txDataRpc.gasPrice)
+ ? utils.convertAmountToBigNumber(txDataRpc.gasPrice)
+ : undefined,
nonce: !_.isUndefined(txDataRpc.nonce) ? utils.convertHexToNumber(txDataRpc.nonce) : undefined,
};
return txData;
diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts
index f1247e48a..76cae4b01 100644
--- a/packages/web3-wrapper/src/web3_wrapper.ts
+++ b/packages/web3-wrapper/src/web3_wrapper.ts
@@ -223,7 +223,10 @@ export class Web3Wrapper {
method: 'eth_getTransactionReceipt',
params: [txHash],
});
- if (!_.isNull(transactionReceiptRpc)) {
+ // HACK Parity can return a pending transaction receipt. We check for a non null
+ // block number before continuing with returning a fully realised receipt.
+ // ref: https://github.com/paritytech/parity-ethereum/issues/1180
+ if (!_.isNull(transactionReceiptRpc) && !_.isNull(transactionReceiptRpc.blockNumber)) {
transactionReceiptRpc.status = Web3Wrapper._normalizeTxReceiptStatus(transactionReceiptRpc.status);
const transactionReceipt = marshaller.unmarshalTransactionReceipt(transactionReceiptRpc);
return transactionReceipt;
@@ -577,7 +580,7 @@ export class Web3Wrapper {
}
// Immediately check if the transaction has already been mined.
let transactionReceipt = await this.getTransactionReceiptIfExistsAsync(txHash);
- if (!_.isUndefined(transactionReceipt) && !_.isNull(transactionReceipt.blockNumber)) {
+ if (!_.isUndefined(transactionReceipt)) {
const logsWithDecodedArgs = _.map(
transactionReceipt.logs,
this.abiDecoder.tryToDecodeLogOrNoop.bind(this.abiDecoder),
diff --git a/packages/website/.gitignore b/packages/website/.gitignore
new file mode 100644
index 000000000..1e8d1ceb4
--- /dev/null
+++ b/packages/website/.gitignore
@@ -0,0 +1 @@
+.awcache
diff --git a/packages/website/README.md b/packages/website/README.md
index d82d045a6..a9145cb6c 100644
--- a/packages/website/README.md
+++ b/packages/website/README.md
@@ -2,9 +2,8 @@
This repository contains our website and [0x Portal DApp][portal-url] (over-the-counter exchange), facilitating trustless over-the-counter trading of Ethereum-based tokens using 0x protocol.
-[website-url]: https://0xproject.com/
-[whitepaper-url]: https://0xproject.com/pdfs/0x_white_paper.pdf
-[portal-url]: https://0xproject.com/portal
+[website-url]: https://0x.org/
+[portal-url]: https://0x.org/portal
## Contributing
diff --git a/packages/website/less/all.less b/packages/website/less/all.less
index 3747e4860..5d1dccc98 100644
--- a/packages/website/less/all.less
+++ b/packages/website/less/all.less
@@ -75,7 +75,7 @@ code {
border: 1px solid #e3eefe;
border-radius: 4px;
font-family: 'Roboto Mono';
- background-color: #f2f6ff !important; // lightBlue
+ //background-color: #f2f6ff !important; // lightBlue
}
#wiki {
diff --git a/packages/website/less/normalize.less b/packages/website/less/normalize.less
new file mode 100644
index 000000000..c45a85f89
--- /dev/null
+++ b/packages/website/less/normalize.less
@@ -0,0 +1,349 @@
+/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
+
+/* Document
+ ========================================================================== */
+
+/**
+ * 1. Correct the line height in all browsers.
+ * 2. Prevent adjustments of font size after orientation changes in iOS.
+ */
+
+ html {
+ line-height: 1.15; /* 1 */
+ -webkit-text-size-adjust: 100%; /* 2 */
+ }
+
+ /* Sections
+ ========================================================================== */
+
+ /**
+ * Remove the margin in all browsers.
+ */
+
+ body {
+ margin: 0;
+ }
+
+ /**
+ * Render the `main` element consistently in IE.
+ */
+
+ main {
+ display: block;
+ }
+
+ /**
+ * Correct the font size and margin on `h1` elements within `section` and
+ * `article` contexts in Chrome, Firefox, and Safari.
+ */
+
+ h1 {
+ font-size: 2em;
+ margin: 0.67em 0;
+ }
+
+ /* Grouping content
+ ========================================================================== */
+
+ /**
+ * 1. Add the correct box sizing in Firefox.
+ * 2. Show the overflow in Edge and IE.
+ */
+
+ hr {
+ box-sizing: content-box; /* 1 */
+ height: 0; /* 1 */
+ overflow: visible; /* 2 */
+ }
+
+ /**
+ * 1. Correct the inheritance and scaling of font size in all browsers.
+ * 2. Correct the odd `em` font sizing in all browsers.
+ */
+
+ pre {
+ font-family: monospace, monospace; /* 1 */
+ font-size: 1em; /* 2 */
+ }
+
+ /* Text-level semantics
+ ========================================================================== */
+
+ /**
+ * Remove the gray background on active links in IE 10.
+ */
+
+ a {
+ background-color: transparent;
+ }
+
+ /**
+ * 1. Remove the bottom border in Chrome 57-
+ * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
+ */
+
+ abbr[title] {
+ border-bottom: none; /* 1 */
+ text-decoration: underline; /* 2 */
+ text-decoration: underline dotted; /* 2 */
+ }
+
+ /**
+ * Add the correct font weight in Chrome, Edge, and Safari.
+ */
+
+ b,
+ strong {
+ font-weight: bolder;
+ }
+
+ /**
+ * 1. Correct the inheritance and scaling of font size in all browsers.
+ * 2. Correct the odd `em` font sizing in all browsers.
+ */
+
+ code,
+ kbd,
+ samp {
+ font-family: monospace, monospace; /* 1 */
+ font-size: 1em; /* 2 */
+ }
+
+ /**
+ * Add the correct font size in all browsers.
+ */
+
+ small {
+ font-size: 80%;
+ }
+
+ /**
+ * Prevent `sub` and `sup` elements from affecting the line height in
+ * all browsers.
+ */
+
+ sub,
+ sup {
+ font-size: 75%;
+ line-height: 0;
+ position: relative;
+ vertical-align: baseline;
+ }
+
+ sub {
+ bottom: -0.25em;
+ }
+
+ sup {
+ top: -0.5em;
+ }
+
+ /* Embedded content
+ ========================================================================== */
+
+ /**
+ * Remove the border on images inside links in IE 10.
+ */
+
+ img {
+ border-style: none;
+ }
+
+ /* Forms
+ ========================================================================== */
+
+ /**
+ * 1. Change the font styles in all browsers.
+ * 2. Remove the margin in Firefox and Safari.
+ */
+
+ button,
+ input,
+ optgroup,
+ select,
+ textarea {
+ font-family: inherit; /* 1 */
+ font-size: 100%; /* 1 */
+ line-height: 1.15; /* 1 */
+ margin: 0; /* 2 */
+ }
+
+ /**
+ * Show the overflow in IE.
+ * 1. Show the overflow in Edge.
+ */
+
+ button,
+ input { /* 1 */
+ overflow: visible;
+ }
+
+ /**
+ * Remove the inheritance of text transform in Edge, Firefox, and IE.
+ * 1. Remove the inheritance of text transform in Firefox.
+ */
+
+ button,
+ select { /* 1 */
+ text-transform: none;
+ }
+
+ /**
+ * Correct the inability to style clickable types in iOS and Safari.
+ */
+
+ button,
+ [type="button"],
+ [type="reset"],
+ [type="submit"] {
+ -webkit-appearance: button;
+ }
+
+ /**
+ * Remove the inner border and padding in Firefox.
+ */
+
+ button::-moz-focus-inner,
+ [type="button"]::-moz-focus-inner,
+ [type="reset"]::-moz-focus-inner,
+ [type="submit"]::-moz-focus-inner {
+ border-style: none;
+ padding: 0;
+ }
+
+ /**
+ * Restore the focus styles unset by the previous rule.
+ */
+
+ button:-moz-focusring,
+ [type="button"]:-moz-focusring,
+ [type="reset"]:-moz-focusring,
+ [type="submit"]:-moz-focusring {
+ outline: 1px dotted ButtonText;
+ }
+
+ /**
+ * Correct the padding in Firefox.
+ */
+
+ fieldset {
+ padding: 0.35em 0.75em 0.625em;
+ }
+
+ /**
+ * 1. Correct the text wrapping in Edge and IE.
+ * 2. Correct the color inheritance from `fieldset` elements in IE.
+ * 3. Remove the padding so developers are not caught out when they zero out
+ * `fieldset` elements in all browsers.
+ */
+
+ legend {
+ box-sizing: border-box; /* 1 */
+ color: inherit; /* 2 */
+ display: table; /* 1 */
+ max-width: 100%; /* 1 */
+ padding: 0; /* 3 */
+ white-space: normal; /* 1 */
+ }
+
+ /**
+ * Add the correct vertical alignment in Chrome, Firefox, and Opera.
+ */
+
+ progress {
+ vertical-align: baseline;
+ }
+
+ /**
+ * Remove the default vertical scrollbar in IE 10+.
+ */
+
+ textarea {
+ overflow: auto;
+ }
+
+ /**
+ * 1. Add the correct box sizing in IE 10.
+ * 2. Remove the padding in IE 10.
+ */
+
+ [type="checkbox"],
+ [type="radio"] {
+ box-sizing: border-box; /* 1 */
+ padding: 0; /* 2 */
+ }
+
+ /**
+ * Correct the cursor style of increment and decrement buttons in Chrome.
+ */
+
+ [type="number"]::-webkit-inner-spin-button,
+ [type="number"]::-webkit-outer-spin-button {
+ height: auto;
+ }
+
+ /**
+ * 1. Correct the odd appearance in Chrome and Safari.
+ * 2. Correct the outline style in Safari.
+ */
+
+ [type="search"] {
+ -webkit-appearance: textfield; /* 1 */
+ outline-offset: -2px; /* 2 */
+ }
+
+ /**
+ * Remove the inner padding in Chrome and Safari on macOS.
+ */
+
+ [type="search"]::-webkit-search-decoration {
+ -webkit-appearance: none;
+ }
+
+ /**
+ * 1. Correct the inability to style clickable types in iOS and Safari.
+ * 2. Change font properties to `inherit` in Safari.
+ */
+
+ ::-webkit-file-upload-button {
+ -webkit-appearance: button; /* 1 */
+ font: inherit; /* 2 */
+ }
+
+ /* Interactive
+ ========================================================================== */
+
+ /*
+ * Add the correct display in Edge, IE 10+, and Firefox.
+ */
+
+ details {
+ display: block;
+ }
+
+ /*
+ * Add the correct display in all browsers.
+ */
+
+ summary {
+ display: list-item;
+ }
+
+ /* Misc
+ ========================================================================== */
+
+ /**
+ * Add the correct display in IE 10+.
+ */
+
+ template {
+ display: none;
+ }
+
+ /**
+ * Add the correct display in IE 10.
+ */
+
+ [hidden] {
+ display: none;
+ } \ No newline at end of file
diff --git a/packages/website/md/docs/0xjs/0.0.1/installation.md b/packages/website/md/docs/0xjs/0.0.1/installation.md
index ac0a47699..3860df1cc 100644
--- a/packages/website/md/docs/0xjs/0.0.1/installation.md
+++ b/packages/website/md/docs/0xjs/0.0.1/installation.md
@@ -28,4 +28,4 @@ Download the UMD module from our [releases page](https://github.com/0xProject/0x
### Wiki
-Check out our [wiki](https://0xproject.com/wiki) for articles on how to get 0x.js setup with TestRPC, Infura and more!
+Check out our [wiki](https://0x.org/wiki) for articles on how to get 0x.js setup with TestRPC, Infura and more!
diff --git a/packages/website/md/docs/0xjs/1.0.1/installation.md b/packages/website/md/docs/0xjs/1.0.1/installation.md
index 74c902afd..d5c13e710 100644
--- a/packages/website/md/docs/0xjs/1.0.1/installation.md
+++ b/packages/website/md/docs/0xjs/1.0.1/installation.md
@@ -37,4 +37,4 @@ Download the UMD module from our [releases page](https://github.com/0xProject/0x
### Wiki
-Check out our [wiki](https://0xproject.com/wiki) for articles on how to get 0x.js setup with Ganache, Infura and more!
+Check out our [wiki](https://0x.org/wiki) for articles on how to get 0x.js setup with Ganache, Infura and more!
diff --git a/packages/website/md/docs/0xjs/2.0.0/installation.md b/packages/website/md/docs/0xjs/2.0.0/installation.md
index aaac263d0..87d763572 100644
--- a/packages/website/md/docs/0xjs/2.0.0/installation.md
+++ b/packages/website/md/docs/0xjs/2.0.0/installation.md
@@ -35,4 +35,4 @@ Download the UMD module from our [releases page](https://github.com/0xProject/0x
### Wiki
-Check out our [wiki](https://0xproject.com/wiki) for articles on how to get 0x.js setup with TestRPC, Infura and more!
+Check out our [wiki](https://0x.org/wiki) for articles on how to get 0x.js setup with TestRPC, Infura and more!
diff --git a/packages/website/md/docs/asset_buyer/introduction.md b/packages/website/md/docs/asset_buyer/introduction.md
index a59539ac6..bac81c760 100644
--- a/packages/website/md/docs/asset_buyer/introduction.md
+++ b/packages/website/md/docs/asset_buyer/introduction.md
@@ -1 +1 @@
-Welcome to the [asset-buyer](https://github.com/0xProject/0x-monorepo/tree/development/packages/asset-buyer) documentation! AssetBuyer is a library that provides an easy way to buy any asset with ETH in one click, leveraging 0x liquidity and the [Forwarder contract](https://0xproject.com/docs/contracts#Forwarder).
+Welcome to the [asset-buyer](https://github.com/0xProject/0x-monorepo/tree/development/packages/asset-buyer) documentation! AssetBuyer is a library that provides an easy way to buy any asset with ETH in one click, leveraging 0x liquidity and the [Forwarder contract](https://0x.org/docs/contracts#Forwarder).
diff --git a/packages/website/md/docs/connect/1/installation.md b/packages/website/md/docs/connect/1/installation.md
index 950bf92ca..d457b0577 100644
--- a/packages/website/md/docs/connect/1/installation.md
+++ b/packages/website/md/docs/connect/1/installation.md
@@ -12,4 +12,4 @@ import { HttpClient } from '@0xproject/connect';
### Wiki
-Check out our [0x Connect introduction tutorial](https://0xproject.com/wiki#Intro-Tutorial) for information on how to integrate relayers into your application.
+Check out our [0x Connect introduction tutorial](https://0x.org/wiki#Intro-Tutorial) for information on how to integrate relayers into your application.
diff --git a/packages/website/md/docs/connect/3/installation.md b/packages/website/md/docs/connect/3/installation.md
index 6797d9633..8ed6172bf 100644
--- a/packages/website/md/docs/connect/3/installation.md
+++ b/packages/website/md/docs/connect/3/installation.md
@@ -12,4 +12,4 @@ import { HttpClient } from '@0x/connect';
### Wiki
-Check out our [0x Connect introduction tutorial](https://0xproject.com/wiki#Intro-Tutorial) for information on how to integrate relayers into your application.
+Check out our [0x Connect introduction tutorial](https://0x.org/wiki#Intro-Tutorial) for information on how to integrate relayers into your application.
diff --git a/packages/website/md/docs/migrations/1/installation.md b/packages/website/md/docs/migrations/1/installation.md
new file mode 100644
index 000000000..78403037b
--- /dev/null
+++ b/packages/website/md/docs/migrations/1/installation.md
@@ -0,0 +1,17 @@
+**Install**
+
+```bash
+yarn add @0x/migrations
+```
+
+**Import**
+
+```javascript
+import { runMigrationsAsync } from '@0x/migrations';
+```
+
+or
+
+```javascript
+var runMigrationsAsync = require('@0x/migrations').runMigrationsAsync;
+```
diff --git a/packages/website/md/docs/migrations/1/introduction.md b/packages/website/md/docs/migrations/1/introduction.md
new file mode 100644
index 000000000..70b13c5f8
--- /dev/null
+++ b/packages/website/md/docs/migrations/1/introduction.md
@@ -0,0 +1 @@
+Welcome to the [@0x/migrations](https://github.com/0xProject/0x-monorepo/tree/development/packages/migrations) documentation! This package is intended for developers who would like to deploy the 0x protocol system of smart contracts to a custom testnet. If you want to test against existing testnets, check out our pre-deployed [Ganache snapshot](https://0x.org/wiki#Ganache-Setup-Guide) or where 0x is already deployed on [popular testnets](https://0x.org/wiki#Deployed-Addresses).
diff --git a/packages/website/md/docs/smart_contracts/1/introduction.md b/packages/website/md/docs/smart_contracts/1/introduction.md
index 79a8f00fd..81715a3d1 100644
--- a/packages/website/md/docs/smart_contracts/1/introduction.md
+++ b/packages/website/md/docs/smart_contracts/1/introduction.md
@@ -1 +1 @@
-Welcome to the [0x smart contracts](https://github.com/0xProject/0x-monorepo/tree/development/packages/contracts) documentation! This documentation is intended for dApp developers who want to integrate 0x exchange functionality directly into their own smart contracts.
+Welcome to the [0x smart contracts](https://github.com/0xProject/0x-monorepo/tree/development/contracts/core) documentation! This documentation is intended for dApp developers who want to integrate 0x exchange functionality directly into their own smart contracts.
diff --git a/packages/website/md/docs/smart_contracts/2/introduction.md b/packages/website/md/docs/smart_contracts/2/introduction.md
index 4aa31db3d..4a3a73027 100644
--- a/packages/website/md/docs/smart_contracts/2/introduction.md
+++ b/packages/website/md/docs/smart_contracts/2/introduction.md
@@ -1,6 +1,6 @@
-Welcome to the [0x smart contracts](https://github.com/0xProject/0x-monorepo/tree/development/packages/contracts) documentation! This documentation is intended for dApp developers who want to integrate 0x exchange functionality directly into their own smart contracts.
+Welcome to the [0x smart contracts](https://github.com/0xProject/0x-monorepo/tree/development/contracts/core) documentation! This documentation is intended for dApp developers who want to integrate 0x exchange functionality directly into their own smart contracts.
### Helpful wiki articles:
-* [Deployed smart contract addresses](https://0xproject.com/wiki#Deployed-Addresses)
+* [Deployed smart contract addresses](https://0x.org/wiki#Deployed-Addresses)
* [0x Protocol Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md)
diff --git a/packages/website/md/docs/sol_cov/1/usage.md b/packages/website/md/docs/sol_cov/1/usage.md
index c747005fb..c2b8404af 100644
--- a/packages/website/md/docs/sol_cov/1/usage.md
+++ b/packages/website/md/docs/sol_cov/1/usage.md
@@ -1,4 +1,4 @@
-Sol-cov uses transaction traces in order to figure out which lines of Solidity source code have been covered by your tests. In order for it to gather these traces, you must add the `CoverageSubprovider` to the [ProviderEngine](https://github.com/MetaMask/provider-engine) instance you use when running your Solidity tests. If you're unfamiliar with ProviderEngine, please read the [Web3 Provider explained](https://0xproject.com/wiki#Web3-Provider-Explained) wiki article.
+Sol-cov uses transaction traces in order to figure out which lines of Solidity source code have been covered by your tests. In order for it to gather these traces, you must add the `CoverageSubprovider` to the [ProviderEngine](https://github.com/MetaMask/provider-engine) instance you use when running your Solidity tests. If you're unfamiliar with ProviderEngine, please read the [Web3 Provider explained](https://0x.org/wiki#Web3-Provider-Explained) wiki article.
The CoverageSubprovider eavesdrops on the `eth_sendTransaction` and `eth_call` RPC calls and collects traces after each call using `debug_traceTransaction`. `eth_call`'s' don't generate traces - so we take a snapshot, re-submit it as a transaction, get the trace and then revert the snapshot.
@@ -8,7 +8,7 @@ In order to use `CoverageSubprovider` with your favorite framework you need to p
### Sol-compiler
-If you are generating your artifacts with [@0xproject/sol-compiler](https://0xproject.com/docs/sol-compiler) you can use the `SolCompilerArtifactsAdapter` we've implemented for you.
+If you are generating your artifacts with [@0xproject/sol-compiler](https://0x.org/docs/sol-compiler) you can use the `SolCompilerArtifactsAdapter` we've implemented for you.
```typescript
import { SolCompilerArtifactsAdapter } from '@0xproject/sol-cov';
diff --git a/packages/website/md/docs/sol_cov/2/usage.md b/packages/website/md/docs/sol_cov/2/usage.md
index d1c76474b..8e33f3bf5 100644
--- a/packages/website/md/docs/sol_cov/2/usage.md
+++ b/packages/website/md/docs/sol_cov/2/usage.md
@@ -1,4 +1,4 @@
-Sol-cov uses transaction traces in order to figure out which lines of Solidity source code have been covered by your tests. In order for it to gather these traces, you must add the `CoverageSubprovider` to the [ProviderEngine](https://github.com/MetaMask/provider-engine) instance you use when running your Solidity tests. If you're unfamiliar with ProviderEngine, please read the [Web3 Provider explained](https://0xproject.com/wiki#Web3-Provider-Explained) wiki article.
+Sol-cov uses transaction traces in order to figure out which lines of Solidity source code have been covered by your tests. In order for it to gather these traces, you must add the `CoverageSubprovider` to the [ProviderEngine](https://github.com/MetaMask/provider-engine) instance you use when running your Solidity tests. If you're unfamiliar with ProviderEngine, please read the [Web3 Provider explained](https://0x.org/wiki#Web3-Provider-Explained) wiki article.
The CoverageSubprovider eavesdrops on the `eth_sendTransaction` and `eth_call` RPC calls and collects traces after each call using `debug_traceTransaction`. `eth_call`'s' don't generate traces - so we take a snapshot, re-submit it as a transaction, get the trace and then revert the snapshot.
@@ -8,7 +8,7 @@ In order to use `CoverageSubprovider` with your favorite framework you need to p
### Sol-compiler
-If you are generating your artifacts with [@0x/sol-compiler](https://0xproject.com/docs/sol-compiler) you can use the `SolCompilerArtifactsAdapter` we've implemented for you.
+If you are generating your artifacts with [@0x/sol-compiler](https://0x.org/docs/sol-compiler) you can use the `SolCompilerArtifactsAdapter` we've implemented for you.
```typescript
import { SolCompilerArtifactsAdapter } from '@0x/sol-cov';
diff --git a/packages/website/md/docs/subproviders/1/introduction.md b/packages/website/md/docs/subproviders/1/introduction.md
index 835201064..fe7fb6a8d 100644
--- a/packages/website/md/docs/subproviders/1/introduction.md
+++ b/packages/website/md/docs/subproviders/1/introduction.md
@@ -1 +1 @@
-Welcome to the [Subproviders](https://github.com/0xProject/0x-monorepo/tree/development/packages/subproviders) documentation! Subproviders is a package containing useful [subproviders](https://0xproject.com/wiki#Web3-Provider-Explained) that can be used with the [Web3 Provider Engine](https://github.com/MetaMask/provider-engine) library.
+Welcome to the [Subproviders](https://github.com/0xProject/0x-monorepo/tree/development/packages/subproviders) documentation! Subproviders is a package containing useful [subproviders](https://0x.org/wiki#Web3-Provider-Explained) that can be used with the [Web3 Provider Engine](https://github.com/MetaMask/provider-engine) library.
diff --git a/packages/website/package.json b/packages/website/package.json
index bb64b24db..bb97ea4e8 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -1,6 +1,6 @@
{
"name": "@0x/website",
- "version": "0.0.59",
+ "version": "0.0.63",
"engines": {
"node": ">=6.12"
},
@@ -13,29 +13,36 @@
"clean": "shx rm -f public/bundle*",
"lint": "tslint --format stylish --project . 'ts/**/*.ts' 'ts/**/*.tsx'",
"dev": "webpack-dev-server --mode development --content-base public --https",
- "deploy_dogfood": "npm run build:prod; aws s3 sync ./public/. s3://dogfood.0xproject.com --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
+ "deploy_dogfood": "npm run build:prod; aws s3 sync ./public/. s3://dogfood.0x.org --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
"deploy_staging": "npm run build:prod; aws s3 sync ./public/. s3://staging-0xproject --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers",
- "deploy_live": "DEPLOY_ROLLBAR_SOURCEMAPS=true npm run build:prod; aws s3 sync ./public/. s3://0xproject.com --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --exclude *.map.js"
+ "deploy_live": "DEPLOY_ROLLBAR_SOURCEMAPS=true npm run build:prod; aws s3 sync ./public/. s3://0x.org --profile 0xproject --region us-east-1 --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --exclude *.map.js"
},
"author": "Fabio Berger",
"license": "Apache-2.0",
"dependencies": {
- "@0x/contract-wrappers": "^4.0.2",
- "@0x/json-schemas": "^2.1.1",
- "@0x/order-utils": "^3.0.2",
- "@0x/react-docs": "^1.0.18",
- "@0x/react-shared": "^1.0.21",
- "@0x/subproviders": "^2.1.4",
- "@0x/types": "^1.2.1",
+ "@0x/asset-buyer": "^3.0.4",
+ "@0x/contract-addresses": "^2.0.0",
+ "@0x/contract-wrappers": "^4.1.1",
+ "@0x/json-schemas": "^2.1.2",
+ "@0x/order-utils": "^3.0.4",
+ "@0x/react-docs": "^1.0.20",
+ "@0x/react-shared": "^1.0.23",
+ "@0x/subproviders": "^2.1.6",
+ "@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
- "@0x/utils": "^2.0.5",
- "@0x/web3-wrapper": "^3.1.4",
+ "@0x/utils": "^2.0.6",
+ "@0x/web3-wrapper": "^3.1.6",
+ "@reach/dialog": "^0.1.2",
+ "@types/react-lazyload": "^2.3.1",
+ "@types/react-loadable": "^5.4.2",
+ "@types/react-syntax-highlighter": "^0.0.8",
+ "@types/styled-components": "^4.1.1",
"accounting": "^0.4.1",
"basscss": "^8.0.3",
"blockies": "^0.0.2",
"bowser": "^1.9.3",
"deep-equal": "^1.0.1",
- "ethereum-types": "^1.1.2",
+ "ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"find-versions": "^2.0.0",
"jsonschema": "^1.2.0",
@@ -46,21 +53,29 @@
"numeral": "^2.0.6",
"polished": "^1.9.2",
"query-string": "^6.0.0",
+ "rc-slider": "^8.6.3",
"react": "^16.4.2",
"react-copy-to-clipboard": "^5.0.0",
"react-document-title": "^2.0.3",
"react-dom": "^16.4.2",
+ "react-flickity-component": "^3.1.0",
+ "react-headroom": "2.2.2",
"react-helmet": "^5.2.0",
+ "react-lazyload": "^2.3.0",
+ "react-loadable": "^5.5.0",
"react-popper": "^1.0.0-beta.6",
"react-redux": "^5.0.3",
+ "react-responsive": "^6.0.1",
"react-scroll": "0xproject/react-scroll#pr-330-and-replace-state",
+ "react-scrollable-anchor": "^0.6.1",
+ "react-syntax-highlighter": "^10.1.1",
"react-tooltip": "^3.2.7",
"react-typist": "^2.0.4",
"redux": "^3.6.0",
"redux-devtools-extension": "^2.13.2",
"rollbar": "^2.4.7",
"semver-sort": "0.0.4",
- "styled-components": "^3.3.0",
+ "styled-components": "^4.1.1",
"thenby": "^1.2.3",
"truffle-contract": "2.0.1",
"web3-provider-engine": "14.0.6",
@@ -77,12 +92,14 @@
"@types/node": "*",
"@types/numeral": "^0.0.22",
"@types/query-string": "^5.1.0",
- "@types/react": "^16.4.2",
+ "@types/rc-slider": "^8.6.0",
+ "@types/react": "^16.7.7",
"@types/react-copy-to-clipboard": "^4.2.0",
"@types/react-dom": "^16.0.7",
"@types/react-helmet": "^5.0.6",
"@types/react-redux": "^4.4.37",
"@types/react-scroll": "1.5.3",
+ "@types/react-syntax-highlighter": "^0.0.8",
"@types/react-tap-event-plugin": "0.0.30",
"@types/redux": "^3.6.0",
"@types/web3-provider-engine": "^14.0.0",
@@ -91,6 +108,7 @@
"less-loader": "^4.1.0",
"make-promises-safe": "^1.1.0",
"raw-loader": "^0.5.1",
+ "react-svg-loader": "^2.1.0",
"rollbar-sourcemap-webpack-plugin": "^2.4.0",
"shx": "^0.2.2",
"source-map-loader": "^0.2.4",
@@ -101,6 +119,7 @@
"typescript": "3.0.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"webpack": "^4.20.2",
+ "webpack-bundle-analyzer": "^3.0.3",
"webpack-cli": "3.1.2",
"webpack-dev-server": "^3.1.9"
}
diff --git a/packages/website/public/css/formular.css b/packages/website/public/css/formular.css
new file mode 100644
index 000000000..85549f8c8
--- /dev/null
+++ b/packages/website/public/css/formular.css
@@ -0,0 +1,45 @@
+/**
+ * @license
+ * MyFonts Webfont Build ID 3678880, 2018-11-27T05:59:35-0500
+ *
+ * The fonts listed in this notice are subject to the End User License
+ * Agreement(s) entered into by the website owner. All other parties are
+ * explicitly restricted from using the Licensed Webfonts(s).
+ *
+ * You may obtain a valid license at the URLs below.
+ *
+ * Webfont: Formular-Light by Brownfox
+ * URL: https://www.myfonts.com/fonts/brownfox/formular/light/
+ *
+ * Webfont: Formular by Brownfox
+ * URL: https://www.myfonts.com/fonts/brownfox/formular/regular/
+ *
+ *
+ * License: https://www.myfonts.com/viewlicense?type=web&buildid=3678880
+ * Licensed pageviews: 200,000
+ * Webfonts copyright: Copyright (c) 2014 by Vyacheslav Kirilenko, Gayane Bagdasaryan. All rights reserved.
+ *
+ * © 2018 MyFonts Inc
+*/
+
+
+/* @import must be at top of file, otherwise CSS will not work */
+@import url("//hello.myfonts.net/count/3822a0");
+
+
+@font-face {
+ font-family: 'Formular';
+ font-weight: 300;
+ src: url('../fonts/Formular-Light.woff2');
+ src: url('../fonts/Formular-Light.woff2') format('woff2'), url('../fonts/Formular-Light.woff') format('woff');
+ font-display: swap;
+}
+
+
+@font-face {
+ font-family: 'Formular';
+ font-weight: 400;
+ src: url('../fonts/Formular-Regular.woff2');
+ src: url('../fonts/Formular-Regular.woff2') format('woff2'), url('../fonts/Formular-Regular.woff') format('woff');
+ font-display: swap;
+}
diff --git a/packages/website/public/fonts/Formular-Light.woff b/packages/website/public/fonts/Formular-Light.woff
new file mode 100644
index 000000000..79c774b40
--- /dev/null
+++ b/packages/website/public/fonts/Formular-Light.woff
Binary files differ
diff --git a/packages/website/public/fonts/Formular-Light.woff2 b/packages/website/public/fonts/Formular-Light.woff2
new file mode 100644
index 000000000..6502d5da1
--- /dev/null
+++ b/packages/website/public/fonts/Formular-Light.woff2
Binary files differ
diff --git a/packages/website/public/fonts/Formular-Regular.woff b/packages/website/public/fonts/Formular-Regular.woff
new file mode 100644
index 000000000..651364b9b
--- /dev/null
+++ b/packages/website/public/fonts/Formular-Regular.woff
Binary files differ
diff --git a/packages/website/public/fonts/Formular-Regular.woff2 b/packages/website/public/fonts/Formular-Regular.woff2
new file mode 100644
index 000000000..91cdbf29f
--- /dev/null
+++ b/packages/website/public/fonts/Formular-Regular.woff2
Binary files differ
diff --git a/packages/website/public/images/0x-instant/0x-instant-widgets.png b/packages/website/public/images/0x-instant/0x-instant-widgets.png
new file mode 100644
index 000000000..707f0eccc
--- /dev/null
+++ b/packages/website/public/images/0x-instant/0x-instant-widgets.png
Binary files differ
diff --git a/packages/website/public/images/0x-instant/0x-instant-widgets@2x.png b/packages/website/public/images/0x-instant/0x-instant-widgets@2x.png
new file mode 100644
index 000000000..35d51387c
--- /dev/null
+++ b/packages/website/public/images/0x-instant/0x-instant-widgets@2x.png
Binary files differ
diff --git a/packages/website/public/images/0x-instant/widget-1.png b/packages/website/public/images/0x-instant/widget-1.png
new file mode 100755
index 000000000..622c1f42c
--- /dev/null
+++ b/packages/website/public/images/0x-instant/widget-1.png
Binary files differ
diff --git a/packages/website/public/images/0x-instant/widget-2.png b/packages/website/public/images/0x-instant/widget-2.png
new file mode 100755
index 000000000..7fec16cfb
--- /dev/null
+++ b/packages/website/public/images/0x-instant/widget-2.png
Binary files differ
diff --git a/packages/website/public/images/0x-instant/widget-3.png b/packages/website/public/images/0x-instant/widget-3.png
new file mode 100755
index 000000000..91ac7d36a
--- /dev/null
+++ b/packages/website/public/images/0x-instant/widget-3.png
Binary files differ
diff --git a/packages/website/public/images/0x-instant/widget-4.png b/packages/website/public/images/0x-instant/widget-4.png
new file mode 100755
index 000000000..3db35e068
--- /dev/null
+++ b/packages/website/public/images/0x-instant/widget-4.png
Binary files differ
diff --git a/packages/website/public/images/0x-instant/widget-5.png b/packages/website/public/images/0x-instant/widget-5.png
new file mode 100755
index 000000000..05cebf28b
--- /dev/null
+++ b/packages/website/public/images/0x-instant/widget-5.png
Binary files differ
diff --git a/packages/website/public/images/0x-instant/widget-6.png b/packages/website/public/images/0x-instant/widget-6.png
new file mode 100755
index 000000000..33def6e04
--- /dev/null
+++ b/packages/website/public/images/0x-instant/widget-6.png
Binary files differ
diff --git a/packages/website/public/images/about/about-office.png b/packages/website/public/images/about/about-office.png
new file mode 100755
index 000000000..432d18a8b
--- /dev/null
+++ b/packages/website/public/images/about/about-office.png
Binary files differ
diff --git a/packages/website/public/images/advisors/david.png b/packages/website/public/images/advisors/david.png
deleted file mode 100644
index 0f87d8935..000000000
--- a/packages/website/public/images/advisors/david.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/advisors/fred.jpg b/packages/website/public/images/advisors/fred.jpg
deleted file mode 100644
index f3b37e2d9..000000000
--- a/packages/website/public/images/advisors/fred.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/advisors/joey.jpg b/packages/website/public/images/advisors/joey.jpg
deleted file mode 100644
index daccc9b55..000000000
--- a/packages/website/public/images/advisors/joey.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/advisors/linda.jpg b/packages/website/public/images/advisors/linda.jpg
deleted file mode 100644
index 1ee59d301..000000000
--- a/packages/website/public/images/advisors/linda.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/advisors/olaf.png b/packages/website/public/images/advisors/olaf.png
deleted file mode 100644
index d1715081f..000000000
--- a/packages/website/public/images/advisors/olaf.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/banner/bottomofcta.png b/packages/website/public/images/banner/bottomofcta.png
new file mode 100644
index 000000000..910022a28
--- /dev/null
+++ b/packages/website/public/images/banner/bottomofcta.png
Binary files differ
diff --git a/packages/website/public/images/banner/topofcta.png b/packages/website/public/images/banner/topofcta.png
new file mode 100644
index 000000000..710c390ab
--- /dev/null
+++ b/packages/website/public/images/banner/topofcta.png
Binary files differ
diff --git a/packages/website/public/images/clients/bamboo.svg b/packages/website/public/images/clients/bamboo.svg
new file mode 100644
index 000000000..702b7d5aa
--- /dev/null
+++ b/packages/website/public/images/clients/bamboo.svg
@@ -0,0 +1,17 @@
+<svg width="70" height="55" viewBox="0 0 70 55" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M44.2922 11.0005C44.2962 10.9978 44.299 10.9951 44.303 10.9924C43.188 10.5459 41.9506 10.3193 40.5868 10.3193C37.1329 10.3193 34.5249 11.6898 32.7657 14.4281H32.4698C32.5599 13.2896 32.6272 12.3008 32.6769 11.4456C32.2358 11.4793 31.7933 11.4996 31.3495 11.4996C30.0798 11.4996 28.8007 11.3606 27.5297 11.0787C26.0812 10.7577 24.7012 10.2626 23.4087 9.61108L24.4685 26.3337C27.3535 27.1592 30.3878 26.6115 32.7738 24.9996C32.7711 24.8566 32.7657 24.7203 32.7657 24.5733V23.7572C32.798 21.1174 33.2419 19.2248 34.0972 18.0783C34.9527 16.9303 36.3097 16.3584 38.1699 16.3584C38.954 16.3584 39.6574 16.5243 40.2801 16.8548C40.9916 14.5522 42.385 12.4964 44.2922 11.0005Z" fill="white"/>
+<path d="M27.9314 9.26574C29.5387 9.62185 31.1634 9.72033 32.7586 9.57464C32.7626 9.35342 32.7667 9.14299 32.7667 8.95818V-9.39018e-08H22.8017L23.2711 7.41367C24.6968 8.26619 26.2623 8.89613 27.9314 9.26574Z" fill="white"/>
+<path d="M48.2361 14.1434C47.608 13.2747 46.8951 12.5571 46.1029 11.9851C43.9079 13.4285 42.3746 15.6919 41.8232 18.2387C41.8635 18.294 41.9052 18.3426 41.9442 18.3992C42.8656 19.7603 43.3269 21.8026 43.3269 24.5247C43.3269 27.2455 42.8696 29.3214 41.9564 30.7473C41.0444 32.1744 39.8138 32.888 38.2684 32.888C36.3599 32.888 34.9651 32.2445 34.0855 30.9577C33.4803 30.0728 33.0889 28.7778 32.8993 27.0944C31.1588 28.0548 29.1911 28.5741 27.1817 28.5741C26.3209 28.5741 25.4521 28.4757 24.5927 28.2801L25.2409 38.5062H30.9894L32.2469 35.4617H32.7661C34.6087 37.821 37.1494 38.9999 40.3908 38.9999C43.6631 38.9999 46.2509 37.7468 48.15 35.2392C50.0505 32.7315 51 29.1933 51 24.6231C51 20.1852 50.0787 16.6915 48.2361 14.1434Z" fill="white"/>
+<path d="M11.4923 11.5399C14.6059 11.5426 17.5366 10.7386 20.3234 9.40857C21.2568 8.96208 22.1042 8.33078 22.9918 7.78447C23.3308 7.57539 23.4195 7.28402 23.3873 6.88609C23.1734 4.32179 21.8486 2.37799 20.0019 0.720171C19.928 0.652725 19.811 0.631142 19.6724 0.569092C19.663 0.729613 19.6375 0.832131 19.6563 0.923857C19.9293 2.30245 20.2992 3.64463 21.1264 4.81415C21.2434 4.98276 21.3039 5.19184 21.3913 5.38069L21.2851 5.46567C18.3059 3.95353 15.1519 3.51379 11.8917 3.71612C11.8742 3.80785 11.8567 3.89958 11.8393 3.9913C13.1116 4.58888 14.3624 5.24175 15.6631 5.76514C16.9609 6.28852 18.31 6.68105 19.6361 7.13159C15.5904 7.36496 11.9133 8.39688 9 11.432C9.83793 11.5196 10.6651 11.5385 11.4923 11.5399Z" fill="white"/>
+<path d="M25.6998 43.0121C25.6998 44.114 25.6998 45.2159 25.6998 46.4026C26.3626 45.6155 27.1068 45.3007 28.0254 45.5187C28.7463 45.6882 29.2347 46.1362 29.5254 46.8264C30.0487 48.11 30.072 49.4299 29.5952 50.7134C28.9905 52.3724 27.1766 52.7962 25.8975 51.6216C25.8393 51.5732 25.7812 51.5247 25.7114 51.4642C25.4091 51.6337 25.5021 52.1665 25.0719 52.1665C24.7463 52.1544 24.4207 52.2149 24.1067 52.1302C23.9207 51.9243 24.0021 51.6942 24.0021 51.4763C24.0021 48.8729 24.0021 46.2694 24.0021 43.666C24.0021 43.448 23.9788 43.2301 23.9788 43C24.537 43.0121 25.1184 43.0121 25.6998 43.0121ZM28.1417 48.8729C28.1766 48.4248 28.1068 47.9889 27.9208 47.5772C27.7114 47.0807 27.3161 46.8385 26.8161 46.8991C26.3044 46.9596 25.9556 47.2624 25.8277 47.7709C25.6649 48.4612 25.6765 49.1635 25.8277 49.8537C25.9556 50.4107 26.3161 50.7497 26.8161 50.774C27.3975 50.8103 27.758 50.5681 27.9673 49.9869C28.0952 49.6357 28.1649 49.2603 28.1417 48.8729Z" fill="white"/>
+<path d="M1.74422 43.0122C1.6977 44.1141 1.80236 45.2282 1.65119 46.3301C1.83724 46.3422 1.88375 46.1848 1.97678 46.1C3.00005 45.0707 4.6745 45.2766 5.36056 46.5722C6.11639 48.0011 6.12802 49.5268 5.45358 50.9799C4.79078 52.433 3.10471 52.7115 1.93027 51.6459C1.8605 51.5854 1.79073 51.5006 1.68608 51.4885C1.65119 51.5006 1.59305 51.5127 1.59305 51.5369C1.46514 52.0576 1.12793 52.215 0.639546 52.1303C0.43024 52.0939 0.209306 52.1061 0 52.0939C0 49.0667 0 46.0395 0 43.0122C0.581406 43.0122 1.16281 43.0122 1.74422 43.0122ZM1.73259 48.8124C1.72096 49.2604 1.73259 49.6964 1.90701 50.1202C2.08143 50.5561 2.39539 50.7741 2.84889 50.7862C3.30238 50.8104 3.65123 50.653 3.8489 50.2171C4.23263 49.3452 4.20938 48.4491 3.90705 47.5773C3.74425 47.1172 3.29076 46.8629 2.83726 46.8871C2.32562 46.9113 2.01166 47.2019 1.82561 47.7347C1.72096 48.0859 1.74422 48.4491 1.73259 48.8124Z" fill="white"/>
+<path d="M64.0688 54.9999C64.0688 54.6608 64.0688 54.3218 64.0688 53.9827C64.3247 53.8374 64.5572 53.9222 64.7782 53.9101C65.2433 53.8859 65.6154 53.7042 65.8479 53.2925C66.1735 52.7234 66.3945 52.1664 66.0805 51.4398C65.3712 49.7688 64.7549 48.0493 64.1037 46.3541C64.0223 46.1482 63.8944 45.9666 63.9642 45.7002C64.3828 45.6154 64.8014 45.6639 65.2898 45.676C65.8363 47.2986 66.4526 48.9091 66.941 50.5922C67.1503 50.3985 67.1154 50.1321 67.1852 49.9141C67.6154 48.6427 68.034 47.3712 68.441 46.0877C68.5457 45.7728 68.6736 45.6154 69.0108 45.6396C69.3364 45.676 69.6736 45.6517 69.9992 45.6517C69.9992 45.7365 69.9992 45.8092 69.9992 45.8939C69.8945 45.9424 69.8945 46.0513 69.8596 46.1361C69.1038 48.2188 68.3131 50.2895 67.5922 52.3843C67.2201 53.4741 66.7433 54.4429 65.6968 54.9757C65.1503 54.9999 64.6154 54.9999 64.0688 54.9999Z" fill="white"/>
+<path d="M56.6293 43.0122C56.6293 46.0273 56.6293 49.0425 56.6293 52.0939C56.1991 52.1545 55.827 52.1303 55.3502 52.1061C55.3502 49.0788 55.3502 46.0516 55.3502 43.0243C55.7805 43.0122 56.1991 43.0122 56.6293 43.0122Z" fill="white"/>
+<path d="M14.9528 46.3544C15.9761 45.1798 17.7203 45.0829 18.8482 46.4391C19.2436 45.9064 19.7436 45.5915 20.3831 45.4704C21.8483 45.2161 22.8832 46.0517 22.9064 47.5895C22.9297 48.9578 22.918 50.3261 22.918 51.7066C22.918 51.8276 22.9413 51.9487 22.825 52.0819C22.325 52.0819 21.7901 52.0819 21.2669 52.0819C21.1273 51.8761 21.1855 51.6702 21.1855 51.4644C21.1738 50.3503 21.1855 49.2484 21.1738 48.1344C21.1622 47.2989 20.8715 46.9114 20.2901 46.8751C19.6622 46.8387 19.1505 47.311 19.0691 48.0618C18.9761 48.9094 19.0343 49.757 19.0226 50.6046C19.0226 51.089 19.0226 51.5612 19.0226 52.0819C18.418 52.1062 17.8947 52.1183 17.29 52.0698C17.29 51.7792 17.3017 51.5249 17.29 51.2585C17.2552 50.1082 17.3714 48.9578 17.2203 47.8196C17.1389 47.2504 16.9063 46.9598 16.4644 46.8751C15.9877 46.7903 15.5342 47.0325 15.3133 47.5047C15.1505 47.8559 15.0923 48.2313 15.0923 48.6188C15.0923 49.7449 15.0923 50.871 15.0923 52.0335C14.4993 52.1425 13.9644 52.094 13.383 52.0698C13.383 49.9023 13.383 47.7711 13.383 45.6157C13.7086 45.4704 14.0574 45.5552 14.3946 45.5552C14.9179 45.5673 14.6853 46.1606 14.9528 46.3544Z" fill="white"/>
+<path d="M10.5367 48.1098C10.6065 47.0805 10.2111 46.6809 9.35062 46.7899C8.83898 46.8504 8.33897 47.0199 7.83896 47.25C7.6064 46.8746 7.43198 46.5114 7.30407 46.1118C7.46686 45.8212 7.76919 45.7969 8.01338 45.7122C8.83898 45.4458 9.6762 45.3368 10.5251 45.5305C11.653 45.7969 12.2344 46.3903 12.2925 47.5891C12.3507 49.0785 12.3042 50.5679 12.3042 52.0573C11.9437 52.251 11.5948 52.1905 11.2576 52.142C10.8506 52.0815 10.9902 51.5608 10.7227 51.3671C10.6065 51.355 10.5483 51.4518 10.4785 51.5245C9.7576 52.3237 8.83898 52.3963 7.90873 52.1663C7.11802 51.9725 6.76917 51.3186 6.66452 50.5194C6.54824 49.6476 6.8622 48.9332 7.50175 48.5578C8.03664 48.243 8.62967 48.1461 9.22271 48.1098C9.65295 48.0855 10.0716 48.1098 10.5367 48.1098ZM10.5134 49.0785C10.025 49.1753 9.55992 49.1148 9.10643 49.2722C8.54828 49.466 8.33897 49.8777 8.46688 50.4468C8.5599 50.8585 8.97852 51.0522 9.51341 50.9311C10.3506 50.7495 10.6646 50.2046 10.5134 49.0785Z" fill="white"/>
+<path d="M33.7683 52.2389C32.0124 52.3358 30.8147 51.0522 30.7101 49.1874C30.6868 48.7515 30.7101 48.3156 30.7915 47.8676C31.1636 45.8817 32.8148 45.2762 34.2683 45.4942C36.3381 45.809 36.9079 47.6133 36.8148 49.1874C36.78 49.7929 36.6404 50.3741 36.3265 50.9069C35.8148 51.7909 34.9776 52.2389 33.7683 52.2389ZM35.0241 48.8847C35.0241 48.4609 35.0357 48.0371 34.8729 47.6375C34.6636 47.141 34.2799 46.9231 33.7799 46.8989C33.2683 46.8746 32.8613 47.1168 32.6752 47.6012C32.3496 48.4125 32.3729 49.248 32.6636 50.0714C32.8613 50.6284 33.2101 50.8222 33.8613 50.7858C34.4195 50.7616 34.6985 50.5437 34.8962 49.9987C35.0241 49.6476 35.0241 49.2601 35.0241 48.8847Z" fill="white"/>
+<path d="M40.6856 52.2391C39.0344 52.3238 37.7669 51.1371 37.6506 49.3087C37.5925 48.3884 37.639 47.4923 38.1623 46.7053C38.8832 45.6154 39.953 45.349 41.1275 45.4822C42.3833 45.6276 43.2205 46.3662 43.581 47.6376C43.8135 48.4611 43.8135 49.3208 43.581 50.1442C43.2089 51.4278 42.2205 52.2996 40.6856 52.2391ZM41.9647 48.8243C41.9996 48.5216 41.9414 48.2068 41.86 47.8919C41.6856 47.238 41.3368 46.9353 40.7088 46.899C40.1158 46.8748 39.7088 47.1291 39.5228 47.7466C39.3018 48.4974 39.3135 49.2602 39.5344 49.9989C39.6972 50.5559 40.1158 50.8223 40.6856 50.8223C41.2437 50.8223 41.6391 50.5317 41.8135 49.9626C41.9298 49.6114 42.0112 49.236 41.9647 48.8243Z" fill="white"/>
+<path d="M54.5122 49.1998C53.1052 49.1998 51.768 49.1998 50.4424 49.1998C50.3377 50.3381 50.9656 51.0888 52.0122 51.1373C52.7331 51.1736 53.4308 51.0525 54.082 50.7498C54.1401 50.8103 54.1866 50.8467 54.1866 50.8709C54.2099 51.9849 54.3843 51.8638 53.2796 52.1544C52.5936 52.3361 51.8494 52.324 51.1401 52.1544C50.0703 51.888 49.3842 51.1494 49.1168 50.0475C48.8958 49.1514 48.9424 48.2432 49.2447 47.3714C49.7098 46.0152 50.9191 45.3371 52.4308 45.5671C53.5703 45.7367 54.4076 46.7296 54.5238 48.0495C54.5471 48.4006 54.5122 48.7639 54.5122 49.1998ZM53.1982 48.1948C53.0587 46.9355 52.5936 46.4995 51.5703 46.6327C50.861 46.7175 50.3959 47.3956 50.5122 48.1948C51.3959 48.1948 52.2796 48.1948 53.1982 48.1948Z" fill="white"/>
+<path d="M58.9435 46.9957C58.7458 46.7656 58.6876 46.4387 58.5597 46.1481C58.99 45.809 59.4551 45.7121 59.9319 45.6274C60.583 45.5063 61.2458 45.4942 61.8854 45.7C62.6296 45.9422 63.1063 46.4871 63.1296 47.2742C63.1877 48.8605 63.1412 50.4468 63.1412 52.033C62.3156 52.2389 62.3156 52.2389 61.9551 51.3307C61.8621 51.3065 61.8156 51.367 61.7691 51.4276C61.083 52.3358 60.1295 52.3358 59.176 52.1783C58.5248 52.0694 58.0132 51.4276 57.9202 50.7495C57.7923 49.7686 58.0597 49.0784 58.769 48.6788C59.2807 48.3761 59.8505 48.2429 60.4319 48.2308C60.897 48.2187 61.3505 48.2308 61.7923 48.2308C61.9668 47.0562 61.6063 46.6203 60.5946 46.6203C60.2225 46.6203 59.8737 46.693 59.5249 46.8383C59.3388 46.9109 59.176 47.0441 58.9435 46.9957ZM61.8272 49.0663C61.1412 49.0542 60.5016 49.03 59.897 49.2964C59.3853 49.5144 59.1993 49.9261 59.2923 50.5194C59.3621 50.9432 59.7109 51.2096 60.2458 51.2096C60.5714 51.2096 60.897 51.137 61.1877 50.9432C61.8389 50.5073 61.897 49.8534 61.8272 49.0663Z" fill="white"/>
+<path d="M46.1743 52.0816C45.7208 52.1301 45.3371 52.1301 44.9185 52.0816C44.9185 49.9626 44.9185 47.8556 44.9185 45.7244C45.2092 45.5912 45.5347 45.6639 45.872 45.6881C45.9417 46.0393 46.0115 46.3662 46.0813 46.7416C46.4417 46.3904 46.6976 45.9666 47.1511 45.7486C47.6162 45.5307 48.0697 45.5186 48.6046 45.5912C48.6627 46.0272 48.6046 46.4267 48.5813 46.8142C48.2906 46.9353 48.0813 46.7779 47.8371 46.8142C46.7906 46.9595 46.2092 47.6255 46.1859 48.7759C46.1743 49.6598 46.1859 50.5438 46.1859 51.4399C46.1743 51.6215 46.1743 51.8274 46.1743 52.0816Z" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/clients/emoon.svg b/packages/website/public/images/clients/emoon.svg
new file mode 100644
index 000000000..1b14c41b0
--- /dev/null
+++ b/packages/website/public/images/clients/emoon.svg
@@ -0,0 +1,8 @@
+<svg width="56" height="57" viewBox="0 0 56 57" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M45.9154 25.5331C40.1112 25.5331 34.2797 25.5331 28.2302 25.5331C28.2302 29.7282 28.2302 33.7069 28.2302 37.6585C23.2979 38.281 14.7414 34.9519 10.9537 27.0487C7.1932 19.1727 9.50944 9.34786 16.4309 4.01594C23.5432 -1.47838 33.6802 -1.37011 40.6562 4.55725C46.9509 9.8621 48.9129 18.9832 45.9154 25.5331ZM16.5672 18.5772C24.3607 18.5772 31.9907 18.5772 39.8114 18.5772C39.6479 14.7068 38.0402 11.7296 35.0699 9.61851C31.1732 6.83076 26.9494 6.50597 22.6712 8.83361C18.8562 10.8635 16.9759 14.1655 16.5672 18.5772Z" fill="white"/>
+<path d="M8.85624 52.382H2.86125C3.13375 53.3564 3.84225 53.8977 4.82324 53.8977C5.55899 53.8977 6.26749 53.6 6.83974 53.0316L8.31124 54.4931C7.43924 55.4675 6.13124 56.0088 4.55074 56.0088C1.71675 56.0088 0 54.2766 0 51.6783C0 49.0259 1.7985 47.2666 4.49624 47.2666C7.52099 47.2396 9.04699 49.2424 8.85624 52.382ZM6.10399 50.8663C6.10399 49.892 5.47724 49.2153 4.49624 49.2153C3.56975 49.2153 2.97025 49.892 2.7795 50.8663H6.10399Z" fill="white"/>
+<path d="M24.9048 50.4874V55.8734H22.0708V51.2723C22.0708 50.2979 21.5258 49.7025 20.6538 49.7025C19.6456 49.7296 19.0188 50.5145 19.0188 51.6241V55.8464H16.1848V51.2452C16.1848 50.2709 15.6398 49.6754 14.7678 49.6754C13.7596 49.7025 13.1328 50.4874 13.1328 51.5971V55.8193H10.2988V47.2666H13.1328V48.674C13.7323 47.6726 14.6861 47.1583 15.9396 47.1583C17.3293 47.1583 18.3921 47.862 18.8008 49.08C19.3458 47.8079 20.4086 47.1583 21.8256 47.1583C23.6786 47.2125 24.9048 48.4845 24.9048 50.4874Z" fill="white"/>
+<path d="M35.5633 51.5971C35.5633 54.2495 33.683 55.9817 30.849 55.9817C28.015 55.9817 26.1348 54.2495 26.1348 51.5971C26.1348 48.9717 27.9878 47.2395 30.849 47.2395C33.7103 47.2395 35.5633 48.9717 35.5633 51.5971ZM28.996 51.6512C28.996 52.9233 29.759 53.7894 30.849 53.7894C31.9663 53.7894 32.702 52.9233 32.702 51.6512C32.702 50.3791 31.9663 49.5401 30.849 49.5401C29.759 49.513 28.996 50.3791 28.996 51.6512Z" fill="white"/>
+<path d="M45.7254 51.5971C45.7254 54.2495 43.8451 55.9817 41.0111 55.9817C38.1771 55.9817 36.2969 54.2495 36.2969 51.5971C36.2969 48.9717 38.1499 47.2395 41.0111 47.2395C43.8724 47.2395 45.7254 48.9717 45.7254 51.5971ZM39.1581 51.6512C39.1581 52.9233 39.9211 53.7894 41.0111 53.7894C42.1284 53.7894 42.8641 52.9233 42.8641 51.6512C42.8641 50.3791 42.1284 49.5401 41.0111 49.5401C39.9211 49.513 39.1581 50.3791 39.1581 51.6512Z" fill="white"/>
+<path d="M56.0009 50.4874V55.8734H53.1669V51.2723C53.1669 50.2979 52.5946 49.7025 51.6954 49.7025C50.7416 49.7296 50.1149 50.3791 50.0059 51.3264V55.8464H47.1719V47.2937H50.0059V48.674C50.6054 47.6996 51.6136 47.1583 52.8671 47.1583C54.7474 47.2125 56.0009 48.4845 56.0009 50.4874Z" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/clients/ercdex.svg b/packages/website/public/images/clients/ercdex.svg
new file mode 100644
index 000000000..41a0ff3b0
--- /dev/null
+++ b/packages/website/public/images/clients/ercdex.svg
@@ -0,0 +1,16 @@
+<svg width="33" height="48" viewBox="0 0 33 48" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M2.16152 21.0377C2.1613 23.4544 2.16546 25.8711 2.1567 28.288C2.15538 28.6091 2.30283 29.0977 1.96829 29.202C1.56255 29.3284 1.20567 28.9928 0.973885 28.6151C0.501547 27.8461 0.13415 27.0646 0.138093 26.1145C0.159563 20.8668 0.138312 15.619 0.1554 10.3711C0.159344 9.16291 0.21981 9.12677 1.28695 9.63525C5.56493 11.6742 9.8278 13.7439 14.1045 15.7853C14.8239 16.1288 15.429 16.5203 15.5061 17.4008C15.5692 18.1211 15.2474 18.4863 14.5404 18.2975C14.0173 18.1577 13.53 17.8755 13.0349 17.6398C9.74783 16.0747 6.45308 14.5253 3.18462 12.9226C2.34314 12.5098 2.1326 12.6693 2.14772 13.5807C2.18847 16.0659 2.16152 18.552 2.16152 21.0377" fill="white"/>
+<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="17" y="9" width="16" height="27">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M17.5312 9.59204H32.9286V35.2771H17.5312V9.59204Z" fill="white"/>
+</mask>
+<g mask="url(#mask0)">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M17.5488 25.3121C17.5488 22.8275 17.5799 20.3425 17.5324 17.859C17.5151 16.9481 17.689 16.3417 18.6181 15.9169C22.8626 13.9771 27.0738 11.964 31.2972 9.97869C31.7776 9.75281 32.3431 9.27566 32.7512 9.90486C33.1142 10.4646 32.8827 11.0857 32.3961 11.5826C31.9457 12.0431 31.3539 12.2411 30.8019 12.5062C27.5847 14.0499 24.3806 15.6233 21.1266 17.0859C19.8779 17.6472 19.4552 18.3837 19.4885 19.7705C19.5935 24.1157 19.5273 28.4653 19.5269 32.813C19.5269 33.2961 19.5433 33.7802 19.5157 34.262C19.4861 34.7762 19.3181 35.2231 18.7066 35.2735C18.0888 35.3243 17.8479 34.8237 17.6991 34.3967C17.5462 33.9579 17.5569 33.4503 17.5547 32.9727C17.5427 30.4193 17.549 27.8655 17.5488 25.3121" fill="white"/>
+</g>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M31.5424 7.52054C31.5145 7.78979 31.3307 7.86997 31.1704 7.99616C30.3475 8.64508 29.6074 8.1872 28.8704 7.83689C25.6554 6.30837 22.4468 4.7667 19.234 3.23379C18.7406 2.99828 18.2135 2.82477 17.7442 2.55092C16.8795 2.04616 16.1101 2.17651 15.236 2.60963C11.9848 4.22119 8.70081 5.76702 5.42491 7.32841C4.74598 7.65221 4.0493 7.9392 3.35876 8.23825C2.94776 8.41658 2.49054 8.46324 2.28658 8.01237C2.08546 7.56764 2.09423 7.05959 2.6347 6.76033C2.87547 6.62713 3.10594 6.47334 3.35394 6.35635C7.5031 4.39974 11.6597 2.45891 15.7992 0.482144C16.4076 0.191644 16.8819 0.174774 17.5087 0.481487C21.8126 2.58751 26.1438 4.6381 30.4577 6.72396C30.8641 6.92048 31.3794 7.02432 31.5424 7.52054" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M22.7216 31.8144C22.4408 31.7018 22.2732 31.4792 22.2309 31.1979C22.1091 30.3845 22.2666 29.6725 23.0855 29.2807C25.998 27.8867 28.9054 26.482 31.8349 25.1252C32.5575 24.7907 33.0103 25.2308 32.8745 26.0445C32.7674 26.6879 32.4532 27.1876 31.8363 27.4808C28.9196 28.8651 26.0072 30.2585 23.093 31.6481C22.9705 31.7068 22.8452 31.7599 22.7216 31.8144" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M25.3483 10.558C25.2596 10.6741 25.1682 10.8647 25.0184 10.978C24.4579 11.4008 23.8897 11.2926 23.276 11.0323C20.2472 9.74786 17.3273 8.23905 14.3851 6.77538C14.1441 6.65576 13.8244 6.5942 13.8481 6.25374C13.8759 5.85392 14.2457 5.70823 14.5408 5.58007C14.9992 5.38159 15.4555 5.45016 15.9252 5.67756C18.8206 7.07902 21.7311 8.44915 24.6271 9.84973C24.9077 9.98534 25.3097 10.0528 25.3483 10.558" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M7.66389 9.32442C7.61438 8.98528 7.81111 8.88451 7.98747 8.79403C8.5297 8.51645 9.00882 8.23274 9.70572 8.57911C12.5794 10.0066 15.4932 11.3533 18.3824 12.75C18.7121 12.9092 19.278 12.9982 19.0979 13.5603C18.9652 13.9753 18.5588 14.1871 18.1112 14.1615C17.7771 14.1422 17.4173 14.1052 17.1214 13.9656C14.0959 12.5368 11.08 11.0874 8.06546 9.63573C7.89896 9.55555 7.76598 9.40526 7.66389 9.32442" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.4641 44.7585C10.4641 44.1654 10.4604 43.5722 10.4669 42.9791C10.4685 42.8461 10.4249 42.7688 10.3092 42.7046C10.0297 42.5497 9.73455 42.4448 9.42192 42.3834C9.07468 42.3151 8.7213 42.2791 8.37801 42.3609C7.75757 42.5083 7.2653 42.8483 6.95595 43.421C6.63281 44.0189 6.55285 44.6586 6.63062 45.3268C6.70335 45.9525 6.92068 46.5056 7.39609 46.9396C7.87675 47.3785 8.45118 47.5152 9.07556 47.4245C9.54483 47.3561 9.95451 47.1353 10.318 46.8253C10.4264 46.733 10.4685 46.6423 10.4669 46.5032C10.4604 45.9218 10.4641 45.3401 10.4641 44.7585M10.445 42.2412C10.4779 42.1709 10.4641 42.1008 10.4641 42.0329C10.4652 41.1277 10.4687 40.2226 10.4608 39.3176C10.4597 39.1743 10.5024 39.1034 10.6387 39.0795C10.7439 39.0611 10.8378 38.9868 10.9621 39.012V47.7669C10.8004 47.7873 10.6426 47.7816 10.4779 47.7706C10.4409 47.6019 10.4895 47.4332 10.4483 47.2746C10.3703 47.2547 10.3331 47.3079 10.2901 47.3408C9.83423 47.6904 9.32115 47.9032 8.74606 47.9056C7.95365 47.9093 7.27165 47.6348 6.7544 47.0111C6.30616 46.4706 6.11578 45.8353 6.07722 45.1467C6.04392 44.5523 6.11841 43.9733 6.37561 43.4302C6.79931 42.5361 7.49423 42.0033 8.4836 41.8743C9.13164 41.7897 9.74156 41.9192 10.3208 42.2123C10.3552 42.2296 10.3865 42.2621 10.445 42.2412" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M13.9915 39.773C14.0598 39.747 14.1181 39.7544 14.1753 39.7544C15.5701 39.754 16.9648 39.754 18.3595 39.7542C18.5547 39.7542 18.5562 39.7548 18.5547 39.9542C18.554 40.0458 18.5667 40.1387 18.5418 40.2296C18.4819 40.2646 18.4169 40.2478 18.3551 40.2478C17.1449 40.2489 15.9345 40.2486 14.7243 40.2486C14.5216 40.2486 14.5218 40.2491 14.5218 40.4577C14.5218 41.4258 14.5218 42.3941 14.5216 43.3624C14.5216 43.527 14.5216 43.5274 14.6921 43.5274C15.6891 43.5276 16.6861 43.5274 17.6832 43.5276C17.8858 43.5276 17.8858 43.5281 17.8856 43.7362C17.8856 43.8216 17.8856 43.9066 17.8856 43.9798C17.8335 44.03 17.7848 44.0118 17.741 44.0118C16.7324 44.0129 15.7237 44.0124 14.7151 44.0127C14.5216 44.0127 14.5218 44.0131 14.5218 44.2118C14.5218 45.1801 14.5216 46.1483 14.5225 47.1166C14.5225 47.167 14.5076 47.22 14.5446 47.2853H18.5332C18.5713 47.4511 18.5549 47.6025 18.5457 47.7653H13.9915V39.773Z" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M20.6225 39.7707C20.8164 39.7411 20.9831 39.7597 21.1489 39.7547C21.235 39.752 21.2644 39.8219 21.3027 39.8765C21.6811 40.4132 22.0579 40.9506 22.4354 41.4878C22.8323 42.0533 23.2298 42.6185 23.6267 43.1839C23.6532 43.2216 23.6754 43.2624 23.7214 43.2856C23.7959 43.2464 23.8292 43.1695 23.8743 43.1053C24.6264 42.0359 25.3781 40.9664 26.1251 39.8938C26.2428 39.7271 26.2666 39.7562 26.3922 39.7518C26.5499 39.7463 26.6875 39.7463 26.8198 39.7463C26.7738 39.8302 26.7526 39.8727 26.7219 39.9155C25.8697 41.097 25.0161 42.2774 24.1639 43.4591C24.0088 43.6742 24.0046 43.6085 24.1694 43.8361C25.074 45.0864 25.9814 46.3345 26.8871 47.5842C26.9237 47.6348 26.9721 47.6784 26.9968 47.7743C26.7981 47.7743 26.6071 47.7791 26.4167 47.7697C26.3852 47.7682 26.3532 47.7077 26.3269 47.6705C25.5531 46.5814 24.7804 45.4919 24.0071 44.4027C23.9111 44.2675 23.814 44.1336 23.7205 44.0033C23.6397 44.0173 23.6215 44.0784 23.5897 44.1236C22.76 45.2998 21.9299 46.4758 21.104 47.6549C21.0403 47.7461 20.9756 47.7866 20.8641 47.7787C20.7226 47.7686 20.5795 47.7763 20.4211 47.7763C20.4389 47.6884 20.4891 47.64 20.527 47.5874C21.4258 46.3472 22.3267 45.1083 23.2245 43.8675C23.4263 43.5888 23.4116 43.6801 23.2262 43.4199C22.404 42.2664 21.5779 41.1156 20.7537 39.9637C20.7138 39.9078 20.6766 39.8502 20.6225 39.7707" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/clients/godsUnchained.svg b/packages/website/public/images/clients/godsUnchained.svg
new file mode 100644
index 000000000..f039b00f9
--- /dev/null
+++ b/packages/website/public/images/clients/godsUnchained.svg
@@ -0,0 +1,16 @@
+<svg width="64" height="56" viewBox="0 0 64 56" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M49.6638 13.9894C49.7509 13.7863 49.7654 13.5106 49.6929 13.3075C49.3011 12.1903 48.8948 11.0875 48.4741 9.98483C48.4015 9.7962 48.2564 9.56405 48.0823 9.50602C46.7765 9.0127 45.4706 8.54839 44.1503 8.06958C43.7585 7.92449 43.1491 7.44568 42.975 6.90883C42.4382 5.24024 41.9884 4.05047 41.437 2.38189C41.3209 2.01915 41.1033 1.83053 40.7551 1.71446C39.6669 1.3227 38.5641 0.945456 37.4904 0.510173C36.9536 0.292532 36.4893 0.33606 35.967 0.568211C34.7772 1.10506 33.5729 1.61289 32.3686 2.0917C32.122 2.19327 31.7447 2.17876 31.4981 2.07719C30.0036 1.45329 28.4946 0.800362 27.0001 0.118419C26.6229 -0.0556942 26.3327 -0.0266754 25.9845 0.132928C24.9253 0.59723 23.8516 1.03251 22.8069 1.52583C22.5748 1.6274 22.3571 1.87406 22.241 2.10621C21.5881 3.48461 20.9642 4.863 20.3693 6.2559C20.1952 6.67668 19.9486 6.90883 19.5278 7.06843C18.2655 7.53273 17.0177 8.05507 15.7408 8.51937C15.291 8.67898 15.0154 8.92564 14.8412 9.37543C14.4495 10.3911 13.9852 11.3632 13.6079 12.3789C13.5064 12.6401 13.5064 12.9883 13.5934 13.264C14.0142 14.4392 14.493 15.6 14.9138 16.7897C15.0008 17.0364 15.0008 17.3556 14.9138 17.6023C14.2899 19.1548 13.637 20.7073 12.955 22.2598C12.8099 22.579 12.8244 22.8257 12.955 23.1449C13.4483 24.3492 13.9271 25.5679 14.3624 26.7867C14.493 27.164 14.7107 27.3526 15.0879 27.4977C16.5098 28.0491 17.9172 28.6294 19.3101 29.2388C19.5858 29.3549 19.847 29.6451 19.9631 29.9208C20.5725 31.4152 21.1383 32.9387 21.7042 34.4477C21.8493 34.8395 22.0814 35.0861 22.4732 35.2312C23.3583 35.5649 24.2143 35.9277 25.0849 36.3049C25.5347 36.4935 25.9555 36.5081 26.4052 36.3049C27.7111 35.7245 29.0169 35.1587 30.3373 34.6218C30.5695 34.5203 30.9177 34.4767 31.1353 34.5783C32.6733 35.2312 34.1823 35.9277 35.7058 36.6096C35.8944 36.6967 36.112 36.7547 36.2717 36.8127C36.4603 36.7547 36.6054 36.7402 36.736 36.6822C37.6936 36.2904 38.6512 35.8696 39.6088 35.4924C40.0151 35.3328 40.2763 35.0861 40.4504 34.6799C41.0017 33.3885 41.5966 32.1262 42.1335 30.8349C42.3076 30.4141 42.5542 30.1819 42.975 30.0223C44.484 29.4275 45.7898 28.8035 47.2988 28.2087C47.6761 28.0636 47.9517 27.8604 48.1113 27.4542C48.4741 26.5546 49.1125 25.684 49.4027 24.7699C49.5333 24.3492 49.5042 23.8123 49.3446 23.3915C48.9094 22.2163 48.387 21.07 47.8792 19.9238C47.647 19.4014 47.6325 18.9371 47.8647 18.4003C48.4886 16.9494 49.0835 15.4694 49.6638 13.9894ZM35.227 2.23679C35.8509 1.99013 36.3442 2.17876 36.9681 2.3964C37.7516 2.67208 38.5496 2.90423 39.3477 3.19442C39.5073 3.25245 39.6959 3.39755 39.7684 3.55715C40.0006 4.03596 40.3488 5.03711 40.3488 5.03711C40.3488 5.03711 41.1468 7.05392 41.1323 7.11196C40.8856 7.06843 38.0998 5.84964 36.9681 5.37083C36.823 5.31279 36.5909 5.31279 36.4313 5.38534C35.5027 5.82062 30.1777 7.90998 30.1777 7.90998C30.1777 7.90998 29.6844 8.62094 29.4087 9.07073C29.4087 9.07073 29.1185 9.62209 29.0024 9.9413C28.6542 10.8554 28.277 11.7695 27.9142 12.6691L26.3907 16.3109C25.6072 18.1681 24.7947 20.0253 24.0112 21.8971C23.9386 22.0857 23.8081 22.2453 23.7065 22.4194C23.6485 22.4049 23.6049 22.4049 23.5469 22.3904C23.4598 22.0276 23.4018 21.6504 23.2567 21.3167C23.0826 20.8814 22.8214 20.5042 22.6183 20.0834C22.2556 19.3289 21.8058 18.6324 22.212 17.6893C23.7936 13.9314 25.3461 10.1589 26.8695 6.37198C27.0872 5.83513 27.4064 5.51592 27.9432 5.29828C30.3373 4.36968 32.8329 3.20893 35.227 2.23679ZM30.0906 10.3911C32.4992 11.4067 34.8207 12.3789 37.1712 13.3655L35.7783 16.6882L28.6687 13.7283L29.9455 10.6523C30.0181 10.5652 30.0471 10.4781 30.0906 10.3911ZM34.7627 19.1548L34.3709 20.0834C34.2548 20.301 34.1388 20.5042 34.0952 20.7363L33.8776 21.2732L26.768 18.3132L28.1174 15.0921L35.227 18.0521L35.1544 18.2117C35.0238 18.5309 34.8933 18.8501 34.7627 19.1548ZM24.9253 22.7386L26.1731 19.7497C28.5381 20.7508 30.8451 21.7229 33.2247 22.7096C32.7459 23.8558 32.3106 24.886 31.8463 25.9887C31.6286 25.9307 31.3239 25.8872 31.0483 25.7711C29.2346 25.0021 27.4209 24.2041 25.6072 23.4206C25.1429 23.2319 24.9398 23.0433 24.9253 22.7386ZM19.847 11.2617C21.0077 8.72251 22.0669 6.12532 23.1551 3.54264C23.3873 2.97678 23.8806 2.78815 24.3739 2.61404C24.4755 2.58502 25.6798 1.88857 26.5649 1.71446C27.0292 1.6274 27.2178 1.85955 27.5515 1.99013C28.2479 2.28032 28.9299 2.58502 29.6118 2.88972C29.6989 2.91874 29.7569 2.99128 29.9601 3.13638C29.0605 3.52813 27.4354 4.21008 27.4354 4.21008C27.4354 4.21008 26.5358 4.60183 26.3472 4.81947C25.999 5.21123 25.5782 5.76258 25.4186 6.19787C24.1128 9.57856 22.6908 12.9157 21.3124 16.2674C21.2979 16.3109 21.2399 16.3254 21.1383 16.427C20.9497 16.0933 20.7611 15.7886 20.6015 15.4549C20.3548 14.918 20.0936 14.3667 19.905 13.8008C19.7744 13.4091 19.5568 12.7416 19.5133 12.3354C19.4697 11.9001 19.6293 11.7405 19.847 11.2617ZM15.262 12.9302C15.5087 12.495 16.031 11.5083 16.031 11.5083C16.031 11.5083 16.4518 10.4636 16.7275 10.0574C16.9306 9.75268 17.7141 9.53503 17.7141 9.53503C17.7141 9.53503 19.2086 8.88211 19.5423 8.63545C19.4262 8.96917 19.2666 9.43347 19.0925 9.89777C18.8458 10.5217 18.6137 11.1601 18.3235 11.7695C18.1349 12.1612 18.1784 12.4804 18.3525 12.8722C19.8035 16.3254 21.2399 19.7787 22.6763 23.2319C22.7344 23.377 22.7779 23.5511 22.8359 23.7398C22.241 23.8994 22.212 23.8413 21.3995 23.3915C21.2979 23.3335 19.4552 22.7096 18.6862 22.4049C18.5121 22.3323 18.3235 22.1002 18.309 21.9261C18.251 20.9975 17.7431 20.2575 17.3949 19.445C17.0757 18.6905 16.829 17.9215 16.5098 17.1815C16.0455 16.1368 15.7698 15.0341 15.32 13.9894C15.0879 13.5541 15.0444 13.293 15.262 12.9302ZM18.8168 27.2075C17.9898 26.8593 15.6247 25.9887 15.6247 25.9887L14.522 23.2755C14.4495 23.1013 14.464 22.8982 14.5656 22.7241C15.0008 21.9696 16.0455 19.5465 16.1906 19.3869C16.4663 19.9963 17.2643 22.0131 17.511 22.608C17.6851 23.0433 17.9608 23.3045 18.396 23.4931C21.7767 24.857 25.1429 26.2499 28.5091 27.6428C28.7268 27.7298 28.9154 27.8459 29.2781 28.0345C28.9009 28.1942 28.6687 28.3102 28.4366 28.3973C27.537 28.76 26.6519 29.1228 25.7523 29.5C25.23 29.7322 24.7512 29.6886 24.2143 29.4565C22.4297 28.6875 20.616 27.962 18.8168 27.2075ZM28.9299 33.2144C28.3205 33.4756 25.8394 34.5058 25.7233 34.4767C25.5492 34.4332 22.9665 33.7513 22.7489 33.5336C22.6618 33.4466 21.472 29.8627 21.1528 29.6451C21.1964 29.5725 22.4732 30.1384 22.5022 30.0659C23.2277 30.3561 23.9677 30.6317 24.6786 30.9655C25.0994 31.1686 25.4621 31.1831 25.9119 30.98C27.8127 30.1384 29.7279 29.3404 31.6431 28.5424C32.151 28.3392 32.4992 28.0781 32.7168 27.5122C32.949 26.8883 33.1957 26.2644 33.4423 25.6405H33.4568L38.361 13.9024C38.4045 13.9459 38.4626 14.0039 38.5351 14.062C38.5496 14.0765 38.5641 14.091 38.5641 14.1055L40.1312 17.907C40.1602 18.1391 40.1457 18.4003 40.0731 18.6034C38.5061 22.4194 36.8956 26.2209 35.3285 30.0514C35.1254 30.5302 34.8497 30.8349 34.3564 31.0235C32.5427 31.7345 30.7291 32.4599 28.9299 33.2144ZM42.5107 24.7554C41.5821 27.0044 39.5218 33.1419 38.7092 33.5917C37.8242 34.085 35.8219 35.1732 35.8219 35.1732C35.8219 35.1732 32.92 33.8964 32.4121 33.6207C32.3106 33.5626 32.1945 33.5191 32.0059 33.4321C32.1945 33.3015 32.2961 33.1854 32.4267 33.1274C33.5294 32.6485 34.6321 32.1552 35.7493 31.6909C36.112 31.5458 36.3297 31.3427 36.4748 30.9655C37.592 28.1361 38.7528 25.3213 39.8845 22.4919C40.0296 22.1292 40.1602 21.7665 40.3053 21.4183C40.2908 21.4473 40.2617 21.4763 40.2472 21.5053L40.9002 19.8222C40.9582 19.9093 42.1625 22.7966 42.1625 22.7966C42.2786 23.1013 42.3946 23.406 42.4672 23.7252C42.5687 24.059 42.6268 24.4652 42.5107 24.7554ZM47.4729 24.059C47.1392 24.7554 46.2832 26.7867 46.2832 26.7867C46.2832 26.7867 43.4683 28.0781 42.7429 28.1942C42.975 27.5702 43.6715 25.1762 43.9762 24.5523C44.2373 24.0009 44.0487 23.5947 43.7585 23.1739L39.3477 12.4514C39.5653 12.4659 39.7829 12.5675 40.0006 12.6546C41.0453 13.0753 42.0899 13.5251 43.1491 13.9459C43.5409 14.1055 43.773 14.3522 43.9181 14.7439C44.8903 17.167 45.8769 19.5756 46.878 21.9841C47.1392 22.608 47.7776 23.4206 47.4729 24.059ZM46.5298 15.658C46.3412 16.1513 46.022 17.2686 45.9639 17.2831C45.8479 17.138 44.9048 14.8745 44.4985 13.8734C44.3389 13.4671 44.0777 13.2204 43.6715 13.0463C40.3778 11.7114 37.0987 10.3766 33.8196 9.0272C33.5004 8.89662 33.1811 8.72251 32.8764 8.5629C32.8764 8.47585 32.8764 8.38879 32.8619 8.30173C34.2984 7.72136 35.7348 7.12647 37.1857 6.5606C37.3018 6.51707 37.4759 6.60413 37.6065 6.64766C39.7974 7.57626 42.0319 8.46134 44.1793 9.50602C44.8177 9.81071 45.8624 10.0138 46.4282 10.5942C46.8925 11.073 47.5455 13.2785 47.5455 13.2785C47.5455 13.2785 46.6314 15.3823 46.5298 15.658Z" fill="white"/>
+<path d="M0 55.3291V46.5164L0.638921 45.8995H3.15054L3.76743 46.5164V47.7943L3.92165 48.4112H2.3574L2.53365 47.7943V47.2875L2.37943 47.1333H1.41003L1.27784 47.2875V54.536L1.43206 54.6902H2.40146L2.55568 54.536V52.1786H2.15911L1.8727 50.9007H3.89962L3.7454 51.5397V55.3291L3.12851 55.946H0.638921L0 55.3291Z" fill="white"/>
+<path d="M8.61313 46.5164V55.3291L7.99624 55.946H5.46259L4.8457 55.3291V46.5164L5.46259 45.8995H7.97421L8.61313 46.5164ZM7.18107 47.1774H6.2337L6.07948 47.3316V54.558L6.2337 54.7122H7.18107L7.33529 54.558V47.3096L7.18107 47.1774Z" fill="white"/>
+<path d="M9.51758 45.8995H12.8003L13.4392 46.5164V55.3291L12.8003 55.946H9.51758L9.6718 55.3291V46.5164L9.51758 45.8995ZM10.9276 54.536L11.0818 54.6902H12.0512L12.2055 54.536V47.2875L12.0512 47.1333H11.0818L10.9276 47.2875V54.536Z" fill="white"/>
+<path d="M18.4182 48.4112H16.854L17.0082 47.7943V47.3096L16.854 47.1553H15.8846L15.7303 47.3096V50.1517L15.8846 50.3059H17.6251L18.242 50.9228V55.3291L17.6251 55.946H15.1135L14.4745 55.3291V54.0513L14.3203 53.4564H15.8846L15.7303 54.0513V54.536L15.8846 54.6902H16.854L17.0082 54.536V51.6939L16.854 51.5397H15.1135L14.4745 50.9007V46.4944L15.1135 45.8995H17.6251L18.242 46.5164V47.7943L18.4182 48.4112Z" fill="white"/>
+<path d="M26.1072 46.5164V55.3291L25.4683 55.946H22.9567L22.3398 55.3291V46.5164L22.1855 45.8995H23.7498L23.5735 46.5164V54.536L23.7278 54.6902H24.6972L24.8514 54.536V46.5164L24.6972 45.8995H26.2614L26.1072 46.5164Z" fill="white"/>
+<path d="M28.6404 55.946H27.0762L27.2304 55.3291V46.5164L27.0762 45.8995H28.4862L30.0505 51.804V46.5164L29.8962 45.8995H31.4605L31.3063 46.5164V55.3291L31.4605 55.946H30.0505L28.4862 50.0415V55.3512L28.6404 55.946Z" fill="white"/>
+<path d="M32.3652 55.3291V46.5164L33.0042 45.8995H35.5158L36.1327 46.5164V47.7943L36.2869 48.4112H34.7226L34.8989 47.7943V47.2875L34.7447 47.1333H33.7753L33.621 47.2875V54.536L33.7753 54.6902H34.7447L34.8989 54.536V54.0513L34.7226 53.4344H36.2869L36.1327 54.0513V55.3291L35.5158 55.946H33.0042L32.3652 55.3291Z" fill="white"/>
+<path d="M37.0787 45.8995H38.6429L38.4887 46.5164V50.1517L38.6429 50.3059H39.6123L39.7665 50.1517V46.5164L39.5903 45.8995H41.1545L41.0003 46.5164V55.3291L41.1545 55.946H39.5903L39.7445 55.3291V51.6939L39.5903 51.5397H38.6209L38.4667 51.6939V55.3291L38.6209 55.946H37.0566L37.2109 55.3291V46.5164L37.0787 45.8995Z" fill="white"/>
+<path d="M46.7068 55.946H45.1426L45.2527 55.5274L44.9223 53.6106L44.746 53.4344H43.6444L43.4682 53.6106L43.1597 55.5274L43.2478 55.946H41.6836L41.97 55.0868L43.4461 46.4724L43.3139 45.8995H45.0324L44.9002 46.4724L46.3984 55.0868L46.7068 55.946ZM43.8427 52.1566H44.5257L44.6579 52.0464L44.1952 49.3585L43.7105 52.0684L43.8427 52.1566Z" fill="white"/>
+<path d="M48.8006 55.946H47.2363L47.3906 55.3291V46.5164L47.2363 45.8995H48.8006L48.6464 46.5164V55.3291L48.8006 55.946Z" fill="white"/>
+<path d="M51.1795 55.946H49.6152L49.7695 55.3291V46.5164L49.6152 45.8995H51.0253L52.5895 51.804V46.5164L52.4353 45.8995H53.9996L53.8453 46.5164V55.3291L53.9996 55.946H52.5895L51.0253 50.0415V55.3512L51.1795 55.946Z" fill="white"/>
+<path d="M54.8164 55.946L54.9706 55.3291V46.5164L54.8164 45.8995H58.5838L58.8042 47.2875L58.1652 47.1333H56.3586L56.2044 47.2875V50.1517L56.3586 50.3059H56.8654L57.4822 50.1517V51.7159L56.8654 51.5617H56.3586L56.2044 51.7159V54.558L56.3586 54.7122H58.1652L58.8042 54.558L58.5838 55.968H54.8164V55.946Z" fill="white"/>
+<path d="M59.3965 45.8995H62.6792L63.3181 46.5164V55.3291L62.6792 55.946H59.3965L59.5507 55.3291V46.5164L59.3965 45.8995ZM60.8065 54.536L60.9607 54.6902H61.9301L62.0844 54.536V47.2875L61.9081 47.1333H60.9387L60.8065 47.2875V54.536Z" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/clients/instex.svg b/packages/website/public/images/clients/instex.svg
new file mode 100644
index 000000000..c92033b93
--- /dev/null
+++ b/packages/website/public/images/clients/instex.svg
@@ -0,0 +1,40 @@
+<svg width="43" height="55" viewBox="0 0 43 55" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M5.36442 47.6098C5.31169 47.7017 5.33806 47.7804 5.33806 47.8461C5.33806 49.9726 5.33806 52.0859 5.33806 54.2124C5.33806 54.3831 5.29851 54.4356 5.12714 54.4224C4.77122 54.4093 4.4153 54.4093 4.05938 54.4224C3.88801 54.4224 3.83529 54.3699 3.83529 54.1993C3.84847 53.2804 3.83529 52.3616 3.83529 51.4427C3.83529 49.0406 3.83529 46.6516 3.83529 44.2494C3.83529 44.1706 3.80892 44.0919 3.87483 44C6.23444 46.4547 8.59406 48.9093 10.9932 51.4033C10.9932 51.2721 10.9932 51.2064 10.9932 51.1277C10.9932 49.0406 10.9932 46.9535 10.9932 44.8663C10.9932 44.6957 11.0459 44.6301 11.2041 44.6432C11.5732 44.6432 11.9292 44.6432 12.2983 44.6432C12.4169 44.6432 12.496 44.6563 12.496 44.827C12.496 48.1874 12.496 51.5346 12.496 54.895C12.496 54.9081 12.496 54.9344 12.4828 55C10.0836 52.5191 7.73721 50.0644 5.36442 47.6098Z" fill="#FBFBFB"/>
+<path d="M28.9219 49.5394C28.9219 47.9774 28.9219 46.4285 28.9219 44.8664C28.9219 44.6826 28.9746 44.6301 29.146 44.6301C30.8069 44.6301 32.4547 44.6301 34.1157 44.6301C34.2738 44.6301 34.3661 44.6695 34.3529 44.8533C34.3398 45.1289 34.3529 45.4046 34.3529 45.6934C34.3529 46.0478 34.3529 46.0478 34.0102 46.0478C32.9029 46.0478 31.8088 46.0478 30.7015 46.0478C30.3851 46.0478 30.4378 46.0215 30.4378 46.3234C30.4378 46.9273 30.451 47.5442 30.4378 48.148C30.4378 48.3449 30.4906 48.3712 30.6751 48.3712C31.7956 48.358 32.9161 48.3712 34.0497 48.3581C34.2211 48.3581 34.2738 48.4106 34.2607 48.5681C34.2475 48.8962 34.2475 49.2113 34.2607 49.5394C34.2738 49.7101 34.2211 49.7626 34.0497 49.7626C32.9161 49.7495 31.7956 49.7626 30.6619 49.7495C30.4774 49.7495 30.4378 49.802 30.4378 49.9726C30.451 50.9177 30.451 51.8628 30.4378 52.8079C30.4378 52.9917 30.4906 53.018 30.6487 53.018C31.822 53.0048 32.982 53.018 34.1552 53.0048C34.3134 53.0048 34.3661 53.0442 34.3661 53.2017C34.3529 53.5561 34.3529 53.8974 34.3661 54.2518C34.3661 54.37 34.3266 54.4094 34.2079 54.4094C32.4942 54.4094 30.7937 54.4094 29.0801 54.4094C28.9087 54.4094 28.9351 54.3175 28.9351 54.2125C28.9219 52.6635 28.9219 51.1015 28.9219 49.5394Z" fill="#FCFCFC"/>
+<path d="M35.3016 54.4094C35.2884 54.2125 35.4466 54.1075 35.5257 53.9762C35.7629 53.5299 36.0134 53.0968 36.2902 52.6767C36.5275 52.3223 36.7252 51.9416 36.9625 51.5741C37.1602 51.259 37.358 50.9309 37.5425 50.6158C37.7534 50.2614 37.9644 49.907 38.1885 49.5526C38.2939 49.382 38.3071 49.2376 38.2016 49.0538C37.9907 48.7256 37.7666 48.3843 37.5953 48.0299C37.4107 47.6493 37.1866 47.2948 36.9757 46.9404C36.7516 46.5729 36.5539 46.2053 36.3298 45.8378C36.1057 45.4571 35.8552 45.0896 35.6707 44.6695C35.7366 44.6039 35.8157 44.6302 35.8816 44.6302C36.2375 44.6302 36.5934 44.6433 36.9493 44.6302C37.2393 44.617 37.4107 44.7089 37.5425 44.9583C37.793 45.4834 38.1094 45.9559 38.3862 46.4679C38.6235 46.901 38.8871 47.3211 39.098 47.7674C39.1244 47.8199 39.1903 47.8199 39.1903 47.8855C39.4012 47.7018 39.4803 47.4524 39.6253 47.2292C39.8758 46.8485 40.0867 46.4416 40.3372 46.0478C40.4822 45.8378 40.5876 45.5884 40.7194 45.3652C40.8381 45.1552 40.9963 44.9583 41.1017 44.7483C41.1676 44.6302 41.2467 44.617 41.3522 44.617C41.7872 44.617 42.2222 44.617 42.6572 44.617C42.7231 44.617 42.8022 44.6039 42.8286 44.6695C42.8681 44.7483 42.7759 44.7746 42.7363 44.8271C42.5781 45.1027 42.4068 45.3652 42.2486 45.6409C42.0772 45.9034 41.919 46.1791 41.7608 46.4547C41.5499 46.8092 41.3258 47.1505 41.1281 47.5049C40.9831 47.7674 40.8249 48.0037 40.6667 48.2531C40.469 48.5812 40.2581 48.8963 40.0735 49.2244C39.9944 49.382 40.1526 49.5132 40.2317 49.6182C40.4162 49.8939 40.5481 50.1958 40.7326 50.4715C40.8908 50.734 41.049 50.9965 41.194 51.2722C41.4181 51.6791 41.6686 52.0729 41.9058 52.4667C42.1431 52.8736 42.3936 53.2936 42.6177 53.7137C42.7363 53.9368 42.9209 54.1206 43 54.3831C42.4595 54.3831 41.9454 54.3831 41.4445 54.3831C41.2335 54.3831 41.2467 54.1994 41.194 54.0944C40.9172 53.5956 40.6272 53.1099 40.3503 52.6111C40.034 52.0466 39.678 51.4953 39.3749 50.9178C39.2299 50.6421 39.1903 50.6421 39.0321 50.9046C38.6762 51.4953 38.3466 52.0991 37.9775 52.6898C37.648 53.228 37.3052 53.7531 37.0152 54.3175C36.9757 54.3963 36.9098 54.3831 36.8439 54.3831C36.3298 54.4094 35.8288 54.4094 35.3016 54.4094Z" fill="#FCFCFC"/>
+<path d="M15.833 51.4034C15.9385 51.7315 15.978 52.0991 16.1362 52.4141C16.3076 52.7554 16.5844 52.9917 16.9535 53.123C17.1908 53.2017 17.4412 53.2542 17.6917 53.228C18.1267 53.1886 18.4958 53.0048 18.7858 52.6635C19.1154 52.2829 19.2076 51.8366 19.1549 51.3771C19.1154 51.049 18.9835 50.7602 18.7199 50.5239C18.4035 50.2351 18.0344 50.0514 17.6521 49.8938C17.0853 49.6576 16.5185 49.4607 16.0044 49.1194C15.5957 48.8437 15.2398 48.5024 15.0157 48.043C14.8575 47.728 14.8048 47.3998 14.8048 47.0848C14.8048 46.7697 14.8048 46.4284 14.9893 46.1397C15.1212 45.9034 15.2266 45.6409 15.4243 45.4571C15.7539 45.142 16.0966 44.8664 16.5317 44.7089C16.848 44.5776 17.1776 44.5514 17.5203 44.4988C17.8631 44.4463 18.2058 44.4988 18.5353 44.5645C18.799 44.617 19.0626 44.7483 19.2867 44.8926C19.5504 45.0633 19.7877 45.2602 19.9854 45.5096C20.1172 45.6802 20.249 45.864 20.3677 46.0478C20.4336 46.1397 20.3413 46.179 20.2886 46.2053C20.1568 46.2972 20.0249 46.3891 19.8667 46.4547C19.6954 46.5203 19.5636 46.6516 19.4054 46.7304C19.2076 46.8222 19.1681 46.8354 19.0758 46.6516C18.9308 46.3759 18.7067 46.179 18.4431 46.0215C18.2453 45.9034 18.0212 45.9296 17.8103 45.9034C17.3094 45.864 16.8744 46.0215 16.558 46.4284C16.1626 46.9272 16.268 47.5048 16.7557 47.8724C17.0194 48.0824 17.3226 48.2136 17.6258 48.3318C18.0081 48.4762 18.364 48.6731 18.7463 48.8175C19.1813 48.9881 19.5372 49.2506 19.8667 49.5657C20.3018 49.9857 20.5522 50.4845 20.6313 51.1015C20.6972 51.5215 20.6445 51.9284 20.5654 52.3222C20.4599 52.9129 20.1436 53.4117 19.6822 53.8187C19.4317 54.0418 19.1549 54.2125 18.8649 54.37C18.7331 54.4487 18.5881 54.4881 18.4563 54.5144C17.784 54.6588 17.1117 54.685 16.4394 54.475C15.688 54.2387 15.1475 53.753 14.7784 53.0704C14.5675 52.6898 14.4357 52.2697 14.3698 51.8366C14.3566 51.7709 14.3961 51.7447 14.4357 51.7447C14.528 51.7315 14.6202 51.679 14.7125 51.6659C15.0157 51.6397 15.2925 51.5084 15.5957 51.5084C15.688 51.469 15.7407 51.3771 15.833 51.4034Z" fill="#FCFCFC"/>
+<path d="M25.3497 50.2351C25.3497 51.5608 25.3497 52.8866 25.3497 54.2124C25.3497 54.3699 25.3101 54.4224 25.152 54.4224C24.7829 54.4093 24.4269 54.4093 24.0578 54.4224C23.8997 54.4224 23.8337 54.383 23.8337 54.2124C23.8469 52.5453 23.8337 50.8783 23.8337 49.2112C23.8337 48.2267 23.8337 47.2422 23.8337 46.2577C23.8337 46.1002 23.7942 46.0477 23.6228 46.0477C23.0164 46.0608 22.4101 46.0477 21.8169 46.0477C21.5796 46.0477 21.5664 46.0346 21.5664 45.7983C21.5664 45.4702 21.5664 45.142 21.5664 44.8138C21.5664 44.6957 21.6191 44.6563 21.7246 44.6432C21.7773 44.6432 21.8301 44.6432 21.8828 44.6432C23.6887 44.6432 25.4947 44.6432 27.3007 44.6432C27.6039 44.6432 27.6038 44.6432 27.6038 44.9582C27.6038 45.247 27.5907 45.5358 27.6038 45.8246C27.617 46.0083 27.5248 46.0609 27.3666 46.0609C26.7734 46.0609 26.1802 46.0609 25.6002 46.0609C25.3497 46.0609 25.3497 46.0608 25.3497 46.3103C25.3497 47.6098 25.3497 48.9224 25.3497 50.2351Z" fill="#FBFBFB"/>
+<path d="M0 49.5394C0 47.9905 0 46.4416 0 44.8795C0 44.6301 0 44.6301 0.263644 44.6301C0.606381 44.6301 0.935936 44.6301 1.27867 44.6301C1.43686 44.6301 1.51595 44.6826 1.51595 44.8664C1.51595 47.9774 1.51595 51.0884 1.51595 54.1993C1.51595 54.37 1.47641 54.4225 1.30504 54.4225C0.949118 54.4094 0.606381 54.4094 0.250462 54.4225C0.065911 54.4225 0 54.3831 0 54.1731C0.0131822 52.6373 0 51.0884 0 49.5394Z" fill="#FBFBFB"/>
+<path opacity="0.5" d="M37.9992 14.1879C37.9992 19.2408 37.9992 24.3186 37.9752 29.3715C37.9752 29.5458 38.0232 29.7449 37.9033 29.8943C37.8314 29.8445 37.7595 29.7698 37.6636 29.72C36.8724 29.2471 36.0572 28.7741 35.266 28.2763C34.5227 27.8283 33.7795 27.3802 33.0362 26.9322C32.5567 26.6584 32.0772 26.3846 31.6217 26.0859C31.1661 25.7872 30.6866 25.5383 30.2311 25.2396C29.8954 25.0156 29.5118 24.8413 29.1522 24.6173C28.337 24.0946 27.4739 23.6217 26.6587 23.099C26.2751 22.8749 25.8435 22.7505 25.5318 22.3771C25.5078 22.3771 25.5078 22.3771 25.4839 22.3771C25.5558 22.2776 25.6277 22.1531 25.6757 22.0535C25.6997 22.0286 25.6997 22.0038 25.7236 21.954C25.7476 21.9291 25.7716 21.9042 25.7956 21.8544C26.0113 21.5059 26.1792 21.257 26.2751 21.0828C26.299 21.0579 26.299 21.033 26.323 21.0081C26.347 20.9583 26.371 20.9334 26.371 20.9085C26.347 20.9085 26.323 20.9085 26.323 20.9334C26.2031 20.9832 26.0833 21.0579 25.9874 21.1077C25.9634 21.1326 25.9154 21.1326 25.8915 21.1575C25.8675 21.1575 25.8675 21.1823 25.8435 21.1823C25.8195 21.1823 25.7956 21.2072 25.7716 21.2321C25.7476 21.257 25.6997 21.2819 25.6517 21.3068C25.4359 21.4313 25.1003 21.6553 24.7166 21.8793C24.6927 21.8793 24.6927 21.8793 24.6687 21.9042C24.381 21.8046 24.1652 21.5059 23.8535 21.4313C24.357 21.1077 24.8605 20.809 25.34 20.4356C25.7236 20.1618 26.2271 20.0622 26.4909 19.5893C26.4909 19.5893 26.4908 19.5644 26.4669 19.5644C26.4429 19.5146 26.4189 19.4898 26.3949 19.44C26.371 19.4151 26.371 19.3902 26.347 19.3653C26.2271 19.1413 26.1072 18.9173 26.0113 18.743C25.5558 17.9465 25.2441 17.3242 24.8125 16.6771C24.7886 16.6273 24.7646 16.5775 24.7166 16.5526C24.4529 16.1792 24.333 15.7063 24.0213 15.3578C24.0933 15.3329 24.1892 15.308 24.2371 15.2583C25.364 14.4368 26.5628 13.7897 27.7136 13.0181C28.0493 12.794 28.1452 12.57 28.1452 12.1966C28.1212 9.73242 28.1452 7.24331 28.1452 4.77908C28.1452 4.60485 28.0972 4.43061 28.2651 4.30615C29.2241 4.90354 30.1831 5.47604 31.1422 6.04853C32.0532 6.59614 32.9643 7.11885 33.8754 7.66646C34.6666 8.13939 35.4818 8.63721 36.273 9.13503C36.7285 9.43373 37.184 9.75731 37.6875 9.98133C37.9033 10.0809 37.9513 10.2551 37.9513 10.4792C37.9992 11.7237 37.9992 12.9683 37.9992 14.1879Z" fill="white"/>
+<path opacity="0.39" d="M18.7722 21.5556C18.4845 21.8294 18.3646 21.929 18.1728 22.1032L18.1488 22.1281C18.1249 22.1281 18.1249 22.153 18.1249 22.153C18.1009 22.1281 18.0769 22.1281 18.0529 22.1032C18.0529 22.1032 18.0529 22.1032 18.029 22.1032C18.005 22.0784 17.981 22.0784 17.957 22.0535C17.7413 21.9041 17.5494 21.8045 17.4775 21.7299C17.4535 21.705 17.4296 21.705 17.4296 21.705C17.046 21.4561 16.6623 21.1823 16.2068 21.0329C16.5664 21.5805 16.9021 22.1281 17.2617 22.6509C17.1419 22.7255 17.022 22.8002 16.9021 22.8749C16.9021 22.8749 16.9021 22.8749 16.8781 22.8749C16.7582 22.9495 16.6384 23.0242 16.5185 23.074C15.7273 23.5469 14.9361 24.0696 14.1209 24.5177C13.2578 24.9906 12.4426 25.5133 11.5795 26.036C10.7883 26.509 9.9731 26.957 9.1819 27.4797C8.12697 28.1518 7.04806 28.7492 5.99312 29.3964C5.72939 29.5706 5.39373 29.6453 5.17794 29.944C4.93819 29.9191 5.01012 29.7199 5.01012 29.5706C5.01012 28.5749 5.01012 27.5793 5.01012 26.5836C5.01012 21.2818 5.01012 16.0049 5.01012 10.7031C5.01012 10.3048 5.15397 10.1057 5.44168 9.93147C6.54456 9.2843 7.6954 8.68692 8.75034 7.96507C9.39768 7.54192 10.093 7.16856 10.7643 6.74541C11.6514 6.1978 12.5145 5.6502 13.4256 5.17727C13.8812 4.92835 14.3127 4.65455 14.7443 4.40564C14.7443 6.89475 14.7683 9.40876 14.7443 11.8979C14.7443 11.9477 14.7443 11.9974 14.7443 12.0472C14.7443 12.1717 14.7443 12.2961 14.7443 12.4206C14.7443 12.4455 14.7443 12.4455 14.7443 12.4704C14.7922 12.7691 14.9361 13.018 15.4636 13.2669L15.4875 13.2918C16.0869 13.69 16.7103 14.0634 17.2857 14.4368C17.2857 14.4368 17.3097 14.4368 17.3097 14.4617C17.4775 14.5612 17.6214 14.6608 17.7652 14.7355C17.7892 14.7604 17.8372 14.7852 17.8611 14.8101C17.8851 14.835 17.9091 14.8599 17.957 14.8599C17.981 14.8848 18.005 14.8848 18.029 14.9097C18.1488 14.9844 18.2687 15.059 18.3406 15.1088C18.3646 15.1337 18.4126 15.1586 18.4365 15.1835C18.4605 15.2084 18.4845 15.2084 18.4845 15.2084C18.5085 15.2333 18.5325 15.2582 18.5564 15.2582C18.0769 16.0796 17.5974 17.0006 17.1179 17.822C16.7582 18.4194 16.3986 19.0416 16.1349 19.6888C16.1109 19.7884 16.1589 19.863 16.2548 19.9128C16.8062 20.2613 17.3576 20.5849 17.8851 20.9583C18.1728 21.1325 18.3646 21.2818 18.7722 21.5556Z" fill="white"/>
+<path opacity="0.39" d="M18.0758 22.1283C18.0519 22.1034 18.0279 22.1034 18.0039 22.0785C18.0279 22.1034 18.0519 22.1283 18.0758 22.1283Z" fill="white"/>
+<path opacity="0.56" d="M37.9062 29.8944C37.6664 30.218 37.2828 30.2926 36.9711 30.4918C36.0121 31.0891 35.0291 31.6616 34.0461 32.2341C33.3508 32.6324 32.6794 33.0555 32.0081 33.4538C31.5526 33.7276 31.097 34.0014 30.6415 34.2752C29.7784 34.7979 28.9152 35.3206 28.0521 35.8434C28.0521 33.1551 28.0521 30.4669 28.0521 27.7537C28.0521 27.6293 28.0761 27.4799 27.9322 27.4053C27.9083 27.3306 27.8363 27.2808 27.7644 27.231C27.165 26.8576 26.5656 26.5092 25.9662 26.1109C25.2949 25.6629 24.5756 25.2397 23.9043 24.8166C23.9283 24.7917 23.9522 24.7419 23.9762 24.717C24.0002 24.6921 24.0242 24.6672 24.0242 24.6423C24.0721 24.5428 24.1441 24.4432 24.216 24.3436C24.216 24.3436 24.216 24.3188 24.24 24.3188C24.5277 23.8707 24.8394 23.4227 25.1031 23.0244C25.151 22.9497 25.199 22.8751 25.2469 22.8253C25.2709 22.8004 25.2949 22.7506 25.3189 22.7257C25.3668 22.6262 25.4387 22.5515 25.4867 22.4768C25.5107 22.4768 25.5107 22.4768 25.5346 22.4768C25.8224 22.8502 26.2779 22.9746 26.6615 23.1986C27.5007 23.7214 28.3398 24.1943 29.155 24.717C29.4907 24.941 29.8743 25.0904 30.2339 25.3393C30.6894 25.638 31.169 25.8869 31.6245 26.1856C32.08 26.4843 32.5835 26.7581 33.0391 27.0319C33.7823 27.4799 34.5256 27.928 35.2688 28.376C36.06 28.8489 36.8512 29.3219 37.6664 29.8197C37.7623 29.7948 37.8342 29.8446 37.9062 29.8944Z" fill="white"/>
+<path opacity="0.32" d="M21.4588 8.46298C21.4588 8.81146 21.4588 9.18483 21.4588 9.5333C21.4588 10.2551 21.4588 10.977 21.4348 11.6988L21.4108 13.3168C21.4108 13.8644 21.4108 14.412 21.3868 14.9347C21.3868 15.6565 21.3868 16.3784 21.3868 17.0753C20.8594 16.7766 20.1401 16.229 19.6126 15.9054C19.5647 15.8805 19.5167 15.8557 19.4928 15.8308C19.2051 15.6316 18.9173 15.4574 18.5817 15.2583C18.5577 15.2334 18.5337 15.2334 18.5098 15.2085C18.4858 15.2085 18.4858 15.1836 18.4618 15.1836C18.4378 15.1587 18.3899 15.1338 18.3659 15.1089C18.27 15.0591 18.1741 14.9845 18.0542 14.9098C18.0302 14.8849 18.0063 14.8849 17.9823 14.86C17.9583 14.8351 17.9343 14.8351 17.8864 14.8102C17.8624 14.7853 17.8145 14.7604 17.7905 14.7356C17.6466 14.636 17.5028 14.5613 17.3349 14.4618C17.3349 14.4618 17.311 14.4618 17.311 14.4369C16.7355 14.0635 16.1122 13.6901 15.5128 13.2919L15.4888 13.267C14.9853 12.9932 14.8175 12.7692 14.7695 12.4705C14.7695 12.4456 14.7695 12.4456 14.7695 12.4207C14.7695 12.2962 14.7695 12.1718 14.7695 12.0473C14.7695 11.9975 14.7695 11.9477 14.7695 11.898C14.7935 9.40885 14.7695 6.89484 14.7695 4.40573C14.7935 4.38084 14.8175 4.35595 14.8415 4.33105C15.8724 4.97822 16.9034 5.65029 17.9583 6.29746C18.7255 6.77039 19.4928 7.21843 20.236 7.71625C20.5956 7.96516 21.0032 8.23896 21.4588 8.46298Z" fill="white"/>
+<path opacity="0.32" d="M18.5566 15.2583C18.9163 15.4574 19.18 15.6317 19.4677 15.8308C19.18 15.6566 18.8923 15.4574 18.5566 15.2583Z" fill="white"/>
+<path opacity="0.32" d="M21.4093 17.1252C21.4093 17.1003 21.4093 17.1003 21.4093 17.1252C21.3853 17.1252 21.3853 17.1003 21.3853 17.1003C21.3853 17.1003 21.3853 17.1003 21.3613 17.1003L21.4093 17.1252C21.4093 17.1003 21.4093 17.1003 21.4093 17.1252C21.4093 17.1003 21.4093 17.1003 21.4093 17.1252C21.4093 17.1003 21.4093 17.1003 21.4093 17.1252Z" fill="white"/>
+<path opacity="0.21" d="M28.1939 4.82888C28.1939 7.2931 28.1939 9.78222 28.1939 12.2464C28.1939 12.6198 28.098 12.8438 27.7623 13.0678C26.6115 13.8146 25.4127 14.4866 24.2858 15.308C24.2139 15.3578 24.142 15.3827 24.0701 15.4076C23.2069 15.9552 22.2719 16.5526 21.3848 17.1002C21.3848 16.3784 21.3848 15.6814 21.3848 14.9596C21.3848 14.412 21.3848 13.8644 21.4087 13.3416L21.4327 11.7237C21.4327 11.0019 21.4567 10.28 21.4567 9.5582C21.4567 9.20972 21.4567 8.83635 21.4567 8.48788C22.104 8.08962 22.7514 7.71625 23.3748 7.31799C24.118 6.84506 24.8373 6.37213 25.5566 5.8992C26.108 5.55072 26.6834 5.27692 27.2109 4.87866C27.5226 4.65464 27.8582 4.50529 28.1939 4.33105C28.2418 4.35595 28.2898 4.38084 28.3138 4.40573C28.1459 4.4804 28.1939 4.67953 28.1939 4.82888Z" fill="white"/>
+<path opacity="0.21" d="M28.0996 27.7536C28.0996 30.4419 28.0996 33.1301 28.0996 35.8433C27.1645 36.4406 26.2295 37.0131 25.2944 37.5856C24.5272 38.0337 23.8079 38.5315 23.0407 38.9795C22.5852 39.2533 22.1057 39.5271 21.6741 39.8507C21.5542 39.9254 21.4583 40.0001 21.3145 40.0001C21.3145 37.1874 21.3145 34.3747 21.3145 31.562C21.4104 31.5371 21.5063 31.4873 21.6022 31.4375C21.9378 31.1886 22.2975 30.9646 22.6811 30.7406C23.5202 30.2427 24.3354 29.72 25.1506 29.1973C26.0856 28.5999 27.0207 28.0025 27.9797 27.4052C28.1236 27.4798 28.0996 27.6292 28.0996 27.7536Z" fill="white"/>
+<path opacity="0.7" d="M28.1954 4.28128C27.8598 4.45552 27.5241 4.60486 27.2124 4.82888C26.685 5.22714 26.1095 5.50094 25.5581 5.84942C24.8148 6.32235 24.0956 6.79528 23.3763 7.26822C22.7529 7.66647 22.1056 8.06473 21.4582 8.4381C21.0267 8.21408 20.5951 7.94028 20.1875 7.66647C19.4443 7.16865 18.6531 6.72061 17.9098 6.24768C16.8789 5.60051 15.8239 4.92845 14.793 4.28128C15.0807 3.90791 15.5122 3.78345 15.8719 3.53454C16.6631 3.01183 17.4783 2.48911 18.2934 1.99129C19.0367 1.51836 19.7799 1.07032 20.5232 0.597388C20.7629 0.448041 21.0027 0.298694 21.2185 0.124456C21.4343 -0.0497823 21.6021 -0.0248911 21.7939 0.0995646C22.8488 0.821408 23.9517 1.46858 25.0546 2.16553C25.9177 2.71314 26.7809 3.23585 27.62 3.80835C27.8118 3.98258 28.0995 3.98258 28.1954 4.28128Z" fill="white"/>
+<path opacity="0.32" d="M21.3146 31.5371C21.3146 34.3498 21.3146 37.1625 21.3146 39.9752C20.8111 39.7512 20.3316 39.4276 19.876 39.1289C19.5164 38.9049 19.1328 38.6809 18.7731 38.4319C18.3176 38.1084 17.8381 37.8346 17.3586 37.5359C16.5674 37.038 15.7762 36.5153 14.961 36.0175C14.7932 35.9179 14.7212 35.8184 14.6973 35.6192C14.6973 33.4039 14.6973 31.2135 14.7212 28.9982C14.7212 28.4755 14.7212 27.9528 14.7212 27.4301C15.1288 27.6541 15.5124 27.903 15.92 28.1519C16.4954 28.5004 17.0709 28.8488 17.6223 29.2222C18.4135 29.7449 19.2527 30.2179 20.0439 30.7157C20.4754 31.0144 20.859 31.338 21.3146 31.5371Z" fill="white"/>
+<path opacity="0.12" d="M26.5172 19.689C26.2535 20.1371 25.75 20.2366 25.3664 20.5353C24.8868 20.8838 24.3834 21.1825 23.8799 21.531C23.2805 21.9043 22.6811 22.2777 22.0817 22.6262C21.8419 22.7755 21.6261 22.9249 21.3145 23.0493C21.3145 21.1327 21.3864 19.017 21.3864 17.1003C21.3864 17.1003 21.3864 17.1003 21.4104 17.1003C22.8489 17.7973 24.4313 18.7183 25.8459 19.4152C25.8459 19.4152 25.8699 19.4152 25.8699 19.4401C25.8938 19.4401 25.9178 19.465 25.9418 19.465C26.1336 19.5646 26.3494 19.6392 26.5172 19.689Z" fill="white"/>
+<path opacity="0.24" d="M21.3875 17.1003C21.3875 17.1003 21.3594 17.1293 21.3875 17.1003V17.1003Z" fill="white"/>
+<path opacity="0.24" d="M26.5156 19.689C26.3478 19.6392 26.132 19.5645 25.9641 19.4899C25.9402 19.4899 25.9162 19.465 25.8922 19.465C25.8922 19.465 25.8682 19.465 25.8682 19.4401C24.4297 18.7431 22.8473 17.8222 21.4327 17.1252C21.4327 17.1252 21.4327 17.1252 21.4087 17.1252C21.4087 17.1252 21.4087 17.1252 21.3848 17.1252C22.2719 16.5776 23.1829 15.9802 24.0701 15.4326C24.4057 15.7562 24.5256 16.254 24.7654 16.6274C24.7893 16.6772 24.8133 16.727 24.8613 16.7518C25.2928 17.399 25.6045 18.0462 26.06 18.8178C26.1559 18.9672 26.2758 19.2161 26.3957 19.4401C26.4197 19.465 26.4197 19.4899 26.4437 19.5148C26.4676 19.5645 26.4916 19.6143 26.5156 19.6392C26.4916 19.6641 26.5156 19.6641 26.5156 19.689Z" fill="white"/>
+<path opacity="0.56" d="M20.8359 23.572C20.9079 23.5222 20.9798 23.4724 21.0277 23.4475C20.9798 23.4724 20.9079 23.5222 20.8359 23.572Z" fill="white"/>
+<path opacity="0.56" d="M21.3145 23.2483C21.3384 23.2234 21.3624 23.1986 21.4104 23.2234C21.3864 23.2234 21.3624 23.2234 21.3145 23.2483Z" fill="white"/>
+<path opacity="0.56" d="M22.1496 23.5966C22.0297 23.5468 21.9098 23.4721 21.8379 23.4224C21.9338 23.497 22.0297 23.5468 22.1496 23.5966Z" fill="white"/>
+<path opacity="0.24" d="M21.3857 17.1003C21.3857 19.017 21.3138 21.1327 21.3138 23.0493C21.2658 23.0244 21.2179 22.9995 21.1699 22.9747C21.122 22.9498 21.098 22.9249 21.0501 22.9249C20.9781 22.8751 20.9062 22.8502 20.8343 22.8004C20.7863 22.7755 20.7623 22.7506 20.7144 22.7257C20.6904 22.7257 20.6664 22.7008 20.6664 22.7008C20.6185 22.676 20.5466 22.6262 20.4986 22.6013C19.9232 22.2528 19.3957 21.8546 18.7724 21.5559C18.3887 21.3069 18.1969 21.1576 17.8852 20.9336C17.3578 20.5602 16.8063 20.2366 16.2549 19.8881C16.159 19.8384 16.111 19.7637 16.135 19.6641C16.7824 19.3903 17.3818 19.0419 18.0291 18.768C18.101 18.7432 18.173 18.6934 18.2449 18.6685C19.2519 18.1956 20.3548 17.5982 21.3857 17.1003Z" fill="white"/>
+<path opacity="0.24" d="M21.3875 17.1003C21.3875 17.1003 21.3594 17.1293 21.3875 17.1003V17.1003Z" fill="white"/>
+<path opacity="0.6" d="M21.384 17.1001C20.3531 17.573 19.2502 18.1953 18.2192 18.6683C18.1473 18.6931 18.0754 18.7429 18.0035 18.7678C17.3801 19.0665 16.7567 19.3901 16.1094 19.6639C16.3971 19.0167 16.7567 18.4193 17.0924 17.7971C17.5719 16.9757 18.0514 16.0547 18.5309 15.2333C18.8906 15.4324 19.1543 15.6066 19.442 15.8058C19.49 15.8307 19.5139 15.8556 19.5619 15.8804C20.1133 16.2289 20.8326 16.8014 21.384 17.1001C21.384 17.1001 21.3601 17.1001 21.384 17.1001Z" fill="white"/>
+<path opacity="0.6" d="M21.4087 17.1252C21.4087 17.1003 21.4087 17.1003 21.4087 17.1252C21.3848 17.1003 21.3848 17.1003 21.3848 17.1003C21.4327 17.1003 21.4567 17.1252 21.4087 17.1252Z" fill="white"/>
+<path opacity="0.7" d="M27.9553 27.4051C27.0203 28.0025 26.0852 28.5998 25.1262 29.1972C24.311 29.72 23.4958 30.2427 22.6567 30.7405C22.297 30.9645 21.9374 31.1885 21.5778 31.4374C21.4819 31.5121 21.386 31.537 21.2901 31.5619C20.8345 31.3628 20.4509 31.0392 20.0433 30.7654C19.2282 30.2676 18.413 29.7697 17.6218 29.2719C17.0464 28.8985 16.4709 28.575 15.9195 28.2016C15.5359 27.9527 15.1283 27.7038 14.7207 27.4797C14.8166 27.4051 14.8885 27.3304 14.9844 27.2557C15.0324 27.2308 15.0803 27.1811 15.1283 27.1562C15.2242 27.0815 15.3201 27.0317 15.416 26.957C15.9435 26.6086 16.4949 26.3099 17.0224 25.9614C17.1902 25.8618 17.382 25.7374 17.5738 25.6129C17.6457 25.5631 17.7177 25.5133 17.8136 25.4636C17.9335 25.3889 18.0533 25.3142 18.1732 25.2395C18.2451 25.1898 18.3171 25.14 18.413 25.1151C18.4849 25.0653 18.5808 25.0404 18.6527 24.9906C18.6527 24.9906 18.6527 24.9906 18.6767 24.9906C18.7007 24.9657 18.7247 24.9657 18.7486 24.9409C18.9884 25.2893 19.2281 25.6627 19.4679 26.0112C19.5638 26.1605 19.6597 26.285 19.7556 26.4343C20.0433 26.8575 20.331 27.2806 20.6187 27.7038C20.6427 27.7287 20.6667 27.7784 20.6907 27.8033C20.7146 27.8531 20.7386 27.9029 20.7866 27.9278C20.8585 28.0522 20.9304 28.1518 20.9784 28.2016C21.0503 28.326 21.1222 28.4505 21.2421 28.5501C21.2901 28.575 21.314 28.5999 21.386 28.6247C21.4339 28.6247 21.4819 28.5998 21.5298 28.575C21.5538 28.5501 21.5778 28.5252 21.6018 28.5003C21.6257 28.4505 21.6497 28.4256 21.6737 28.3758C21.7936 28.2016 22.0333 27.8531 22.321 27.4051C22.369 27.3304 22.4169 27.2557 22.4889 27.1562C22.5608 27.0317 22.6567 26.9073 22.7526 26.7579C23.0403 26.3348 23.352 25.8618 23.6876 25.364C23.7835 25.2395 23.8555 25.1151 23.9514 24.9657C23.9514 24.9409 23.9754 24.9409 23.9754 24.916C23.9993 24.8662 24.0233 24.8413 24.0473 24.7915C24.7186 25.2147 25.4379 25.6378 26.1092 26.0858C26.6846 26.4841 27.308 26.8326 27.9074 27.2059C27.8594 27.2806 27.9314 27.3304 27.9553 27.4051Z" fill="white"/>
+<path opacity="0.7" d="M23.9528 24.7915C23.9288 24.8413 23.9048 24.8662 23.8809 24.916C23.8809 24.8662 23.9048 24.8164 23.9528 24.7915Z" fill="white"/>
+<path opacity="0.24" d="M26.395 20.9832C26.395 21.008 26.371 21.0329 26.3471 21.0827C26.3471 21.1076 26.3231 21.1325 26.2991 21.1574C26.2032 21.3316 26.0354 21.5805 25.8196 21.929C25.7956 21.9539 25.7717 21.9788 25.7477 22.0286C25.7237 22.0535 25.6997 22.0784 25.6997 22.1281C25.6278 22.2277 25.5798 22.3273 25.5079 22.4517C25.46 22.5264 25.388 22.626 25.3401 22.7006C25.3161 22.7255 25.2921 22.7504 25.2682 22.8002C25.2202 22.8749 25.1723 22.9247 25.1243 22.9993C24.8606 23.3976 24.5729 23.8456 24.2612 24.2937C24.2612 24.2937 24.2612 24.3186 24.2372 24.3186C24.1653 24.4181 24.0934 24.5177 24.0454 24.6173C24.0214 24.6422 23.9975 24.667 23.9975 24.6919C23.9735 24.7168 23.9495 24.7666 23.9255 24.7915C23.8776 24.8164 23.8776 24.8662 23.8536 24.916C23.8536 24.9408 23.8296 24.9408 23.8296 24.9657C23.7337 25.0902 23.6618 25.2146 23.5659 25.364C23.2302 25.8618 22.9185 26.3348 22.6308 26.7579C22.5349 26.8824 22.463 27.0317 22.3671 27.1562C22.3191 27.2308 22.2712 27.3055 22.1993 27.4051C21.8876 27.8531 21.6478 28.2265 21.5519 28.3758C21.5279 28.4256 21.504 28.4505 21.48 28.5003C21.456 28.5252 21.432 28.5501 21.4081 28.575C21.3841 28.5998 21.3361 28.6247 21.2642 28.6247C21.2642 27.1562 21.2642 25.6876 21.2402 24.219C21.2642 24.1941 21.2882 24.1941 21.3122 24.1692C21.3361 24.1692 21.3361 24.1443 21.3601 24.1443C21.3841 24.1194 21.4081 24.1194 21.432 24.0945C21.432 24.0945 21.432 24.0945 21.456 24.0945C21.48 24.0697 21.504 24.0697 21.5279 24.0448C21.5999 23.995 21.6478 23.9701 21.7198 23.9203C21.8157 23.8705 21.9116 23.7959 22.0075 23.7461C22.0314 23.7461 22.0554 23.7212 22.0554 23.7212C22.0554 23.7212 22.0794 23.7212 22.0794 23.6963C22.0794 23.6963 22.1034 23.6963 22.1034 23.6714C22.1753 23.6216 22.2712 23.5718 22.3431 23.5221C22.3431 23.5221 22.3431 23.5221 22.3671 23.5221C23.0624 23.074 23.9255 22.5264 24.6448 22.0784C24.6688 22.0784 24.6927 22.0535 24.6927 22.0535C25.0764 21.8046 25.412 21.6054 25.6278 21.481C25.6758 21.4561 25.6997 21.4312 25.7477 21.4063C25.7717 21.3814 25.7956 21.3814 25.8196 21.3565C25.8436 21.3565 25.8676 21.3316 25.8676 21.3316C25.8915 21.3067 25.9155 21.3067 25.9635 21.2818C26.0594 21.2321 26.1792 21.1574 26.2991 21.1076C26.371 21.008 26.3711 20.9832 26.395 20.9832Z" fill="white"/>
+<path opacity="0.24" d="M22.1536 23.5969C22.1536 23.5969 22.1289 23.5969 22.1289 23.6227C22.1289 23.6227 22.1536 23.6227 22.1536 23.5969Z" fill="white"/>
+<path opacity="0.24" d="M23.9528 24.7915C23.9288 24.8413 23.9048 24.8662 23.8809 24.916C23.8809 24.8662 23.9048 24.8164 23.9528 24.7915Z" fill="white"/>
+<path d="M21.7696 23.8706C21.6977 23.9204 21.6497 23.9453 21.5778 23.9951C21.5538 24.02 21.5298 24.02 21.5059 24.0448C21.5298 24.02 21.5778 23.9951 21.6257 23.9702C21.6497 23.9702 21.6497 23.9453 21.6737 23.9453C21.6977 23.9204 21.7216 23.9204 21.7456 23.8955C21.7456 23.8706 21.7456 23.8706 21.7696 23.8706Z" fill="white"/>
+<path opacity="0.7" d="M22.1516 23.5969C22.1516 23.5969 22.1277 23.5969 22.1277 23.6218C22.1277 23.6218 22.1037 23.6218 22.1037 23.6467C22.0797 23.6467 22.0557 23.6716 22.0557 23.6716C21.9359 23.7463 21.84 23.8209 21.744 23.8707C21.7201 23.8956 21.6961 23.8956 21.6721 23.9205C21.6481 23.9205 21.6481 23.9454 21.6242 23.9454L21.6002 23.9703C21.5762 23.9952 21.5522 23.9952 21.5283 24.0201C21.5283 24.0201 21.5283 24.0201 21.5043 24.0201C21.4803 24.045 21.4563 24.045 21.4324 24.0699C21.4084 24.0699 21.4084 24.0947 21.3844 24.0947C21.3604 24.1196 21.3365 24.1196 21.3125 24.1445C21.3125 24.1445 21.2885 24.1196 21.2645 24.1196C21.1686 24.045 20.9289 23.9205 20.6412 23.7214C20.6412 23.7214 20.6172 23.7214 20.6172 23.6965C20.6891 23.6467 20.7371 23.5969 20.785 23.572C20.809 23.5471 20.833 23.5223 20.8569 23.5223C20.9289 23.4725 21.0008 23.4227 21.0488 23.3978C21.0727 23.3729 21.0967 23.3729 21.1207 23.348C21.1686 23.3231 21.2166 23.2982 21.2885 23.2484C21.3125 23.2484 21.3125 23.2236 21.3365 23.2236C21.3604 23.1987 21.3844 23.1738 21.4324 23.1987H21.4563C21.5043 23.1987 21.5522 23.2236 21.6242 23.2733C21.6481 23.2733 21.6481 23.2982 21.6721 23.2982C21.7201 23.3231 21.792 23.3729 21.84 23.3978C21.9359 23.4974 22.0318 23.5471 22.1516 23.5969Z" fill="white"/>
+<path opacity="0.6" d="M21.3146 28.6C21.2667 28.5751 21.2187 28.5751 21.1708 28.5253C21.0509 28.4507 20.9789 28.3013 20.907 28.1769C20.8591 28.1022 20.7871 28.0275 20.7152 27.903C20.6912 27.8533 20.6673 27.8035 20.6193 27.7786C20.5953 27.7537 20.5714 27.7288 20.5474 27.679C20.2597 27.2559 19.9959 26.8327 19.6843 26.4096C19.5884 26.2851 19.4924 26.1358 19.3965 25.9864C19.1568 25.638 18.917 25.2646 18.6773 24.9161C18.6533 24.9161 18.6293 24.941 18.6053 24.9659C18.6293 24.941 18.6533 24.941 18.6773 24.9161C18.6053 24.8165 18.4615 24.5676 18.2697 24.3187C18.2217 24.2689 18.1978 24.1943 18.1498 24.1196C18.0779 24.02 18.006 23.9205 17.934 23.8209C17.9101 23.7711 17.8861 23.7462 17.8621 23.6964C17.8621 23.6964 17.8621 23.6964 17.8621 23.6716C17.8381 23.6467 17.8141 23.5969 17.7902 23.572C17.7662 23.5471 17.7422 23.4973 17.7182 23.4724C17.5984 23.2733 17.4785 23.0991 17.3826 22.9497C17.3586 22.9248 17.3586 22.9248 17.3346 22.8999C17.3107 22.875 17.3107 22.8501 17.2867 22.8501C17.2867 22.8253 17.2627 22.8253 17.2627 22.8004C17.2627 22.8004 17.2627 22.7755 17.2387 22.7755C17.2387 22.7755 17.2387 22.7506 17.2148 22.7506L17.1908 22.7257C17.1908 22.7257 17.1908 22.7008 17.1668 22.7008C17.1668 22.6759 17.1428 22.6759 17.1428 22.6759C16.7832 22.1283 16.4475 21.5807 16.0879 21.058C16.5434 21.2073 16.927 21.4811 17.3107 21.73C17.3107 21.73 17.3346 21.7549 17.3586 21.7549C17.4545 21.8047 17.6223 21.9292 17.8381 22.0785C17.8621 22.1034 17.8861 22.1034 17.91 22.1283C17.91 22.1283 17.9101 22.1283 17.934 22.1283C17.958 22.1283 17.982 22.1532 18.006 22.1781C18.006 22.1781 18.0299 22.1781 18.0299 22.203C18.0539 22.2279 18.0779 22.2279 18.1019 22.2528C18.1498 22.2776 18.1738 22.3025 18.2217 22.3274C18.2937 22.3772 18.3656 22.4021 18.4375 22.4519C18.5094 22.5017 18.5814 22.5515 18.6533 22.5763C18.7492 22.651 18.8451 22.7008 18.941 22.7755C18.989 22.8004 19.0369 22.8501 19.0849 22.875C19.1808 22.9497 19.3006 22.9995 19.3965 23.0742C19.5884 23.1986 19.7802 23.3231 19.972 23.4475C20.0199 23.4724 20.0679 23.4973 20.1158 23.5471C20.2597 23.6218 20.3796 23.7213 20.4994 23.796C20.4994 23.796 20.5234 23.796 20.5234 23.8209C20.8111 23.9951 21.0509 24.1445 21.1468 24.2192C21.1708 24.244 21.1947 24.244 21.1947 24.244C21.2906 25.638 21.2906 27.1314 21.3146 28.6Z" fill="white"/>
+<path opacity="0.6" d="M18.0758 22.1283C18.0519 22.1034 18.0279 22.1034 18.0039 22.0785C18.0279 22.1034 18.0519 22.1283 18.0758 22.1283Z" fill="white"/>
+<path opacity="0.6" d="M24.6944 21.9788C23.9751 22.4517 23.088 22.9993 22.4167 23.4474C22.4167 23.4474 22.4167 23.4474 22.3927 23.4474C22.2968 23.4971 22.2249 23.5469 22.1529 23.5967C22.0331 23.5469 21.9372 23.4722 21.8412 23.4225C21.7933 23.3976 21.7214 23.3478 21.6734 23.3229C21.6494 23.3229 21.6494 23.298 21.6255 23.298C21.5775 23.2731 21.5056 23.2233 21.4576 23.2233H21.4337C21.3857 23.2233 21.3617 23.2233 21.3378 23.2482C21.3378 23.2482 21.3138 23.2731 21.2898 23.2731C21.2179 23.3229 21.1699 23.3478 21.122 23.3727C21.098 23.3976 21.074 23.3976 21.05 23.4225C21.0021 23.4474 20.9302 23.4971 20.8582 23.5469C20.8343 23.5718 20.8103 23.5718 20.7863 23.5967C20.7384 23.6216 20.6904 23.6714 20.6185 23.7212C20.4986 23.6465 20.3787 23.5718 20.2349 23.4722C20.1869 23.4474 20.139 23.4225 20.091 23.3727C19.8992 23.2482 19.7074 23.1238 19.5156 22.9993C19.4197 22.9246 19.2998 22.8749 19.2039 22.8002C19.156 22.7753 19.108 22.7255 19.0601 22.7006C18.9642 22.6259 18.8682 22.5762 18.7723 22.5015C18.7004 22.4517 18.6285 22.4019 18.5566 22.377C18.4846 22.3273 18.4127 22.2775 18.3408 22.2526C18.2928 22.2277 18.2689 22.2028 18.2209 22.1779C18.1969 22.153 18.173 22.153 18.149 22.1281L18.125 22.1032L18.149 22.0783L18.173 22.0535C18.3648 21.8792 18.5086 21.7797 18.7723 21.5058C19.3717 21.7797 19.9232 22.2028 20.4986 22.5513C20.5466 22.5762 20.6185 22.626 20.6664 22.6508C20.6904 22.6508 20.7144 22.6757 20.7144 22.6757C20.7623 22.7006 20.7863 22.7255 20.8343 22.7504C20.9062 22.8002 20.9781 22.8251 21.05 22.8749C21.098 22.8998 21.122 22.9246 21.1699 22.9246C21.2179 22.9495 21.2658 22.9744 21.3138 22.9993C21.6255 22.8749 21.8412 22.7255 22.081 22.5762C22.6804 22.2028 23.2798 21.8294 23.8792 21.481C24.1909 21.5556 24.4067 21.8543 24.6944 21.9788Z" fill="white"/>
+<path opacity="0.6" d="M18.7237 24.9409C18.6997 24.9658 18.6758 24.9658 18.6518 24.9906C18.6518 24.9906 18.6518 24.9906 18.6278 24.9906C18.5559 25.0404 18.46 25.0653 18.388 25.1151C18.3161 25.1649 18.2202 25.1898 18.1483 25.2396C18.0284 25.3142 17.9085 25.3889 17.7887 25.4636C17.7167 25.5134 17.6208 25.5631 17.5489 25.6129C17.3571 25.7374 17.1653 25.8618 16.9975 25.9614C16.47 26.3099 15.9185 26.6086 15.3911 26.957C15.2952 27.0317 15.1993 27.0815 15.1034 27.1562C15.0554 27.1811 15.0075 27.2309 14.9595 27.2557C14.8636 27.3304 14.7677 27.4051 14.6958 27.4798C14.6958 28.0025 14.6958 28.5252 14.6958 29.0479C14.6958 31.2632 14.6958 33.4536 14.6718 35.6689C14.1923 35.5196 13.7847 35.1711 13.3531 34.9471C12.3462 34.3746 11.3631 33.7772 10.3801 33.1798C9.75677 32.8065 9.15737 32.4082 8.534 32.0348C7.43112 31.3877 6.35221 30.7405 5.24932 30.0933C5.1774 30.0684 5.12945 30.0435 5.10547 29.944C5.32125 29.6702 5.65691 29.5706 5.92064 29.3964C6.97558 28.7243 8.07847 28.1518 9.10942 27.4798C9.90062 26.9819 10.7158 26.509 11.507 26.0361C12.3462 25.5383 13.1613 24.9906 14.0484 24.5177C14.8636 24.0697 15.6548 23.547 16.446 23.074C16.5659 22.9994 16.6858 22.9247 16.8057 22.8749C16.8057 22.8749 16.8056 22.8749 16.8296 22.8749C16.9495 22.8002 17.0694 22.7504 17.1893 22.6509C17.1893 22.6509 17.1893 22.6509 17.2132 22.6758L17.2372 22.7007L17.2612 22.7256C17.2612 22.7504 17.2852 22.7504 17.2852 22.7753C17.2852 22.7753 17.3091 22.8002 17.3091 22.8251C17.3331 22.85 17.3571 22.8998 17.3811 22.9496C17.477 23.0989 17.5968 23.2732 17.7167 23.4723C17.7887 23.5967 17.8846 23.7212 17.9565 23.8457C18.0284 23.9452 18.1003 24.0448 18.1723 24.1443C18.2202 24.219 18.2442 24.2688 18.2921 24.3435C18.5079 24.5924 18.6518 24.8164 18.7237 24.9409Z" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/clients/laketrade.svg b/packages/website/public/images/clients/laketrade.svg
new file mode 100644
index 000000000..6ab08bcec
--- /dev/null
+++ b/packages/website/public/images/clients/laketrade.svg
@@ -0,0 +1,13 @@
+<svg width="78" height="53" viewBox="0 0 78 53" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M0 52.4754H5.63871V50.785H1.93548V43.7012H0V52.4754Z" fill="white"/>
+<path d="M6.54294 52.4754H8.50423L9.05907 50.7076H11.8204L12.3752 52.4754H14.4268L11.4849 43.7012H9.48488L6.54294 52.4754ZM9.53649 49.0947L10.4397 45.8947L11.3429 49.0947H9.53649Z" fill="white"/>
+<path d="M16.2298 52.4754H18.1653V50.1528L19.1976 48.8367L21.1976 52.4754H23.404L20.5395 47.3012L23.3653 43.7012H21.146L18.1653 47.5334V43.7012H16.2298V52.4754Z" fill="white"/>
+<path d="M25.063 52.4754H31.2049V50.8108H26.9985V48.8367H30.4307V47.185H26.9985V45.3657H31.0759V43.7012H25.063V52.4754Z" fill="white"/>
+<path d="M39.0649 52.4754H40.2262V44.7721H42.8198V43.7012H36.4714V44.7721H39.0649V52.4754Z" fill="white"/>
+<path d="M44.9018 52.4754H46.0631V48.9141H47.9857L50.076 52.4754H51.4179L49.276 48.8367C50.5534 48.5915 51.0954 47.8044 51.0954 46.3076C51.0954 44.4625 50.2696 43.7012 48.2696 43.7012H44.9018V52.4754ZM46.0631 47.856V44.7592H48.1663C49.4825 44.7592 49.9341 45.185 49.9341 46.3076C49.9341 47.4302 49.4825 47.856 48.1663 47.856H46.0631Z" fill="white"/>
+<path d="M52.7774 52.4754H53.9774L54.7774 50.2302H58.3129L59.1129 52.4754H60.3516L57.1516 43.7012H55.9774L52.7774 52.4754ZM55.1516 49.1721L56.5452 45.185L57.9387 49.1721H55.1516Z" fill="white"/>
+<path d="M62.4673 52.4754H65.4867C67.7835 52.4754 68.8157 51.4044 68.8157 49.0689V47.1076C68.8157 44.7721 67.7835 43.7012 65.4867 43.7012H62.4673V52.4754ZM63.6286 51.4173V44.7592H65.3448C66.9964 44.7592 67.6544 45.4302 67.6544 47.1205V49.056C67.6544 50.7463 66.9964 51.4173 65.3448 51.4173H63.6286Z" fill="white"/>
+<path d="M71.6155 52.4754H77.4865V51.4173H72.7768V48.5141H76.7123V47.456H72.7768V44.7592H77.3575V43.7012H71.6155V52.4754Z" fill="white"/>
+<path d="M38.5883 16.5883H37.9916C29.1604 16.5883 22 9.42787 22 0.5967V0H38.5883V16.5883Z" fill="white"/>
+<path d="M39.1846 33.1765H38.5879V16.5883H55.1762V17.185C55.1762 26.0161 48.0158 33.1765 39.1846 33.1765Z" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/clients/ledgerdex.svg b/packages/website/public/images/clients/ledgerdex.svg
new file mode 100644
index 000000000..44126012e
--- /dev/null
+++ b/packages/website/public/images/clients/ledgerdex.svg
@@ -0,0 +1,19 @@
+<svg width="69" height="55" viewBox="0 0 69 55" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0)">
+<path d="M43.2016 50.8792C43.1515 50.6793 43.1515 50.5793 43.3268 50.4543C44.0531 50.0045 44.2785 49.3047 44.2785 48.48C44.2785 47.2054 44.2785 45.9308 44.2785 44.6562C44.2785 43.3066 43.452 42.5068 42.1247 42.5068C40.8725 42.5068 39.6202 42.5068 38.368 42.5068C37.817 42.5068 37.792 42.5068 37.792 43.0817V52.5787C37.792 53.2035 37.792 53.8283 37.792 54.4531C37.792 54.803 37.9423 54.9779 38.2929 54.9529C38.6685 54.9529 39.0442 54.9529 39.4199 54.9529C39.8707 54.9529 39.9458 54.878 39.9458 54.4031C39.9458 53.3534 39.9458 52.3038 39.9458 51.2791C39.9458 51.1041 39.8957 50.9292 40.046 50.7792H41.0478C41.3733 52.0289 41.724 53.2535 42.0245 54.4781C42.1247 54.828 42.2499 55.0279 42.6506 54.9779C43.0012 54.9529 43.3268 54.9779 43.6774 54.9779C44.1533 54.9779 44.2284 54.878 44.1282 54.4281C43.8277 53.2285 43.5272 52.0538 43.2016 50.8792ZM42.0996 48.1301C42.0996 48.455 41.8993 48.6549 41.5737 48.6799C41.0728 48.7049 40.5469 48.6799 39.9709 48.6799V44.5562C40.5469 44.5562 41.0979 44.5312 41.6739 44.5562C41.9243 44.5812 42.0996 44.7811 42.0996 45.081C42.0996 46.1057 42.0996 47.1304 42.0996 48.1301Z" fill="white"/>
+<path d="M51.9679 44.7561C51.9679 43.2816 51.1915 42.5068 49.7139 42.5068C48.5618 42.5068 47.4348 42.5068 46.2828 42.5068C45.7068 42.5068 45.7068 42.5068 45.7068 43.0817C45.7068 44.9811 45.7068 46.8555 45.7068 48.7549C45.7068 50.6543 45.7068 52.5537 45.7068 54.4531C45.7068 54.828 45.7819 54.9779 46.2077 54.9779C47.3848 54.9529 48.5869 54.9779 49.764 54.9779C51.1915 54.9779 51.9679 54.2032 51.9679 52.7786C51.9679 50.0795 51.9679 47.4053 51.9679 44.7561ZM49.8892 52.1288C49.8892 52.7036 49.7139 52.8786 49.1379 52.8786C48.7121 52.8786 48.3114 52.8786 47.8606 52.8786V44.5562C48.3615 44.5562 48.8373 44.5312 49.3132 44.5562C49.7389 44.5812 49.8892 44.7811 49.8892 45.281C49.8892 46.5806 49.8892 47.8801 49.8892 49.1548C49.8892 50.1794 49.8892 51.1541 49.8892 52.1288Z" fill="white"/>
+<path d="M20.9879 44.6063C20.9879 43.3317 20.1615 42.5069 18.8842 42.4819C17.657 42.4819 16.4549 42.4819 15.2277 42.4819C14.7268 42.4819 14.7018 42.5069 14.7018 43.0068C14.7018 44.9062 14.7018 46.8056 14.7018 48.705C14.7018 50.6044 14.7018 52.4788 14.7018 54.3782C14.7018 54.903 14.7018 54.928 15.2528 54.928C16.4549 54.928 17.657 54.928 18.8592 54.928C20.1364 54.928 20.9629 54.1033 20.9629 52.8287C20.9879 50.1045 20.9879 47.3554 20.9879 44.6063ZM18.9343 47.4304C18.9343 48.9799 18.9343 50.5044 18.9343 52.0539C18.9343 52.7037 18.759 52.8787 18.1078 52.8787C17.7572 52.8787 17.4316 52.8787 17.081 52.8787C17.0309 52.8787 16.9808 52.8537 16.9057 52.8287V44.5813C17.4066 44.5063 17.9075 44.5313 18.3833 44.5563C18.784 44.5813 18.9343 44.8562 18.9343 45.2311C18.9343 45.9808 18.9343 46.7056 18.9343 47.4304Z" fill="white"/>
+<path d="M28.851 52.9786C28.801 54.0283 28.3752 54.778 27.0979 54.903C26.021 55.0279 24.9191 55.0529 23.8422 54.853C23.0658 54.703 22.615 54.2032 22.4397 53.4784C22.3645 53.1285 22.3145 52.7787 22.3145 52.4288C22.3145 49.9046 22.3145 47.4053 22.3145 44.8811C22.3145 44.5062 22.3896 44.1314 22.4898 43.7815C22.7152 42.9817 23.3162 42.5818 24.0676 42.5319C25.1445 42.4569 26.2214 42.4069 27.2983 42.5818C28.3502 42.7318 28.801 43.5066 28.8761 44.4563C28.9262 45.0561 28.8761 45.6309 28.8761 46.2307C28.8761 46.5056 28.7759 46.6306 28.5004 46.6306C28.0747 46.6306 27.6239 46.6306 27.1981 46.6306C26.9477 46.6306 26.8224 46.5306 26.8224 46.2557C26.8224 45.9058 26.8224 45.5809 26.8224 45.231C26.7974 44.7812 26.597 44.5812 26.1462 44.5562C25.7956 44.5562 25.42 44.5562 25.0693 44.5562C24.6937 44.5562 24.4683 44.7562 24.4683 45.131C24.4683 47.5053 24.4683 49.8796 24.4683 52.2538C24.4683 52.6787 24.6937 52.8786 25.0944 52.9036C25.445 52.9286 25.8207 52.9036 26.1713 52.9036C26.5219 52.9036 26.7724 52.7287 26.7974 52.3788C26.8224 51.679 26.7974 50.9542 26.7974 50.2794C26.597 50.1545 26.4217 50.1795 26.2464 50.2045C25.9208 50.2295 25.7455 50.1045 25.7706 49.7546C25.7956 49.3547 25.7956 48.9798 25.7706 48.58C25.7706 48.2551 25.8708 48.1301 26.1963 48.1301C26.9477 48.1551 27.699 48.1301 28.4503 48.1301C28.7509 48.1301 28.8761 48.2301 28.8761 48.53C28.8761 50.0045 28.9262 51.5041 28.851 52.9786Z" fill="white"/>
+<path d="M67.4444 54.9532C67.0688 54.9532 66.6931 54.9282 66.3174 54.9532C65.9418 54.9782 65.7665 54.8033 65.6412 54.4784C65.2405 53.4037 64.8148 52.354 64.389 51.3044C64.364 51.2294 64.3139 51.1794 64.2387 51.0045C63.7629 52.2041 63.3121 53.2788 62.9114 54.3534C62.7361 54.8033 62.5107 55.0032 62.0348 54.9532C61.6842 54.9032 61.3085 54.9532 60.9579 54.9532C60.4821 54.9532 60.432 54.8533 60.6073 54.4284C61.3586 52.604 62.0849 50.8045 62.8613 48.9801C62.9865 48.7052 62.9865 48.4803 62.8613 48.1804C62.135 46.4809 61.4338 44.7564 60.7325 43.057C60.5071 42.5321 60.5572 42.4821 61.1332 42.4821C61.4839 42.4821 61.8595 42.5071 62.2101 42.4821C62.6109 42.4571 62.7862 42.6321 62.9364 42.982C63.2871 43.9567 63.6878 44.9064 64.0634 45.8561C64.1135 46.006 64.1386 46.156 64.3139 46.2809C64.7396 45.2063 65.1904 44.1566 65.5661 43.057C65.7164 42.6071 65.9668 42.4322 66.4176 42.4821C66.7682 42.5071 67.1439 42.4821 67.4945 42.4821C67.9453 42.4821 67.9954 42.5571 67.8201 42.982C67.0938 44.7064 66.3926 46.4309 65.6663 48.1554C65.541 48.4553 65.516 48.6802 65.6663 48.9801C66.4176 50.7545 67.1439 52.554 67.8952 54.3284C68.0956 54.8783 68.0455 54.9532 67.4444 54.9532Z" fill="white"/>
+<path d="M59.5306 54.5532C59.5306 54.8531 59.4304 54.9781 59.1299 54.9781C57.3267 54.9781 55.4985 54.9781 53.6953 54.9781C53.3947 54.9781 53.2946 54.8781 53.2946 54.5532C53.2946 50.6795 53.2946 46.7807 53.2946 42.9069C53.2946 42.657 53.3446 42.482 53.6452 42.507C55.5235 42.507 57.4269 42.507 59.3303 42.507C59.3803 42.507 59.4304 42.532 59.5056 42.557C59.6057 43.1568 59.5557 43.7566 59.5306 44.3564C59.5056 44.6313 59.2802 44.5814 59.0798 44.5814C58.028 44.5814 56.951 44.5814 55.8992 44.5814H55.3983V47.6804C56.2999 47.6804 57.1764 47.6804 58.078 47.6804C58.604 47.6804 58.629 47.7054 58.629 48.2302C58.629 48.5551 58.629 48.88 58.629 49.2049C58.629 49.7298 58.629 49.7547 58.078 49.7547C57.2015 49.7547 56.3249 49.7547 55.4233 49.7547V52.9287C56.6255 52.9287 57.8025 52.9287 59.0047 52.9287C59.5807 52.9287 59.5807 52.9287 59.5807 53.5036C59.5306 53.8285 59.5056 54.1784 59.5306 54.5532Z" fill="white"/>
+<path d="M13.5004 53.3284C13.5004 53.7283 13.5004 54.1032 13.5004 54.5031C13.5004 54.803 13.3752 54.9529 13.0496 54.9529C11.2464 54.9529 9.46823 54.9529 7.66503 54.9529C7.33946 54.9529 7.21423 54.853 7.21423 54.5281C7.21423 50.6543 7.21423 46.8055 7.21423 42.9317C7.21423 42.6068 7.3645 42.5068 7.66503 42.5068C9.46823 42.5068 11.2464 42.5068 13.0496 42.5068C13.2499 42.5068 13.4503 42.5568 13.4753 42.7817C13.5004 43.3566 13.6006 43.9564 13.3501 44.5812H9.29292V47.6052C9.66859 47.7052 10.0443 47.6302 10.4199 47.6552C10.9709 47.6552 11.5469 47.6552 12.0979 47.6552C12.4235 47.6552 12.5487 47.7552 12.5487 48.0801C12.5236 48.48 12.5236 48.8548 12.5487 49.2547C12.5737 49.6046 12.4235 49.7296 12.0728 49.7296C11.2965 49.7046 10.5451 49.7296 9.76876 49.7296C9.6185 49.7296 9.46823 49.7046 9.26787 49.8045V52.8036C9.41814 52.9286 9.59345 52.8786 9.76876 52.8786C10.8206 52.8786 11.8975 52.9036 12.9494 52.8786C13.3251 52.8786 13.5004 53.0035 13.5004 53.3284Z" fill="white"/>
+<path d="M36.5656 53.3534C36.5656 53.7283 36.5656 54.1032 36.5656 54.4781C36.5656 54.803 36.4654 54.9529 36.0897 54.9529C34.3116 54.9529 32.5334 54.9529 30.7553 54.9529C30.4297 54.9529 30.2794 54.853 30.2794 54.5031C30.2794 50.6543 30.2794 46.8055 30.2794 42.9567C30.2794 42.6068 30.4046 42.5068 30.7553 42.5068C32.5334 42.5068 34.3116 42.5068 36.0897 42.5068C36.3151 42.5068 36.5405 42.5318 36.5405 42.7817C36.5656 43.3566 36.6657 43.9564 36.4153 44.5562H32.3831V47.5553C32.5084 47.6802 32.6837 47.6302 32.859 47.6302C33.6103 47.6302 34.3617 47.6552 35.113 47.6302C35.4887 47.6302 35.664 47.7302 35.6389 48.1301C35.6139 48.48 35.6389 48.8049 35.6389 49.1548C35.6389 49.6546 35.6139 49.6796 35.113 49.6796C34.2114 49.6796 33.3348 49.6796 32.3831 49.6796C32.308 50.7293 32.3581 51.7789 32.3581 52.8536H33.7606C34.537 52.8536 35.3133 52.8786 36.1148 52.8536C36.4403 52.8786 36.5656 53.0285 36.5656 53.3534Z" fill="white"/>
+<path d="M6.08579 54.603C6.08579 54.828 5.96057 54.9529 5.73517 54.9529C3.93197 54.9529 2.12877 54.9529 0.350622 54.9529C0.0500888 54.9529 0 54.778 0 54.5281C0 53.9033 0 53.2785 0 52.6537V43.1066C0 42.5068 0 42.5068 0.601066 42.5068C0.951688 42.5068 1.27726 42.5068 1.62789 42.5068C2.12877 42.5068 2.15382 42.5318 2.15382 43.0317C2.15382 44.9311 2.15382 46.8055 2.15382 48.7049V52.9036H4.55808C4.95879 52.9036 5.33446 52.9036 5.73517 52.9036C5.98561 52.9036 6.11084 53.0035 6.11084 53.2785C6.06075 53.7033 6.06075 54.1532 6.08579 54.603Z" fill="white"/>
+<path d="M41.3723 17.8194C39.8947 17.8194 38.5172 18.2193 37.3401 18.9191L35.1863 16.3949C35.9377 15.5701 36.3885 14.4705 36.3885 13.2708C36.3885 12.3711 36.138 11.5464 35.6872 10.8216L39.2936 6.62292C39.7945 6.89784 40.3705 7.04779 40.9966 7.04779C42.9501 7.04779 44.5279 5.47329 44.5279 3.5239C44.5529 1.57451 42.9751 0 41.0217 0C39.0682 0 37.4904 1.57451 37.4904 3.5239C37.4904 4.24867 37.7158 4.89847 38.0664 5.44829L34.5352 9.54701C33.7588 8.9472 32.7821 8.59731 31.7302 8.59731C30.8036 8.59731 29.952 8.87222 29.2258 9.32208L27.673 7.49765C27.9234 7.09778 28.0737 6.62292 28.0737 6.09809C28.0737 4.64854 26.8966 3.47391 25.444 3.47391C23.9915 3.47391 22.8144 4.64854 22.8144 6.09809C22.8144 7.54764 23.9915 8.72227 25.444 8.72227C25.7446 8.72227 26.0201 8.67228 26.2956 8.57231L27.9485 10.5217C27.3975 11.2965 27.0719 12.2212 27.0719 13.2458C27.0719 13.4458 27.097 13.6457 27.122 13.8457L24.0416 16.02C23.3904 15.3702 22.5139 14.9953 21.5371 14.9953C19.5837 14.9953 18.0059 16.5698 18.0059 18.5192C18.0059 20.4686 19.5837 22.0431 21.5371 22.0431C23.4906 22.0431 25.0684 20.4686 25.0684 18.5192C25.0684 18.1693 25.0183 17.8194 24.9181 17.4945L27.673 15.5451C28.4744 16.9447 30.0021 17.9194 31.7302 17.9194C32.4815 17.9194 33.1577 17.7444 33.7838 17.4445L35.9377 19.9687C34.435 21.3933 33.4833 23.4177 33.4833 25.667C33.4833 30.0156 37.0146 33.5395 41.3723 33.5395C45.73 33.5395 49.2613 30.0156 49.2613 25.667C49.2613 21.3183 45.705 17.8194 41.3723 17.8194Z" fill="white"/>
+</g>
+<defs>
+<clipPath id="clip0">
+<rect width="69" height="55" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/packages/website/public/images/clients/openrelay.svg b/packages/website/public/images/clients/openrelay.svg
new file mode 100644
index 000000000..21e32cc18
--- /dev/null
+++ b/packages/website/public/images/clients/openrelay.svg
@@ -0,0 +1,22 @@
+<svg width="64" height="52" viewBox="0 0 64 52" fill="none" xmlns="http://www.w3.org/2000/svg">
+<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="15" y="0" width="33" height="36">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M15.9592 0.240479H47.5748V35.1917H15.9592V0.240479Z" fill="white"/>
+</mask>
+<g mask="url(#mask0)">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M29.5768 30.5355C29.5208 30.4346 29.4727 30.3452 29.4219 30.2572C28.9351 29.4126 28.448 28.568 27.9605 27.7238C26.4156 25.0481 24.8706 22.3725 23.3258 19.6967C23.2905 19.6355 23.2543 19.5742 23.2253 19.51C23.0158 19.0477 23.2174 18.5524 23.527 18.3231C23.9571 18.0045 24.5702 18.0907 24.8939 18.5213C24.9503 18.5965 24.9975 18.6791 25.0446 18.7606C25.8588 20.1697 26.6724 21.5791 27.486 22.9885C28.7006 25.0925 29.9154 27.1962 31.1301 29.3C31.1617 29.3546 31.1941 29.4081 31.2262 29.4625C31.2616 29.5229 31.3156 29.5469 31.3843 29.5431C31.4471 29.5397 31.5102 29.5342 31.5728 29.5354C31.7692 29.5397 31.9686 29.526 32.1612 29.5556C32.9428 29.6754 33.5783 30.0487 34.0519 30.6876C34.0847 30.7317 34.1177 30.7759 34.1471 30.8224C34.1955 30.8985 34.2644 30.9217 34.3498 30.9086C34.3886 30.9024 34.4279 30.8987 34.4664 30.8911C34.6358 30.857 34.8056 30.8242 34.9746 30.7871C36.1347 30.5325 37.2313 30.1105 38.2708 29.5377C39.6658 28.7688 40.8629 27.7657 41.8505 26.5146C42.8969 25.1889 43.6297 23.703 44.1116 22.0889C44.4689 20.8922 44.655 19.6665 44.7153 18.4216C44.7517 17.6675 44.7368 16.9121 44.6675 16.1597C44.6113 15.5492 44.5255 14.9421 44.3982 14.3414C44.0858 12.8685 43.5671 11.4744 42.8031 10.175C41.9921 8.79579 40.9569 7.61379 39.6708 6.6586C38.2628 5.61297 36.7021 4.89506 34.9899 4.51033C34.7984 4.46722 34.6046 4.43318 34.4116 4.39733C34.3349 4.38322 34.2783 4.41143 34.2321 4.47931C34.1215 4.64146 34.0037 4.79838 33.8897 4.95831C33.872 4.98309 33.8593 5.01169 33.8399 5.04594C33.8764 5.09851 33.9113 5.14967 33.9469 5.20043C34.1322 5.46391 34.3282 5.72073 34.5012 5.99206C35.3765 7.36563 35.8651 8.87113 35.9862 10.4917C36.0392 11.1977 36.0182 11.9053 35.9135 12.6091C35.7676 13.5883 35.4895 14.5253 35.0655 15.4205C34.6032 16.3964 33.9818 17.2606 33.2443 18.0445C33.064 18.2361 32.8398 18.3477 32.5772 18.3545C32.184 18.3646 31.8679 18.2065 31.678 17.8572C31.4854 17.5031 31.506 17.146 31.7354 16.8092C31.7793 16.7449 31.8351 16.6881 31.8889 16.6309C32.5417 15.9374 33.0658 15.1592 33.4401 14.2816C33.8111 13.4112 34.014 12.5025 34.0587 11.5594C34.1006 10.6723 33.9868 9.80195 33.731 8.9513C33.4115 7.88935 32.8858 6.9396 32.1606 6.10144C31.963 5.87302 31.991 5.91169 31.7408 5.90424C30.7522 5.87483 29.9755 5.45323 29.4121 4.63985C29.3762 4.58828 29.3422 4.53531 29.3097 4.48132C29.2682 4.41263 29.2086 4.38564 29.1307 4.39692C29.0841 4.40377 29.0378 4.41243 28.9915 4.42089C27.6969 4.65899 26.4742 5.10032 25.3194 5.7298C24.4665 6.1947 23.6771 6.75045 22.963 7.40974C21.6426 8.62921 20.655 10.0805 19.9564 11.7333C19.2851 13.3222 18.9289 14.9832 18.8379 16.7004C18.7889 17.6191 18.8045 18.5387 18.9088 19.4558C18.9847 20.1207 19.0923 20.7792 19.2524 21.4286C19.6634 23.095 20.3376 24.6427 21.3373 26.043C22.0509 27.0427 22.8955 27.9153 23.8832 28.6457C25.3661 29.7423 27.0122 30.4757 28.8205 30.8427C28.9435 30.8677 29.0678 30.8874 29.1919 30.9074C29.2686 30.9197 29.3287 30.8937 29.3732 30.8262C29.4336 30.7346 29.4989 30.6463 29.5768 30.5355M15.9592 17.91C15.9721 15.9986 16.1546 14.3622 16.6099 12.7634C17.2053 10.6731 18.1635 8.76739 19.5361 7.07738C20.7773 5.54932 22.2786 4.3375 24.0199 3.42098C25.4433 2.67166 26.9451 2.15216 28.5276 1.86512C28.7208 1.83007 28.9143 1.79563 29.1091 1.77005C29.2213 1.75534 29.2924 1.70156 29.349 1.60608C29.5309 1.29769 29.7688 1.03784 30.0536 0.8209C31.3462 -0.162491 33.1923 0.135225 34.1111 1.47535C34.1199 1.48845 34.1316 1.50033 34.1371 1.51483C34.215 1.7205 34.3834 1.76823 34.582 1.79805C36.8159 2.13303 38.8774 2.92466 40.7698 4.15601C41.4237 4.58103 42.0342 5.06286 42.6075 5.59222C43.7971 6.69023 44.7696 7.95542 45.5466 9.37431C46.4115 10.9541 46.9955 12.6319 47.3049 14.4051C47.4048 14.9783 47.4711 15.5557 47.5172 16.1362C47.5847 16.9844 47.5901 17.8338 47.548 18.6815C47.3957 21.7463 46.5302 24.5877 44.8218 27.1515C43.3669 29.3352 41.4464 30.9888 39.0816 32.1261C37.7334 32.7741 36.321 33.2184 34.8455 33.4615C34.7369 33.4795 34.6284 33.4974 34.5192 33.5117C34.4106 33.526 34.3306 33.5711 34.2789 33.6751C34.2265 33.78 34.1636 33.8813 34.0944 33.9764C33.5239 34.7588 32.7522 35.1858 31.7855 35.1916C30.7296 35.1979 29.915 34.7245 29.3474 33.832C29.322 33.7921 29.296 33.752 29.2777 33.7089C29.2223 33.5806 29.1266 33.524 28.9881 33.5043C28.7002 33.4638 28.4132 33.4154 28.1285 33.3568C25.8046 32.878 23.6878 31.9411 21.807 30.4864C20.7485 29.6678 19.8326 28.71 19.05 27.6263C17.6805 25.7298 16.7831 23.6266 16.3216 21.3353C16.185 20.6565 16.0819 19.9729 16.037 19.2815C16.0019 18.7405 15.9753 18.199 15.9592 17.91" fill="white"/>
+</g>
+<mask id="mask1" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="39" width="10" height="10">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M0.784973 39.8586H9.01565V48.5607H0.784973V39.8586Z" fill="white"/>
+</mask>
+<g mask="url(#mask1)">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M2.16291 44.2098C2.16291 44.6126 2.22717 45.0032 2.35628 45.3819C2.485 45.7606 2.6683 46.095 2.90599 46.385C3.14368 46.6751 3.43193 46.907 3.77013 47.0802C4.10854 47.2532 4.48723 47.3398 4.90621 47.3398C5.3413 47.3398 5.72604 47.2494 6.06062 47.0679C6.39479 46.8866 6.67881 46.6471 6.91247 46.3488C7.14614 46.0511 7.3234 45.7163 7.44446 45.3457C7.56511 44.9752 7.62554 44.5965 7.62554 44.2098C7.62554 43.7987 7.56108 43.4061 7.43217 43.0312C7.30345 42.6565 7.11995 42.3262 6.88246 42.0402C6.64457 41.7545 6.35854 41.5247 6.02436 41.3513C5.68978 41.178 5.31713 41.0916 4.90621 41.0916C4.47132 41.0916 4.08457 41.1821 3.74596 41.3633C3.40776 41.5448 3.12152 41.7803 2.88806 42.0704C2.654 42.3604 2.47493 42.6928 2.35024 43.0675C2.22515 43.4421 2.16291 43.8228 2.16291 44.2098M4.89433 48.5607C4.28197 48.5607 3.72381 48.4378 3.22043 48.1921C2.71665 47.9463 2.28377 47.62 1.92119 47.2129C1.55861 46.8064 1.27842 46.3409 1.08122 45.817C0.883614 45.2933 0.784912 44.7577 0.784912 44.2098C0.784912 43.6377 0.889657 43.0896 1.09935 42.5661C1.30864 42.0424 1.59648 41.5789 1.96349 41.176C2.3299 40.7731 2.76499 40.4531 3.26857 40.2154C3.77215 39.9777 4.32206 39.8586 4.9185 39.8586C5.53065 39.8586 6.08862 39.9855 6.5922 40.2393C7.09578 40.4932 7.52684 40.8255 7.88539 41.2364C8.24374 41.6474 8.52192 42.1129 8.71952 42.6326C8.91672 43.1523 9.01563 43.682 9.01563 44.2217C9.01563 44.7939 8.9129 45.3416 8.70723 45.8653C8.50197 46.3893 8.21372 46.8503 7.84309 47.2494C7.47246 47.648 7.03515 47.9665 6.53177 48.204C6.02819 48.4419 5.48231 48.5607 4.89433 48.5607" fill="white"/>
+</g>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M13.4028 47.485C13.6846 47.485 13.9406 47.4244 14.1702 47.3037C14.3999 47.1829 14.5973 47.0215 14.7624 46.8201C14.9274 46.6188 15.0543 46.3894 15.1432 46.1312C15.2316 45.8736 15.2761 45.6077 15.2761 45.3335C15.2761 45.0434 15.2257 44.7697 15.125 44.5119C15.0241 44.254 14.8871 44.0284 14.7141 43.8349C14.5407 43.6417 14.3334 43.4886 14.0917 43.3758C13.85 43.263 13.5881 43.2066 13.3061 43.2066C13.1369 43.2066 12.9596 43.2388 12.7743 43.3033C12.5888 43.3679 12.4158 43.4564 12.2546 43.5692C12.0933 43.682 11.9525 43.8129 11.8316 43.962C11.7107 44.111 11.6261 44.2744 11.5776 44.4512V46.1072C11.6582 46.3004 11.7629 46.4819 11.892 46.6509C12.021 46.8201 12.164 46.9653 12.3211 47.0862C12.4782 47.2068 12.6492 47.3037 12.8347 47.376C13.0201 47.4485 13.2094 47.485 13.4028 47.485M13.8379 48.6211C13.3303 48.6211 12.8831 48.5 12.4963 48.2585C12.1096 48.0168 11.8034 47.7026 11.5776 47.3158V51.0743H10.2484V42.1793H11.4207V43.3152C11.6624 42.9367 11.9744 42.6345 12.3573 42.4087C12.7399 42.1833 13.1731 42.0703 13.6566 42.0703C14.0917 42.0703 14.4903 42.1593 14.8531 42.3362C15.2157 42.5137 15.5299 42.7514 15.7958 43.0493C16.0617 43.3476 16.269 43.6941 16.4182 44.0889C16.5673 44.4837 16.6418 44.8986 16.6418 45.3335C16.6418 45.793 16.5731 46.2218 16.4363 46.6207C16.2992 47.0195 16.1058 47.3662 15.8562 47.6601C15.6062 47.9543 15.3103 48.188 14.9679 48.3612C14.6253 48.5343 14.2488 48.6211 13.8379 48.6211" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M22.6242 44.8622C22.6 44.5965 22.5335 44.3505 22.425 44.1249C22.3162 43.8995 22.177 43.7082 22.0078 43.5508C21.8388 43.3937 21.6412 43.271 21.4156 43.1822C21.19 43.0936 20.9521 43.0493 20.7025 43.0493C20.4528 43.0493 20.2171 43.0936 19.9955 43.1822C19.7739 43.271 19.5785 43.3937 19.4093 43.5508C19.2401 43.7082 19.1032 43.8995 18.9984 44.1249C18.8935 44.3505 18.8292 44.5965 18.805 44.8622H22.6242ZM20.7025 48.6209C20.211 48.6209 19.7639 48.5341 19.361 48.361C18.9581 48.188 18.6137 47.9523 18.3276 47.654C18.0416 47.3561 17.82 47.0094 17.6629 46.6146C17.5058 46.22 17.4272 45.8008 17.4272 45.3577C17.4272 44.9147 17.5058 44.4935 17.6629 44.0947C17.82 43.6959 18.0416 43.3454 18.3276 43.0432C18.6137 42.7411 18.9581 42.5034 19.361 42.3304C19.7639 42.1569 20.2151 42.0703 20.7148 42.0703C21.2061 42.0703 21.6513 42.1591 22.0501 42.3362C22.4489 42.5137 22.7892 42.7493 23.0716 43.0432C23.3534 43.3375 23.5687 43.6798 23.7182 44.0703C23.867 44.4615 23.9416 44.8702 23.9416 45.2973C23.9416 45.3939 23.9375 45.4846 23.9295 45.5694C23.9214 45.654 23.9132 45.7243 23.9053 45.7807H18.8415C18.8655 46.0627 18.9319 46.3167 19.0407 46.5421C19.1495 46.7677 19.2903 46.9633 19.4639 47.1283C19.637 47.2934 19.8342 47.4203 20.0559 47.509C20.2775 47.5978 20.5092 47.6419 20.7509 47.6419C20.9281 47.6419 21.1032 47.6198 21.2768 47.5754C21.4498 47.5313 21.609 47.4669 21.7542 47.3823C21.899 47.2975 22.028 47.1947 22.141 47.0737C22.2536 46.953 22.3422 46.8201 22.4066 46.675L23.5429 47.0014C23.3252 47.4767 22.9644 47.8655 22.461 48.1677C21.9575 48.4698 21.3713 48.6209 20.7025 48.6209V48.6209Z" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M30.6972 48.5H29.3678V44.9588C29.3678 44.3628 29.2731 43.9297 29.0838 43.6598C28.8944 43.3899 28.6144 43.2549 28.2438 43.2549C28.0504 43.2549 27.857 43.2912 27.6637 43.3635C27.4703 43.436 27.289 43.539 27.1198 43.6717C26.9506 43.8046 26.7995 43.962 26.6666 44.1432C26.5336 44.3245 26.4309 44.5238 26.3584 44.7413V48.5H25.0289V42.1793H26.2375V43.4481C26.4794 43.0213 26.8299 42.6849 27.289 42.4389C27.7483 42.1934 28.2561 42.0703 28.812 42.0703C29.1907 42.0703 29.5009 42.139 29.7426 42.276C29.9842 42.4129 30.1755 42.6003 30.3165 42.838C30.4575 43.0755 30.5562 43.3498 30.6126 43.6598C30.6688 43.97 30.6972 44.2984 30.6972 44.6446V48.5Z" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M33.7669 44.3182H36.1359C36.3293 44.3182 36.5046 44.2759 36.6615 44.1913C36.8186 44.1067 36.9535 43.9901 37.0666 43.841C37.1792 43.692 37.2678 43.5205 37.3322 43.3272C37.3969 43.1338 37.4291 42.9283 37.4291 42.7108C37.4291 42.4932 37.3907 42.2878 37.3141 42.0946C37.2374 41.901 37.1368 41.7318 37.012 41.5868C36.8871 41.442 36.742 41.327 36.5769 41.2424C36.4117 41.158 36.2405 41.1155 36.0632 41.1155H33.7669V44.3182ZM32.4133 48.4999V39.9189H36.1478C36.5346 39.9189 36.8913 39.9997 37.2176 40.1607C37.5437 40.3218 37.8237 40.5335 38.0576 40.7952C38.2911 41.0572 38.4744 41.3554 38.6073 41.6895C38.7402 42.0239 38.8069 42.3645 38.8069 42.7108C38.8069 43.0011 38.7664 43.2788 38.6861 43.5447C38.6055 43.8106 38.4927 44.0566 38.3475 44.282C38.2026 44.5076 38.0254 44.703 37.8159 44.8681C37.6062 45.0335 37.3766 45.1562 37.127 45.237L39.1451 48.4999H37.6102L35.7492 45.5147H33.7669V48.4999H32.4133Z" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M44.8376 44.8622C44.8135 44.5965 44.747 44.3505 44.6384 44.1249C44.5296 43.8995 44.3905 43.7082 44.2213 43.5508C44.0522 43.3937 43.8546 43.271 43.629 43.1822C43.4034 43.0936 43.1655 43.0493 42.916 43.0493C42.6662 43.0493 42.4305 43.0936 42.2089 43.1822C41.9874 43.271 41.792 43.3937 41.6228 43.5508C41.4536 43.7082 41.3166 43.8995 41.2119 44.1249C41.1069 44.3505 41.0427 44.5965 41.0185 44.8622H44.8376ZM42.916 48.6209C42.4245 48.6209 41.9773 48.5341 41.5744 48.361C41.1716 48.188 40.8271 47.9523 40.5411 47.654C40.2551 47.3561 40.0335 47.0094 39.8764 46.6146C39.7192 46.22 39.6407 45.8008 39.6407 45.3577C39.6407 44.9147 39.7192 44.4935 39.8764 44.0947C40.0335 43.6959 40.2551 43.3454 40.5411 43.0432C40.8271 42.7411 41.1716 42.5034 41.5744 42.3304C41.9773 42.1569 42.4285 42.0703 42.9283 42.0703C43.4196 42.0703 43.8647 42.1591 44.2636 42.3362C44.6624 42.5137 45.0026 42.7493 45.285 43.0432C45.5668 43.3375 45.7821 43.6798 45.9316 44.0703C46.0805 44.4615 46.155 44.8702 46.155 45.2973C46.155 45.3939 46.151 45.4846 46.1429 45.5694C46.1349 45.654 46.1266 45.7243 46.1187 45.7807H41.0549C41.0789 46.0627 41.1454 46.3167 41.2542 46.5421C41.3629 46.7677 41.5037 46.9633 41.6774 47.1283C41.8504 47.2934 42.0476 47.4203 42.2694 47.509C42.4909 47.5978 42.7226 47.6419 42.9643 47.6419C43.1416 47.6419 43.3166 47.6198 43.4903 47.5754C43.6633 47.5313 43.8224 47.4669 43.9676 47.3823C44.1125 47.2975 44.2414 47.1947 44.3544 47.0737C44.467 46.953 44.5556 46.8201 44.6201 46.675L45.7564 47.0014C45.5386 47.4767 45.1779 47.8655 44.6745 48.1677C44.1709 48.4698 43.5847 48.6209 42.916 48.6209V48.6209Z" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M47.2546 39.6775H48.5842V46.675C48.5842 46.9089 48.6445 47.092 48.7653 47.2249C48.8864 47.3579 49.0554 47.4244 49.2731 47.4244C49.3616 47.4244 49.4643 47.4082 49.5813 47.376C49.6979 47.3442 49.8087 47.3077 49.9135 47.2674L50.1069 48.3068C49.9135 48.3953 49.684 48.4658 49.418 48.5181C49.1523 48.5703 48.9144 48.5967 48.7049 48.5967C48.2458 48.5967 47.8891 48.472 47.6355 48.2222C47.3817 47.9725 47.2546 47.6179 47.2546 47.1585V39.6775Z" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M52.9228 47.6419C53.2451 47.6419 53.5493 47.5837 53.8353 47.4669C54.1213 47.35 54.3449 47.1867 54.5061 46.9772C54.6753 46.8322 54.7599 46.6793 54.7599 46.5179V45.684C54.5343 45.5954 54.2948 45.5269 54.041 45.4785C53.7869 45.4302 53.5394 45.406 53.2975 45.406C52.8221 45.406 52.4333 45.5088 52.1312 45.7142C51.829 45.9197 51.678 46.1918 51.678 46.53C51.678 46.8443 51.7946 47.1085 52.0286 47.3216C52.2621 47.5354 52.5602 47.6419 52.9228 47.6419M52.5602 48.6209C52.2541 48.6209 51.97 48.5703 51.7084 48.4698C51.4463 48.3691 51.2207 48.2301 51.0314 48.0528C50.842 47.8756 50.6932 47.6661 50.5844 47.4244C50.4756 47.1829 50.421 46.921 50.421 46.6388C50.421 46.3409 50.4855 46.0708 50.6144 45.829C50.7433 45.5875 50.9266 45.378 51.1645 45.2008C51.402 45.0235 51.6842 44.8863 52.0105 44.7896C52.3368 44.693 52.6972 44.6446 53.0922 44.6446C53.3899 44.6446 53.6842 44.6708 53.9745 44.7232C54.2643 44.7757 54.5262 44.8462 54.7599 44.9349V44.4996C54.7599 44.0325 54.6269 43.6679 54.3612 43.406C54.0951 43.1441 53.7124 43.013 53.2129 43.013C52.8747 43.013 52.5421 43.0755 52.2158 43.2003C51.8895 43.3252 51.5531 43.5047 51.2066 43.7382L50.7957 42.8922C51.6095 42.3445 52.4555 42.0703 53.3337 42.0703C54.2039 42.0703 54.8809 42.2921 55.3642 42.7352C55.8478 43.1782 56.0895 43.8149 56.0895 44.6446V46.9291C56.0895 47.2111 56.2061 47.3561 56.4398 47.3639V48.5C56.3109 48.5244 56.2001 48.5403 56.1076 48.5484C56.0148 48.5562 55.9241 48.5607 55.8355 48.5607C55.5777 48.5607 55.3781 48.496 55.2373 48.3671C55.0963 48.2384 55.0094 48.0732 54.9774 47.8718L54.9414 47.4727C54.6591 47.8434 54.3107 48.1274 53.8957 48.325C53.4808 48.5222 53.0358 48.6209 52.5602 48.6209" fill="white"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M57.7574 49.9867C57.8783 50.0107 57.9969 50.0308 58.1139 50.0471C58.2308 50.063 58.3254 50.0713 58.398 50.0713C58.5025 50.0713 58.5931 50.0489 58.6699 50.0048C58.7462 49.9603 58.825 49.8818 58.9056 49.7692C58.9861 49.6562 59.0687 49.4972 59.1533 49.2918C59.2379 49.0861 59.3364 48.8222 59.4494 48.4999L56.851 42.1792H58.2167L60.1746 47.3278L61.915 42.1792H63.1719L60.3075 49.9623C60.1786 50.3251 59.9548 50.6291 59.6368 50.875C59.3183 51.1206 58.9096 51.2436 58.41 51.2436C58.3133 51.2436 58.2126 51.2374 58.1079 51.2253C58.0031 51.2134 57.8863 51.187 57.7574 51.147V49.9867Z" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/clients/paradex.svg b/packages/website/public/images/clients/paradex.svg
new file mode 100644
index 000000000..e3bdf48b1
--- /dev/null
+++ b/packages/website/public/images/clients/paradex.svg
@@ -0,0 +1,9 @@
+<svg width="82" height="47" viewBox="0 0 82 47" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M51.9065 2.40902L48.5125 19.4016C48.3937 19.9971 47.8718 20.4258 47.2653 20.4258H43.9271C42.6671 20.4258 41.4348 20.7925 40.379 21.4809L40.2783 21.5467L43.9832 2.99693C44.2283 1.76899 45.3053 0.885254 46.5559 0.885254H50.659C51.4619 0.885254 52.064 1.62077 51.9065 2.40902M29.1543 26.9147L32.5483 9.92205C32.6671 9.32634 33.1894 8.89757 33.7958 8.89757H37.134C38.3941 8.89757 39.6263 8.53122 40.6818 7.84283L40.7822 7.77698L37.0776 26.3265C36.8322 27.5547 35.7555 28.4384 34.5049 28.4384H30.4015C29.5989 28.4384 28.9965 27.7029 29.1543 26.9147" fill="white"/>
+<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="34" width="82" height="13">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M0.00012207 46.4356H81.0604V34.6733H0.00012207L0.00012207 46.4356Z" fill="white"/>
+</mask>
+<g mask="url(#mask0)">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M32.561 46.4356H30.7493L27.027 41.1475H28.3166C29.7831 41.1475 30.716 40.0956 30.716 38.8942C30.716 37.6095 29.8164 36.6252 28.3001 36.6252H25.3177V46.4356H23.2678V35.1377C23.2678 34.9274 23.4384 34.757 23.6486 34.757H28.4669C31.1494 34.757 32.7989 36.492 32.7989 38.7775C32.7989 40.5724 31.8089 41.9505 30.3627 42.5006L32.8148 45.9429C32.9613 46.1492 32.8141 46.4356 32.561 46.4356V46.4356ZM62.2248 41.4721H68.073V39.6369H62.2248V37.9942H60.1756V46.4356H62.2248H68.5118C68.6836 46.4356 68.8229 46.2958 68.8229 46.1239V44.6004H62.2248V41.4721ZM51.8391 34.757H48.3543C48.1445 34.757 47.9742 34.9274 47.9742 35.1377V36.6252H51.8391C54.2883 36.6252 55.8879 38.31 55.8879 40.613C55.8879 42.915 54.2883 44.5667 51.8391 44.5667H50.0231V37.9942H47.9742V46.4356H51.8391C55.5047 46.4356 58.0372 43.8827 58.0372 40.5796C58.0372 37.2759 55.5047 34.757 51.8391 34.757V34.757ZM60.1756 36.5919H68.8229V34.757H60.556C60.3458 34.757 60.1756 34.9274 60.1756 35.1377V36.5919ZM81.0605 34.757H78.7113L70.3137 46.4356H72.6628L75.6874 42.2297L78.7113 46.4356H80.4531C80.7066 46.4356 80.8537 46.1479 80.7056 45.9416L76.8617 40.5961L81.0605 34.757ZM74.7872 37.6934L72.6629 34.757H71.0583C70.7474 34.757 70.5678 35.109 70.7499 35.3608L73.6123 39.3273L74.7872 37.6934ZM39.2427 34.9015L34.2104 46.4356H36.3098L40.2585 37.1258L42.7826 43.0985H38.9758L38.267 44.9172H43.554L44.2076 46.4356H45.8979C46.1224 46.4356 46.273 46.205 46.1832 45.9991L41.3415 34.9015C41.281 34.7629 41.1441 34.6733 40.9929 34.6733H39.591C39.4401 34.6733 39.3032 34.7629 39.2427 34.9015V34.9015ZM14.5088 34.9015L9.47689 46.4356H11.576L15.525 37.1258L18.0488 43.0985H14.2423L13.5335 44.9172H18.8199L19.4738 46.4356H21.1641C21.3886 46.4356 21.5392 46.205 21.4494 45.9991L16.6079 34.9015C16.5471 34.7629 16.4102 34.6733 16.259 34.6733H14.8574C14.7062 34.6733 14.5693 34.7629 14.5088 34.9015V34.9015ZM4.84842 34.757H0.380527C0.170369 34.757 0.00012207 34.9274 0.00012207 35.1377V46.4356H1.73814C1.91026 46.4356 2.04932 46.2958 2.04932 46.1239V36.6252H4.6816C6.33948 36.6252 7.19758 37.8117 7.19758 39.2696C7.19758 40.8417 6.23129 42.1558 4.6816 42.1558H3.5064V44.0081H4.61488C7.53495 44.0081 9.28014 41.7804 9.28014 39.2197C9.28014 36.6593 7.56426 34.757 4.84842 34.757V34.757Z" fill="white"/>
+</g>
+</svg>
diff --git a/packages/website/public/images/clients/radar-relay.svg b/packages/website/public/images/clients/radar-relay.svg
new file mode 100644
index 000000000..ecc759fab
--- /dev/null
+++ b/packages/website/public/images/clients/radar-relay.svg
@@ -0,0 +1,13 @@
+<svg width="61" height="49" viewBox="0 0 61 49" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M16.3814 36.7544L12.573 48.1516H13.6538L17.3935 36.7544H16.3814Z" fill="white"/>
+<path d="M17.1706 39.4236L18.7831 44.3179H15.5923L15.2664 45.2933H19.0919L20.0354 48.1512H21.1677L17.7024 37.8149L17.1706 39.4236Z" fill="white"/>
+<path d="M43.9152 39.4236L45.5278 44.3179H42.3198L42.011 45.2933H45.8365L46.7801 48.1512H47.9123L44.447 37.8149L43.9152 39.4236Z" fill="white"/>
+<path d="M43.1089 36.7544L39.3176 48.1516H40.3984L44.1382 36.7544H43.1089Z" fill="white"/>
+<path d="M1.31935 38.3286H0.255737V48.1514H1.31935V38.3286Z" fill="white"/>
+<path d="M7.40936 40.1086C7.40936 38.0892 5.86542 36.7373 3.54949 36.7373H0.255737V37.6956H3.51518C5.23068 37.6956 6.31145 38.6197 6.31145 40.1086C6.31145 41.6316 5.21353 42.6242 3.51518 42.6242H1.95408V43.5654H3.54949C3.7382 43.5654 3.9269 43.5483 4.11561 43.5311L6.22567 48.1516H7.39221L5.17922 43.2916C6.56877 42.7782 7.40936 41.5974 7.40936 40.1086Z" fill="white"/>
+<path d="M54.6542 38.3286H53.5906V48.1514H54.6542V38.3286Z" fill="white"/>
+<path d="M60.7442 40.1086C60.7442 38.0892 59.2003 36.7373 56.8843 36.7373H53.5906V37.6956H56.85C58.5655 37.6956 59.6463 38.6197 59.6463 40.1086C59.6463 41.6316 58.5484 42.6242 56.85 42.6242H55.2889V43.5654H56.8843C57.073 43.5654 57.2617 43.5483 57.4504 43.5311L59.5605 48.1516H60.727L58.5141 43.2916C59.9036 42.7782 60.7442 41.5974 60.7442 40.1086Z" fill="white"/>
+<path d="M27.9267 36.7544H26.8631V48.1687H27.9267V36.7544Z" fill="white"/>
+<path d="M30.3456 36.7544H28.5443V37.7298H30.3456C31.9753 37.7298 33.0218 38.7737 33.0218 40.3823V44.5408C33.0218 46.1494 31.9753 47.1933 30.3456 47.1933H28.5443V48.1687H30.3456C32.5757 48.1687 34.0854 46.6799 34.0854 44.4723V40.4337C34.0854 38.2261 32.5929 36.7544 30.3456 36.7544Z" fill="white"/>
+<path d="M37.0055 22.2375C39.835 19.9572 41.6467 16.4218 41.6467 12.4471C41.6467 5.58552 36.2116 0 29.5348 0H19.4584V1.19241H29.5348C35.5805 1.19241 40.4864 6.23402 40.4864 12.4471C40.4864 16.0871 38.7968 19.3296 36.1709 21.4007L34.9292 20.1246C37.2498 18.4092 38.7561 15.606 38.7561 12.4471C38.7561 7.21724 34.6238 2.97057 29.5348 2.97057H19.4584V4.14207H29.5348C33.9928 4.14207 37.6162 7.86574 37.6162 12.4471C37.6162 15.2713 36.2319 17.7816 34.1149 19.2878L32.8732 18.0117C34.6849 16.8611 35.8859 14.811 35.8859 12.468C35.8859 8.86988 33.036 5.94115 29.5348 5.94115H19.4788L30.8579 17.6142C30.4304 17.7188 30.003 17.7816 29.5551 17.7816H19.4788V18.974H29.5551C30.349 18.974 31.0818 18.8276 31.7943 18.5556L33.1174 19.8945C32.0386 20.4384 30.8376 20.7313 29.5755 20.7313H19.4991V21.9237H29.5755C31.1633 21.9237 32.6696 21.5053 33.9724 20.7731L35.2345 22.0701C33.5856 23.0952 31.6314 23.7018 29.5755 23.7018H19.4991V24.8733H29.5755C31.9775 24.8733 34.1963 24.1621 36.0895 22.9278L39.7129 26.6515H19.4991V27.8439H42.5017L37.0055 22.2375ZM22.2676 7.11264H29.5348C32.405 7.11264 34.7256 9.49747 34.7256 12.4471C34.7256 14.4554 33.6264 16.2336 32.0182 17.1331L22.2676 7.11264Z" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/clients/sharkrelay.svg b/packages/website/public/images/clients/sharkrelay.svg
new file mode 100644
index 000000000..41d5376de
--- /dev/null
+++ b/packages/website/public/images/clients/sharkrelay.svg
@@ -0,0 +1,32 @@
+<svg width="69" height="49" viewBox="0 0 69 49" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0)">
+<path d="M64.9397 26.25C64.9397 26.2761 64.9136 26.2761 64.9136 26.3023C64.9397 26.3023 64.9397 26.3023 64.9659 26.3023C64.9659 26.2761 64.9397 26.2761 64.9397 26.25Z" fill="white"/>
+<path d="M68.0002 40.2872C67.8956 40.3918 67.8695 40.5225 67.791 40.6532C66.9541 42.3004 66.091 43.9476 65.2541 45.5947C65.2018 45.7255 65.1756 45.8301 65.1495 45.9608C65.1233 46.8759 65.1233 47.8171 65.0972 48.7322C65.0972 48.8106 65.0972 48.8891 65.0972 48.9675C64.9925 49.0198 64.9141 48.9937 64.8356 48.9937C64.5479 48.9937 64.2864 48.9937 63.9987 48.9675C63.8418 48.9675 63.8156 48.9675 63.8418 48.7845C63.8679 47.8433 63.8941 46.8759 63.8941 45.9346C63.8941 45.8039 63.8679 45.6732 63.8156 45.5425C63.1356 44.0522 62.4556 42.5619 61.7756 41.0716C61.6449 40.7578 61.4879 40.4441 61.3572 40.1303C61.4095 40.078 61.4618 40.1042 61.5141 40.1042C61.9064 40.1042 62.2987 40.1303 62.6649 40.1303C62.7956 40.1303 62.8479 40.1826 62.9002 40.2872C63.4233 41.5422 63.9726 42.7972 64.4956 44.0522C64.5218 44.0783 64.5218 44.1306 64.5741 44.1567C64.6264 44.1045 64.6525 44.0522 64.6787 43.9737C65.2541 42.7972 65.8556 41.5945 66.431 40.4179C66.5095 40.2349 66.6141 40.1826 66.7971 40.2088C67.1895 40.2349 67.5818 40.2349 67.9741 40.2349C68.0002 40.2611 68.0002 40.2872 68.0002 40.2872Z" fill="white"/>
+<path d="M49.8744 0.0784365C49.8744 0.104582 49.8483 0.104582 49.8483 0.130728V0.156873C48.8806 0.130728 47.9129 0.104582 46.9452 0.0784365C46.9452 0.052291 46.9452 0.0261455 46.9452 -3.89598e-10C47.939 0.052291 48.9067 0.0784365 49.8744 0.0784365Z" fill="white"/>
+<path d="M46.972 0.104492C47.9396 0.130638 48.9073 0.156783 49.875 0.182929C50.8427 0.209074 51.7842 0.339802 52.7258 0.496675C54.1642 0.731984 55.6027 1.07188 57.015 1.46406C57.0411 1.46406 57.0934 1.4902 57.1196 1.51635C57.0673 1.67322 56.9104 1.64708 56.8319 1.69937C55.1319 2.37915 53.4319 3.08508 51.8888 4.05246C51.3135 4.4185 50.7642 4.78454 50.3458 5.33359C50.2412 5.46432 50.1104 5.46432 49.9796 5.43818C49.1689 5.33359 48.3581 5.20287 47.5473 5.09828C46.9981 5.01985 46.4227 4.94141 45.795 4.86297C46.6843 5.67349 47.495 6.40556 48.3319 7.16378C47.9658 7.68669 47.5996 8.18345 47.2858 8.73251C46.1612 10.5888 45.3243 12.5236 44.9058 14.6414C44.3304 17.5958 44.6704 20.4195 46.1873 23.0602C46.2135 23.1125 46.2396 23.1648 46.2396 23.2171C46.2135 23.2433 46.1873 23.2694 46.1873 23.2956C45.2197 22.9034 44.252 22.485 43.2843 22.119C40.2766 20.9425 37.1905 20.0274 34.0259 19.3737C32.2213 19.0077 30.4167 18.7462 28.5859 18.6155C27.069 18.5109 25.5782 18.5371 24.0613 18.6417C23.0936 18.7201 22.1521 18.877 21.2105 19.0861C21.0798 19.1123 20.949 19.1646 20.8182 19.1123C20.8705 18.7462 21.0798 18.4586 21.2367 18.1449C22.7798 15.0597 24.7151 12.2622 27.0167 9.72604C28.8997 7.66054 30.9659 5.8565 33.3197 4.34006C36.1705 2.50988 39.2566 1.22875 42.5781 0.601257C44.0166 0.287511 45.4812 0.104492 46.972 0.104492Z" fill="white"/>
+<path d="M8.78805 29.6229C8.70959 29.0739 8.84036 28.6294 9.12805 28.1849C10.6973 25.858 12.7373 24.1062 15.1696 22.7467C17.3926 21.5178 19.7726 20.7596 22.2834 20.3674C23.5649 20.1583 24.8726 20.0798 26.1803 20.0275C28.0372 19.9752 29.8941 20.1583 31.7249 20.3936C34.1833 20.7335 36.6156 21.3087 38.9956 22.0407C40.0679 22.3806 41.114 22.8251 42.1602 23.2434C44.8017 24.2631 47.4171 25.2828 50.0586 26.3025C51.0001 26.6685 51.9678 27.0345 52.9878 27.2176C55.3417 27.6359 57.5909 27.4267 59.657 26.041C59.8662 25.9103 60.0493 25.7796 60.2586 25.6227C60.2586 25.6227 60.2847 25.6227 60.3109 25.6227C60.4155 25.7011 60.3109 25.7795 60.2586 25.8318C59.5001 26.7992 58.4801 27.4267 57.3555 27.8973C56.0217 28.4202 54.6355 28.6294 53.2232 28.6556C50.8694 28.6817 48.594 28.2372 46.3709 27.5574C45.5863 27.3221 44.854 26.93 44.0956 26.6424C41.5587 25.7011 38.9956 24.969 36.3541 24.4461C34.8895 24.1585 33.451 23.9494 31.9602 23.7925C30.3126 23.6095 28.6649 23.531 26.991 23.5572C25.1864 23.5833 23.3818 23.7402 21.6034 24.0278C18.5695 24.5246 15.6403 25.4135 12.868 26.7731C11.7696 27.296 10.7234 27.8973 9.70343 28.551C9.41574 28.734 9.20651 28.9432 9.07574 29.2569C8.94497 29.3615 8.89266 29.4922 8.78805 29.6229Z" fill="white"/>
+<path d="M47.4944 48.6012C45.8468 48.575 44.1991 48.5227 42.5514 48.4966C42.6037 45.5683 42.6822 42.64 42.7345 39.6855C44.3822 39.7117 46.0298 39.764 47.6775 39.7901C47.6775 40.2085 47.6514 40.6268 47.6514 41.0713C46.4221 41.0451 45.2191 41.019 43.9898 40.9928C43.9637 41.8033 43.9637 42.6138 43.9375 43.4244C44.9837 43.4505 46.0298 43.4766 47.076 43.5028C47.076 43.9473 47.0498 44.3656 47.0498 44.8101C46.0037 44.7839 44.9575 44.7578 43.9114 44.7316C43.8852 45.5683 43.8852 46.3527 43.8591 47.1893C45.0883 47.2155 46.3175 47.2416 47.5468 47.2677C47.4944 47.7384 47.4944 48.1567 47.4944 48.6012Z" fill="white"/>
+<path d="M50.2149 47.3463C51.4702 47.3725 52.6733 47.3986 53.9025 47.4248C53.9548 47.5293 53.9287 47.6339 53.9287 47.7123C53.9287 47.9999 53.9025 48.3137 53.9025 48.6013C53.9025 48.7059 53.8764 48.732 53.7718 48.732C53.7456 48.732 53.7194 48.732 53.6933 48.732C52.1764 48.7059 50.6595 48.6536 49.1425 48.6274C49.0902 48.6274 49.0379 48.6274 48.9595 48.6013C49.0118 45.673 49.0902 42.7447 49.1425 39.8164C49.561 39.8164 49.9533 39.8426 50.3718 39.8426C50.3456 42.3525 50.2933 44.8363 50.2149 47.3463Z" fill="white"/>
+<path d="M64.9129 26.3022C64.9129 26.5114 64.7299 26.616 64.6253 26.7729C63.1606 28.5246 61.3822 29.8842 59.3422 30.9039C57.2761 31.9235 55.1053 32.4987 52.8038 32.7079C50.9992 32.8648 49.2207 32.734 47.4684 32.3941C45.4546 32.002 43.4669 31.5313 41.5577 30.8254C40.0408 30.2764 38.6023 29.5966 37.3208 28.6031C36.9023 28.2893 36.5362 27.9494 36.2223 27.5572C36.17 27.4788 36.0916 27.4265 36.0916 27.3219C36.2223 27.2696 36.3008 27.3742 36.3792 27.4265C38.8377 28.6031 41.4008 29.3874 44.0684 29.9103C46.1869 30.3287 48.3576 30.564 50.5284 30.5378C53.9022 30.4855 57.1714 29.8842 60.336 28.6292C61.853 28.0278 63.2914 27.2958 64.6776 26.433C64.756 26.3545 64.8083 26.3022 64.9129 26.3022Z" fill="white"/>
+<path d="M58.3758 40.6791C57.7481 42.2217 57.1204 43.7382 56.4665 45.2546C55.9958 46.3789 55.5512 47.5031 55.0804 48.6274C55.0281 48.7581 54.9758 48.8365 54.8189 48.7842C54.7404 48.7581 54.6881 48.7842 54.6096 48.7581C54.7142 48.4966 54.8188 48.2352 54.9235 47.9737C55.9958 45.3853 57.0681 42.7969 58.1404 40.2347C58.1665 40.1562 58.1665 40.0255 58.2973 39.9993C58.4281 39.9732 58.5588 39.9993 58.6111 40.1301C58.7419 40.4961 58.8727 40.836 59.0034 41.202C59.9188 43.6859 60.808 46.1958 61.7234 48.6797C61.7496 48.7581 61.7757 48.8365 61.8019 48.9411C61.6973 48.9934 61.5665 48.9673 61.4619 48.9411C61.3834 48.9411 61.3834 48.8365 61.3573 48.7842C61.1219 48.1567 60.9127 47.5293 60.6773 46.9279C59.945 44.8886 59.1865 42.8492 58.4542 40.8099C58.4542 40.7314 58.4542 40.7053 58.3758 40.6791Z" fill="white"/>
+<path d="M27.1739 48.3659C26.9385 48.3659 26.86 48.1567 26.8077 48.0783L26.3108 46.8233C26.3108 46.8233 25.6046 45.0715 25.4216 44.6532C25.0554 44.6793 24.6631 44.6793 24.14 44.6793C23.9046 44.6793 23.6954 44.6793 23.46 44.6532C23.2246 44.6532 23.0154 44.6271 22.78 44.6271C22.6231 44.6271 22.4662 44.6271 22.3093 44.6271H22.2831C22.257 45.4114 22.257 46.1696 22.2308 46.954L22.2047 47.7645C22.2047 47.8429 22.2047 47.8952 22.2047 47.9475C22.1785 48.1306 22.0477 48.2351 21.8647 48.2351C21.6816 48.2351 21.5508 48.1044 21.5247 47.9475C21.5247 47.8952 21.5247 47.843 21.5247 47.8168L21.7077 39.4502C21.7077 39.4241 21.7077 39.398 21.7077 39.3718L21.7339 39.2411L21.8647 39.1626C21.9431 39.1104 22.0216 39.1104 22.1262 39.1104C22.1523 39.1104 22.2308 39.1104 22.2308 39.1104C22.2308 39.1104 23.4077 39.1365 23.8785 39.1365C24.2446 39.1365 24.6369 39.1626 25.0031 39.1626C25.4477 39.1626 25.84 39.2411 26.18 39.398C26.86 39.6856 27.2785 40.1562 27.4877 40.8621C27.7231 41.6465 27.6969 42.4308 27.4092 43.189C27.1739 43.8427 26.7031 44.3133 26.0493 44.5225L27.54 48.209L27.3308 48.3136C27.3308 48.3659 27.2523 48.3659 27.1739 48.3659ZM23.8 43.9996C24.1662 43.9996 24.5323 44.0257 24.8985 44.0257C25.0816 44.0257 25.2908 44.0257 25.5 43.9996C26.1539 43.8688 26.5723 43.5289 26.8077 42.9537C26.9646 42.5354 26.9908 42.1171 26.9646 41.6988C26.9646 41.3327 26.8862 41.0451 26.7292 40.7575C26.4416 40.2085 25.9446 39.9209 25.2908 39.8947C24.8985 39.8686 24.48 39.8686 23.957 39.8424C23.6693 39.8424 23.3816 39.8424 23.0939 39.8163C22.8585 39.8163 22.6493 39.8163 22.4139 39.8163L22.3093 43.9734L23.8 43.9996Z" fill="white"/>
+<path d="M25.8133 44.3396C25.8657 44.3135 25.8918 44.3135 25.9441 44.2873C26.5718 44.0782 26.9903 43.686 27.1995 43.0847C27.461 42.3787 27.4872 41.6467 27.2518 40.9407C27.0687 40.3394 26.6764 39.8949 26.101 39.6596C25.761 39.5027 25.3949 39.4504 25.0026 39.4504C24.0872 39.4243 23.1718 39.3981 22.2564 39.3981C22.178 39.3981 22.1257 39.372 22.0472 39.4243C22.0472 39.4504 22.0472 39.4766 22.0472 39.5027C21.9949 42.3003 21.9164 45.0717 21.8641 47.8693C21.8641 47.8954 21.8641 47.9477 21.8641 47.9739C21.8641 48 21.8903 48.0262 21.9426 48.0262C21.9688 48.0262 22.0211 48 22.0211 47.9739C22.0211 47.9216 22.0211 47.8693 22.0211 47.817C22.0472 46.7712 22.0734 45.6992 22.0995 44.6534C22.0995 44.5749 22.0734 44.4965 22.1518 44.4181C22.2303 44.4181 22.3087 44.4181 22.3872 44.4181C23.4334 44.4181 24.4795 44.5227 25.5257 44.4442C25.6303 44.4442 25.6564 44.5227 25.6826 44.5749C25.9703 45.307 26.2841 46.0391 26.5718 46.7712C26.7287 47.1895 26.9118 47.6078 27.0687 48.0262C27.0949 48.1046 27.1472 48.183 27.278 48.1307C26.781 46.8758 26.258 45.6469 25.761 44.4181C25.7872 44.3396 25.8133 44.3396 25.8133 44.3396ZM25.578 44.2351C25.3687 44.2873 25.1334 44.2873 24.9241 44.2873C24.0349 44.2612 23.1195 44.2612 22.2303 44.2351C22.2041 44.2351 22.1518 44.2351 22.0995 44.2351L22.2041 39.5812C22.2303 39.5812 22.2564 39.555 22.2564 39.555C23.2764 39.5812 24.3226 39.5812 25.3426 39.6334C26.0487 39.6596 26.6503 39.9995 26.9903 40.6531C27.1733 40.9669 27.2518 41.3329 27.2518 41.6989C27.278 42.1696 27.2518 42.614 27.0687 43.0585C26.8072 43.7383 26.2841 44.1043 25.578 44.2351Z" fill="white"/>
+<path d="M7.63696 47.9477C7.45389 47.9477 7.32312 47.817 7.32312 47.6601C7.32312 47.5817 7.32312 47.5032 7.32312 47.451L7.5062 39.2151C7.5062 39.1628 7.5062 39.1367 7.5062 39.0844C7.53235 38.9014 7.66312 38.7706 7.84619 38.7968C8.05542 38.8229 8.16004 38.9537 8.18619 39.1105C8.18619 39.1628 8.18619 39.2151 8.18619 39.2674L8.10773 43.0062L12.9462 43.1108C12.9723 42.0911 12.9985 41.0453 13.0246 40.0256L13.0508 39.2413C13.0508 39.0582 13.1816 38.9014 13.3646 38.9014C13.4692 38.9014 13.5477 38.9275 13.6262 39.006C13.6785 39.0844 13.7308 39.1628 13.7046 39.2674L13.5216 47.5817C13.5216 47.6601 13.5216 47.7124 13.5216 47.7647C13.4954 47.9477 13.3646 48.0523 13.1816 48.0523C12.9985 48.0523 12.8677 47.9216 12.8416 47.7386C12.8416 47.6863 12.8416 47.634 12.8416 47.5817L12.92 43.8167L8.08158 43.7121C8.05542 44.6795 8.02927 45.6469 8.00312 46.6143L7.97696 47.5032C7.97696 47.5555 7.97696 47.6078 7.97696 47.634C7.95081 47.817 7.82004 47.9477 7.63696 47.9477Z" fill="white"/>
+<path d="M13.1557 43.5551C11.3772 43.5028 9.62495 43.4767 7.8465 43.4244C7.79419 43.5028 7.82034 43.5813 7.82034 43.6597C7.79419 44.9147 7.76804 46.1958 7.74188 47.4508C7.74188 47.5031 7.74188 47.5554 7.74188 47.6077C7.74188 47.66 7.71573 47.66 7.66342 47.66C7.63727 47.66 7.58496 47.6338 7.58496 47.6077C7.58496 47.5554 7.58496 47.477 7.58496 47.4247C7.63727 44.8363 7.68958 42.274 7.76804 39.6856C7.76804 39.5287 7.76804 39.3719 7.76804 39.215C7.76804 39.1888 7.76804 39.1365 7.76804 39.1104C7.76804 39.0581 7.82034 39.032 7.8465 39.0581C7.89881 39.0581 7.89881 39.0843 7.89881 39.1365C7.89881 39.1888 7.89881 39.2411 7.89881 39.2934C7.87265 40.5484 7.8465 41.8034 7.82034 43.0322C7.82034 43.1107 7.79419 43.1891 7.82034 43.2675C9.5988 43.3198 11.3511 43.346 13.1295 43.3983C13.1819 43.3198 13.1557 43.2414 13.1557 43.163C13.1819 41.908 13.208 40.6791 13.2342 39.4241C13.2342 39.3719 13.2342 39.3196 13.2342 39.2673C13.2342 39.215 13.2603 39.1888 13.3126 39.1888C13.3911 39.1888 13.3911 39.2411 13.3911 39.2934C13.3911 39.3457 13.3911 39.3719 13.3911 39.4241C13.3388 42.1433 13.2603 44.8886 13.208 47.6077C13.208 47.66 13.208 47.7123 13.208 47.7646C13.208 47.7907 13.1819 47.8169 13.1295 47.8169C13.1034 47.8169 13.0511 47.7907 13.0511 47.7646C13.0511 47.7123 13.0511 47.66 13.0511 47.6077C13.0772 46.3527 13.1034 45.0977 13.1295 43.8427C13.1557 43.7382 13.1819 43.6597 13.1557 43.5551Z" fill="white"/>
+<path d="M3.00768 47.9475C2.90306 47.9475 2.79845 47.9475 2.69383 47.9214C2.27537 47.8952 1.93537 47.8168 1.62153 47.7122C0.758458 47.3723 0.20923 46.7187 0.0523074 45.7513C0 45.5422 0 45.333 0 45.1238C0.0261537 44.7839 0.287691 44.7839 0.339998 44.7839H0.366152C0.418459 44.7839 0.653843 44.8362 0.653843 45.1238C0.653843 45.3853 0.679996 45.5944 0.732304 45.8036C0.889226 46.5357 1.35999 47.0063 2.11845 47.1893C2.4323 47.2678 2.71999 47.32 3.03383 47.32C3.39998 47.32 3.79229 47.2678 4.15844 47.1632C5.28305 46.8494 5.46613 45.9343 5.41382 45.2284C5.38766 44.9147 5.3092 44.6532 5.15228 44.4179C4.9169 44.1042 4.60305 43.895 4.10613 43.7643C3.71383 43.6597 3.32152 43.5812 2.95537 43.4767C2.69383 43.4244 2.43229 43.3459 2.19691 43.2936C1.88307 43.2152 1.62153 43.1106 1.38615 42.9799C0.810765 42.6661 0.470767 42.1955 0.339998 41.568C0.235383 41.0451 0.261537 40.5745 0.418459 40.1039C0.627689 39.4764 1.0723 39.0058 1.7523 38.7705C2.22307 38.5874 2.69383 38.5613 3.26921 38.5352C3.68767 38.5613 4.13229 38.6136 4.55075 38.7705C5.38766 39.0842 5.88459 39.6856 6.06766 40.6007C6.09381 40.7575 6.11997 40.8883 6.11997 41.0451L6.14612 41.1759C6.14612 41.2281 6.14612 41.3066 6.14612 41.3589C6.14612 41.6988 5.85843 41.7249 5.80612 41.7249C5.67536 41.7249 5.59689 41.6726 5.54459 41.6203C5.43997 41.5157 5.46613 41.4112 5.46613 41.3589C5.46613 41.1497 5.43997 40.9144 5.41382 40.7052C5.28305 39.9993 4.89074 39.5548 4.2369 39.3718C3.8969 39.2672 3.5569 39.2149 3.24306 39.2149C2.79845 39.2149 2.37999 39.2934 1.96153 39.4503C1.43845 39.6594 1.12461 40.0516 1.04615 40.6529C0.993841 40.9667 1.01999 41.2543 1.0723 41.5419C1.20307 42.0387 1.54307 42.3785 2.0923 42.5877C2.30153 42.6661 2.53691 42.7184 2.79845 42.7707C2.90306 42.7969 3.00768 42.823 3.11229 42.8492C3.26921 42.8753 3.42614 42.9276 3.58306 42.9537C3.87075 43.0322 4.15844 43.0845 4.44613 43.1629C5.12613 43.3459 5.59689 43.712 5.91074 44.2349C6.06766 44.4963 6.14612 44.7839 6.17228 45.0715C6.19843 45.4376 6.22458 45.9605 6.01535 46.4834C5.75382 47.1109 5.3092 47.5292 4.62921 47.7645C4.02767 47.8952 3.5569 47.9737 3.00768 47.9475Z" fill="white"/>
+<path d="M3.19118 38.8228C3.58348 38.8489 3.97579 38.875 4.3681 39.0319C5.12655 39.3195 5.54501 39.8686 5.70194 40.6529C5.72809 40.836 5.75424 41.019 5.75424 41.202C5.75424 41.2543 5.75424 41.3066 5.75424 41.3589C5.75424 41.4112 5.7804 41.4896 5.67578 41.4896C5.59732 41.4896 5.59732 41.4112 5.59732 41.3589C5.59732 41.1236 5.57117 40.8882 5.51886 40.6529C5.36194 39.8686 4.91732 39.3457 4.15887 39.1104C3.3481 38.875 2.51118 38.875 1.70042 39.1888C1.07273 39.4241 0.706576 39.9209 0.601961 40.5745C0.549654 40.9144 0.549654 41.2281 0.654269 41.568C0.811191 42.1955 1.22965 42.5877 1.83119 42.7969C2.17118 42.9276 2.51118 42.9799 2.87733 43.0583C3.32195 43.1629 3.76656 43.2675 4.21117 43.3721C4.7604 43.5289 5.23117 43.8165 5.51886 44.3133C5.64963 44.5486 5.72809 44.7839 5.75424 45.0454C5.7804 45.4899 5.7804 45.9082 5.62347 46.3265C5.38809 46.9017 4.96963 47.2678 4.39425 47.4769C3.84502 47.6599 3.29579 47.7122 2.72041 47.6599C2.38041 47.6338 2.04042 47.5815 1.70042 47.4508C0.889652 47.137 0.445039 46.5357 0.288117 45.699C0.261963 45.5421 0.261963 45.333 0.261963 45.1238C0.261963 45.0715 0.261963 45.0192 0.340424 45.0192C0.392731 45.0192 0.392731 45.0715 0.392731 45.1238C0.392731 45.3591 0.418885 45.5944 0.471193 45.8297C0.654269 46.6926 1.2035 47.2155 2.04042 47.4246C2.77272 47.6076 3.47887 47.6076 4.21117 47.3985C5.30963 47.0847 5.72809 46.2219 5.64963 45.2023C5.62347 44.8624 5.54501 44.5486 5.33578 44.261C5.04809 43.8427 4.62963 43.6335 4.13271 43.5028C3.50502 43.3459 2.85118 43.1891 2.19734 43.0322C1.9358 42.9799 1.67426 42.8753 1.43888 42.7446C0.941959 42.457 0.628115 42.0648 0.5235 41.5157C0.445039 41.0713 0.445039 40.6268 0.575807 40.1823C0.758883 39.6071 1.17734 39.2149 1.75272 39.0058C2.22349 38.875 2.69426 38.8228 3.19118 38.8228Z" fill="white"/>
+<path d="M33.9471 48.5228C33.764 48.5228 33.6594 48.3659 33.6071 48.3137L33.1101 47.6077L30.4425 43.8166L30.2071 44.0519C29.9194 44.3395 29.6578 44.6533 29.3702 44.9409C29.344 44.967 29.344 44.9932 29.344 45.0455C29.3178 45.7775 29.3178 46.5358 29.2917 47.2678L29.2655 47.9476C29.2655 47.9999 29.2655 48.0522 29.2655 48.1045C29.2655 48.2875 29.1086 48.3921 28.9517 48.4182C28.7686 48.4182 28.6378 48.2875 28.6117 48.1045C28.6117 48.0522 28.6117 47.9999 28.6117 47.9738L28.7948 39.7641C28.7948 39.7118 28.7948 39.6334 28.7948 39.5811C28.8209 39.398 28.9517 39.2935 29.1348 39.2935C29.3178 39.2935 29.4486 39.4242 29.4486 39.6072C29.4486 39.6595 29.4486 39.7118 29.4486 39.7641L29.344 43.9996C30.1025 43.1891 30.8871 42.3525 31.6455 41.542L33.5024 39.5549C33.5547 39.5026 33.6594 39.3719 33.8424 39.3719C33.9209 39.3719 33.9994 39.398 34.0778 39.4503L34.3394 39.6333L30.8871 43.3199L34.3917 48.3137L34.1563 48.4705C34.104 48.4967 34.0255 48.5228 33.9471 48.5228Z" fill="white"/>
+<path d="M33.9464 39.6856C32.8218 40.8883 31.6972 42.091 30.5726 43.2937C31.7233 44.9409 32.8741 46.5881 34.051 48.2352C33.9464 48.3137 33.8941 48.2352 33.8418 48.1829C33.6849 47.9476 33.5018 47.7123 33.3449 47.477C32.4295 46.1959 31.5141 44.8886 30.6249 43.6075C30.5987 43.5552 30.5464 43.5029 30.5203 43.4767C30.468 43.4767 30.4418 43.5029 30.4157 43.529C30.0234 43.9474 29.631 44.3918 29.2387 44.8102C29.1603 44.8886 29.1341 44.967 29.1341 45.0978C29.108 46.0651 29.0818 47.0064 29.0818 47.9738C29.0818 48.0261 29.0818 48.0783 29.0818 48.1306C29.0818 48.1829 29.0557 48.1829 29.0034 48.1829C28.9511 48.1829 28.951 48.1568 28.951 48.1306C28.951 48.0783 28.951 48.0261 28.951 47.9738C29.0034 45.2546 29.0818 42.5093 29.1341 39.7902C29.1341 39.7379 29.1341 39.6856 29.1341 39.6333C29.1341 39.6072 29.1603 39.5811 29.2126 39.5811C29.2649 39.5811 29.2649 39.6072 29.2649 39.6333C29.2649 39.6856 29.2649 39.7379 29.2649 39.7902C29.2387 41.3328 29.1864 42.8754 29.1603 44.418C29.1603 44.4964 29.1603 44.5748 29.1603 44.6794C29.3172 44.5748 29.4218 44.418 29.5264 44.3134C30.5987 43.1891 31.6449 42.0387 32.7172 40.9145C33.0833 40.5223 33.4233 40.1563 33.7895 39.7641C33.7633 39.6595 33.8156 39.5811 33.9464 39.6856Z" fill="white"/>
+<path d="M14.2026 48.0786C14.1503 48.0786 14.098 48.0524 14.0457 48.0524L13.8364 47.974L13.8887 47.7387C13.941 47.5557 14.0195 47.3988 14.0718 47.2419C14.098 47.1896 14.1241 47.1373 14.1241 47.085C15.1964 44.4966 16.2687 41.9344 17.3149 39.3721C17.3933 39.0845 17.5764 39.0322 17.7072 39.0322C17.9164 39.0322 18.0472 39.163 18.0995 39.3721V39.3983C19.041 41.9605 19.9564 44.5489 20.8979 47.1112L21.081 47.5818C21.1072 47.6341 21.1333 47.7125 21.1595 47.7648L21.2641 48.0786L21.0549 48.1832C20.9764 48.2093 20.9241 48.2354 20.8456 48.2354C20.6887 48.2354 20.5841 48.1309 20.5056 47.9478C20.401 47.6864 20.3225 47.4249 20.2179 47.1635L20.061 46.6929L17.7072 40.1826L14.5687 47.791C14.4903 48.0001 14.3595 48.0786 14.2026 48.0786Z" fill="white"/>
+<path d="M14.1241 47.7907C14.1765 47.5816 14.2811 47.3724 14.3595 47.1894C15.4318 44.601 16.5041 42.0387 17.5503 39.4765C17.5764 39.398 17.5764 39.2935 17.7072 39.2935C17.838 39.2935 17.8118 39.4242 17.8641 39.5026C18.858 42.2218 19.8518 44.967 20.8456 47.6862C20.8718 47.7646 20.898 47.8692 20.9503 47.9738C20.8195 48.0261 20.7933 47.9738 20.7672 47.8692C20.6103 47.4509 20.4533 47.0325 20.3226 46.6403C19.6949 44.8625 19.041 43.1107 18.4134 41.3328C18.2041 40.7576 17.9949 40.1824 17.7857 39.6072C17.7857 39.5811 17.7857 39.5549 17.7334 39.5288C17.6549 39.7118 17.5764 39.921 17.498 40.104C16.4518 42.6401 15.4057 45.1762 14.3595 47.6862C14.2811 47.7646 14.2811 47.8692 14.1241 47.7907Z" fill="white"/>
+<path d="M46.214 23.2173C46.2401 23.2434 46.2663 23.2696 46.2401 23.2957C46.214 23.3219 46.1878 23.2957 46.1355 23.2696C46.1878 23.2434 46.214 23.2173 46.214 23.2173Z" fill="white"/>
+<path d="M64.9136 26.3023C64.9136 26.2761 64.9397 26.2761 64.9397 26.25C64.9397 26.2761 64.9659 26.2761 64.9659 26.3023C64.9397 26.3023 64.9136 26.3023 64.9136 26.3023Z" fill="white"/>
+<path d="M20.7912 19.1123C20.8174 19.1385 20.7912 19.1646 20.765 19.1646C20.765 19.1646 20.7389 19.1646 20.7389 19.1384C20.765 19.1384 20.7912 19.1123 20.7912 19.1123Z" fill="white"/>
+<path d="M39.6746 45.0976C39.7269 45.0714 39.7531 45.0453 39.7792 45.0453C40.2761 44.81 40.6161 44.4178 40.7992 43.8949C41.113 43.0844 41.1392 42.2216 40.9561 41.3849C40.7207 40.2345 39.9884 39.6332 38.8115 39.5809C37.7654 39.5286 36.7454 39.5286 35.6992 39.5024C35.6731 39.5024 35.6469 39.5024 35.6208 39.5286C35.5946 39.5809 35.6208 39.6593 35.6208 39.7116C35.5685 42.483 35.49 45.2806 35.4377 48.052C35.4377 48.0782 35.4377 48.1043 35.4377 48.1305C35.4115 48.2612 35.4638 48.2873 35.5946 48.2873C35.9085 48.2873 36.2223 48.2873 36.5361 48.3135C36.5885 48.3135 36.6408 48.3396 36.7192 48.2612L36.7977 45.176C37.2684 45.176 37.7392 45.2022 38.1838 45.2022C38.3669 45.2022 38.3669 45.2022 38.4454 45.3852C38.8115 46.3264 39.1515 47.2677 39.5177 48.2089C39.5438 48.2873 39.57 48.3658 39.7007 48.3658C40.1454 48.3658 40.5638 48.3919 41.0346 48.3919C40.5638 47.3199 40.1192 46.2218 39.6746 45.0976ZM39.5961 43.2935C39.4392 43.7119 39.1254 43.9472 38.6546 43.9472C38.0531 43.9472 37.4254 43.921 36.7977 43.921L36.8761 40.8882C36.9285 40.8359 36.9808 40.862 37.0331 40.862C37.53 40.862 38.0269 40.8882 38.55 40.8882C38.6807 40.8882 38.8377 40.9143 38.9684 40.9404C39.3084 41.0189 39.5177 41.228 39.6484 41.5679C39.8054 42.1431 39.8054 42.7445 39.5961 43.2935Z" fill="white"/>
+</g>
+<defs>
+<clipPath id="clip0">
+<rect width="69" height="49" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/packages/website/public/images/clients/starbitex.svg b/packages/website/public/images/clients/starbitex.svg
new file mode 100644
index 000000000..eee21b3fc
--- /dev/null
+++ b/packages/website/public/images/clients/starbitex.svg
@@ -0,0 +1,22 @@
+<svg width="64" height="50" viewBox="0 0 64 50" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M28.6823 41.0316C28.7604 40.9785 28.8125 40.9785 28.8646 40.9785C29.7499 40.9785 30.6352 40.9785 31.5205 41.0051C32.0153 41.0316 32.51 41.1113 32.9526 41.3237C33.6557 41.6423 33.9682 42.2265 33.9161 42.9966C33.89 43.6338 33.6297 44.1649 33.0828 44.5101C33.0568 44.5366 33.0047 44.5632 32.9787 44.6163C33.0568 44.7225 33.161 44.7756 33.2651 44.8022C33.9421 45.0943 34.2806 45.5988 34.3327 46.3157C34.4369 47.6434 33.6557 48.3603 32.5621 48.679C32.1194 48.7852 31.6767 48.8383 31.2341 48.8117C30.479 48.8117 29.7499 48.8117 28.9948 48.8117C28.8906 48.8117 28.7864 48.8383 28.6563 48.7586C28.6823 46.2095 28.6823 43.6338 28.6823 41.0316ZM30.1665 46.4485C30.1665 46.714 30.1665 47.0061 30.1665 47.2716C30.1665 47.5637 30.1925 47.5903 30.505 47.5903C30.8175 47.5903 31.1039 47.5903 31.4164 47.5903C31.7028 47.5903 31.9632 47.5372 32.2236 47.431C32.6402 47.2451 32.8485 46.8733 32.8485 46.3954C32.8225 45.944 32.6141 45.6784 32.1975 45.5191C31.5986 45.2801 30.9737 45.4129 30.3748 45.3863C30.2446 45.3863 30.1925 45.466 30.1925 45.6253C30.1665 45.8909 30.1665 46.1564 30.1665 46.4485ZM31.0258 42.2C30.7654 42.2 30.5831 42.2 30.4008 42.2C30.2446 42.2 30.1665 42.2796 30.1925 42.4389C30.1925 42.9435 30.1925 43.4214 30.1925 43.9259C30.1925 44.1118 30.2707 44.1915 30.4529 44.1915C30.7914 44.1915 31.1039 44.1915 31.4164 44.1649C31.6507 44.1649 31.833 44.0852 32.0152 43.979C32.3798 43.7666 32.4839 43.448 32.4579 43.0497C32.4319 42.7045 32.2496 42.4655 31.9371 42.3327C31.5986 42.2 31.2862 42.2265 31.0258 42.2Z" fill="white"/>
+<path d="M19.229 41.0315C19.3331 40.9518 19.4113 40.9784 19.4894 40.9784C20.2966 40.9784 21.0777 40.9784 21.8849 40.9784C22.5099 40.9784 23.1088 41.058 23.6816 41.3767C24.3326 41.7219 24.6711 42.306 24.7232 43.023C24.7752 43.5275 24.7492 44.0054 24.5149 44.4568C24.3065 44.8817 24.0201 45.2003 23.6035 45.4393C23.3171 45.5986 23.291 45.6252 23.4733 45.9438C23.968 46.8201 24.4367 47.6698 24.9315 48.546C24.9836 48.6257 25.0096 48.6788 25.0096 48.785C24.8534 48.8647 24.6971 48.8381 24.5409 48.8381C24.2545 48.8381 23.942 48.8381 23.6556 48.8381C23.4473 48.8381 23.3171 48.785 23.2129 48.5726C22.7963 47.7494 22.3536 46.9529 21.911 46.1297C21.8329 45.9704 21.7287 45.8907 21.5464 45.8907C21.3642 45.8907 21.1819 45.8907 20.9996 45.8907C20.7392 45.8907 20.7132 45.9438 20.7132 46.2094C20.7132 46.9263 20.7132 47.6698 20.7132 48.3867C20.7132 48.5195 20.7392 48.6523 20.6611 48.8116C20.1924 48.8116 19.7237 48.8116 19.229 48.8116C19.1769 48.5726 19.1509 41.4829 19.229 41.0315ZM20.6872 43.3947C20.6872 43.7133 20.6872 44.0054 20.6872 44.3241C20.6872 44.5365 20.7653 44.6162 20.9736 44.6162C21.4162 44.6162 21.8849 44.6162 22.3276 44.5365C22.588 44.4834 22.8223 44.3772 22.9786 44.1382C23.5514 43.4213 23.1869 42.4388 22.3016 42.2795C21.8589 42.1998 21.4423 42.1998 20.9996 42.1998C20.7913 42.1998 20.7132 42.2795 20.7132 42.4919C20.7132 42.8105 20.7132 43.1026 20.6872 43.3947Z" fill="white"/>
+<path d="M51.1289 48.7853C51.1289 46.1831 51.1289 43.6074 51.1289 41.0583C51.2331 40.9787 51.3372 41.0052 51.4153 41.0052C52.7693 41.0052 54.0973 41.0052 55.4513 41.0052C55.8419 41.0052 55.8419 41.0052 55.8419 41.4035C55.8419 41.6159 55.8419 41.8284 55.8419 42.0143C55.8419 42.2798 55.8159 42.3063 55.5034 42.3063C54.8264 42.3063 54.1494 42.3063 53.4724 42.3063C53.2901 42.3063 53.0818 42.3063 52.8995 42.3063C52.7173 42.3063 52.6392 42.386 52.6392 42.5719C52.6392 42.9702 52.6392 43.3685 52.6392 43.7668C52.6392 44.0323 52.6912 44.0854 52.9777 44.0854C53.6547 44.0854 54.3317 44.0854 55.0087 44.0854C55.3472 44.0854 55.3472 44.0854 55.3472 44.4306C55.3472 44.643 55.3472 44.8554 55.3472 45.0944C55.3472 45.36 55.3211 45.3865 55.0608 45.3865C54.4098 45.3865 53.7849 45.3865 53.1339 45.3865C53.0558 45.3865 53.0037 45.3865 52.9256 45.3865C52.7433 45.3865 52.6392 45.4662 52.6392 45.652C52.6392 46.1565 52.6392 46.6876 52.6392 47.1921C52.6392 47.4046 52.6912 47.4577 52.9777 47.4577C53.7849 47.4577 54.566 47.4577 55.3732 47.4577C55.4513 47.4577 55.5295 47.4577 55.6076 47.4577C55.894 47.4577 55.92 47.5108 55.92 47.7763C55.92 48.0418 55.92 48.3074 55.92 48.5729C55.92 48.7057 55.868 48.7853 55.7117 48.7853C55.6596 48.7853 55.6076 48.7853 55.5555 48.7853C54.1754 48.7853 52.7954 48.7853 51.3893 48.7853C51.3372 48.8384 51.2331 48.8384 51.1289 48.7853Z" fill="white"/>
+<path d="M11.5742 48.8383C11.7044 48.3869 11.8346 48.0151 11.9388 47.6168C12.2773 46.5281 12.6158 45.466 12.9543 44.3773C13.2928 43.3418 13.6052 42.2796 13.9437 41.244C13.9958 41.0847 14.1 40.9785 14.2822 40.9785C14.6989 40.9785 15.1415 40.9785 15.5581 40.9785C15.7404 40.9785 15.8446 41.0582 15.9227 41.2175C16.2352 42.2531 16.5737 43.2886 16.8861 44.3242C17.1726 45.2536 17.459 46.1829 17.7714 47.1123C17.9277 47.5903 18.0839 48.0682 18.2141 48.5462C18.2401 48.6259 18.2662 48.7055 18.2141 48.8117C17.7714 48.8117 17.3027 48.8117 16.834 48.8117C16.7039 48.8117 16.6518 48.7321 16.6257 48.6258C16.4955 48.1213 16.3393 47.6434 16.2352 47.1389C16.1831 46.9264 16.0789 46.8202 15.8706 46.8202C15.2196 46.8202 14.5947 46.8202 13.9437 46.8202C13.7354 46.8202 13.6573 46.8999 13.6052 47.1123C13.5011 47.5903 13.3449 48.0417 13.2407 48.4931C13.1626 48.7852 13.1365 48.8117 12.8241 48.8383C12.4335 48.8383 12.0429 48.8383 11.5742 48.8383ZM14.9332 42.2796C14.803 42.439 14.7509 42.5983 14.7249 42.731C14.6468 43.0762 14.5687 43.3949 14.4645 43.7401C14.3083 44.2446 14.1781 44.7756 14.0479 45.3067C13.9698 45.5722 14.0219 45.6519 14.3083 45.6519C14.6989 45.6519 15.0895 45.6519 15.48 45.6519C15.7925 45.6519 15.8185 45.5988 15.7144 45.3067C15.5581 44.696 15.4019 44.0852 15.2196 43.5011C15.1415 43.0762 15.0634 42.6779 14.9332 42.2796Z" fill="white"/>
+<path d="M5.22159 41.8547C5.03932 42.1468 4.80497 42.3858 4.6227 42.6513C4.4925 42.8106 4.38835 42.7841 4.25816 42.6779C3.99777 42.4654 3.6853 42.3327 3.37284 42.253C2.98226 42.1468 2.59167 42.1468 2.22713 42.3327C1.70636 42.5716 1.6022 43.1293 2.01882 43.5276C2.25317 43.7665 2.56564 43.8462 2.85206 43.979C3.3468 44.1914 3.8155 44.3773 4.31023 44.6428C5.11743 45.0676 5.56009 45.7315 5.53405 46.6609C5.50802 47.6168 5.01328 48.2806 4.18004 48.6789C3.13849 49.1569 2.0709 49.0772 1.05539 48.5992C0.716884 48.4399 0.430457 48.254 0.144031 48.0151C-0.0382406 47.8557 -0.0382406 47.8026 0.0919532 47.6168C0.300263 47.3512 0.534612 47.0857 0.768961 46.7936C0.951232 46.7936 1.02935 46.9264 1.15954 47.006C1.75843 47.4309 2.38336 47.6699 3.11245 47.5637C3.6853 47.484 3.99777 47.1122 3.97173 46.6343C3.94569 46.2891 3.73738 46.0767 3.47699 45.9439C3.06037 45.7315 2.61771 45.5456 2.17505 45.3597C1.75843 45.1739 1.36785 44.9614 1.00331 44.6959C-0.0642794 43.9524 -0.0642794 42.1733 1.10746 41.3767C1.96674 40.7926 2.90414 40.7129 3.89361 41.0316C4.38835 41.1909 4.85705 41.4299 5.22159 41.8547Z" fill="white"/>
+<path d="M63.0006 48.8115C62.584 48.8646 62.1934 48.8115 61.8289 48.8381C61.4383 48.8912 61.256 48.7319 61.0998 48.3867C60.7613 47.6432 60.3707 46.9262 60.0582 46.2093C60.0062 46.1031 59.9541 46.0234 59.876 45.8907C59.6416 46.1827 59.5635 46.5279 59.4073 46.8466C59.1208 47.4307 58.8344 48.0415 58.574 48.6522C58.5219 48.785 58.4438 48.8646 58.2876 48.8646C57.8449 48.8646 57.4023 48.8646 56.9596 48.8646C56.9336 48.8646 56.9075 48.8381 56.8555 48.8115C57.1159 48.2804 57.4023 47.7759 57.6627 47.2714C58.0272 46.5545 58.4178 45.8641 58.8084 45.1737C58.9386 44.9347 58.9386 44.7489 58.8084 44.5099C58.2616 43.5009 57.7147 42.4653 57.1679 41.4297C57.1159 41.3235 57.0638 41.2173 57.0638 41.1111C57.1159 41.0049 57.22 41.0314 57.2981 41.0314C57.6366 41.0314 58.0012 41.058 58.3397 41.0314C58.574 41.0049 58.7042 41.1111 58.8084 41.3235C59.1208 42.0404 59.4593 42.7308 59.7978 43.4212C59.8499 43.554 59.928 43.6602 59.9801 43.7929C60.1103 43.7133 60.1624 43.6071 60.2145 43.5009C60.5269 42.7574 60.8654 42.0139 61.1779 41.2704C61.256 41.1111 61.3602 41.0049 61.5685 41.0314C61.9851 41.058 62.4017 41.0314 62.8183 41.0314C62.8444 41.1907 62.7663 41.2969 62.7142 41.4031C62.1674 42.4653 61.6206 43.5009 61.0477 44.563C60.9175 44.802 60.8915 45.0144 61.0477 45.2534C61.6726 46.3421 62.2455 47.4573 62.8444 48.546C62.8965 48.5725 62.9225 48.6522 63.0006 48.8115Z" fill="white"/>
+<path d="M40.6345 48.8381C40.5564 48.6522 40.5824 48.5195 40.5824 48.4132C40.5824 46.5545 40.5824 44.7223 40.5824 42.8636C40.5824 42.7839 40.5824 42.7043 40.5824 42.6246C40.6085 42.4122 40.5043 42.3325 40.3221 42.3325C39.8273 42.3325 39.3326 42.3325 38.8378 42.3325C38.4473 42.3325 38.4473 42.3325 38.4473 41.9342C38.4473 41.7218 38.4473 41.5094 38.4473 41.3235C38.4473 41.0314 38.4733 41.0314 38.7597 41.0049C38.916 41.0049 39.0982 41.0049 39.2545 41.0049C40.8168 41.0049 42.3791 41.0049 43.9414 41.0049C44.306 41.0049 44.332 41.0049 44.332 41.3766C44.332 41.5891 44.332 41.8015 44.332 42.0405C44.332 42.306 44.306 42.3325 44.0456 42.3325C43.5509 42.3325 43.0561 42.3325 42.5614 42.3325C42.1708 42.3325 42.1708 42.3325 42.1708 42.7308C42.1708 44.6161 42.1708 46.5014 42.1708 48.3867C42.1708 48.4664 42.1708 48.546 42.1708 48.6257C42.1708 48.7584 42.1187 48.8381 41.9885 48.8381C41.5198 48.8381 41.0772 48.8381 40.6345 48.8381Z" fill="white"/>
+<path d="M8.16577 48.8381C8.08766 48.6522 8.11369 48.5195 8.11369 48.4132C8.11369 46.5545 8.11369 44.7223 8.11369 42.8636C8.11369 42.7839 8.11369 42.7043 8.11369 42.6246C8.13973 42.4122 8.03558 42.3325 7.85331 42.3325C7.35857 42.3325 6.86383 42.3325 6.3691 42.3325C5.97852 42.3325 5.97852 42.3325 5.97852 41.9342C5.97852 41.7218 5.97852 41.5094 5.97852 41.3235C5.97852 41.0314 6.00455 41.0314 6.29098 41.0049C6.44721 41.0049 6.62948 41.0049 6.78572 41.0049C8.34804 41.0049 9.91037 41.0049 11.4727 41.0049C11.8372 41.0049 11.8633 41.0049 11.8633 41.3766C11.8633 41.5891 11.8633 41.8015 11.8633 42.0405C11.8633 42.306 11.8372 42.3325 11.5768 42.3325C11.0821 42.3325 10.5874 42.3325 10.0926 42.3325C9.70206 42.3325 9.70206 42.3325 9.70206 42.7308C9.70206 44.6161 9.70206 46.5014 9.70206 48.3867C9.70206 48.4664 9.70206 48.546 9.70206 48.6257C9.70206 48.7584 9.64998 48.8381 9.51979 48.8381C9.05109 48.8381 8.60843 48.8381 8.16577 48.8381Z" fill="white"/>
+<path d="M37.173 48.8115C36.7043 48.8115 36.2356 48.8115 35.7148 48.8115C35.7148 46.2093 35.7148 43.6336 35.7148 41.0049C36.1835 41.0049 36.6262 41.0049 37.0689 41.0049C37.173 41.0049 37.1991 41.0845 37.2251 41.1642C37.2251 41.2704 37.2251 41.3766 37.2251 41.4828C37.2251 43.793 37.2251 46.1297 37.2251 48.4398C37.2251 48.546 37.2511 48.6522 37.173 48.8115Z" fill="white"/>
+<path d="M45.2448 42.5451C45.2708 41.1643 46.3905 40.1287 47.7705 40.2615C48.9162 40.3677 49.9057 41.3502 49.8276 42.7575C49.7495 44.3772 48.5257 45.1207 47.406 45.0676C46.1041 44.988 45.1667 43.8727 45.2448 42.5451ZM49.2027 42.2795C49.2547 42.0937 49.1506 41.9343 49.0725 41.8016C48.8381 41.2705 48.4475 40.9253 47.8747 40.8722C47.6664 40.8191 47.4841 40.8191 47.2758 40.8722C47.1977 40.8456 47.1196 40.8722 47.0415 40.8988C46.4165 41.1112 46.052 41.536 45.8957 42.1733C45.6874 43.1292 46.052 44.2976 47.2758 44.5366C48.083 44.6693 49.0985 44.1914 49.2027 43.0761C49.2287 42.784 49.2287 42.5185 49.2027 42.2795Z" fill="white"/>
+<path d="M48.576 42.2C48.576 42.1204 48.576 42.0673 48.5499 41.9876C48.3676 41.6955 48.1593 41.5097 47.7948 41.4831C47.5084 41.4565 47.2219 41.4565 46.9095 41.4565C46.6491 41.4565 46.623 41.4831 46.623 41.7486C46.623 42.3328 46.623 42.9435 46.623 43.5277C46.623 43.7932 46.6491 43.8198 46.9095 43.8198C47.1699 43.8198 47.1959 43.7932 47.2219 43.5277C47.2219 43.448 47.2219 43.3684 47.2219 43.2887C47.2219 43.1825 47.248 43.0763 47.3782 43.0497C47.5084 43.0232 47.6125 43.0763 47.6646 43.1825C47.7427 43.2887 47.7688 43.3949 47.8469 43.5277C48.0291 43.8994 48.1593 43.926 48.5499 43.7667C48.5239 43.5277 48.3676 43.3684 48.2895 43.156C48.2374 43.0497 48.1333 42.917 48.3156 42.8108C48.3416 42.7577 48.3937 42.7046 48.4458 42.678H48.4718C48.4718 42.5983 48.5239 42.5452 48.576 42.5187C48.576 42.4656 48.576 42.439 48.602 42.3859C48.5499 42.3062 48.5499 42.2531 48.576 42.2ZM47.7948 42.4656C47.6646 42.6514 47.4563 42.6514 47.274 42.5718C47.3261 42.3859 47.3261 42.2 47.274 42.0142C47.3782 41.9345 47.4823 41.9611 47.5865 41.9876C47.6646 41.9611 47.6906 41.9876 47.7167 42.0407C47.8729 42.1469 47.925 42.3062 47.7948 42.4656Z" fill="white"/>
+<path d="M48.4453 42.6513C48.4453 42.5716 48.4974 42.5185 48.5495 42.4919Z" fill="white"/>
+<path d="M45.4291 23.2415H32.5582C31.196 21.8744 29.6928 20.6487 28.2836 19.3287C25.7 16.9244 23.1164 14.5672 20.4859 12.1629C20.251 11.9272 20.0161 11.6915 19.7813 11.4558H33.0749C33.4507 11.8329 33.8735 12.163 34.2023 12.493C37.6784 15.8401 41.1545 19.1401 44.6306 22.4872C44.9594 22.723 45.1943 23.0058 45.4291 23.2415Z" fill="white"/>
+<path d="M46.0399 24.1843C45.9929 24.2786 45.9459 24.3729 45.852 24.5143C44.8655 25.74 43.926 26.9657 42.9396 28.1915C41.4364 30.0772 39.9332 31.9158 38.477 33.8015C38.0542 34.3672 37.5375 34.5558 36.8799 34.5558C32.981 34.5558 29.0352 34.5558 25.1364 34.5086C24.9015 34.5086 24.5727 34.5557 24.3848 34.4615L29.0822 28.8043L29.1761 28.6629C29.411 28.38 29.6459 28.0972 29.8807 27.8615C29.9747 27.7672 30.0217 27.6729 30.0686 27.5786L30.7732 26.73C30.9142 26.6829 31.0551 26.5886 31.196 26.4472C31.8537 25.6929 32.5113 25.0329 33.028 24.1843H46.0399Z" fill="white"/>
+<path d="M40.1691 0.471334C40.1691 0.518477 40.1691 0.565614 40.1691 0.612757C40.1691 0.659899 40.1222 0.754197 40.1222 0.80134C40.1222 0.848482 40.0752 0.848488 40.0752 0.895631C40.0752 0.942774 40.0282 0.989894 40.0282 0.989894C39.9812 1.08418 39.8873 1.17848 39.8403 1.27277C39.6524 1.55563 33.4988 9.5699 32.7942 10.5128H19.2656C19.3596 10.3242 19.5005 10.1828 19.6414 10.0413C20.44 9.00419 21.2855 8.06134 22.0841 7.07134C23.7282 5.04419 25.4192 3.01704 27.0164 0.989894C27.4391 0.471322 27.9558 0.188488 28.6135 0.188488C32.1365 0.188488 35.6126 0.188488 39.1357 0.188488C39.5115 0.188488 39.8403 0.188477 40.1691 0.471334Z" fill="white"/>
+<path d="M29.8352 26.3999L23.6816 33.8013C22.0375 32.1042 20.3934 30.4542 18.7493 28.7099C18.0447 27.9556 18.0447 27.9084 18.7024 27.1541C20.2525 25.3156 21.8496 23.4299 23.3998 21.5913C24.1514 20.6956 24.2453 20.6956 25.0439 21.497C26.688 23.147 28.2381 24.7499 29.8352 26.3999Z" fill="white"/>
+<path d="M30.0683 27.5786C30.0213 27.6729 29.9743 27.7672 29.8804 27.8615C29.6455 28.1443 29.4107 28.38 29.1758 28.6629L30.0683 27.5786Z" fill="white"/>
+<path d="M45.8993 6.93004C44.5841 8.67433 43.3158 10.3715 42.0944 12.1629C41.7656 12.6343 41.4838 12.6815 41.061 12.3043C39.4639 10.7486 37.7728 9.28719 36.2227 7.63719L41.2489 0.895763C42.7521 2.45148 44.2552 4.00719 45.7584 5.51576C46.2751 5.98719 46.3221 6.36433 45.8993 6.93004Z" fill="white"/>
+<path d="M52.8997 5.98715C52.0072 5.84572 51.6784 4.99715 50.8798 5.04429C50.1752 5.09143 49.7994 5.89286 49.0479 5.98715C48.9539 5.46858 49.0479 5.0443 49.2358 4.66715C49.5646 4.00715 49.2827 3.58286 48.766 3.15858C48.4372 2.87572 47.8735 2.73429 47.9675 2.12143C48.2963 1.79143 48.719 1.93285 49.0948 1.93285C49.8464 1.97999 50.2692 1.65001 50.4101 0.895726C50.5041 0.518583 50.5041 0.0942857 51.0677 0C51.5845 0.471429 51.3496 1.41428 52.0072 1.79142C52.6179 2.16857 53.4164 1.69714 54.0271 2.12143C54.0271 2.78143 53.4634 2.87572 53.1346 3.15858C52.6179 3.58286 52.336 4.00715 52.6649 4.66715C52.8528 4.99716 52.9467 5.46858 52.8997 5.98715Z" fill="white"/>
+<path d="M39.1818 2.1214L40.0274 1.03712C39.9804 1.1314 39.8865 1.22568 39.8395 1.31996C39.6046 1.64996 39.3697 1.93282 39.0879 2.26282L39.1818 2.1214Z" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/clients/tokenjar.svg b/packages/website/public/images/clients/tokenjar.svg
new file mode 100644
index 000000000..f36a6c6aa
--- /dev/null
+++ b/packages/website/public/images/clients/tokenjar.svg
@@ -0,0 +1,13 @@
+<svg width="65" height="54" viewBox="0 0 65 54" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M13.4087 47.2394C13.4087 48.5078 13.4276 49.7763 13.4087 51.0639C13.3898 52.1786 12.6333 52.9665 11.5554 52.9665C10.7043 52.9665 9.79657 53.2164 9.13465 52.3515C8.83206 51.9672 8.64294 51.6212 8.64294 51.1023C8.66186 48.5078 8.66186 45.9325 8.64294 43.338C8.64294 42.7615 8.86989 42.3771 9.26703 42.0312C10.137 41.2816 11.8769 41.2816 12.7657 41.9927C13.2196 42.3579 13.4466 42.7807 13.4276 43.4149C13.3709 44.6833 13.4087 45.971 13.4087 47.2394ZM10.137 47.2394C10.137 48.2964 10.1181 49.3534 10.137 50.4105C10.1559 51.2561 10.345 51.4291 11.0447 51.4291C11.7067 51.4291 11.8958 51.0831 11.8958 50.4681C11.8769 48.3156 11.8769 46.1439 11.8958 43.9915C11.8958 43.3765 11.7067 43.0305 11.0447 43.0305C10.345 43.0305 10.1559 43.2227 10.137 44.0491C10.1181 45.1254 10.137 46.1824 10.137 47.2394Z" fill="white"/>
+<path d="M56.0165 52.7551H54.5414L54.4847 48.7L52.9906 48.6808V52.6975L51.4398 52.7359C51.4398 52.7359 51.4777 52.1593 51.4777 51.7942C51.4588 49.1228 51.5533 46.4514 51.4398 43.78C51.3642 41.935 52.4611 41.6083 53.766 41.5315C55.2979 41.4354 55.9787 42.2618 55.9787 43.8761C55.9787 46.4706 55.9787 49.0459 55.9787 51.6404C55.9976 52.044 56.0165 52.7551 56.0165 52.7551ZM54.4847 47.2586C54.4847 47.2586 54.4847 44.9331 54.4847 43.8185C54.4847 43.2996 54.2199 43.0497 53.7093 43.0497C53.1797 43.0689 52.9717 43.3572 52.9717 43.8569C52.9717 44.9716 52.9717 47.297 52.9717 47.297L54.4847 47.2586Z" fill="white"/>
+<path d="M61.7656 52.8895C60.9713 52.928 60.4418 52.9087 60.4418 52.9087V41.5121H61.4063C61.4063 41.5121 63.0705 41.3391 63.8648 41.7812C64.4322 42.0887 64.7726 42.4922 64.7537 43.1649C64.7537 44.3949 64.7537 45.6249 64.7537 46.8549C64.7537 47.1047 64.6402 47.4891 64.4133 47.6428C64.1863 47.7966 63.9783 47.9503 63.9783 47.9503C63.9783 47.9503 64.262 49.2188 64.3376 49.7569C64.4889 50.737 64.9995 52.8895 64.9995 52.8895H63.6757C63.6757 52.8895 63.5811 52.4283 63.4866 52.0631C63.2218 51.0061 62.976 49.9491 62.749 48.8728C62.7112 48.6999 62.6355 48.3731 62.6355 48.3731L61.7278 48.3924C61.7278 48.3924 61.7278 48.7767 61.7278 48.9689C61.7656 50.2758 61.7656 51.5442 61.7656 52.8895ZM61.8223 46.951C63.1651 47.1816 63.4866 46.9317 63.5055 45.7018C63.5055 45.2789 63.5244 44.8561 63.5055 44.4333C63.4677 43.2226 63.1083 42.8766 61.8223 43.0688C61.8223 44.2988 61.8223 45.7018 61.8223 46.951Z" fill="white"/>
+<path d="M35.459 45.2022C35.459 46.4514 35.3833 52.9089 35.3833 52.9089H34.2108L34.2865 41.5891L35.5536 41.6083L37.18 46.4514V41.6468L38.5038 41.5891V52.8897C38.5038 52.8897 37.7095 52.8897 37.2178 52.9089C37.2178 52.1401 37.2178 49.8916 37.2178 49.8916C37.2178 49.8916 35.5536 45.183 35.459 45.2022Z" fill="white"/>
+<path d="M22.7515 52.7935L21.2196 52.755C21.2196 52.755 20.0471 49.6993 19.6877 48.5269C19.5932 48.2386 19.4419 47.7966 19.1771 47.1047C19.1771 48.8536 19.1771 52.755 19.1771 52.755H17.6831C17.6831 52.755 17.6831 52.2169 17.6831 51.7172C17.6831 48.7191 17.6642 45.7018 17.6831 42.7037C17.6831 42.1848 17.6831 41.6659 17.6831 41.6659L19.1204 41.6274C19.1204 41.6274 19.1204 45.0676 19.1204 46.9126C19.4419 46.3168 20.7846 41.6659 20.7846 41.6659H22.2598C22.2598 41.6659 21.0872 45.8555 20.7846 47.0471C21.0683 47.9696 22.7515 52.7935 22.7515 52.7935Z" fill="white"/>
+<path d="M26.4768 52.8511C26.4768 49.065 26.4768 41.6274 26.4768 41.6274L29.9188 41.5505L29.8998 43.0112H27.9898V46.3168L29.5783 46.3552L29.6162 47.8542L27.9898 47.9119V51.2752H29.8998C29.8998 51.2752 29.8809 52.3898 29.8998 52.8703C28.7273 52.8511 27.6115 52.8511 26.4768 52.8511Z" fill="white"/>
+<path d="M45.7101 41.5122H47.1664C47.1664 41.5122 47.2231 48.085 47.2042 50.7564C47.2042 52.217 46.4477 52.9857 45.105 52.9473C44.5944 52.9473 44.0648 52.8896 44.0648 52.8896C44.0648 52.8896 44.0648 52.1401 44.0648 51.3906C44.2161 51.3906 44.3107 51.4482 44.4241 51.429C45.5399 51.2368 45.6912 51.0831 45.7101 50.0068C45.7291 47.6429 45.7101 41.5122 45.7101 41.5122Z" fill="white"/>
+<path d="M4.29299 41.8582V43.0305H2.78004V52.7167L1.4373 52.7551C1.4373 52.7551 1.47512 47.2586 1.47512 44.8947C1.47512 43.8185 1.47512 43.1074 1.47512 43.1074L0.0189118 43.0497L3.60715e-08 41.8966L4.29299 41.8582Z" fill="white"/>
+<path d="M38.9414 6.9187V9.80149H35.594V30.9804L32.6059 31.0573C32.6059 31.0573 32.6815 18.8727 32.6815 13.6068C32.6815 11.2237 32.6815 9.78227 32.6815 9.78227H29.4665L29.4098 6.95714L38.9414 6.9187Z" fill="white"/>
+<path d="M38.0325 36.3808C38.0325 36.3808 43.9141 33.671 43.9141 29.8657C43.9141 24.9842 43.9141 18.4691 43.9141 18.4691C43.9141 18.4691 43.9141 11.954 43.9141 7.07245C43.9141 2.19092 38.0325 0 38.0325 0C43.1008 2.97888 42.5713 8.68681 42.5713 8.68681V28.2321C42.5713 28.2321 43.1198 33.3827 38.0325 36.3808Z" fill="white"/>
+<path d="M30.033 36.3808C30.033 36.3808 24.1514 33.671 24.1514 29.8657C24.1514 24.9842 24.1514 18.4691 24.1514 18.4691C24.1514 18.4691 24.1514 11.954 24.1514 7.07245C24.1514 2.19092 30.033 0 30.033 0C24.9646 2.97888 25.4941 8.68681 25.4941 8.68681V28.2321C25.4752 28.2321 24.9457 33.3827 30.033 36.3808Z" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/clients/veil.svg b/packages/website/public/images/clients/veil.svg
new file mode 100644
index 000000000..b4b36ce57
--- /dev/null
+++ b/packages/website/public/images/clients/veil.svg
@@ -0,0 +1,4 @@
+<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M43.9675 22.0108C43.9675 15.6664 43.9675 9.32189 43.9675 2.98825C43.9675 1.11523 42.8537 7.4544e-05 40.9722 7.4544e-05C28.3204 7.4544e-05 15.6687 7.4544e-05 3.01695 7.4544e-05C1.17867 -0.0107522 0.0108135 1.15854 0.0108135 3.00991C0.0108135 15.6555 0.0216269 28.312 0 40.9576C0 42.6899 1.27599 44.0108 3.03858 43.9999C15.6687 43.9566 28.2988 43.9566 40.9397 43.9999C42.6807 44.0108 44.0107 42.7116 43.9999 40.9251C43.9351 34.624 43.9675 28.312 43.9675 22.0108ZM18.4802 29.438C17.7557 31.2244 17.0312 33.0108 16.3067 34.7972C15.8525 35.9124 15.3875 37.0275 14.955 38.1535C14.7712 38.6299 14.4792 38.8139 13.971 38.8031C11.9489 38.749 12.3165 39.1062 11.5163 37.1358C10.4999 34.6132 9.4834 32.0905 8.46693 29.5679C8.1209 28.7126 8.23985 28.5285 9.14818 28.5394C10.9432 28.561 10.5756 28.2795 11.2352 29.9793C11.9597 31.8632 12.6626 33.747 13.4411 35.8041C14.1116 34.0285 14.7387 32.3937 15.3551 30.7697C15.5714 30.1958 15.7985 29.622 16.0039 29.0482C16.1337 28.7018 16.3499 28.5285 16.7392 28.5394C17.1177 28.561 17.4962 28.5394 17.8746 28.5394C18.5883 28.5502 18.7505 28.7667 18.4802 29.438ZM28.5583 34.4724C26.6984 34.4832 24.8385 34.4724 22.9894 34.4724H22.3622C22.2216 35.5659 22.7515 36.6269 23.5733 36.995C24.4276 37.374 25.4981 37.1358 26.1794 36.3563C26.4497 36.0423 26.7309 35.8799 27.1526 35.9124C27.5635 35.9448 27.9852 35.9124 28.3961 35.9232C29.0017 35.934 29.2288 36.248 28.8935 36.746C28.5475 37.2549 28.1366 37.7746 27.6176 38.1102C25.9523 39.1929 24.1248 39.312 22.2865 38.619C20.9673 38.121 20.1671 37.0816 19.7994 35.7283C19.4534 34.4724 19.4426 33.184 19.7345 31.9281C20.405 29.059 22.7948 28.063 25.1737 28.3878C27.6284 28.7234 29.0557 30.3366 29.2612 32.8267C29.2828 33.1191 29.3261 33.4006 29.3261 33.6929C29.3261 34.2992 29.1639 34.4616 28.5583 34.4724ZM33.9867 33.6929C33.9867 35.1004 33.9867 36.5078 33.9867 37.9153C33.9867 38.7165 33.9002 38.8031 33.0783 38.8031C32.6999 38.8031 32.3214 38.8031 31.9429 38.8031C31.5645 38.8031 31.3806 38.619 31.3806 38.2401C31.3806 35.2086 31.3806 32.1771 31.3806 29.1348C31.3806 28.7342 31.5753 28.5394 31.9754 28.5394C32.3863 28.5394 32.808 28.5394 33.2189 28.5394C33.8461 28.5394 33.9867 28.6801 33.9867 29.2972C33.9867 30.7697 33.9867 32.2313 33.9867 33.6929ZM34.0948 26.0925C34.084 26.6988 33.9434 26.8504 33.3811 26.8504C33.1324 26.8504 32.8729 26.8504 32.6242 26.8504C31.2833 26.8504 31.2617 26.9911 31.2725 25.497C31.2833 24.5335 31.359 24.4577 32.3214 24.4577H33.1324C33.2189 24.4577 33.3162 24.4577 33.4028 24.4577C34.0516 24.501 34.1273 24.685 34.0948 26.0925ZM39.2096 30.7047C39.2096 33.1191 39.2096 35.5443 39.2096 37.9586C39.2096 38.7057 39.1123 38.8031 38.3769 38.8031C38.0201 38.8031 37.6524 38.7923 37.2956 38.8031C36.7874 38.8248 36.5819 38.5974 36.5927 38.0885C36.6035 35.9773 36.5927 33.8661 36.5927 31.7549C36.5927 29.7303 36.5927 27.7165 36.5927 25.6919C36.5927 24.8799 36.7009 24.7716 37.5335 24.7716C37.8579 24.7716 38.1823 24.7825 38.5067 24.7716C39.0041 24.7608 39.2204 24.999 39.2204 25.497C39.1988 27.2401 39.2096 28.9724 39.2096 30.7047Z" fill="white"/>
+<path d="M26.8125 33H22.7184C22.5194 31.2688 23.3047 29.7122 24.4147 29.5812C25.9015 29.3921 26.802 30.6432 26.8125 33Z" fill="white"/>
+</svg>
diff --git a/packages/website/public/images/developers/tutorials/integrate_0x_instant.svg b/packages/website/public/images/developers/tutorials/integrate_0x_instant.svg
new file mode 100644
index 000000000..e9c9278a8
--- /dev/null
+++ b/packages/website/public/images/developers/tutorials/integrate_0x_instant.svg
@@ -0,0 +1,3 @@
+<svg width="32" height="39" viewBox="0 0 32 39" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M16 1L1 23.242H16L16.0412 38L31 15.7159H16V1Z" stroke="#3289F1" stroke-width="1.5" stroke-miterlimit="10" stroke-linejoin="round"/>
+</svg>
diff --git a/packages/website/public/images/events/berlin.jpg b/packages/website/public/images/events/berlin.jpg
new file mode 100644
index 000000000..0bcc0fa63
--- /dev/null
+++ b/packages/website/public/images/events/berlin.jpg
Binary files differ
diff --git a/packages/website/public/images/events/event-sample.jpg b/packages/website/public/images/events/event-sample.jpg
new file mode 100644
index 000000000..f7a832a5c
--- /dev/null
+++ b/packages/website/public/images/events/event-sample.jpg
Binary files differ
diff --git a/packages/website/public/images/events/london.jpg b/packages/website/public/images/events/london.jpg
new file mode 100644
index 000000000..4b6b7ef06
--- /dev/null
+++ b/packages/website/public/images/events/london.jpg
Binary files differ
diff --git a/packages/website/public/images/events/sf.jpg b/packages/website/public/images/events/sf.jpg
new file mode 100644
index 000000000..efd7f7c29
--- /dev/null
+++ b/packages/website/public/images/events/sf.jpg
Binary files differ
diff --git a/packages/website/public/images/jobs/calendar-icon.svg b/packages/website/public/images/jobs/calendar-icon.svg
deleted file mode 100644
index 2ce87388f..000000000
--- a/packages/website/public/images/jobs/calendar-icon.svg
+++ /dev/null
@@ -1,15 +0,0 @@
-<svg width="36" height="34" viewBox="0 0 36 34" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M14.5337 0.542553H13.1244V0H12.1554V0.542553H4.66839V0H3.78756V0.542553H2.37824C1.05699 0.542553 0 1.62766 0 2.98404V14.5585C0 15.9149 1.05699 17 2.37824 17H14.6218C15.943 17 17 15.9149 17 14.5585V5.33511V4.43085V2.98404C16.9119 1.62766 15.8549 0.542553 14.5337 0.542553Z" transform="translate(0.410645) scale(2)" fill="black"/>
-<path d="M0.61658 2.53191H1.84974C2.20207 2.53191 2.46632 2.26064 2.46632 1.89894V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.26064 0.264249 2.53191 0.61658 2.53191Z" transform="translate(4.63916 24.5938) scale(2)" fill="white"/>
-<path d="M0.61658 2.53191H1.84974C2.20207 2.53191 2.46632 2.26064 2.46632 1.89894V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.26064 0.264249 2.53191 0.61658 2.53191Z" transform="translate(11.5103 24.5938) scale(2)" fill="white"/>
-<path d="M0.61658 2.53191H1.84974C2.20207 2.53191 2.46632 2.26064 2.46632 1.89894V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.26064 0.264249 2.53191 0.61658 2.53191Z" transform="translate(18.5571 24.5938) scale(2)" fill="white"/>
-<path d="M0.61658 2.53191H1.84974C2.20207 2.53191 2.46632 2.26064 2.46632 1.89894V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.26064 0.264249 2.53191 0.61658 2.53191Z" transform="translate(25.6035 24.5938) scale(2)" fill="white"/>
-<path d="M0.61658 2.53192H1.84974C2.20207 2.53192 2.46632 2.26064 2.46632 1.89894V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.26064 0.264249 2.53192 0.61658 2.53192Z" transform="translate(4.63916 17.1797) scale(2)" fill="white"/>
-<path d="M0.61658 2.53192H1.84974C2.20207 2.53192 2.46632 2.26064 2.46632 1.89894V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.26064 0.264249 2.53192 0.61658 2.53192Z" transform="translate(11.5103 17.1797) scale(2)" fill="white"/>
-<path d="M0.61658 2.53192H1.84974C2.20207 2.53192 2.46632 2.26064 2.46632 1.89894V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.26064 0.264249 2.53192 0.61658 2.53192Z" transform="translate(18.5571 17.1797) scale(2)" fill="white"/>
-<path d="M0.61658 2.53192H1.84974C2.20207 2.53192 2.46632 2.26064 2.46632 1.89894V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.26064 0.264249 2.53192 0.61658 2.53192Z" transform="translate(25.6035 17.1797) scale(2)" fill="white"/>
-<path d="M0.61658 2.44149H1.84974C2.20207 2.44149 2.46632 2.17021 2.46632 1.80851V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.17021 0.264249 2.44149 0.61658 2.44149Z" transform="translate(4.63916 9.76562) scale(2)" fill="white"/>
-<path d="M0.61658 2.44149H1.84974C2.20207 2.44149 2.46632 2.17021 2.46632 1.80851V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.17021 0.264249 2.44149 0.61658 2.44149Z" transform="translate(11.5103 9.76562) scale(2)" fill="white"/>
-<path d="M0.61658 2.44149H1.84974C2.20207 2.44149 2.46632 2.17021 2.46632 1.80851V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.17021 0.264249 2.44149 0.61658 2.44149Z" transform="translate(18.5571 9.76562) scale(2)" fill="white"/>
-<path d="M0.61658 2.44149H1.84974C2.20207 2.44149 2.46632 2.17021 2.46632 1.80851V0.632979C2.46632 0.271276 2.20207 0 1.84974 0H0.61658C0.264249 0 0 0.271276 0 0.632979V1.89894C0 2.17021 0.264249 2.44149 0.61658 2.44149Z" transform="translate(25.6035 9.76562) scale(2)" fill="white"/>
-</svg>
diff --git a/packages/website/public/images/jobs/heart-icon.svg b/packages/website/public/images/jobs/heart-icon.svg
deleted file mode 100644
index b83067af6..000000000
--- a/packages/website/public/images/jobs/heart-icon.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-<svg width="42" height="36" viewBox="0 0 42 36" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path fill-rule="evenodd" clip-rule="evenodd" d="M19.9861 5.40966C19.9861 6.40787 19.7347 7.34168 19.2634 8.14669C19.1691 8.30769 19.0434 8.46869 18.9491 8.6297L17.9435 9.66011L10.0245 18L1.66551 9.3703C1.66551 9.3703 1.66551 9.3703 1.63409 9.3381L1.44554 9.1449C1.16271 8.8551 0.942742 8.50089 0.722769 8.14669C0.251398 7.37388 0 6.40787 0 5.40966C0 2.41503 2.35685 0 5.24793 0C7.32196 0 9.11317 1.25581 9.99306 3.05903C10.8415 1.25581 12.6327 0 14.7068 0C17.6293 0 19.9861 2.41503 19.9861 5.40966Z" transform="translate(0.0483398) scale(2)" fill="#FF573F"/>
-</svg>
diff --git a/packages/website/public/images/jobs/hero-dots-left.svg b/packages/website/public/images/jobs/hero-dots-left.svg
deleted file mode 100644
index 35f3239a0..000000000
--- a/packages/website/public/images/jobs/hero-dots-left.svg
+++ /dev/null
@@ -1,17 +0,0 @@
-<svg width="730" height="566" viewBox="0 0 730 566" fill="none" xmlns="http://www.w3.org/2000/svg">
-<ellipse cx="5.54373" cy="5.55975" rx="5.54373" ry="5.55975" transform="translate(569.231 541.863) scale(2)" fill="black"/>
-<ellipse cx="5.54373" cy="5.55975" rx="5.54373" ry="5.55975" transform="translate(620.402 302.363) scale(2)" fill="black"/>
-<ellipse cx="5.54373" cy="5.55975" rx="5.54373" ry="5.55975" transform="translate(425.944 249.332) scale(2)" fill="black"/>
-<ellipse cx="5.54373" cy="5.55975" rx="5.54373" ry="5.55975" transform="translate(707.397 74.8438) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(444.712 430.668) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(180.317 546.992) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(620.402 165.508) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(265.602 182.617) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(705.691 444.352) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(269.014 386.188) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(1.95703 458) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(1.95703) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(77.9043 262) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(465.178 86.8164) scale(2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(159.847 86.8164) scale(2)" fill="black"/>
-</svg>
diff --git a/packages/website/public/images/jobs/hero-dots-right.svg b/packages/website/public/images/jobs/hero-dots-right.svg
deleted file mode 100644
index 93686f128..000000000
--- a/packages/website/public/images/jobs/hero-dots-right.svg
+++ /dev/null
@@ -1,16 +0,0 @@
-<svg width="680" height="506" viewBox="0 0 680 506" fill="none" xmlns="http://www.w3.org/2000/svg">
-<ellipse cx="5.54373" cy="5.55975" rx="5.54373" ry="5.55975" transform="translate(117.916 483.762) scale(-2 2)" fill="black"/>
-<ellipse cx="5.54373" cy="5.55975" rx="5.54373" ry="5.55975" transform="translate(66.7402 196.73) scale(-2 2)" fill="black"/>
-<ellipse cx="5.54373" cy="5.55975" rx="5.54373" ry="5.55975" transform="translate(244.141 280.555) scale(-2 2)" fill="black"/>
-<ellipse cx="5.54373" cy="5.55975" rx="5.54373" ry="5.55975" transform="translate(494.888 148.828) scale(-2 2)" fill="black"/>
-<ellipse cx="5.54373" cy="5.55975" rx="5.54373" ry="5.55975" transform="translate(221.969 22.2383) scale(-2 2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(293.61 409.672) scale(-2 2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(508.535 482.051) scale(-2 2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(15.5688 25.6602) scale(-2 2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(522.182) scale(-2 2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(15.5688 372.93) scale(-2 2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(435.188 314.766) scale(-2 2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(653.747 352) scale(-2 2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(679.729 76) scale(-2 2)" fill="black"/>
-<ellipse cx="3.41153" cy="3.42138" rx="3.41153" ry="3.42138" transform="translate(305.551 138.566) scale(-2 2)" fill="black"/>
-</svg>
diff --git a/packages/website/public/images/jobs/map@2x.png b/packages/website/public/images/jobs/map@2x.png
new file mode 100644
index 000000000..08fa60ec0
--- /dev/null
+++ b/packages/website/public/images/jobs/map@2x.png
Binary files differ
diff --git a/packages/website/public/images/jobs/ship-icon.svg b/packages/website/public/images/jobs/ship-icon.svg
deleted file mode 100644
index 4e507b9c0..000000000
--- a/packages/website/public/images/jobs/ship-icon.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-<svg width="42" height="28" viewBox="0 0 42 28" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path fill-rule="evenodd" clip-rule="evenodd" d="M13.4071 11.6878H1.76832C0.771632 11.6878 0 10.9065 0 9.96896V1.71879C0 0.781267 0.803783 0 1.76832 0H13.3749C14.3716 0 15.1433 0.781267 15.1433 1.71879L16.1078 9.93771C16.14 10.9065 14.3716 11.6878 13.4071 11.6878Z" transform="translate(0.410645) scale(2)" fill="#04060C"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M8.32719 7.1564H0.96454C0.417967 7.1564 0 6.75015 0 6.21888V0.93752C0 0.406259 0.417967 0 0.96454 0H8.29504C8.84161 0 9.25958 0.406259 9.25958 0.93752V6.18763C9.29173 6.71889 8.84161 7.1564 8.32719 7.1564Z" transform="translate(21.8877 9.06641) scale(2)" fill="#04060C"/>
-<path d="M2.3792 4.6251C3.69319 4.6251 4.7584 3.58974 4.7584 2.31255C4.7584 1.03536 3.69319 0 2.3792 0C1.0652 0 0 1.03536 0 2.31255C0 3.58974 1.0652 4.6251 2.3792 4.6251Z" transform="translate(4.20508 18.75) scale(2)" fill="#04060C"/>
-<path d="M2.3792 4.6251C3.69319 4.6251 4.7584 3.58974 4.7584 2.31255C4.7584 1.03536 3.69319 0 2.3792 0C1.0652 0 0 1.03536 0 2.31255C0 3.58974 1.0652 4.6251 2.3792 4.6251Z" transform="translate(26.3887 18.75) scale(2)" fill="#04060C"/>
-</svg>
diff --git a/packages/website/public/images/jobs/world-map.svg b/packages/website/public/images/jobs/world-map.svg
deleted file mode 100644
index 7b201dcd2..000000000
--- a/packages/website/public/images/jobs/world-map.svg
+++ /dev/null
@@ -1,64 +0,0 @@
-<svg width="1046" height="594" viewBox="0 0 1046 594" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g filter="url(#filter0_d)">
-<path d="M220.481 72.6818C220.411 73.1706 220.692 73.3102 221.112 73.3102C220.692 74.148 219.92 73.1705 219.57 72.7517C219.64 72.6818 219.64 72.612 219.71 72.4724C219.85 72.5422 219.92 72.6818 220.061 72.7517C220.061 72.612 220.061 72.4724 220.061 72.4026C220.411 72.3328 220.411 72.4724 220.481 72.6818ZM97.4774 35.4009C97.3372 35.5405 97.0566 35.5405 96.9164 35.75C96.4255 34.5631 96.145 34.8424 94.9528 34.7725C95.584 34.3537 96.145 33.9348 96.7761 33.5857C96.5658 33.5159 96.4255 33.2366 96.2151 33.1668C96.4956 32.9574 96.7761 32.8177 97.1268 32.6083C96.4255 32.2592 96.145 31.98 95.4437 32.1894C94.6723 32.4687 94.3918 32.6781 93.6905 32.2592C92.9893 31.9102 92.6386 32.1894 91.8672 32.1894C91.5166 32.1894 91.0958 32.9574 90.8153 33.2366C91.0958 33.3763 92.4983 33.7253 92.4983 34.0744C92.4983 34.7725 92.4984 35.6801 91.5166 35.4707C91.0958 35.4009 90.5348 34.3537 90.0439 34.4933C89.553 34.6329 88.8517 35.1216 89.4127 35.6103C90.5348 36.5179 91.8672 36.7972 92.849 37.984C93.2698 38.5425 93.6204 39.2407 94.2515 39.3803C94.8126 39.5199 95.6541 39.0312 95.4437 38.4029C96.3554 38.8218 98.8098 37.1462 97.1969 36.5877C97.4073 36.5179 97.6878 36.3783 97.8982 36.3085C97.7579 36.0292 97.6177 35.6801 97.4774 35.4009ZM218.798 72.612C218.868 72.8215 218.588 73.2404 219.009 73.5894C219.009 73.1706 218.938 72.8215 219.219 72.4724C219.079 72.4026 218.798 72.4026 218.658 72.4026C218.588 72.612 218.728 72.5422 218.798 72.612ZM124.056 49.5034C124.547 49.9223 125.879 50.6903 126.37 49.8525C126.861 49.0147 126.51 48.5958 126.791 47.7581C125.669 46.292 122.793 48.4562 124.056 49.5034ZM132.05 39.5898C131.7 38.3331 130.087 38.5425 129.245 38.8218C128.754 39.0312 127.492 37.0066 126.931 36.5179C126.3 35.9594 124.897 35.3311 124.126 35.4009C123.705 35.4707 122.793 35.4009 122.513 35.6801C122.303 35.8896 121.601 36.7972 121.321 36.6575C120.409 36.099 120.479 36.099 119.778 36.7972C119.357 37.2161 118.796 37.2161 119.147 36.5179C119.568 35.6801 119.708 35.6801 119.287 34.8424C119.007 34.214 118.796 34.2838 118.446 33.865C118.095 33.4461 118.235 32.6781 117.674 32.6083C117.253 32.6083 116.552 32.3989 116.131 32.5385C115.079 32.9574 114.098 33.4461 113.046 33.5857C113.116 33.1668 113.256 32.8177 113.326 32.3989C111.713 32.1894 111.012 32.1894 109.469 32.8876C108.347 33.3763 107.646 34.0744 107.155 35.4009C106.945 35.8896 106.313 36.9368 106.384 37.4255C106.454 37.6349 106.594 39.2407 106.734 39.2407C108.207 39.3803 109.189 39.2407 110.241 40.3577C109.189 40.2879 108.137 40.1483 107.015 40.0785C107.436 40.9162 108.277 41.5446 109.048 41.9634C109.68 42.3125 109.96 41.8238 110.451 41.8238C111.573 41.754 110.732 42.0333 111.363 42.5918C111.643 42.8012 112.555 43.0107 112.905 43.0107C113.957 43.0805 115.29 42.8012 116.272 43.2201C116.622 43.3597 116.903 43.4994 117.253 43.639C117.464 43.7088 117.604 43.2201 117.744 43.2201C118.235 43.2899 118.375 43.9881 118.936 43.7786C118.516 43.3597 118.095 43.0107 117.674 42.5918C119.287 43.0805 120.339 43.4296 121.952 43.0805C121.671 42.3823 121.531 42.0333 120.83 41.8936C121.671 41.0559 121.601 42.3823 122.232 42.6616C122.443 42.7314 123.004 42.3823 123.074 42.7314C123.144 43.0805 123.214 43.4296 123.284 43.7786C124.056 43.0107 125.388 44.756 126.019 45.2447C124.897 45.5938 124.617 45.3844 124.617 46.7108C125.108 46.5014 125.669 46.292 126.16 46.1523C126.861 45.8731 126.791 45.8032 127.212 46.5014C127.702 47.409 128.824 47.1297 129.385 48.1071C129.736 48.7355 130.087 49.4336 130.437 50.0619C130.578 50.3412 130.227 50.5506 130.017 50.7601C129.175 51.5979 128.334 52.4356 127.492 53.2734C127.773 53.4829 128.824 53.9715 128.614 54.5301C128.544 54.7395 127.001 55.0188 126.721 55.0886C125.739 55.3678 124.547 54.949 123.565 54.8791C123.705 55.5773 122.793 55.7169 122.443 56.3452C122.232 56.7641 122.934 57.6717 123.355 57.6019C124.056 57.5321 124.897 57.7415 125.388 57.2528C125.879 56.7641 126.58 57.183 127.212 57.3226C127.212 57.1132 127.352 56.9038 127.282 56.6943C127.702 56.6245 127.983 56.9038 127.983 57.3226C129.105 56.6245 129.035 57.2528 129.736 58.3699C130.157 58.9982 130.858 58.9284 131.489 59.2775C131.139 59.4869 130.718 59.6265 130.367 59.836C130.998 60.185 131.419 60.5341 132.12 60.4643C132.05 60.6039 131.98 60.6737 131.91 60.8134C132.611 61.0228 133.313 61.1625 134.014 61.3719C134.294 61.4417 134.294 62.07 134.785 62.2097C136.118 62.5587 137.52 62.9078 138.923 63.2569C138.993 62.6286 139.203 62.3493 138.712 62.0002C138.222 61.6512 137.731 61.3021 137.17 60.953C136.819 60.7436 136.118 60.8134 135.907 60.4643C135.627 59.9756 135.346 59.4869 135.066 58.9982C135.557 59.2076 136.048 59.4171 136.539 59.6265C136.398 59.4171 136.398 59.1378 136.328 58.9284C137.17 59.4171 138.011 59.9756 138.853 60.4643C139.273 60.7436 140.115 61.7908 140.396 61.6512C140.255 61.3719 140.185 61.0926 140.045 60.8134C140.185 60.8832 140.396 60.8832 140.536 60.953C140.886 60.185 139.764 60.0454 140.185 59.2775C140.396 59.5567 140.676 59.9058 140.886 60.185C140.816 59.6963 140.886 58.7888 140.676 58.3699C140.396 57.8812 139.835 58.0906 139.694 57.4623C139.554 56.6943 139.624 56.4849 138.993 56.2056C138.502 55.9962 138.011 55.5773 137.871 56.4151C137.661 55.8565 137.52 55.298 137.31 54.7395C137.1 54.1112 136.959 54.3904 136.398 54.5999C136.258 54.2508 136.118 53.8319 136.048 53.413C136.398 53.4828 136.819 53.4828 137.17 53.5527C137.1 52.7847 136.328 52.8545 136.749 52.1564C137.029 51.6677 137.38 51.7375 137.941 52.0167C138.362 52.2262 138.783 53.1338 139.273 53.2036C139.624 53.2734 140.325 52.8545 140.676 52.7149C140.886 53.5527 140.115 53.6225 139.554 53.8319C140.466 54.8791 140.957 55.3678 142.219 55.9264C142.499 55.1584 142.219 54.3206 142.149 53.5527C143.131 54.2508 143.551 53.6923 144.603 53.1338C144.253 52.9941 143.902 52.7847 143.551 52.6451C143.832 52.2262 144.603 52.5753 145.024 52.6451C145.164 51.6677 145.515 51.1092 144.603 50.6903C144.042 50.4808 142.99 50.7601 142.359 50.7601C142.569 50.4808 142.78 50.1318 142.92 49.8525C142.008 49.7129 141.588 49.7827 140.957 49.0845C140.396 48.4562 140.185 48.2468 139.484 47.9675C138.011 47.409 136.539 46.8505 135.066 46.1523C135.487 46.0825 135.907 46.0825 136.328 46.0127C136.258 45.5938 136.188 45.2447 136.118 44.8258C136.679 44.9655 137.31 45.0353 137.871 45.1749C137.52 44.1975 137.59 44.2673 136.679 44.407C136.188 44.4768 135.767 44.1975 135.276 44.0579C136.118 43.5692 136.328 43.4994 137.31 43.4994C137.31 42.7314 136.539 42.4522 136.048 42.1031C135.907 42.871 135.206 43.0107 134.645 43.2899C134.855 42.522 134.294 42.6616 133.733 42.5918C134.365 42.3823 135.487 42.3823 135.697 41.6144C135.136 41.3351 132.261 39.4501 131.91 40.2181C131.63 40.8464 130.648 41.5446 130.367 40.7068C130.437 40.2879 131.77 39.7294 132.05 39.5898ZM89.1322 26.0457C88.7816 26.0457 88.5011 26.1854 88.2206 26.4646C88.6413 26.4646 88.992 26.4646 89.4127 26.4646C88.1504 27.3024 89.9036 27.3722 90.5348 27.2326C91.4464 27.0231 92.3581 26.9533 93.2698 26.8835C93.1295 27.2326 92.849 27.3722 92.4983 27.3024C92.5685 27.3722 92.6386 27.442 92.7087 27.5118C92.3581 27.442 92.0075 27.5817 91.7971 27.9307C92.1477 27.9307 92.5685 28.0005 92.9191 28.21C92.7087 28.21 92.4282 28.2798 92.2178 28.2798C92.288 28.9081 92.7789 28.8383 93.2698 28.9779C93.5503 29.0478 93.6905 28.6289 93.9009 28.6289C94.6022 28.6987 95.6541 28.9779 96.2151 28.4194C96.0047 28.2798 95.7943 28.0704 95.584 27.9307C95.8645 27.7213 95.9346 27.5118 95.9346 27.1628C96.0749 27.3024 96.2852 27.3722 96.4255 27.442C96.5658 26.8835 96.2151 26.7439 96.145 26.325C96.145 25.9061 96.3554 25.557 96.2852 25.208C96.2852 24.9985 95.8645 24.2306 95.6541 24.1607C95.3736 24.0211 94.8126 23.672 94.5321 23.8117C93.6905 24.3004 93.0594 23.6022 92.0075 24.0211C90.8854 24.44 92.7789 24.5098 92.849 25.0683C92.6386 24.9985 92.4282 25.1381 92.2178 25.0683C92.4984 25.4872 92.7789 25.8363 93.0594 26.2552C92.6386 26.0457 89.8335 23.323 89.9036 25.208C90.1841 25.208 90.4646 25.208 90.7452 25.208C90.114 25.4872 90.2543 26.1155 90.8854 25.9061C90.8153 26.4646 89.6932 25.9061 89.1322 26.0457ZM89.2024 44.1975C89.4127 43.0805 89.9738 43.3597 90.6049 43.8484C90.675 43.7088 90.8153 43.5692 90.8854 43.3597C91.727 44.6862 91.5867 42.9409 91.5867 42.3823C90.675 42.5918 89.553 41.8936 88.5712 41.3351C88.2206 41.1257 86.818 40.5672 86.6778 40.1483C86.5375 39.7294 86.9583 39.1011 86.7479 38.5425C86.1869 37.2161 85.8362 35.1914 84.6441 34.5631C84.1532 34.2838 83.6623 33.5159 83.3116 34.1442C83.1012 34.4235 82.1896 33.7253 81.9091 33.5857C82.2597 34.0744 81.6286 34.2838 81.7688 34.5631C81.9091 34.9122 82.0493 35.2613 82.1195 35.6103C82.4 36.4481 82.6805 37.2161 82.961 37.984C82.4 38.1935 82.1195 38.6124 81.839 37.9142C81.5584 37.1462 81.3481 36.4481 81.0675 35.6801C80.7169 34.6329 78.9637 34.6329 78.2624 34.7027C78.6832 35.1216 79.104 35.6103 79.5247 36.0292C79.2442 35.9594 78.2624 35.5405 78.1222 35.8198C77.7014 36.5179 77.7014 36.4481 76.93 36.4481C77.1404 36.1688 77.3508 35.9594 77.491 35.6801C77.0001 35.4707 75.5275 34.4235 75.0366 34.5631C74.6859 34.6329 74.6158 35.4707 74.195 35.4707C73.7743 35.5405 73.3535 35.5405 73.0029 35.5405C73.634 34.982 74.3353 34.2838 73.4236 33.7253C72.7224 33.3064 72.4418 33.5857 71.6704 33.865C70.0575 34.4933 68.9355 34.982 67.603 36.099C67.8134 36.1688 68.0238 36.3783 68.2342 36.3783C67.6732 36.867 66.8316 37.3557 66.9719 38.2633C67.4628 38.2633 67.8836 38.2633 68.3744 38.2633C68.3043 38.4029 68.2342 38.6124 68.1641 38.8218C69.1459 38.752 70.1276 38.752 71.0393 38.752C70.0575 39.1709 69.0056 39.6596 68.0238 40.0785C68.655 40.7068 68.7952 41.0559 69.5666 40.986C70.6185 40.986 71.6003 40.986 72.6522 40.9162C74.1249 40.9162 75.3872 41.2653 76.8599 41.6144C77.9118 41.8936 76.2287 42.1729 75.8781 42.1729C75.1067 42.1729 74.2652 41.9635 73.4938 41.8936C72.2315 41.754 70.6887 42.4522 69.4264 42.6616C70.1276 45.1051 72.512 44.6862 74.4755 44.8258C74.3353 46.0825 74.6158 46.7108 75.7378 46.641C77.1404 46.5014 78.4728 46.4316 79.8754 46.292C80.787 46.2221 81.1377 45.5938 82.1195 45.3844C82.6805 45.3145 82.961 45.2447 83.3818 44.8258C83.8025 44.4768 83.8025 43.9881 84.3635 44.1975C84.2934 44.3371 84.2934 44.6164 84.2233 44.756C84.8544 44.8957 85.5557 45.0353 86.1869 45.1749C86.0466 45.2447 85.9765 45.3844 85.8362 45.4542C86.9583 45.4542 88.0102 46.0825 89.1322 45.9429C89.4127 45.9429 90.5348 45.524 90.5348 45.2447C90.5348 44.756 89.8335 44.8957 90.3244 44.1975C89.553 43.9881 89.1322 44.407 88.5712 44.9655C88.5712 44.407 88.7115 43.9881 88.2907 43.5692C88.5011 43.5692 88.6413 43.5692 88.8517 43.639C88.8517 43.9881 89.0621 44.0579 89.2024 44.1975ZM93.41 45.524C93.5503 45.6636 93.8308 45.9429 93.971 46.0127C94.0412 45.7334 94.1814 45.8032 94.2515 45.6636C94.3217 46.0127 94.5321 46.1523 94.8126 46.2221C94.8827 46.1523 94.8827 46.0127 94.9528 45.8731C95.2333 46.7108 96.4956 46.7807 97.1969 46.9203C97.8982 47.0599 98.5995 46.292 99.2306 45.9429C98.3891 45.1749 97.6177 44.5466 96.6359 43.9183C96.145 43.5692 95.7242 43.0107 95.2333 43.4994C94.8827 43.8484 94.2515 44.2673 94.8827 44.756C94.7424 44.756 94.6723 44.8258 94.5321 44.8258C94.3918 45.4542 93.7607 44.8957 93.41 45.524ZM219.429 71.7743C219.359 71.8441 219.289 71.8441 219.149 71.9139C219.219 71.9837 219.219 72.1233 219.289 72.1932C219.64 71.9139 219.78 71.7044 220.131 71.6346C220.061 71.5648 219.99 71.495 219.92 71.3554C220.481 71.2856 220.411 70.5176 220.131 70.6572C219.78 70.8667 218.588 71.2158 219.429 71.7743ZM119.778 58.5793C118.866 57.8812 118.726 57.8812 117.604 58.0208C118.586 57.0434 116.061 55.8565 115.57 55.5075C115.22 55.2282 114.589 55.3678 114.308 55.0188C113.817 54.5301 113.677 54.3206 113.186 55.0188C113.116 54.8791 112.976 54.5999 112.905 54.4603C113.887 54.3206 113.607 52.9243 112.765 53.2734C111.924 53.6225 111.924 54.3904 111.643 55.3678C111.503 55.7867 111.503 56.2056 111.433 56.5547C111.363 56.8339 111.643 57.3227 111.573 57.5321C111.433 57.8114 110.451 58.5793 110.171 58.9284C110.451 58.9284 112.064 58.5095 112.204 58.5793C112.415 58.7189 112.555 60.3247 112.905 60.1152C113.467 59.7662 113.887 58.9982 114.378 58.7888C115.15 58.5095 115.079 57.8812 115.851 57.5321C115.64 58.7888 117.814 59.068 118.656 59.2775C119.007 59.068 119.357 58.8586 119.778 58.5793ZM103.649 29.3968C103.929 30.095 104.841 29.4666 105.262 29.1874C105.612 29.8855 105.542 29.9553 106.243 30.0252C106.804 30.095 107.365 30.3044 107.506 29.4666C107.576 29.6761 107.786 29.7459 107.926 29.9553C107.926 29.6761 108.067 29.3968 108.067 29.1176C108.838 29.3968 107.997 30.3044 108.838 30.3742C109.68 30.444 110.521 30.444 111.363 30.5139C111.293 30.3044 111.363 30.095 111.363 29.8855C111.783 30.5139 112.976 30.7233 113.186 29.8157C113.396 30.7233 114.659 30.1648 115.29 30.0252C115.22 29.6761 115.15 29.327 115.079 28.9779C115.921 28.9779 115.5 29.8855 116.131 30.1648C116.692 30.3742 117.113 30.5837 117.674 30.444C118.025 30.3742 119.568 30.3742 119.708 30.0252C119.918 29.2572 120.199 29.327 120.9 29.0478C120.549 28.6987 120.129 28.6987 119.708 28.5591C120.059 28.2798 120.409 28.0704 120.69 27.7911C119.357 26.6741 117.744 25.8363 116.061 26.3948C115.36 26.6042 114.729 26.2552 113.957 26.5344C113.186 26.8137 112.555 26.9533 111.783 27.1628C111.924 27.3024 112.064 27.442 112.204 27.5118C111.433 27.3722 110.381 26.8835 109.609 26.9533C109.399 26.9533 108.908 27.442 108.698 27.3024C108.347 27.0929 107.997 26.8137 107.576 26.6042C107.365 26.4646 105.823 25.6268 105.823 25.557C105.682 25.0683 107.225 25.6268 107.365 24.9287C106.945 24.7891 106.524 24.6494 106.033 24.5796C105.402 24.44 105.682 24.0909 105.262 23.8117C104.49 23.323 103.649 24.0211 102.877 23.8117C102.036 23.672 101.615 22.9041 100.914 22.8343C100.072 22.6946 99.0202 22.2757 98.2488 22.555C96.9164 22.9041 97.3372 23.4626 98.1787 24.3702C99.0202 25.208 99.5111 25.0683 100.563 24.9287C101.475 24.7891 101.895 24.44 102.527 25.208C102.947 25.6967 103.999 26.5344 103.298 27.2326C103.018 28.21 103.228 28.4194 103.649 29.3968ZM127.352 48.1769C126.861 48.7355 128.965 48.7355 129.105 48.7355C128.895 47.7581 127.843 47.6184 127.352 48.1769ZM108.067 7.40524C107.436 7.96376 106.734 8.52228 106.103 9.08079C107.225 9.84875 108.347 9.22042 109.68 9.15061C110.872 9.08079 112.134 8.66191 113.256 8.31283C112.204 8.87135 111.363 9.29024 110.171 9.36005C109.048 9.49968 108.347 9.42987 107.295 9.91857C108.417 10.1978 109.609 10.9658 110.591 10.2676C111.854 9.42987 112.485 9.29024 114.028 9.15061C112.695 9.5695 112.064 9.84875 110.942 10.8262C111.924 10.9658 112.835 11.1054 113.817 11.1054C114.589 11.1054 114.659 11.3149 114.799 10.4073C114.869 10.128 115.711 9.98838 115.991 9.91857C115.851 10.0582 115.711 10.2676 115.57 10.4073C116.201 10.1978 116.763 10.0582 117.394 9.84875C116.903 10.2676 116.482 10.6167 115.991 11.0356C116.763 10.896 117.534 10.7563 118.235 10.6167C118.726 10.5469 119.848 10.5469 120.199 10.1978C121.321 9.08079 122.373 8.66191 123.775 7.96376C123.144 8.52228 122.583 9.08079 121.952 9.63931C122.303 9.77894 122.723 9.98838 123.074 10.128C120.62 10.7563 118.235 11.245 115.781 11.7337C116.622 12.5017 117.394 13.2697 118.235 13.9678C117.183 13.3395 115.921 12.1526 114.729 11.8734C114.518 11.8036 111.222 11.8036 111.222 11.7337C110.241 13.6886 112.204 13.5489 113.256 14.3169C114.238 15.015 115.079 16.1321 115.711 17.2491C114.168 16.4113 111.643 16.2019 110.241 17.5982C108.978 18.8548 110.1 18.9945 111.363 19.2039C112.204 19.4133 112.835 18.2963 113.467 17.7378C113.046 19.1341 111.783 19.9021 113.256 20.9493C114.448 21.787 115.781 20.1115 116.482 19.3435C115.36 20.8795 114.659 21.9965 112.695 21.5078C111.924 21.2983 111.854 20.1813 111.152 20.1115C110.171 19.9719 109.68 19.9021 108.768 20.2511C109.329 21.2983 109.329 21.438 110.451 21.5078C109.68 22.2757 109.189 22.0663 108.277 22.4852C107.926 22.6248 107.155 22.7644 106.945 23.0437C106.734 23.323 107.295 23.6022 106.875 23.8815C107.506 24.6494 107.716 24.0909 108.207 23.5324C108.207 24.44 109.469 25.1381 109.82 24.0909C109.96 24.9985 110.521 24.5098 111.152 24.5796C111.783 24.6494 112.344 24.7193 112.976 24.7193C113.677 24.7193 113.887 24.0909 114.378 24.2306C114.799 24.3702 115.57 24.7193 115.43 23.8117C115.711 24.44 117.043 25.0683 117.113 23.9513C117.674 24.5796 118.025 23.8117 118.375 24.0909C118.936 24.5098 118.726 24.7891 118.516 25.4872C119.357 25.208 120.129 24.9985 120.97 24.7193C121.181 24.6494 121.321 24.1607 121.531 24.0909C121.601 24.0909 121.882 24.44 122.162 24.3702C122.373 24.3004 123.004 24.2306 123.004 23.9513C123.004 23.672 123.004 22.9739 122.793 22.8343C122.373 22.555 122.232 22.4154 121.812 22.6248C121.321 22.9041 121.321 23.1135 120.97 22.555C120.69 22.0663 122.162 21.0191 122.443 20.8096C123.284 20.1115 121.952 19.7624 122.373 19.4133C122.653 19.2039 123.775 19.9021 124.266 19.6926C125.248 19.3435 125.458 19.2039 126.089 18.3661C125.599 18.0869 125.178 17.8774 124.687 17.5982C125.528 17.4585 126.3 17.3887 127.141 17.3189C127.212 16.3415 125.108 16.2717 124.406 16.0622C125.318 16.0622 126.3 16.0622 127.212 16.0622C127.422 14.9452 124.757 15.2943 124.056 15.2245C125.739 15.015 127.422 14.8754 129.105 14.5263C129.035 14.2471 128.895 13.898 128.824 13.6187C129.456 13.7584 130.227 14.2471 130.788 13.898C131.63 13.4791 132.05 13.13 132.681 12.4319C132.05 12.4319 131.489 12.3621 130.858 12.3621C131.84 12.1526 132.822 11.9432 133.804 11.7337C134.645 11.5941 135.697 10.6167 136.398 10.128C137.38 9.49968 140.676 8.66191 140.816 7.47506C138.292 7.96376 135.837 8.45246 133.313 9.01098C134.855 8.59209 136.398 8.10339 137.871 7.6845C136.959 7.54487 136.118 7.40524 135.206 7.26561C137.17 7.12599 139.133 6.98636 141.097 6.84673C142.499 6.77691 144.253 5.24099 145.515 4.61266C143.762 3.98433 142.219 3.56544 140.396 3.28619C138.853 3.00693 137.45 3.49563 135.907 3.8447C136.749 3.356 137.59 2.93711 138.432 2.44841C136.889 2.23897 135.206 1.75027 133.663 1.75027C132.191 1.75027 130.578 2.23897 129.105 2.44841C129.315 2.8673 129.526 3.21637 129.736 3.63526C129.035 3.14656 128.053 2.16915 127.212 2.16915C125.949 2.16915 124.757 2.09934 123.565 2.09934C124.266 2.72767 125.038 3.28619 125.739 3.91452C124.897 3.56544 123.986 3.21637 123.144 2.8673C122.653 2.65786 121.251 2.30878 120.76 2.44841C120.409 2.58804 120.339 3.00693 119.918 3.07674C119.357 3.07674 118.796 3.14656 118.235 3.14656C117.604 3.21637 116.903 4.05415 116.412 4.47303C117.885 5.24099 119.287 6.00895 120.76 6.77691C119.147 6.35803 117.534 6.00895 115.991 5.59007C115.29 5.38062 114.518 4.61266 113.887 4.19378C113.396 3.91452 112.625 4.05415 112.064 3.98433C112.204 4.3334 112.344 4.61266 112.415 4.96174C111.783 4.96174 111.222 4.96174 110.591 5.03155C111.012 5.24099 111.433 5.45044 111.854 5.65988C110.241 5.7297 108.067 4.82211 107.225 6.7071C106.103 5.7297 104.701 6.49765 103.579 7.12599C104.35 7.47506 105.051 7.82413 105.823 8.1732C106.594 7.96376 107.365 7.6845 108.067 7.40524ZM91.5867 20.3908C91.0958 19.7624 90.5348 19.9021 89.9036 20.0417C89.2024 20.1813 89.6231 20.67 90.1841 20.67C90.675 20.6002 91.0257 20.2511 91.5867 20.3908ZM120.269 63.7456C120.69 63.3965 121.882 62.1399 120.69 61.7908C120.199 61.6512 119.708 62.2097 119.638 62.6286C119.638 63.2569 119.848 63.3267 120.269 63.7456ZM215.572 84.4805C215.432 84.5503 215.292 84.7598 215.152 84.8296C216.414 85.8768 218.097 83.922 219.289 83.5729C219.71 83.4333 219.99 83.8522 220.131 83.2937C220.271 82.8748 220.411 82.3861 220.551 81.8974C220.762 81.3389 220.411 80.5709 219.99 80.152C220.832 79.5935 221.112 79.5237 221.183 78.4765C220.762 78.6161 220.622 77.8481 220.271 77.4292C220.061 77.2198 219.289 77.5689 219.009 77.6387C219.079 77.4991 219.149 77.4292 219.219 77.2896C218.237 76.7311 217.326 77.7783 216.835 78.5463C217.115 78.6859 217.466 78.7557 217.746 78.8953C217.326 79.1746 217.185 79.5237 216.694 79.384C216.414 79.3142 215.923 79.035 215.642 79.2444C215.152 79.5237 215.292 79.5935 215.432 80.2218C215.502 80.5011 215.011 80.8502 214.871 80.9898C215.432 81.269 215.853 81.4087 216.484 81.4785C216.063 81.8276 215.642 82.2464 215.222 82.805C215.783 82.6653 216.344 82.4559 216.835 82.6653C216.484 82.7351 215.713 82.7351 215.502 83.0842C215.222 83.4333 215.011 83.5729 214.591 83.6427C214.801 83.6427 215.011 83.7824 215.222 83.8522C215.011 83.9918 214.801 84.1314 214.52 84.2012C215.011 84.3409 215.292 84.4107 215.572 84.4805ZM114.659 61.7908C114.729 61.9304 114.799 62.4889 115.009 62.4191C116.131 62.3493 117.464 61.8606 117.604 60.3945C117.324 60.3945 117.043 60.3945 116.763 60.3945C116.061 60.5341 115.64 60.5341 115.079 61.0228C114.659 61.3719 114.518 61.3021 114.659 61.7908ZM101.685 28.5591C101.545 27.7911 100.703 26.6741 99.8617 26.9533C99.3709 27.0929 97.0566 27.5118 97.4073 28.6987C97.5475 29.1874 99.441 29.8157 99.8617 30.095C100.914 29.8855 101.966 30.0252 101.685 28.5591ZM85.9765 16.9C86.6778 16.9698 86.8881 15.9226 87.5193 16.551C87.379 16.6208 87.3089 16.8302 87.1687 16.9C87.5193 16.9698 87.8699 17.0397 88.2206 17.1095C88.3608 18.2963 86.6778 17.3887 85.9765 17.8774C86.1869 19.9021 88.5011 17.9472 88.9218 18.4359C89.4127 18.9945 90.2543 18.8548 90.8854 18.9246C91.5166 18.9945 91.5867 19.3435 91.9373 19.9719C92.2178 20.5304 95.0931 20.4606 93.6905 18.8548C93.4801 18.6454 92.9892 18.2963 93.0594 17.9472C93.1996 17.4585 93.2698 17.5284 92.9191 17.2491C92.288 16.7604 92.1477 16.8302 91.3763 16.9698C91.6568 15.4339 89.7634 16.2019 89.2725 16.4811C88.8517 15.5735 88.4309 14.8754 87.379 15.015C86.1869 15.1547 85.5557 14.9452 85.1349 16.1321C85.5557 16.1321 85.9064 16.1321 86.3271 16.0622C86.1869 16.4113 86.1167 16.6906 85.9765 16.9ZM86.3271 22.3456C86.6778 22.6946 87.0284 22.1361 86.7479 21.7172C86.4674 21.438 86.1869 21.1587 85.9765 20.9493C85.5557 20.6002 85.2051 20.1813 84.6441 20.3908C84.7142 20.8096 84.8544 21.1587 84.9246 21.5776C85.2752 21.9267 86.0466 22.0663 86.3271 22.3456ZM94.4619 12.8508C94.1113 12.013 92.1477 12.2923 92.7087 13.4093C93.6204 13.7584 95.1632 14.5961 94.4619 12.8508ZM97.1268 19.2039C96.7761 19.4133 96.2852 19.3435 95.9346 19.4832C96.2852 19.6228 96.9164 20.2511 96.9865 20.2511C97.4073 20.2511 97.8281 20.1115 98.1787 19.9719C98.5995 19.8322 99.441 19.8322 99.6514 19.4133C99.8618 18.9945 99.3007 18.8548 99.8617 18.2963C99.3709 18.0869 98.6696 18.1567 98.3189 17.9472C97.9683 17.8076 97.5475 17.3189 97.1268 17.1793C96.4956 16.9 94.2515 16.4811 95.5138 17.8076C95.3736 17.8076 95.2333 17.8774 95.0931 17.8774C95.3736 19.1341 96.4255 18.5058 97.1268 19.2039ZM76.4391 19.6228C75.1768 19.8322 74.6158 19.553 74.8963 21.0889C75.4573 21.0889 75.9482 21.8569 76.4391 21.787C77.2105 21.5776 77.9819 21.3682 78.6832 21.2285C79.2442 21.0889 78.9637 20.8795 79.104 20.5304C79.1741 20.1813 78.2624 20.4606 78.0521 20.1115C78.6832 19.9719 79.3144 19.9719 79.7351 19.3435C78.8235 18.9246 77.4209 19.4832 76.4391 19.6228ZM78.7533 24.8589C79.2442 25.1381 79.7351 25.4872 80.226 25.7665C79.8754 25.9061 79.5949 26.0457 79.2442 26.1854C79.5247 26.325 80.8572 26.6741 80.787 27.0231C80.6468 27.7911 79.9455 27.442 79.2442 27.3722C78.8936 27.3722 77.491 27.5118 77.4209 27.0929C77.2105 26.1854 77.1404 26.325 76.2989 26.3948C76.4391 26.325 76.5794 26.2552 76.7196 26.1854C76.1586 25.7665 75.5275 24.8589 74.8262 24.9985C73.5639 25.208 74.0548 24.7193 73.0029 24.3702C72.7925 24.3004 71.2497 24.44 71.2497 24.7891C71.2497 25.1381 72.512 25.3476 72.7925 25.4174C71.7406 25.3476 71.0393 25.208 70.0575 25.6268V26.1155C70.6887 26.4646 71.8107 26.1854 72.5821 26.1854C72.2315 26.3948 69.2861 26.2552 69.3562 26.9533C69.4264 27.6515 71.8808 26.8835 72.2315 26.8137C71.2497 27.5817 69.2861 27.0231 68.7251 28.1402C69.5666 28.4194 69.9173 28.4892 70.7588 28.2798C70.7588 28.4194 70.6887 28.5591 70.6887 28.6987C71.0393 28.8383 71.3899 28.9081 71.7406 28.9779C71.4601 28.2798 72.3016 28.4194 72.4418 29.0478C73.2834 28.4892 73.4938 28.4194 73.7041 27.442C74.3353 27.6515 74.0548 28.1402 73.9847 28.6987C74.4755 28.6289 75.5976 28.9081 75.6677 28.21C75.9482 28.9081 77.1404 28.5591 77.7014 28.21C76.7196 29.2572 74.6158 29.4666 73.2133 29.9553C74.8963 31.0724 75.5976 30.7233 77.4209 30.0252C78.4728 29.6761 79.4546 29.327 80.5065 28.9081C81.0676 28.6987 81.4182 29.2572 81.9792 29.1874C82.2597 29.1874 82.3298 28.6987 82.7506 28.6987C83.2415 28.6987 83.7324 28.6987 84.2233 28.6987C84.8544 28.6987 85.1349 27.9307 85.2752 27.2326C85.4856 26.3948 85.4155 25.6268 84.2934 25.7665C82.961 25.9759 84.083 26.325 83.522 27.0231C83.3116 26.325 83.1012 26.1854 82.4701 26.0457C82.1195 25.9061 81.9792 25.208 81.6987 24.9287C80.9974 24.3702 81.5584 22.8343 80.226 23.3928C79.7351 23.9513 79.3845 24.3702 78.7533 24.8589ZM97.267 12.6413C97.4774 14.2471 99.2306 14.2471 100.212 13.8282C99.8617 14.3867 99.3709 14.3169 98.8098 14.3867C98.3891 14.4565 98.5293 15.015 98.9501 14.9452C99.3709 14.8754 99.3007 15.6434 99.7916 15.2943C100.142 15.015 100.353 14.7358 100.773 14.9452C100.773 15.0848 100.703 15.1547 100.703 15.2943C101.194 15.5735 101.334 15.1547 101.755 14.9452C101.895 14.8754 102.316 15.4339 102.176 14.666C102.947 14.9452 104.28 14.5961 104.771 15.0848C104.14 15.1547 103.508 15.2245 102.877 15.3641C103.859 15.783 104.771 15.5735 105.752 15.5037C103.929 15.8528 102.246 15.7132 100.563 16.4113C101.054 16.7604 101.615 16.9 102.246 17.0397C101.966 17.0397 101.615 17.1095 101.334 17.1095C101.825 17.8774 103.228 17.5982 104.069 17.8076C103.508 17.8774 102.877 17.9472 102.316 18.0171C103.088 19.2039 104.771 18.9945 105.963 19.0643C105.893 18.785 105.682 18.5058 105.402 18.4359C106.173 18.4359 106.524 18.7152 107.085 19.2039C106.804 18.6454 106.524 18.0869 106.243 17.4585C106.804 18.0171 107.365 18.5756 107.926 19.1341C108.207 18.5058 108.347 18.1567 107.926 17.5284C110.311 18.785 107.716 16.551 109.329 16.0622C109.189 16.551 109.399 16.9698 109.609 17.4585C110.03 17.1095 110.732 16.8302 110.381 16.1321C110.802 16.4811 112.485 15.5735 113.186 15.3641C112.905 14.8754 112.485 14.5263 112.064 14.1074C111.994 14.3169 111.783 14.5263 111.713 14.7358C111.643 13.5489 110.311 14.2471 109.75 14.4565C110.381 13.2697 110.661 12.7112 109.189 12.5715C110.1 11.8036 108.838 10.7563 107.997 11.5243C108.207 11.8734 108.347 12.1526 108.558 12.5017C108.067 12.5017 107.646 12.3621 107.365 11.9432C107.225 11.6639 107.646 10.896 106.945 11.1054C106.173 11.3149 105.542 10.9658 104.981 10.4073C104.14 9.49968 103.719 8.73172 102.527 8.38265C101.825 8.1732 100.703 7.82413 100.212 8.59209C100.844 8.80154 101.545 8.59209 102.106 8.94116C101.545 9.98838 99.441 8.52228 98.8098 10.128C99.3007 10.2676 100.072 10.1978 100.493 10.5469C100.002 10.6865 97.6177 10.7563 98.3891 11.5243C98.0384 11.6639 97.6177 11.8036 97.267 11.9432C97.8982 12.2224 98.2488 12.0828 98.88 12.2224C98.8098 12.2923 98.6696 12.3621 98.5995 12.3621C99.1605 12.6413 99.8618 12.013 100.353 12.3621C100.142 12.4319 100.002 12.6413 99.7916 12.6413C99.9319 12.781 100.072 12.9206 100.212 12.9904C100.002 12.9206 99.7916 12.9206 99.5812 12.781C98.88 12.781 98.0384 12.7112 97.267 12.6413ZM86.818 25.3476C87.3089 25.9061 89.4829 26.0457 89.2725 24.9287C88.6413 24.7891 87.2388 24.8589 86.818 25.3476ZM68.9355 25.4872C68.5147 25.6268 66.3407 26.4646 66.6213 27.0929C66.7615 27.5118 67.8836 27.3722 68.0939 27.0231C68.3043 26.6042 69.0757 26.0457 68.9355 25.4872ZM220.271 73.6593C220.201 73.7291 220.131 73.7291 220.061 73.7989L220.201 73.9385C220.201 73.8687 220.341 73.7989 220.271 73.6593ZM83.3116 33.3763C84.0129 33.5857 84.083 33.7253 84.6441 34.214C85.0648 34.6329 85.3453 35.1216 85.9064 34.8424C86.3271 34.6329 86.6778 33.9348 86.6778 33.5159C86.6778 32.8876 86.257 32.8177 85.7661 32.4687C84.7843 32.6083 83.7324 32.2592 83.3116 33.3763ZM87.9401 28.3496C87.5894 27.3722 87.0985 27.5118 86.3972 27.7911C85.4856 29.0478 87.5193 28.5591 87.9401 28.3496ZM86.4674 23.9513C86.6778 24.3702 86.818 24.3702 86.818 24.7891C87.4492 24.8589 88.2206 24.9985 88.7115 24.5098C88.4309 24.3004 88.0803 24.1607 87.7998 23.9513C87.379 23.7419 86.9583 23.8117 86.4674 23.9513ZM101.475 21.3682C101.685 21.0889 101.895 20.7398 102.106 20.4606C100.703 20.0417 99.1605 19.9719 97.8281 20.67C98.1787 21.7172 100.703 21.2983 101.475 21.3682ZM119.778 34.8424C119.988 35.0518 120.479 35.2613 120.69 35.4009C121.181 35.6801 122.653 35.0518 123.144 34.9122C123.775 34.7726 124.687 34.982 125.318 34.982C124.406 33.7951 123.775 33.3763 122.513 32.7479C122.092 32.5385 121.531 32.8876 121.04 32.6781C120.549 32.4687 119.988 32.329 119.497 32.1196C118.656 32.2592 118.516 33.4461 119.287 33.865C119.918 34.214 119.427 34.3537 119.778 34.8424ZM104.841 21.0191C104.35 21.5078 105.332 21.8569 105.612 21.9965C106.103 22.2059 106.524 21.9267 107.015 21.787C106.945 20.7398 105.472 20.4606 104.841 21.0191ZM105.823 23.323C105.332 23.672 106.454 24.44 106.875 24.3004C106.804 24.1607 106.734 23.8815 106.664 23.8117C107.295 23.3928 106.173 23.0437 105.823 23.323ZM429.672 29.8157C431.285 29.8855 432.337 29.8157 433.88 29.327C433.95 29.327 434.09 28.4194 434.02 28.3496C433.95 28.21 433.108 28.0704 432.968 28.0005C432.127 27.7213 431.846 27.8609 431.004 28.1402C431.075 27.9307 431.004 27.7213 431.004 27.5817C430.303 27.5817 429.602 27.3722 428.971 27.8609C428.901 26.3948 427.288 27.3024 427.428 28.21C427.498 28.6289 429.251 29.5365 429.672 29.8157ZM299.866 39.4501C300.707 40.3577 301.759 40.986 302.881 41.0559C303.933 41.1257 306.107 41.8238 307.019 41.0559C305.546 40.0785 304.354 39.1709 304.284 37.1462C304.214 35.5405 305.757 34.214 306.668 33.097C307.229 32.4687 307.72 31.7705 308.211 31.0724C308.702 30.5139 309.754 30.095 310.385 29.6761C311.577 28.9081 312.348 27.9307 313.751 27.5817C315.364 27.093 316.977 26.6042 318.59 26.0457C319.361 25.7665 322.587 25.208 322.727 23.7419C322.868 21.9965 319.572 22.7644 319.011 23.2531C317.678 24.3004 316.206 24.5796 314.593 24.9985C313.12 24.9985 312.138 25.1381 310.806 25.6967C309.754 26.1155 308.071 26.4646 307.159 27.2326C306.177 28.1402 305.195 28.9779 304.284 29.9553C303.653 30.6535 303.022 31.3516 302.39 32.0498C301.899 32.6083 302.18 32.9574 302.32 33.6555C302.39 33.9348 300.988 34.7027 300.777 34.8424C299.936 35.4707 300.707 35.5405 300.287 36.3085C300.006 36.9368 299.094 36.6575 299.024 37.4255C298.954 38.6124 299.094 38.6124 299.866 39.4501ZM302.741 11.8036C301.198 11.245 301.198 11.3149 299.866 12.3621C300.497 12.4319 301.128 12.5017 301.689 12.5715C302.04 12.2923 302.39 12.0828 302.741 11.8036ZM308.421 8.24302C308.071 7.96376 307.72 7.61469 307.369 7.33543C308.071 7.12599 308.842 6.98636 309.543 6.77691C308.351 6.56747 307.86 6.28821 306.879 6.98636C306.107 7.54487 305.266 8.10339 304.494 8.59209C305.266 8.66191 305.967 8.80154 306.738 8.87135C307.299 8.73172 307.86 8.45246 308.421 8.24302ZM308.421 42.1729C308.632 42.7314 310.385 44.1277 310.946 43.639C311.577 43.0805 309.473 41.9635 309.193 41.6842C308.912 41.8936 308.702 42.0333 308.421 42.1729ZM310.315 12.9206C310.034 12.2923 309.403 12.7112 308.912 12.8508C309.123 12.9904 309.333 13.1999 309.543 13.3395C309.824 13.13 310.104 12.9904 310.315 12.9206ZM307.72 9.84875C306.808 9.5695 305.967 9.22042 304.985 9.22042C303.653 9.29024 303.162 9.08079 302.25 10.1978C303.162 10.4073 304.003 10.6865 304.915 10.896C306.037 10.6865 306.808 10.6167 307.72 9.84875ZM294.326 10.6865C293.695 11.1054 292.993 11.5243 292.362 12.013C293.554 12.4319 294.326 12.5017 295.588 12.5017C295.518 12.1526 295.378 11.8036 295.307 11.4545C296.57 11.1752 297.902 10.8262 299.164 10.5469C298.463 10.0582 297.972 9.63931 297.131 9.91857C296.289 10.128 295.588 10.4771 294.746 10.2676C292.993 9.84875 291.871 10.3375 290.118 10.896C290.679 11.0356 291.31 11.1752 291.871 11.3847C292.713 11.1054 293.554 10.896 294.326 10.6865ZM295.027 46.1523C295.448 46.5712 296.78 45.3844 297.131 45.1749C296.5 44.6164 296.219 44.4768 295.448 44.3371C294.466 44.6862 294.115 45.2447 295.027 46.1523ZM258.21 42.5918C259.542 42.3823 260.384 42.0333 261.296 40.986C260.664 40.986 260.664 41.5446 260.174 41.754C259.753 41.9635 259.051 41.8936 258.631 41.8936C258.841 42.2427 258.561 42.4522 258.21 42.5918ZM76.5794 18.4359C77.2105 18.785 77.1404 18.2963 77.7014 18.2265C78.1222 18.1567 80.5065 19.0643 80.226 17.8076C80.0156 17.0397 78.1222 17.1095 77.6313 17.2491C76.7898 17.5284 75.3171 17.5982 74.7561 18.4359C74.8262 18.5058 74.9664 18.5756 75.1067 18.6454C75.5275 18.5756 76.1586 18.2265 76.5794 18.4359ZM308.421 11.245C308.071 11.245 304.564 11.3847 304.915 12.3621C305.266 13.3395 307.65 12.5715 308.491 12.4319C308.351 12.2923 308.281 12.0828 308.141 11.9432C308.562 11.8734 308.982 11.8036 309.403 11.7337C309.123 11.5941 308.772 11.3847 308.421 11.245ZM416.067 29.1176C416.558 29.3968 417.049 29.9553 417.61 29.8855C418.592 29.8157 418.522 29.7459 418.943 28.8383C419.644 29.9553 420.696 29.0478 421.748 28.6289C422.028 28.4892 422.379 29.5365 422.729 29.4666C423.22 29.327 423.781 29.2572 424.272 29.1176C424.062 28.8383 423.922 28.4892 423.711 28.21C424.342 28.4892 424.623 28.6987 425.184 28.3496C425.675 28.0704 426.095 27.7911 426.446 27.3024C425.044 26.7439 423.641 26.2552 422.309 25.6967C421.958 25.557 421.327 25.1381 420.906 25.2778C420.205 25.557 420.555 26.0457 420.696 26.8137C419.714 26.3948 417.75 24.5098 416.769 25.2778C415.857 25.9759 415.436 26.1854 415.086 27.3722C414.945 28.1402 415.717 28.6987 416.067 29.1176ZM220.271 76.8009C220.622 76.6613 220.692 76.382 220.481 76.033C220.341 76.1028 220.131 76.2424 219.99 76.382C220.411 76.4518 220.201 76.5915 220.271 76.8009ZM421.467 33.5857C422.379 34.3537 423.01 34.1442 424.132 34.1442C423.851 33.097 423.781 33.097 422.94 32.5385C422.729 32.3989 421.257 31.7705 421.257 31.7007C421.187 31.0026 420.626 30.3044 419.784 30.8629C418.802 31.4913 419.994 32.1196 420.415 32.4687C419.854 32.8177 419.293 33.2366 418.732 33.5857C419.504 33.5159 420.836 33.0272 421.467 33.5857ZM317.328 9.98838C318.169 9.77894 317.889 9.42987 317.818 8.52228C317.468 8.52228 316.767 8.45246 316.486 8.59209C316.276 8.80154 316.206 9.42987 315.995 9.5695C315.294 9.98838 314.593 8.94116 314.032 9.98838C314.242 10.1978 314.382 10.4073 314.593 10.5469C315.504 10.4073 316.416 10.1978 317.328 9.98838ZM309.894 11.3149C310.385 11.3149 310.665 11.1752 310.946 11.5941C311.507 12.2923 312.91 11.3149 313.4 10.7563C313.961 10.128 312.699 9.15061 312.068 9.36005C311.016 9.63931 310.175 9.91857 309.263 10.4073C309.403 10.8262 309.403 11.3149 309.894 11.3149ZM363.962 19.2737C364.734 20.2511 366.557 18.9945 367.469 18.7152C367.749 18.6454 368.24 19.2039 368.661 19.1341C369.432 18.9945 370.274 18.8548 371.045 18.7152C371.606 18.6454 371.887 18.4359 372.378 18.0171C372.658 17.8076 372.027 16.8302 371.676 16.8302C370.905 16.7604 370.765 16.4113 370.204 15.783C369.993 15.5037 368.941 15.783 368.591 15.783C368.801 15.5735 369.012 15.3641 369.292 15.1547C368.17 14.7358 367.399 14.8056 366.627 15.6434C365.856 16.4811 365.295 17.4585 364.664 18.5058C364.453 18.785 364.173 19.0643 363.962 19.2737ZM353.654 14.1074C354.425 14.0376 355.968 13.5489 356.529 14.2471C357.23 15.1547 357.651 16.2717 358.703 16.2019C360.035 16.0623 360.666 16.0623 361.859 16.4811C362.981 16.9 363.472 16.6906 364.664 16.3415C364.523 15.9924 364.173 15.2245 364.243 14.8056C364.453 14.3169 364.944 13.6886 364.453 13.4093C363.401 12.8508 362.84 13.3395 361.718 13.7584C362.069 13.3395 362.42 12.9904 362.84 12.5715C362.35 12.4319 361.087 12.5017 360.947 11.8734C360.737 10.5469 360.737 10.6865 361.859 10.3375C361.087 9.77894 359.685 8.31283 358.843 8.24302C357.791 8.1732 358.492 8.80154 357.861 9.01098C357.16 9.22042 356.459 9.42987 355.828 9.63931C355.056 9.84875 355.126 10.128 354.916 11.0356C354.846 11.3149 353.654 11.4545 353.373 11.5243C353.093 11.5941 352.742 12.781 352.602 13.13C352.461 13.3395 353.513 13.9678 353.654 14.1074ZM473.572 40.637C473.923 40.4973 474.273 40.7766 474.624 40.7068C475.816 40.4973 476.728 40.4973 477.569 39.5898C477.078 39.1709 476.728 38.6124 476.097 38.6124C475.255 38.5425 474.413 38.5425 473.642 38.4727C473.081 38.4727 472.169 39.0312 471.678 39.3105C471.538 39.3803 471.959 40.8464 472.029 41.1257C472.45 40.9162 473.011 40.7766 473.572 40.637ZM250.917 44.8957C250.426 45.1051 249.795 45.1051 250.005 45.8731C250.286 45.6636 250.566 45.4542 250.776 45.2447C250.776 45.1051 250.847 44.9655 250.917 44.8957ZM247.34 47.8977C247.691 47.9675 247.971 47.8279 248.112 47.4788C247.901 47.2694 247.621 47.2694 247.41 47.5486C247.34 47.6184 247.34 47.7581 247.34 47.8977ZM249.304 45.524C249.023 45.8731 248.743 46.1523 248.462 46.5014C248.743 46.5712 249.023 46.641 249.304 46.7108C249.865 46.292 249.795 45.9429 249.304 45.524ZM224.479 69.6798C224.829 69.7496 224.829 69.6798 225.18 69.5402C224.969 69.5402 224.829 69.4006 224.549 69.4704C224.619 69.4006 224.689 69.4006 224.759 69.3308C224.268 68.9817 224.198 69.4704 224.198 69.6798C224.268 69.7496 224.338 69.8893 224.408 69.9591C224.479 69.8893 224.479 69.8195 224.479 69.6798ZM260.033 41.6144C260.314 41.3351 260.664 41.1955 260.664 40.7068C260.244 40.9162 260.314 41.1955 259.753 41.0559C259.332 40.9162 259.051 40.9162 258.631 40.986C258.841 41.8936 259.472 41.6144 260.033 41.6144ZM220.692 76.3122C220.832 76.1028 220.972 75.8933 221.042 75.6839C220.762 75.6141 220.481 75.8933 220.692 76.3122ZM249.444 46.9203C248.883 46.9203 248.322 46.7807 248.322 47.6184C248.743 47.409 249.093 47.1297 249.444 46.9203ZM221.603 76.5217C221.603 76.7311 221.673 76.9405 221.814 77.15C222.024 76.8009 221.884 76.5915 221.603 76.5217ZM221.253 72.9611C221.183 72.9611 221.112 73.0309 221.042 73.1007C221.183 73.1705 221.253 73.1706 221.323 73.1706C221.042 73.4498 220.902 73.7291 220.832 74.0781C220.762 74.2178 220.341 74.4272 220.201 74.6367C220.762 74.7763 220.762 74.9857 220.201 75.1254C220.551 75.4744 221.463 75.1254 220.692 74.6367C221.183 74.9159 221.393 74.497 221.814 74.148C221.884 74.2178 221.884 74.2876 221.954 74.3574C221.393 74.6367 221.323 75.265 221.183 75.8933C221.112 76.3122 221.323 76.3122 221.112 76.8009C221.042 77.0802 220.832 77.2198 221.042 77.3594C221.463 77.7783 221.393 76.8009 221.463 76.5217C221.533 76.033 221.533 75.5443 222.094 75.3348C221.463 75.8933 222.024 76.382 222.445 75.4744C222.515 75.6141 222.585 75.8235 222.585 75.9631C222.234 75.9631 222.305 76.1028 222.375 76.5217C222.515 77.0104 222.585 76.8707 222.375 77.4991C222.164 78.1274 221.603 78.1972 222.305 78.7557C222.305 78.6161 222.305 78.4765 222.305 78.3368C222.655 78.4765 223.146 78.8953 223.006 78.3368C223.497 78.6859 224.198 77.9878 224.899 78.1274C223.637 78.4066 224.338 80.3615 225.11 79.8029C224.759 80.2916 224.829 81.269 225.25 81.6181L225.11 81.6879C224.899 81.4087 224.969 81.5483 224.759 81.4087C224.759 81.5483 224.829 81.6181 224.829 81.7577C224.338 81.6879 223.988 81.4785 223.567 81.8276C223.427 81.4785 223.146 81.3389 222.796 81.4785C223.357 81.8974 223.076 82.3163 222.585 82.6653C222.866 82.5955 223.216 82.5257 223.497 82.5257C223.427 83.154 223.777 83.2937 223.357 83.8522C223.146 84.1314 222.234 84.3409 221.884 84.4805C221.954 84.6201 221.954 84.8994 221.954 84.8296C222.375 85.5277 222.866 84.6201 223.497 84.9692C223.427 85.039 223.357 85.1088 223.286 85.1787C223.567 85.1787 224.198 85.5277 224.268 85.5277C224.689 85.3881 225.18 85.2485 225.601 85.039C225.32 85.3881 225.04 85.5975 224.969 86.0164C224.128 85.8768 223.216 85.5277 222.936 86.6448C222.796 87.2033 221.814 87.692 221.393 88.1807C222.164 88.6694 222.936 87.1335 223.988 87.9014C224.549 86.4353 224.829 87.6222 225.881 87.1335C226.232 86.9938 226.863 86.4353 227.214 86.5051C227.704 86.5051 227.775 87.0637 228.265 86.924C229.177 86.7146 229.738 86.7146 230.65 86.3655C231.842 85.8768 230.019 85.5277 229.668 85.4579C230.58 84.7598 231.211 84.4805 231.351 83.2238C231.491 81.9672 229.387 82.805 229.177 82.5955C230.019 82.037 228.756 80.9898 228.125 80.9898C228.476 80.8502 228.897 80.92 229.107 81.269C228.826 79.6633 227.494 79.5237 227.073 78.267C226.582 76.5915 225.881 76.4518 224.338 76.2424C224.619 75.8933 224.969 75.7537 225.32 75.8235C224.829 74.8461 227.003 73.7291 226.442 72.8215C226.091 72.263 223.567 72.5422 223.286 73.1007L223.146 72.9611C223.357 72.8215 223.427 72.5422 223.637 72.4026C223.427 72.3328 223.216 72.1932 223.006 72.1932C223.146 72.1932 223.286 72.1932 223.497 72.1932C223.637 71.5648 224.759 71.4252 224.899 70.5176C224.338 70.378 223.497 70.5874 222.936 70.8667C222.655 70.727 222.936 70.6572 222.515 70.8667C222.375 70.2383 221.884 70.7969 222.094 71.2856C221.954 71.2856 221.814 71.3554 221.673 71.3554C221.603 71.495 221.603 71.6346 221.533 71.7044C221.744 71.8441 221.884 72.1233 222.024 72.263C221.744 72.0535 221.393 72.0535 221.042 72.1932C221.183 72.4026 221.183 72.6819 221.323 72.9611C221.183 72.9611 221.042 72.8913 220.972 72.8913C220.832 72.8913 220.972 72.8913 221.253 72.9611ZM222.866 79.1746C222.585 79.3142 222.375 79.5237 222.375 79.8727C222.445 79.8727 222.515 79.8727 222.655 79.8727C222.936 79.7331 223.006 79.5237 222.866 79.1746ZM251.618 46.4316C252.109 45.8731 252.67 45.3145 253.161 44.756C252.81 45.0353 252.459 45.3844 252.109 45.6636C251.688 45.6636 251.478 46.0127 251.618 46.4316ZM254.353 43.2201C254.072 43.5692 253.792 43.7088 253.441 44.0579C253.722 44.0579 254.072 44.0579 254.353 44.1277C254.633 43.639 255.054 43.4296 254.353 43.2201ZM252.53 44.1277C251.898 44.3371 251.898 44.2673 251.828 44.9655C251.758 46.0127 253.231 44.6164 253.511 44.3371C253.301 43.8484 252.95 43.9881 252.53 44.1277ZM255.615 42.9409C255.194 42.6616 254.633 42.6616 254.493 43.2201C254.633 43.2899 254.774 43.3597 254.984 43.4296C255.265 43.3597 255.475 43.2201 255.615 42.9409ZM250.987 45.8032C250.706 46.0127 250.847 46.4316 250.426 46.641C250.496 46.292 250.566 45.9429 250.636 45.6636C250.215 45.6636 250.005 46.0127 250.145 46.5014C250.005 46.5014 249.865 46.5014 249.795 46.5014C249.725 46.9901 249.795 46.7807 249.514 47.1297C250.075 47.1995 250.286 47.409 250.636 46.9203C250.917 46.5712 251.127 46.4316 251.548 46.5712C251.548 46.2919 251.408 45.524 250.987 45.8032ZM249.725 47.7581C249.725 48.3864 249.374 48.526 248.883 48.5958C249.093 48.7355 249.023 48.8053 249.234 48.9449C249.163 49.0845 249.093 49.294 248.953 49.4336C249.514 48.8751 249.865 48.6656 249.725 47.7581ZM250.356 47.5486C250.215 47.4788 250.005 47.4788 249.865 47.4788C249.865 47.6882 249.865 47.9675 249.935 48.1769C250.356 47.7581 250.776 47.2694 251.197 46.8505C250.847 46.8505 250.566 47.1297 250.356 47.5486ZM256.667 43.1503C256.106 42.8012 255.054 43.4296 254.633 43.9881C254.914 43.9183 255.194 43.7786 255.475 43.7088C255.896 43.4994 256.246 43.2899 256.667 43.1503ZM257.158 42.3823C257.018 42.3823 256.667 42.3823 256.527 42.3823C256.597 42.522 256.597 42.6616 256.667 42.8012C257.018 43.0805 257.228 42.871 257.158 42.3823ZM324.691 33.2366C323.849 33.3064 324.06 33.7253 323.99 34.6329C324.761 34.4933 325.532 34.3537 326.304 34.214C325.953 33.4461 325.392 33.1668 324.691 33.2366ZM405.057 118.061C405.127 118.41 405.127 118.759 405.197 119.109C406.039 119.178 405.408 118.201 406.039 118.271C406.81 118.341 406.39 119.318 406.179 119.667C405.759 120.295 405.688 122.32 406.81 121.552C407.652 120.924 408.003 119.737 408.493 118.759C408.634 118.48 408.143 117.852 408.003 117.642C407.722 117.154 407.442 117.712 407.021 117.084C407.722 116.456 408.493 117.433 408.844 116.176C409.195 116.805 409.475 116.525 409.896 116.246C410.106 116.107 410.878 115.967 410.948 115.827C411.439 115.269 412.421 115.618 413.052 115.688C412.07 116.525 412.631 117.154 413.402 117.782C413.823 117.224 414.174 116.176 414.945 116.316C414.454 115.897 414.314 115.478 414.875 115.059C415.506 116.107 416.839 115.618 417.47 114.71C417.61 114.989 417.75 115.269 417.891 115.548C418.241 115.059 418.522 114.501 419.013 114.152C418.943 114.431 418.872 114.78 418.802 115.129C419.504 114.92 419.574 114.361 420.135 114.012C420.205 113.942 419.994 112.616 420.065 112.267C420.205 111.499 420.485 111.499 420.485 110.591C420.485 110.033 420.345 109.055 421.187 109.474C421.187 108.916 421.046 108.497 421.467 108.148C421.958 107.799 421.818 107.17 421.818 106.542C421.818 106.123 421.327 105.495 421.116 105.076C420.906 104.657 421.116 104.238 421.187 103.819C420.485 103.47 420.065 103.959 420.275 104.727C419.854 103.121 418.872 105.215 418.732 105.844C418.592 106.332 419.223 106.542 419.153 106.821C418.943 107.45 418.732 108.148 418.522 108.846C418.241 109.684 417.68 110.661 416.839 111.01C416.348 111.289 415.927 111.499 415.366 111.569C414.875 111.569 415.436 110.661 415.576 110.521C414.875 110.801 414.595 110.731 414.595 111.499C414.595 111.918 413.893 112.476 413.683 112.825C413.402 113.244 413.823 113.593 413.262 113.803C412.491 114.152 412.841 113.523 412.35 113.523C411.439 113.593 409.756 113.384 409.195 114.222C408.564 115.129 407.722 115.757 406.67 115.757C407.301 117.154 405.758 117.573 405.057 118.061ZM403.725 165.605C403.304 165.954 402.673 166.373 402.392 166.862C401.972 167.56 402.252 167.699 402.392 168.328C402.462 168.816 402.533 169.375 402.463 169.934C402.392 170.283 403.234 170.701 403.444 170.911C403.374 170.213 403.094 168.747 404.216 169.235C404.075 169.096 402.883 168.328 403.444 168.188C404.075 168.049 404.146 167.211 403.444 167.071C403.585 166.862 403.655 166.582 403.795 166.443C403.865 166.164 403.725 165.884 403.725 165.605ZM434.16 205.609C433.389 204.911 434.441 203.933 433.178 203.514C433.038 203.445 432.407 204.352 432.267 203.863C432.056 203.235 431.916 202.677 431.706 202.118C431.355 201.071 431.425 200.442 430.514 199.954C430.163 199.744 427.708 198.627 427.708 198.278C427.708 197.231 427.989 196.114 427.288 195.346C426.376 194.299 426.446 193.81 426.376 192.344C426.306 191.367 425.184 190.878 424.553 191.436C424.202 189.272 423.641 187.666 422.8 185.642C421.748 185.851 421.677 187.736 421.467 188.644C421.187 189.621 421.397 190.808 421.467 191.855C421.537 193.112 420.836 197.022 419.083 196.393C418.452 196.184 417.961 195.137 417.33 194.718C416.208 194.02 415.085 193.391 413.963 192.693C412.912 192.065 413.332 191.716 413.683 190.459C413.893 189.412 414.524 188.923 415.156 188.155C414.104 187.108 413.823 187.038 412.421 186.898C411.299 186.759 410.247 186.619 409.125 186.619C409.195 187.108 409.195 187.666 409.265 188.155C408.003 187.946 406.951 187.317 406.179 188.434C405.408 189.551 405.198 190.599 404.917 191.925C403.865 191.367 402.813 190.808 401.761 190.25C401.411 190.04 400.078 191.506 399.798 191.785C398.115 193.252 395.8 194.508 394.889 196.742C394.468 197.859 394.468 198.837 393.346 199.116C391.873 199.465 390.401 199.814 388.928 200.093C387.946 200.303 387.385 200.722 386.473 201.42C385.351 202.188 385.211 202.467 384.65 203.863C384.44 203.375 384.299 202.956 384.089 202.537C383.388 204.352 382.897 205.818 383.598 207.633C384.019 208.681 383.879 208.89 383.528 210.007C383.248 210.775 383.809 211.403 384.089 212.102C384.931 213.917 385.492 215.592 385.772 217.617C385.912 218.385 386.544 220.34 386.263 220.968C386.193 221.177 384.51 222.155 385.351 222.713C385.983 223.202 386.754 224.179 387.595 224.179C388.437 224.179 389.419 224.459 390.05 223.83C390.962 222.923 391.242 222.574 392.434 222.434C393.276 222.364 394.117 222.225 395.029 222.225C395.66 222.225 396.361 222.155 396.993 222.155C397.203 222.155 397.483 221.247 397.624 221.038C397.974 220.34 399.237 220.06 399.938 219.711C400.639 219.362 401.691 219.921 402.322 219.502C402.813 219.223 403.865 218.245 404.426 218.315C406.46 218.594 408.283 218.804 410.177 219.502C411.369 219.991 411.509 220.2 412.14 221.457C412.561 222.294 413.052 222.993 413.543 223.761C414.665 222.504 415.576 221.457 416.348 219.991C416.839 221.526 415.857 222.713 415.086 224.04C416.348 224.319 416.278 223.621 416.909 222.364C416.979 223.132 416.769 225.017 417.54 225.017C418.241 225.017 418.732 226.483 418.872 227.112C419.363 229.276 420.906 229.904 422.8 230.184C423.992 230.393 424.202 230.533 425.114 229.695C426.166 228.787 426.096 229.206 427.007 230.253C427.428 230.742 428.55 230.393 428.971 229.974C429.953 228.997 430.093 228.927 431.355 228.857C433.529 228.787 433.319 225.855 433.669 224.04C433.95 222.434 435.703 221.247 436.124 219.711C436.615 217.826 437.526 215.592 437.596 213.637C437.667 211.822 437.035 209.658 436.755 207.843C435.843 207.145 435.002 206.377 434.16 205.609ZM400.148 174.402C399.728 175.589 401.691 175.1 401.972 174.96C402.042 174.262 400.429 173.634 400.148 174.402ZM407.231 186.48C406.53 186.968 405.759 185.991 405.688 187.248C406.249 187.248 406.881 187.527 407.301 187.248C407.722 186.968 407.932 186.27 407.231 186.48ZM436.825 176.845C437.176 176.147 437.246 176.077 436.825 175.449C436.755 175.379 436.474 175.519 436.404 175.379C436.334 175.239 436.194 174.96 436.054 174.821C435.422 174.262 434.581 173.913 433.88 173.424C433.599 174.262 436.825 174.681 436.474 176.217C436.545 176.426 436.685 176.636 436.825 176.845ZM429.953 233.884C429.532 234.023 428.269 234.861 427.919 234.652C427.218 234.303 426.446 234.023 425.745 233.674C425.605 234.791 425.745 236.188 426.166 237.235C426.727 238.561 427.358 238.84 428.62 239.12C429.953 239.329 431.425 234.372 429.953 233.884ZM432.126 177.823C431.565 177.823 431.004 177.683 430.514 177.892C430.864 178.73 432.547 179.219 433.319 179.009C433.95 178.87 434.721 178.591 434.932 177.962C435.002 177.753 436.194 177.823 435.493 177.055C436.474 176.845 436.054 176.007 435.493 175.658C434.721 175.17 434.932 176.496 434.932 176.915C434.861 176.915 432.407 178.66 433.038 177.194C432.968 177.055 432.617 177.823 432.126 177.823ZM427.077 177.683C426.657 177.194 426.937 176.426 426.306 176.077C425.675 175.728 425.114 175.309 424.483 174.96C423.571 174.402 422.379 174.122 421.397 173.773C419.854 173.215 418.311 172.586 416.698 172.028C415.927 171.749 414.735 172.307 414.244 173.005C414.034 173.215 413.262 174.611 412.982 174.471C412.351 174.122 412 174.122 411.719 173.424C411.439 172.656 411.228 172.028 411.158 171.19C411.018 170.283 410.808 170.492 410.036 170.283C408.774 170.003 407.512 170.283 406.881 171.539C407.301 171.609 407.722 171.679 408.213 171.749C408.423 171.819 408.213 172.517 408.493 172.656C409.195 173.075 410.177 172.796 410.948 172.796C410.948 172.936 410.948 173.285 410.878 173.424C409.896 173.075 409.335 173.285 408.283 173.494C408.704 174.192 409.125 174.96 409.545 175.658C409.896 175.17 410.317 174.751 410.667 174.262C410.878 175.379 410.878 175.309 411.789 175.728C412.841 176.217 413.963 176.636 415.015 177.055C415.436 177.264 416.558 177.473 416.769 177.962C417.119 178.8 417.47 179.708 417.82 180.545C416.558 180.894 416.418 180.755 416.278 182.151C417.259 182.081 418.171 181.942 419.153 181.872C419.644 181.802 419.994 183.338 420.626 183.338C421.607 183.408 422.589 183.687 423.431 183.059C423.922 182.779 424.132 181.243 424.623 181.313C425.184 181.383 426.797 181.313 427.218 181.732C427.989 182.57 428.76 183.338 429.532 184.176C430.163 184.804 430.934 184.734 431.776 184.874C432.337 184.944 433.249 185.642 433.669 185.502C433.319 185.153 432.197 184.385 432.758 183.896C432.267 183.757 431.495 183.827 431.846 183.059C430.584 182.989 430.654 182.71 430.023 181.523C429.882 181.243 429.321 181.034 429.041 180.825C428.76 180.685 428.69 179.987 428.55 179.708C428.971 179.638 429.392 179.638 429.742 179.568C430.023 177.892 427.779 178.451 427.077 177.683ZM422.168 86.2957C422.168 87.2731 422.238 88.1109 421.888 88.9486C421.397 90.0657 421.748 90.0657 422.028 91.1827C422.168 91.8809 422.168 91.8809 421.748 92.5092C421.537 92.7884 421.818 93.2772 421.818 93.6262C421.818 94.6734 421.607 94.9527 422.028 95.9999C422.168 95.4414 422.168 94.5338 422.87 94.3942C423.571 94.2545 423.922 95.1621 423.851 95.7207C424.483 95.0225 423.711 93.9753 423.361 93.2772C422.87 92.4394 422.589 92.2997 422.87 91.3223C423.29 90.0657 423.15 89.6468 424.342 89.4373C425.114 89.2977 425.044 90.6242 425.815 90.6242C425.184 89.5072 424.903 88.5298 424.553 87.2033C424.412 86.575 424.272 86.0164 424.062 85.3881C423.992 84.9692 423.501 84.6899 423.431 84.2711C423.22 82.9446 424.272 82.3163 423.571 80.9898C423.22 80.2916 423.641 78.4066 422.379 79.3142C422.87 79.8029 423.15 80.5709 422.659 80.9898C422.449 81.1992 422.379 80.7803 421.958 81.0596C421.537 81.4087 421.677 81.4087 421.818 81.9672C421.958 82.5955 421.607 83.6427 421.467 84.2711C421.467 85.1787 422.87 85.5277 422.168 86.2957ZM397.554 155.272C398.185 155.412 398.605 154.435 397.764 154.365C397.554 154.574 396.782 155.133 397.554 155.272ZM396.572 155.482C396.642 154.854 396.993 154.365 397.413 154.016C397.694 153.806 397.483 152.969 397.624 152.62C397.554 152.689 397.483 152.689 397.413 152.759C397.203 153.597 396.432 154.644 396.572 155.482ZM398.816 152.48C398.465 152.689 398.115 152.55 397.904 152.27C397.974 152.689 397.904 153.038 398.115 153.318C398.676 152.829 398.255 154.295 398.886 154.644C398.886 154.435 398.886 154.155 398.816 153.946C398.886 154.155 399.026 154.295 399.096 154.505C399.447 154.016 398.746 153.248 398.816 152.48ZM396.782 151.293C396.922 151.642 397.203 151.921 397.483 152.061C397.554 151.852 397.554 151.433 397.554 151.223C396.993 151.293 397.133 150.595 396.361 150.665C396.572 151.014 396.502 151.433 396.151 151.712C396.361 151.572 396.642 151.433 396.782 151.293ZM397.834 150.804C397.834 151.363 398.255 151.502 398.605 151.782C399.026 152.131 398.535 152.201 398.816 152.55C399.728 153.737 399.657 152.131 399.517 151.363C399.307 150.455 398.465 150.735 397.834 150.804ZM394.538 151.921C394.678 153.457 394.468 154.505 396.081 153.806C395.66 154.365 394.748 155.203 395.59 155.622C395.941 155.761 395.8 156.25 396.221 156.18C396.642 156.11 396.432 155.552 396.432 155.133C396.432 154.574 397.133 153.527 396.922 153.178C396.432 152.34 396.151 152.27 395.31 151.921C395.099 151.852 394.748 151.921 394.538 151.921ZM391.032 171.469C390.821 172.028 390.962 172.447 390.681 173.005C390.26 173.843 390.05 173.913 390.541 174.681C390.821 175.1 391.593 174.541 391.382 175.519C391.312 175.938 390.891 177.543 391.032 177.823C391.242 178.102 392.294 178.311 392.504 177.892C392.575 177.753 392.294 177.194 392.294 176.985C392.294 176.706 392.574 176.496 392.574 176.287C392.645 175.798 392.504 175.1 392.574 174.541C392.645 173.983 391.873 173.564 392.995 173.424C393.626 173.354 393.136 174.471 393.206 174.751C393.416 175.379 394.187 175.309 393.977 175.938C393.767 176.636 394.258 176.775 394.748 176.636C394.468 176.706 395.871 175.589 395.73 175.938C396.151 175.03 395.169 175.519 394.889 174.821C394.819 174.681 395.309 174.332 395.169 174.122C395.029 173.773 394.819 173.494 394.678 173.145C394.398 172.656 394.117 172.656 393.767 172.237C395.029 172.726 395.45 170.213 396.572 170.911C396.852 169.794 395.941 170.492 395.52 170.492C395.029 170.492 394.959 170.701 394.608 170.841C394.117 170.981 394.398 170.422 393.907 170.911C392.715 172.168 391.452 169.934 392.364 168.816C392.785 168.258 393.346 168.886 393.977 168.816C394.678 168.747 395.52 168.467 396.151 168.816C397.694 169.724 398.535 168.049 399.026 166.722C398.395 166.722 397.904 167.699 397.343 168.118C397.063 168.328 396.502 167.979 396.151 167.909C395.73 167.909 395.8 168.188 395.31 167.979C394.678 167.769 393.556 167.071 392.925 167.49C392.154 167.979 391.943 168.467 391.523 169.375C392.154 170.422 391.312 170.771 391.032 171.469ZM392.504 149.408C392.925 150.106 393.276 150.735 393.697 151.433C394.468 150.525 394.398 150.036 393.486 149.408C393.135 149.408 392.855 149.408 392.504 149.408ZM384.86 181.732C384.86 182.5 385.422 183.128 385.983 182.43C386.544 181.662 385.351 181.523 384.86 181.732ZM419.854 100.328C419.784 100.608 419.784 101.236 419.574 101.376C419.083 101.655 419.013 101.655 418.872 102.144C418.802 102.283 419.363 103.889 419.504 103.959C419.714 104.029 419.924 103.33 420.205 103.4C420.415 103.47 420.906 103.47 420.626 103.121C420.345 102.632 419.433 102.981 419.574 102.074C419.994 101.934 420.485 102.353 420.696 102.283C420.906 102.144 421.537 101.795 421.748 102.004C422.098 102.353 423.15 103.261 423.641 103.051C423.641 103.051 423.922 102.004 423.992 101.864C424.132 101.655 424.763 101.306 425.044 101.306C425.815 101.306 426.446 101.236 427.007 100.538C425.535 100.608 426.657 99.351 426.446 98.7227C425.394 99.7699 425.394 99.4906 424.062 98.8623C423.15 98.3736 422.729 97.5358 422.028 96.6981C421.257 95.581 421.537 98.0245 421.677 98.3736C421.818 98.7925 421.116 99.1416 421.116 99.6303C421.116 100.049 421.187 100.328 420.976 100.677C420.696 100.538 420.275 100.468 419.854 100.328ZM242.151 76.9405C242.221 77.2896 242.782 78.0576 243.133 77.9878C243.623 77.8481 243.553 77.15 243.133 77.0802C242.992 76.5915 242.571 76.7311 242.151 76.9405ZM275.882 113.942C275.461 114.152 274.76 114.64 274.339 114.571C274.059 114.571 273.007 114.291 272.797 114.71C272.095 116.107 274.97 115.269 275.251 115.199C274.83 114.64 275.461 114.361 275.882 113.942ZM264.592 115.059C264.592 114.571 263.61 114.361 263.119 114.431C262.207 114.571 261.927 114.361 261.155 113.872C261.015 114.012 260.875 114.361 260.805 114.571C262.207 115.059 263.189 115.129 264.592 115.059ZM243.974 76.7311C243.834 77.0802 243.974 77.7783 244.465 77.7783C245.026 77.7085 244.956 78.1972 245.026 78.7557C245.096 78.1274 245.026 77.4292 245.797 77.3594C245.657 77.2896 245.517 77.0104 245.377 76.9405C247.27 76.5915 244.184 74.8461 245.096 76.6613C244.675 76.6613 244.535 76.4518 244.745 76.033C244.605 76.033 244.395 76.033 244.255 76.033C244.395 76.3122 244.325 76.5217 243.974 76.7311ZM260.664 70.5874C259.753 70.3082 259.402 70.378 258.42 70.6572C258.771 71.0063 258.981 71.3554 258.771 71.9139C259.192 71.1459 260.033 71.0063 260.664 70.5874ZM240.538 105.914C240.608 106.123 240.187 106.472 240.187 106.751C240.187 106.891 240.538 107.031 240.538 107.17C240.468 107.799 239.907 107.868 240.398 108.357C240.818 108.706 241.239 108.776 241.309 108.148C241.309 107.799 241.87 108.148 241.94 107.449C242.01 106.751 242.081 106.053 242.221 105.355C242.361 103.959 240.748 104.797 240.398 105.076C240.257 105.006 240.117 105.006 239.977 104.936C239.696 105.634 240.468 105.425 240.538 105.914ZM486.405 58.7189C486.125 58.7189 484.933 58.4397 484.722 58.6491C484.442 58.9284 484.722 59.5567 484.933 59.7662C485.704 60.3945 486.686 59.4869 487.177 60.1152C487.738 60.8134 488.649 61.0926 489 59.9058C488.229 59.4869 487.247 58.7189 486.405 58.7189ZM253.441 73.9385C253.722 73.5196 254.143 73.2404 254.563 73.0309C254.143 72.5422 254.493 72.263 254.844 71.8441C253.511 71.495 253.371 72.8913 253.441 73.9385ZM256.316 67.2363C256.316 67.0967 256.246 66.9571 256.246 66.8174C256.316 66.8174 256.387 66.8174 256.457 66.8174C256.317 65.9098 255.124 66.608 256.316 67.2363ZM240.468 102.632C239.977 103.051 240.888 103.889 241.309 103.889C241.66 102.842 241.73 102.283 241.59 101.166C241.169 101.236 241.52 101.585 241.309 101.864C241.169 102.144 240.748 102.353 240.468 102.632ZM440.051 178.451C439.7 178.241 439.77 177.683 439.139 177.543C439.139 178.032 439.139 178.311 439.42 178.591C439.63 178.87 439.56 179.219 439.7 179.428C439.981 179.777 441.243 180.126 440.822 179.219C440.612 178.94 440.331 178.591 440.051 178.451ZM410.738 117.712C410.948 117.642 411.228 118.271 411.369 118.061C411.509 117.852 412 117.363 412.07 117.154C412.14 115.478 409.966 116.944 409.616 116.665C409.125 117.712 408.704 117.503 409.125 118.829C409.966 119.388 410.106 117.992 410.738 117.712ZM402.743 174.332C402.112 175.17 403.374 175.17 403.725 175.1C404.005 175.1 403.865 174.471 404.146 174.611C404.426 174.681 404.777 174.96 405.057 174.89C405.899 174.681 406.109 174.96 406.81 175.449C407.091 173.983 405.548 173.913 404.707 173.634C403.935 173.773 403.234 173.704 402.743 174.332ZM464.385 235.071C464.385 234.512 464.175 234.023 463.964 233.535C463.333 233.884 463.053 233.884 462.913 234.652C462.702 235.42 462.492 235.071 462.071 235.629C461.79 236.048 461.861 236.746 461.58 237.165C461.3 237.584 460.668 237.933 460.318 238.282C459.897 238.631 459.546 239.05 459.055 239.259C458.705 239.399 457.933 239.608 457.653 239.888C456.882 240.935 456.11 241.912 455.339 242.96C454.567 244.007 456.882 243.728 457.162 244.077C457.653 244.635 459.266 245.194 459.757 244.356C460.248 243.518 461.229 242.471 461.51 241.493C461.861 240.097 462.352 239.888 463.474 239.12C463.544 239.469 463.754 239.678 464.105 239.678C463.684 238.84 463.614 238.771 464.175 238.003C464.736 237.235 465.297 236.537 465.858 235.838C465.718 235.28 465.507 234.791 465.367 234.233C465.086 234.512 464.736 234.791 464.385 235.071ZM457.162 244.705C456.741 244.845 457.022 245.403 456.671 245.822C457.162 245.403 458.354 245.613 457.162 244.705ZM471.117 228.438C469.995 229.136 469.855 229.066 468.593 228.717C467.821 228.508 468.312 227.112 467.541 226.763C467.611 227.531 467.12 228.159 466.629 227.181C466.489 226.902 466.77 226.413 466.559 226.134C466.419 225.925 466.138 225.646 465.998 225.366C465.647 224.319 466.279 224.459 465.086 224.04C464.525 223.83 464.245 223.272 463.684 223.132C463.964 223.761 464.245 224.319 464.525 224.947C464.666 224.878 464.736 224.808 464.876 224.668C465.157 225.296 465.858 227.67 466.559 227.461C466.279 228.229 466.84 228.927 466.559 229.625C466.209 230.602 466.068 230.882 465.227 231.51C465.507 231.789 465.858 232.138 466.209 232.348C466.419 232.487 467.12 232.487 467.26 232.697C467.681 233.465 466.699 234.442 466.349 234.861C467.05 235.28 467.821 235.699 468.383 234.582C468.803 233.674 469.645 232.627 469.645 231.65C469.645 231.021 470.346 230.951 470.697 231.161C471.117 231.37 470.767 230.812 470.907 230.672C471.328 230.114 472.169 228.578 471.117 228.438ZM232.193 107.17C232.473 107.38 232.754 107.589 233.034 107.799C233.245 107.589 233.525 107.38 233.735 107.17C233.245 106.263 232.894 106.682 232.193 107.17ZM484.021 54.181C484.021 55.0886 484.161 55.3678 483.39 55.7169C482.829 55.9962 483.32 56.8339 483.46 57.3925C482.478 57.2528 482.128 57.1132 481.286 56.4849C480.795 56.1358 479.673 56.7641 479.533 56.1358C479.322 55.2282 479.463 54.3904 478.551 54.3206C477.569 54.2508 476.587 54.181 475.676 54.1112C475.115 54.0414 476.096 52.3658 474.834 52.5753C474.203 52.7149 474.413 54.3206 474.413 54.949C474.343 55.9962 471.117 56.2754 470.276 56.4849C471.047 57.0434 471.889 57.2528 471.959 58.3001C472.029 59.4869 472.52 59.9756 473.151 60.953C473.221 61.0228 472.66 61.7908 472.52 61.7908C472.24 61.8606 471.608 61.5813 471.328 61.5813C470.837 61.5115 469.785 61.0228 469.364 61.3021C467.611 62.3493 465.788 63.4663 464.035 64.5135C462.632 65.3513 461.159 65.84 460.528 67.3759C459.266 66.1891 459.196 65.9797 457.583 66.1891C456.04 66.3985 455.97 66.4684 454.988 67.8646C454.988 67.3759 454.988 66.8872 454.918 66.3985C454.427 66.608 453.586 67.3061 453.025 67.2363C452.393 67.1665 451.762 66.8174 451.341 67.4458C450.43 68.842 449.588 70.3082 448.677 71.7044C449.168 71.8441 450.78 72.0535 450.64 72.612C450.29 74.0083 450.219 74.0083 451.061 75.1254C449.658 75.7537 448.466 76.3122 449.168 78.1274C449.308 78.4066 448.116 78.8953 447.765 78.9652C447.064 79.1746 446.503 79.1048 446.433 79.9426C446.362 80.8502 446.643 81.6879 445.731 81.8974C444.609 82.1766 444.539 82.037 444.399 83.2937C444.188 84.4805 442.716 85.7372 441.944 86.6448C441.033 82.3861 437.947 74.3574 443.066 71.8441C444.539 71.1459 445.381 70.9365 446.222 69.4704C446.994 68.0741 447.975 67.5156 449.168 66.608C450.009 65.9797 451.201 65.6306 451.412 64.5135C451.622 63.6758 451.832 62.838 452.043 62.0002C452.113 61.7908 453.235 61.721 453.445 61.6512C452.604 61.4417 452.113 61.3719 451.271 61.4417C450.64 61.5115 450.29 62.4889 449.939 63.0474C449.238 64.1645 447.765 65.0023 446.783 65.7702C446.292 64.5135 446.433 64.0248 446.713 62.6286C445.801 63.1871 445.381 63.3965 444.329 63.3965C443.277 63.3965 442.996 63.3267 442.155 64.0248C440.822 65.0721 439.7 66.3287 438.578 67.6552C438.929 67.9345 439.841 68.3533 439.56 68.842C439.49 69.0515 438.228 69.1213 438.017 69.1213C436.755 69.2609 435.563 69.4006 434.3 69.5402C434.721 69.1911 435.212 68.9119 435.633 68.5628C434.441 68.3533 433.249 68.0741 432.126 67.8646C431.776 67.7948 431.004 68.493 430.724 68.7024C430.373 68.9119 429.882 68.7024 429.462 68.6326C428.34 68.4232 427.428 68.4232 426.306 68.493C425.605 68.493 423.641 68.2137 423.15 68.7024C421.327 70.378 419.504 72.0535 417.75 73.8687C416.137 75.5443 414.314 76.7311 412.421 78.0576C412.701 78.6859 413.122 78.6161 413.613 78.6859C414.314 78.7557 414.384 78.6161 414.665 79.3142C414.735 79.5237 415.015 80.5709 415.226 80.5709C416.628 80.7105 416.769 80.92 417.4 79.5237C417.961 78.3368 421.327 81.0596 421.187 82.037C420.766 84.2013 420.275 86.3655 419.784 88.5996C419.293 90.6242 418.592 91.7412 417.47 93.5564C416.418 95.2319 415.576 96.8377 414.174 98.1642C413.262 99.0718 412.35 99.9793 411.369 100.887C410.878 101.376 409.826 101.376 409.125 101.515C408.774 101.585 408.493 100.608 408.213 100.608C408.003 100.538 407.231 101.166 407.021 101.306C405.969 101.934 405.969 102.213 405.548 103.47C404.917 105.425 403.374 106.472 401.972 107.799C403.514 109.125 404.917 110.591 404.566 112.895C404.356 114.431 404.566 114.78 403.304 115.408C402.252 115.967 401.691 115.897 400.499 115.897C400.639 115.059 400.709 114.152 400.85 113.314C400.99 112.337 400.078 112.406 400.85 111.499C401.34 110.94 401.06 110.172 400.359 110.242C399.728 110.312 398.676 110.731 398.465 109.753C398.325 109.265 399.026 107.938 399.167 107.449C399.167 107.38 397.764 106.402 397.554 106.472C396.993 106.472 396.011 107.38 395.59 107.659C394.959 108.078 394.258 108.427 393.626 108.846C393.136 107.519 394.328 106.612 395.099 105.774C394.258 105.146 394.258 104.936 393.346 105.355C392.715 105.634 392.294 106.053 391.733 106.472C391.032 107.031 390.681 107.38 389.84 107.659C389.699 107.729 388.297 108.217 388.647 108.636C389.208 109.195 389.699 109.753 390.12 110.452C390.751 111.429 390.681 111.289 391.593 110.801C392.995 110.102 394.047 110.731 395.45 111.08C393.837 112.406 392.294 113.733 390.681 115.129C391.382 115.688 392.224 116.176 392.574 117.084C393.065 118.201 393.556 119.248 394.117 120.365C393.276 120.226 392.504 120.086 391.663 119.946C392.504 120.575 393.416 121.203 394.258 121.831C393.626 122.25 392.995 122.739 392.364 123.228C393.136 123.437 393.977 123.716 394.748 123.926C393.767 125.741 392.925 128.045 391.663 129.651C390.33 131.326 389.279 133.211 387.315 134.049C385.211 134.887 383.177 135.794 381.003 136.562C380.372 136.772 379.671 137.051 379.04 137.26C378.479 137.47 378.619 137.47 378.759 138.098C378.829 138.517 378.829 139.355 378.128 139.006C377.918 138.936 377.707 137.958 377.637 137.679C377.848 137.609 378.058 137.4 378.339 137.4C377.637 136.841 376.305 136.423 375.463 137.051C374.762 137.609 373.079 138.447 372.798 139.355C372.728 139.634 372.167 140.821 372.308 141.1C372.728 141.728 373.149 142.427 373.57 143.055C374.131 144.032 374.902 144.87 375.604 145.708C376.445 146.825 376.936 147.174 377.006 148.57C377.076 149.408 377.497 151.433 376.866 152.061C375.043 153.737 373.289 155.272 371.326 156.739C370.695 156.11 371.606 155.063 371.115 154.574C370.484 153.876 369.853 153.248 369.222 152.55C368.1 151.363 367.258 150.665 365.716 150.595C365.786 150.246 365.786 149.827 365.856 149.478C364.383 149.548 364.664 149.757 364.523 151.363C364.453 152.34 363.962 153.248 363.612 154.086C363.472 154.435 363.612 154.923 363.612 155.272C363.682 156.04 363.682 155.901 364.383 155.901C364.734 155.901 365.225 158.274 365.365 158.693C365.575 159.392 366.978 160.09 367.539 160.509C368.03 160.858 368.941 161.765 369.152 162.324C369.503 163.162 369.152 164.348 369.362 165.256C369.573 166.094 370.064 166.932 370.344 167.769C369.082 167.56 368.31 166.792 367.329 165.954C366.347 165.186 366.277 164.767 365.926 163.511C365.645 162.673 365.365 160.718 364.804 160.09C363.892 159.112 363.051 158.205 362.139 157.227C361.718 156.808 362.279 154.435 362.35 153.806C362.49 152.62 362.209 151.223 362.139 150.036C361.999 147.663 361.227 145.638 360.526 143.334C360.035 143.893 359.544 144.521 359.124 145.08C358.492 145.848 358.563 145.778 357.651 145.568C356.669 145.359 356.739 145.429 356.95 144.381C357.02 143.963 357.37 142.776 357.23 142.357C356.599 140.891 356.248 139.564 355.056 138.657C354.004 137.819 353.654 136.353 353.093 135.096C352.532 135.445 351.83 136.283 351.199 136.353C350.077 136.492 348.955 136.632 347.903 136.841C347.763 136.841 347.062 136.841 346.921 136.981C346.711 137.19 347.062 137.958 346.851 138.168C346.29 138.726 345.799 139.285 345.238 139.843C343.696 141.449 342.153 142.985 340.61 144.591C340.119 145.149 338.997 145.359 338.366 145.708C337.524 146.127 337.875 146.685 337.875 147.663C337.875 148.5 338.155 149.687 337.945 150.525C337.735 151.293 337.104 152.48 337.314 153.248C337.594 154.505 337.805 154.993 338.576 155.901C339.277 156.669 339.558 157.507 339.979 158.484C340.75 160.229 337.735 161.765 337.524 159.392C337.384 158.344 337.384 157.367 337.454 156.32C337.524 155.272 337.104 155.133 336.402 154.435C336.332 155.133 336.472 155.901 335.841 156.25C335.21 156.669 334.579 157.088 333.948 157.507C332.195 154.225 330.722 150.874 329.249 147.453C328.828 146.546 328.197 145.498 327.987 144.591C327.847 143.893 327.917 142.985 327.917 142.287C327.847 140.123 327.777 137.889 327.706 135.724C327.216 136.353 326.795 136.981 326.304 137.609C325.813 138.238 325.813 138.168 325.042 138.098C324.2 138.098 323.218 136.423 322.587 135.794C323.218 135.655 324.481 135.724 324.621 134.887C324.27 134.887 323.849 135.026 323.499 134.956C322.587 134.747 321.605 133.909 320.764 133.421C320.203 133.071 319.852 131.675 319.572 131.047C319.291 130.418 314.593 131.396 313.821 131.536C312.068 131.745 310.385 131.047 308.702 130.698C307.93 130.558 307.089 130.628 306.738 129.86C306.037 128.533 306.247 128.115 304.915 128.603C303.793 129.022 303.092 128.883 301.899 128.673C301.198 128.533 300.707 127.626 300.006 127.347C298.814 126.788 298.674 126.649 298.113 125.392C297.692 124.554 297.552 123.437 296.64 123.297C295.097 123.088 295.097 123.158 294.045 124.414C293.695 124.833 294.957 126.439 295.237 126.858C296.219 128.464 297.061 130.209 297.902 131.815C298.042 131.047 298.113 130.279 298.253 129.581C298.884 130.698 298.744 131.815 298.814 133.141C299.936 133.071 301.759 133.281 302.811 132.653C303.793 132.024 304.775 130.488 305.546 129.511C305.616 130.488 305.406 132.024 306.177 132.513C306.598 132.792 307.089 133.281 307.65 133.49C308.071 133.7 308.632 133.49 308.912 133.979C309.123 134.328 309.403 135.305 309.824 135.375C310.525 135.515 310.245 135.934 310.175 136.632C310.104 137.33 308.702 138.517 308.281 139.006C308.281 138.796 308.071 138.587 308.071 138.377C307.72 139.215 307.51 139.634 307.51 140.611C307.51 141.449 307.229 141.379 306.528 141.659C305.827 142.008 305.125 142.357 304.424 142.636C304.003 142.845 304.003 144.032 303.583 144.242C303.232 144.381 302.741 143.963 302.39 144.102C301.899 144.312 301.338 144.591 300.848 144.8C300.146 145.149 300.216 146.057 299.585 146.336C298.393 146.755 297.201 147.174 296.079 147.593C295.728 147.732 295.658 147.872 295.448 148.221C295.167 148.64 294.817 148.64 294.326 148.71C293.274 148.919 292.292 149.199 291.31 149.478C290.539 149.687 290.399 150.525 289.627 150.525C288.365 150.525 288.225 150.804 288.014 149.478C287.734 148.151 287.523 146.825 287.243 145.498C286.822 143.474 285.84 142.078 284.788 140.332C284.157 139.285 284.087 139.076 282.965 138.657C282.334 138.447 282.334 136.492 282.194 135.864C282.053 134.887 281.352 133.979 280.931 133.071C280.651 132.513 280.02 132.303 279.739 131.675C279.038 130.418 278.337 129.162 277.635 127.905C277.285 127.277 277.004 126.23 276.163 126.439C276.233 125.671 276.373 124.903 276.443 124.135C276.163 125.043 275.812 125.95 275.531 126.928C274.48 125.811 273.919 124.833 273.217 123.437C272.446 124.345 273.778 125.95 274.199 126.788C275.041 128.533 275.882 130.279 276.794 132.024C277.285 133.071 277.144 134.258 277.916 135.026C278.266 135.375 279.038 135.934 279.108 136.423C279.248 137.33 279.389 138.168 279.529 139.075C279.599 139.564 279.529 140.611 279.95 140.96C280.44 141.449 281.142 141.938 281.562 142.496C282.264 143.613 282.614 145.359 283.105 146.615C283.246 147.034 284.508 146.965 284.788 147.314C285.279 147.872 285.77 148.431 286.191 148.989C286.962 149.897 288.575 150.944 287.383 152.131C288.225 152.41 289.136 154.086 289.838 153.946C292.152 153.318 294.466 152.689 296.71 152.131C297.131 151.991 298.393 151.502 298.744 152.131C298.954 152.48 298.183 154.714 298.042 155.203C297.622 157.018 296.289 158.763 295.448 160.369C294.676 161.765 294.115 163.231 293.063 164.348C290.258 167.281 287.032 169.934 284.929 173.494C284.438 174.262 281.492 178.311 281.983 179.009C282.825 180.266 282.825 180.476 282.755 182.011C282.685 183.408 282.755 183.478 283.526 184.595C284.788 186.27 284.368 188.853 284.438 191.018C284.508 192.553 283.246 194.369 281.983 194.997C281.282 195.346 279.879 195.695 279.318 196.254C278.617 197.091 277.916 197.859 277.215 198.697C276.583 199.395 275.882 199.744 276.233 200.652C276.513 201.28 277.425 202.677 277.355 203.375C277.285 204.143 277.425 206.028 277.004 206.656C276.654 207.214 274.9 207.633 274.339 207.913C273.358 208.401 273.568 208.82 273.428 210.007C273.358 210.635 273.498 212.381 273.147 212.869C272.025 214.475 270.903 216.43 269.571 217.896C268.869 218.664 267.958 219.292 267.186 219.921C266.766 220.27 265.924 221.387 265.293 221.526C263.259 221.945 261.155 222.364 259.122 222.783C258.21 222.993 257.228 223.202 256.246 223.411C255.755 223.481 254.844 222.294 254.563 222.015C253.441 221.038 253.511 221.038 253.652 219.432C253.722 218.804 253.021 217.757 252.81 217.198C252.319 216.011 251.828 214.824 251.337 213.637C251.057 212.939 250.145 212.381 249.654 211.892C249.304 211.543 249.304 209.867 249.234 209.379C249.023 207.982 248.813 206.656 248.602 205.33C248.322 203.514 247.41 202.048 246.569 200.442C246.008 199.395 245.517 198.348 245.026 197.231C244.816 196.742 245.096 195.905 245.166 195.416C245.517 193.112 245.587 190.878 246.709 188.853C247.831 186.898 247.13 185.363 246.639 183.338C246.148 181.174 245.587 179.009 245.096 176.845C244.956 176.217 244.044 175.379 243.694 174.89C242.922 173.913 242.221 172.936 241.449 171.888C241.029 171.33 241.309 170.632 241.449 170.003C241.59 168.677 241.73 167.281 241.94 165.954C242.081 164.767 242.151 164.697 241.449 163.79C240.678 162.743 240.748 162.603 239.486 162.743C238.785 162.743 237.382 163.231 236.891 162.603C236.19 161.765 235.489 160.858 234.787 160.02C234.507 159.671 230.159 160.299 229.598 160.578C228.546 161.067 227.564 161.626 226.512 162.114C225.741 162.533 225.32 162.324 224.479 162.114C223.567 161.905 223.006 161.626 222.094 161.905C220.972 162.324 219.85 162.673 218.728 163.092C218.167 163.301 217.606 162.533 217.185 162.254C216.133 161.486 215.011 160.718 213.959 159.95C212.627 158.973 211.926 158.484 211.084 157.018C209.682 154.644 208.349 152.27 206.947 149.897C206.526 149.129 206.105 148.361 205.614 147.593C205.404 147.244 206.175 145.917 206.245 145.568C206.456 144.94 207.157 143.753 207.017 143.055C206.736 141.938 206.526 140.821 206.245 139.634C206.105 138.866 205.474 137.54 205.614 136.702C205.684 136.213 206.245 135.515 206.456 135.096C207.788 132.722 209.121 130.349 210.453 127.975C211.365 126.299 212.487 125.811 214.1 124.833C214.941 124.345 215.292 124.275 215.432 123.297C215.642 122.041 215.783 120.784 215.993 119.527C216.204 118.061 219.219 117.782 219.78 116.316C220.201 115.339 220.341 113.872 221.393 113.593C221.673 113.523 222.375 114.92 223.216 114.71C223.567 114.64 224.408 114.291 224.759 114.431C224.969 114.571 225.671 115.059 225.881 114.989C226.653 114.501 227.494 113.942 228.336 113.523C229.878 112.825 231.772 112.127 233.455 111.918C233.876 111.848 234.577 111.638 234.998 111.778C235.348 111.918 235.909 112.197 236.26 112.197C236.681 112.197 237.102 111.708 237.522 111.638C237.873 111.569 238.294 111.708 238.644 111.708C239.766 111.778 240.538 111.987 241.52 111.359C242.291 110.87 243.062 111.499 243.834 111.848C243.203 113.174 243.133 113.244 243.764 114.501C244.114 115.059 242.852 115.967 242.431 116.386C243.062 116.944 243.904 118.061 244.675 118.271C246.078 118.62 247.48 119.039 248.883 119.388C249.935 119.667 249.654 120.854 250.706 121.343C251.618 121.761 252.53 121.622 253.371 122.18C254.633 123.018 255.265 123.228 256.036 121.692C256.246 121.343 255.615 120.784 255.826 120.435C255.966 120.156 256.316 119.318 256.597 119.178C257.929 118.759 258.631 118.55 260.033 118.969C260.314 119.039 260.033 119.667 260.454 119.737C261.085 119.876 261.716 120.016 262.348 120.156C262.838 120.226 262.909 120.505 263.119 120.994C263.259 121.273 263.75 120.644 263.96 120.714C264.942 120.994 265.994 121.343 266.976 121.622C268.098 121.971 268.238 121.971 269.29 121.412C270.482 120.854 270.552 120.644 271.745 121.203C273.147 121.901 275.251 121.692 275.882 119.946C276.233 118.829 278.196 115.478 277.425 114.361C276.934 113.663 277.986 112.127 277.776 111.918C277.495 111.638 277.074 112.127 276.864 112.267C276.583 112.476 276.163 111.918 275.882 111.987C275.461 112.057 275.181 112.895 274.83 113.035C274.48 113.174 273.778 113.104 273.428 113.104C272.516 113.104 272.165 112.197 271.394 112.057C270.833 111.987 270.412 111.638 270.202 112.267C269.991 112.965 269.991 112.965 269.29 113.035C268.589 113.174 267.537 112.267 266.976 111.918C265.994 111.359 264.241 108.427 265.293 107.24C264.942 107.31 264.592 107.31 264.241 107.38C264.101 106.193 265.643 105.844 266.275 105.844C267.537 105.774 268.168 105.774 269.29 105.146C268.939 105.006 268.589 104.797 268.238 104.657C268.449 104.098 269.711 104.308 270.272 104.378C271.324 104.517 271.394 104.238 272.236 103.68C272.797 103.33 273.568 102.772 274.199 102.842C275.041 102.912 275.812 103.051 276.654 102.772C276.443 103.121 276.794 103.4 277.144 103.61C277.705 103.889 277.495 103.121 278.056 103.959C278.266 104.238 279.879 104.517 280.37 104.727C281.212 105.076 281.773 104.587 282.614 104.657C283.596 104.797 284.297 104.378 285.139 103.889C285.84 103.47 285.419 102.213 284.999 101.725C284.368 101.027 283.596 100.887 282.965 100.259C282.264 99.5605 281.703 98.7227 280.721 98.583C280.651 98.583 279.879 98.0943 279.739 98.0245C279.388 97.7453 278.968 97.466 278.617 97.1868C278.687 97.1169 278.898 96.7679 278.898 96.7679C279.248 96.8377 279.599 96.9075 279.95 96.9773C279.599 95.8603 280.37 95.5112 281.212 95.5112C280.791 95.1621 280.3 94.8829 280.09 94.3942C280.44 94.3942 280.791 94.3942 281.142 94.3942C280.861 93.5564 281.913 94.1847 282.123 93.696C282.334 93.1375 281.422 93.347 281.212 93.4168C280.3 93.5564 279.388 93.5564 278.757 94.3942C278.757 94.3244 278.757 94.1847 278.757 94.1149C277.776 94.3244 277.355 94.5338 276.654 95.2319C276.724 95.0923 276.794 94.9527 276.864 94.8829C275.882 94.7432 276.303 95.9999 276.724 96.4886C277.215 97.1169 278.056 96.7679 278.898 96.7679C278.337 97.8151 277.635 97.0471 277.004 97.3962C276.303 97.7453 275.041 98.9321 274.269 98.3736C274.69 97.1169 274.129 97.2566 273.077 96.7679C273.568 96.4886 275.531 95.7905 274.199 95.3018C273.778 95.1621 273.287 95.3018 272.867 95.3018C272.586 95.3018 272.095 94.8131 271.885 94.6734C272.446 94.7433 273.147 95.0225 273.428 94.3942C272.867 94.6734 271.324 93.9753 270.973 94.3942C270.552 94.8131 269.43 95.7206 269.36 96.2792C269.29 96.6282 269.29 97.3962 269.15 97.7453C268.939 98.0245 268.168 97.9547 268.098 98.3038C267.888 99.351 267.958 100.189 267.046 100.747C266.204 101.306 266.415 102.283 266.766 103.121C267.046 103.61 268.378 104.238 268.308 104.517C268.098 105.215 266.836 104.308 266.345 104.727C265.643 105.355 265.012 105.983 264.311 106.612C264.241 105.914 264.662 105.774 265.153 105.425C264.732 105.285 264.311 105.285 263.89 105.076C263.189 104.797 262.768 105.006 262.137 104.797C261.857 104.727 261.436 105.006 261.155 105.076C260.875 105.146 261.296 105.704 261.085 105.844C260.524 106.332 260.174 105.914 259.683 105.565C259.192 106.123 259.753 106.682 260.033 107.24C260.524 108.078 260.524 107.938 259.893 108.636C260.735 109.195 261.646 109.404 261.506 110.661C261.015 110.242 260.664 109.823 260.103 110.452C260.735 110.591 260.805 111.01 260.384 111.359C259.893 111.778 260.103 111.987 260.314 112.616C259.753 112.476 259.332 112.616 259.051 112.057C258.841 111.569 258.561 111.708 258.14 112.057C257.719 110.591 257.368 110.452 258.561 109.474C257.509 109.474 257.509 109.334 256.807 108.357C256.457 107.799 256.176 106.891 255.685 106.472C254.844 105.774 255.124 105.215 255.265 104.098C255.335 103.051 254.984 103.051 254.213 102.423C253.161 101.585 251.969 100.398 250.636 100.259C250.286 100.189 249.514 99.2114 249.444 98.8623C249.163 97.8151 249.023 97.5358 248.252 96.9075C247.901 98.0245 247.48 97.466 247.34 96.6981C247.2 95.9301 247.34 96.1395 246.499 96.349C245.657 96.5584 245.166 96.6282 245.727 97.6057C245.938 97.9547 245.236 98.7227 245.867 99.1416C246.358 99.4906 247.13 99.9095 247.551 100.398C247.901 100.887 247.831 101.725 248.322 102.144C248.883 102.632 249.234 103.051 249.935 103.121C250.426 103.121 251.267 103.121 250.496 103.749C251.197 104.308 254.633 105.774 253.792 106.891C253.441 106.682 252.459 105.355 252.039 105.704C251.618 106.123 251.548 106.193 251.408 106.751C251.267 107.24 251.618 107.24 251.969 107.519C252.95 108.287 251.267 108.497 251.337 108.985C251.408 109.684 250.075 110.87 250.075 109.753C249.374 110.172 249.234 111.01 249.584 111.638C249.935 112.337 248.532 112.546 248.392 111.987C248.112 111.01 244.816 111.15 246.078 109.684C246.288 109.893 248.041 110.033 248.462 109.963C248.953 109.823 249.795 109.823 250.145 109.544C250.566 109.265 250.215 108.985 250.636 108.706C250.987 108.567 250.145 106.472 249.935 106.472C249.654 106.472 249.023 106.402 249.093 105.983C249.163 105.425 248.673 105.215 248.252 105.425C248.322 105.006 247.34 104.238 246.919 104.308C246.218 104.378 245.797 103.68 245.306 103.191C244.395 102.283 243.133 101.864 242.852 100.677C242.571 99.5605 242.571 99.4906 241.59 98.9321C241.099 98.6529 240.468 98.4434 240.117 98.9321C239.837 99.2812 237.242 101.166 236.891 101.027C236.05 100.747 235.138 100.468 234.296 100.189C233.876 100.049 233.174 100.957 232.824 101.306C232.684 101.445 233.174 102.772 232.824 103.261C232.473 103.68 231.351 104.029 230.86 104.238C229.458 104.936 229.037 106.123 228.195 107.519C227.915 107.938 229.037 108.357 228.476 109.055C228.125 109.474 227.284 110.172 227.564 110.731C227.284 110.801 226.512 110.87 226.372 111.15C226.232 111.429 225.881 112.197 225.601 112.197C224.689 112.267 223.847 112.267 222.936 112.197C222.164 112.127 221.673 113.104 221.042 113.314C220.481 113.523 219.429 112.267 220.131 111.778C219.429 112.127 219.079 110.94 218.237 111.429C217.536 111.848 217.045 111.219 216.414 111.708C216.484 111.219 216.624 110.731 216.624 110.172C216.624 109.893 216.554 109.614 216.554 109.334C216.554 109.055 216.204 109.404 216.133 109.265C215.572 108.427 215.993 108.287 216.203 107.38C216.414 106.472 217.045 105.146 216.694 104.308C216.344 103.54 216.554 102.632 216.694 101.795C216.204 102.213 215.853 101.445 216.063 100.957C216.274 100.538 217.185 100.538 217.466 100.468C217.396 100.398 217.396 100.259 217.326 100.189C218.167 99.4208 218.588 100.468 219.289 100.259C220.341 99.9793 220.692 99.9095 221.744 100.259C222.515 100.538 223.216 100.119 223.918 100.398C224.408 100.608 225.39 100.747 225.881 100.608C227.284 100.328 227.073 97.6056 227.073 96.4886C227.073 95.4414 227.214 95.0923 226.232 94.8131C225.671 94.6036 225.601 93.6262 225.671 93.2772C225.11 93.4168 225.32 93.0677 225.11 92.9979C224.899 92.8583 224.268 92.8583 224.128 92.7884C223.707 92.4394 223.567 92.2299 223.006 92.2997C222.655 92.2997 222.375 92.2997 222.164 91.8809C222.305 91.8809 222.445 91.7412 222.585 91.7412C222.234 91.6016 222.024 91.3223 222.024 90.9035C222.655 90.8336 223.286 90.9733 223.777 90.6242C224.829 89.8562 224.268 91.2525 224.899 91.0431C225.18 90.9733 226.442 90.7638 226.442 90.4147C226.372 89.7864 226.162 89.3675 225.881 88.7392C226.162 88.7392 226.653 88.6694 226.793 88.9486C226.933 89.3675 226.863 89.4373 227.284 89.4373C228.055 89.5072 228.406 89.5072 229.177 89.1581C228.967 89.1581 228.826 89.0185 228.616 89.0185C229.037 88.4599 229.738 88.2505 230.299 88.0411C231.141 87.6222 230.229 87.1335 230.65 86.4353C230.86 86.1561 232.122 85.8768 232.473 85.6674C233.104 85.3881 233.525 85.3881 234.226 85.4579C234.016 85.3881 233.315 85.3183 233.315 85.039C233.315 84.9692 233.946 84.8994 234.016 84.8296C234.156 84.69 234.016 84.4107 234.156 84.2711C234.577 83.7125 234.647 83.3635 234.857 82.5955C234.928 82.2464 235.489 82.3163 235.699 82.037C236.47 81.1294 237.172 81.6879 238.013 81.4087C238.153 81.3389 238.013 80.92 238.224 80.92C238.434 80.92 238.714 80.8502 238.925 80.7803C239.275 80.7105 239.696 80.8502 240.047 80.92C239.907 80.2218 240.468 80.4313 240.959 80.3615C240.678 80.2916 239.977 79.6633 240.327 79.384C240.888 78.8953 240.398 78.9652 240.187 78.3368C239.977 77.7085 240.398 77.3594 239.837 76.8707C239.416 76.5217 239.486 76.2424 239.486 75.6839C239.416 74.7065 239.626 73.5894 240.678 73.5196C241.449 73.5196 242.151 72.612 242.922 72.263C242.361 73.0309 242.081 74.7065 243.273 74.9857C242.571 76.033 241.309 76.4518 241.52 77.8481C241.73 78.8953 242.712 79.8029 243.694 79.3142C243.553 79.5935 243.413 79.8727 243.273 80.152C244.255 80.7105 245.026 79.3142 245.867 79.2444C246.148 79.1746 246.99 79.7331 247.06 80.0124C247.2 80.5709 247.691 80.7105 248.182 80.9898C248.252 80.8502 248.252 80.6407 248.252 80.4313C247.971 80.4313 247.691 80.3615 247.48 80.3615C248.041 80.0124 250.145 79.9426 250.566 79.384C251.197 78.4765 253.161 77.9878 254.072 78.7557C254.002 78.6859 253.652 78.6161 253.511 78.4765C253.511 79.384 254.774 79.5237 255.194 78.9652C255.405 78.7557 255.475 78.1972 255.545 78.1274C255.685 78.0576 255.896 78.1274 256.036 77.9878C256.317 77.7085 256.737 77.5689 256.948 77.2198C256.878 77.5689 256.597 77.7783 256.387 78.0576C257.929 78.8255 257.018 76.033 256.948 75.3348C256.948 74.7763 257.088 74.3574 257.439 73.9385C257.789 73.5196 257.509 72.9611 258 72.5422C259.332 71.5648 259.683 73.7291 260.664 73.7989C261.225 73.8687 261.646 73.0309 261.506 72.5422C261.436 72.1932 261.716 70.9365 261.646 70.8667C261.506 70.727 261.225 71.0761 261.085 71.0063C260.875 70.8667 260.664 70.5874 260.454 70.378C260.314 70.2383 260.033 69.0515 260.174 68.9817C261.155 68.5628 262.277 67.9345 263.329 68.0741C264.101 68.1439 264.872 68.2835 265.643 68.3533C266.695 68.493 265.784 68.0741 266.415 67.6552C266.836 67.3759 267.397 67.5854 267.888 67.2363C268.238 67.0269 269.01 67.3061 269.36 67.3759C269.15 66.6778 267.677 66.3985 267.116 66.1193C267.256 65.9797 267.256 65.7004 267.327 65.5608C265.153 65.9797 262.909 66.5382 260.664 66.9571C260.454 67.0269 259.542 67.3061 259.402 67.0967C258.981 66.3985 258.841 66.2589 258.14 65.9797C257.298 65.6306 257.368 65.7004 257.509 64.723C257.649 64.0248 257.649 63.7456 257.509 63.0474C257.368 62.5587 256.878 61.5115 257.018 61.0228C257.088 60.6039 258 59.9058 258.28 59.5567C258.981 58.7189 259.963 58.2302 260.594 57.3925C260.945 56.9736 261.506 55.9962 261.927 55.7169C262.347 55.5075 263.049 55.9264 262.768 55.0886C262.488 53.9716 261.646 53.4828 260.524 53.413C258.981 53.3432 258.911 53.2734 257.859 54.4603C257.158 55.2282 256.807 55.7867 257.368 56.7641C257.859 57.6019 253.722 59.7662 253.441 60.185C252.389 61.4417 250.706 63.5361 251.758 65.4211C252.249 66.2589 253.582 66.1891 254.002 67.1665C254.283 67.8646 253.161 68.4232 252.67 68.842C251.828 69.61 251.127 69.8893 250.987 71.0063C250.847 71.9139 250.917 73.3102 250.496 74.148C250.005 75.3348 249.093 75.3348 248.112 75.5442C247.691 75.6141 247.761 76.1028 247.621 76.5217C247.48 77.0104 247.2 76.8707 246.709 76.8707C246.008 76.9405 245.938 77.0802 245.797 76.3122C245.727 75.8933 245.517 75.265 245.657 74.8461C245.938 74.0083 244.745 73.0309 244.255 72.4026C244.044 72.1233 244.184 71.6346 244.044 71.2856C243.834 70.8667 243.483 70.4478 243.413 69.9591C243.343 69.5402 243.694 68.7722 243.203 68.7024C242.782 68.6326 242.712 67.9345 242.571 67.5156C242.291 68.6326 242.081 68.7722 241.169 69.4006C240.538 69.8195 240.047 70.5176 239.416 70.9365C238.434 71.5648 235.909 71.2158 235.909 69.6798C235.839 67.7948 235.138 65.9797 235.208 64.1645C235.278 62.5587 235.418 62.5587 236.541 61.5813C237.172 61.0228 237.873 60.7436 238.644 60.3247C239.556 59.9058 240.327 59.6265 241.029 58.7888C241.66 58.0906 242.291 57.4623 242.992 56.7641C244.465 55.3678 245.096 53.6923 246.148 51.9469C247.2 50.2714 248.532 49.0147 249.865 47.6184C251.127 46.2221 252.249 44.6862 253.932 43.9183C255.826 43.0805 257.649 42.4522 259.613 41.8238C260.384 41.6144 260.735 40.4275 261.436 40.0086C262.067 39.5898 263.049 39.5199 263.82 39.5898C262.909 40.5672 262.488 41.0559 262.137 42.3823C262.979 42.2427 263.75 40.7766 264.241 40.1483C264.311 40.5672 264.381 40.986 264.521 41.4049C264.942 40.9162 265.293 40.3577 265.643 39.869C265.784 39.6596 266.766 39.869 267.046 39.869C266.836 40.2879 266.555 40.637 266.345 41.0559C267.327 41.8238 266.766 39.9388 267.607 40.2879C268.449 40.637 269.36 40.986 270.202 41.3351C270.903 41.6144 269.571 42.3125 269.29 42.3823C268.659 42.522 267.817 42.2427 267.186 42.1729C267.537 42.8012 268.168 42.522 268.449 43.2201C268.519 43.3597 269.43 43.1503 269.711 43.1503C270.482 43.2201 271.184 43.5692 271.674 42.871C271.885 42.522 272.797 43.2201 273.147 43.4296C272.937 44.1277 272.306 43.7088 271.815 43.5692C271.604 44.9655 274.059 44.4768 274.76 44.4768C276.163 44.5466 276.794 44.8957 278.056 45.5938C279.248 46.2221 280.23 46.8505 281.492 47.1995C282.474 47.4788 283.666 48.1071 284.017 49.2242C284.368 50.2714 284.297 50.2714 283.736 51.179C283.386 51.7375 283.246 52.0866 282.614 52.296C281.212 52.7149 280.791 52.7847 279.459 52.5054C276.934 51.8771 274.83 51.3186 272.446 50.1318C273.147 50.8299 275.111 52.1564 275.111 53.1338C275.111 54.181 274.9 56.2754 275.882 56.6943C276.934 57.183 278.337 58.3699 279.388 57.951C280.02 57.6717 279.669 56.6943 279.038 56.6943C278.407 56.6943 278.126 56.1358 277.705 55.5773C278.687 54.6697 278.757 54.8791 279.95 55.298C280.931 55.6471 281.913 55.9962 282.895 56.3452C282.825 56.066 282.053 54.181 282.123 54.1112C282.895 53.6225 283.596 53.1338 284.297 52.6451C284.648 52.3658 285.419 51.6677 285.84 51.8073C286.612 52.0167 287.383 52.296 288.154 52.5054C288.225 52.0866 288.645 51.2488 288.435 50.8299C288.365 50.6903 287.664 49.5034 287.593 49.643C287.804 48.9449 287.944 48.2468 288.084 47.4788C288.154 47.1995 287.313 46.5014 287.173 46.2221C288.084 46.3618 289.066 46.4316 289.978 46.5712C290.679 46.641 291.17 47.7581 291.591 48.3166C291.1 48.3864 289.767 48.2468 289.487 48.6656C289.066 49.3638 289.838 49.8525 290.258 50.411C290.749 51.0393 291.45 50.6205 292.222 50.5506C293.134 50.411 292.502 49.7827 292.923 49.1543C293.134 48.8751 293.975 48.6656 294.256 48.526C295.097 48.1769 295.939 47.7581 296.78 47.3392C298.113 46.7807 299.375 46.1523 300.637 45.5938C300.988 46.7807 300.988 46.7807 302.11 47.0599C302.881 47.2694 303.232 45.8731 303.863 45.9429C304.845 46.0825 305.406 46.2221 306.247 45.8032C307.229 45.3145 307.51 45.3844 308.632 45.5938C308.491 45.8731 308.281 46.1523 308.141 46.4316C309.333 46.7807 309.263 46.8505 310.104 45.8032C310.806 44.8258 310.385 44.756 309.614 43.7786C311.297 43.0805 313.751 43.2899 315.434 43.9881C316.626 44.4768 317.748 44.8957 318.94 45.3844C319.782 45.7334 320.624 46.641 321.325 47.1995C321.395 46.7807 321.816 45.3145 321.465 45.0353C320.624 44.407 319.782 43.7786 318.87 43.1503C318.309 42.7314 319.221 41.5446 319.431 40.986C319.642 40.4973 318.309 40.0086 317.959 39.7294C318.8 39.1011 319.642 38.4029 320.483 37.7048C321.044 37.2161 321.325 35.6103 321.535 34.9122C321.886 34.0046 325.883 34.982 326.795 35.0518C326.444 36.0292 326.094 37.0066 325.743 37.984C325.533 38.4727 326.444 39.6596 326.655 40.1483C327.075 40.986 325.673 44.8258 326.374 45.3145C327.216 45.8731 328.127 45.9429 327.706 46.9901C327.426 47.5486 327.145 48.9449 326.655 49.2242C325.743 49.7827 324.831 50.3412 323.92 50.8997C323.499 51.179 322.307 50.6903 321.816 50.6903C323.008 51.6677 324.27 52.4356 325.883 51.9469C327.145 51.528 328.478 49.8525 329.39 48.8751C330.441 47.8279 327.777 46.292 329.951 45.5938C330.371 45.4542 331.563 44.8258 331.844 45.2447C332.405 45.8731 332.966 46.5014 333.527 47.1297C333.387 46.292 333.527 45.524 332.826 45.0353C331.914 44.407 331.844 44.407 330.792 44.5466C330.512 44.6164 328.408 45.0353 328.338 44.8258C328.197 44.2673 327.636 43.2201 327.917 42.6616C328.267 41.9634 329.039 41.0559 328.548 40.3577C328.197 39.7992 327.005 38.752 327.426 38.1236C327.917 37.2859 328.688 37.2161 329.53 36.867C330.161 36.5877 329.6 35.1914 329.46 34.7725C329.951 34.6329 330.792 35.8896 330.582 36.3783C329.951 37.5651 330.021 37.5651 330.652 38.752C331.073 39.5898 334.439 39.5898 335.28 39.6596C334.088 39.2407 332.896 38.752 331.704 38.1935C330.371 37.5651 332.686 36.5877 333.247 36.3783C334.859 35.8896 335.561 36.2387 337.174 36.867C337.665 37.0764 338.085 37.4255 338.576 37.7048C338.997 37.984 339.628 37.7048 340.119 37.6349C339.979 37.2161 339.768 36.1688 339.488 35.8896C339.207 35.6103 338.015 35.6103 337.594 35.5405C337.033 35.4707 336.963 33.0272 336.823 32.4687C338.646 32.2592 340.47 32.1196 342.293 31.9102C343.345 31.8403 344.327 31.7007 345.379 31.6309C346.08 31.5611 345.799 30.8629 345.799 30.1648C345.87 28.8383 345.729 28.8383 346.781 28.21C347.553 27.7911 348.324 27.1628 349.095 26.8137C350.778 26.1854 352.812 26.1155 354.565 25.7665C357.861 25.1381 361.087 24.7891 364.313 23.5324C365.084 23.2532 364.734 22.0663 365.295 21.7172C366.207 21.2285 367.188 20.7398 368.1 20.2511C369.222 19.6926 371.256 19.6926 372.097 20.8795C371.186 21.1587 370.344 21.438 369.432 21.7172C370.835 21.9267 372.237 22.1361 373.64 22.3456C373.079 22.8343 372.448 23.323 371.887 23.8815C372.658 23.9513 373.43 23.9513 374.201 24.0211C374.201 23.7419 374.061 22.555 374.341 22.555C374.972 22.555 375.534 22.6248 376.165 22.6248C377.076 22.6248 378.058 22.4852 378.9 22.9739C379.671 23.5324 381.003 24.0909 381.635 24.8589C381.775 25.0683 382.546 25.8363 382.476 26.0457C382.336 26.325 382.125 27.2326 381.845 27.3722C378.058 29.6761 374.341 31.98 370.554 34.2838C373.149 33.5159 375.744 32.8177 378.409 32.0498C377.707 31.98 377.076 31.8403 376.375 31.7705C377.146 31.0724 378.409 30.444 379.391 31.1422C380.793 32.1894 381.144 32.1196 382.897 31.98C385.141 31.7705 387.455 32.2592 389.629 32.4687C389.208 32.7479 388.788 32.9574 388.367 33.2366C388.928 33.5159 389.91 34.2838 390.471 34.214C391.382 34.1442 392.294 34.1442 393.135 34.0744C393.697 34.0744 395.169 34.2839 395.239 33.6555C395.45 32.2592 395.31 32.329 396.502 32.329C397.343 32.329 398.255 32.3989 399.096 32.2592C399.728 32.1196 400.99 31.5611 401.621 31.7705C402.182 31.98 403.024 33.3763 403.444 33.865C403.725 34.1442 403.094 35.8198 403.094 36.2387C403.094 36.5877 403.164 38.6124 403.374 38.752C404.216 39.2407 404.987 39.6596 405.829 40.1483C406.179 40.3577 407.301 38.5425 407.512 38.1935C408.213 37.2859 408.073 37.1462 409.055 37.7746C410.036 38.4029 410.247 38.6822 411.299 38.4029C412 38.1935 412.841 37.7048 413.473 37.984C413.963 38.2633 415.085 39.1011 415.576 38.8916C416.418 38.5425 417.259 38.1935 418.101 37.8444C417.891 37.4255 417.049 36.5179 417.4 36.099C417.61 35.75 418.382 34.3537 418.802 34.4235C420.415 34.6329 422.028 34.8424 423.641 35.0518C424.833 35.1914 426.096 35.6801 427.288 35.9594C428.55 36.3085 430.373 36.3783 431.495 37.0764C432.197 37.4953 433.81 40.0785 434.581 40.0086C436.194 39.7294 437.807 39.4501 439.42 39.1709C440.752 38.9614 442.014 39.5898 443.277 39.9388C444.048 40.1483 444.399 40.0785 444.679 40.8464C444.96 41.754 444.89 41.8936 444.609 42.8012C445.942 43.2201 446.994 43.7786 448.396 43.4994C450.009 43.2201 451.061 43.1503 452.674 43.4296C453.235 43.4994 454.076 43.8484 454.567 43.4994C455.339 42.871 455.269 42.871 455.97 43.5692C456.461 44.0579 457.232 45.1051 457.863 45.3844C458.354 45.5938 459.266 45.2447 459.757 45.1749C459.617 44.1277 459.476 43.0107 459.336 41.9634C461.65 42.1729 463.964 42.3125 466.279 42.522C468.102 42.6616 469.855 43.9183 471.468 44.6862C473.362 45.5938 475.185 46.5712 477.008 47.6184C478.13 48.2468 478.27 48.3166 478.761 49.643C479.322 51.1092 479.112 51.528 480.585 51.528C480.444 50.9695 480.234 50.3412 480.094 49.7827C481.426 49.7827 482.338 49.8525 483.6 50.3412C484.512 50.6903 485.423 51.7375 486.195 52.3658C485.704 52.7847 485.003 53.6225 484.442 53.7621C485.423 54.5999 484.512 54.2508 484.021 54.181ZM302.46 103.889C302.18 103.68 302.25 102.981 301.97 102.842C300.848 102.144 300.637 103.889 300.637 104.517C300.006 103.4 299.866 102.981 300.427 101.795C299.936 101.585 298.954 101.376 298.603 100.957C298.323 100.608 298.323 99.4208 298.253 99.0019C298.253 98.9321 296.71 98.3736 297.411 98.1642C298.113 98.0245 298.253 98.7925 298.954 98.3038C298.533 97.8849 298.042 97.8151 298.463 97.2566C298.674 96.9773 299.235 96.7679 299.515 96.8377C300.287 96.9773 301.549 96.9075 302.25 97.2566C301.759 97.466 301.268 98.0943 301.268 98.7227C301.759 98.0245 301.97 97.6057 302.811 97.466C302.39 96.1395 302.11 97.0471 300.988 96.6981C301.128 96.1395 301.549 95.4414 301.268 94.9527C301.128 94.7432 300.637 93.5564 300.216 94.0451C299.796 94.5338 299.164 94.0451 298.603 93.8357C298.183 93.696 297.481 94.3942 297.061 94.464C295.939 94.6734 296.009 94.1149 295.728 95.4414C295.658 95.7905 294.396 96.0697 294.045 96.2792C293.274 96.6282 293.344 96.6282 293.134 97.5358C293.063 97.9547 292.432 98.3736 292.152 98.6529C292.853 98.7227 293.624 99.2114 293.554 100.049C293.554 101.236 293.695 101.725 294.185 102.772C294.466 103.4 295.237 103.61 295.588 104.238C296.149 105.215 296.359 105.564 297.341 106.053C296.57 106.332 296.359 106.193 296.149 107.1C296.009 107.659 295.798 108.148 295.588 108.706C295.307 109.334 295.448 109.753 295.448 110.452C295.518 111.219 295.728 111.08 296.43 111.219C297.061 111.359 297.061 111.848 297.552 111.987C298.113 112.197 298.744 112.337 299.305 112.546C300.076 112.755 301.409 112.267 302.18 112.197C302.11 111.219 301.899 110.312 302.04 109.404C302.32 107.938 301.689 108.636 301.128 107.589C301.268 107.659 301.479 107.589 301.689 107.659C301.619 107.45 301.549 106.961 301.409 106.751C301.268 106.612 300.777 106.821 300.637 106.612C300.216 106.123 300.497 105.634 300.707 105.215C300.637 105.285 302.881 105.564 303.302 105.355C303.442 104.447 302.881 104.238 302.46 103.889ZM72.6522 23.3928C73.2132 23.5324 73.9847 23.8815 74.5457 23.4626C74.4054 23.323 74.2652 23.1833 74.1249 23.1135C73.5639 23.1135 73.0029 22.9739 72.6522 23.3928ZM122.373 142.008C122.934 142.357 123.284 142.636 123.916 142.845C124.196 142.915 124.617 142.427 125.178 142.636C125.038 142.496 124.967 142.287 124.827 142.147C124.196 141.868 122.934 141.17 122.373 142.008ZM117.604 96.349C117.534 96.4188 117.464 96.4886 117.394 96.5584L117.534 96.6282C117.744 96.349 117.885 96.2094 117.744 95.9301C117.674 95.9999 117.604 96.0697 117.604 96.1395C117.464 95.7206 117.113 95.6508 116.763 95.7905C116.272 95.9999 116.131 95.5112 115.64 95.8603C115.781 95.8603 115.921 95.9301 115.991 95.9301C116.482 96.1395 117.113 96.6282 117.604 96.349ZM114.869 95.2319C114.589 95.0225 114.518 95.1621 114.448 95.2319C114.518 95.3018 114.659 95.4414 114.729 95.5112C114.799 95.4414 114.799 95.3716 114.869 95.2319ZM115.5 95.9301C115.5 95.8603 115.5 95.7905 115.5 95.7207C115.36 95.6508 115.29 95.581 115.079 95.5112C115.009 95.581 114.869 95.6508 114.799 95.7207C115.009 95.8603 115.29 95.8603 115.5 95.9301ZM152.948 86.0863C153.159 85.6674 153.299 85.3183 153.509 84.8994C152.387 84.4107 151.195 85.9466 150.774 86.9938C150.073 88.6694 149.442 89.4373 148.25 90.694C148.039 90.9034 147.899 92.1601 148.11 92.4394C148.39 92.8583 149.372 92.7186 149.793 92.7186C151.055 92.579 152.387 92.579 153.58 93.2073C153.159 93.347 152.878 93.6262 152.878 94.1149C154 93.9055 154.281 93.0677 155.403 92.9979C155.263 93.8357 155.122 93.9055 155.894 94.1847C156.525 94.464 156.665 94.464 157.016 93.9055C157.437 93.2771 156.946 91.811 156.805 91.1129C156.735 90.694 155.894 90.4846 155.964 90.2053C156.104 89.4373 155.964 89.4373 155.473 88.8788C155.122 88.4599 153.509 89.0185 153.018 89.1581C153.018 88.8788 153.089 88.2505 152.808 88.1109C152.598 88.0411 152.107 87.9014 152.107 87.6222C152.037 86.7146 152.317 86.6448 152.948 86.0863ZM137.59 142.357C137.941 143.125 139.273 142.496 139.624 142.008C139.554 141.938 139.484 141.868 139.414 141.798C138.712 141.728 137.1 141.17 137.59 142.357ZM126.3 139.564C126.861 139.425 127.422 139.215 127.983 139.075C127.562 138.726 127.212 138.377 126.651 138.308C126.23 138.238 126.019 137.679 125.879 137.679C125.108 137.749 124.196 137.26 123.635 136.632C123.635 136.702 123.565 136.772 123.565 136.841C121.952 135.794 120.199 134.817 118.305 134.607C117.183 134.468 116.342 134.747 115.22 135.026C114.308 135.236 114.098 136.073 113.396 136.562C114.799 137.33 116.412 134.119 117.814 135.585C117.604 135.724 117.464 135.794 117.113 135.724C117.324 136.004 117.744 136.213 118.095 136.073C118.516 135.934 118.586 136.283 119.007 136.283C119.778 136.283 120.479 136.841 121.321 136.981C122.092 137.051 122.092 137.958 122.934 138.377C123.144 138.447 123.986 138.238 123.986 138.866C123.986 139.075 123.284 139.564 123.144 139.704C124.196 139.704 125.248 139.425 126.3 139.564ZM141.728 93.696C141.097 94.8829 142.219 95.0923 143.06 95.5112C143.902 95.8603 144.112 95.4414 144.673 94.8131C143.832 94.7433 142.99 94.6734 142.079 94.6036C141.938 94.3244 141.798 93.9753 141.728 93.696ZM141.167 88.3203C142.008 89.0185 143.972 90.6242 145.024 89.7864C144.042 88.6694 142.499 88.3203 141.167 88.3203ZM180.999 179.777C181.42 181.593 181.42 181.523 180.438 182.919C179.246 184.664 178.054 186.41 176.792 188.155C176.231 188.993 175.529 189.621 175.459 190.668C175.249 193.252 175.109 195.765 174.898 198.348C174.758 200.024 173.005 201.769 172.163 203.165C171.813 203.724 171.462 204.701 170.761 204.771C170.06 204.841 168.587 204.562 167.956 204.98C166.273 206.167 164.59 207.284 162.836 208.471C162.486 208.681 162.486 211.264 162.486 211.683C162.416 212.241 162.486 213.149 162.205 213.568C160.803 215.383 159.4 217.198 157.998 218.943C156.735 220.619 155.403 222.225 154.141 223.9C153.86 224.249 149.793 222.504 149.161 222.364C148.811 223.761 151.125 223.9 151.335 225.087C151.476 225.646 151.896 226.832 151.826 227.391C151.756 227.949 150.915 228.648 150.634 229.136C149.793 230.393 148.671 230.323 147.268 230.742C145.936 231.091 145.304 231.091 143.972 230.812C144.253 231.65 144.463 231.999 144.112 232.836C143.902 233.325 144.182 234.163 143.902 234.372C142.569 235.28 141.798 234.931 140.396 234.233C140.396 234.931 140.185 235.838 140.325 236.537C140.466 237.025 141.237 237.863 141.027 238.352C140.606 239.259 140.185 240.167 139.764 241.075C139.344 241.982 139.203 241.912 138.222 242.122C137.38 242.331 137.24 243.029 136.819 243.797C136.539 244.286 137.59 245.194 137.871 245.612C138.222 246.171 139.484 245.682 139.203 246.52C138.923 247.358 138.783 247.707 138.292 248.335C137.801 248.894 137.1 249.452 136.889 250.22C136.539 251.337 136.258 251.407 135.276 251.966C134.294 252.524 135.416 255.387 135.557 256.504C135.627 256.922 135.627 257.83 135.907 258.039C136.609 258.668 137.31 259.296 138.081 259.855C139.344 260.902 140.185 260.762 141.798 260.762C140.325 261.391 138.853 262.089 137.45 262.717C136.258 263.276 136.048 262.927 134.855 262.368C133.102 261.53 131.419 260.692 129.736 259.924C128.824 259.506 128.684 258.528 128.334 257.551C127.352 255.317 125.809 253.083 126.089 250.569C126.51 246.799 126.931 243.029 127.352 239.329C127.773 235.699 127.913 231.929 128.614 228.368C129.456 223.9 130.297 219.362 131.209 214.894C131.7 212.171 132.261 209.449 132.752 206.726C132.962 205.539 133.383 204.282 133.453 203.095C133.523 202.118 133.172 200.931 133.032 199.954C132.962 199.325 133.032 197.72 132.681 197.161C132.331 196.603 131.069 196.044 130.578 195.695C129.526 194.997 128.474 194.229 127.422 193.461C126.37 192.693 126.019 191.995 125.388 190.738C124.056 188.295 122.793 185.851 121.461 183.478C120.409 181.453 119.287 179.498 118.235 177.473C117.604 176.217 118.726 173.983 119.007 172.656C119.147 172.028 119.217 170.562 119.638 170.073C120.269 169.305 120.83 168.467 121.461 167.699C122.864 165.954 123.986 164.907 123.635 162.463C123.565 161.905 123.214 161.626 123.635 161.207C123.705 161.137 123.495 160.369 123.565 160.09C123.705 159.322 122.092 158.624 122.232 157.925C122.443 157.018 122.443 157.157 121.671 156.739C121.11 156.459 121.11 156.459 120.62 156.739C120.199 156.948 119.918 157.297 119.568 157.646C119.357 157.856 119.918 158.484 120.059 158.693C119.007 159.112 119.077 159.252 118.586 158.135C118.375 158.763 117.324 157.716 116.692 157.576C116.412 157.507 116.201 157.856 115.991 157.716C115.64 157.507 115.36 157.227 115.009 156.948C114.378 156.459 113.046 155.831 112.555 155.133C112.134 154.505 112.344 153.597 111.854 153.038C110.591 151.572 109.82 150.316 108.067 149.827C106.734 149.478 104.49 149.338 103.368 148.291C102.456 147.383 101.475 146.476 100.563 145.498C99.9319 144.87 99.0903 145.498 98.3189 145.778C96.6359 146.266 94.9528 145.08 93.3399 144.451C92.0776 143.963 90.7452 143.404 89.4829 142.915C89.0621 142.776 88.2907 142.636 88.0102 142.287C87.1687 141.449 86.3271 140.611 85.4856 139.774C84.7142 139.006 85.2051 138.517 85.4856 137.47C85.696 136.772 84.3635 135.375 84.0129 134.817C83.5921 134.188 83.2415 133.77 82.6805 133.211C81.7688 132.373 80.8572 131.536 80.0156 130.698C79.8053 130.488 80.0858 129.93 80.0858 129.651C80.1559 129.371 79.665 128.952 79.5247 128.743C78.8936 127.905 78.3326 127.207 77.5612 126.579C76.8599 126.09 76.1586 125.741 75.8781 124.903C75.7378 124.414 75.3872 122.111 74.9664 121.901C74.1249 121.552 73.2834 121.133 72.4418 120.784C72.7224 121.692 72.9327 123.577 73.4938 124.275C74.4054 125.322 75.1768 126.23 75.7378 127.556C76.0184 128.324 76.2287 128.533 76.8599 129.022C77.2807 129.441 77.4209 130 77.6313 130.628C77.8417 131.256 78.1222 131.815 78.1923 132.443C78.2624 133.49 78.6832 132.722 78.9637 132.932C79.3144 133.211 79.9455 133.77 79.8754 134.328C79.8053 135.026 79.1741 135.166 78.8936 134.677C78.2624 133.56 77.2105 132.932 76.2287 132.234C75.9482 132.024 76.0885 130.768 76.0184 130.418C75.9482 129.86 75.1768 129.511 74.8262 129.162C74.4755 128.883 74.1249 129.022 73.7041 128.673C73.2132 128.254 72.7925 127.835 72.3016 127.416C72.8626 127.347 74.1249 127.207 73.4236 126.16C72.7925 125.252 72.512 124.764 71.5302 124.275C70.899 123.996 70.7588 122.948 70.4783 122.25C70.0575 121.133 69.5666 120.016 69.1459 118.829C68.655 117.573 67.042 116.525 65.8499 116.176C64.8681 115.897 64.5174 115.967 64.0967 115.059C63.6058 114.012 63.1149 112.965 62.6941 111.987C61.9928 110.452 60.5903 109.544 60.0994 107.868C59.4682 105.704 59.5384 104.308 59.6085 102.004C59.6786 100.119 59.8189 98.234 59.889 96.2792C59.9591 94.464 59.5384 93.2772 58.9773 91.5318C60.0293 91.811 61.0812 92.0903 62.063 92.5092C62.1331 90.9733 62.2032 90.7638 61.1513 89.7166C60.3799 88.8788 59.6786 88.3901 58.767 87.7618C57.9956 87.2033 57.154 87.2033 56.3125 86.8542C54.9099 86.2259 54.6996 86.2259 54.0684 84.7598C53.3671 83.0842 50.8425 82.1766 50.9828 80.2916C51.123 78.5463 50.9828 78.6859 49.6504 77.8481C49.44 77.7085 48.5985 79.5237 48.0374 78.6859C47.6167 77.9878 46.9154 76.3122 46.2141 75.9631C45.2323 75.4744 45.0219 75.265 44.4609 74.3574C43.8298 73.4498 43.2688 72.1932 42.5675 71.495C41.9363 70.8667 41.0247 70.4478 40.3234 69.9591C38.5702 68.7722 37.0975 68.1439 35.1339 67.4458C34.3625 67.1665 33.4509 67.7948 32.6795 67.6552C31.8379 67.4458 30.9263 66.608 30.225 66.1193C29.2432 65.491 28.9627 65.2815 27.8407 65.4211C26.8589 65.491 26.368 65.7702 26.7186 67.0269C26.9991 68.0741 23.0019 69.1911 22.0902 69.4704C21.8798 68.9817 22.0902 68.7024 22.5811 68.5628C21.8798 68.3533 22.4408 66.3985 22.8616 66.1193C23.8434 65.5608 24.3343 65.5608 25.5265 65.5608C25.246 65.3513 25.0356 65.0721 24.7551 64.8626C25.0356 64.6532 25.3161 64.4437 25.6667 64.2343C23.8434 64.5834 23.1421 64.9324 21.5993 66.1193C20.2669 67.0967 19.776 68.2137 18.9345 69.6798C19.3552 69.7496 19.776 69.8893 20.1968 69.9591C18.9345 71.6346 17.7423 72.5422 16.0592 73.7291C15.2177 74.2876 12.6931 74.9857 12.5528 76.1726C12.4827 77.2896 9.11659 77.8481 8.13481 78.1274C7.71404 78.267 7.3634 78.267 6.94264 78.3368C6.45174 78.4066 6.66213 78.6859 6.31149 78.8953C5.46996 79.4539 4.90893 79.5935 4.0674 79.384C4.83881 78.6161 5.68034 78.4066 6.592 77.8481C7.29327 77.4292 9.25685 75.4744 9.888 76.5915C10.3088 75.8235 11.9217 74.0781 12.7632 74.6367C12.4827 73.7989 13.9554 73.3102 14.1658 72.4026C14.306 71.6346 14.306 71.4252 14.7969 70.9365C15.1476 70.5874 15.4281 70.4478 15.1476 69.9591C14.0255 70.5874 12.9035 71.495 11.7814 70.727C11.4308 70.4478 10.6594 69.61 10.1685 69.8195C9.60749 70.0987 9.04646 70.3082 8.48544 70.5874C8.27506 69.4704 8.06468 68.2835 7.92442 67.1665C7.64391 67.3061 6.17123 68.4232 5.96085 68.2137C5.39983 67.7948 4.34791 67.2363 3.99728 66.608C3.57651 65.9098 3.57651 64.5834 3.36613 63.8154C3.22587 63.1173 3.71676 62.6286 4.0674 62.07C4.69855 60.953 4.62842 60.6737 5.82059 60.8134C6.80238 60.8832 6.94264 60.1152 7.78417 59.7662C8.6257 59.4171 9.32698 60.1152 9.74774 59.068C10.0984 58.2302 9.60749 58.0906 8.97634 57.4623C9.25685 57.3227 9.46723 57.183 9.74774 57.0434C9.3971 55.9264 8.48544 56.9038 7.8543 57.2528C7.01276 57.7415 6.94264 57.183 6.1011 57.2528C4.48817 57.4623 2.66485 57.8114 1.82332 56.066C2.0337 55.9962 2.24408 55.7867 2.38434 55.7867C1.61294 55.5075 0.561021 55.3678 0 54.5999C1.19217 53.9715 1.96357 53.413 3.22587 53.413C3.15574 53.2734 3.01549 53.2036 2.94536 53.064C3.92715 52.5054 4.48817 52.3658 5.61021 52.296C5.96085 53.064 6.94264 52.8545 7.92442 53.1338C8.76595 53.3432 9.04646 52.9941 9.81787 52.4356C9.46723 52.296 9.11659 52.1564 8.76595 52.0167C8.90621 51.9469 9.04646 51.9469 9.18672 51.8771C8.83608 51.5979 8.69583 51.2488 9.11659 50.8997C8.20493 50.8299 7.43353 50.6903 6.52187 50.411C5.82059 50.2016 5.82059 49.0147 5.11932 48.7355C4.62842 48.526 2.59472 47.9675 2.38434 47.4788C2.31421 47.2694 2.73498 46.292 2.80511 46.0825C2.87523 45.8731 3.296 45.9429 3.43625 45.9429C4.20766 45.8731 5.3297 46.1523 5.82059 45.4542C6.38162 44.6862 6.87251 43.7786 7.57378 43.1503C8.76595 42.0333 10.449 41.4049 11.9918 41.1257C13.0437 40.986 13.8151 40.986 14.6567 40.2879C15.7787 39.3803 15.7086 39.3803 16.9709 40.0086C18.0929 40.5672 21.2487 39.7992 21.7396 41.1257C22.0902 42.1031 25.3862 42.0333 26.5082 42.1729C28.1212 42.3823 29.8042 42.5918 31.4172 42.871C33.8716 43.2899 36.256 43.7088 38.7105 44.1277C40.3234 44.407 41.7961 45.3145 43.2688 46.0127C43.5493 46.1523 45.2323 44.0579 45.5128 43.8484C45.9336 43.3597 46.8453 44.756 47.3362 44.4768C48.1777 44.1277 52.0347 41.754 52.5957 42.6616C51.1932 43.4296 49.7906 44.1277 48.3881 44.8957C49.44 45.6636 53.0866 42.522 53.3671 43.8484C53.7879 43.3597 54.2087 42.871 54.6294 42.3823C54.9801 41.9635 54.1385 41.8936 54.7697 41.4049C55.8216 42.6616 56.9436 43.7786 58.0657 44.8957C58.4163 43.7088 58.5566 43.2899 59.4682 42.522C60.0293 43.0805 59.0475 43.3597 59.8189 43.7786C60.0994 43.9183 59.6786 44.4768 59.5384 44.756C60.0293 44.6164 60.8708 44.6164 61.2214 44.3371C61.3617 44.1975 61.0812 43.639 61.2916 43.639C61.5721 43.5692 61.7824 43.5692 62.063 43.4994C62.9746 43.3597 64.2369 44.2673 65.0784 44.6164C66.8316 45.3844 68.9355 45.6636 70.7588 46.1523C70.6887 46.0127 70.6887 45.8731 70.6185 45.7334C71.8107 45.8032 72.4418 46.3618 73.4938 47.0599C74.2652 47.6184 71.8808 48.3864 71.7406 48.4562C72.512 48.7355 73.3535 49.1544 74.195 49.0845C75.5275 48.9449 76.93 48.8751 78.2624 48.7355C78.8936 48.6656 80.0156 48.526 80.4364 49.1543C81.0675 50.0619 81.6987 50.9695 82.3298 51.9469C82.2597 51.528 82.1195 51.1092 82.0493 50.7601C81.9792 50.4808 82.2597 50.2714 82.1896 50.0619C82.0493 49.0845 81.6286 49.3638 82.1195 48.3864C82.4701 47.7581 85.2752 47.6882 84.6441 46.7108C83.3116 47.2694 82.3298 47.6882 80.8572 47.6184C81.2078 46.4316 81.6987 46.5014 82.7506 46.1523C83.8727 45.8032 84.083 45.6636 85.1349 46.292C85.4155 46.4316 85.6258 47.1297 85.7661 47.4788C85.9765 47.8977 86.257 47.8279 86.7479 47.9675C87.6595 48.1769 88.431 48.4562 89.2725 48.7355C89.9738 49.0147 93.8308 49.4336 93.971 48.8751C94.3217 47.7581 94.3217 47.2694 95.584 47.2694C96.3554 47.2694 97.1969 47.6882 97.9683 47.8977C97.8982 48.2468 97.4073 49.3638 97.4774 49.7129C97.6177 50.0619 98.6696 50.5506 98.9501 50.6903C98.5293 49.4336 98.1086 48.3166 99.6514 48.1071C100.283 48.0373 100.633 47.409 101.124 46.9901C101.475 46.641 101.194 46.2221 101.124 45.8032C100.703 46.0127 100.353 46.1523 99.9319 46.3618C99.7916 45.1051 100.703 44.9655 101.545 44.8258C101.475 43.8484 100.563 44.5466 100.002 44.3371C99.5111 44.1277 97.8982 43.8484 97.6878 43.3597C97.267 42.3125 97.267 41.6144 97.267 40.4973C97.267 39.3803 97.828 39.2407 98.6696 39.5898C98.8098 39.0312 98.4592 38.8916 97.9683 38.8916C98.8098 38.3331 98.9501 38.4029 98.88 37.3557C98.88 36.4481 98.8098 36.0292 98.3891 35.2613C98.1086 34.6329 98.3189 33.7951 98.3189 33.097C98.3189 32.5385 99.2306 32.8177 99.6514 32.8876C98.1086 31.212 100.773 31.7007 101.825 31.7007C103.298 31.7007 104.28 31.8403 105.682 32.2592C105.121 33.097 104.28 34.9122 103.508 35.4009C102.807 35.8198 100.984 35.4707 100.212 35.4707C102.737 35.8198 99.8618 37.4255 100.002 38.2633C101.264 38.0538 101.966 39.1709 102.246 40.3577C102.386 41.1257 103.649 42.0333 104.14 42.6616C103.508 43.0805 102.877 43.4994 102.316 43.9183C102.947 44.1277 103.438 44.5466 103.999 44.1975C104.56 43.7786 105.051 44.2673 105.682 44.6164C105.402 44.8258 105.121 45.0353 104.771 45.2447C105.332 45.7334 105.682 45.7334 105.472 46.5712C105.262 47.3392 105.121 47.5486 105.823 47.9675C106.243 47.3392 106.454 47.0599 106.524 46.292C106.524 46.0127 106.804 44.8258 107.295 45.1749C107.646 45.3844 108.768 45.8032 108.838 46.2221C108.978 46.9203 109.399 47.6882 108.558 47.9675C108.558 47.8279 108.487 47.6184 108.487 47.4788C106.734 48.4562 110.591 51.8771 110.802 49.9921C110.872 49.4336 110.802 49.1543 111.152 48.8053C111.363 48.6656 111.924 48.3166 111.924 48.0373C111.924 46.641 111.924 46.7108 113.116 46.2221C112.625 45.4542 112.204 45.1051 112.415 44.2673C112.625 43.3597 113.046 43.639 113.817 43.7088C114.308 43.7786 115.711 43.7088 116.061 44.1277C116.763 44.8957 116.973 45.0353 117.885 45.2447C117.464 45.9429 118.095 46.4316 117.674 46.9203C117.394 47.2694 116.482 47.1297 116.061 47.1297C116.412 47.8977 116.622 48.5958 117.253 49.0845C117.885 49.6431 118.165 50.1318 117.464 50.9695C117.043 51.528 115.921 51.8771 115.29 52.296C114.729 52.6451 114.308 51.8771 113.817 51.4582C114.028 52.0167 114.308 52.5054 114.518 53.064C114.168 52.8545 113.747 52.6451 113.396 52.5054C113.467 52.6451 113.467 52.7847 113.537 52.9243C113.186 52.8545 112.765 52.7149 112.415 52.6451C112.134 52.5753 112.344 51.9469 112.134 51.9469C111.573 51.9469 110.732 51.7375 110.451 52.3658C110.802 52.5753 111.152 52.7847 111.503 52.9941C111.152 53.5527 110.802 54.2508 110.241 54.5999C109.399 55.0886 109.119 54.6697 108.207 54.2508C106.875 53.5527 105.682 53.6225 104.14 53.5527C105.191 54.0414 106.243 54.5999 107.295 55.0886C108.067 55.4377 109.329 55.3678 110.171 55.4377C109.82 55.9962 109.259 57.5321 108.698 57.8114C108.347 57.951 107.926 58.3001 107.576 58.3001C107.155 58.2302 106.734 58.0906 106.313 58.3699C105.191 59.2076 105.051 59.2076 103.789 58.8586C102.947 58.5793 102.106 58.4397 101.334 58.1604C101.895 58.4397 102.456 58.6491 103.017 58.9284C102.877 58.9982 102.807 59.2076 102.667 59.2775C103.508 59.068 103.719 59.068 104.49 59.4869C104.911 59.6963 105.542 60.3247 104.841 60.6737C104.069 61.0228 103.789 61.0228 102.947 60.953C102.667 60.953 102.246 61.8606 102.106 62.07C101.475 63.1173 100.423 64.2343 100.142 65.491C99.8618 66.8872 99.5812 68.3533 99.2306 69.7496C99.7916 69.8893 101.054 69.8893 101.475 70.3082C101.966 70.727 102.246 72.4026 102.456 73.0309C102.877 74.2178 103.158 73.7989 104.21 73.5196C104.771 73.38 105.472 73.7989 106.033 74.0083C107.716 74.6367 108.908 75.1952 110.381 76.2424C110.872 76.5915 111.713 77.5689 112.274 77.5689C113.116 77.6387 113.957 77.7783 114.729 77.8481C115.009 77.8481 116.622 77.8481 116.622 78.1972C116.552 79.3142 116.552 80.5011 116.482 81.6181C116.412 83.2238 118.025 84.4107 118.936 85.5975C119.848 86.7146 121.812 84.6201 121.601 83.6427C121.461 82.5955 121.251 81.6181 121.11 80.5709C121.04 80.0124 120.269 79.3142 119.988 78.8255C120.97 78.1972 122.934 77.4292 123.635 76.4518C124.266 75.5443 124.406 73.1007 123.635 72.3328C123.074 71.7743 122.513 71.2856 122.092 70.6572C121.461 69.7496 121.251 69.8195 122.022 69.1213C122.934 68.3533 123.004 68.4232 122.653 67.2363C122.513 66.608 122.092 65.84 122.303 65.2117C122.653 64.0248 122.723 63.8154 122.373 62.6984C122.162 62.0002 122.583 61.721 123.355 61.6512C124.757 61.5115 126.019 62.6984 127.352 62.07C128.193 61.6512 128.404 62.1399 129.245 62.6984C129.596 62.9776 130.718 63.3965 130.788 63.955C130.998 64.723 131.419 65.2815 132.261 65.1419C132.962 65.0721 133.383 65.3513 134.014 65.7004C133.663 66.3287 133.453 66.4684 133.593 67.1665C133.733 67.7948 133.874 68.4232 133.663 69.0515C133.874 68.9817 134.014 69.1213 134.224 69.0515C133.874 69.4704 132.962 70.0987 133.453 70.5874C134.294 68.0043 137.45 73.6593 138.151 70.1685C138.292 70.3082 138.572 70.3082 138.712 70.5176C139.063 69.7496 139.624 69.0515 139.484 68.2137C139.344 67.6552 140.255 66.4684 140.816 66.608C140.746 66.8872 140.676 67.2363 140.606 67.5156C141.938 67.5854 142.85 70.378 143.551 71.495C143.902 72.1233 145.024 73.38 145.024 74.0781C145.024 74.497 144.393 74.9857 144.463 75.4046C144.533 75.5443 145.164 75.9631 145.304 76.1028C145.585 76.3122 146.216 76.6613 146.427 77.0104C146.707 77.4292 146.286 77.8481 146.847 77.9179C147.899 77.9878 148.32 77.9878 149.232 78.5463C149.793 78.9652 150.985 79.5237 149.723 79.7331C149.021 79.8727 148.25 80.152 147.549 80.3615C147.969 80.5011 148.53 80.2218 149.021 80.0822C148.671 80.6407 147.689 80.7105 147.128 80.92C146.567 81.1294 146.777 82.1766 147.058 81.8276C147.338 81.4785 147.478 81.4785 147.899 81.269C148.25 81.1294 148.11 80.92 148.32 80.8502C148.811 80.5709 149.442 80.4313 150.003 80.3615C149.652 80.2916 149.582 80.2218 149.372 80.0124C149.793 80.0124 150.564 80.0822 150.774 80.5709C150.985 81.1992 150.284 81.1294 150.704 81.6181C151.195 80.7803 151.756 81.1992 152.457 81.4785C153.018 81.6879 152.598 82.805 152.457 83.154C152.247 83.7824 152.948 83.9918 152.457 84.7598C152.247 85.1088 151.195 85.6674 150.845 85.7372C150.284 85.8768 149.723 85.7372 149.091 85.9466C148.46 86.1561 148.18 86.5749 147.689 87.0636C146.707 88.1109 145.865 88.3203 144.463 88.1807C142.99 88.0411 141.658 87.9712 140.185 88.1109C138.923 88.1807 137.59 87.7618 137.24 89.4373C137.17 89.8562 135.907 89.9959 135.557 90.2751C134.996 90.694 134.505 91.3922 134.014 91.8809C133.172 92.7884 132.681 93.9055 131.7 94.6734C133.453 93.8357 134.365 92.0205 136.118 91.1827C137.31 90.6242 140.536 88.809 141.377 90.9035C141.237 90.8336 141.097 90.8336 140.957 90.7638C141.798 91.3223 140.676 91.811 140.185 92.1601C139.624 92.6488 139.133 91.811 138.502 92.2299C138.783 92.2997 139.414 92.9979 139.414 92.9979C139.835 92.8583 140.185 92.7884 140.606 92.9281C140.536 93.4168 140.185 93.8357 139.835 94.1149C140.045 94.0451 140.255 94.1149 140.466 94.1149C140.115 95.0225 141.097 95.7206 141.798 95.9301C141.728 95.9999 141.658 96.0697 141.588 96.0697C142.569 96.5584 143.551 96.9773 144.463 96.349C144.463 96.4886 144.533 96.6981 144.533 96.8377C144.673 96.8377 144.954 96.7679 145.094 96.6282C144.463 95.8603 145.725 94.7433 146.146 94.1149C146.917 94.3942 146.497 95.0923 146.286 95.7207C146.847 95.3018 147.689 96.1395 147.198 96.349C146.567 96.6282 145.936 97.0471 145.234 96.9075C145.375 97.0471 145.445 97.2566 145.655 97.3962C144.814 97.7453 144.042 98.0943 143.201 98.3736C142.92 98.5132 142.569 98.5831 142.289 98.7925C141.938 99.0718 141.868 98.3736 141.518 98.6529C140.957 99.0718 140.466 99.9793 139.835 100.538C139.414 100.957 139.063 100.398 138.783 100.259C137.941 99.0019 139.975 97.9547 140.676 97.466C141.167 97.117 140.957 97.5358 141.167 97.7453C141.658 98.1642 141.938 97.6056 142.359 97.1868C141.798 97.1868 141.097 96.9773 140.606 97.3264C140.606 97.0471 140.886 96.7679 141.027 96.4188C140.396 96.2792 139.554 97.117 139.063 97.466C138.712 97.6755 138.712 97.1868 138.292 97.6755C138.081 97.8849 137.59 97.7453 137.31 97.7453C137.731 99.0718 135.487 98.5831 135.136 99.2114C135.066 99.1416 134.926 99.0019 134.855 98.9321C134.505 99.6303 134.154 99.7001 133.523 99.9793C133.102 100.119 133.032 100.468 132.892 100.957C132.611 101.655 131.349 104.029 133.102 103.819C133.032 103.68 133.032 103.61 132.962 103.47C133.102 103.54 133.243 103.749 133.313 103.889C132.822 104.238 132.191 103.959 131.63 103.819C131.349 103.749 131.419 104.587 131.069 104.587C129.806 104.657 129.175 104.727 128.053 105.495C128.824 105.425 129.456 105.006 130.297 104.866C130.227 104.936 130.157 105.006 130.017 105.076C130.227 105.076 130.437 105.146 130.648 105.076C130.087 105.355 129.736 105.634 129.105 105.634C128.614 105.704 127.773 105.495 127.492 105.983C128.684 106.123 126.931 108.427 126.51 108.776C126.791 108.287 125.949 107.938 125.739 107.38C125.809 108.078 126.651 109.055 126.37 109.684C126.019 110.312 125.458 111.15 125.318 111.778L125.178 111.708C125.178 111.219 125.388 110.801 125.599 110.382C125.318 110.172 125.458 109.544 124.827 109.753C124.897 109.265 124.967 108.776 125.108 108.357C125.178 108.287 125.528 107.38 125.108 107.659C124.056 108.427 124.406 108.916 124.687 110.102C124.406 109.893 124.056 109.684 123.705 109.614C123.986 109.963 124.617 110.102 124.827 110.452C124.967 110.731 124.617 111.569 124.687 111.848C124.827 112.337 125.528 112.057 125.318 112.895C125.178 113.593 124.757 113.523 124.196 113.663C124.687 113.663 125.599 113.523 125.458 114.222C125.388 114.501 124.336 114.571 124.056 114.571C124.196 114.64 124.336 114.78 124.477 114.92C124.266 114.989 124.126 115.129 123.845 115.129C124.126 115.757 124.477 115.199 124.897 115.408C124.617 115.548 124.336 115.757 124.056 115.897C123.845 116.037 123.495 115.618 123.355 115.757C123.004 115.967 122.653 116.805 122.443 117.154C122.232 117.433 121.671 117.293 121.321 117.712C121.04 118.061 120.76 118.55 120.339 118.829C118.936 119.667 118.726 120.016 117.955 121.482C117.604 122.18 117.814 123.437 118.165 124.135C118.726 125.392 119.147 126.509 119.568 127.835C119.778 128.533 119.918 130.279 119.427 130.768C119.077 131.117 118.726 131.675 118.305 131.047C118.165 130.837 117.324 130.139 117.324 130.069C117.183 129.441 116.903 129.092 116.692 128.603C116.482 128.045 116.201 127.766 116.342 127.137C116.272 127.207 116.131 127.277 116.061 127.416C115.851 126.579 116.552 125.462 115.781 124.833C115.079 124.345 114.659 123.367 113.817 123.646C113.326 123.786 112.905 124.135 112.415 123.856C112.064 123.577 111.503 123.158 111.082 123.018C110.311 122.809 109.048 123.786 108.838 122.529C108.698 123.646 106.243 122.809 105.542 123.437C106.033 123.507 107.926 123.716 106.524 124.414C106.664 124.484 107.436 124.764 107.436 124.903C107.506 125.322 107.155 125.462 106.945 125.392C107.155 124.903 106.384 124.694 106.033 124.484C106.103 124.833 105.963 124.973 105.963 125.252C105.612 124.554 105.332 125.252 104.841 124.903C104.28 124.484 103.999 124.065 103.298 124.275C102.947 124.414 102.386 124.065 102.036 123.926C101.334 123.646 100.212 124.484 99.5812 124.764C98.4592 125.182 95.8645 127.137 95.8645 128.673C95.8645 129.162 96.4956 129.651 96.5658 130.139C96.5658 130.488 96.3554 130.977 96.2151 131.326C96.0047 132.164 95.584 133.071 95.584 133.979C95.584 136.213 95.8645 137.819 97.1268 139.704C97.8281 140.821 98.1086 141.589 99.3709 141.938C99.6514 142.008 100.002 142.636 100.212 142.566C100.703 142.357 101.194 142.217 101.685 142.008C102.176 141.798 102.527 141.728 103.017 141.728C103.368 141.728 103.649 142.147 103.859 142.078C104.069 142.008 104.35 141.938 104.49 141.798C104.63 141.728 104.35 141.379 104.49 141.24C104.911 140.821 105.121 140.751 105.262 140.123C105.542 139.145 105.472 138.028 106.454 137.679C106.875 137.54 108.277 137.191 108.698 137.26C109.259 137.33 110.872 136.981 110.381 138.238C110.171 138.726 109.539 140.193 109.189 140.193C109.399 140.262 109.259 140.472 109.68 140.472C109.539 140.611 109.399 140.751 109.259 140.891L109.329 141.03C109.399 140.96 109.469 140.891 109.539 140.891C109.329 141.449 109.189 142.078 109.048 142.636C108.768 142.357 108.698 142.008 108.768 141.589C108.628 141.728 108.487 142.078 108.347 142.287C109.119 142.357 108.207 143.753 108.487 144.312C108.698 144.8 107.926 145.708 107.576 145.987C108.628 146.336 109.68 146.057 110.872 146.266C111.363 146.336 111.643 145.917 112.134 145.987C112.625 146.057 113.326 145.987 113.817 146.197C114.799 146.615 115.5 147.314 115.29 148.5C115.15 149.268 115.079 149.967 114.939 150.735C114.869 151.153 114.518 151.572 114.448 151.991C114.168 154.016 116.692 157.367 118.516 156.599C119.638 156.11 120.269 155.691 121.461 156.04C122.653 156.389 123.074 157.018 123.916 157.995C123.845 156.529 125.669 154.574 126.37 153.457C126.58 153.108 127.913 152.899 128.263 152.759C129.245 152.41 130.227 152.061 131.209 151.712C132.12 151.363 133.733 152.201 134.575 152.34C136.889 152.899 139.203 153.387 141.518 153.946C142.78 154.225 144.042 154.225 145.024 155.203C146.847 156.948 148.6 158.624 150.424 160.369C151.546 161.486 154.07 161.486 155.473 161.835C156.805 162.184 157.927 164.418 158.769 165.535C159.61 166.652 160.522 167.769 161.364 168.956C161.574 169.235 162.065 170.143 162.345 170.283C164.169 170.981 166.062 171.609 167.886 172.307C169.709 173.005 171.602 173.634 173.496 174.332C175.039 174.89 176.652 176.566 177.984 177.543C178.264 177.543 179.948 177.613 180.018 177.753C180.579 178.102 180.789 178.94 180.999 179.777ZM121.321 100.887C121.321 101.445 119.427 101.934 118.866 101.864C118.025 101.864 117.955 101.864 117.324 102.423C116.903 102.772 116.622 103.191 115.991 102.912C116.061 102.493 116.412 102.213 116.763 102.144C116.552 101.795 116.482 102.074 116.412 101.655C115.991 102.213 115.64 102.772 115.29 103.4C115.57 103.47 115.921 103.54 116.201 103.68C116.131 103.749 116.061 103.889 115.991 103.959C117.253 104.098 117.744 103.47 118.796 103.051C119.848 102.632 120.549 102.213 121.461 101.515C121.531 101.236 121.601 101.096 121.321 100.887ZM122.934 100.538C123.916 101.445 125.949 99.7001 124.897 99.2812C125.178 99.0019 125.458 98.7925 125.739 98.5132C125.178 98.7227 123.916 99.7001 123.495 99.4906C122.723 99.1416 121.812 99.6303 121.04 99.7699C119.427 101.934 122.303 99.8397 122.934 100.538ZM103.649 94.1847C104.21 94.464 104.771 94.1149 105.332 93.9055C105.262 94.0451 105.262 94.1847 105.191 94.2545C106.524 94.9527 108.487 92.2299 109.469 92.9979C109.048 93.1375 108.558 93.6262 108.417 94.1149C108.908 93.8357 109.329 93.8357 109.68 94.2545C110.03 94.6734 110.311 94.464 110.732 94.7432C110.942 94.8131 112.835 94.1847 113.186 94.1149C112.976 94.7433 113.537 94.5338 113.957 94.7432C114.238 94.8829 114.378 95.3716 114.659 95.6508C114.168 95.581 113.677 95.3018 113.467 95.8603C112.765 95.0923 111.433 95.5112 110.942 96.2792L110.802 96.1395C110.872 95.9999 110.942 95.9301 111.012 95.7905C110.802 95.9301 110.661 95.9301 110.451 96.0697C110.451 95.9301 110.381 95.7905 110.381 95.7207C109.89 96.2094 109.119 97.466 108.978 98.0944C109.539 98.234 109.82 97.1868 110.241 96.8377C110.311 97.3264 109.82 98.0944 109.68 98.6529C109.469 99.351 109.119 100.119 109.189 100.887C109.259 102.004 109.82 104.936 110.942 102.702C111.573 101.515 111.363 100.677 111.082 99.4906C110.802 98.1642 111.854 97.9547 112.204 97.117C112.204 97.3264 112.204 97.6755 112.204 97.8849C112.555 97.466 112.415 96.7679 113.186 96.6981C112.555 95.8603 113.817 95.9999 114.238 96.4188C114.659 96.9075 115.29 96.6981 115.43 97.3962C115.29 97.3962 115.29 97.3264 115.22 97.3962C115.5 97.8151 115.57 98.5831 115.15 98.8623C115.079 98.9321 114.448 99.5604 114.518 99.7699C114.659 100.189 115.64 99.2114 115.921 99.2812C116.482 99.2812 116.482 100.747 116.552 101.236C116.833 100.887 117.183 100.538 117.464 100.189C117.674 99.9793 117.464 99.351 117.604 99.0019C117.814 98.3736 118.516 97.6057 117.534 97.117C118.235 96.7679 117.955 97.6755 118.516 97.6057C118.446 97.8151 118.446 97.8151 118.305 98.0245C118.446 98.1642 118.446 98.0944 118.516 98.3038C118.866 97.9547 119.497 98.4434 119.848 98.3038C119.918 98.3038 119.708 97.6755 120.269 98.0245C119.568 97.3962 119.638 95.9999 118.586 95.7905C117.674 95.581 116.622 95.581 115.711 95.3716C115.36 95.3018 113.537 94.7432 113.677 94.5338C113.817 94.2545 113.677 94.1149 113.537 93.9055C113.396 93.696 113.677 93.4866 113.607 93.2772C113.396 92.6488 112.835 92.9979 113.186 92.0205C111.854 92.2299 111.854 91.6714 111.152 90.6242C110.802 90.0657 110.311 90.694 109.96 90.5544C109.469 90.3449 109.048 90.0657 108.558 90.1355C109.048 90.5544 108.628 90.8336 108.207 91.1129C108.347 90.9035 108.417 90.694 108.487 90.4147C108.067 90.6242 108.137 91.1827 107.716 91.3223C107.786 91.1827 107.856 90.9733 107.926 90.8336C107.225 90.9733 107.506 91.6016 107.015 91.8809C106.384 92.1601 105.823 92.4394 105.191 92.7186C104.771 93.1375 104.21 93.6262 103.649 94.1847ZM69.0056 52.1564C68.7952 52.1564 68.655 52.0167 68.4446 52.0167C68.5848 51.8771 68.7251 51.6677 68.8653 51.5979C68.2342 51.528 67.8134 52.296 67.1823 52.3658C66.3407 52.5054 65.9901 52.5753 65.2187 52.2262C65.4291 51.528 66.481 51.3884 67.042 51.1092C65.8498 50.6903 65.5693 50.5506 64.4473 51.0393C63.746 51.3186 63.0447 51.528 62.3435 51.8073C61.5721 52.0866 60.8007 52.1564 60.0293 52.4356C59.6085 52.5753 57.9254 52.6451 59.1877 53.4828C59.2579 53.413 59.4682 53.2734 59.5384 53.2036C59.4682 53.1338 59.4682 53.064 59.3981 52.9941C59.889 52.7847 61.2214 52.7847 61.7123 52.9243C61.6422 52.7847 61.6422 52.7847 61.5721 52.6451C62.4136 52.5054 63.2551 52.6451 64.0265 53.1338C63.6058 53.7621 62.5539 53.2036 61.9227 53.413C62.2032 53.6225 62.4837 53.8319 62.624 54.1112C62.2733 54.181 61.9928 54.3904 61.7123 54.5999C62.2733 55.2282 61.3617 55.298 60.9409 55.3678C61.5019 55.7867 62.1331 55.5075 62.7642 55.7867C63.185 55.9962 63.746 54.949 64.0967 54.6697C64.7278 54.2508 65.7797 54.5999 64.9382 55.1584C64.5876 55.3678 64.5174 55.7169 64.3772 55.7867C64.2369 55.9264 63.8863 55.9264 63.746 56.066C64.5876 56.834 65.4291 54.6697 66.481 54.949C66.3407 54.5999 66.0602 54.3206 65.7096 54.2508C66.5511 53.3432 68.3043 54.6697 68.655 53.6923C68.5147 53.7621 68.3043 53.7621 68.1641 53.7621C68.1641 53.1338 68.5848 53.4828 68.7251 53.1338C68.7952 52.7149 68.9355 52.4356 69.0056 52.1564ZM80.7169 60.8832C79.8053 60.4643 78.3326 60.185 77.491 60.8832C77.1404 61.1624 76.93 61.6511 76.6495 61.9304C76.1586 62.4191 75.9482 62.5587 75.3171 62.6286C74.7561 62.6984 73.7743 62.6286 73.4938 61.9304C73.4236 61.721 72.3717 62.0002 72.0912 61.4417C72.0211 61.3021 71.0393 60.8832 70.9692 61.0228C70.7588 61.2323 71.8808 61.721 72.0912 61.721C71.7406 62.4889 73.4938 63.1173 72.4418 63.3965C72.0912 63.4663 71.8107 63.1871 71.6003 63.606C71.3198 63.955 71.4601 64.1645 71.0393 64.2343C71.1094 64.3041 71.1796 64.3739 71.2497 64.4437C70.899 64.723 70.4783 64.4437 70.0575 64.4437C70.0575 64.5135 70.0575 64.5834 70.1276 64.6532C69.7069 64.6532 69.3562 64.4437 68.8653 64.4437C69.4264 65.2117 70.899 65.4211 71.8107 65.5608C72.3717 65.6306 74.5457 65.3513 74.195 64.5834C74.8963 63.955 75.3171 64.1645 76.0184 63.8154C76.4391 63.606 76.8599 63.0474 77.2807 62.6984C77.1404 62.6984 77.0703 62.6984 76.93 62.6984C77.4209 62.2795 77.7014 62.0002 78.1923 61.8606C78.6832 61.721 78.9637 61.9304 79.3845 61.5115C79.0338 61.6511 78.9637 61.5813 78.6131 61.5115C78.9637 61.4417 79.2442 61.3719 79.5949 61.2323C79.2442 61.2323 78.9637 61.2323 78.6832 61.0228C78.8936 61.0228 79.1741 61.0228 79.4546 61.0228C78.543 60.7436 77.7715 61.3021 76.93 61.8606C77.2105 60.8134 80.0156 60.185 80.1559 61.3719C80.3663 61.3021 80.5767 61.0228 80.7169 60.8832ZM95.8645 84.3409C95.9346 83.7824 95.8645 84.0616 96.2151 83.8522C96.2151 83.9918 96.145 84.1314 96.145 84.2711C96.2151 84.1314 96.2151 84.2013 96.2852 83.9918C96.706 84.1314 96.5658 84.69 96.5658 85.1787C96.706 84.8994 96.9164 84.69 97.1969 84.8296C97.4073 84.8994 97.0566 85.5277 96.9865 85.7372C97.1969 85.5277 97.3372 85.5277 97.4774 85.4579C96.9865 85.807 96.8463 86.5051 97.0566 87.1335C97.267 87.692 97.6177 87.0636 97.5475 86.7146C97.6878 86.7844 97.7579 86.7844 97.8982 86.8542C97.6878 86.2957 98.1086 85.7372 97.7579 85.4579C97.4073 85.1088 97.1268 84.3409 96.9865 83.922C96.706 83.2238 95.3736 80.2916 95.9346 79.9426L95.7944 79.8727C95.584 80.0822 95.584 80.0822 95.3035 80.152C95.3736 79.8029 95.584 79.5935 95.8645 79.5237C95.7943 79.4539 95.584 79.3142 95.584 79.2444C95.1632 80.0124 95.1632 80.2916 95.7944 80.7105C95.3035 80.5011 94.3918 80.0124 94.1814 80.7803C93.8308 82.1068 94.0412 81.8276 95.0229 82.037C93.9009 82.2464 95.3035 83.5729 95.5138 84.1314C95.584 84.2013 95.7242 84.2711 95.8645 84.3409ZM3.50638 66.608C2.59472 66.2589 2.17396 66.8872 1.19217 66.8174C1.61294 67.4458 2.24408 67.5156 2.87523 67.7948C3.01549 67.4458 3.36613 67.5854 3.71676 67.5156C3.71676 67.4458 3.71676 67.3759 3.71676 67.3061C3.57651 66.9571 3.296 67.0269 3.50638 66.608ZM58.4865 37.4953C59.328 37.9142 60.0293 38.1935 60.6604 38.8916C61.7123 40.0785 61.5721 40.0785 62.8344 39.3105C63.0447 39.1709 63.2551 39.1011 63.4655 38.9614C63.6759 38.8916 63.6058 39.2407 63.746 39.2407C64.1668 39.1011 64.5875 38.8916 65.0083 38.6822L65.359 36.867C65.9901 37.2859 66.6213 36.7274 66.7615 36.099C66.9018 35.5405 67.1823 35.5405 67.6732 35.3311C68.7952 34.8424 70.4783 34.4933 71.3899 33.7253C71.951 33.2366 71.951 32.9574 71.2497 32.4687C70.7588 32.1196 70.338 31.7007 69.777 31.4913C68.7251 31.0724 67.603 30.6535 66.6914 31.6309C66.7615 31.4913 66.7615 31.2818 66.8316 31.0724C65.5693 31.4215 64.5174 29.9553 63.3954 30.1648C62.063 30.3742 60.6604 30.5837 59.328 30.7233C59.5384 31.1422 60.5903 32.4687 60.3799 32.6781C59.9591 33.097 58.8371 34.1442 59.4682 34.7725C58.2761 34.9122 59.1877 35.3311 58.6968 35.8896C58.3462 36.3783 57.715 36.867 57.8553 37.5651C57.9956 37.6349 58.2761 37.6349 58.4865 37.4953ZM63.746 26.1854C64.4473 26.2552 64.0967 25.6967 64.2369 25.4872C64.6577 25.1381 65.1486 25.6268 65.0784 26.325C65.4291 26.1854 65.9901 26.1155 66.2706 25.8363C66.5511 25.4872 65.7797 24.9287 66.2706 24.6494C66.5511 24.5098 66.7615 25.557 67.3225 24.9985C67.603 24.6494 67.3927 24.3004 67.042 24.1607C67.4628 23.8815 67.8836 24.3004 67.8836 23.4626C67.8836 23.1135 68.5147 23.1833 68.655 23.323C67.603 23.9513 68.655 24.9985 69.5666 24.7891C70.1978 24.6494 71.7406 23.4626 70.6185 22.9041C70.7588 22.8343 71.1094 22.7644 71.3198 22.7644C69.8471 22.4852 71.1796 21.8569 71.8107 21.6474C70.899 21.1587 70.5484 20.7398 69.5666 21.1587C69.7069 21.2285 69.777 21.3682 69.9874 21.438C69.5666 21.8569 69.1459 21.5776 68.655 21.3682C68.3043 21.2285 67.8134 21.438 67.4628 21.5078C66.481 21.6474 66.2005 21.9965 65.4291 22.6946C64.9382 23.1135 63.9564 24.3702 63.2551 24.44C62.2032 24.5796 61.3617 24.8589 62.2733 25.9759C62.7642 26.1155 63.2551 26.1854 63.746 26.1854ZM74.3353 20.1115C73.4236 19.2737 73.4236 19.2039 72.3016 19.6228C72.7224 19.9021 73.073 20.1813 73.4938 20.4606C73.7743 20.3908 74.0548 20.2511 74.3353 20.1115ZM20.4773 71.495C20.898 71.7743 21.5292 71.3554 21.7396 71.0761C21.8097 71.1459 21.8798 71.2157 21.9499 71.2856C22.0201 71.2157 22.0902 71.0761 22.1603 71.0063C21.8798 70.8667 21.5993 70.727 21.2487 70.6572C20.9682 70.7969 20.6175 71.0761 20.4773 71.495ZM49.6504 80.2218C49.7205 79.4539 47.827 79.7331 47.827 79.8727C47.7569 80.8502 49.8607 84.4805 50.6322 83.6427C50.4218 83.4333 50.2114 83.2238 50.001 83.0842C49.7205 82.037 49.5802 81.269 49.6504 80.2218ZM19.4955 72.5422C18.3033 71.7743 18.0929 74.3574 19.3552 74.2876C19.7059 74.2876 19.9864 73.6593 20.4773 73.5894C20.898 73.5196 21.2487 73.3102 21.2487 72.8215C21.5993 72.9611 21.8097 72.8913 21.9499 72.5422C21.8097 72.5422 21.7396 72.4724 21.5993 72.4724C21.8097 71.5648 19.3552 71.4252 19.4955 72.5422ZM60.45 89.7864C60.3098 89.5072 59.7487 89.4373 59.4682 89.2977C59.0475 89.1581 58.9773 88.8788 58.767 88.4599C58.0657 87.2033 57.8553 87.4825 56.593 87.0636C55.6112 86.7146 55.2606 86.2259 54.2087 86.575C55.8917 88.5996 57.6449 89.7864 59.889 90.9733C61.3617 91.5318 61.1513 90.9733 60.45 89.7864ZM296.78 189.202C296.43 188.714 295.307 186.968 295.237 188.644C295.167 189.97 294.817 189.97 293.975 190.948C293.274 191.716 292.993 192.414 292.152 192.903C291.17 193.391 290.469 193.74 289.417 193.88C288.996 193.95 288.575 195.695 288.715 196.184C288.926 197.022 289.487 198.348 289.417 199.186C289.347 200.093 288.295 201.001 288.014 201.909C287.664 202.956 287.874 203.724 288.154 204.771C288.435 205.748 288.575 206.726 288.715 207.703C288.786 208.052 290.399 208.681 290.749 208.541C290.96 208.401 292.713 207.913 292.783 207.843C292.993 207.075 293.204 206.377 293.484 205.609C294.326 202.886 295.097 200.163 295.939 197.51C296.5 195.695 296.64 194.857 296.5 192.903C296.71 193.112 296.991 193.391 297.201 193.601C297.622 192.065 297.131 190.808 296.78 189.202ZM391.943 144.94C391.663 145.498 392.013 146.406 392.084 147.034C392.154 147.523 392.855 147.593 393.276 147.732C392.434 148.151 392.995 148.989 393.697 149.059C394.328 149.129 394.117 148.64 394.889 149.059C395.169 149.199 395.38 149.548 395.52 149.827C395.59 149.478 395.66 149.129 395.73 148.78C396.502 149.059 396.572 148.989 396.642 149.827C396.642 150.176 397.483 150.525 397.764 150.665C398.185 149.687 397.203 149.967 397.273 149.129C397.904 149.478 398.395 149.129 397.834 148.5C397.554 148.221 397.554 148.85 397.343 148.78C397.063 148.71 396.782 148.431 396.502 148.291C396.221 148.151 396.011 148.082 395.73 148.012C395.38 147.942 395.31 148.5 395.099 148.5C394.398 148.5 394.678 147.802 394.398 147.244C393.907 146.266 394.538 146.546 394.468 145.638C394.468 145.289 394.959 145.638 395.099 145.429C395.239 145.219 395.31 144.8 395.31 144.591C395.66 143.544 395.239 143.963 395.099 143.055C394.959 142.566 395.59 142.287 395.239 141.659C394.187 142.147 394.678 141.659 393.767 141.449C393.486 141.379 392.855 141.589 392.855 141.938C392.715 142.776 392.574 143.613 392.434 144.451C392.364 144.94 392.855 145.01 392.645 145.568C392.364 145.289 392.154 145.149 391.943 144.94ZM394.328 133.351C394.468 132.583 395.239 130.628 393.837 131.326C393.065 131.675 392.364 132.722 392.154 133.7C391.943 134.747 392.645 135.445 393.206 136.283C393.697 135.236 394.047 134.538 394.328 133.351ZM391.172 152.34C390.962 153.457 390.821 154.086 390.05 154.784C389.208 155.552 388.788 156.11 388.227 157.088C389.279 156.459 390.33 156.18 390.541 154.854C390.611 154.505 391.452 154.086 391.733 153.876C391.803 153.806 391.523 152.899 391.663 152.62C391.452 152.55 391.312 152.48 391.172 152.34ZM400.218 155.761C400.078 155.342 399.798 154.993 399.447 154.923C399.517 155.342 399.587 155.691 399.657 156.11C399.167 156.04 399.307 155.971 399.096 156.25C398.676 155.971 398.535 156.32 398.535 156.808C397.904 156.39 397.624 157.367 397.063 157.576C397.413 157.157 397.343 156.529 396.782 156.459C396.151 156.39 396.361 157.297 396.011 157.437C395.38 157.646 394.187 158.344 394.889 159.322C395.169 159.042 395.8 157.088 396.011 158.554C396.151 158.205 396.221 158.274 396.361 158.065C396.432 158.484 396.432 158.344 396.712 158.554C396.642 158.344 396.712 158.135 396.642 157.925C398.115 157.716 397.133 159.112 397.413 159.88C397.624 160.369 398.816 161.207 399.026 160.509H399.167C398.816 161.556 399.868 161.137 399.728 160.229C399.587 159.601 399.167 159.112 399.938 158.554C400.289 159.042 400.078 159.601 400.429 160.159C400.429 159.88 400.499 159.531 400.499 159.252C400.569 159.322 400.639 159.322 400.709 159.392C400.779 158.973 401.34 157.367 400.709 157.367C400.779 157.227 400.779 157.018 400.709 156.878C400.499 156.878 400.429 156.739 400.359 156.739C400.429 156.599 400.569 156.529 400.639 156.459C400.709 156.11 400.569 155.622 400.218 155.761ZM392.925 184.315C392.645 183.687 390.611 182.989 390.681 184.036C391.382 184.315 393.486 185.712 392.925 184.315ZM388.507 182.43C388.297 182.151 387.525 181.872 387.245 181.872C386.614 181.872 386.614 182.151 386.333 182.779C387.666 183.198 388.577 183.128 389.91 182.849C391.873 182.5 389.769 181.453 388.928 181.732C389.208 182.221 388.928 182.361 388.507 182.43ZM394.258 182.989C394.468 182.989 394.538 182.64 394.819 182.71C395.45 182.849 395.73 182.221 396.081 182.221C396.922 182.221 398.395 182.64 399.026 182.011C398.044 181.662 397.413 181.942 396.432 181.872C395.8 181.802 395.8 181.872 395.31 182.291C395.029 182.5 394.748 182.011 394.398 182.221C393.767 182.57 392.434 181.453 391.873 182.151C391.172 182.919 393.065 182.71 393.346 183.059C393.837 182.64 393.977 183.059 394.258 182.989ZM395.099 177.543C395.38 177.753 395.59 178.032 395.871 178.241C396.151 177.753 396.502 177.613 396.151 177.194C395.941 176.845 396.151 176.636 396.502 176.706C396.291 175.938 395.73 176.217 395.871 176.915C395.52 175.938 395.169 177.194 395.099 177.543ZM377.006 168.677C376.936 169.026 377.357 169.235 377.427 169.584C377.497 169.794 377.146 169.864 377.217 170.073C377.287 170.352 377.357 170.562 377.427 170.841C377.497 171.19 377.707 170.911 377.637 171.469C378.058 171.26 377.988 171.469 378.128 171.051C378.829 171.679 378.689 173.005 378.829 173.913C378.9 174.681 380.442 174.053 380.863 173.913C380.933 174.262 381.003 174.611 381.074 174.96C382.266 174.262 382.406 173.983 383.528 174.751C383.738 174.89 384.159 174.681 384.44 174.751C384.72 174.89 384.79 175.519 384.86 175.868C385.492 175.589 386.123 175.239 386.754 174.96C386.614 175.379 386.614 175.728 387.105 175.728C387.105 174.821 387.175 173.913 387.175 173.075C387.175 172.237 387.385 172.237 388.016 171.679C388.858 170.911 388.858 170.981 388.788 169.794C388.788 169.235 389.138 168.328 389.629 168.398C390.611 168.607 391.032 168.467 390.19 167.63C389.98 167.42 389.489 167.141 389.349 166.862C389.279 166.722 389.559 166.303 389.489 166.094C389.138 165.047 388.717 165.116 388.788 163.86C388.788 163.231 390.05 163.231 390.401 163.162C390.19 162.882 389.98 162.603 389.84 162.394C390.33 162.254 390.821 162.114 391.242 161.975C391.102 161.556 390.821 161.626 390.401 161.486C390.12 161.416 389.84 160.927 389.629 160.648C389.349 160.299 388.297 159.322 387.946 159.322C387.525 159.392 386.614 160.858 386.263 161.207C385.702 161.835 386.193 162.324 385.421 162.533C384.44 162.812 384.299 162.812 383.668 163.65C383.248 164.279 383.037 164.977 382.336 165.186C381.564 165.396 380.933 165.465 380.513 166.164C379.952 167.071 379.741 167.071 380.513 167.769C379.811 167.56 378.409 167.63 378.268 166.652C377.988 166.792 377.707 167.001 377.357 167.211C377.146 167.56 377.076 168.118 377.006 168.677ZM398.325 184.595C398.605 184.176 398.816 183.896 399.237 183.687C399.938 183.338 401.621 182.919 401.901 182.081C401.27 182.151 400.639 182.151 400.008 182.291C399.728 182.361 399.377 182.361 399.167 182.5C399.026 182.57 399.026 182.919 398.816 182.989C398.255 183.268 397.694 183.408 397.203 183.827C396.712 184.315 397.483 184.525 396.852 185.083C397.343 185.013 397.974 185.083 398.325 184.595ZM129.947 142.217C130.227 142.287 130.788 142.078 131.069 142.217C131.279 142.357 131.209 143.264 131.77 143.125C132.05 143.055 132.05 142.147 132.261 142.008C132.681 141.728 132.752 142.147 132.892 142.147C133.593 142.147 134.154 141.868 134.926 141.868C135.557 141.868 135.416 142.427 135.837 141.728C135.977 141.449 135.346 141.03 135.066 141.03C134.365 140.891 134.365 140.891 134.014 140.193C133.733 139.704 133.733 140.053 133.313 139.913C132.962 139.774 132.471 139.425 132.12 139.634C131.98 139.704 131.349 139.843 131.209 139.843C130.227 139.843 129.947 139.494 128.965 139.983C129.947 140.472 129.876 140.751 130.508 141.659C129.876 142.078 127.352 141.1 127.702 142.008C128.474 142.496 128.824 142.078 129.947 142.217ZM207.999 57.3925C208.77 57.6019 209.191 57.0434 209.191 56.2056C209.822 56.5547 210.102 55.9264 210.523 55.5075C210.032 55.1584 210.383 54.4603 210.173 54.3206C209.682 54.0414 209.261 53.6225 208.63 53.9017C209.401 52.6451 205.754 51.179 206.386 52.8545C205.334 52.7149 205.053 53.2734 204.001 52.7847C204.071 53.2036 204.142 53.5527 204.142 53.9716C203.721 53.413 203.581 52.9243 202.949 52.8545C202.388 52.8545 202.178 53.4829 202.388 53.9716C202.038 53.5527 201.687 52.9243 201.056 52.9941C201.477 54.0414 200.916 53.5527 200.635 54.0414C200.425 54.3904 200.285 54.8791 200.074 55.298C199.794 54.8791 199.513 54.4603 199.303 53.9716C199.583 54.0414 199.934 53.8319 199.864 53.4828C199.864 53.2036 199.233 53.064 199.092 52.9243C198.321 52.2262 198.391 52.0866 197.339 52.0866C197.479 52.5753 197.83 52.5054 198.321 52.5753C198.461 53.9017 197.129 52.4356 196.708 52.9243C196.217 53.5527 197.129 53.5527 196.989 53.8319C196.848 54.1112 196.357 53.9017 196.147 53.7621C196.147 53.9017 196.147 54.0414 196.147 54.181C195.796 54.1112 195.866 54.2508 195.516 54.3904C196.357 54.7395 196.638 54.5999 197.55 54.2508C197.97 54.1112 198.882 54.5301 199.303 54.5999C198.952 54.8093 198.601 54.949 198.181 55.1584C198.531 55.3678 198.882 55.4377 199.233 55.2282C199.233 55.298 199.233 55.4377 199.233 55.5075C198.181 55.5075 197.129 55.9264 196.147 55.9264C196.287 56.6943 198.04 56.3452 198.601 56.3452C198.321 56.6943 198.461 56.9736 198.882 56.9038C198.882 57.0434 198.812 57.1132 198.812 57.2528C198.952 57.2528 199.022 57.2528 199.162 57.3226C198.882 58.0906 197.62 57.8812 197.9 58.7189C198.742 58.6491 199.583 58.5095 200.425 58.3699C200.635 58.3699 200.846 58.9284 201.056 59.068C201.336 59.2775 201.897 59.2775 202.178 59.3473C202.879 59.4869 203.44 59.5567 204.142 59.2076C204.492 59.068 204.422 58.7888 204.773 58.7189C205.193 58.6491 205.544 58.5793 205.965 58.5793C206.456 58.2302 207.508 57.2528 207.999 57.3925ZM199.162 40.5672C199.022 39.9388 198.321 38.4727 198.601 37.8444C199.162 36.2387 199.513 34.214 200.635 32.9574C201.407 32.1196 202.108 31.2818 202.879 30.444C203.09 30.2346 202.529 28.3496 202.529 28.0005C202.388 27.3024 202.458 26.1155 201.897 25.6967C201.126 25.208 200.425 24.6494 199.653 24.1607C200.775 23.1135 201.827 21.9965 202.949 20.9493C201.757 20.1813 201.056 19.8322 200.495 18.5058C200.074 17.4585 201.407 16.1321 201.897 15.2943C202.458 14.3169 203.581 13.9678 204.492 13.3395C205.474 12.6413 206.245 12.013 207.087 11.0356C206.806 10.8262 206.526 10.5469 206.245 10.3375C207.227 10.128 208.419 10.128 209.331 9.5695C210.453 8.94116 211.645 8.24302 212.767 7.61469C211.505 7.12599 210.102 6.28821 208.77 6.07877C207.788 5.93914 205.825 5.7297 205.193 6.49766C204.773 7.05617 204.492 7.75432 203.791 7.6845C203.02 7.54487 202.178 7.40524 201.407 7.26561C200.495 7.12599 198.672 8.38265 197.83 8.73172C197.97 8.45246 199.653 5.79951 198.461 5.79951C197.409 5.79951 196.428 5.93914 195.516 5.24099C196.918 4.75229 198.391 4.19378 199.794 3.70507C196.989 2.51823 194.534 1.26156 191.589 0.842677C188.293 0.353975 185.137 -0.204542 181.841 0.0747164C180.649 0.144531 179.457 0.28416 178.264 0.353975C177.844 0.353975 177.072 0.28416 176.652 0.493604C176.09 0.842677 176.02 2.09934 175.249 1.95971C174.267 1.82008 173.356 1.61064 172.444 1.47101C171.322 1.26156 169.919 0.703047 168.797 1.19175C167.184 1.88989 165.571 2.65786 164.029 3.356C165.571 4.3334 167.184 5.03155 168.166 6.63728C165.431 5.65988 162.977 4.89192 160.172 4.26359C159.33 4.12396 158.068 4.54285 157.226 4.61266C155.263 4.89192 153.369 5.10136 151.406 5.38062C150.564 5.52025 149.232 5.38062 148.46 5.79951C147.338 6.35803 146.286 6.91654 145.164 7.47506C142.429 8.87135 139.764 10.2676 137.029 11.6639C138.011 12.781 139.203 12.5715 140.606 12.7112C140.325 13.4791 139.975 14.2471 139.694 15.015C139.344 15.8528 139.273 15.7132 138.362 15.7132C137.1 15.783 136.118 16.0622 134.855 16.4113C133.243 16.9 131.7 17.3189 130.087 17.8076C129.736 17.9472 129.736 18.8548 129.666 19.2737C129.596 19.553 130.297 20.2511 130.508 20.5304C130.998 21.1587 131.559 22.4852 132.261 22.8343C133.172 23.3928 134.084 23.9513 135.066 24.44C135.557 24.7193 136.819 25.8363 137.38 25.7665C138.432 25.6268 139.484 25.4872 140.536 25.3476C142.429 25.1381 144.042 25.4872 145.936 25.7665C146.917 25.9061 147.829 26.1155 148.811 26.2552C149.302 26.325 150.284 28.0704 150.564 28.4892C151.826 30.1648 152.528 32.1196 153.439 34.0744C153.93 35.1216 154.07 35.2613 153.72 36.3085C153.369 37.3557 152.808 37.984 153.509 38.752C154.281 39.5898 155.263 40.0086 154.912 41.1955C154.631 42.3125 154.141 43.0107 154.912 43.8484C155.894 44.8957 155.824 44.8957 157.156 44.5466C158.138 44.2673 159.049 43.9881 160.031 43.7088C159.961 44.407 159.821 45.1051 159.751 45.8731C159.751 46.0825 158.839 46.3618 158.629 46.4316C157.998 46.7108 157.296 46.9901 156.665 47.2694C156.525 47.3392 156.525 48.2468 156.455 48.4562C156.314 49.4336 155.824 51.0393 156.104 51.9469C156.595 53.2734 157.086 54.6697 157.577 55.9962C158.348 58.1604 159.751 59.9756 160.943 61.8606C161.644 62.9776 162.416 64.1645 163.117 65.2815C163.468 65.84 164.519 65.9797 165.08 66.1891C166.273 66.608 167.395 67.0269 168.587 67.4458C168.867 67.5156 170.48 67.5854 170.55 67.3759C171.252 65.1419 172.023 62.9078 172.724 60.6737C173.285 58.8586 173.917 57.1132 174.618 55.3678C174.968 54.3904 174.898 54.3904 175.81 54.1112C177.002 53.7621 178.124 53.3432 179.316 52.9941C180.018 52.7847 181.14 52.6451 181.771 52.2262C182.472 51.7375 183.173 50.4808 183.734 49.7827C184.225 49.1544 184.436 48.7355 185.137 48.5958C186.259 48.3166 187.311 48.0373 188.433 47.6882C189.976 47.2694 191.939 47.1297 193.342 46.2221C195.095 45.1051 196.918 44.0579 198.672 42.9409C199.373 41.8238 199.443 41.8936 199.162 40.5672ZM378.128 141.798C378.479 141.659 379.11 141.659 379.18 141.1C379.25 140.611 379.391 139.983 379.881 139.983C379.952 139.494 379.811 139.145 379.391 139.075C379.391 139.215 379.32 139.285 379.32 139.425C378.058 138.726 377.497 139.843 376.585 140.402C376.585 141.24 376.445 141.449 377.146 141.868C377.427 142.078 377.567 142.078 377.918 142.078C378.268 142.147 377.918 141.868 378.128 141.798ZM372.658 178.381C372.869 177.264 372.658 175.798 373.009 174.751C373.43 173.564 371.957 172.656 371.186 173.634C371.817 173.005 371.186 173.005 371.115 172.517C371.045 172.237 371.045 171.26 370.765 171.19C370.484 171.051 369.713 170.981 369.713 170.632C369.643 170.073 370.134 169.934 370.064 169.515C369.923 168.886 369.082 168.956 369.082 168.607C369.082 167.909 368.801 168.188 368.38 167.839C367.89 167.49 368.451 167.35 367.679 167.211C367.188 167.141 366.838 167.141 366.557 166.792C365.996 166.024 365.155 165.745 364.453 165.116C363.892 164.558 362.981 163.999 362.49 163.301C361.859 162.394 362.069 161.975 360.877 161.835C360.526 161.765 358.703 161.137 358.563 161.346C358.282 161.765 359.685 163.511 359.965 163.72C360.526 164.209 361.718 164.418 361.718 165.465C361.788 166.582 363.051 166.373 363.331 167.42C363.472 168.049 363.682 168.677 363.822 169.235C363.962 169.654 364.313 169.515 364.594 169.794C365.225 170.492 365.646 172.028 365.996 172.936C366.347 173.704 366.978 174.262 367.539 174.89C368.661 176.147 369.853 177.404 371.115 178.591C371.115 178.311 371.186 178.102 371.186 177.823C371.747 178.521 372.167 177.404 372.658 178.381ZM375.604 173.354C374.902 172.796 375.183 174.262 375.183 174.541C376.165 174.821 376.235 173.843 375.604 173.354ZM383.388 181.104C382.757 181.243 381.775 180.755 381.985 179.847C381.494 180.057 380.302 179.917 379.952 179.568C379.531 179.079 379.32 179.358 379.18 179.847C379.11 180.126 378.689 179.987 378.479 179.917C377.427 179.777 376.726 180.057 376.165 179.079C376.095 178.94 374.692 178.591 374.411 178.451C374.271 178.94 373.85 178.66 373.43 178.521C373.009 178.451 373.009 178.591 372.728 178.94C371.887 179.917 373.009 179.987 373.71 180.196C373.71 180.336 373.64 180.476 373.64 180.615C374.482 180.755 375.253 181.243 376.095 181.453C376.515 181.523 377.006 181.243 377.427 181.243C377.848 181.313 378.339 181.593 378.689 181.732C379.04 181.872 379.391 182.081 379.741 182.081C380.022 182.081 380.302 182.151 380.653 182.221C380.863 182.221 380.933 182.011 381.074 182.011C381.915 182.081 382.266 182.361 383.177 182.221C383.738 182.43 384.229 182.71 384.79 182.919C384.019 181.942 384.86 180.755 383.388 181.104ZM371.817 172.586C372.027 172.796 372.167 172.796 372.448 172.726C372.588 172.726 372.728 173.075 372.869 173.285C373.079 173.494 372.939 173.634 373.219 173.843C373.5 174.053 373.71 174.192 373.991 174.192C373.78 173.913 373.78 173.634 374.131 173.424C372.939 173.494 373.57 171.749 372.588 171.819C372.588 171.958 372.658 172.098 372.658 172.237C372.308 171.609 372.097 172.237 371.817 172.586Z" transform="translate(34 26) scale(2)" fill="white"/>
-</g>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(859.474 468.395) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(854.935 460.781) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(857.07 456.211) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(867.177 458.332) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(547.667 186.191) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(543.128 178.578) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(545.263 174.008) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(555.37 176.129) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(509.799 195.969) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(505.26 188.355) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(507.395 183.785) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(517.502 185.906) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(796.046 237.02) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(791.507 229.406) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(793.642 224.836) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(803.749 226.957) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(816.046 297.02) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(811.507 289.406) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(813.642 284.836) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(823.749 286.957) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(794.046 301.02) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(789.507 293.406) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(791.642 288.836) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(801.749 290.957) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(352.046 433.02) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(347.507 425.406) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(349.642 420.836) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(359.749 422.957) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(200.046 237.02) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(195.507 229.406) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(197.642 224.836) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(207.749 226.957) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(156.046 243.02) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(151.507 235.406) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(153.642 230.836) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(163.749 232.957) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(208.046 265.02) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(203.507 257.406) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(205.642 252.836) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(215.749 254.957) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(278.046 245.02) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(273.507 237.406) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(275.642 232.836) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(285.749 234.957) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0 2.36804C0.590364 2.71089 1.26641 2.92688 1.9936 2.97373C2.99795 3.03839 3.94806 2.77184 4.7373 2.26944C5.12975 2.01962 5.48213 1.71145 5.78153 1.35622C5.53323 1.01235 5.26904 0.657526 4.99001 0.296025L4.76202 0C4.46198 0.471461 4.03057 0.849314 3.52278 1.0857L2.7439 0.32652L0 2.36804Z" transform="translate(686.046 311.02) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M0.604584 0C0.268048 0.58226 0.0560402 1.24712 0.00960309 1.96155C-0.0554133 2.96241 0.212865 3.90916 0.718502 4.69527C0.968667 5.08428 1.27703 5.43372 1.6323 5.73085C1.97783 5.48362 2.33448 5.22058 2.69787 4.94286L2.99492 4.71637C2.52216 4.41772 2.14318 3.98873 1.90604 3.48384L2.67357 2.70084L0.604584 0Z" transform="translate(681.507 303.406) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M5.78206 0.616686C5.19117 0.273085 4.51439 0.0564579 3.78629 0.009566C2.78092 -0.0551811 1.82989 0.211895 1.04024 0.715243C0.649454 0.96431 0.298489 1.2713 0 1.62495C0.248345 1.96895 0.512562 2.32398 0.791518 2.68577L1.019 2.9815C1.31913 2.51066 1.75027 2.13325 2.25773 1.8972L2.99226 2.609L5.78206 0.616686Z" transform="translate(683.642 298.836) scale(2)" fill="black"/>
-<path fill-rule="evenodd" clip-rule="evenodd" d="M2.40197 5.71368C2.7324 5.13584 2.94121 4.47796 2.98716 3.77102C3.05213 2.77115 2.78441 1.82527 2.2797 1.03958C2.02876 0.648908 1.71919 0.298102 1.36237 0C1.01698 0.247188 0.660552 0.510198 0.297402 0.788014L0 1.01494C0.474427 1.31415 0.854625 1.74457 1.09198 2.25126L1.09653 2.2618L0.357757 3.02495L2.40197 5.71368Z" transform="translate(693.749 300.957) scale(2)" fill="black"/>
-<defs>
-<filter id="filter0_d" x="0" y="0" width="1046" height="594" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
-<feFlood flood-opacity="0" result="BackgroundImageFix"/>
-<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0"/>
-<feOffset dy="4"/>
-<feGaussianBlur stdDeviation="8.5"/>
-<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
-<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
-<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
-</filter>
-</defs>
-</svg>
diff --git a/packages/website/public/images/og_image.png b/packages/website/public/images/og_image.png
index 74265bdf8..b9bafeb7e 100644
--- a/packages/website/public/images/og_image.png
+++ b/packages/website/public/images/og_image.png
Binary files differ
diff --git a/packages/website/public/images/press/logo-forbes.png b/packages/website/public/images/press/logo-forbes.png
new file mode 100644
index 000000000..6849c672b
--- /dev/null
+++ b/packages/website/public/images/press/logo-forbes.png
Binary files differ
diff --git a/packages/website/public/images/press/logo-fortune.png b/packages/website/public/images/press/logo-fortune.png
new file mode 100644
index 000000000..981f8c357
--- /dev/null
+++ b/packages/website/public/images/press/logo-fortune.png
Binary files differ
diff --git a/packages/website/public/images/press/logo-techcrunch.png b/packages/website/public/images/press/logo-techcrunch.png
new file mode 100644
index 000000000..7f260d0ea
--- /dev/null
+++ b/packages/website/public/images/press/logo-techcrunch.png
Binary files differ
diff --git a/packages/website/public/images/press/logo-venturebeat.png b/packages/website/public/images/press/logo-venturebeat.png
new file mode 100644
index 000000000..2086bf0b7
--- /dev/null
+++ b/packages/website/public/images/press/logo-venturebeat.png
Binary files differ
diff --git a/packages/website/public/images/relayer-logos/logo.png b/packages/website/public/images/relayer-logos/logo.png
new file mode 100755
index 000000000..d810cef4a
--- /dev/null
+++ b/packages/website/public/images/relayer-logos/logo.png
Binary files differ
diff --git a/packages/website/public/images/relayer-logos/logo_1.png b/packages/website/public/images/relayer-logos/logo_1.png
new file mode 100755
index 000000000..0068a7445
--- /dev/null
+++ b/packages/website/public/images/relayer-logos/logo_1.png
Binary files differ
diff --git a/packages/website/public/images/relayer-logos/logo_2.1.png b/packages/website/public/images/relayer-logos/logo_2.1.png
new file mode 100755
index 000000000..f6cd92b0e
--- /dev/null
+++ b/packages/website/public/images/relayer-logos/logo_2.1.png
Binary files differ
diff --git a/packages/website/public/images/relayer-logos/logo_2.2.png b/packages/website/public/images/relayer-logos/logo_2.2.png
new file mode 100755
index 000000000..9461e91ee
--- /dev/null
+++ b/packages/website/public/images/relayer-logos/logo_2.2.png
Binary files differ
diff --git a/packages/website/public/images/relayer-logos/logo_2.3.png b/packages/website/public/images/relayer-logos/logo_2.3.png
new file mode 100755
index 000000000..fde896972
--- /dev/null
+++ b/packages/website/public/images/relayer-logos/logo_2.3.png
Binary files differ
diff --git a/packages/website/public/images/relayer-logos/logo_2.png b/packages/website/public/images/relayer-logos/logo_2.png
new file mode 100755
index 000000000..e3015110c
--- /dev/null
+++ b/packages/website/public/images/relayer-logos/logo_2.png
Binary files differ
diff --git a/packages/website/public/images/relayer-logos/logo_3.png b/packages/website/public/images/relayer-logos/logo_3.png
new file mode 100755
index 000000000..b3d397fe1
--- /dev/null
+++ b/packages/website/public/images/relayer-logos/logo_3.png
Binary files differ
diff --git a/packages/website/public/images/relayer-logos/logo_4.png b/packages/website/public/images/relayer-logos/logo_4.png
new file mode 100755
index 000000000..578be0af8
--- /dev/null
+++ b/packages/website/public/images/relayer-logos/logo_4.png
Binary files differ
diff --git a/packages/website/public/images/relayer-logos/logo_5.png b/packages/website/public/images/relayer-logos/logo_5.png
new file mode 100755
index 000000000..baf3c4080
--- /dev/null
+++ b/packages/website/public/images/relayer-logos/logo_5.png
Binary files differ
diff --git a/packages/website/public/images/social/discord.png b/packages/website/public/images/social/discord.png
new file mode 100644
index 000000000..1bdb07394
--- /dev/null
+++ b/packages/website/public/images/social/discord.png
Binary files differ
diff --git a/packages/website/public/images/social/rocketchat.png b/packages/website/public/images/social/rocketchat.png
deleted file mode 100644
index 58ff8d293..000000000
--- a/packages/website/public/images/social/rocketchat.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/advisors/davids.jpg b/packages/website/public/images/team/advisors/davids.jpg
new file mode 100755
index 000000000..904ebda01
--- /dev/null
+++ b/packages/website/public/images/team/advisors/davids.jpg
Binary files differ
diff --git a/packages/website/public/images/team/advisors/frede.jpg b/packages/website/public/images/team/advisors/frede.jpg
new file mode 100755
index 000000000..cb882c53f
--- /dev/null
+++ b/packages/website/public/images/team/advisors/frede.jpg
Binary files differ
diff --git a/packages/website/public/images/team/advisors/joeyk.jpg b/packages/website/public/images/team/advisors/joeyk.jpg
new file mode 100755
index 000000000..c6050242f
--- /dev/null
+++ b/packages/website/public/images/team/advisors/joeyk.jpg
Binary files differ
diff --git a/packages/website/public/images/team/advisors/lindax.jpg b/packages/website/public/images/team/advisors/lindax.jpg
new file mode 100755
index 000000000..766532068
--- /dev/null
+++ b/packages/website/public/images/team/advisors/lindax.jpg
Binary files differ
diff --git a/packages/website/public/images/team/advisors/olafc.jpg b/packages/website/public/images/team/advisors/olafc.jpg
new file mode 100755
index 000000000..bb0dc6cb5
--- /dev/null
+++ b/packages/website/public/images/team/advisors/olafc.jpg
Binary files differ
diff --git a/packages/website/public/images/team/alex.jpg b/packages/website/public/images/team/alex.jpg
deleted file mode 100644
index ae6888804..000000000
--- a/packages/website/public/images/team/alex.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/alexb.jpg b/packages/website/public/images/team/alexb.jpg
new file mode 100755
index 000000000..c076de14b
--- /dev/null
+++ b/packages/website/public/images/team/alexb.jpg
Binary files differ
diff --git a/packages/website/public/images/team/alexbrowne.png b/packages/website/public/images/team/alexbrowne.png
deleted file mode 100644
index 76a61913e..000000000
--- a/packages/website/public/images/team/alexbrowne.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/alexv.jpg b/packages/website/public/images/team/alexv.jpg
new file mode 100755
index 000000000..686f4a2e3
--- /dev/null
+++ b/packages/website/public/images/team/alexv.jpg
Binary files differ
diff --git a/packages/website/public/images/team/amir.png b/packages/website/public/images/team/amir.png
deleted file mode 100644
index 2bb795d50..000000000
--- a/packages/website/public/images/team/amir.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/amirb.jpg b/packages/website/public/images/team/amirb.jpg
new file mode 100755
index 000000000..19502735d
--- /dev/null
+++ b/packages/website/public/images/team/amirb.jpg
Binary files differ
diff --git a/packages/website/public/images/team/anyone.png b/packages/website/public/images/team/anyone.png
deleted file mode 100644
index 4de26b0ce..000000000
--- a/packages/website/public/images/team/anyone.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/ben.jpg b/packages/website/public/images/team/ben.jpg
deleted file mode 100644
index b42d0a42a..000000000
--- a/packages/website/public/images/team/ben.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/benb.jpg b/packages/website/public/images/team/benb.jpg
new file mode 100755
index 000000000..ef7fb69a9
--- /dev/null
+++ b/packages/website/public/images/team/benb.jpg
Binary files differ
diff --git a/packages/website/public/images/team/blake.jpg b/packages/website/public/images/team/blake.jpg
index 44ca0a311..0f5512af4 100644..100755
--- a/packages/website/public/images/team/blake.jpg
+++ b/packages/website/public/images/team/blake.jpg
Binary files differ
diff --git a/packages/website/public/images/team/brandon.png b/packages/website/public/images/team/brandon.png
deleted file mode 100644
index ebd3cf101..000000000
--- a/packages/website/public/images/team/brandon.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/brandonm.jpg b/packages/website/public/images/team/brandonm.jpg
new file mode 100755
index 000000000..72368f994
--- /dev/null
+++ b/packages/website/public/images/team/brandonm.jpg
Binary files differ
diff --git a/packages/website/public/images/team/chris.png b/packages/website/public/images/team/chris.png
deleted file mode 100644
index 242a2813f..000000000
--- a/packages/website/public/images/team/chris.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/chrisk.jpg b/packages/website/public/images/team/chrisk.jpg
new file mode 100755
index 000000000..cf900faea
--- /dev/null
+++ b/packages/website/public/images/team/chrisk.jpg
Binary files differ
diff --git a/packages/website/public/images/team/clay.png b/packages/website/public/images/team/clay.png
deleted file mode 100644
index 2bc828572..000000000
--- a/packages/website/public/images/team/clay.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/clayr.jpg b/packages/website/public/images/team/clayr.jpg
new file mode 100755
index 000000000..3fa550727
--- /dev/null
+++ b/packages/website/public/images/team/clayr.jpg
Binary files differ
diff --git a/packages/website/public/images/team/eugenea.jpg b/packages/website/public/images/team/eugenea.jpg
new file mode 100755
index 000000000..dc9aecea1
--- /dev/null
+++ b/packages/website/public/images/team/eugenea.jpg
Binary files differ
diff --git a/packages/website/public/images/team/fabio.jpg b/packages/website/public/images/team/fabio.jpg
deleted file mode 100644
index da87a9e95..000000000
--- a/packages/website/public/images/team/fabio.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/fabiob.jpg b/packages/website/public/images/team/fabiob.jpg
new file mode 100755
index 000000000..c06a06c9f
--- /dev/null
+++ b/packages/website/public/images/team/fabiob.jpg
Binary files differ
diff --git a/packages/website/public/images/team/fragosti.png b/packages/website/public/images/team/fragosti.png
deleted file mode 100644
index 60c168514..000000000
--- a/packages/website/public/images/team/fragosti.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/francesco.jpg b/packages/website/public/images/team/francesco.jpg
new file mode 100755
index 000000000..56ae0e870
--- /dev/null
+++ b/packages/website/public/images/team/francesco.jpg
Binary files differ
diff --git a/packages/website/public/images/team/gene.jpg b/packages/website/public/images/team/gene.jpg
deleted file mode 100644
index 1d4222118..000000000
--- a/packages/website/public/images/team/gene.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/greg.jpeg b/packages/website/public/images/team/greg.jpeg
deleted file mode 100644
index a765e047f..000000000
--- a/packages/website/public/images/team/greg.jpeg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/greg.jpg b/packages/website/public/images/team/greg.jpg
new file mode 100755
index 000000000..0b6df7083
--- /dev/null
+++ b/packages/website/public/images/team/greg.jpg
Binary files differ
diff --git a/packages/website/public/images/team/jacob.jpg b/packages/website/public/images/team/jacob.jpg
deleted file mode 100644
index de8b9e4b5..000000000
--- a/packages/website/public/images/team/jacob.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/jacobe.jpg b/packages/website/public/images/team/jacobe.jpg
new file mode 100755
index 000000000..29eed406d
--- /dev/null
+++ b/packages/website/public/images/team/jacobe.jpg
Binary files differ
diff --git a/packages/website/public/images/team/jason.png b/packages/website/public/images/team/jason.png
deleted file mode 100644
index a39522252..000000000
--- a/packages/website/public/images/team/jason.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/jasons.jpg b/packages/website/public/images/team/jasons.jpg
new file mode 100755
index 000000000..b0a40edba
--- /dev/null
+++ b/packages/website/public/images/team/jasons.jpg
Binary files differ
diff --git a/packages/website/public/images/team/leonid.png b/packages/website/public/images/team/leonid.png
deleted file mode 100644
index 4acbf87c8..000000000
--- a/packages/website/public/images/team/leonid.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/leonidL.jpg b/packages/website/public/images/team/leonidL.jpg
new file mode 100755
index 000000000..e3dfd6a7d
--- /dev/null
+++ b/packages/website/public/images/team/leonidL.jpg
Binary files differ
diff --git a/packages/website/public/images/team/matt.jpg b/packages/website/public/images/team/matt.jpg
deleted file mode 100644
index 101209c37..000000000
--- a/packages/website/public/images/team/matt.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/mattt.jpg b/packages/website/public/images/team/mattt.jpg
new file mode 100755
index 000000000..03f95a7c1
--- /dev/null
+++ b/packages/website/public/images/team/mattt.jpg
Binary files differ
diff --git a/packages/website/public/images/team/mel.png b/packages/website/public/images/team/mel.png
deleted file mode 100644
index 52d779ad2..000000000
--- a/packages/website/public/images/team/mel.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/melo.jpg b/packages/website/public/images/team/melo.jpg
new file mode 100755
index 000000000..2db8ec796
--- /dev/null
+++ b/packages/website/public/images/team/melo.jpg
Binary files differ
diff --git a/packages/website/public/images/team/peter.jpg b/packages/website/public/images/team/peter.jpg
deleted file mode 100644
index fa976cb8d..000000000
--- a/packages/website/public/images/team/peter.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/peterz.jpg b/packages/website/public/images/team/peterz.jpg
new file mode 100755
index 000000000..7708c75db
--- /dev/null
+++ b/packages/website/public/images/team/peterz.jpg
Binary files differ
diff --git a/packages/website/public/images/team/rahul.png b/packages/website/public/images/team/rahul.png
deleted file mode 100644
index b63cc12b1..000000000
--- a/packages/website/public/images/team/rahul.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/rahuls.jpg b/packages/website/public/images/team/rahuls.jpg
new file mode 100755
index 000000000..ef2f001dd
--- /dev/null
+++ b/packages/website/public/images/team/rahuls.jpg
Binary files differ
diff --git a/packages/website/public/images/team/remco.jpeg b/packages/website/public/images/team/remco.jpeg
deleted file mode 100644
index e87e7bfd6..000000000
--- a/packages/website/public/images/team/remco.jpeg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/remcoB.jpg b/packages/website/public/images/team/remcoB.jpg
new file mode 100755
index 000000000..bc997a18e
--- /dev/null
+++ b/packages/website/public/images/team/remcoB.jpg
Binary files differ
diff --git a/packages/website/public/images/team/steve.png b/packages/website/public/images/team/steve.png
deleted file mode 100644
index 751583fba..000000000
--- a/packages/website/public/images/team/steve.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/steveK.jpg b/packages/website/public/images/team/steveK.jpg
new file mode 100755
index 000000000..aeede8bc5
--- /dev/null
+++ b/packages/website/public/images/team/steveK.jpg
Binary files differ
diff --git a/packages/website/public/images/team/tom.jpg b/packages/website/public/images/team/tom.jpg
deleted file mode 100644
index 3623a2b78..000000000
--- a/packages/website/public/images/team/tom.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/toms.jpg b/packages/website/public/images/team/toms.jpg
new file mode 100755
index 000000000..9d9dd2db8
--- /dev/null
+++ b/packages/website/public/images/team/toms.jpg
Binary files differ
diff --git a/packages/website/public/images/team/weijew.jpg b/packages/website/public/images/team/weijew.jpg
new file mode 100755
index 000000000..0b2464e67
--- /dev/null
+++ b/packages/website/public/images/team/weijew.jpg
Binary files differ
diff --git a/packages/website/public/images/team/weijie.png b/packages/website/public/images/team/weijie.png
deleted file mode 100644
index 69fd51794..000000000
--- a/packages/website/public/images/team/weijie.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/will.jpg b/packages/website/public/images/team/will.jpg
deleted file mode 100644
index 7de028032..000000000
--- a/packages/website/public/images/team/will.jpg
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/willw.jpg b/packages/website/public/images/team/willw.jpg
new file mode 100755
index 000000000..c1bd8f406
--- /dev/null
+++ b/packages/website/public/images/team/willw.jpg
Binary files differ
diff --git a/packages/website/public/images/team/xianny.jpg b/packages/website/public/images/team/xianny.jpg
new file mode 100755
index 000000000..4e6a3bb8c
--- /dev/null
+++ b/packages/website/public/images/team/xianny.jpg
Binary files differ
diff --git a/packages/website/public/images/team/zach.png b/packages/website/public/images/team/zach.png
deleted file mode 100644
index 4565a9af0..000000000
--- a/packages/website/public/images/team/zach.png
+++ /dev/null
Binary files differ
diff --git a/packages/website/public/images/team/zack.jpg b/packages/website/public/images/team/zack.jpg
new file mode 100755
index 000000000..9060d7592
--- /dev/null
+++ b/packages/website/public/images/team/zack.jpg
Binary files differ
diff --git a/packages/website/public/index.html b/packages/website/public/index.html
index a8a61f8ad..26ebcdec8 100644
--- a/packages/website/public/index.html
+++ b/packages/website/public/index.html
@@ -1,95 +1,133 @@
<!DOCTYPE html>
<html>
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <meta name="description" content="An Open Protocol For Decentralized Exchange On The Ethereum Blockchain" />
+ <meta property="og:type" content="website" />
+ <meta property="og:title" content="0x" />
+ <meta
+ property="og:description"
+ content="An Open Protocol For Decentralized Exchange On The Ethereum Blockchain"
+ />
+ <meta property="og:image" content="/images/og_image.png" />
+ <title>0x: The Protocol for Trading Tokens</title>
+ <link rel="icon" type="image/png" href="/images/favicon/favicon-2-32x32.png" sizes="32x32" />
+ <link rel="icon" type="image/png" href="/images/favicon/favicon-2-16x16.png" sizes="16x16" />
+ <link rel="stylesheet" href="/css/material-design-iconic-font.min.css" />
+ <link rel="stylesheet" href="/css/roboto.css" />
+ <link rel="stylesheet" href="/css/roboto_mono.css" />
+ <link rel="stylesheet" href="/css/formular.css" />
+ <link rel="stylesheet" href="/css/basscss_responsive_custom.css" />
+ <link rel="stylesheet" href="/css/basscss_responsive_padding.css" />
+ <link rel="stylesheet" href="/css/basscss_responsive_margin.css" />
+ <link rel="stylesheet" href="/css/basscss_responsive_type_scale.css" />
+ </head>
-<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="description" content="An Open Protocol For Decentralized Exchange On The Ethereum Blockchain" />
- <meta property="og:type" content="website" />
- <meta property="og:title" content="0x" />
- <meta property="og:description" content="An Open Protocol For Decentralized Exchange On The Ethereum Blockchain" />
- <meta property="og:image" content="/images/og_image.png" />
- <title>0x: The Protocol for Trading Tokens</title>
- <link rel="icon" type="image/png" href="/images/favicon/favicon-2-32x32.png" sizes="32x32" />
- <link rel="icon" type="image/png" href="/images/favicon/favicon-2-16x16.png" sizes="16x16" />
- <link rel="stylesheet" href="/css/github-gist.css">
- <link rel="stylesheet" href="/css/material-design-iconic-font.min.css">
- <link rel="stylesheet" href="/css/roboto.css">
- <link rel="stylesheet" href="/css/roboto_mono.css">
- <link rel="stylesheet" href="/css/basscss_responsive_custom.css">
- <link rel="stylesheet" href="/css/basscss_responsive_padding.css">
- <link rel="stylesheet" href="/css/basscss_responsive_margin.css">
- <link rel="stylesheet" href="/css/basscss_responsive_type_scale.css">
-</head>
+ <body style="margin: 0px; min-width: 355px;">
+ <!-- Heap SDK -->
+ <script type="text/javascript">
+ (window.heap = window.heap || []),
+ (heap.load = function(e, t) {
+ (window.heap.appid = e), (window.heap.config = t = t || {});
+ var r = t.forceSSL || 'https:' === document.location.protocol,
+ a = document.createElement('script');
+ (a.type = 'text/javascript'),
+ (a.async = !0),
+ (a.src = (r ? 'https:' : 'http:') + '//cdn.heapanalytics.com/js/heap-' + e + '.js');
+ var n = document.getElementsByTagName('script')[0];
+ n.parentNode.insertBefore(a, n);
+ for (
+ var o = function(e) {
+ return function() {
+ heap.push([e].concat(Array.prototype.slice.call(arguments, 0)));
+ };
+ },
+ p = [
+ 'addEventProperties',
+ 'addUserProperties',
+ 'clearEventProperties',
+ 'identify',
+ 'resetIdentity',
+ 'removeEventProperty',
+ 'setEventProperties',
+ 'track',
+ 'unsetEventProperty',
+ ],
+ c = 0;
+ c < p.length;
+ c++
+ )
+ heap[p[c]] = o(p[c]);
+ });
+ heap.load('410099666');
+ </script>
+ <!-- End Heap SDK -->
+ <!-- Global site tag (gtag.js) - Google Analytics -->
+ <script async src="https://www.googletagmanager.com/gtag/js?id=UA-98720122-1"></script>
+ <script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag() {
+ dataLayer.push(arguments);
+ }
+ gtag('js', new Date());
-<body style="margin: 0px; min-width: 355px;">
- <!-- Heap SDK -->
- <script type="text/javascript">
- window.heap = window.heap || [], heap.load = function (e, t) { window.heap.appid = e, window.heap.config = t = t || {}; var r = t.forceSSL || "https:" === document.location.protocol, a = document.createElement("script"); a.type = "text/javascript", a.async = !0, a.src = (r ? "https:" : "http:") + "//cdn.heapanalytics.com/js/heap-" + e + ".js"; var n = document.getElementsByTagName("script")[0]; n.parentNode.insertBefore(a, n); for (var o = function (e) { return function () { heap.push([e].concat(Array.prototype.slice.call(arguments, 0))) } }, p = ["addEventProperties", "addUserProperties", "clearEventProperties", "identify", "resetIdentity", "removeEventProperty", "setEventProperties", "track", "unsetEventProperty"], c = 0; c < p.length; c++)heap[p[c]] = o(p[c]) };
- heap.load("410099666");
- </script>
- <!-- End Heap SDK -->
- <!-- Global site tag (gtag.js) - Google Analytics -->
- <script async src="https://www.googletagmanager.com/gtag/js?id=UA-98720122-1"></script>
- <script>
- window.dataLayer = window.dataLayer || [];
- function gtag() {
- dataLayer.push(arguments);
- }
- gtag('js', new Date());
+ gtag('config', 'UA-98720122-1');
+ </script>
+ <!-- End Google Analytics -->
+ <!-- Facebook SDK -->
+ <div id="fb-root"></div>
+ <script>
+ (function(d, s, id) {
+ var js,
+ fjs = d.getElementsByTagName(s)[0];
+ if (d.getElementById(id)) return;
+ js = d.createElement(s);
+ js.id = id;
+ js.src = '//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8&appId=1687545238205192';
+ fjs.parentNode.insertBefore(js, fjs);
+ })(document, 'script', 'facebook-jssdk');
+ </script>
+ <div id="app"></div>
+ <!-- End Facebook SDK -->
+ <!-- Twitter SDK -->
+ <script>
+ window.twttr = (function(d, s, id) {
+ var js,
+ fjs = d.getElementsByTagName(s)[0],
+ t = window.twttr || {};
+ if (d.getElementById(id)) return t;
+ js = d.createElement(s);
+ js.id = id;
+ js.src = 'https://platform.twitter.com/widgets.js';
+ fjs.parentNode.insertBefore(js, fjs);
- gtag('config', 'UA-98720122-1');
- </script>
- <!-- End Google Analytics -->
- <!-- Facebook SDK -->
- <div id="fb-root"></div>
- <script>
- (function (d, s, id) {
- var js,
- fjs = d.getElementsByTagName(s)[0];
- if (d.getElementById(id)) return;
- js = d.createElement(s);
- js.id = id;
- js.src = '//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8&appId=1687545238205192';
- fjs.parentNode.insertBefore(js, fjs);
- })(document, 'script', 'facebook-jssdk');
- </script>
- <div id="app"></div>
- <!-- End Facebook SDK -->
- <!-- Twitter SDK -->
- <script>
- window.twttr = (function (d, s, id) {
- var js,
- fjs = d.getElementsByTagName(s)[0],
- t = window.twttr || {};
- if (d.getElementById(id)) return t;
- js = d.createElement(s);
- js.id = id;
- js.src = 'https://platform.twitter.com/widgets.js';
- fjs.parentNode.insertBefore(js, fjs);
-
- t._e = [];
- t.ready = function (f) {
- t._e.push(f);
- };
- return t;
- })(document, 'script', 'twitter-wjs');
- </script>
- <!-- End Twitter SDK -->
- <!-- Hotjar Tracking Code for https://0xproject.com/ -->
- <script>
- (function (h, o, t, j, a, r) {
- h.hj = h.hj || function () { (h.hj.q = h.hj.q || []).push(arguments) };
- h._hjSettings = { hjid: 935597, hjsv: 6 };
- a = o.getElementsByTagName('head')[0];
- r = o.createElement('script'); r.async = 1;
- r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
- a.appendChild(r);
- })(window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv=');
- </script>
- <!-- End Hotjar Tracking Code -->
- <!-- Main -->
- <script type="text/javascript" crossorigin="anonymous" src="/bundle.js" charset="utf-8"></script>
-</body>
-
-</html> \ No newline at end of file
+ t._e = [];
+ t.ready = function(f) {
+ t._e.push(f);
+ };
+ return t;
+ })(document, 'script', 'twitter-wjs');
+ </script>
+ <!-- End Twitter SDK -->
+ <!-- Hotjar Tracking Code for https://0x.org/ -->
+ <script>
+ (function(h, o, t, j, a, r) {
+ h.hj =
+ h.hj ||
+ function() {
+ (h.hj.q = h.hj.q || []).push(arguments);
+ };
+ h._hjSettings = { hjid: 935597, hjsv: 6 };
+ a = o.getElementsByTagName('head')[0];
+ r = o.createElement('script');
+ r.async = 1;
+ r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;
+ a.appendChild(r);
+ })(window, document, 'https://static.hotjar.com/c/hotjar-', '.js?sv=');
+ </script>
+ <!-- End Hotjar Tracking Code -->
+ <!-- Main -->
+ <script type="text/javascript" crossorigin="anonymous" src="/bundle.js" charset="utf-8"></script>
+ </body>
+</html>
diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json
index eb88b43d0..88193a181 100644
--- a/packages/website/translations/chinese.json
+++ b/packages/website/translations/chinese.json
@@ -67,6 +67,7 @@
"BLOG": "博客",
"FORUM": "论坛",
"CONNECT": "0x 连接",
+ "PROTOCOL_SPECIFICATION": "protocol specification",
"WHITEPAPER": "白皮书",
"WIKI": "维基",
"WEB3_WRAPPER": "Web3Wrapper",
@@ -76,13 +77,13 @@
"STANDARD_RELAYER_API": "中继方标准API",
"PORTAL_DAPP": "去中心化应用门户",
"WEBSITE": "网站",
- "DEVELOPERS": "首页",
- "HOME": "Rocket.chat",
- "ROCKETCHAT": "开发人员",
+ "DEVELOPERS": "开发人员",
+ "HOME": "首页",
+ "DISCORD": "discord chat",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
- "DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
+ "DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications on top of Ethereum",
"ORDER_BASICS": "Make & take orders",
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json
index 5fba7a0ff..a1d8ecc43 100644
--- a/packages/website/translations/english.json
+++ b/packages/website/translations/english.json
@@ -69,6 +69,7 @@
"BLOG": "blog",
"FORUM": "forum",
"CONNECT": "0x Connect",
+ "PROTOCOL_SPECIFICATION": "protocol specification",
"WHITEPAPER": "whitepaper",
"WIKI": "wiki",
"WEB3_WRAPPER": "Web3Wrapper",
@@ -81,16 +82,19 @@
"WEBSITE": "website",
"DEVELOPERS": "developers",
"HOME": "home",
- "ROCKETCHAT": "rocket.chat",
+ "DISCORD": "discord chat",
"TRADE_CALL_TO_ACTION": "trade on 0x",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
- "DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
+ "DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications on top of Ethereum",
"ORDER_BASICS": "Make & take orders",
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
"USE_NETWORKED_LIQUIDITY_DESCRIPTION": "Learn how to tap into networked liquidity using the Standard Relayer API",
+ "INTEGRATE_0X_INSTANT": "add seamless purchasing of crypto assets to your website or app",
+ "INTEGRATE_0X_INSTANT_DESCRIPTION":
+ "learn how to use 0x Instant or AssetBuyer to give your users the power of purchasing crypto assets using 0x",
"VIEW_ALL_DOCUMENTATION": "view all documentation",
"SANDBOX": "0x.js sandbox",
"GITHUB": "github",
diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json
index e3ce74676..539b81470 100644
--- a/packages/website/translations/korean.json
+++ b/packages/website/translations/korean.json
@@ -67,6 +67,7 @@
"BLOG": "블로그",
"FORUM": "포럼",
"CONNECT": "0x Connect",
+ "PROTOCOL_SPECIFICATION": "protocol specification",
"WHITEPAPER": "백서",
"WIKI": "위키",
"WEB3_WRAPPER": "Web3Wrapper",
@@ -77,12 +78,12 @@
"PORTAL_DAPP": "포털 dApp",
"WEBSITE": "Website",
"HOME": "홈",
- "ROCKETCHAT": "Rocket.chat",
+ "DISCORD": "discord chat",
"DEVELOPERS": "개발자",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
- "DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
+ "DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications on top of Ethereum",
"ORDER_BASICS": "Make & take orders",
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json
index c74fb5e32..feb5df02e 100644
--- a/packages/website/translations/russian.json
+++ b/packages/website/translations/russian.json
@@ -67,6 +67,7 @@
"BLOG": "Блог",
"FORUM": "Форум",
"CONNECT": "0x Connect",
+ "PROTOCOL_SPECIFICATION": "protocol specification",
"WHITEPAPER": "Whitepaper",
"WIKI": "Вики",
"WEB3_WRAPPER": "Web3Wrapper",
@@ -76,13 +77,13 @@
"STANDARD_RELAYER_API": "standard relayer API",
"PORTAL_DAPP": "DApp-портал",
"WEBSITE": "Веб-сайт",
- "DEVELOPERS": "Домашняя страница",
- "HOME": "Rocket.chat",
- "ROCKETCHAT": "Для разработчиков",
+ "DEVELOPERS": "Для разработчиков",
+ "HOME": "Домашняя страница",
+ "DISCORD": "discord chat",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
- "DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
+ "DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications on top of Ethereum",
"ORDER_BASICS": "Make & take orders",
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json
index e29db711b..f4762a67e 100644
--- a/packages/website/translations/spanish.json
+++ b/packages/website/translations/spanish.json
@@ -68,6 +68,7 @@
"BLOG": "blog",
"FORUM": "foro",
"CONNECT": "0x Connect",
+ "PROTOCOL_SPECIFICATION": "protocol specification",
"WHITEPAPER": "documento técnico",
"WIKI": "wiki",
"WEB3_WRAPPER": "Web3Wrapper",
@@ -77,13 +78,13 @@
"STANDARD_RELAYER_API": "API de transmisión estándar",
"PORTAL_DAPP": "portal dApp",
"WEBSITE": "website",
- "DEVELOPERS": "inicio",
- "HOME": "rocket.chat",
- "ROCKETCHAT": "desarrolladores",
+ "DEVELOPERS": "desarrolladores",
+ "HOME": "inicio",
+ "DISCORD": "discord chat",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
- "DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications ontop of Ethereum",
+ "DEVELOP_ON_ETHEREUM_DESCRIPTION": "Learn more about building applications on top of Ethereum",
"ORDER_BASICS": "Make & take orders",
"ORDER_BASICS_DESCRIPTION": "Tutorial on how to create, validate and fill an order using 0x",
"USE_NETWORKED_LIQUIDITY": "use networked liquidity",
diff --git a/packages/website/ts/components/aboutPageLayout.tsx b/packages/website/ts/components/aboutPageLayout.tsx
new file mode 100644
index 000000000..a2fd9dd72
--- /dev/null
+++ b/packages/website/ts/components/aboutPageLayout.tsx
@@ -0,0 +1,71 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { Button } from 'ts/components/button';
+import { ChapterLink } from 'ts/components/chapter_link';
+import { Column, Section } from 'ts/components/newLayout';
+import { SiteWrap } from 'ts/components/siteWrap';
+import { Heading, Paragraph } from 'ts/components/text';
+
+import { addFadeInAnimation } from 'ts/constants/animations';
+import { WebsitePaths } from 'ts/types';
+
+interface Props {
+ title: string;
+ description: React.ReactNode | string;
+ linkLabel?: string;
+ href?: string;
+ to?: string;
+ children?: React.ReactNode;
+}
+
+export const AboutPageLayout = (props: Props) => (
+ <SiteWrap theme="light">
+ <Section isFlex={true} maxWidth="1170px" wrapWidth="100%">
+ <Column>
+ <ChapterLink to={WebsitePaths.AboutMission}>Mission</ChapterLink>
+ <ChapterLink to={WebsitePaths.AboutTeam}>Team</ChapterLink>
+ <ChapterLink to={WebsitePaths.AboutPress}>Press</ChapterLink>
+ <ChapterLink to={WebsitePaths.AboutJobs}>Jobs</ChapterLink>
+ </Column>
+
+ <Column width="70%" maxWidth="800px">
+ <Column width="100%" maxWidth="680px">
+ <AnimatedHeading size="medium">{props.title}</AnimatedHeading>
+
+ <AnimatedParagraph size="medium" marginBottom="60px" isMuted={0.65}>
+ {props.description}
+ </AnimatedParagraph>
+
+ {props.linkLabel &&
+ (props.href || props.to) && (
+ <AnimatedLink
+ to={props.to}
+ href={props.href}
+ target={!_.isUndefined(props.href) ? '_blank' : undefined}
+ isWithArrow={true}
+ isAccentColor={true}
+ >
+ {props.linkLabel}
+ </AnimatedLink>
+ )}
+ </Column>
+ </Column>
+ </Section>
+
+ {props.children}
+ </SiteWrap>
+);
+
+const AnimatedHeading = styled(Heading)`
+ ${addFadeInAnimation('0.5s')};
+`;
+
+const AnimatedParagraph = styled(Paragraph)`
+ ${addFadeInAnimation('0.5s', '0.15s')};
+`;
+
+const AnimatedLink = styled(Button)`
+ ${addFadeInAnimation('0.6s', '0.3s')};
+`;
diff --git a/packages/website/ts/components/animatedChatIcon.tsx b/packages/website/ts/components/animatedChatIcon.tsx
new file mode 100644
index 000000000..9a86e244c
--- /dev/null
+++ b/packages/website/ts/components/animatedChatIcon.tsx
@@ -0,0 +1,106 @@
+import * as React from 'react';
+import styled, { keyframes } from 'styled-components';
+
+export const AnimatedChatIcon = () => (
+ <svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <mask id="mask30" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="150" height="150">
+ <circle cx="75" cy="75" r="73" fill="#00AE99" stroke="#00AE99" stroke-width="3" />
+ </mask>
+
+ <g mask="url(#mask30)">
+ <circle cx="75" cy="75" r="73" stroke="#00AE99" stroke-width="3" />
+
+ <Rays>
+ <path vector-effect="non-scaling-stroke" d="M76 37H137.5" stroke="#00AE99" stroke-width="3" />
+ <path
+ vector-effect="non-scaling-stroke"
+ d="M37 73.5L37 12M113 137.5L113 75"
+ stroke="#00AE99"
+ stroke-width="3"
+ />
+ <path vector-effect="non-scaling-stroke" d="M13 113H71.5" stroke="#00AE99" stroke-width="3" />
+ <path
+ vector-effect="non-scaling-stroke"
+ d="M49.087 47.5264L92.574 4.03932"
+ stroke="#00AE99"
+ stroke-width="3"
+ />
+ <path
+ vector-effect="non-scaling-stroke"
+ d="M47.3192 100.913L3.8321 57.4259M146.314 92.4277L102.12 48.2335"
+ stroke="#00AE99"
+ stroke-width="3"
+ />
+ <path
+ vector-effect="non-scaling-stroke"
+ d="M58.2793 145.814L101.766 102.327"
+ stroke="#00AE99"
+ stroke-width="3"
+ />
+ </Rays>
+
+ <Bubble>
+ <path
+ vector-effect="non-scaling-stroke"
+ d="M113 75C113 85.3064 108.897 94.6546 102.235 101.5C98.4048 105.436 71 132.5 71 132.5V112.792C51.8933 110.793 37 94.6359 37 75C37 54.0132 54.0132 37 75 37C95.9868 37 113 54.0132 113 75Z"
+ stroke="#00AE99"
+ strokeWidth="3"
+ />
+ </Bubble>
+
+ <Dot delay={0} vector-effect="non-scaling-stroke" cx="75" cy="75" r="4" stroke="#00AE99" strokeWidth="3" />
+ <Dot
+ delay={4.4}
+ vector-effect="non-scaling-stroke"
+ cx="91"
+ cy="75"
+ r="4"
+ stroke="#00AE99"
+ strokeWidth="3"
+ />
+ <Dot
+ delay={-4.6}
+ vector-effect="non-scaling-stroke"
+ cx="59"
+ cy="75"
+ r="4"
+ stroke="#00AE99"
+ strokeWidth="3"
+ />
+ </g>
+ </svg>
+);
+
+const scale = keyframes`
+ 0% { transform: scale(1.2) }
+ 15% { transform: scale(1) }
+ 85% { transform: scale(1) }
+ 100% { transform: scale(1.2) }
+`;
+
+const fadeInOut = keyframes`
+ 0%, 30%, 50%, 100% {
+ transform: initial;
+ }
+
+ 40% {
+ transform: translateY(-5px);
+ }
+`;
+
+const Bubble = styled.g`
+ animation: ${scale} 4s infinite cubic-bezier(0.175, 0.885, 0.32, 1.275);
+ transform-origin: 50% 50%;
+`;
+
+const Rays = styled.g`
+ animation: ${scale} 4s infinite cubic-bezier(0.175, 0.885, 0.32, 1.275);
+ transform-origin: 50% 50%;
+`;
+
+const Dot =
+ styled.circle <
+ { delay: number } >
+ `
+ animation: ${fadeInOut} 4s ${props => `${props.delay}s`} infinite;
+`;
diff --git a/packages/website/ts/components/animatedCompassIcon.tsx b/packages/website/ts/components/animatedCompassIcon.tsx
new file mode 100644
index 000000000..5388f95ca
--- /dev/null
+++ b/packages/website/ts/components/animatedCompassIcon.tsx
@@ -0,0 +1,53 @@
+import * as React from 'react';
+import styled, { keyframes } from 'styled-components';
+
+export const AnimatedCompassIcon = () => (
+ <svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <g>
+ <circle cx="75" cy="75" r="73" stroke="#00AE99" stroke-width="3" />
+ <circle cx="75" cy="75" r="58" stroke="#00AE99" stroke-width="3" />
+ <Needle
+ d="M62.9792 62.9792L36.6447 113.355L87.0208 87.0208M62.9792 62.9792L113.355 36.6447L87.0208 87.0208M62.9792 62.9792L87.0208 87.0208"
+ stroke="#00AE99"
+ strokeWidth="3"
+ />
+
+ <Dial>
+ <path d="M75 2V17M75 133V148" stroke="#00AE99" stroke-width="3" />
+ <path d="M2 75L17 75M133 75L148 75" stroke="#00AE99" stroke-width="3" />
+ <path d="M11.7801 38.5L24.7705 46M125.229 104L138.22 111.5" stroke="#00AE99" stroke-width="3" />
+ <path d="M38.5001 11.7801L46.0001 24.7705M104 125.229L111.5 138.22" stroke="#00AE99" stroke-width="3" />
+ <path d="M111.5 11.7801L104 24.7705M46 125.229L38.5 138.22" stroke="#00AE99" stroke-width="3" />
+ <path d="M138.22 38.5L125.229 46M24.7705 104L11.7801 111.5" stroke="#00AE99" stroke-width="3" />
+ </Dial>
+ </g>
+ </svg>
+);
+
+const point = keyframes`
+ 0% { transform: rotate(0deg) }
+ 20% { transform: rotate(10deg) }
+ 30% { transform: rotate(30deg) }
+ 60% { transform: rotate(-20deg) }
+ 80% { transform: rotate(-20deg) }
+ 100% { transform: rotate(0deg) }
+`;
+
+const rotate = keyframes`
+ 0% { transform: rotate(0deg) }
+ 20% { transform: rotate(-10deg) }
+ 30% { transform: rotate(-30deg) }
+ 60% { transform: rotate(20deg) }
+ 80% { transform: rotate(20deg) }
+ 100% { transform: rotate(0deg) }
+`;
+
+const Needle = styled.path`
+ animation: ${point} 5s infinite;
+ transform-origin: 50% 50%;
+`;
+
+const Dial = styled.g`
+ animation: ${rotate} 5s infinite;
+ transform-origin: 50% 50%;
+`;
diff --git a/packages/website/ts/components/banner.tsx b/packages/website/ts/components/banner.tsx
new file mode 100644
index 000000000..76fc1d09e
--- /dev/null
+++ b/packages/website/ts/components/banner.tsx
@@ -0,0 +1,147 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { colors } from 'ts/style/colors';
+
+import { Button } from 'ts/components/button';
+import { ThemeInterface } from 'ts/components/siteWrap';
+import { Paragraph } from 'ts/components/text';
+
+import { Column, Section } from 'ts/components/newLayout';
+
+interface Props {
+ heading?: string;
+ subline?: string;
+ mainCta?: CTAButton;
+ secondaryCta?: CTAButton;
+ theme?: ThemeInterface;
+}
+
+interface CTAButton {
+ text: string;
+ href?: string;
+ onClick?: () => void;
+ shouldOpenInNewTab?: boolean;
+}
+
+interface BorderProps {
+ isBottom?: boolean;
+}
+
+export const Banner: React.StatelessComponent<Props> = (props: Props) => {
+ const { heading, subline, mainCta, secondaryCta } = props;
+ return (
+ <CustomSection bgColor={colors.brandDark} isFlex={true} flexBreakpoint="900px" paddingMobile="120px 0">
+ <Border />
+ <Border isBottom={true} />
+
+ <Column>
+ <CustomHeading>{heading}</CustomHeading>
+
+ {subline && (
+ <Paragraph color={colors.white} isMuted={0.5} isNoMargin={true}>
+ {subline}
+ </Paragraph>
+ )}
+ </Column>
+ <Column>
+ <ButtonWrap>
+ {mainCta && (
+ <Button
+ color={colors.white}
+ isTransparent={false}
+ href={mainCta.href}
+ target={mainCta.shouldOpenInNewTab ? '_blank' : ''}
+ >
+ {mainCta.text}
+ </Button>
+ )}
+
+ {secondaryCta && (
+ <Button
+ color={colors.white}
+ href={secondaryCta.href}
+ onClick={secondaryCta.onClick}
+ isTransparent={true}
+ >
+ {secondaryCta.text}
+ </Button>
+ )}
+ </ButtonWrap>
+ </Column>
+ </CustomSection>
+ );
+};
+
+const CustomSection = styled(Section)`
+ color: ${colors.white};
+ margin-top: 30px;
+
+ @media (max-width: 900px) {
+ text-align: center;
+
+ p {
+ margin-bottom: 30px;
+ }
+
+ div:last-child {
+ margin-bottom: 0;
+ }
+ }
+`;
+
+const CustomHeading = styled.h2`
+ font-size: 34px;
+ font-weight: 400;
+ margin-bottom: 10px @media (max-width: 768px) {
+ font-size: 30px;
+ }
+`;
+
+const ButtonWrap = styled.div`
+ display: inline-block;
+
+ @media (min-width: 768px) {
+ * + * {
+ margin-left: 15px;
+ }
+ }
+
+ @media (max-width: 768px) {
+ a,
+ button {
+ display: block;
+ width: 220px;
+ }
+
+ * + * {
+ margin-top: 15px;
+ }
+ }
+`;
+
+// Note let's refactor this
+// is it absolutely necessary to have a stateless component
+// to pass props down into the styled icon?
+const Border =
+ styled.div <
+ BorderProps >
+ `
+ position: absolute;
+ background-image: ${props =>
+ props.isBottom ? 'url(/images/banner/bottomofcta.png);' : 'url(/images/banner/topofcta.png);'};
+ background-position: ${props => (props.isBottom ? 'left top' : 'left bottom')};
+ left: 0;
+ width: calc(100% + 214px);
+ height: 40px;
+ top: ${props => !props.isBottom && 0};
+ bottom: ${props => props.isBottom && 0};
+ transform: translate(-112px);
+
+ @media (max-width: 768px) {
+ width: calc(100% + 82px);
+ height: 40px;
+ transform: translate(-41px);
+ background-size: auto 80px;
+ }
+`;
diff --git a/packages/website/ts/components/blockIconLink.tsx b/packages/website/ts/components/blockIconLink.tsx
new file mode 100644
index 000000000..ff7712595
--- /dev/null
+++ b/packages/website/ts/components/blockIconLink.tsx
@@ -0,0 +1,84 @@
+import { History, Location } from 'history';
+import * as React from 'react';
+import { match, withRouter } from 'react-router-dom';
+import styled from 'styled-components';
+
+import { Button } from 'ts/components/button';
+import { Icon } from 'ts/components/icon';
+
+interface BaseComponentProps {
+ icon?: string;
+ iconComponent?: React.ReactNode;
+ title: string;
+ linkLabel: string;
+ linkUrl?: string;
+ linkAction?: () => void;
+ history: History;
+ location: Location;
+ match: match<any>;
+}
+
+class BaseComponent extends React.PureComponent<BaseComponentProps> {
+ public onClick = (): void => {
+ const { linkAction, linkUrl } = this.props;
+
+ if (linkAction) {
+ linkAction();
+ } else {
+ this.props.history.push(linkUrl);
+ }
+ };
+
+ public render(): React.ReactNode {
+ const { icon, iconComponent, linkUrl, linkAction, title, linkLabel } = this.props;
+
+ return (
+ <Wrap onClick={this.onClick}>
+ <div>
+ <Icon name={icon} component={iconComponent} size="large" margin={[0, 0, 'default', 0]} />
+
+ <Title>{title}</Title>
+
+ <Button isWithArrow={true} isTransparent={true} href={linkUrl} onClick={linkAction}>
+ {linkLabel}
+ </Button>
+ </div>
+ </Wrap>
+ );
+ }
+}
+
+export const BlockIconLink = withRouter<BaseComponentProps>(BaseComponent);
+
+const Wrap = styled.div`
+ width: calc(50% - 15px);
+ height: 400px;
+ padding: 40px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ text-align: center;
+ transition: background-color 0.25s;
+ background-color: ${props => props.theme.lightBgColor};
+ cursor: pointer;
+
+ a,
+ button {
+ pointer-events: none;
+ }
+
+ @media (max-width: 900px) {
+ width: 100%;
+ margin-top: 30px;
+ }
+
+ &:hover {
+ background-color: #002d28;
+ }
+`;
+
+const Title = styled.h2`
+ font-size: 20px;
+ margin-bottom: 30px;
+ color: ${props => props.theme.linkColor};
+`;
diff --git a/packages/website/ts/components/button.tsx b/packages/website/ts/components/button.tsx
new file mode 100644
index 000000000..569038ae0
--- /dev/null
+++ b/packages/website/ts/components/button.tsx
@@ -0,0 +1,107 @@
+import * as React from 'react';
+import { Link as ReactRouterLink } from 'react-router-dom';
+import styled from 'styled-components';
+
+import { ThemeInterface } from 'ts/components/siteWrap';
+
+import { colors } from 'ts/style/colors';
+
+interface ButtonInterface {
+ bgColor?: string;
+ borderColor?: string;
+ color?: string;
+ children?: React.ReactNode | string;
+ isTransparent?: boolean;
+ isNoBorder?: boolean;
+ isNoPadding?: boolean;
+ isWithArrow?: boolean;
+ isAccentColor?: boolean;
+ hasIcon?: boolean | string;
+ isInline?: boolean;
+ href?: string;
+ type?: string;
+ target?: string;
+ to?: string;
+ onClick?: () => any;
+ theme?: ThemeInterface;
+ shouldUseAnchorTag?: boolean;
+}
+
+export const Button: React.StatelessComponent<ButtonInterface> = (props: ButtonInterface) => {
+ const { children, href, isWithArrow, to, shouldUseAnchorTag, target } = props;
+ let linkElem;
+
+ if (href || shouldUseAnchorTag) {
+ linkElem = 'a';
+ }
+ if (to) {
+ linkElem = ReactRouterLink;
+ }
+
+ const Component = linkElem ? ButtonBase.withComponent<any>(linkElem) : ButtonBase;
+ const targetProp = href && target ? { target } : {};
+
+ return (
+ <Component {...props} {...targetProp}>
+ {children}
+
+ {isWithArrow && (
+ <svg width="16" height="15" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M4.484.246l.024 1.411 8.146.053L.817 13.547l.996.996L13.65 2.706l.052 8.146 1.412.024L15.045.315 4.484.246z" />
+ </svg>
+ )}
+ </Component>
+ );
+};
+
+Button.defaultProps = {
+ borderColor: 'rgba(255, 255, 255, .4)',
+};
+
+const ButtonBase =
+ styled.button <
+ ButtonInterface >
+ `
+ appearance: none;
+ border: 1px solid transparent;
+ display: inline-block;
+ background-color: ${props => props.bgColor || colors.brandLight};
+ background-color: ${props => (props.isTransparent || props.isWithArrow) && 'transparent'};
+ border-color: ${props => props.isTransparent && !props.isWithArrow && props.borderColor};
+ color: ${props => (props.isAccentColor ? props.theme.linkColor : props.color || props.theme.textColor)};
+ padding: ${props => !props.isNoPadding && !props.isWithArrow && '18px 30px'};
+ white-space: ${props => props.isWithArrow && 'nowrap'};
+ text-align: center;
+ font-size: ${props => (props.isWithArrow ? '20px' : '18px')};
+ text-decoration: none;
+ cursor: pointer;
+ outline: none;
+ transition: background-color 0.35s, border-color 0.35s;
+
+ // @todo Refactor to use theme props
+ ${props =>
+ props.bgColor === 'dark' &&
+ `
+ background-color: ${colors.brandDark};
+ color: ${colors.white};
+ `}
+
+ svg {
+ margin-left: 9px;
+ transition: transform 0.5s;
+ transform: translate3d(-2px, 2px, 0);
+ }
+
+ path {
+ fill: ${props => (props.isAccentColor ? props.theme.linkColor : props.color || props.theme.textColor)};
+ }
+
+ &:hover {
+ background-color: ${props => !props.isTransparent && !props.isWithArrow && '#04BEA8'};
+ border-color: ${props => props.isTransparent && !props.isNoBorder && !props.isWithArrow && '#00AE99'};
+
+ svg {
+ transform: translate3d(2px, -2px, 0);
+ }
+ }
+`;
diff --git a/packages/website/ts/components/chapter_link.tsx b/packages/website/ts/components/chapter_link.tsx
new file mode 100644
index 000000000..fd974cec1
--- /dev/null
+++ b/packages/website/ts/components/chapter_link.tsx
@@ -0,0 +1,15 @@
+import { NavLink as ReactRouterLink } from 'react-router-dom';
+import styled from 'styled-components';
+
+export const ChapterLink = styled(ReactRouterLink).attrs({
+ activeStyle: { opacity: 1 },
+})`
+ font-size: 1.222222222rem;
+ display: block;
+ opacity: 0.5;
+ margin-bottom: 1.666666667rem;
+
+ &:hover {
+ opacity: 1;
+ }
+`;
diff --git a/packages/website/ts/components/definition.tsx b/packages/website/ts/components/definition.tsx
new file mode 100644
index 000000000..92fe54f38
--- /dev/null
+++ b/packages/website/ts/components/definition.tsx
@@ -0,0 +1,145 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { Button } from 'ts/components/button';
+import { Icon } from 'ts/components/icon';
+import { Heading, Paragraph } from 'ts/components/text';
+
+export interface Action {
+ label: string;
+ url?: string;
+ onClick?: () => void;
+ shouldUseAnchorTag?: boolean;
+}
+
+interface Props {
+ isInline?: boolean;
+ isInlineIcon?: boolean;
+ isCentered?: boolean;
+ isWithMargin?: boolean;
+ icon: string;
+ iconSize?: 'medium' | 'large' | number;
+ fontSize?: 'default' | 'medium' | number;
+ title: string;
+ titleSize?: 'small' | 'default' | number;
+ description: React.ReactNode | string;
+ actions?: Action[];
+}
+
+export const Definition = (props: Props) => (
+ <Wrap {...props}>
+ <Icon name={props.icon} size={props.iconSize || 'medium'} margin={[0, 0, 'default', 0]} />
+
+ <TextWrap {...props}>
+ <Heading
+ asElement="h2"
+ fontWeight="400"
+ marginBottom={props.titleSize === 'small' ? '7px' : '15px'}
+ size={props.titleSize || 'default'}
+ >
+ {props.title}
+ </Heading>
+
+ {typeof props.description === 'string' ? (
+ <Paragraph isMuted={true} size={props.fontSize || 'default'}>
+ {props.description}
+ </Paragraph>
+ ) : (
+ <>{props.description}</>
+ )}
+
+ {props.actions && (
+ <LinkWrap>
+ {props.actions.map((item, index) => (
+ <Button
+ key={`dlink-${index}`}
+ href={item.url}
+ onClick={item.onClick}
+ isWithArrow={true}
+ isAccentColor={true}
+ shouldUseAnchorTag={item.shouldUseAnchorTag}
+ target="_blank"
+ >
+ {item.label}
+ </Button>
+ ))}
+ </LinkWrap>
+ )}
+ </TextWrap>
+ </Wrap>
+);
+
+const Wrap =
+ styled.div <
+ Props >
+ `
+ max-width: ${props => props.isInline && '354px'};
+
+ & + & {
+ margin-top: ${props => props.isInlineIcon && '120px'};
+ margin-top: ${props => props.isWithMargin && '60px'};
+ }
+
+ @media (min-width: 768px) {
+ width: ${props => (props.isInline ? 'calc(33.3333% - 30px)' : '100%')};
+ display: ${props => props.isInlineIcon && 'flex'};
+ justify-content: ${props => props.isInlineIcon && 'space-between'};
+ align-items: ${props => props.isInlineIcon && 'center'};
+ text-align: ${props => (props.isInlineIcon || !props.isCentered) && 'left'};
+ }
+
+ @media (max-width: 768px) {
+ margin: 0 auto;
+
+ & + & {
+ margin-top: ${props => props.isInline && '60px'};
+ }
+ }
+`;
+
+const TextWrap =
+ styled.div <
+ Props >
+ `
+ width: 100%;
+ max-width: 560px;
+
+ ul {
+ padding-top: 10px;
+ padding-left: 1rem;
+ }
+
+ li {
+ color: ${props => props.theme.paragraphColor};
+ font-size: ${props => `var(--${props.fontSize || 'default'}Paragraph)`};
+ font-weight: 300;
+ list-style: disc;
+ opacity: 0.75;
+ line-height: 1.444444444;
+ margin-bottom: 1rem;
+ }
+
+ @media (min-width: 768px) {
+ margin-left: ${props => props.isInlineIcon && '60px'};
+ }
+`;
+
+const LinkWrap = styled.div`
+ margin-top: 60px;
+
+ @media (min-width: 768px) {
+ display: inline-flex;
+
+ a + a {
+ margin-left: 60px;
+ }
+ }
+
+ @media (max-width: 768px) {
+ max-width: 250px;
+
+ a + a {
+ margin-top: 15px;
+ }
+ }
+`;
diff --git a/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx b/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx
deleted file mode 100644
index bbec1d649..000000000
--- a/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import { colors } from '@0x/react-shared';
-import Dialog from 'material-ui/Dialog';
-import FlatButton from 'material-ui/FlatButton';
-import * as React from 'react';
-import { constants } from 'ts/utils/constants';
-
-interface U2fNotSupportedDialogProps {
- isOpen: boolean;
- onToggleDialog: () => void;
-}
-
-export const U2fNotSupportedDialog = (props: U2fNotSupportedDialogProps) => {
- return (
- <Dialog
- title="U2F Not Supported"
- titleStyle={{ fontWeight: 100 }}
- actions={[<FlatButton key="u2fNo" label="Ok" onClick={props.onToggleDialog} />]}
- open={props.isOpen}
- onRequestClose={props.onToggleDialog}
- autoScrollBodyContent={true}
- >
- <div className="pt2" style={{ color: colors.grey700 }}>
- <div>
- It looks like your browser does not support U2F connections required for us to communicate with your
- hardware wallet. Please use a browser that supports U2F connections and try again.
- </div>
- <div>
- <ul>
- <li className="pb1">Chrome version 38 or later</li>
- <li className="pb1">Opera version 40 of later</li>
- <li>
- Firefox with{' '}
- <a
- href={constants.URL_FIREFOX_U2F_ADDON}
- target="_blank"
- style={{ textDecoration: 'underline' }}
- >
- this extension
- </a>.
- </li>
- </ul>
- </div>
- </div>
- </Dialog>
- );
-};
diff --git a/packages/website/ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx b/packages/website/ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx
deleted file mode 100644
index cf2c4dda5..000000000
--- a/packages/website/ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import Dialog from 'material-ui/Dialog';
-import FlatButton from 'material-ui/FlatButton';
-import { colors } from 'material-ui/styles';
-import * as React from 'react';
-
-interface WrappedEthSectionNoticeDialogProps {
- isOpen: boolean;
- onToggleDialog: () => void;
-}
-
-export const WrappedEthSectionNoticeDialog = (props: WrappedEthSectionNoticeDialogProps) => {
- return (
- <Dialog
- title="Dedicated Wrapped Ether Section"
- titleStyle={{ fontWeight: 100 }}
- actions={[
- <FlatButton key="acknowledgeWrapEthSection" label="Sounds good" onClick={props.onToggleDialog} />,
- ]}
- open={props.isOpen}
- onRequestClose={props.onToggleDialog}
- autoScrollBodyContent={true}
- modal={true}
- >
- <div className="pt2" style={{ color: colors.grey700 }}>
- <div>
- We have recently updated the Wrapped Ether token (WETH) used by 0x Portal. Don't worry, unwrapping
- Ether tied to the old Wrapped Ether token can be done at any time by clicking on the "Wrap ETH"
- section in the menu to the left.
- </div>
- </div>
- </Dialog>
- );
-};
diff --git a/packages/website/ts/components/documentation/sidebar_header.tsx b/packages/website/ts/components/documentation/sidebar_header.tsx
index 9ced52c74..0ab24ab5e 100644
--- a/packages/website/ts/components/documentation/sidebar_header.tsx
+++ b/packages/website/ts/components/documentation/sidebar_header.tsx
@@ -24,7 +24,7 @@ export const SidebarHeader: React.StatelessComponent<SidebarHeaderProps> = ({
return (
<Container>
<Container className="flex justify-bottom">
- <Container className="left pl1" width="150px">
+ <Container className="col col-7 pl1">
<Text
fontColor={colors.lightLinkBlue}
fontSize={screenWidth === ScreenWidths.Sm ? '20px' : '22px'}
@@ -37,12 +37,14 @@ export const SidebarHeader: React.StatelessComponent<SidebarHeaderProps> = ({
{!_.isUndefined(docsVersion) &&
!_.isUndefined(availableDocVersions) &&
!_.isUndefined(onVersionSelected) && (
- <div className="right" style={{ alignSelf: 'flex-end', paddingBottom: 4 }}>
- <VersionDropDown
- selectedVersion={docsVersion}
- versions={availableDocVersions}
- onVersionSelected={onVersionSelected}
- />
+ <div className="col col-5 pl1" style={{ alignSelf: 'flex-end', paddingBottom: 4 }}>
+ <Container className="right">
+ <VersionDropDown
+ selectedVersion={docsVersion}
+ versions={availableDocVersions}
+ onVersionSelected={onVersionSelected}
+ />
+ </Container>
</div>
)}
</Container>
diff --git a/packages/website/ts/components/dropdowns/developers_drop_down.tsx b/packages/website/ts/components/dropdowns/developers_drop_down.tsx
index b8a35fab0..079132f2b 100644
--- a/packages/website/ts/components/dropdowns/developers_drop_down.tsx
+++ b/packages/website/ts/components/dropdowns/developers_drop_down.tsx
@@ -53,8 +53,8 @@ const usefulLinksToLinkInfo: ALink[] = [
shouldOpenInNewTab: true,
},
{
- title: Key.Whitepaper,
- to: WebsitePaths.Whitepaper,
+ title: Key.ProtocolSpecification,
+ to: constants.URL_PROTOCOL_SPECIFICATION,
shouldOpenInNewTab: true,
},
];
diff --git a/packages/website/ts/components/dropdowns/dropdown_developers.tsx b/packages/website/ts/components/dropdowns/dropdown_developers.tsx
new file mode 100644
index 000000000..590d2ead9
--- /dev/null
+++ b/packages/website/ts/components/dropdowns/dropdown_developers.tsx
@@ -0,0 +1,184 @@
+import { Link } from '@0x/react-shared';
+import * as _ from 'lodash';
+import * as React from 'react';
+import styled, { withTheme } from 'styled-components';
+
+import { Button } from 'ts/components/button';
+import { Column, FlexWrap, WrapGrid } from 'ts/components/newLayout';
+import { ThemeValuesInterface } from 'ts/components/siteWrap';
+import { Heading } from 'ts/components/text';
+import { WebsitePaths } from 'ts/types';
+import { constants } from 'ts/utils/constants';
+
+interface Props {
+ theme: ThemeValuesInterface;
+}
+
+interface LinkConfig {
+ label: string;
+ url: string;
+ shouldOpenInNewTab?: boolean;
+}
+
+const introData: LinkConfig[] = [
+ {
+ label: 'Build a relayer',
+ url: `${WebsitePaths.Wiki}#Build-A-Relayer`,
+ },
+ {
+ label: 'Develop on Ethereum',
+ url: `${WebsitePaths.Wiki}#Ethereum-Development`,
+ },
+ {
+ label: 'Make & take orders',
+ url: `${WebsitePaths.Wiki}#Create,-Validate,-Fill-Order`,
+ },
+ {
+ label: 'Use networked liquidity',
+ url: `${WebsitePaths.Wiki}#Find,-Submit,-Fill-Order-From-Relayer`,
+ },
+ {
+ label: 'Market making',
+ url: `${WebsitePaths.MarketMaker}`,
+ },
+];
+
+const docsData: LinkConfig[] = [
+ {
+ label: '0x.js',
+ url: WebsitePaths.ZeroExJs,
+ },
+ {
+ label: '0x Connect',
+ url: WebsitePaths.Connect,
+ },
+ {
+ label: 'Smart Contract',
+ url: WebsitePaths.SmartContracts,
+ },
+];
+
+const linksData: LinkConfig[] = [
+ {
+ label: 'Wiki',
+ url: WebsitePaths.Wiki,
+ },
+ {
+ label: 'Github',
+ url: constants.URL_GITHUB_ORG,
+ shouldOpenInNewTab: true,
+ },
+ {
+ label: 'Protocol specification',
+ url: constants.URL_PROTOCOL_SPECIFICATION,
+ shouldOpenInNewTab: true,
+ },
+];
+
+export const DropdownDevelopers: React.FunctionComponent<Props> = withTheme((props: Props) => (
+ <>
+ <DropdownWrap>
+ <div>
+ <Heading asElement="h4" size={14} color="inherit" marginBottom="15px" isMuted={0.35}>
+ Getting Started
+ </Heading>
+
+ <StyledGrid isCentered={false} isWrapped={true}>
+ {_.map(introData, (item, index) => (
+ <li>
+ <Link key={`introLink-${index}`} to={item.url}>
+ {item.label}
+ </Link>
+ </li>
+ ))}
+ </StyledGrid>
+ </div>
+
+ <StyledWrap>
+ <Column width="calc(100% - 15px)">
+ <Heading asElement="h4" size={14} color="inherit" marginBottom="15px" isMuted={0.35}>
+ Popular Docs
+ </Heading>
+
+ <ul>
+ {_.map(docsData, (item, index) => (
+ <li key={`docsLink-${index}`}>
+ <Link to={item.url} shouldOpenInNewTab={item.shouldOpenInNewTab}>
+ {item.label}
+ </Link>
+ </li>
+ ))}
+ </ul>
+ </Column>
+
+ <Column width="calc(100% - 15px)">
+ <Heading asElement="h4" size={14} color="inherit" marginBottom="15px" isMuted={0.35}>
+ Useful Links
+ </Heading>
+
+ <ul>
+ {_.map(linksData, (item, index) => (
+ <li key={`usefulLink-${index}`}>
+ <Link to={item.url} shouldOpenInNewTab={item.shouldOpenInNewTab}>
+ {item.label}
+ </Link>
+ </li>
+ ))}
+ </ul>
+ </Column>
+ </StyledWrap>
+
+ <StyledLink
+ to={WebsitePaths.Docs}
+ bgColor={props.theme.dropdownButtonBg}
+ isAccentColor={true}
+ isNoBorder={true}
+ >
+ View All Documentation
+ </StyledLink>
+ </DropdownWrap>
+ </>
+));
+
+const DropdownWrap = styled.div`
+ padding: 15px 30px 75px 30px;
+
+ a {
+ color: inherit;
+ }
+
+ li {
+ margin: 8px 0;
+ }
+`;
+
+const StyledGrid = styled(WrapGrid.withComponent('ul'))`
+ li {
+ width: 50%;
+ flex-shrink: 0;
+ }
+`;
+
+const StyledWrap = styled(FlexWrap)`
+ padding-top: 20px;
+ margin-top: 30px;
+ position: relative;
+
+ &:before {
+ content: '';
+ width: 100%;
+ height: 1px;
+ background-color: ${props => props.theme.dropdownColor};
+ opacity: 0.15;
+ position: absolute;
+ top: 0;
+ left: 0;
+ }
+`;
+
+const StyledLink = styled(Button)`
+ width: 100%;
+ position: absolute;
+ bottom: 0;
+ left: 0;
+`;
diff --git a/packages/website/ts/components/dropdowns/dropdown_products.tsx b/packages/website/ts/components/dropdowns/dropdown_products.tsx
new file mode 100644
index 000000000..93fd1a4fe
--- /dev/null
+++ b/packages/website/ts/components/dropdowns/dropdown_products.tsx
@@ -0,0 +1,48 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+
+import { Link } from 'react-router-dom';
+import styled from 'styled-components';
+import { Heading, Paragraph } from 'ts/components/text';
+import { WebsitePaths } from 'ts/types';
+
+const navData = [
+ {
+ title: '0x Instant',
+ description: 'Simple crypto purchasing',
+ url: WebsitePaths.Instant,
+ },
+ {
+ title: '0x Launch Kit',
+ description: 'Build on the 0x protocol',
+ url: WebsitePaths.LaunchKit,
+ },
+];
+
+export const DropdownProducts: React.FunctionComponent<{}> = () => (
+ <List>
+ {_.map(navData, (item, index) => (
+ <li key={`productLink-${index}`}>
+ <Link to={item.url}>
+ <Heading asElement="h3" color="inherit" isNoMargin={true} size="small">
+ {item.title}
+ </Heading>
+
+ {item.description && (
+ <Paragraph color="inherit" isNoMargin={true} size="small" isMuted={0.5}>
+ {item.description}
+ </Paragraph>
+ )}
+ </Link>
+ </li>
+ ))}
+ </List>
+);
+
+const List = styled.ul`
+ a {
+ padding: 15px 30px;
+ display: block;
+ color: inherit;
+ }
+`;
diff --git a/packages/website/ts/components/eth_wrappers.tsx b/packages/website/ts/components/eth_wrappers.tsx
index 4a9f3b2fe..dc597b18f 100644
--- a/packages/website/ts/components/eth_wrappers.tsx
+++ b/packages/website/ts/components/eth_wrappers.tsx
@@ -209,7 +209,7 @@ export class EthWrappers extends React.Component<EthWrappersProps, EthWrappersSt
<Divider />
<div className="pt2" style={{ lineHeight: 1.5 }}>
The{' '}
- <a href="https://blog.0xproject.com/canonical-weth-a9aa7d0279dd" target="_blank">
+ <a href={constants.URL_CANONICAL_WETH_POST} target="_blank">
canonical WETH
</a>{' '}
contract is updated when necessary. Unwrap outdated WETH in order to
 retrieve your ETH and move
diff --git a/packages/website/ts/components/fill_warning_dialog.tsx b/packages/website/ts/components/fill_warning_dialog.tsx
index 430abd013..feb72c2ee 100644
--- a/packages/website/ts/components/fill_warning_dialog.tsx
+++ b/packages/website/ts/components/fill_warning_dialog.tsx
@@ -35,7 +35,7 @@ export const FillWarningDialog = (props: FillWarningDialogProps) => {
<div>
At least one of the tokens in this order was not found in the token registry smart contract and may
be counterfeit. It is your responsibility to verify the token addresses on Etherscan (
- <a href="https://0xproject.com/wiki#Verifying-Custom-Tokens" target="_blank">
+ <a href="https://0x.org/wiki#Verifying-Custom-Tokens" target="_blank">
See this how-to guide
</a>) before filling an order. <b>This action may result in the loss of funds</b>.
</div>
diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx
index e10005a0a..3765a32ca 100644
--- a/packages/website/ts/components/footer.tsx
+++ b/packages/website/ts/components/footer.tsx
@@ -1,228 +1,168 @@
-import { ALink, colors, Link } from '@0x/react-shared';
-import { ObjectMap } from '@0x/types';
+import { Link as SmartLink } from '@0x/react-shared';
import * as _ from 'lodash';
-import DropDownMenu from 'material-ui/DropDownMenu';
-import MenuItem from 'material-ui/MenuItem';
import * as React from 'react';
+import MediaQuery from 'react-responsive';
+import styled from 'styled-components';
-import { Dispatcher } from 'ts/redux/dispatcher';
-import { Deco, Key, Language, WebsitePaths } from 'ts/types';
+import { Logo } from 'ts/components/logo';
+import { Column, FlexWrap, WrapGrid } from 'ts/components/newLayout';
+import { NewsletterForm } from 'ts/components/newsletter_form';
+import { WebsitePaths } from 'ts/types';
import { constants } from 'ts/utils/constants';
-import { Translate } from 'ts/utils/translate';
-
-const ICON_DIMENSION = 16;
-
-const languageToMenuTitle = {
- [Language.English]: 'English',
- [Language.Russian]: 'Русский',
- [Language.Spanish]: 'Español',
- [Language.Korean]: '한국어',
- [Language.Chinese]: '中文',
-};
-
-export interface FooterProps {
- translate: Translate;
- dispatcher: Dispatcher;
- backgroundColor?: string;
+
+interface LinkInterface {
+ text: string;
+ url: string;
+ shouldOpenInNewTab?: boolean;
+}
+
+interface LinkRows {
+ heading: string;
+ isOnMobile?: boolean;
+ links: LinkInterface[];
}
-interface FooterState {
- selectedLanguage: Language;
+interface LinkListProps {
+ links: LinkInterface[];
}
-export class Footer extends React.Component<FooterProps, FooterState> {
- public static defaultProps = {
- backgroundColor: colors.darkerGrey,
- };
- constructor(props: FooterProps) {
- super(props);
- this.state = {
- selectedLanguage: props.translate.getLanguage(),
- };
+const linkRows: LinkRows[] = [
+ {
+ heading: 'Products',
+ isOnMobile: true,
+ links: [
+ { url: WebsitePaths.Instant, text: '0x Instant' },
+ { url: WebsitePaths.LaunchKit, text: '0x Launch Kit' },
+ ],
+ },
+ {
+ heading: 'Developers',
+ links: [
+ { url: WebsitePaths.Docs, text: 'Documentation' },
+ { url: constants.URL_GITHUB_ORG, text: 'GitHub', shouldOpenInNewTab: true },
+ { url: constants.URL_PROTOCOL_SPECIFICATION, text: 'Protocol Spec', shouldOpenInNewTab: true },
+ ],
+ },
+ {
+ heading: 'About',
+ isOnMobile: true,
+ links: [
+ { url: WebsitePaths.AboutMission, text: 'Mission' },
+ { url: WebsitePaths.AboutTeam, text: 'Team' },
+ { url: WebsitePaths.AboutJobs, text: 'Jobs' },
+ { url: WebsitePaths.AboutPress, text: 'Press' },
+ { url: WebsitePaths.Ecosystem, text: 'Grant Program' },
+ ],
+ },
+ {
+ heading: 'Community',
+ isOnMobile: true,
+ links: [
+ { url: constants.URL_TWITTER, text: 'Twitter', shouldOpenInNewTab: true },
+ { url: constants.URL_ZEROEX_CHAT, text: 'Discord Chat', shouldOpenInNewTab: true },
+ { url: constants.URL_FACEBOOK, text: 'Facebook', shouldOpenInNewTab: true },
+ { url: constants.URL_REDDIT, text: 'Reddit', shouldOpenInNewTab: true },
+ ],
+ },
+];
+
+export const Footer: React.StatelessComponent = () => (
+ <FooterWrap>
+ <FlexWrap>
+ <FooterColumn width="35%">
+ <Logo />
+ <NewsletterForm />
+ </FooterColumn>
+
+ <FooterColumn width="55%">
+ <WrapGrid isCentered={false} isWrapped={true}>
+ {_.map(linkRows, (row: LinkRows, index) => (
+ <MediaQuery minWidth={row.isOnMobile ? 0 : 768} key={`fc-${index}`}>
+ <FooterSectionWrap>
+ <RowHeading>{row.heading}</RowHeading>
+
+ <LinkList links={row.links} />
+ </FooterSectionWrap>
+ </MediaQuery>
+ ))}
+ </WrapGrid>
+ </FooterColumn>
+ </FlexWrap>
+ </FooterWrap>
+);
+
+const LinkList = (props: LinkListProps) => (
+ <List>
+ {_.map(props.links, (link, index) => (
+ <li key={`fl-${index}`}>
+ <Link to={link.url} shouldOpenInNewTab={link.shouldOpenInNewTab}>
+ {link.text}
+ </Link>
+ </li>
+ ))}
+ </List>
+);
+
+const FooterWrap = styled.footer`
+ padding: 40px 30px 30px 30px;
+ margin-top: 30px;
+ background-color: ${props => props.theme.footerBg};
+ color: ${props => props.theme.footerColor};
+
+ path {
+ fill: ${props => props.theme.footerColor};
+ }
+
+ @media (min-width: 768px) {
+ height: 350px;
}
- public render(): React.ReactNode {
- const sectionNameToLinks: ObjectMap<ALink[]> = {
- [Key.Documentation]: [
- {
- title: 'Developer Home',
- to: WebsitePaths.Docs,
- },
- {
- title: '0x.js',
- to: WebsitePaths.ZeroExJs,
- },
- {
- title: this.props.translate.get(Key.SmartContracts, Deco.Cap),
- to: WebsitePaths.SmartContracts,
- },
- {
- title: this.props.translate.get(Key.Connect, Deco.Cap),
- to: WebsitePaths.Connect,
- },
- {
- title: this.props.translate.get(Key.Whitepaper, Deco.Cap),
- to: WebsitePaths.Whitepaper,
- shouldOpenInNewTab: true,
- },
- {
- title: this.props.translate.get(Key.Wiki, Deco.Cap),
- to: WebsitePaths.Wiki,
- },
- ],
- [Key.Community]: [
- {
- title: this.props.translate.get(Key.RocketChat, Deco.Cap),
- to: constants.URL_ZEROEX_CHAT,
- shouldOpenInNewTab: true,
- },
- {
- title: this.props.translate.get(Key.Blog, Deco.Cap),
- to: constants.URL_BLOG,
- shouldOpenInNewTab: true,
- },
- {
- title: 'Twitter',
- to: constants.URL_TWITTER,
- shouldOpenInNewTab: true,
- },
- {
- title: 'Reddit',
- to: constants.URL_REDDIT,
- shouldOpenInNewTab: true,
- },
- {
- title: this.props.translate.get(Key.Forum, Deco.Cap),
- to: constants.URL_DISCOURSE_FORUM,
- shouldOpenInNewTab: true,
- },
- ],
- [Key.Organization]: [
- {
- title: this.props.translate.get(Key.About, Deco.Cap),
- to: WebsitePaths.About,
- },
- {
- title: this.props.translate.get(Key.Careers, Deco.Cap),
- to: WebsitePaths.Careers,
- },
- {
- title: this.props.translate.get(Key.Contact, Deco.Cap),
- to: 'mailto:team@0xproject.com',
- shouldOpenInNewTab: true,
- },
- ],
- };
- const languageMenuItems = _.map(languageToMenuTitle, (menuTitle: string, language: Language) => {
- return <MenuItem key={menuTitle} value={language} primaryText={menuTitle} />;
- });
- return (
- <div className="relative pb4 pt2" style={{ backgroundColor: this.props.backgroundColor }}>
- <div className="mx-auto max-width-4 md-px2 lg-px0 py4 clearfix" style={{ color: colors.white }}>
- <div className="col lg-col-4 md-col-4 col-12 left">
- <div className="sm-mx-auto" style={{ width: 148 }}>
- <div>
- <img src="/images/protocol_logo_white.png" height="30" />
- </div>
- <div
- style={{
- fontSize: 11,
- color: colors.grey,
- paddingLeft: 37,
- paddingTop: 2,
- }}
- >
- © ZeroEx, Intl.
- </div>
- <div className="pt4 center">
- <DropDownMenu
- labelStyle={{ color: colors.white }}
- value={this.state.selectedLanguage}
- onChange={this._updateLanguage.bind(this)}
- >
- {languageMenuItems}
- </DropDownMenu>
- </div>
- </div>
- </div>
- <div className="col lg-col-8 md-col-8 col-12 lg-pl4 md-pl4">
- <div className="col lg-col-4 md-col-4 col-12">
- <div className="lg-right md-right sm-center">
- {this._renderHeader(Key.Documentation)}
- {_.map(sectionNameToLinks[Key.Documentation], this._renderMenuItem.bind(this))}
- </div>
- </div>
- <div className="col lg-col-4 md-col-4 col-12 lg-pr2 md-pr2">
- <div className="lg-right md-right sm-center">
- {this._renderHeader(Key.Community)}
- {_.map(sectionNameToLinks[Key.Community], this._renderMenuItem.bind(this))}
- </div>
- </div>
- <div className="col lg-col-4 md-col-4 col-12">
- <div className="lg-right md-right sm-center">
- {this._renderHeader(Key.Organization)}
- {_.map(sectionNameToLinks[Key.Organization], this._renderMenuItem.bind(this))}
- </div>
- </div>
- </div>
- </div>
- </div>
- );
+`;
+
+const FooterColumn = styled(Column)`
+ @media (min-width: 768px) {
+ width: ${props => props.width};
}
- private _renderIcon(fileName: string): React.ReactNode {
- return (
- <div style={{ height: ICON_DIMENSION, width: ICON_DIMENSION }}>
- <img src={`/images/social/${fileName}`} style={{ width: ICON_DIMENSION }} />
- </div>
- );
+
+ @media (max-width: 768px) {
+ text-align: left;
}
- private _renderMenuItem(link: ALink): React.ReactNode {
- const titleToIcon: { [title: string]: string } = {
- [this.props.translate.get(Key.RocketChat, Deco.Cap)]: 'rocketchat.png',
- [this.props.translate.get(Key.Blog, Deco.Cap)]: 'medium.png',
- Twitter: 'twitter.png',
- Reddit: 'reddit.png',
- [this.props.translate.get(Key.Forum, Deco.Cap)]: 'discourse.png',
- };
- const iconIfExists = titleToIcon[link.title];
- return (
- <div key={link.title} className="sm-center" style={{ fontSize: 13, paddingTop: 25 }}>
- <Link
- to={link.to}
- shouldOpenInNewTab={link.shouldOpenInNewTab}
- fontColor={colors.white}
- className="text-decoration-none"
- >
- <div>
- {!_.isUndefined(iconIfExists) ? (
- <div className="inline-block">
- <div className="pr1 table-cell">{this._renderIcon(iconIfExists)}</div>
- <div className="table-cell">{link.title}</div>
- </div>
- ) : (
- link.title
- )}
- </div>
- </Link>
- </div>
- );
+`;
+
+const FooterSectionWrap = styled(FooterColumn)`
+ @media (max-width: 768px) {
+ width: 50%;
+
+ & + & {
+ margin-top: 0;
+ margin-bottom: 30px;
+ }
}
- private _renderHeader(key: Key): React.ReactNode {
- const headerStyle = {
- color: colors.grey400,
- letterSpacing: 2,
- fontFamily: 'Roboto Mono',
- fontSize: 13,
- };
- return (
- <div className="lg-pb2 md-pb2 sm-pt4" style={headerStyle}>
- {this.props.translate.get(key, Deco.Upper)}
- </div>
- );
+`;
+
+const RowHeading = styled.h3`
+ color: inherit;
+ font-weight: 700;
+ font-size: 16px;
+ margin-bottom: 1.25em;
+ opacity: 0.75;
+`;
+
+const List = styled.ul`
+ li + li {
+ margin-top: 8px;
}
- private _updateLanguage(_event: any, _index: number, value: Language): void {
- this.setState({
- selectedLanguage: value,
- });
- this.props.dispatcher.updateSelectedLanguage(value);
+`;
+
+const Link = styled(SmartLink)`
+ color: inherit;
+ opacity: 0.5;
+ display: block;
+ font-size: 16px;
+ line-height: 20px;
+ transition: opacity 0.25s;
+ text-decoration: none;
+
+ &:hover {
+ opacity: 0.8;
}
-}
+`;
diff --git a/packages/website/ts/components/forms/subscribe_form.tsx b/packages/website/ts/components/forms/subscribe_form.tsx
deleted file mode 100644
index f5560cfa7..000000000
--- a/packages/website/ts/components/forms/subscribe_form.tsx
+++ /dev/null
@@ -1,127 +0,0 @@
-import { colors } from '@0x/react-shared';
-import * as _ from 'lodash';
-import * as React from 'react';
-
-import { Button } from 'ts/components/ui/button';
-import { Container } from 'ts/components/ui/container';
-import { Input } from 'ts/components/ui/input';
-import { Text } from 'ts/components/ui/text';
-import { analytics } from 'ts/utils/analytics';
-import { backendClient } from 'ts/utils/backend_client';
-
-export interface SubscribeFormProps {}
-
-export enum SubscribeFormStatus {
- None,
- Error,
- Success,
- Loading,
- Other,
-}
-
-export interface SubscribeFormState {
- emailText: string;
- lastSubmittedEmail: string;
- status: SubscribeFormStatus;
-}
-
-const FORM_FONT_SIZE = '15px';
-
-// TODO: Translate visible strings. https://app.asana.com/0/628666249318202/697485674422001
-export class SubscribeForm extends React.Component<SubscribeFormProps, SubscribeFormState> {
- public state = {
- emailText: '',
- lastSubmittedEmail: '',
- status: SubscribeFormStatus.None,
- };
- public render(): React.ReactNode {
- return (
- <Container className="flex flex-column items-center justify-between md-mx2 sm-mx2">
- <Container marginBottom="15px">
- <Text fontFamily="Roboto Mono" fontColor={colors.grey} center={true}>
- Subscribe to our newsletter for 0x relayer and dApp updates
- </Text>
- </Container>
- <form onSubmit={this._handleFormSubmitAsync.bind(this)}>
- <Container className="flex flex-wrap justify-center items-center">
- <Container marginTop="15px">
- <Input
- placeholder="you@email.com"
- value={this.state.emailText}
- fontColor={colors.white}
- fontSize={FORM_FONT_SIZE}
- backgroundColor={colors.projectsGrey}
- width="300px"
- onChange={this._handleEmailInputChange.bind(this)}
- />
- </Container>
- <Container marginLeft="15px" marginTop="15px">
- <Button
- type="submit"
- backgroundColor={colors.darkestGrey}
- fontColor={colors.white}
- fontSize={FORM_FONT_SIZE}
- >
- Subscribe
- </Button>
- </Container>
- </Container>
- </form>
- {this._renderMessage()}
- </Container>
- );
- }
- private _renderMessage(): React.ReactNode {
- let message = null;
- switch (this.state.status) {
- case SubscribeFormStatus.Error:
- message = 'Sorry, something went wrong. Try again later.';
- break;
- case SubscribeFormStatus.Loading:
- message = 'One second...';
- break;
- case SubscribeFormStatus.Success:
- message = `Thanks! ${this.state.lastSubmittedEmail} is now on the mailing list.`;
- break;
- case SubscribeFormStatus.None:
- break;
- default:
- throw new Error(
- 'The SubscribeFormStatus switch statement is not exhaustive when choosing an error message.',
- );
- }
- return (
- <Container isHidden={!message} marginTop="30px">
- <Text center={true} fontFamily="Roboto Mono" fontColor={colors.grey}>
- {message || 'spacer text (never shown to user)'}
- </Text>
- </Container>
- );
- }
- private _handleEmailInputChange(event: React.ChangeEvent<HTMLInputElement>): void {
- this.setState({ emailText: event.target.value });
- }
- private async _handleFormSubmitAsync(event: React.FormEvent<HTMLInputElement>): Promise<void> {
- event.preventDefault();
- if (_.isUndefined(this.state.emailText) || _.isEmpty(this.state.emailText)) {
- return;
- }
- this.setState({
- status: SubscribeFormStatus.Loading,
- lastSubmittedEmail: this.state.emailText,
- });
- try {
- const response = await backendClient.subscribeToNewsletterAsync(this.state.emailText);
- const status = response.status === 200 ? SubscribeFormStatus.Success : SubscribeFormStatus.Error;
- if (status === SubscribeFormStatus.Success) {
- analytics.identify(this.state.emailText, 'email');
- }
- this.setState({ status, emailText: '' });
- } catch (error) {
- this._setStatus(SubscribeFormStatus.Error);
- }
- }
- private _setStatus(status: SubscribeFormStatus): void {
- this.setState({ status });
- }
-}
diff --git a/packages/website/ts/components/hamburger.tsx b/packages/website/ts/components/hamburger.tsx
new file mode 100644
index 000000000..435d206cd
--- /dev/null
+++ b/packages/website/ts/components/hamburger.tsx
@@ -0,0 +1,72 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+interface Props {
+ isOpen: boolean;
+ onClick?: () => void;
+}
+
+export const Hamburger: React.FunctionComponent<Props> = (props: Props) => {
+ return (
+ <StyledHamburger isOpen={props.isOpen} onClick={props.onClick}>
+ <span />
+ <span />
+ <span />
+ </StyledHamburger>
+ );
+};
+
+const StyledHamburger =
+ styled.button <
+ Props >
+ `
+ background: none;
+ border: 0;
+ width: 22px;
+ height: 16px;
+ position: relative;
+ z-index: 25;
+ padding: 0;
+ outline: none;
+ user-select: none;
+
+ @media (min-width: 800px) {
+ display: none;
+ }
+
+ span {
+ display: block;
+ background-color: ${props => props.theme.textColor};
+ width: 100%;
+ height: 2px;
+ margin-bottom: 5px;
+ transform-origin: 4px 0px;
+ transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0),
+ background-color 0.5s cubic-bezier(0.77,0.2,0.05,1.0),
+ opacity 0.55s ease;
+
+ &:first-child {
+ //transform-origin: 0% 0%;
+ }
+
+ &:last-child {
+ //transform-origin: 0% 100%;
+ }
+
+ ${props =>
+ props.isOpen &&
+ `
+ opacity: 1;
+ transform: rotate(45deg) translate(0, 1px);
+
+ &:nth-child(2) {
+ opacity: 0;
+ transform: rotate(0deg) scale(0.2, 0.2);
+ }
+
+ &:last-child {
+ transform: rotate(-45deg) translate(1px, -4px);
+ }
+ `}
+ }
+`;
diff --git a/packages/website/ts/components/header.tsx b/packages/website/ts/components/header.tsx
new file mode 100644
index 000000000..90e097070
--- /dev/null
+++ b/packages/website/ts/components/header.tsx
@@ -0,0 +1,252 @@
+import { Link } from '@0x/react-shared';
+import _ from 'lodash';
+import * as React from 'react';
+import MediaQuery from 'react-responsive';
+import styled, { css, withTheme } from 'styled-components';
+
+import Headroom from 'react-headroom';
+
+import { Button } from 'ts/components/button';
+import { DropdownDevelopers } from 'ts/components/dropdowns/dropdown_developers';
+import { DropdownProducts } from 'ts/components/dropdowns/dropdown_products';
+import { Hamburger } from 'ts/components/hamburger';
+import { Logo } from 'ts/components/logo';
+import { MobileNav } from 'ts/components/mobileNav';
+import { FlexWrap } from 'ts/components/newLayout';
+import { ThemeValuesInterface } from 'ts/components/siteWrap';
+import { WebsitePaths } from 'ts/types';
+import { constants } from 'ts/utils/constants';
+
+interface HeaderProps {
+ location?: Location;
+ isNavToggled?: boolean;
+ toggleMobileNav?: () => void;
+ theme: ThemeValuesInterface;
+}
+
+interface NavItemProps {
+ url?: string;
+ id?: string;
+ text?: string;
+ dropdownWidth?: number;
+ dropdownComponent?: React.FunctionComponent<any>;
+ shouldOpenInNewTab?: boolean;
+}
+
+interface DropdownWrapInterface {
+ width?: number;
+}
+
+const navItems: NavItemProps[] = [
+ {
+ id: 'why',
+ url: WebsitePaths.Why,
+ text: 'Why 0x',
+ },
+ {
+ id: 'products',
+ text: 'Products',
+ dropdownComponent: DropdownProducts,
+ dropdownWidth: 280,
+ },
+ {
+ id: 'developers',
+ text: 'Developers',
+ dropdownComponent: DropdownDevelopers,
+ dropdownWidth: 480,
+ },
+ {
+ id: 'about',
+ url: WebsitePaths.AboutMission,
+ text: 'About',
+ },
+ {
+ id: 'blog',
+ url: constants.URL_BLOG,
+ shouldOpenInNewTab: true,
+ text: 'Blog',
+ },
+];
+
+class HeaderBase extends React.Component<HeaderProps> {
+ public onUnpin = () => {
+ if (this.props.isNavToggled) {
+ this.props.toggleMobileNav();
+ }
+ };
+
+ public render(): React.ReactNode {
+ const { isNavToggled, toggleMobileNav, theme } = this.props;
+
+ return (
+ <Headroom onUnpin={this.onUnpin} downTolerance={4} upTolerance={10}>
+ <StyledHeader isNavToggled={isNavToggled}>
+ <HeaderWrap>
+ <Link to={WebsitePaths.Home}>
+ <Logo />
+ </Link>
+
+ <NavLinks>
+ {_.map(navItems, (link, index) => <NavItem key={`navlink-${index}`} link={link} />)}
+ </NavLinks>
+
+ <MediaQuery minWidth={990}>
+ <TradeButton bgColor={theme.headerButtonBg} color="#ffffff" href="/portal">
+ Trade on 0x
+ </TradeButton>
+ </MediaQuery>
+
+ <Hamburger isOpen={isNavToggled} onClick={toggleMobileNav} />
+ <MobileNav isToggled={isNavToggled} toggleMobileNav={toggleMobileNav} />
+ </HeaderWrap>
+ </StyledHeader>
+ </Headroom>
+ );
+ }
+}
+
+export const Header = withTheme(HeaderBase);
+
+const NavItem = (props: { link: NavItemProps; key: string }) => {
+ const { link } = props;
+ const Subnav = link.dropdownComponent;
+ const linkElement = _.isUndefined(link.url) ? (
+ <StyledAnchor href="#">{link.text}</StyledAnchor>
+ ) : (
+ <StyledNavLink to={link.url} shouldOpenInNewTab={link.shouldOpenInNewTab}>
+ {link.text}
+ </StyledNavLink>
+ );
+ return (
+ <LinkWrap>
+ {linkElement}
+
+ {link.dropdownComponent && (
+ <DropdownWrap width={link.dropdownWidth}>
+ <Subnav />
+ </DropdownWrap>
+ )}
+ </LinkWrap>
+ );
+};
+
+const StyledHeader =
+ styled.header <
+ HeaderProps >
+ `
+ padding: 30px;
+ background-color: ${props => props.theme.bgColor};
+`;
+
+const LinkWrap = styled.li`
+ position: relative;
+
+ a {
+ display: block;
+ }
+
+ @media (min-width: 800px) {
+ &:hover > div {
+ display: block;
+ visibility: visible;
+ opacity: 1;
+ transform: translate3d(0, 0, 0);
+ transition: opacity 0.35s, transform 0.35s, visibility 0s;
+ }
+ }
+`;
+
+const linkStyles = css`
+ color: ${props => props.theme.textColor};
+ opacity: 0.5;
+ transition: opacity 0.35s;
+ padding: 15px 0;
+ margin: 0 30px;
+
+ &:hover {
+ opacity: 1;
+ }
+`;
+
+const StyledNavLink = styled(Link).attrs({
+ activeStyle: { opacity: 1 },
+})`
+ ${linkStyles};
+`;
+
+const StyledAnchor = styled.a`
+ ${linkStyles};
+ cursor: default;
+`;
+
+const HeaderWrap = styled(FlexWrap)`
+ justify-content: space-between;
+ align-items: center;
+
+ @media (max-width: 800px) {
+ padding-top: 0;
+ display: flex;
+ padding-bottom: 0;
+ }
+`;
+
+const NavLinks = styled.ul`
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+
+ @media (max-width: 800px) {
+ display: none;
+ }
+`;
+
+const DropdownWrap =
+ styled.div <
+ DropdownWrapInterface >
+ `
+ width: ${props => props.width || 280}px;
+ padding: 15px 0;
+ border: 1px solid transparent;
+ border-color: ${props => props.theme.dropdownBorderColor};
+ background-color: ${props => props.theme.dropdownBg};
+ color: ${props => props.theme.dropdownColor};
+ position: absolute;
+ top: 100%;
+ left: calc(50% - ${props => (props.width || 280) / 2}px);
+ visibility: hidden;
+ opacity: 0;
+ transform: translate3d(0, -10px, 0);
+ transition: opacity 0.35s, transform 0.35s, visibility 0s 0.35s;
+ z-index: 20;
+
+ &:after, &:before {
+ bottom: 100%;
+ left: 50%;
+ border: solid transparent;
+ content: " ";
+ height: 0;
+ width: 0;
+ position: absolute;
+ pointer-events: none;
+ }
+ &:after {
+ border-color: rgba(255, 255, 255, 0);
+ border-bottom-color: ${props => props.theme.dropdownBg};
+ border-width: 10px;
+ margin-left: -10px;
+ }
+ &:before {
+ border-color: rgba(255, 0, 0, 0);
+ border-bottom-color: ${props => props.theme.dropdownBorderColor};
+ border-width: 11px;
+ margin-left: -11px;
+ }
+
+ @media (max-width: 768px) {
+ display: none;
+ }
+`;
+
+const TradeButton = styled(Button)`
+ padding: 14px 22px !important;
+`;
diff --git a/packages/website/ts/components/hero.tsx b/packages/website/ts/components/hero.tsx
new file mode 100644
index 000000000..a662ee3a5
--- /dev/null
+++ b/packages/website/ts/components/hero.tsx
@@ -0,0 +1,152 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { addFadeInAnimation } from 'ts/constants/animations';
+
+interface Props {
+ title: string;
+ maxWidth?: string;
+ maxWidthHeading?: string;
+ isLargeTitle?: boolean;
+ isFullWidth?: boolean;
+ isCenteredMobile?: boolean;
+ description: string;
+ figure?: React.ReactNode;
+ actions?: React.ReactNode;
+}
+
+const Section = styled.section`
+ padding: 120px 0;
+
+ @media (max-width: 768px) {
+ padding: 60px 0;
+ }
+`;
+
+interface WrapProps {
+ isCentered?: boolean;
+ isFullWidth?: boolean;
+ isCenteredMobile?: boolean;
+}
+const Wrap =
+ styled.div <
+ WrapProps >
+ `
+ width: calc(100% - 60px);
+ margin: 0 auto;
+
+ @media (min-width: 768px) {
+ max-width: ${props => (!props.isFullWidth ? '895px' : '1136px')};
+ flex-direction: row-reverse;
+ display: flex;
+ align-items: center;
+ text-align: ${props => props.isCentered && 'center'};
+ justify-content: ${props => (props.isCentered ? 'center' : 'space-between')};
+ }
+
+ @media (max-width: 768px) {
+ text-align: ${props => (props.isCenteredMobile ? `center` : 'left')};
+ }
+`;
+
+interface TitleProps {
+ isLarge?: any;
+ maxWidth?: string;
+}
+const Title =
+ styled.h1 <
+ TitleProps >
+ `
+ font-size: ${props => (props.isLarge ? '80px' : '50px')};
+ font-weight: 300;
+ line-height: 1.1;
+ margin-left: auto;
+ margin-right: auto;
+ margin-bottom: 30px;
+ max-width: ${props => props.maxWidth};
+ ${addFadeInAnimation('0.5s')}
+
+ @media (max-width: 1024px) {
+ font-size: 60px;
+ }
+
+ @media (max-width: 768px) {
+ font-size: 46px;
+ }
+`;
+
+const Description = styled.p`
+ font-size: 22px;
+ line-height: 31px;
+ font-weight: 300;
+ padding: 0;
+ margin-bottom: 50px;
+ color: ${props => props.theme.introTextColor};
+ ${addFadeInAnimation('0.5s', '0.15s')} @media (max-width: 1024px) {
+ margin-bottom: 30px;
+ }
+`;
+
+const Content =
+ styled.div <
+ { width: string } >
+ `
+ width: 100%;
+
+ @media (min-width: 768px) {
+ max-width: ${props => props.width};
+ }
+`;
+
+const ButtonWrap = styled.div`
+ display: inline-flex;
+ align-items: center;
+
+ * + * {
+ margin-left: 12px;
+ }
+
+ > *:nth-child(1) {
+ ${addFadeInAnimation('0.6s', '0.3s')};
+ }
+ > *:nth-child(2) {
+ ${addFadeInAnimation('0.6s', '0.4s')};
+ }
+
+ @media (max-width: 500px) {
+ flex-direction: column;
+ justify-content: center;
+
+ * {
+ padding-left: 20px;
+ padding-right: 20px;
+ }
+
+ * + * {
+ margin-left: 0;
+ margin-top: 12px;
+ }
+ }
+`;
+
+export const Hero: React.StatelessComponent<Props> = (props: Props) => (
+ <Section>
+ <Wrap isCentered={!props.figure} isFullWidth={props.isFullWidth} isCenteredMobile={props.isCenteredMobile}>
+ {props.figure && <Content width="400px">{props.figure}</Content>}
+
+ <Content width={props.maxWidth ? props.maxWidth : props.figure ? '546px' : '678px'}>
+ <Title isLarge={props.isLargeTitle} maxWidth={props.maxWidthHeading}>
+ {props.title}
+ </Title>
+
+ <Description>{props.description}</Description>
+
+ {props.actions && <ButtonWrap>{props.actions}</ButtonWrap>}
+ </Content>
+ </Wrap>
+ </Section>
+);
+
+Hero.defaultProps = {
+ isCenteredMobile: true,
+};
diff --git a/packages/website/ts/components/heroAnimation.tsx b/packages/website/ts/components/heroAnimation.tsx
new file mode 100644
index 000000000..42956fb6a
--- /dev/null
+++ b/packages/website/ts/components/heroAnimation.tsx
@@ -0,0 +1,123 @@
+import * as React from 'react';
+import styled, { keyframes } from 'styled-components';
+
+export const HeroAnimation = () => (
+ <Image width="404" height="404" viewBox="0 0 404 404" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="404" height="404">
+ <circle cx="202" cy="202" r="200" fill="#00AE99" stroke="#00AE99" stroke-width="3" />
+ </mask>
+ <g mask="url(#mask0)">
+ <circle cx="202" cy="202" r="200" stroke="#00AE99" strokeWidth="3" />
+ <TopCircle
+ vector-effect="non-scaling-stroke"
+ cx="201.667"
+ cy="68.6667"
+ r="66.6667"
+ stroke="#00AE99"
+ strokeWidth="3"
+ />
+ <LeftCircle
+ vector-effect="non-scaling-stroke"
+ cx="68.6667"
+ cy="202.667"
+ r="66.6667"
+ stroke="#00AE99"
+ strokeWidth="3"
+ />
+ <Logo
+ vector-effect="non-scaling-stroke"
+ d="M168.17 260.29L167.271 259.089L165.46 260.444L167.413 261.585L168.17 260.29ZM197.32 269.2L197.219 270.696L197.226 270.697L197.32 269.2ZM237.414 258.856L238.22 260.12L238.225 260.117L237.414 258.856ZM252.653 245.439L253.801 246.405L254.55 245.515L253.874 244.568L252.653 245.439ZM241.096 229.872L242.285 228.958L242.281 228.952L242.276 228.946L241.096 229.872ZM237.72 225.571L238.901 224.645L237.582 222.965L236.449 224.775L237.72 225.571ZM219.719 241.445L218.672 242.519L219.418 243.246L220.36 242.801L219.719 241.445ZM208.264 230.282L209.311 229.207L208.392 228.312L207.365 229.081L208.264 230.282ZM143.827 169.549L145.02 168.64L143.647 166.838L142.524 168.806L143.827 169.549ZM135.133 198.43L133.637 198.329L133.636 198.337L135.133 198.43ZM145.464 238.577L144.201 239.388L145.464 238.577ZM158.862 253.837L157.895 254.984L158.786 255.736L159.735 255.057L158.862 253.837ZM174.409 242.264L175.324 243.453L175.33 243.448L175.336 243.443L174.409 242.264ZM178.705 238.885L179.632 240.064L181.287 238.761L179.516 237.623L178.705 238.885ZM162.851 220.757L161.78 219.707L161.049 220.452L161.495 221.397L162.851 220.757ZM174.102 209.286L175.173 210.337L176.082 209.41L175.295 208.377L174.102 209.286ZM235.163 145.072L236.036 146.292L237.92 144.945L235.92 143.777L235.163 145.072ZM206.014 136.162L205.91 137.658L205.913 137.658L206.014 136.162ZM165.817 146.506L166.629 147.767L166.632 147.765L165.817 146.506ZM150.578 159.922L149.43 158.956L148.681 159.846L149.357 160.793L150.578 159.922ZM162.135 175.489L160.946 176.403L160.951 176.409L160.955 176.415L162.135 175.489ZM165.511 179.791L164.331 180.717L165.634 182.378L166.773 180.6L165.511 179.791ZM183.614 163.916L184.655 162.836L183.913 162.122L182.98 162.557L183.614 163.916ZM194.354 174.26L193.313 175.341L194.212 176.206L195.226 175.48L194.354 174.26ZM259.608 235.505L258.411 236.409L259.789 238.233L260.914 236.243L259.608 235.505ZM268.2 206.931L269.696 207.033L269.697 207.024L268.2 206.931ZM257.87 166.784L259.135 165.979L259.132 165.974L257.87 166.784ZM244.471 151.524L245.439 150.378L244.547 149.625L243.598 150.304L244.471 151.524ZM228.924 163.097L228.009 161.909L228.003 161.913L227.997 161.918L228.924 163.097ZM224.629 166.477L223.701 165.298L222.034 166.609L223.826 167.744L224.629 166.477ZM240.584 184.604L239.228 185.244L239.235 185.259L239.242 185.274L240.584 184.604ZM240.687 184.809L241.767 185.849L242.502 185.086L242.029 184.139L240.687 184.809ZM229.845 196.075L228.764 195.035L227.877 195.957L228.648 196.979L229.845 196.075ZM167.413 261.585C176.201 266.718 186.346 269.964 197.219 270.696L197.421 267.703C187.019 267.002 177.321 263.898 168.926 258.994L167.413 261.585ZM197.226 270.697C212.283 271.639 226.405 267.659 238.22 260.12L236.607 257.591C225.307 264.8 211.813 268.604 197.413 267.703L197.226 270.697ZM238.225 260.117C244.08 256.348 249.307 251.742 253.801 246.405L251.506 244.473C247.204 249.583 242.203 253.989 236.602 257.594L238.225 260.117ZM253.874 244.568C250.283 239.533 246.385 234.295 242.285 228.958L239.906 230.786C243.989 236.1 247.864 241.309 251.432 246.31L253.874 244.568ZM242.276 228.946C241.713 228.229 241.151 227.512 240.588 226.795C240.026 226.078 239.463 225.362 238.901 224.645L236.54 226.497C237.103 227.213 237.665 227.93 238.228 228.647C238.791 229.364 239.353 230.081 239.916 230.798L242.276 228.946ZM236.449 224.775C232.311 231.384 226.193 236.725 219.078 240.089L220.36 242.801C227.974 239.201 234.538 233.481 238.992 226.367L236.449 224.775ZM220.766 240.371L209.311 229.207L207.217 231.356L218.672 242.519L220.766 240.371ZM207.365 229.081L167.271 259.089L169.069 261.49L209.163 231.483L207.365 229.081ZM142.524 168.806C137.505 177.601 134.368 187.549 133.637 198.329L136.63 198.532C137.33 188.214 140.33 178.703 145.13 170.293L142.524 168.806ZM133.636 198.337C132.696 213.409 136.668 227.654 144.201 239.388L146.726 237.767C139.531 226.56 135.73 212.947 136.63 198.524L133.636 198.337ZM144.201 239.388C147.965 245.25 152.565 250.484 157.895 254.984L159.83 252.691C154.727 248.383 150.327 243.376 146.726 237.767L144.201 239.388ZM159.735 255.057C164.764 251.461 169.994 247.558 175.324 243.453L173.494 241.076C168.187 245.164 162.985 249.045 157.99 252.617L159.735 255.057ZM175.336 243.443C176.768 242.317 178.2 241.19 179.632 240.064L177.777 237.706C176.345 238.832 174.913 239.959 173.481 241.086L175.336 243.443ZM179.516 237.623C172.904 233.374 167.568 227.241 164.208 220.117L161.495 221.397C165.09 229.021 170.8 235.588 177.894 240.147L179.516 237.623ZM163.922 221.807L175.173 210.337L173.031 208.236L161.78 219.707L163.922 221.807ZM175.295 208.377L145.02 168.64L142.634 170.458L172.909 210.196L175.295 208.377ZM235.92 143.777C227.132 138.643 216.987 135.398 206.114 134.665L205.913 137.658C216.315 138.359 226.012 141.463 234.407 146.367L235.92 143.777ZM206.118 134.665C191.055 133.618 176.824 137.599 165.003 145.246L166.632 147.765C177.926 140.459 191.515 136.657 205.91 137.658L206.118 134.665ZM165.006 145.244C159.151 149.013 153.924 153.619 149.43 158.956L151.725 160.888C156.027 155.779 161.028 151.372 166.629 147.767L165.006 145.244ZM149.357 160.793C152.948 165.828 156.846 171.066 160.946 176.403L163.325 174.575C159.242 169.261 155.367 164.052 151.799 159.051L149.357 160.793ZM160.955 176.415C161.518 177.132 162.08 177.849 162.643 178.566C163.205 179.283 163.768 180 164.331 180.717L166.691 178.865C166.128 178.148 165.566 177.431 165.003 176.714C164.441 175.997 163.878 175.28 163.315 174.563L160.955 176.415ZM166.773 180.6C171.021 173.973 177.044 168.635 184.248 165.276L182.98 162.557C175.251 166.161 168.796 171.885 164.248 178.981L166.773 180.6ZM182.574 164.997L193.313 175.341L195.394 173.18L184.655 162.836L182.574 164.997ZM195.226 175.48L236.036 146.292L234.291 143.852L193.481 173.04L195.226 175.48ZM260.914 236.243C265.827 227.556 268.964 217.713 269.696 207.033L266.703 206.828C266.003 217.042 263.004 226.453 258.303 234.767L260.914 236.243ZM269.697 207.024C270.638 191.949 266.663 177.81 259.135 165.979L256.604 167.589C263.804 178.904 267.603 192.417 266.703 206.837L269.697 207.024ZM259.132 165.974C255.368 160.111 250.769 154.878 245.439 150.378L243.503 152.67C248.606 156.978 253.007 161.986 256.607 167.594L259.132 165.974ZM243.598 150.304C238.57 153.901 233.339 157.803 228.009 161.909L229.84 164.285C235.147 160.197 240.349 156.316 245.344 152.744L243.598 150.304ZM227.997 161.918C227.281 162.481 226.565 163.045 225.849 163.608C225.133 164.171 224.417 164.734 223.701 165.298L225.556 167.656C226.272 167.092 226.988 166.529 227.704 165.966C228.42 165.402 229.136 164.839 229.852 164.276L227.997 161.918ZM223.826 167.744C230.535 171.992 235.869 178.121 239.228 185.244L241.941 183.964C238.345 176.339 232.632 169.769 225.431 165.209L223.826 167.744ZM239.242 185.274L239.345 185.479L242.029 184.139L241.926 183.934L239.242 185.274ZM239.606 183.769L228.764 195.035L230.926 197.115L241.767 185.849L239.606 183.769ZM228.648 196.979L258.411 236.409L260.806 234.601L231.042 195.171L228.648 196.979Z"
+ fill="#00AE99"
+ />
+ <Rectangle
+ vector-effect="non-scaling-stroke"
+ d="M269 135V268.333H442V135H269Z"
+ stroke="#00AE99"
+ strokeWidth="3"
+ />
+ <Square
+ vector-effect="non-scaling-stroke"
+ d="M339.64 269.64L270 339.281L343.913 413.194L413.554 343.554L339.64 269.64Z"
+ stroke="#00AE99"
+ strokeWidth="3"
+ />
+ <Oblong
+ vector-effect="non-scaling-stroke"
+ d="M202.5 269C202.5 269 269 269 269 335.5C269 402 202.5 402 202.5 402H-6.5C-6.5 402 -77 402 -77 335.5C-77 269 -6.5 269 -6.5 269H202.5Z"
+ stroke="#00AE99"
+ strokeWidth="3"
+ />
+ </g>
+ </Image>
+);
+
+const moveUp = keyframes`
+ 0% { transform: translate3d(0, 0, 0) }
+ 45% { transform: translate3d(0, 0, 0) }
+ 55% { transform: translate3d(0, -7%, 0) }
+ 85% { transform: translate3d(0, -7%, 0) }
+ 100% { transform: translate3d(0, 0, 0) }
+`;
+
+const moveLeft = keyframes`
+ 0% { transform: translate3d(0, 0, 0) }
+ 45% { transform: translate3d(0, 0, 0) }
+ 55% { transform: translate3d(-7%, 0, 0) }
+ 85% { transform: translate3d(-7%, 0, 0) }
+ 100% { transform: translate3d(0, 0, 0) }
+`;
+
+const moveDiag = keyframes`
+ 0% { transform: translate3d(0, 0, 0) }
+ 45% { transform: translate3d(0, 0, 0) }
+ 55% { transform: translate3d(5%, 5%, 0) }
+ 85% { transform: translate3d(5%, 5%, 0) }
+ 100% { transform: translate3d(0, 0, 0) }
+`;
+
+const moveRight = keyframes`
+ 0% { transform: translate3d(0, 0, 0) }
+ 45% { transform: translate3d(0, 0, 0) }
+ 55% { transform: translate3d(7%, 0, 0) }
+ 85% { transform: translate3d(7%, 0, 0) }
+ 100% { transform: translate3d(0, 0, 0) }
+`;
+
+const spin = keyframes`
+ 0% { transform: rotate(0deg) }
+ 65% { transform: rotate(0deg) }
+ 85% { transform: rotate(90deg) }
+ 100% { transform: rotate(90deg) }
+`;
+
+const moveIn = keyframes`
+ 0% { opacity: 0; transform: scale(1.7) rotate(-30deg) }
+ 100% { opacity: 1; transform: scale(1) rotate(0deg) }
+`;
+
+const Image = styled.svg`
+ opacity: 0;
+ transform: scale(1.5) rotate(-30deg);
+ animation: ${moveIn} 2s forwards;
+`;
+
+const TopCircle = styled.circle`
+ animation: ${moveUp} 4s -2.85s infinite;
+`;
+const LeftCircle = styled.circle`
+ animation: ${moveLeft} 4s -2.85s infinite;
+`;
+const Oblong = styled.path`
+ animation: ${moveLeft} 4s -2.85s infinite;
+`;
+const Square = styled.path`
+ animation: ${moveDiag} 4s -2.85s infinite;
+`;
+const Rectangle = styled.path`
+ animation: ${moveRight} 4s -2.85s infinite;
+`;
+
+const Logo = styled.path`
+ animation: ${spin} 4s -2.8s infinite;
+ transform-origin: 202px 202.7px;
+`;
diff --git a/packages/website/ts/components/heroImage.tsx b/packages/website/ts/components/heroImage.tsx
new file mode 100644
index 000000000..af7c055ac
--- /dev/null
+++ b/packages/website/ts/components/heroImage.tsx
@@ -0,0 +1,27 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+interface Props {
+ image: React.ReactNode;
+}
+
+export const LandingAnimation = (props: Props) => <Wrap>{props.image}</Wrap>;
+
+const Wrap = styled.figure`
+ display: inline-block;
+
+ svg {
+ width: 100%;
+ height: auto;
+ }
+
+ @media (min-width: 768px) {
+ width: 100%;
+ max-width: 400px;
+ }
+
+ @media (max-width: 768px) {
+ width: 180px;
+ margin-bottom: 40px;
+ }
+`;
diff --git a/packages/website/ts/components/icon.tsx b/packages/website/ts/components/icon.tsx
new file mode 100644
index 000000000..165e999b9
--- /dev/null
+++ b/packages/website/ts/components/icon.tsx
@@ -0,0 +1,72 @@
+import * as React from 'react';
+import Loadable from 'react-loadable';
+import styled from 'styled-components';
+
+import { Paragraph } from 'ts/components/text';
+import { getCSSPadding, PaddingInterface } from 'ts/constants/utilities';
+
+interface IconProps extends PaddingInterface {
+ name?: string;
+ component?: React.ReactNode;
+ size?: 'small' | 'medium' | 'large' | 'hero' | number;
+}
+
+export const Icon: React.FunctionComponent<IconProps> = (props: IconProps) => {
+ if (props.name && !props.component) {
+ const IconSVG = Loadable({
+ loader: async () => import(/* webpackChunkName: "icon" */ `ts/icons/illustrations/${props.name}.svg`),
+ loading: () => <Paragraph>Loading</Paragraph>,
+ });
+
+ return (
+ <StyledIcon {...props}>
+ <IconSVG />
+ </StyledIcon>
+ );
+ }
+
+ if (props.component) {
+ return <StyledIcon {...props}>{props.component}</StyledIcon>;
+ }
+
+ return null;
+};
+
+export const InlineIconWrap =
+ styled.div <
+ PaddingInterface >
+ `
+ margin: ${props => getCSSPadding(props.margin)};
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ > figure {
+ margin: 0 5px;
+ }
+`;
+
+const _getSize = (size: string | number = 'small'): string => {
+ if (typeof size === 'string') {
+ return `var(--${size}Icon)`;
+ }
+
+ return `${size}px`;
+};
+
+const StyledIcon =
+ styled.figure <
+ IconProps >
+ `
+ width: ${props => _getSize(props.size)};
+ height: ${props => _getSize(props.size)};
+ margin: ${props => getCSSPadding(props.margin)};
+ display: inline-block;
+ flex-shrink: 0;
+
+ svg {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ }
+`;
diff --git a/packages/website/ts/components/image.tsx b/packages/website/ts/components/image.tsx
new file mode 100644
index 000000000..65b2a9705
--- /dev/null
+++ b/packages/website/ts/components/image.tsx
@@ -0,0 +1,20 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+interface Props {
+ alt?: string;
+ src?: any;
+ srcset?: any;
+ isCentered?: boolean;
+}
+
+const ImageClass: React.FunctionComponent<Props> = (props: Props) => {
+ return <img {...props} />;
+};
+
+export const Image =
+ styled(ImageClass) <
+ Props >
+ `
+ margin: ${props => props.isCentered && `0 auto`};
+`;
diff --git a/packages/website/ts/components/link.tsx b/packages/website/ts/components/link.tsx
new file mode 100644
index 000000000..080a0abcc
--- /dev/null
+++ b/packages/website/ts/components/link.tsx
@@ -0,0 +1,64 @@
+import { Link as SmartLink } from '@0x/react-shared';
+import * as React from 'react';
+import styled from 'styled-components';
+
+interface LinkInterface {
+ color?: string;
+ children?: React.ReactNode | string;
+ isNoArrow?: boolean;
+ hasIcon?: boolean | string;
+ isBlock?: boolean;
+ isCentered?: boolean;
+ href?: string;
+ theme?: {
+ textColor: string;
+ };
+ shouldOpenInNewTab?: boolean;
+ target?: string;
+}
+
+export const Link = (props: LinkInterface) => {
+ const { children, isNoArrow, href } = props;
+
+ return (
+ <StyledLink to={href} {...props}>
+ {children}
+ {!isNoArrow && (
+ <svg width="25" height="25" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M8.484 5.246l.023 1.411 8.147.053L4.817 18.547l.996.996L17.65 7.706l.052 8.146 1.411.024-.068-10.561-10.561-.069z"
+ fill="currentColor"
+ />
+ </svg>
+ )}
+ </StyledLink>
+ );
+};
+
+// Added this, & + & doesnt really work since we switch with element types...
+export const LinkWrap = styled.div`
+ a + a,
+ a + button,
+ button + a {
+ margin-left: 20px;
+ }
+`;
+
+const StyledLink =
+ styled(SmartLink) <
+ LinkInterface >
+ `
+ display: ${props => !props.isBlock && 'inline-flex'};
+ color: ${props => props.color || props.theme.linkColor};
+ text-align: center;
+ font-size: 18px;
+ text-decoration: none;
+ align-items: center;
+
+ @media (max-width: 768px) {
+ }
+
+ svg {
+ margin-left: 3px;
+ }
+`;
diff --git a/packages/website/ts/components/logo.tsx b/packages/website/ts/components/logo.tsx
new file mode 100644
index 000000000..19aeb901e
--- /dev/null
+++ b/packages/website/ts/components/logo.tsx
@@ -0,0 +1,41 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { ThemeInterface } from 'ts/components/siteWrap';
+import LogoIcon from 'ts/icons/logo-with-type.svg';
+
+interface LogoInterface {
+ theme?: ThemeInterface;
+}
+
+// Note let's refactor this
+// is it absolutely necessary to have a stateless component
+// to pass props down into the styled icon?
+const StyledLogo = styled.div`
+ text-align: left;
+ position: relative;
+ z-index: 25;
+
+ @media (max-width: 800px) {
+ svg {
+ width: 60px;
+ }
+ }
+`;
+
+const Icon =
+ styled(LogoIcon) <
+ LogoInterface >
+ `
+ flex-shrink: 0;
+
+ path {
+ fill: ${props => props.theme.textColor};
+ }
+`;
+
+export const Logo: React.StatelessComponent<LogoInterface> = (props: LogoInterface) => (
+ <StyledLogo>
+ <Icon {...props} />
+ </StyledLogo>
+);
diff --git a/packages/website/ts/components/mobileNav.tsx b/packages/website/ts/components/mobileNav.tsx
new file mode 100644
index 000000000..573d21596
--- /dev/null
+++ b/packages/website/ts/components/mobileNav.tsx
@@ -0,0 +1,121 @@
+import * as React from 'react';
+import MediaQuery from 'react-responsive';
+import styled from 'styled-components';
+
+import { Link } from 'react-router-dom';
+
+import { WrapGrid, WrapProps } from 'ts/components/newLayout';
+import { WebsitePaths } from 'ts/types';
+
+interface Props {
+ isToggled: boolean;
+ toggleMobileNav: () => void;
+}
+
+export class MobileNav extends React.PureComponent<Props> {
+ public render(): React.ReactNode {
+ const { isToggled, toggleMobileNav } = this.props;
+
+ return (
+ <MediaQuery maxWidth={800}>
+ <Wrap isToggled={isToggled}>
+ <Section>
+ <h4>Products</h4>
+
+ <ul>
+ <li>
+ <Link to={WebsitePaths.Instant}>0x Instant</Link>
+ </li>
+ <li>
+ <Link to={WebsitePaths.LaunchKit}>0x Launch Kit</Link>
+ </li>
+ </ul>
+ </Section>
+
+ <Section isDark={true}>
+ <Grid as="ul" isFullWidth={true} isWrapped={true}>
+ <li>
+ <Link to={WebsitePaths.Why}>Why 0x</Link>
+ </li>
+ <li>
+ <Link to={WebsitePaths.AboutMission}>About</Link>
+ </li>
+ <li>
+ <a href="https://blog.0xproject.com/latest" target="_blank">
+ Blog
+ </a>
+ </li>
+ </Grid>
+ </Section>
+
+ {isToggled && <Overlay onClick={toggleMobileNav} />}
+ </Wrap>
+ </MediaQuery>
+ );
+ }
+}
+
+const Wrap =
+ styled.nav <
+ { isToggled: boolean } >
+ `
+ width: 100%;
+ height: 357px;
+ background-color: ${props => props.theme.mobileNavBgUpper};
+ color: ${props => props.theme.mobileNavColor};
+ transition: ${props => (props.isToggled ? 'visibility 0s, transform 0.5s' : 'visibility 0s 0.5s, transform 0.5s')};
+ transform: translate3d(0, ${props => (props.isToggled ? 0 : '-100%')}, 0);
+ visibility: ${props => !props.isToggled && 'hidden'};
+ position: fixed;
+ display: flex;
+ flex-direction: column;
+ justify-content: flex-end;
+ z-index: 20;
+ top: 0;
+ left: 0;
+ font-size: 20px;
+
+ a {
+ padding: 15px 0;
+ display: block;
+ color: inherit;
+ }
+
+ h4 {
+ font-size: 14px;
+ opacity: 0.5;
+ }
+`;
+
+const Overlay = styled.div`
+ position: absolute;
+ width: 100vw;
+ height: 100vh;
+ top: 100%;
+ background: transparent;
+ cursor: pointer;
+`;
+
+interface SectionProps {
+ isDark?: boolean;
+}
+const Section =
+ styled.div <
+ SectionProps >
+ `
+ width: 100%;
+ padding: 15px 30px;
+ background-color: ${props => (props.isDark ? props.theme.mobileNavBgLower : 'transparent')};
+`;
+
+const Grid =
+ styled(WrapGrid) <
+ WrapProps >
+ `
+ justify-content: flex-start;
+
+ li {
+ width: 50%;
+ flex-shrink: 0;
+ }
+`;
diff --git a/packages/website/ts/components/modals/input.tsx b/packages/website/ts/components/modals/input.tsx
new file mode 100644
index 000000000..8cfcc9763
--- /dev/null
+++ b/packages/website/ts/components/modals/input.tsx
@@ -0,0 +1,95 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+export enum InputWidth {
+ Half,
+ Full,
+}
+
+interface InputProps {
+ name: string;
+ width?: InputWidth;
+ label: string;
+ type?: string;
+ errors?: ErrorProps;
+ isErrors?: boolean;
+ required?: boolean;
+}
+
+interface ErrorProps {
+ [key: string]: string;
+}
+
+export const Input = React.forwardRef((props: InputProps, ref?: React.Ref<HTMLInputElement>) => {
+ const { name, label, type, errors } = props;
+ const id = `input-${name}`;
+ const componentType = type === 'textarea' ? 'textarea' : 'input';
+ const isErrors = errors.hasOwnProperty(name) && errors[name] !== null;
+ const errorMessage = isErrors ? errors[name] : null;
+
+ return (
+ <InputWrapper {...props}>
+ <Label htmlFor={id}>{label}</Label>
+ <StyledInput as={componentType} ref={ref} id={id} isErrors={isErrors} {...props} />
+ {isErrors && <Error>{errorMessage}</Error>}
+ </InputWrapper>
+ );
+});
+
+Input.defaultProps = {
+ width: InputWidth.Full,
+ errors: {},
+};
+
+const StyledInput = styled.input`
+ appearance: none;
+ background-color: #fff;
+ border: 1px solid #d5d5d5;
+ color: #000;
+ font-size: 1.294117647rem;
+ padding: 16px 15px 14px;
+ outline: none;
+ width: 100%;
+ min-height: ${props => props.type === 'textarea' && `120px`};
+
+ background-color: ${(props: InputProps) => props.isErrors && `#FDEDED`};
+ border-color: ${(props: InputProps) => props.isErrors && `#FD0000`};
+
+ &::placeholder {
+ color: #c3c3c3;
+ }
+`;
+
+const InputWrapper =
+ styled.div <
+ InputProps >
+ `
+ position: relative;
+ flex-grow: ${props => props.width === InputWidth.Full && 1};
+ width: ${props => props.width === InputWidth.Half && `calc(50% - 15px)`};
+
+ @media (max-width: 768px) {
+ width: 100%;
+ margin-bottom: 30px;
+ }
+`;
+
+const Label = styled.label`
+ color: #000;
+ font-size: 1.111111111rem;
+ line-height: 1.4em;
+ margin-bottom: 10px;
+ display: inline-block;
+`;
+
+const Error = styled.span`
+ color: #fd0000;
+ font-size: 0.833333333rem;
+ line-height: 1em;
+ display: inline-block;
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ width: 100%;
+ transform: translateY(24px);
+`;
diff --git a/packages/website/ts/components/modals/modal_contact.tsx b/packages/website/ts/components/modals/modal_contact.tsx
new file mode 100644
index 000000000..a3a1f13f5
--- /dev/null
+++ b/packages/website/ts/components/modals/modal_contact.tsx
@@ -0,0 +1,395 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { colors } from 'ts/style/colors';
+
+import { DialogContent, DialogOverlay } from '@reach/dialog';
+import '@reach/dialog/styles.css';
+
+import { Button } from 'ts/components/button';
+import { Icon } from 'ts/components/icon';
+import { Input, InputWidth } from 'ts/components/modals/input';
+import { Heading, Paragraph } from 'ts/components/text';
+import { GlobalStyle } from 'ts/constants/globalStyle';
+
+export enum ModalContactType {
+ General = 'GENERAL',
+ MarketMaker = 'MARKET_MAKER',
+}
+
+interface Props {
+ theme?: GlobalStyle;
+ isOpen?: boolean;
+ onDismiss?: () => void;
+ modalContactType: ModalContactType;
+}
+
+interface FormProps {
+ isSuccessful?: boolean;
+ isSubmitting?: boolean;
+}
+
+interface ErrorResponseProps {
+ param: string;
+ location: string;
+ msg: string;
+}
+
+interface ErrorResponse {
+ errors: ErrorResponseProps[];
+}
+
+interface ErrorProps {
+ [key: string]: string;
+}
+
+export class ModalContact extends React.Component<Props> {
+ public static defaultProps = {
+ modalContactType: ModalContactType.General,
+ };
+ public state = {
+ isSubmitting: false,
+ isSuccessful: false,
+ errors: {},
+ };
+ // shared fields
+ public nameRef: React.RefObject<HTMLInputElement> = React.createRef();
+ public emailRef: React.RefObject<HTMLInputElement> = React.createRef();
+ public companyProjectRef: React.RefObject<HTMLInputElement> = React.createRef();
+ public commentsRef: React.RefObject<HTMLInputElement> = React.createRef();
+ // general lead fields
+ public linkRef: React.RefObject<HTMLInputElement> = React.createRef();
+ // market maker lead fields
+ public countryRef: React.RefObject<HTMLInputElement> = React.createRef();
+ public fundSizeRef: React.RefObject<HTMLInputElement> = React.createRef();
+ public constructor(props: Props) {
+ super(props);
+ }
+ public render(): React.ReactNode {
+ const { isOpen, onDismiss } = this.props;
+ const { isSuccessful, errors } = this.state;
+ return (
+ <>
+ <DialogOverlay
+ style={{ background: 'rgba(0, 0, 0, 0.75)', zIndex: 30 }}
+ isOpen={isOpen}
+ onDismiss={onDismiss}
+ >
+ <StyledDialogContent>
+ <Form onSubmit={this._onSubmitAsync.bind(this)} isSuccessful={isSuccessful}>
+ <Heading color={colors.textDarkPrimary} size={34} asElement="h2">
+ Contact the 0x Core Team
+ </Heading>
+ {this._renderFormContent(errors)}
+ <ButtonRow>
+ <Button
+ color="#5C5C5C"
+ isNoBorder={true}
+ isTransparent={true}
+ type="button"
+ onClick={this.props.onDismiss}
+ >
+ Back
+ </Button>
+ <Button>Submit</Button>
+ </ButtonRow>
+ </Form>
+ <Confirmation isSuccessful={isSuccessful}>
+ <Icon name="rocketship" size="large" margin={[0, 0, 'default', 0]} />
+ <Heading color={colors.textDarkPrimary} size={34} asElement="h2">
+ Thanks for contacting us.
+ </Heading>
+ <Paragraph isMuted={true} color={colors.textDarkPrimary}>
+ We'll get back to you soon. If you need quick support in the meantime, reach out to the
+ 0x team on Discord.
+ </Paragraph>
+ <Button onClick={this.props.onDismiss}>Done</Button>
+ </Confirmation>
+ </StyledDialogContent>
+ </DialogOverlay>
+ </>
+ );
+ }
+ public _renderFormContent(errors: ErrorProps): React.ReactNode {
+ switch (this.props.modalContactType) {
+ case ModalContactType.MarketMaker:
+ return this._renderMarketMakerFormContent(errors);
+ case ModalContactType.General:
+ default:
+ return this._renderGeneralFormContent(errors);
+ }
+ }
+ private _renderMarketMakerFormContent(errors: ErrorProps): React.ReactNode {
+ return (
+ <>
+ <Paragraph isMuted={true} color={colors.textDarkPrimary}>
+ If you’re considering market making on 0x, we’re happy to answer your questions. Fill out the form
+ so we can connect you with the right person to help you get started.
+ </Paragraph>
+ <InputRow>
+ <Input
+ name="name"
+ label="Your name"
+ type="text"
+ width={InputWidth.Half}
+ ref={this.nameRef}
+ required={true}
+ errors={errors}
+ />
+ <Input
+ name="email"
+ label="Your email"
+ type="email"
+ ref={this.emailRef}
+ required={true}
+ errors={errors}
+ width={InputWidth.Half}
+ />
+ </InputRow>
+ <InputRow>
+ <Input
+ name="country"
+ label="Country of Location"
+ type="text"
+ ref={this.countryRef}
+ required={true}
+ errors={errors}
+ />
+ </InputRow>
+ <InputRow>
+ <Input
+ name="fundSize"
+ label="Fund Size"
+ type="text"
+ ref={this.fundSizeRef}
+ required={true}
+ errors={errors}
+ />
+ </InputRow>
+ <InputRow>
+ <Input
+ name="companyOrProject"
+ label="Name of your project / company"
+ type="text"
+ ref={this.companyProjectRef}
+ required={false}
+ errors={errors}
+ />
+ </InputRow>
+ <InputRow>
+ <Input
+ name="comments"
+ label="What is prompting you to reach out?"
+ type="textarea"
+ ref={this.commentsRef}
+ required={false}
+ errors={errors}
+ />
+ </InputRow>
+ </>
+ );
+ }
+ private _renderGeneralFormContent(errors: ErrorProps): React.ReactNode {
+ return (
+ <>
+ <Paragraph isMuted={true} color={colors.textDarkPrimary}>
+ If you're considering building on 0x, we're happy to answer your questions. Fill out the form so we
+ can connect you with the right person to help you get started.
+ </Paragraph>
+ <InputRow>
+ <Input
+ name="name"
+ label="Your name"
+ type="text"
+ width={InputWidth.Half}
+ ref={this.nameRef}
+ required={true}
+ errors={errors}
+ />
+ <Input
+ name="email"
+ label="Your email"
+ type="email"
+ ref={this.emailRef}
+ required={true}
+ errors={errors}
+ width={InputWidth.Half}
+ />
+ </InputRow>
+ <InputRow>
+ <Input
+ name="companyOrProject"
+ label="Name of your project / company"
+ type="text"
+ ref={this.companyProjectRef}
+ required={true}
+ errors={errors}
+ />
+ </InputRow>
+ <InputRow>
+ <Input
+ name="link"
+ label="Do you have any documentation or a website?"
+ type="text"
+ ref={this.linkRef}
+ errors={errors}
+ />
+ </InputRow>
+ <InputRow>
+ <Input
+ name="comments"
+ label="Anything else?"
+ type="textarea"
+ ref={this.commentsRef}
+ errors={errors}
+ />
+ </InputRow>
+ </>
+ );
+ }
+ private async _onSubmitAsync(e: Event): Promise<void> {
+ e.preventDefault();
+
+ let jsonBody;
+ if (this.props.modalContactType === ModalContactType.MarketMaker) {
+ jsonBody = {
+ name: this.nameRef.current.value,
+ email: this.emailRef.current.value,
+ country: this.countryRef.current.value,
+ fundSize: this.fundSizeRef.current.value,
+ projectOrCompany: this.companyProjectRef.current.value,
+ comments: this.commentsRef.current.value,
+ };
+ } else {
+ jsonBody = {
+ name: this.nameRef.current.value,
+ email: this.emailRef.current.value,
+ projectOrCompany: this.companyProjectRef.current.value,
+ link: this.linkRef.current.value,
+ comments: this.commentsRef.current.value,
+ };
+ }
+
+ this.setState({ ...this.state, errors: [], isSubmitting: true });
+
+ const endpoint =
+ this.props.modalContactType === ModalContactType.MarketMaker ? '/market_maker_leads' : '/leads';
+
+ try {
+ // Disabling no-unbound method b/c no reason for _.isEmpty to be bound
+ // tslint:disable:no-unbound-method
+ const response = await fetch(`https://website-api.0xproject.com${endpoint}`, {
+ method: 'post',
+ mode: 'cors',
+ credentials: 'same-origin',
+ headers: {
+ 'content-type': 'application/json; charset=utf-8',
+ },
+ body: JSON.stringify(_.omitBy(jsonBody, _.isEmpty)),
+ });
+
+ if (!response.ok) {
+ const errorResponse: ErrorResponse = await response.json();
+ const errors = this._parseErrors(errorResponse.errors);
+ this.setState({ ...this.state, isSubmitting: false, errors });
+
+ throw new Error('Request failed');
+ }
+
+ this.setState({ ...this.state, isSuccessful: true });
+ } catch (e) {
+ // Empty block
+ }
+ }
+ private _parseErrors(errors: ErrorResponseProps[]): ErrorProps {
+ const initialValue: {} = {};
+ return _.reduce(
+ errors,
+ (hash: ErrorProps, error: ErrorResponseProps) => {
+ const { param, msg } = error;
+ const key = param;
+ hash[key] = msg;
+
+ return hash;
+ },
+ initialValue,
+ );
+ }
+}
+
+// Handle errors: {"errors":[{"location":"body","param":"name","msg":"Invalid value"},{"location":"body","param":"email","msg":"Invalid value"}]}
+
+const InputRow = styled.div`
+ width: 100%;
+ flex: 0 0 auto;
+
+ @media (min-width: 768px) {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 30px;
+ }
+`;
+
+const ButtonRow = styled(InputRow)`
+ @media (max-width: 768px) {
+ display: flex;
+ flex-direction: column;
+
+ button:nth-child(1) {
+ order: 2;
+ }
+
+ button:nth-child(2) {
+ order: 1;
+ margin-bottom: 10px;
+ }
+ }
+`;
+
+const StyledDialogContent = styled(DialogContent)`
+ position: relative;
+ max-width: 800px;
+ background-color: #f6f6f6 !important;
+ padding: 60px 60px !important;
+
+ @media (max-width: 768px) {
+ width: calc(100vw - 40px) !important;
+ margin: 40px auto !important;
+ padding: 30px 30px !important;
+ }
+`;
+
+const Form =
+ styled.form <
+ FormProps >
+ `
+ position: relative;
+ transition: opacity 0.30s ease-in-out, visibility 0.30s ease-in-out;
+
+ opacity: ${props => props.isSuccessful && `0`};
+ visibility: ${props => props.isSuccessful && `hidden`};
+`;
+
+const Confirmation =
+ styled.div <
+ FormProps >
+ `
+ position: absolute;
+ top: 50%;
+ text-align: center;
+ width: 100%;
+ left: 0;
+ transition: opacity 0.30s ease-in-out, visibility 0.30s ease-in-out;
+ transition-delay: 0.40s;
+ padding: 60px 60px;
+ transform: translateY(-50%);
+ opacity: ${props => (props.isSuccessful ? `1` : `0`)};
+ visibility: ${props => (props.isSuccessful ? 'visible' : `hidden`)};
+
+ p {
+ max-width: 492px;
+ margin-left: auto;
+ margin-right: auto;
+ }
+`;
diff --git a/packages/website/ts/components/newLayout.tsx b/packages/website/ts/components/newLayout.tsx
new file mode 100644
index 000000000..28e7653c5
--- /dev/null
+++ b/packages/website/ts/components/newLayout.tsx
@@ -0,0 +1,152 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+export interface WrapProps {
+ bgColor?: string;
+ id?: string;
+ offsetTop?: string;
+ maxWidth?: string;
+ wrapWidth?: string;
+ isFullWidth?: boolean;
+ isTextCentered?: boolean;
+ isCentered?: boolean;
+ isWrapped?: boolean;
+}
+
+export interface WrapGridProps {
+ isWrapped?: boolean;
+ isCentered?: boolean;
+}
+
+export interface WrapStickyProps {
+ offsetTop?: string;
+}
+
+export interface SectionProps extends WrapProps {
+ isPadded?: boolean;
+ isFullWidth?: boolean;
+ isFlex?: boolean;
+ padding?: string;
+ paddingMobile?: string;
+ flexBreakpoint?: string;
+ maxWidth?: string;
+ bgColor?: 'dark' | 'light' | string;
+ children: any;
+}
+
+export interface FlexProps {
+ padding?: string;
+ isFlex?: boolean;
+ flexBreakpoint?: string;
+}
+
+export interface ColumnProps {
+ padding?: string;
+ width?: string;
+ maxWidth?: string;
+}
+
+export const Section: React.FunctionComponent<SectionProps> = (props: SectionProps) => {
+ return (
+ <SectionBase {...props}>
+ <Wrap {...props}>{props.children}</Wrap>
+ </SectionBase>
+ );
+};
+
+export const Column =
+ styled.div <
+ ColumnProps >
+ `
+ width: ${props => props.width};
+ max-width: ${props => props.maxWidth};
+ padding: ${props => props.padding};
+
+ @media (max-width: 768px) {
+ width: 100%;
+
+ & + & {
+ margin-top: 60px;
+ }
+ }
+`;
+
+export const FlexWrap =
+ styled.div <
+ FlexProps >
+ `
+ max-width: 1500px;
+ margin: 0 auto;
+ padding: ${props => props.padding};
+
+ @media (min-width: ${props => props.flexBreakpoint || '768px'}) {
+ display: ${props => props.isFlex && 'flex'};
+ justify-content: ${props => props.isFlex && 'space-between'};
+ }
+`;
+
+export const WrapSticky =
+ styled.div <
+ WrapProps >
+ `
+ position: sticky;
+ top: ${props => props.offsetTop || '60px'};
+`;
+
+const SectionBase =
+ styled.section <
+ SectionProps >
+ `
+ width: ${props => !props.isFullWidth && 'calc(100% - 60px)'};
+ max-width: 1500px;
+ margin: 0 auto;
+ padding: ${props => props.isPadded && '120px 0'};
+ background-color: ${props => props.theme[`${props.bgColor}BgColor`] || props.bgColor};
+ position: relative;
+ overflow: ${props => !props.isFullWidth && 'hidden'};
+
+ @media (max-width: 768px) {
+ padding: ${props => props.isPadded && (props.paddingMobile || '40px 0')};
+ }
+`;
+
+const Wrap =
+ styled(FlexWrap) <
+ WrapProps >
+ `
+ width: ${props => props.wrapWidth || 'calc(100% - 60px)'};
+ width: ${props => props.bgColor && 'calc(100% - 60px)'};
+ max-width: ${props => !props.isFullWidth && (props.maxWidth || '895px')};
+ text-align: ${props => props.isTextCentered && 'center'};
+ margin: 0 auto;
+`;
+
+export const WrapGrid =
+ styled(Wrap) <
+ WrapProps >
+ `
+ display: flex;
+ flex-wrap: ${props => props.isWrapped && `wrap`};
+ justify-content: ${props => (props.isCentered ? `center` : 'space-between')};
+
+ @media (max-width: 768px) {
+ width: 100%;
+ }
+`;
+
+Section.defaultProps = {
+ isPadded: true,
+};
+
+FlexWrap.defaultProps = {
+ isFlex: true,
+};
+
+WrapGrid.defaultProps = {
+ isCentered: true,
+ isFullWidth: true,
+};
+
+Wrap.defaultProps = {
+ isFlex: false,
+};
diff --git a/packages/website/ts/components/newsletter_form.tsx b/packages/website/ts/components/newsletter_form.tsx
new file mode 100644
index 000000000..4a7abb7ec
--- /dev/null
+++ b/packages/website/ts/components/newsletter_form.tsx
@@ -0,0 +1,202 @@
+import * as React from 'react';
+import styled, { withTheme } from 'styled-components';
+
+import { ThemeValuesInterface } from 'ts/components/siteWrap';
+import { colors } from 'ts/style/colors';
+import { errorReporter } from 'ts/utils/error_reporter';
+
+interface FormProps {
+ theme: ThemeValuesInterface;
+}
+
+interface InputProps {
+ isSubmitted: boolean;
+ name: string;
+ type: string;
+ label: string;
+ textColor: string;
+ required?: boolean;
+}
+
+interface ArrowProps {
+ isSubmitted: boolean;
+}
+
+const Input = React.forwardRef((props: InputProps, ref: React.Ref<HTMLInputElement>) => {
+ const { name, label, type } = props;
+ const id = `input-${name}`;
+
+ return (
+ <InnerInputWrapper {...props}>
+ <label className="visuallyHidden" htmlFor={id}>
+ {label}
+ </label>
+ <StyledInput ref={ref} id={id} placeholder={label} type={type || 'text'} {...props} />
+ </InnerInputWrapper>
+ );
+});
+
+class Form extends React.Component<FormProps> {
+ public emailInput = React.createRef<HTMLInputElement>();
+ public state = {
+ isSubmitted: false,
+ };
+ public render(): React.ReactNode {
+ const { isSubmitted } = this.state;
+ const { theme } = this.props;
+
+ return (
+ <StyledForm onSubmit={this._onSubmitAsync.bind(this)}>
+ <InputWrapper>
+ <Input
+ isSubmitted={isSubmitted}
+ name="email"
+ type="email"
+ label="Email Address"
+ ref={this.emailInput}
+ required={true}
+ textColor={theme.textColor}
+ />
+
+ <SubmitButton>
+ <Arrow
+ isSubmitted={isSubmitted}
+ width="22"
+ height="17"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M13.066 0l-1.068 1.147 6.232 6.557H0v1.592h18.23l-6.232 6.557L13.066 17l8.08-8.5-8.08-8.5z"
+ fill="#CBCBCB"
+ />
+ </Arrow>
+ </SubmitButton>
+ <SuccessText isSubmitted={isSubmitted}>🎉 Thank you for signing up!</SuccessText>
+ </InputWrapper>
+ <Text>Subscribe to our newsletter for updates in the 0x ecosystem</Text>
+ </StyledForm>
+ );
+ }
+
+ private async _onSubmitAsync(e: React.FormEvent<HTMLFormElement>): Promise<void> {
+ e.preventDefault();
+
+ const email = this.emailInput.current.value;
+ const referrer = 'https://0x.org/';
+
+ this.setState({ isSubmitted: true });
+
+ if (email === 'triggererror@0xproject.org') {
+ throw new Error('Manually triggered error');
+ }
+
+ try {
+ await fetch('https://website-api.0x.org/newsletter_subscriber/substack', {
+ method: 'post',
+ mode: 'cors',
+ headers: {
+ 'content-type': 'application/json; charset=utf-8',
+ },
+ body: JSON.stringify({ email, referrer }),
+ });
+ } catch (e) {
+ errorReporter.report(e);
+ }
+ }
+}
+
+export const NewsletterForm = withTheme(Form);
+
+const StyledForm = styled.form`
+ appearance: none;
+ border: 0;
+ color: ${colors.white};
+ padding: 13px 0 14px;
+ margin-top: 27px;
+`;
+
+const StyledInput =
+ styled.input <
+ InputProps >
+ `
+ appearance: none;
+ background-color: transparent;
+ border: 0;
+ border-bottom: 1px solid #393939;
+ color: ${props => props.textColor || '#fff'};
+ font-size: 1.294117647rem;
+ padding: 15px 0;
+ outline: none;
+ width: 100%;
+
+ &::placeholder {
+ color: #B1B1B1; // #9D9D9D on light theme
+ }
+`;
+
+const InputWrapper = styled.div`
+ position: relative;
+`;
+
+const InnerInputWrapper =
+ styled.div <
+ ArrowProps >
+ `
+ opacity: ${props => props.isSubmitted && 0};
+ visibility: ${props => props.isSubmitted && 'hidden'};
+ transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
+ transition-delay: 0.30s;
+`;
+
+const SubmitButton = styled.button`
+ width: 44px;
+ height: 44px;
+ background-color: transparent;
+ border: 0;
+ position: absolute;
+ right: 0;
+ top: calc(50% - 22px);
+ overflow: hidden;
+ outline: 0;
+
+ &:focus-within {
+ //background-color: #eee;
+ }
+`;
+
+const Text = styled.p`
+ color: #656565;
+ font-size: 0.833333333rem;
+ font-weight: 300;
+ line-height: 1.2em;
+ margin-top: 15px;
+`;
+
+const SuccessText =
+ styled.p <
+ ArrowProps >
+ `
+ color: #B1B1B1;
+ font-size: 1rem;
+ font-weight: 300;
+ line-height: 1.2em;
+ padding-top: 25px;
+ position: absolute;
+ left: 0;
+ top: 0;
+ text-align: left;
+ right: 50px;
+ opacity: ${props => (props.isSubmitted ? 1 : 0)};
+ visibility: ${props => (props.isSubmitted ? 'visible' : 'hidden')};
+ transition: opacity 0.25s ease-in-out, visibility 0.25s ease-in-out;
+ transition-delay: 0.55s;
+`;
+
+const Arrow =
+ styled.svg <
+ ArrowProps >
+ `
+ transform: ${props => props.isSubmitted && `translateX(44px)`};
+ transition: transform 0.25s ease-in-out;
+`;
diff --git a/packages/website/ts/components/old_footer.tsx b/packages/website/ts/components/old_footer.tsx
new file mode 100644
index 000000000..6366bf4ea
--- /dev/null
+++ b/packages/website/ts/components/old_footer.tsx
@@ -0,0 +1,228 @@
+import { ALink, colors, Link } from '@0x/react-shared';
+import { ObjectMap } from '@0x/types';
+import * as _ from 'lodash';
+import DropDownMenu from 'material-ui/DropDownMenu';
+import MenuItem from 'material-ui/MenuItem';
+import * as React from 'react';
+
+import { Dispatcher } from 'ts/redux/dispatcher';
+import { Deco, Key, Language, WebsitePaths } from 'ts/types';
+import { constants } from 'ts/utils/constants';
+import { Translate } from 'ts/utils/translate';
+
+const ICON_DIMENSION = 16;
+
+const languageToMenuTitle = {
+ [Language.English]: 'English',
+ [Language.Russian]: 'Русский',
+ [Language.Spanish]: 'Español',
+ [Language.Korean]: '한국어',
+ [Language.Chinese]: '中文',
+};
+
+export interface FooterProps {
+ translate: Translate;
+ dispatcher: Dispatcher;
+ backgroundColor?: string;
+}
+
+interface FooterState {
+ selectedLanguage: Language;
+}
+
+export class Footer extends React.Component<FooterProps, FooterState> {
+ public static defaultProps = {
+ backgroundColor: colors.darkerGrey,
+ };
+ constructor(props: FooterProps) {
+ super(props);
+ this.state = {
+ selectedLanguage: props.translate.getLanguage(),
+ };
+ }
+ public render(): React.ReactNode {
+ const sectionNameToLinks: ObjectMap<ALink[]> = {
+ [Key.Documentation]: [
+ {
+ title: 'Developer Home',
+ to: WebsitePaths.Docs,
+ },
+ {
+ title: '0x.js',
+ to: WebsitePaths.ZeroExJs,
+ },
+ {
+ title: this.props.translate.get(Key.SmartContracts, Deco.Cap),
+ to: WebsitePaths.SmartContracts,
+ },
+ {
+ title: this.props.translate.get(Key.Connect, Deco.Cap),
+ to: WebsitePaths.Connect,
+ },
+ {
+ title: this.props.translate.get(Key.Whitepaper, Deco.Cap),
+ to: WebsitePaths.Whitepaper,
+ shouldOpenInNewTab: true,
+ },
+ {
+ title: this.props.translate.get(Key.Wiki, Deco.Cap),
+ to: WebsitePaths.Wiki,
+ },
+ ],
+ [Key.Community]: [
+ {
+ title: this.props.translate.get(Key.Discord, Deco.Cap),
+ to: constants.URL_ZEROEX_CHAT,
+ shouldOpenInNewTab: true,
+ },
+ {
+ title: this.props.translate.get(Key.Blog, Deco.Cap),
+ to: constants.URL_BLOG,
+ shouldOpenInNewTab: true,
+ },
+ {
+ title: 'Twitter',
+ to: constants.URL_TWITTER,
+ shouldOpenInNewTab: true,
+ },
+ {
+ title: 'Reddit',
+ to: constants.URL_REDDIT,
+ shouldOpenInNewTab: true,
+ },
+ {
+ title: this.props.translate.get(Key.Forum, Deco.Cap),
+ to: constants.URL_DISCOURSE_FORUM,
+ shouldOpenInNewTab: true,
+ },
+ ],
+ [Key.Organization]: [
+ {
+ title: this.props.translate.get(Key.About, Deco.Cap),
+ to: WebsitePaths.About,
+ },
+ {
+ title: this.props.translate.get(Key.Careers, Deco.Cap),
+ to: WebsitePaths.Careers,
+ },
+ {
+ title: this.props.translate.get(Key.Contact, Deco.Cap),
+ to: 'mailto:team@0x.org',
+ shouldOpenInNewTab: true,
+ },
+ ],
+ };
+ const languageMenuItems = _.map(languageToMenuTitle, (menuTitle: string, language: Language) => {
+ return <MenuItem key={menuTitle} value={language} primaryText={menuTitle} />;
+ });
+ return (
+ <div className="relative pb4 pt2" style={{ backgroundColor: this.props.backgroundColor }}>
+ <div className="mx-auto max-width-4 md-px2 lg-px0 py4 clearfix" style={{ color: colors.white }}>
+ <div className="col lg-col-4 md-col-4 col-12 left">
+ <div className="sm-mx-auto" style={{ width: 148 }}>
+ <div>
+ <img src="/images/protocol_logo_white.png" height="30" />
+ </div>
+ <div
+ style={{
+ fontSize: 11,
+ color: colors.grey,
+ paddingLeft: 37,
+ paddingTop: 2,
+ }}
+ >
+ © ZeroEx, Intl.
+ </div>
+ <div className="pt4 center">
+ <DropDownMenu
+ labelStyle={{ color: colors.white }}
+ value={this.state.selectedLanguage}
+ onChange={this._updateLanguage.bind(this)}
+ >
+ {languageMenuItems}
+ </DropDownMenu>
+ </div>
+ </div>
+ </div>
+ <div className="col lg-col-8 md-col-8 col-12 lg-pl4 md-pl4">
+ <div className="col lg-col-4 md-col-4 col-12">
+ <div className="lg-right md-right sm-center">
+ {this._renderHeader(Key.Documentation)}
+ {_.map(sectionNameToLinks[Key.Documentation], this._renderMenuItem.bind(this))}
+ </div>
+ </div>
+ <div className="col lg-col-4 md-col-4 col-12 lg-pr2 md-pr2">
+ <div className="lg-right md-right sm-center">
+ {this._renderHeader(Key.Community)}
+ {_.map(sectionNameToLinks[Key.Community], this._renderMenuItem.bind(this))}
+ </div>
+ </div>
+ <div className="col lg-col-4 md-col-4 col-12">
+ <div className="lg-right md-right sm-center">
+ {this._renderHeader(Key.Organization)}
+ {_.map(sectionNameToLinks[Key.Organization], this._renderMenuItem.bind(this))}
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ );
+ }
+ private _renderIcon(fileName: string): React.ReactNode {
+ return (
+ <div style={{ height: ICON_DIMENSION, width: ICON_DIMENSION }}>
+ <img src={`/images/social/${fileName}`} style={{ width: ICON_DIMENSION }} />
+ </div>
+ );
+ }
+ private _renderMenuItem(link: ALink): React.ReactNode {
+ const titleToIcon: { [title: string]: string } = {
+ [this.props.translate.get(Key.Discord, Deco.Cap)]: 'discord.png',
+ [this.props.translate.get(Key.Blog, Deco.Cap)]: 'medium.png',
+ Twitter: 'twitter.png',
+ Reddit: 'reddit.png',
+ [this.props.translate.get(Key.Forum, Deco.Cap)]: 'discourse.png',
+ };
+ const iconIfExists = titleToIcon[link.title];
+ return (
+ <div key={link.title} className="sm-center" style={{ fontSize: 13, paddingTop: 25 }}>
+ <Link
+ to={link.to}
+ shouldOpenInNewTab={link.shouldOpenInNewTab}
+ fontColor={colors.white}
+ className="text-decoration-none"
+ >
+ <div>
+ {!_.isUndefined(iconIfExists) ? (
+ <div className="inline-block">
+ <div className="pr1 table-cell">{this._renderIcon(iconIfExists)}</div>
+ <div className="table-cell">{link.title}</div>
+ </div>
+ ) : (
+ link.title
+ )}
+ </div>
+ </Link>
+ </div>
+ );
+ }
+ private _renderHeader(key: Key): React.ReactNode {
+ const headerStyle = {
+ color: colors.grey400,
+ letterSpacing: 2,
+ fontFamily: 'Roboto Mono',
+ fontSize: 13,
+ };
+ return (
+ <div className="lg-pb2 md-pb2 sm-pt4" style={headerStyle}>
+ {this.props.translate.get(key, Deco.Upper)}
+ </div>
+ );
+ }
+ private _updateLanguage(_event: any, _index: number, value: Language): void {
+ this.setState({
+ selectedLanguage: value,
+ });
+ this.props.dispatcher.updateSelectedLanguage(value);
+ }
+}
diff --git a/packages/website/ts/components/onboarding/onboarding_flow.tsx b/packages/website/ts/components/onboarding/onboarding_flow.tsx
index 91d5f2476..ec1b5bc42 100644
--- a/packages/website/ts/components/onboarding/onboarding_flow.tsx
+++ b/packages/website/ts/components/onboarding/onboarding_flow.tsx
@@ -7,8 +7,8 @@ import {
OnboardingTooltip,
TooltipPointerDisplay,
} from 'ts/components/onboarding/onboarding_tooltip';
-import { Animation } from 'ts/components/ui/animation';
import { Container } from 'ts/components/ui/container';
+import { EaseUpFromBottomAnimation } from 'ts/components/ui/ease_up_from_bottom_animation';
import { Overlay } from 'ts/components/ui/overlay';
import { zIndex } from 'ts/style/z_index';
@@ -66,7 +66,7 @@ export class OnboardingFlow extends React.Component<OnboardingFlowProps> {
let onboardingElement = null;
const currentStep = this._getCurrentStep();
if (this.props.isMobile) {
- onboardingElement = <Animation type="easeUpFromBottom">{this._renderOnboardingCard()}</Animation>;
+ onboardingElement = <EaseUpFromBottomAnimation>{this._renderOnboardingCard()}</EaseUpFromBottomAnimation>;
} else if (currentStep.position.type === 'target') {
const { placement, target } = currentStep.position;
onboardingElement = (
diff --git a/packages/website/ts/components/redirector.tsx b/packages/website/ts/components/redirector.tsx
deleted file mode 100644
index a02693003..000000000
--- a/packages/website/ts/components/redirector.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import { constants } from 'ts/utils/constants';
-
-interface RedirectorProps {
- location: string;
-}
-
-export function Redirector(_props: RedirectorProps): void {
- window.location.href = constants.URL_ANGELLIST;
-}
diff --git a/packages/website/ts/components/sections/landing/about.tsx b/packages/website/ts/components/sections/landing/about.tsx
new file mode 100644
index 000000000..9c369d83a
--- /dev/null
+++ b/packages/website/ts/components/sections/landing/about.tsx
@@ -0,0 +1,81 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { Button } from 'ts/components/button';
+import { Icon, InlineIconWrap } from 'ts/components/icon';
+import { Column, FlexWrap, Section } from 'ts/components/newLayout';
+import { Paragraph } from 'ts/components/text';
+import { WebsitePaths } from 'ts/types';
+
+interface FigureProps {
+ value: string;
+ description: string;
+}
+
+export const SectionLandingAbout = () => (
+ <Section bgColor="dark" isTextCentered={true}>
+ <InlineIconWrap>
+ <Icon name="descriptionCoin" size="small" />
+ <Icon name="descriptionCopy" size="small" />
+ <Icon name="descriptionFlask" size="small" />
+ <Icon name="descriptionBolt" size="small" />
+ </InlineIconWrap>
+
+ <Paragraph size="large" isCentered={true} isMuted={1} padding={['large', 0, 'default', 0]}>
+ Anyone in the world can use 0x to service a wide variety of markets ranging from gaming items to financial
+ instruments to assets that could have never existed before.
+ </Paragraph>
+
+ <DeveloperLink href={`${WebsitePaths.Why}#cases`} isWithArrow={true} isAccentColor={true}>
+ Discover how developers use 0x
+ </DeveloperLink>
+
+ <hr
+ style={{
+ width: '100%',
+ maxWidth: '340px',
+ borderColor: '#3C4746',
+ margin: '60px auto',
+ }}
+ />
+
+ <FlexWrap as="dl">
+ <Figure value="353K" description="Total Transactions" />
+
+ <Figure value="$447M" description="Total Volume" />
+
+ <Figure value="30+" description="Total Projects" />
+ </FlexWrap>
+ </Section>
+);
+
+const Figure = (props: FigureProps) => (
+ <Column padding="0 30px">
+ <FigureValue>{props.value}</FigureValue>
+ <FigureDescription>{props.description}</FigureDescription>
+ </Column>
+);
+
+const DeveloperLink = styled(Button)`
+ @media (max-width: 500px) {
+ && {
+ white-space: pre-wrap;
+ line-height: 1.3;
+ }
+ }
+`;
+
+const FigureValue = styled.dt`
+ font-size: 50px;
+ font-weight: 300;
+ margin-bottom: 15px;
+
+ @media (max-width: 768px) {
+ font-size: 40px;
+ }
+`;
+
+const FigureDescription = styled.dd`
+ font-size: 18px;
+ color: #999999;
+`;
diff --git a/packages/website/ts/components/sections/landing/clients.tsx b/packages/website/ts/components/sections/landing/clients.tsx
new file mode 100644
index 000000000..9a68fbf4c
--- /dev/null
+++ b/packages/website/ts/components/sections/landing/clients.tsx
@@ -0,0 +1,113 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import styled from 'styled-components';
+import { Heading } from 'ts/components/text';
+
+import { Section, WrapGrid } from 'ts/components/newLayout';
+
+interface ProjectLogo {
+ name: string;
+ imageUrl?: string;
+ persistOnMobile?: boolean;
+}
+
+interface StyledProjectInterface {
+ isOnMobile?: boolean;
+}
+
+const projects: ProjectLogo[] = [
+ {
+ name: 'Radar Relay',
+ imageUrl: 'images/clients/radar-relay.svg',
+ persistOnMobile: true,
+ },
+ {
+ name: 'Paradex',
+ imageUrl: 'images/clients/paradex.svg',
+ persistOnMobile: true,
+ },
+ {
+ name: 'Star Bit Ex',
+ imageUrl: 'images/clients/starbitex.svg',
+ },
+ {
+ name: 'LedgerDex',
+ imageUrl: 'images/clients/ledgerdex.svg',
+ },
+ {
+ name: 'OpenRelay',
+ imageUrl: 'images/clients/openrelay.svg',
+ persistOnMobile: true,
+ },
+ {
+ name: 'Bamboo Relay',
+ imageUrl: 'images/clients/bamboo.svg',
+ persistOnMobile: true,
+ },
+ {
+ name: 'dEX',
+ imageUrl: 'images/clients/ercdex.svg',
+ persistOnMobile: true,
+ },
+ {
+ name: 'emoon',
+ imageUrl: 'images/clients/emoon.svg',
+ persistOnMobile: true,
+ },
+ {
+ name: 'Gods Unchained',
+ imageUrl: 'images/clients/godsUnchained.svg',
+ },
+ {
+ name: 'Instex',
+ imageUrl: 'images/clients/instex.svg',
+ },
+ {
+ name: 'Lake Trade',
+ imageUrl: 'images/clients/laketrade.svg',
+ },
+ {
+ name: 'Veil',
+ imageUrl: 'images/clients/veil.svg',
+ },
+];
+
+export const SectionLandingClients = () => (
+ <Section isTextCentered={true}>
+ <Heading size="small">Join the growing number of projects developing on 0x</Heading>
+
+ <WrapGrid isWrapped={true}>
+ {_.map(projects, (item: ProjectLogo, index) => (
+ <StyledProject key={`client-${index}`} isOnMobile={item.persistOnMobile}>
+ <img src={item.imageUrl} alt={item.name} />
+ </StyledProject>
+ ))}
+ </WrapGrid>
+ </Section>
+);
+
+const StyledProject =
+ styled.div <
+ StyledProjectInterface >
+ `
+ flex-shrink: 0;
+
+ img {
+ object-fit: contain;
+ width: 100%;
+ height: 100%;
+ }
+
+ @media (min-width: 768px) {
+ width: auto;
+ height: 50px;
+ margin: 30px;
+ }
+
+ @media (max-width: 768px) {
+ width: auto;
+ height: 42px;
+ margin: 15px;
+ display: ${props => !props.isOnMobile && 'none'};
+ }
+`;
diff --git a/packages/website/ts/components/sections/landing/cta.tsx b/packages/website/ts/components/sections/landing/cta.tsx
new file mode 100644
index 000000000..ec5a58a58
--- /dev/null
+++ b/packages/website/ts/components/sections/landing/cta.tsx
@@ -0,0 +1,29 @@
+import * as React from 'react';
+
+import { BlockIconLink } from 'ts/components/blockIconLink';
+import { Section } from 'ts/components/newLayout';
+
+import { AnimatedChatIcon } from 'ts/components/animatedChatIcon';
+import { AnimatedCompassIcon } from 'ts/components/animatedCompassIcon';
+import { WebsitePaths } from 'ts/types';
+
+interface Props {
+ onContactClick?: () => void;
+}
+
+export const SectionLandingCta = (props: Props) => (
+ <Section isPadded={false} isFlex={true} maxWidth="auto" wrapWidth="100%" flexBreakpoint="900px">
+ <BlockIconLink
+ iconComponent={<AnimatedCompassIcon />}
+ title="Ready to build on 0x?"
+ linkLabel="Get Started"
+ linkUrl={WebsitePaths.Docs}
+ />
+ <BlockIconLink
+ iconComponent={<AnimatedChatIcon />}
+ title="Want help from the 0x team?"
+ linkLabel="Get in Touch"
+ linkAction={props.onContactClick}
+ />
+ </Section>
+);
diff --git a/packages/website/ts/components/sections/landing/hero.tsx b/packages/website/ts/components/sections/landing/hero.tsx
new file mode 100644
index 000000000..489757286
--- /dev/null
+++ b/packages/website/ts/components/sections/landing/hero.tsx
@@ -0,0 +1,31 @@
+import * as React from 'react';
+
+import { Button } from 'ts/components/button';
+import { Hero } from 'ts/components/hero';
+import { LandingAnimation } from 'ts/components/heroImage';
+
+import { HeroAnimation } from 'ts/components/heroAnimation';
+import { WebsitePaths } from 'ts/types';
+
+export const SectionLandingHero = () => (
+ <Hero
+ title="Powering Decentralized Exchange"
+ isLargeTitle={true}
+ isFullWidth={true}
+ description="0x is an open protocol that enables the peer-to-peer exchange of assets on the Ethereum blockchain."
+ figure={<LandingAnimation image={<HeroAnimation />} />}
+ actions={<HeroActions />}
+ />
+);
+
+const HeroActions = () => (
+ <>
+ <Button href="https://0x.org/docs" isInline={true}>
+ Get Started
+ </Button>
+
+ <Button to={WebsitePaths.Why} isTransparent={true} isInline={true}>
+ Learn More
+ </Button>
+ </>
+);
diff --git a/packages/website/ts/components/siteWrap.tsx b/packages/website/ts/components/siteWrap.tsx
new file mode 100644
index 000000000..316896dbb
--- /dev/null
+++ b/packages/website/ts/components/siteWrap.tsx
@@ -0,0 +1,149 @@
+import * as React from 'react';
+import styled, { ThemeProvider } from 'styled-components';
+
+import { colors } from 'ts/style/colors';
+
+import { Footer } from 'ts/components/footer';
+import { Header } from 'ts/components/header';
+import { GlobalStyles } from 'ts/constants/globalStyle';
+
+interface Props {
+ theme?: 'dark' | 'light' | 'gray';
+ children: any;
+}
+
+interface State {
+ isMobileNavOpen: boolean;
+}
+
+interface MainProps {
+ isNavToggled: boolean;
+}
+
+export interface ThemeValuesInterface {
+ bgColor: string;
+ darkBgColor?: string;
+ lightBgColor: string;
+ introTextColor: string;
+ textColor: string;
+ paragraphColor: string;
+ linkColor: string;
+ mobileNavBgUpper: string;
+ mobileNavBgLower: string;
+ mobileNavColor: string;
+ dropdownBg: string;
+ dropdownButtonBg: string;
+ dropdownBorderColor?: string;
+ dropdownColor: string;
+ headerButtonBg: string;
+ footerBg: string;
+ footerColor: string;
+}
+
+export interface ThemeInterface {
+ [key: string]: ThemeValuesInterface;
+}
+
+const GLOBAL_THEMES: ThemeInterface = {
+ dark: {
+ bgColor: '#000000',
+ darkBgColor: '#111A19',
+ lightBgColor: '#003831',
+ introTextColor: 'rgba(255, 255, 255, 0.75)',
+ textColor: '#FFFFFF',
+ paragraphColor: '#FFFFFF',
+ linkColor: colors.brandLight,
+ mobileNavBgUpper: '#003831',
+ mobileNavBgLower: '#022924',
+ mobileNavColor: '#FFFFFF',
+ dropdownBg: '#111A19',
+ dropdownButtonBg: '#003831',
+ dropdownColor: '#FFFFFF',
+ headerButtonBg: '#00AE99',
+ footerBg: '#181818',
+ footerColor: '#FFFFFF',
+ },
+ light: {
+ bgColor: '#FFFFFF',
+ lightBgColor: '#F3F6F4',
+ darkBgColor: '#003831',
+ introTextColor: 'rgba(92, 92, 92, 0.87)',
+ textColor: '#000000',
+ paragraphColor: '#474747',
+ linkColor: colors.brandDark,
+ mobileNavBgUpper: '#FFFFFF',
+ mobileNavBgLower: '#F3F6F4',
+ mobileNavColor: '#000000',
+ dropdownBg: '#FBFBFB',
+ dropdownButtonBg: '#F3F6F4',
+ dropdownColor: '#003831',
+ dropdownBorderColor: '#E4E4E4',
+ headerButtonBg: '#003831',
+ footerBg: '#F2F2F2',
+ footerColor: '#000000',
+ },
+ gray: {
+ bgColor: '#e0e0e0',
+ lightBgColor: '#003831',
+ introTextColor: 'rgba(92, 92, 92, 0.87)',
+ textColor: '#000000',
+ paragraphColor: '#777777',
+ linkColor: colors.brandDark,
+ mobileNavBgUpper: '#FFFFFF',
+ mobileNavBgLower: '#F3F6F4',
+ mobileNavColor: '#000000',
+ dropdownBg: '#FFFFFF',
+ dropdownButtonBg: '#F3F6F4',
+ dropdownColor: '#003831',
+ headerButtonBg: '#003831',
+ footerBg: '#181818',
+ footerColor: '#FFFFFF',
+ },
+};
+
+export class SiteWrap extends React.Component<Props, State> {
+ public state = {
+ isMobileNavOpen: false,
+ };
+
+ public componentDidMount(): void {
+ document.documentElement.style.overflowY = 'auto';
+ window.scrollTo(0, 0);
+ }
+
+ public toggleMobileNav = () => {
+ this.setState({
+ isMobileNavOpen: !this.state.isMobileNavOpen,
+ });
+ };
+
+ public render(): React.ReactNode {
+ const { children, theme = 'dark' } = this.props;
+ const { isMobileNavOpen } = this.state;
+ const currentTheme = GLOBAL_THEMES[theme];
+
+ return (
+ <>
+ <ThemeProvider theme={currentTheme}>
+ <>
+ <GlobalStyles />
+
+ <Header isNavToggled={isMobileNavOpen} toggleMobileNav={this.toggleMobileNav} />
+
+ <Main isNavToggled={isMobileNavOpen}>{children}</Main>
+
+ <Footer />
+ </>
+ </ThemeProvider>
+ </>
+ );
+ }
+}
+
+const Main =
+ styled.main <
+ MainProps >
+ `
+ transition: transform 0.5s, opacity 0.5s;
+ opacity: ${props => props.isNavToggled && '0.5'};
+`;
diff --git a/packages/website/ts/components/slider/slider.tsx b/packages/website/ts/components/slider/slider.tsx
new file mode 100644
index 000000000..f0a29f894
--- /dev/null
+++ b/packages/website/ts/components/slider/slider.tsx
@@ -0,0 +1,177 @@
+import * as React from 'react';
+import Flickity from 'react-flickity-component';
+import styled from 'styled-components';
+
+import { colors } from 'ts/style/colors';
+
+import { Icon } from 'ts/components/icon';
+import { Heading, Paragraph } from 'ts/components/text';
+
+interface SliderProps {}
+
+interface SlideProps {
+ icon: string;
+ heading: string;
+ text: string;
+ href?: string;
+}
+
+const flickityOptions = {
+ initialIndex: 0,
+ cellAlign: 'left',
+ arrowShape:
+ 'M0 50.766L42.467 93.58l5.791-5.839-32.346-32.61H100V46.84H15.48L50.2 11.838 44.409 6 5.794 44.93l-.003-.003z',
+ prevNextButtons: true,
+};
+
+export const Slide: React.StatelessComponent<SlideProps> = (props: SlideProps) => {
+ const { heading, text, icon } = props;
+
+ return (
+ <StyledSlide>
+ <SlideHead>
+ <Icon name={icon} size="large" />
+ </SlideHead>
+ <SlideContent>
+ <Heading asElement="h4" size="small" marginBottom="15px">
+ {heading}
+ </Heading>
+ <Paragraph isMuted={true}>{text}</Paragraph>
+ </SlideContent>
+ </StyledSlide>
+ );
+};
+
+export const Slider: React.StatelessComponent<SliderProps> = props => {
+ return (
+ <StyledSlider>
+ <Flickity
+ className={'carousel'} // default ''
+ elementType={'div'} // default 'div'
+ options={flickityOptions} // takes flickity options {}
+ disableImagesLoaded={false} // default false
+ >
+ {props.children}
+ </Flickity>
+ </StyledSlider>
+ );
+};
+
+const StyledSlider = styled.div`
+ //overflow: hidden;
+ width: 100%;
+ height: 520px;
+
+ @media (max-width: 500px) {
+ height: 450px;
+ }
+
+ .carousel {
+ display: block;
+ user-select: none;
+ touch-action: pan-y;
+ -webkit-tap-highlight-color: transparent;
+ outline: none;
+
+ @media (max-width: 500px) {
+ overflow: hidden;
+ margin-left: -20px;
+ width: calc(100vw - 20px);
+ }
+ }
+
+ .flickity-viewport {
+ outline: none;
+ }
+
+ .flickity-button {
+ cursor: pointer;
+ position: absolute;
+ width: 74px;
+ height: 74px;
+ background-color: #000;
+ display: flex;
+ outline: 0;
+ top: calc(50% - 37px);
+ border: 0;
+ padding: 0;
+ transition: background-color 0.4s ease-in-out, visibility 0.4s ease-in-out, opacity 0.4s ease-in-out;
+
+ &:disabled {
+ opacity: 0;
+ visibility: hidden;
+ }
+
+ &:hover {
+ background-color: hsla(0, 0%, 10%, 1);
+ }
+
+ &.previous {
+ left: 0;
+ }
+
+ &.next {
+ right: 0;
+ }
+
+ svg {
+ margin: auto;
+ width: 28px;
+ height: auto;
+ }
+
+ path {
+ fill: #fff;
+ }
+ }
+`;
+
+const StyledSlide = styled.div`
+ background-color: ${colors.backgroundDark};
+ width: 560px;
+ height: 520px;
+ flex: 0 0 auto;
+ opacity: 0.3;
+ transition: opacity 0.4s ease-in-out;
+
+ & + & {
+ margin-left: 30px;
+ }
+
+ @media (max-width: 1200px) {
+ width: 100%;
+ }
+
+ @media (max-width: 500px) {
+ width: calc(100vw - 10px - 30px);
+ height: 450px;
+
+ & + & {
+ margin-left: 10px;
+ }
+ }
+
+ &.is-selected {
+ opacity: 1;
+ }
+`;
+
+const SlideHead = styled.div`
+ background-color: ${colors.brandDark};
+ height: 300px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+
+ @media (max-width: 500px) {
+ height: 240px;
+ }
+`;
+
+const SlideContent = styled.div`
+ padding: 30px;
+
+ @media (max-width: 500px) {
+ padding: 20px;
+ }
+`;
diff --git a/packages/website/ts/components/text.tsx b/packages/website/ts/components/text.tsx
new file mode 100644
index 000000000..10f272e73
--- /dev/null
+++ b/packages/website/ts/components/text.tsx
@@ -0,0 +1,83 @@
+import * as React from 'react';
+import styled from 'styled-components';
+import { getCSSPadding, PaddingInterface } from 'ts/constants/utilities';
+
+interface BaseTextInterface extends PaddingInterface {
+ size?: 'default' | 'medium' | 'large' | 'small' | number;
+ isCentered?: boolean;
+ textAlign?: string;
+}
+
+interface HeadingProps extends BaseTextInterface {
+ asElement?: 'h1' | 'h2' | 'h3' | 'h4';
+ maxWidth?: string;
+ fontWeight?: string;
+ isCentered?: boolean;
+ isFlex?: boolean;
+ isNoMargin?: boolean;
+ isMuted?: boolean | number;
+ marginBottom?: string;
+ color?: string;
+}
+
+interface ParagraphProps extends BaseTextInterface {
+ isNoMargin?: boolean;
+ marginBottom?: string; // maybe we should remove isNoMargin
+ isMuted?: boolean | number;
+ fontWeight?: string | number;
+}
+
+const StyledHeading =
+ styled.h1 <
+ HeadingProps >
+ `
+ max-width: ${props => props.maxWidth};
+ color: ${props => props.color || props.theme.textColor};
+ display: ${props => props.isFlex && `inline-flex`};
+ align-items: center;
+ justify-content: ${props => props.isFlex && `space-between`};
+ font-size: ${props =>
+ typeof props.size === 'string' ? `var(--${props.size || 'default'}Heading)` : `${props.size}px`};
+ line-height: ${props => `var(--${props.size || 'default'}HeadingHeight)`};
+ text-align: ${props => props.isCentered && 'center'};
+ padding: ${props => props.padding && getCSSPadding(props.padding)};
+ margin-left: ${props => props.isCentered && 'auto'};
+ margin-right: ${props => props.isCentered && 'auto'};
+ margin-bottom: ${props => !props.isNoMargin && (props.marginBottom || '30px')};
+ opacity: ${props => (typeof props.isMuted === 'boolean' ? 0.75 : props.isMuted)};
+ font-weight: ${props => (props.fontWeight ? props.fontWeight : ['h4'].includes(props.asElement) ? 400 : 300)};
+ width: ${props => props.isFlex && `100%`};
+`;
+
+export const Heading: React.StatelessComponent<HeadingProps> = props => {
+ const { asElement = 'h1', children } = props;
+ const Component = StyledHeading.withComponent(asElement);
+
+ return <Component {...props}>{children}</Component>;
+};
+
+Heading.defaultProps = {
+ size: 'default',
+};
+
+// No need to declare it twice as Styled then rewrap as a stateless comp
+// Note: this would be useful to be implemented the same way was "Heading"
+// and be more generic. e.g. <Text /> with a props asElement so we can use it
+// for literally anything =
+export const Paragraph =
+ styled.p <
+ ParagraphProps >
+ `
+ font-size: ${props => `var(--${props.size || 'default'}Paragraph)`};
+ font-weight: ${props => props.fontWeight || 300};
+ margin-bottom: ${props => !props.isNoMargin && (props.marginBottom || '30px')};
+ padding: ${props => props.padding && getCSSPadding(props.padding)};
+ color: ${props => props.color || props.theme.paragraphColor};
+ opacity: ${props => (typeof props.isMuted === 'boolean' ? 0.75 : props.isMuted)};
+ text-align: ${props => (props.textAlign ? props.textAlign : props.isCentered && 'center')};
+ line-height: 1.4;
+`;
+
+Paragraph.defaultProps = {
+ isMuted: true,
+};
diff --git a/packages/website/ts/components/ui/animation.tsx b/packages/website/ts/components/ui/animation.tsx
deleted file mode 100644
index 943e3bf28..000000000
--- a/packages/website/ts/components/ui/animation.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import * as React from 'react';
-import { keyframes, styled } from 'ts/style/theme';
-
-export type AnimationType = 'easeUpFromBottom';
-
-export interface AnimationProps {
- type: AnimationType;
-}
-
-const PlainAnimation: React.StatelessComponent<AnimationProps> = props => <div {...props} />;
-
-const appearFromBottomFrames = keyframes`
- from {
- position: fixed;
- bottom: -500px;
- left: 0px;
- right: 0px;
- }
-
- to {
- position: fixed;
- bottom: 0px;
- left: 0px;
- right: 0px;
- }
-`;
-
-const stylesForAnimation: { [K in AnimationType]: string } = {
- // Needed for safari
- easeUpFromBottom: `position: fixed`,
-};
-
-const animations: { [K in AnimationType]: string } = {
- easeUpFromBottom: `${appearFromBottomFrames} 1s ease 0s 1 forwards`,
-};
-
-export const Animation = styled(PlainAnimation)`
- animation: ${props => animations[props.type]};
- ${props => stylesForAnimation[props.type]};
-`;
-
-Animation.displayName = 'Animation';
diff --git a/packages/website/ts/components/ui/check_mark.tsx b/packages/website/ts/components/ui/check_mark.tsx
new file mode 100644
index 000000000..86e427c8b
--- /dev/null
+++ b/packages/website/ts/components/ui/check_mark.tsx
@@ -0,0 +1,31 @@
+import * as React from 'react';
+
+import { colors } from '@0x/react-shared';
+
+export interface CheckMarkProps {
+ color?: string;
+ isChecked?: boolean;
+}
+
+export const CheckMark: React.StatelessComponent<CheckMarkProps> = ({ color, isChecked }) => (
+ <svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle
+ cx="8.5"
+ cy="8.5"
+ r="8.5"
+ fill={isChecked ? color : 'white'}
+ stroke={isChecked ? undefined : '#CCCCCC'}
+ />
+ <path
+ d="M2.5 4.5L1.79289 5.20711L2.5 5.91421L3.20711 5.20711L2.5 4.5ZM-0.707107 2.70711L1.79289 5.20711L3.20711 3.79289L0.707107 1.29289L-0.707107 2.70711ZM3.20711 5.20711L7.70711 0.707107L6.29289 -0.707107L1.79289 3.79289L3.20711 5.20711Z"
+ transform="translate(5 6.5)"
+ fill="white"
+ />
+ </svg>
+);
+
+CheckMark.displayName = 'Check';
+
+CheckMark.defaultProps = {
+ color: colors.mediumBlue,
+};
diff --git a/packages/website/ts/components/ui/container.tsx b/packages/website/ts/components/ui/container.tsx
index 7eab2a50f..778f59f27 100644
--- a/packages/website/ts/components/ui/container.tsx
+++ b/packages/website/ts/components/ui/container.tsx
@@ -1,11 +1,15 @@
import { TextAlignProperty } from 'csstype';
+import { darken } from 'polished';
import * as React from 'react';
+import { styled } from 'ts/style/theme';
+
type StringOrNum = string | number;
export type ContainerTag = 'div' | 'span';
export interface ContainerProps {
+ margin?: string;
marginTop?: StringOrNum;
marginBottom?: StringOrNum;
marginRight?: StringOrNum;
@@ -17,10 +21,14 @@ export interface ContainerProps {
paddingLeft?: StringOrNum;
backgroundColor?: string;
background?: string;
+ border?: string;
+ borderTop?: string;
borderRadius?: StringOrNum;
borderBottomLeftRadius?: StringOrNum;
borderBottomRightRadius?: StringOrNum;
borderBottom?: StringOrNum;
+ borderColor?: string;
+ children?: React.ReactNode;
maxWidth?: StringOrNum;
maxHeight?: StringOrNum;
width?: StringOrNum;
@@ -37,15 +45,32 @@ export interface ContainerProps {
right?: string;
bottom?: string;
zIndex?: number;
+ float?: 'right' | 'left';
Tag?: ContainerTag;
cursor?: string;
id?: string;
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
overflowX?: 'scroll' | 'hidden' | 'auto' | 'visible';
+ overflowY?: 'scroll' | 'hidden' | 'auto' | 'visible';
+ shouldDarkenOnHover?: boolean;
+ hasBoxShadow?: boolean;
+ shouldAddBoxShadowOnHover?: boolean;
}
-export const Container: React.StatelessComponent<ContainerProps> = props => {
- const { children, className, Tag, isHidden, id, onClick, ...style } = props;
+export const PlainContainer: React.StatelessComponent<ContainerProps> = props => {
+ const {
+ children,
+ className,
+ Tag,
+ isHidden,
+ id,
+ onClick,
+ shouldDarkenOnHover,
+ shouldAddBoxShadowOnHover,
+ hasBoxShadow,
+ // tslint:disable-next-line:trailing-comma
+ ...style
+ } = props;
const visibility = isHidden ? 'hidden' : undefined;
return (
<Tag id={id} style={{ ...style, visibility }} className={className} onClick={onClick}>
@@ -54,6 +79,20 @@ export const Container: React.StatelessComponent<ContainerProps> = props => {
);
};
+const BOX_SHADOW = '0px 3px 10px rgba(0, 0, 0, 0.3)';
+
+export const Container = styled(PlainContainer)`
+ box-sizing: border-box;
+ ${props => (props.hasBoxShadow ? `box-shadow: ${BOX_SHADOW}` : '')};
+ &:hover {
+ ${props =>
+ props.shouldDarkenOnHover
+ ? `background-color: ${props.backgroundColor ? darken(0.05, props.backgroundColor) : 'none'} !important`
+ : ''};
+ ${props => (props.shouldAddBoxShadowOnHover ? `box-shadow: ${BOX_SHADOW}` : '')};
+ }
+`;
+
Container.defaultProps = {
Tag: 'div',
};
diff --git a/packages/website/ts/components/ui/ease_up_from_bottom_animation.tsx b/packages/website/ts/components/ui/ease_up_from_bottom_animation.tsx
new file mode 100644
index 000000000..ba141c01e
--- /dev/null
+++ b/packages/website/ts/components/ui/ease_up_from_bottom_animation.tsx
@@ -0,0 +1,31 @@
+import { css, keyframes, styled } from 'ts/style/theme';
+
+const appearFromBottomFrames = keyframes`
+ from {
+ position: fixed;
+ bottom: -500px;
+ left: 0px;
+ right: 0px;
+ }
+
+ to {
+ position: fixed;
+ bottom: 0px;
+ left: 0px;
+ right: 0px;
+ }
+`;
+
+const stylesForAnimation = css`
+ position: fixed;
+`;
+const animations = css`
+ animation: ${appearFromBottomFrames} 1s ease 0s 1 forwards;
+`;
+
+export const EaseUpFromBottomAnimation = styled.div`
+ ${props => animations};
+ ${props => stylesForAnimation};
+`;
+
+EaseUpFromBottomAnimation.displayName = 'EaseUpFromBottomAnimation';
diff --git a/packages/website/ts/components/ui/filled_image.tsx b/packages/website/ts/components/ui/filled_image.tsx
deleted file mode 100644
index 7f58ee5b9..000000000
--- a/packages/website/ts/components/ui/filled_image.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import * as React from 'react';
-
-export interface FilledImageProps {
- src: string;
-}
-export const FilledImage = (props: FilledImageProps) => (
- <div
- style={{
- width: '100%',
- height: '100%',
- objectFit: 'cover',
- backgroundImage: `url(${props.src})`,
- backgroundRepeat: 'no-repeat',
- backgroundPosition: 'center',
- backgroundSize: 'cover',
- }}
- />
-);
diff --git a/packages/website/ts/components/ui/image.tsx b/packages/website/ts/components/ui/image.tsx
index c8d39352b..d698ddaa0 100644
--- a/packages/website/ts/components/ui/image.tsx
+++ b/packages/website/ts/components/ui/image.tsx
@@ -10,6 +10,7 @@ export interface ImageProps {
height?: string | number;
maxWidth?: string | number;
maxHeight?: string | number;
+ additionalStyle?: React.CSSProperties;
}
interface ImageState {
imageLoadFailed: boolean;
@@ -30,6 +31,7 @@ export class Image extends React.Component<ImageProps, ImageState> {
onError={this._onError.bind(this)}
src={src}
style={{
+ ...this.props.additionalStyle,
borderRadius: this.props.borderRadius,
maxWidth: this.props.maxWidth,
maxHeight: this.props.maxHeight,
diff --git a/packages/website/ts/components/ui/input.tsx b/packages/website/ts/components/ui/input.tsx
deleted file mode 100644
index e5f4f6c70..000000000
--- a/packages/website/ts/components/ui/input.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { colors } from '@0x/react-shared';
-import * as React from 'react';
-import { styled } from 'ts/style/theme';
-
-export interface InputProps {
- className?: string;
- value?: string;
- width?: string;
- fontSize?: string;
- fontColor?: string;
- placeholderColor?: string;
- placeholder?: string;
- backgroundColor?: string;
- onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
-}
-
-const PlainInput: React.StatelessComponent<InputProps> = ({ value, className, placeholder, onChange }) => (
- <input className={className} value={value} onChange={onChange} placeholder={placeholder} />
-);
-
-export const Input = styled(PlainInput)`
- font-size: ${props => props.fontSize};
- width: ${props => props.width};
- padding: 0.8em 1.2em;
- border-radius: 3px;
- font-family: 'Roboto Mono';
- color: ${props => props.fontColor};
- border: none;
- background-color: ${props => props.backgroundColor};
- &::placeholder {
- color: ${props => props.placeholderColor};
- }
-`;
-
-Input.defaultProps = {
- width: 'auto',
- backgroundColor: colors.white,
- fontColor: colors.darkestGrey,
- placeholderColor: colors.darkGrey,
- fontSize: '12px',
-};
-
-Input.displayName = 'Input';
diff --git a/packages/website/ts/components/ui/multi_select.tsx b/packages/website/ts/components/ui/multi_select.tsx
new file mode 100644
index 000000000..2cf44cae1
--- /dev/null
+++ b/packages/website/ts/components/ui/multi_select.tsx
@@ -0,0 +1,66 @@
+import { colors } from '@0x/react-shared';
+import * as _ from 'lodash';
+import * as React from 'react';
+
+import { Container } from './container';
+
+export interface MultiSelectItemConfig {
+ value: string;
+ renderItemContent: (isSelected: boolean) => React.ReactNode;
+ onClick?: () => void;
+}
+
+export interface MultiSelectProps {
+ selectedValues?: string[];
+ items: MultiSelectItemConfig[];
+ backgroundColor?: string;
+ height?: string;
+}
+
+export class MultiSelect extends React.Component<MultiSelectProps> {
+ public static defaultProps = {
+ backgroundColor: colors.white,
+ };
+ public render(): React.ReactNode {
+ const { items, backgroundColor, selectedValues, height } = this.props;
+ return (
+ <Container
+ backgroundColor={backgroundColor}
+ borderRadius="4px"
+ width="100%"
+ height={height}
+ overflowY="scroll"
+ >
+ {_.map(items, item => (
+ <MultiSelectItem
+ key={item.value}
+ renderItemContent={item.renderItemContent}
+ backgroundColor={backgroundColor}
+ onClick={item.onClick}
+ isSelected={_.isUndefined(selectedValues) || _.includes(selectedValues, item.value)}
+ />
+ ))}
+ </Container>
+ );
+ }
+}
+
+export interface MultiSelectItemProps {
+ renderItemContent: (isSelected: boolean) => React.ReactNode;
+ isSelected?: boolean;
+ onClick?: () => void;
+ backgroundColor?: string;
+}
+
+export const MultiSelectItem: React.StatelessComponent<MultiSelectItemProps> = ({
+ renderItemContent,
+ isSelected,
+ onClick,
+ backgroundColor,
+}) => (
+ <Container cursor="pointer" shouldDarkenOnHover={true} onClick={onClick} backgroundColor={backgroundColor}>
+ <Container borderBottom={`1px solid ${colors.lightestGrey}`} margin="0px 15px" padding="10px 0px">
+ {renderItemContent(isSelected)}
+ </Container>
+ </Container>
+);
diff --git a/packages/website/ts/components/ui/simple_loading.tsx b/packages/website/ts/components/ui/simple_loading.tsx
deleted file mode 100644
index 81744196d..000000000
--- a/packages/website/ts/components/ui/simple_loading.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import CircularProgress from 'material-ui/CircularProgress';
-import * as React from 'react';
-
-export interface SimpleLoadingProps {
- message: string;
-}
-
-export const SimpleLoading = (props: SimpleLoadingProps) => {
- return (
- <div className="mx-auto pt3" style={{ maxWidth: 400, height: 409 }}>
- <div className="relative" style={{ top: '50%', transform: 'translateY(-50%)', height: 95 }}>
- <CircularProgress />
- <div className="pt3 pb3">{props.message}</div>
- </div>
- </div>
- );
-};
diff --git a/packages/website/ts/components/ui/text.tsx b/packages/website/ts/components/ui/text.tsx
index c13e21913..046442ee5 100644
--- a/packages/website/ts/components/ui/text.tsx
+++ b/packages/website/ts/components/ui/text.tsx
@@ -3,10 +3,11 @@ import { darken } from 'polished';
import * as React from 'react';
import { styled } from 'ts/style/theme';
-export type TextTag = 'p' | 'div' | 'span' | 'label' | 'h1' | 'h2' | 'h3' | 'h4' | 'i';
+export type TextTag = 'p' | 'div' | 'span' | 'label' | 'h1' | 'h2' | 'h3' | 'h4' | 'i' | 'span';
export interface TextProps {
className?: string;
+ children?: any;
Tag?: TextTag;
fontSize?: string;
fontFamily?: string;
diff --git a/packages/website/ts/components/ui/typed_text.tsx b/packages/website/ts/components/ui/typed_text.tsx
deleted file mode 100644
index 6d38580b9..000000000
--- a/packages/website/ts/components/ui/typed_text.tsx
+++ /dev/null
@@ -1,75 +0,0 @@
-import * as _ from 'lodash';
-import * as React from 'react';
-import Typist from 'react-typist';
-
-import { Text, TextProps } from 'ts/components/ui/text';
-
-import 'react-typist/dist/Typist.css';
-
-export interface TypedTextProps extends TextProps {
- textList: string[];
- shouldRepeat?: boolean;
- wordDelayMs?: number;
- avgKeystrokeDelayMs?: number;
- stdKeystrokeDelay?: number;
-}
-
-export interface TypedTextState {
- cycleCount: number;
-}
-
-export class TypedText extends React.Component<TypedTextProps, TypedTextState> {
- public static defaultProps = {
- shouldRepeat: false,
- avgKeystrokeDelayMs: 90,
- wordDelayMs: 1000,
- };
- public state = {
- cycleCount: 0,
- };
- public render(): React.ReactNode {
- const {
- textList,
- shouldRepeat,
- wordDelayMs,
- avgKeystrokeDelayMs,
- stdKeystrokeDelay,
- // tslint:disable-next-line
- ...textProps
- } = this.props;
- const { cycleCount } = this.state;
- if (_.isEmpty(textList)) {
- return null;
- }
- const typistChildren: React.ReactNode[] = [];
- _.forEach(textList, text => {
- typistChildren.push(
- <Text key={`text-${text}-${cycleCount}`} {...textProps}>
- {text}
- </Text>,
- );
- if (wordDelayMs) {
- typistChildren.push(<Typist.Delay key={`delay-${text}-${cycleCount}`} ms={wordDelayMs} />);
- }
- typistChildren.push(<Typist.Backspace key={`backspace-${text}-${cycleCount}`} count={text.length} />);
- });
- return (
- <Typist
- avgTypingDelay={avgKeystrokeDelayMs}
- stdTypingDelay={stdKeystrokeDelay}
- className="inline"
- key={`typist-key-${cycleCount}`}
- onTypingDone={this._onTypingDone.bind(this)}
- >
- {typistChildren}
- </Typist>
- );
- }
- private _onTypingDone(): void {
- if (this.props.shouldRepeat) {
- this.setState({
- cycleCount: this.state.cycleCount + 1,
- });
- }
- }
-}
diff --git a/packages/website/ts/constants/.gitkeep b/packages/website/ts/constants/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/packages/website/ts/constants/.gitkeep
diff --git a/packages/website/ts/constants/animations.tsx b/packages/website/ts/constants/animations.tsx
new file mode 100644
index 000000000..6a58c4b40
--- /dev/null
+++ b/packages/website/ts/constants/animations.tsx
@@ -0,0 +1,18 @@
+import { css, keyframes } from 'styled-components';
+
+export const fadeIn = keyframes`
+ 0% {
+ transform: translateY(10px);
+ opacity: 0;
+ }
+ 100% {
+ transform: translateY(0);
+ opacity: 1;
+ }
+`;
+
+export const addFadeInAnimation = (duration: string = '0.5s', delay: string = '0s') => css`
+ opacity: 0;
+ transform: translateY(10px);
+ animation: ${fadeIn} ${duration} ${delay} forwards;
+`;
diff --git a/packages/website/ts/constants/cssReset.js b/packages/website/ts/constants/cssReset.js
new file mode 100644
index 000000000..4c5105b50
--- /dev/null
+++ b/packages/website/ts/constants/cssReset.js
@@ -0,0 +1,50 @@
+export const cssReset = `
+ *,
+ *:before,
+ *:after {
+ box-sizing: border-box;
+ }
+ html, body, div, span, applet, object, iframe,
+ h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+ a, abbr, acronym, address, big, cite, code,
+ del, dfn, em, img, ins, kbd, q, s, samp,
+ small, strike, strong, sub, sup, tt, var,
+ b, u, i, center,
+ dl, dt, dd, ol, ul, li,
+ fieldset, form, label, legend,
+ table, caption, tbody, tfoot, thead, tr, th, td,
+ article, aside, canvas, details, embed,
+ figure, figcaption, footer, header, hgroup,
+ menu, nav, output, ruby, section, summary,
+ time, mark, audio, video {
+ margin: 0;
+ padding: 0;
+ border: 0;
+ font-size: 100%;
+ font: inherit;
+ vertical-align: baseline;
+ }
+ /* HTML5 display-role reset for older browsers */
+ article, aside, details, figcaption, figure,
+ footer, header, hgroup, menu, nav, section {
+ display: block;
+ }
+ body {
+ line-height: 1;
+ }
+ ol, ul {
+ list-style: none;
+ }
+ blockquote, q {
+ quotes: none;
+ }
+ blockquote:before, blockquote:after,
+ q:before, q:after {
+ content: '';
+ content: none;
+ }
+ table {
+ border-collapse: collapse;
+ border-spacing: 0;
+ }
+`;
diff --git a/packages/website/ts/constants/globalStyle.tsx b/packages/website/ts/constants/globalStyle.tsx
new file mode 100644
index 000000000..5abb758c5
--- /dev/null
+++ b/packages/website/ts/constants/globalStyle.tsx
@@ -0,0 +1,109 @@
+import { createGlobalStyle, withTheme } from 'styled-components';
+import { cssReset } from 'ts/constants/cssReset';
+
+export interface GlobalStyle {
+ theme: {
+ bgColor: string;
+ textColor: string;
+ linkColor: string;
+ dropdownButtonBg: string;
+ };
+}
+
+const GlobalStyles = withTheme(
+ createGlobalStyle <
+ GlobalStyle >
+ `
+ ${cssReset};
+
+ html {
+ font-size: 18px;
+ background-color: ${props => props.theme.bgColor};
+ overflow-x: hidden;
+ }
+
+ @media (min-width: 768px) {
+ :root {
+ --smallHeading: 20px;
+ --defaultHeading: 28px;
+ --mediumHeading: 50px;
+ --largeHeading: 80px;
+ --smallHeadingHeight: 1.4em;
+ --defaultHeadingHeight: 1.357142857em;
+ --mediumHeadingHeight: 1.16em;
+ --largeHeadingHeight: 1em;
+ --smallParagraph: 14px;
+ --defaultParagraph: 18px;
+ --mediumParagraph: 22px;
+ --largeParagraph: 28px;
+ --smallIcon: 75px;
+ --mediumIcon: 85px;
+ --largeIcon: 145px;
+ --heroIcon: 282px;
+ }
+ }
+
+ @media (max-width: 1170px) {
+ :root {
+ --largeHeading: 60px;
+ }
+ }
+
+ @media (max-width: 768px) {
+ :root {
+ --smallHeading: 18px;
+ --defaultHeading: 18px;
+ --mediumHeading: 40px;
+ --largeHeading: 46px;
+ --smallHeadingHeight: 1.4em; // TO DO
+ --defaultHeadingHeight: 1.357142857em; // TO DO
+ --mediumHeadingHeight: 1.16em; // TO DO
+ --largeHeadingHeight: 1.108695652em; // TO DO
+ --smallParagraph: 14px; // TO DO
+ --defaultParagraph: 16px; // TO DO
+ --mediumParagraph: 20px; // TO DO
+ --largeParagraph: 20px; // TO DO
+ --smallIcon: 55px;
+ --mediumIcon: 85px;
+ --largeIcon: 115px;
+ }
+ }
+
+ body {
+ font-family: 'Formular', sans-serif !important;
+ -webkit-font-smoothing: antialiased;
+ color: ${props => props.theme.textColor};
+ font-feature-settings: "zero";
+ scroll-behavior: smooth;
+ }
+
+ .visuallyHidden {
+ position: absolute !important;
+ clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
+ clip: rect(1px, 1px, 1px, 1px);
+ padding:0 !important;
+ border:0 !important;
+ height: 1px !important;
+ width: 1px !important;
+ overflow: hidden;
+ }
+
+ img, svg {
+ max-width: 100%;
+ object-fit: contain;
+ }
+
+ a, button {
+ text-decoration: none;
+ font-family: inherit;
+ outline: none;
+ }
+
+ svg + p,
+ img + p {
+ padding-top: 30px;
+ }
+`,
+);
+
+export { GlobalStyles };
diff --git a/packages/website/ts/constants/utilities.tsx b/packages/website/ts/constants/utilities.tsx
new file mode 100644
index 000000000..ee5c5b4ce
--- /dev/null
+++ b/packages/website/ts/constants/utilities.tsx
@@ -0,0 +1,22 @@
+export interface PaddingInterface {
+ padding?: number | Array<'large' | 'default' | 'small' | number>;
+ margin?: number | Array<'large' | 'default' | 'small' | number>;
+}
+
+interface PaddingSizes {
+ [key: string]: string;
+}
+
+export const PADDING_SIZES: PaddingSizes = {
+ default: '30px',
+ large: '60px',
+ small: '15px',
+};
+
+export const getCSSPadding = (value: number | Array<string | number> = 0): string => {
+ if (Array.isArray(value)) {
+ return value.map(val => PADDING_SIZES[val] || `${val}px`).join(' ');
+ } else {
+ return `${value}px`;
+ }
+};
diff --git a/packages/website/ts/containers/about.ts b/packages/website/ts/containers/about.ts
deleted file mode 100644
index 3b1c99d79..000000000
--- a/packages/website/ts/containers/about.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import * as React from 'react';
-import { connect } from 'react-redux';
-import { Dispatch } from 'redux';
-import { About as AboutComponent, AboutProps } from 'ts/pages/about/about';
-import { Dispatcher } from 'ts/redux/dispatcher';
-import { State } from 'ts/redux/reducer';
-import { Translate } from 'ts/utils/translate';
-
-interface ConnectedState {
- translate: Translate;
-}
-
-interface ConnectedDispatch {
- dispatcher: Dispatcher;
-}
-
-const mapStateToProps = (state: State, _ownProps: AboutProps): ConnectedState => ({
- translate: state.translate,
-});
-
-const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({
- dispatcher: new Dispatcher(dispatch),
-});
-
-export const About: React.ComponentClass<AboutProps> = connect(mapStateToProps, mapDispatchToProps)(AboutComponent);
diff --git a/packages/website/ts/containers/jobs.ts b/packages/website/ts/containers/jobs.ts
deleted file mode 100644
index b18485882..000000000
--- a/packages/website/ts/containers/jobs.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-import * as React from 'react';
-import { connect } from 'react-redux';
-import { Dispatch } from 'redux';
-import { Jobs as JobsComponent, JobsProps } from 'ts/pages/jobs/jobs';
-import { Dispatcher } from 'ts/redux/dispatcher';
-import { State } from 'ts/redux/reducer';
-import { ScreenWidths } from 'ts/types';
-import { Translate } from 'ts/utils/translate';
-
-interface ConnectedState {
- translate: Translate;
- screenWidth: ScreenWidths;
-}
-
-interface ConnectedDispatch {
- dispatcher: Dispatcher;
-}
-
-const mapStateToProps = (state: State, _ownProps: JobsProps): ConnectedState => ({
- translate: state.translate,
- screenWidth: state.screenWidth,
-});
-
-const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({
- dispatcher: new Dispatcher(dispatch),
-});
-
-export const Jobs: React.ComponentClass<JobsProps> = connect(mapStateToProps, mapDispatchToProps)(JobsComponent);
diff --git a/packages/website/ts/containers/landing.ts b/packages/website/ts/containers/landing.ts
deleted file mode 100644
index 972ed4c23..000000000
--- a/packages/website/ts/containers/landing.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import * as React from 'react';
-import { connect } from 'react-redux';
-import { Dispatch } from 'redux';
-import { Landing as LandingComponent, LandingProps } from 'ts/pages/landing/landing';
-import { Dispatcher } from 'ts/redux/dispatcher';
-import { State } from 'ts/redux/reducer';
-import { Translate } from 'ts/utils/translate';
-
-interface ConnectedState {
- translate: Translate;
-}
-
-interface ConnectedDispatch {
- dispatcher: Dispatcher;
-}
-
-const mapStateToProps = (state: State, _ownProps: LandingProps): ConnectedState => ({
- translate: state.translate,
-});
-
-const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({
- dispatcher: new Dispatcher(dispatch),
-});
-
-export const Landing: React.ComponentClass<LandingProps> = connect(mapStateToProps, mapDispatchToProps)(
- LandingComponent,
-);
diff --git a/packages/website/ts/containers/launch_kit.ts b/packages/website/ts/containers/launch_kit.ts
deleted file mode 100644
index 2557f38a5..000000000
--- a/packages/website/ts/containers/launch_kit.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import * as React from 'react';
-import { connect } from 'react-redux';
-import { Dispatch } from 'redux';
-import { LaunchKit as LaunchKitComponent, LaunchKitProps } from 'ts/pages/launch_kit/launch_kit';
-import { Dispatcher } from 'ts/redux/dispatcher';
-import { State } from 'ts/redux/reducer';
-import { Translate } from 'ts/utils/translate';
-
-interface ConnectedState {
- translate: Translate;
-}
-
-interface ConnectedDispatch {
- dispatcher: Dispatcher;
-}
-
-const mapStateToProps = (state: State, _ownProps: LaunchKitProps): ConnectedState => ({
- translate: state.translate,
-});
-
-const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({
- dispatcher: new Dispatcher(dispatch),
-});
-
-export const LaunchKit: React.ComponentClass<LaunchKitProps> = connect(mapStateToProps, mapDispatchToProps)(
- LaunchKitComponent,
-);
diff --git a/packages/website/ts/containers/migrations_documentation.ts b/packages/website/ts/containers/migrations_documentation.ts
new file mode 100644
index 000000000..02919e06e
--- /dev/null
+++ b/packages/website/ts/containers/migrations_documentation.ts
@@ -0,0 +1,66 @@
+import { DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0x/react-docs';
+import * as React from 'react';
+import { connect } from 'react-redux';
+import { Dispatch } from 'redux';
+import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentation/doc_page';
+import { Dispatcher } from 'ts/redux/dispatcher';
+import { State } from 'ts/redux/reducer';
+import { DocPackages, ScreenWidths } from 'ts/types';
+import { Translate } from 'ts/utils/translate';
+
+/* tslint:disable:no-var-requires */
+const IntroMarkdown1 = require('md/docs/migrations/1/introduction');
+const InstallationMarkdown1 = require('md/docs/migrations/1/installation');
+/* tslint:enable:no-var-requires */
+
+const markdownSections = {
+ introduction: 'introduction',
+ installation: 'installation',
+};
+
+const docsInfoConfig: DocsInfoConfig = {
+ id: DocPackages.Migrations,
+ packageName: '@0x/migrations',
+ type: SupportedDocJson.TypeDoc,
+ displayName: 'Migrations',
+ packageUrl: 'https://github.com/0xProject/0x-monorepo',
+ markdownMenu: {
+ 'getting-started': [markdownSections.introduction, markdownSections.installation],
+ },
+ sectionNameToMarkdownByVersion: {
+ '2.0.4': {
+ [markdownSections.introduction]: IntroMarkdown1,
+ [markdownSections.installation]: InstallationMarkdown1,
+ },
+ },
+ markdownSections,
+};
+const docsInfo = new DocsInfo(docsInfoConfig);
+
+interface ConnectedState {
+ docsVersion: string;
+ availableDocVersions: string[];
+ docsInfo: DocsInfo;
+ translate: Translate;
+ screenWidth: ScreenWidths;
+}
+
+interface ConnectedDispatch {
+ dispatcher: Dispatcher;
+}
+
+const mapStateToProps = (state: State, _ownProps: DocPageProps): ConnectedState => ({
+ docsVersion: state.docsVersion,
+ availableDocVersions: state.availableDocVersions,
+ translate: state.translate,
+ docsInfo,
+ screenWidth: state.screenWidth,
+});
+
+const mapDispatchToProps = (dispatch: Dispatch<State>): ConnectedDispatch => ({
+ dispatcher: new Dispatcher(dispatch),
+});
+
+export const Documentation: React.ComponentClass<DocPageProps> = connect(mapStateToProps, mapDispatchToProps)(
+ DocPageComponent,
+);
diff --git a/packages/website/ts/containers/order_watcher_documentation.ts b/packages/website/ts/containers/order_watcher_documentation.ts
index ac92e6a22..683e1fe9f 100644
--- a/packages/website/ts/containers/order_watcher_documentation.ts
+++ b/packages/website/ts/containers/order_watcher_documentation.ts
@@ -24,7 +24,7 @@ const docsInfoConfig: DocsInfoConfig = {
id: DocPackages.OrderWatcher,
packageName: '@0x/order-watcher',
type: SupportedDocJson.TypeDoc,
- displayName: 'OrderWatcher',
+ displayName: 'Order Watcher',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
markdownMenu: {
'getting-started': [markdownSections.introduction, markdownSections.installation],
diff --git a/packages/website/ts/globals.d.ts b/packages/website/ts/globals.d.ts
index eb8892aea..05f3c7f88 100644
--- a/packages/website/ts/globals.d.ts
+++ b/packages/website/ts/globals.d.ts
@@ -1,8 +1,15 @@
+declare module '@reach/dialog';
declare module 'truffle-contract';
declare module 'whatwg-fetch';
declare module 'thenby';
declare module 'react-document-title';
declare module 'react-ga';
+declare module 'reach__dialog';
+declare module 'react-flickity-component';
+declare module 'react-anchor-link-smooth-scroll';
+declare module 'react-responsive';
+declare module 'react-scrollable-anchor';
+declare module 'react-headroom';
declare module '*.json' {
const json: any;
@@ -10,6 +17,12 @@ declare module '*.json' {
export default json;
/* tslint:enable */
}
+
+declare module '*.svg' {
+ import { PureComponent, SVGProps } from 'react';
+ export default class extends PureComponent<SVGProps<SVGSVGElement>> {}
+}
+
declare module 'web3-provider-engine/subproviders/filters';
// This will be defined by default in TS 2.4
diff --git a/packages/website/ts/icons/illustrations/0x.svg b/packages/website/ts/icons/illustrations/0x.svg
new file mode 100755
index 000000000..b0810f751
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/0x.svg
@@ -0,0 +1,14 @@
+<svg width="404" height="404" viewBox="0 0 404 404" fill="none" xmlns="http://www.w3.org/2000/svg">
+<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="404" height="404">
+<circle cx="202" cy="202" r="200" fill="#00AE99" stroke="#00AE99" stroke-width="3"/>
+</mask>
+<g mask="url(#mask0)">
+<circle cx="202" cy="202" r="200" stroke="#00AE99" stroke-width="3"/>
+<circle cx="201.667" cy="68.6667" r="66.6667" stroke="#00AE99" stroke-width="3"/>
+<circle cx="68.6667" cy="202.667" r="66.6667" stroke="#00AE99" stroke-width="3"/>
+<path d="M168.17 260.29L167.271 259.089L165.46 260.444L167.413 261.585L168.17 260.29ZM197.32 269.2L197.219 270.696L197.226 270.697L197.32 269.2ZM237.414 258.856L238.22 260.12L238.225 260.117L237.414 258.856ZM252.653 245.439L253.801 246.405L254.55 245.515L253.874 244.568L252.653 245.439ZM241.096 229.872L242.285 228.958L242.281 228.952L242.276 228.946L241.096 229.872ZM237.72 225.571L238.901 224.645L237.582 222.965L236.449 224.775L237.72 225.571ZM219.719 241.445L218.672 242.519L219.418 243.246L220.36 242.801L219.719 241.445ZM208.264 230.282L209.311 229.207L208.392 228.312L207.365 229.081L208.264 230.282ZM143.827 169.549L145.02 168.64L143.647 166.838L142.524 168.806L143.827 169.549ZM135.133 198.43L133.637 198.329L133.636 198.337L135.133 198.43ZM145.464 238.577L144.201 239.388L145.464 238.577ZM158.862 253.837L157.895 254.984L158.786 255.736L159.735 255.057L158.862 253.837ZM174.409 242.264L175.324 243.453L175.33 243.448L175.336 243.443L174.409 242.264ZM178.705 238.885L179.632 240.064L181.287 238.761L179.516 237.623L178.705 238.885ZM162.851 220.757L161.78 219.707L161.049 220.452L161.495 221.397L162.851 220.757ZM174.102 209.286L175.173 210.337L176.082 209.41L175.295 208.377L174.102 209.286ZM235.163 145.072L236.036 146.292L237.92 144.945L235.92 143.777L235.163 145.072ZM206.014 136.162L205.91 137.658L205.913 137.658L206.014 136.162ZM165.817 146.506L166.629 147.767L166.632 147.765L165.817 146.506ZM150.578 159.922L149.43 158.956L148.681 159.846L149.357 160.793L150.578 159.922ZM162.135 175.489L160.946 176.403L160.951 176.409L160.955 176.415L162.135 175.489ZM165.511 179.791L164.331 180.717L165.634 182.378L166.773 180.6L165.511 179.791ZM183.614 163.916L184.655 162.836L183.913 162.122L182.98 162.557L183.614 163.916ZM194.354 174.26L193.313 175.341L194.212 176.206L195.226 175.48L194.354 174.26ZM259.608 235.505L258.411 236.409L259.789 238.233L260.914 236.243L259.608 235.505ZM268.2 206.931L269.696 207.033L269.697 207.024L268.2 206.931ZM257.87 166.784L259.135 165.979L259.132 165.974L257.87 166.784ZM244.471 151.524L245.439 150.378L244.547 149.625L243.598 150.304L244.471 151.524ZM228.924 163.097L228.009 161.909L228.003 161.913L227.997 161.918L228.924 163.097ZM224.629 166.477L223.701 165.298L222.034 166.609L223.826 167.744L224.629 166.477ZM240.584 184.604L239.228 185.244L239.235 185.259L239.242 185.274L240.584 184.604ZM240.687 184.809L241.767 185.849L242.502 185.086L242.029 184.139L240.687 184.809ZM229.845 196.075L228.764 195.035L227.877 195.957L228.648 196.979L229.845 196.075ZM167.413 261.585C176.201 266.718 186.346 269.964 197.219 270.696L197.421 267.703C187.019 267.002 177.321 263.898 168.926 258.994L167.413 261.585ZM197.226 270.697C212.283 271.639 226.405 267.659 238.22 260.12L236.607 257.591C225.307 264.8 211.813 268.604 197.413 267.703L197.226 270.697ZM238.225 260.117C244.08 256.348 249.307 251.742 253.801 246.405L251.506 244.473C247.204 249.583 242.203 253.989 236.602 257.594L238.225 260.117ZM253.874 244.568C250.283 239.533 246.385 234.295 242.285 228.958L239.906 230.786C243.989 236.1 247.864 241.309 251.432 246.31L253.874 244.568ZM242.276 228.946C241.713 228.229 241.151 227.512 240.588 226.795C240.026 226.078 239.463 225.362 238.901 224.645L236.54 226.497C237.103 227.213 237.665 227.93 238.228 228.647C238.791 229.364 239.353 230.081 239.916 230.798L242.276 228.946ZM236.449 224.775C232.311 231.384 226.193 236.725 219.078 240.089L220.36 242.801C227.974 239.201 234.538 233.481 238.992 226.367L236.449 224.775ZM220.766 240.371L209.311 229.207L207.217 231.356L218.672 242.519L220.766 240.371ZM207.365 229.081L167.271 259.089L169.069 261.49L209.163 231.483L207.365 229.081ZM142.524 168.806C137.505 177.601 134.368 187.549 133.637 198.329L136.63 198.532C137.33 188.214 140.33 178.703 145.13 170.293L142.524 168.806ZM133.636 198.337C132.696 213.409 136.668 227.654 144.201 239.388L146.726 237.767C139.531 226.56 135.73 212.947 136.63 198.524L133.636 198.337ZM144.201 239.388C147.965 245.25 152.565 250.484 157.895 254.984L159.83 252.691C154.727 248.383 150.327 243.376 146.726 237.767L144.201 239.388ZM159.735 255.057C164.764 251.461 169.994 247.558 175.324 243.453L173.494 241.076C168.187 245.164 162.985 249.045 157.99 252.617L159.735 255.057ZM175.336 243.443C176.768 242.317 178.2 241.19 179.632 240.064L177.777 237.706C176.345 238.832 174.913 239.959 173.481 241.086L175.336 243.443ZM179.516 237.623C172.904 233.374 167.568 227.241 164.208 220.117L161.495 221.397C165.09 229.021 170.8 235.588 177.894 240.147L179.516 237.623ZM163.922 221.807L175.173 210.337L173.031 208.236L161.78 219.707L163.922 221.807ZM175.295 208.377L145.02 168.64L142.634 170.458L172.909 210.196L175.295 208.377ZM235.92 143.777C227.132 138.643 216.987 135.398 206.114 134.665L205.913 137.658C216.315 138.359 226.012 141.463 234.407 146.367L235.92 143.777ZM206.118 134.665C191.055 133.618 176.824 137.599 165.003 145.246L166.632 147.765C177.926 140.459 191.515 136.657 205.91 137.658L206.118 134.665ZM165.006 145.244C159.151 149.013 153.924 153.619 149.43 158.956L151.725 160.888C156.027 155.779 161.028 151.372 166.629 147.767L165.006 145.244ZM149.357 160.793C152.948 165.828 156.846 171.066 160.946 176.403L163.325 174.575C159.242 169.261 155.367 164.052 151.799 159.051L149.357 160.793ZM160.955 176.415C161.518 177.132 162.08 177.849 162.643 178.566C163.205 179.283 163.768 180 164.331 180.717L166.691 178.865C166.128 178.148 165.566 177.431 165.003 176.714C164.441 175.997 163.878 175.28 163.315 174.563L160.955 176.415ZM166.773 180.6C171.021 173.973 177.044 168.635 184.248 165.276L182.98 162.557C175.251 166.161 168.796 171.885 164.248 178.981L166.773 180.6ZM182.574 164.997L193.313 175.341L195.394 173.18L184.655 162.836L182.574 164.997ZM195.226 175.48L236.036 146.292L234.291 143.852L193.481 173.04L195.226 175.48ZM260.914 236.243C265.827 227.556 268.964 217.713 269.696 207.033L266.703 206.828C266.003 217.042 263.004 226.453 258.303 234.767L260.914 236.243ZM269.697 207.024C270.638 191.949 266.663 177.81 259.135 165.979L256.604 167.589C263.804 178.904 267.603 192.417 266.703 206.837L269.697 207.024ZM259.132 165.974C255.368 160.111 250.769 154.878 245.439 150.378L243.503 152.67C248.606 156.978 253.007 161.986 256.607 167.594L259.132 165.974ZM243.598 150.304C238.57 153.901 233.339 157.803 228.009 161.909L229.84 164.285C235.147 160.197 240.349 156.316 245.344 152.744L243.598 150.304ZM227.997 161.918C227.281 162.481 226.565 163.045 225.849 163.608C225.133 164.171 224.417 164.734 223.701 165.298L225.556 167.656C226.272 167.092 226.988 166.529 227.704 165.966C228.42 165.402 229.136 164.839 229.852 164.276L227.997 161.918ZM223.826 167.744C230.535 171.992 235.869 178.121 239.228 185.244L241.941 183.964C238.345 176.339 232.632 169.769 225.431 165.209L223.826 167.744ZM239.242 185.274L239.345 185.479L242.029 184.139L241.926 183.934L239.242 185.274ZM239.606 183.769L228.764 195.035L230.926 197.115L241.767 185.849L239.606 183.769ZM228.648 196.979L258.411 236.409L260.806 234.601L231.042 195.171L228.648 196.979Z" fill="#00AE99"/>
+<path d="M269 135V268.333H442V135H269Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M339.64 269.64L270 339.281L343.913 413.194L413.554 343.554L339.64 269.64Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M202.5 269C202.5 269 269 269 269 335.5C269 402 202.5 402 202.5 402H-6.5C-6.5 402 -77 402 -77 335.5C-77 269 -6.5 269 -6.5 269H202.5Z" stroke="#00AE99" stroke-width="3"/>
+</g>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/buildBusiness.svg b/packages/website/ts/icons/illustrations/buildBusiness.svg
new file mode 100755
index 000000000..48e5b3b1c
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/buildBusiness.svg
@@ -0,0 +1,6 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M2 45C2 68.7579 21.2421 88 45 88C68.7579 88 88 68.7579 88 45C88 21.6448 69.3906 2.63278 46.1793 2.02876C45.7478 2.02876 45.3452 2 44.9137 2C21.2134 2.02876 2 21.2709 2 45Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M78.8765 52.5843V69.7753H12.1349V52.5843M78.8765 52.5843V21.236H12.1349V52.5843M78.8765 52.5843H51.5731H39.4383H12.1349" stroke="#00AE99" stroke-width="3"/>
+<path d="M56.6293 11.1236H34.3821V21.236H56.6293V11.1236Z" stroke="#00AE99" stroke-width="3"/>
+<rect width="22.2472" height="6.06742" transform="matrix(1 0 0 -1 34.3821 58.6517)" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/checkmark.svg b/packages/website/ts/icons/illustrations/checkmark.svg
new file mode 100644
index 000000000..e17a7ab8b
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/checkmark.svg
@@ -0,0 +1 @@
+<svg width="124" height="124" viewBox="0 0 124 124" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M61.878.5h.002c.327 0 .64.01.924.02l.01.001a23.966 23.966 0 0 0 .87.02C96.885 1.405 123.5 28.597 123.5 62c0 33.979-27.521 61.5-61.5 61.5S.5 95.979.5 62C.5 28.063 27.979.541 61.878.5zm.002 3C29.64 3.54 3.5 29.717 3.5 62c0 32.322 26.178 58.5 58.5 58.5s58.5-26.178 58.5-58.5c0-31.768-25.308-57.628-56.875-58.46-.32 0-.625-.01-.904-.02h-.01c-.294-.011-.56-.02-.83-.02z" fill="#00AE99"/><path fill-rule="evenodd" clip-rule="evenodd" d="M47.502 98.561l55.419-55.419L88.779 29 47.495 70.284 34.142 56.932 20 71.074l16.573 16.573.008-.007L47.502 98.56zM36.573 83.405l.008-.008 10.921 10.921L98.68 43.142l-9.9-9.9-41.284 41.285-13.353-13.352-9.9 9.9 12.331 12.33z" fill="#00AE99"/></svg> \ No newline at end of file
diff --git a/packages/website/ts/icons/illustrations/code-repo.svg b/packages/website/ts/icons/illustrations/code-repo.svg
new file mode 100644
index 000000000..43e412198
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/code-repo.svg
@@ -0,0 +1,7 @@
+<svg width="82" height="82" viewBox="0 0 82 82" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M40.9185 1.43051e-06L40.9197 0C41.1377 7.15256e-07 41.3462 0.00719154 41.5359 0.0137337L41.5428 0.0139726C41.7392 0.0207458 41.9163 0.0267566 42.097 0.0267566C42.1057 0.0267566 42.1143 0.0268694 42.123 0.027095C64.2563 0.603056 82 18.7315 82 41C82 63.6526 63.6526 82 41 82C18.3474 82 0 63.6526 0 41C0 18.3752 18.3193 0.0274277 40.9185 1.43051e-06ZM40.9203 2C19.4262 2.02641 2 19.4778 2 41C2 62.548 19.452 80 41 80C62.548 80 80 62.548 80 41C80 19.8212 63.1283 2.58105 42.0835 2.02675C41.8704 2.02646 41.6666 2.01943 41.4808 2.01302L41.4739 2.01278C41.2777 2.00602 41.1008 2.00001 40.9203 2Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M10.7026 14.378C10.7026 13.8257 11.1504 13.378 11.7026 13.378H33.7762C34.3284 13.378 34.7762 13.8257 34.7762 14.378V36.4516C34.7762 37.0039 34.3284 37.4516 33.7762 37.4516H11.7026C11.1504 37.4516 10.7026 37.0039 10.7026 36.4516V14.378ZM12.7026 15.378V35.4516H32.7762V15.378H12.7026Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M38.6621 20.6785L33.0687 15.0851L34.4829 13.6709L40.3692 19.5572C40.5567 19.7447 40.6621 19.9991 40.6621 20.2643V42.3379C40.6621 42.8902 40.2143 43.3379 39.6621 43.3379H17.5885C17.3233 43.3379 17.0689 43.2325 16.8814 43.045L10.9951 37.1587L12.4093 35.7445L18.0027 41.3379H38.6621V20.6785Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M38.6621 42.338C38.6621 41.7857 39.1098 41.338 39.6621 41.338H61.7357C62.288 41.338 62.7357 41.7857 62.7357 42.338V64.4116C62.7357 64.9638 62.288 65.4116 61.7357 65.4116H39.6621C39.1098 65.4116 38.6621 64.9638 38.6621 64.4116V42.338ZM40.6621 43.338V63.4116H60.7357V43.338H40.6621Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M66.622 48.6385L61.0286 43.0451L62.4429 41.6309L68.3291 47.5172C68.5167 47.7047 68.622 47.9591 68.622 48.2243V70.2979C68.622 70.8501 68.1743 71.2979 67.622 71.2979H45.5485C45.2833 71.2979 45.0289 71.1925 44.8414 71.005L38.9551 65.1187L40.3693 63.7045L45.9627 69.2979H66.622V48.6385Z" fill="#00AE99"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/coin.svg b/packages/website/ts/icons/illustrations/coin.svg
new file mode 100644
index 000000000..a1fb123a4
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/coin.svg
@@ -0,0 +1 @@
+<svg width="88" height="88" viewBox="0 0 88 88" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M44 87c23.748 0 43-19.252 43-43S67.748 1 44 1 1 20.252 1 44s19.252 43 43 43z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M43.999 78.4c18.998 0 34.4-15.401 34.4-34.4 0-18.998-15.401-34.4-34.4-34.4S9.599 25.002 9.599 44C9.599 63 25 78.4 43.999 78.4z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M35.1 57.76v1h20.529v-7.395h-6.098V26.738H42.36l-.254.173-6.568 4.456-.438.298v8.906l1.561-1.06 5.006-3.397v15.251H35.1v6.395z" stroke="#00AE99" stroke-width="2"/><path d="M9.597 43.766c7.115-1.173 12.588-7.271 12.588-14.777 0-3.362-1.095-6.41-2.971-8.913-5.864 6.177-9.538 14.542-9.617 23.69zM9.597 44.234c.079 9.226 3.753 17.513 9.617 23.69a14.719 14.719 0 0 0 2.97-8.913c0-7.506-5.472-13.682-12.587-14.777zM78.399 43.766c-7.115-1.173-12.587-7.271-12.587-14.777 0-3.362 1.094-6.41 2.97-8.913 5.864 6.177 9.539 14.542 9.617 23.69zM78.399 44.235c-.079 9.225-3.753 17.512-9.617 23.689a14.718 14.718 0 0 1-2.97-8.913c0-7.506 5.472-13.682 12.587-14.776z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/></svg>
diff --git a/packages/website/ts/icons/illustrations/consistently-ship.svg b/packages/website/ts/icons/illustrations/consistently-ship.svg
new file mode 100644
index 000000000..733655a3f
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/consistently-ship.svg
@@ -0,0 +1,6 @@
+<svg width="104" height="104" viewBox="0 0 104 104" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M37.5485 62.3767L10.6742 80.0615M16.1162 86.694L39.2493 63.9073" stroke="#00AE99" stroke-width="2.5"/>
+<path d="M43.1605 67.4788L29.2115 96.3881M21.8987 91.9664L41.2898 65.7782" stroke="#00AE99" stroke-width="2.5"/>
+<path d="M64.6767 66.0071L63.4346 66.1475L63.4346 66.1475L64.6767 66.0071ZM65.0025 50.4035L66.2054 50.7435L65.0025 50.4035ZM71.1301 36.7515L70.153 35.9719L70.1082 36.0281L70.0701 36.0891L71.1301 36.7515ZM61.2375 73.5299L60.4186 74.4743L61.3787 75.3068L62.1953 74.3331L61.2375 73.5299ZM47.4561 66.4802L48.3306 67.3734L48.3678 67.337L48.4018 67.2977L47.4561 66.4802ZM45.1781 66.5118L45.9955 65.5661L45.9955 65.5661L45.1781 66.5118ZM44.504 67.2916L45.2499 68.2947L45.36 68.2128L45.4497 68.109L44.504 67.2916ZM43.2195 67.2024L44.037 66.2568L44.037 66.2568L43.2195 67.2024ZM51.486 57.3064L50.6457 58.2318L50.657 58.2421L50.6685 58.2521L51.486 57.3064ZM62.7637 71.4218L63.819 72.0917L63.819 72.0917L62.7637 71.4218ZM76.5283 23.4963L77.6859 23.0248L77.5727 22.7469L77.3457 22.5507L76.5283 23.4963ZM35.9701 41.1929L36.0109 42.4422L36.0109 42.4422L35.9701 41.1929ZM51.3624 38.6129L50.8519 37.4718L51.3624 38.6129ZM63.9842 30.5744L64.793 31.5275L64.8478 31.481L64.8969 31.4285L63.9842 30.5744ZM29.0241 45.6843L28.0908 44.8528L27.2455 45.8017L28.2082 46.6313L29.0241 45.6843ZM37.9936 58.3007L37.0479 57.4833L37.0139 57.5226L36.9833 57.5647L37.9936 58.3007ZM38.2919 60.5593L39.1094 59.6137L39.1094 59.6137L38.2919 60.5593ZM37.6179 61.3391L36.6722 60.5217L36.5825 60.6255L36.5174 60.7463L37.6179 61.3391ZM37.8919 62.5972L38.7094 61.6516L38.7094 61.6515L37.8919 62.5972ZM46.4878 52.9859L45.6704 53.9316L45.6819 53.9416L45.6937 53.9513L46.4878 52.9859ZM30.8892 43.8692L30.0736 42.9219L30.0736 42.9219L30.8892 43.8692ZM76.3188 23.3153L77.1362 22.3696L76.9092 22.1734L76.6179 22.1016L76.3188 23.3153ZM70.1348 36.0655L51.3508 57.796L53.2421 59.4309L72.0261 37.7004L70.1348 36.0655ZM65.9188 65.8667C65.5634 62.7233 64.3047 57.4681 66.2054 50.7435L63.7996 50.0635C61.7311 57.3817 63.1075 63.2547 63.4346 66.1475L65.9188 65.8667ZM66.2054 50.7435C67.7494 45.2809 70.8444 39.5677 72.1902 37.4138L70.0701 36.0891C68.6538 38.3557 65.431 44.2919 63.7996 50.0635L66.2054 50.7435ZM72.1073 37.531C72.8165 36.642 73.9266 35.0937 74.9321 33.5888C75.9127 32.1211 76.8909 30.5525 77.2543 29.671L74.943 28.7181C74.6915 29.3283 73.864 30.6874 72.8534 32.1999C71.8677 33.6752 70.801 35.1596 70.153 35.9719L72.1073 37.531ZM62.0564 72.5855L50.6963 62.7347L49.0585 64.6235L60.4186 74.4743L62.0564 72.5855ZM48.9317 62.8617L46.5104 65.6628L48.4018 67.2977L50.823 64.4966L48.9317 62.8617ZM46.5816 65.5871C46.6163 65.5531 46.6022 65.5735 46.5354 65.6101C46.4766 65.6423 46.4098 65.6684 46.3459 65.6814C46.2855 65.6937 46.2383 65.6924 46.1986 65.6831C46.1638 65.6751 46.0953 65.6523 45.9955 65.5661L44.3607 67.4575C45.1854 68.1704 46.1014 68.2823 46.8439 68.1313C47.5166 67.9946 48.0515 67.6467 48.3306 67.3734L46.5816 65.5871ZM44.2324 65.6944L43.5584 66.4741L45.4497 68.109L46.1238 67.3293L44.2324 65.6944ZM43.7582 66.2885C43.804 66.2544 43.8326 66.2427 43.8431 66.2387C43.857 66.2334 43.8754 66.2284 43.9003 66.2268C43.9278 66.2251 43.9618 66.228 43.9962 66.2392C44.0323 66.251 44.0456 66.2643 44.037 66.2568L42.4021 68.1481C43.5138 69.1091 44.7467 68.6688 45.2499 68.2947L43.7582 66.2885ZM50.6685 58.2521C51.1247 58.6464 51.5236 59.8632 50.612 60.9178L52.5033 62.5527C54.3763 60.3859 53.7352 57.5984 52.3034 56.3607L50.6685 58.2521ZM50.612 60.9178L48.9317 62.8617L50.823 64.4966L52.5033 62.5527L50.612 60.9178ZM62.1953 74.3331C62.6486 73.7926 63.2417 73.0013 63.819 72.0917L61.7083 70.7519C61.1892 71.5698 60.6611 72.2719 60.2798 72.7266L62.1953 74.3331ZM63.819 72.0917C64.381 71.2063 64.9483 70.1773 65.3541 69.1342C65.7512 68.1137 66.0422 66.9586 65.9188 65.8667L63.4346 66.1475C63.4916 66.6522 63.3613 67.3615 63.0243 68.2277C62.6961 69.0712 62.2166 69.9513 61.7083 70.7519L63.819 72.0917ZM50.6948 62.7335L45.811 58.5118L44.1761 60.4032L49.0599 64.6248L50.6948 62.7335ZM48.0426 55.9286C49.1315 56.8715 50.1183 57.753 50.6457 58.2318L52.3263 56.381C51.7849 55.8894 50.7834 54.9948 49.679 54.0386L48.0426 55.9286ZM40.7648 64.3497L44.3607 67.4575L45.9955 65.5661L42.3996 62.4582L40.7648 64.3497ZM39.6096 65.7343L42.4021 68.1481L44.037 66.2568L41.2445 63.8429L39.6096 65.7343ZM77.2543 29.671C77.6017 28.8283 77.9174 27.7261 78.0507 26.5812C78.1821 25.4521 78.1499 24.1638 77.6859 23.0248L75.3706 23.9679C75.6133 24.5637 75.6738 25.3787 75.5675 26.2921C75.463 27.1897 75.2106 28.0692 74.943 28.7181L77.2543 29.671ZM62.9156 29.8252L44.1315 51.5557L46.0229 53.1906L64.8069 31.4601L62.9156 29.8252ZM36.0109 42.4422C38.9206 42.3473 44.9309 42.8595 51.8728 39.7539L50.8519 37.4718C44.4731 40.3255 39.0911 39.8404 35.9294 39.9436L36.0109 42.4422ZM51.8728 39.7539C57.3477 37.3047 62.7552 33.2568 64.793 31.5275L63.1754 29.6213C61.2389 31.2646 56.0337 35.1537 50.8519 37.4718L51.8728 39.7539ZM64.8969 31.4285C65.6069 30.6698 66.9213 29.3996 68.2385 28.2108C69.5889 26.992 70.814 25.9765 71.3813 25.6394L70.1041 23.4903C69.2845 23.9774 67.8738 25.1723 66.5635 26.3549C65.2199 27.5676 63.8485 28.89 63.0715 29.7203L64.8969 31.4285ZM28.2082 46.6313L39.5989 56.4466L41.2308 54.5527L29.8401 44.7374L28.2082 46.6313ZM39.4692 54.6822L37.0479 57.4833L38.9392 59.1182L41.3605 56.3171L39.4692 54.6822ZM36.9833 57.5647C36.7532 57.8804 36.4864 58.46 36.4484 59.1453C36.4065 59.9019 36.6497 60.7921 37.4745 61.505L39.1094 59.6137C39.0096 59.5275 38.9772 59.4629 38.9642 59.4297C38.9494 59.3918 38.9412 59.3452 38.9446 59.2836C38.9482 59.2185 38.9644 59.1487 38.9878 59.0859C39.0143 59.0144 39.0324 58.9976 39.0039 59.0368L36.9833 57.5647ZM37.3462 59.7419L36.6722 60.5217L38.5635 62.1566L39.2376 61.3768L37.3462 59.7419ZM36.5174 60.7463C36.22 61.2983 35.9627 62.5819 37.0745 63.5429L38.7094 61.6515C38.7007 61.6441 38.7158 61.6554 38.7326 61.6893C38.7487 61.7218 38.7565 61.755 38.7588 61.7825C38.7609 61.8074 38.7585 61.8263 38.7553 61.8408C38.7529 61.8517 38.7454 61.8817 38.7183 61.9319L36.5174 60.7463ZM47.3052 52.0403C45.8734 50.8026 43.0225 50.5715 41.1495 52.7383L43.0408 54.3732C43.9524 53.3186 45.2142 53.5373 45.6704 53.9316L47.3052 52.0403ZM41.1495 52.7383L39.4692 54.6822L41.3605 56.3171L43.0408 54.3732L41.1495 52.7383ZM29.9575 46.5158C30.3523 46.0726 30.9705 45.4485 31.7047 44.8165L30.0736 42.9219C29.2572 43.6247 28.56 44.3261 28.0908 44.8528L29.9575 46.5158ZM31.7047 44.8165C32.4234 44.1978 33.2248 43.596 34.012 43.1492C34.8203 42.6904 35.5033 42.4588 36.0109 42.4422L35.9294 39.9436C34.8311 39.9794 33.7302 40.4345 32.7779 40.975C31.8045 41.5275 30.8684 42.2377 30.0736 42.9219L31.7047 44.8165ZM39.5974 56.4453L44.4813 60.667L46.1161 58.7756L41.2323 54.554L39.5974 56.4453ZM49.9826 54.3011C48.8767 53.3467 47.8466 52.4851 47.2819 52.0206L45.6937 53.9513C46.2438 54.4038 47.2588 55.2527 48.3493 56.1937L49.9826 54.3011ZM42.7049 62.7221L39.1094 59.6137L37.4744 61.5049L41.0699 64.6133L42.7049 62.7221ZM41.5018 64.0654L38.7094 61.6516L37.0745 63.5429L39.8669 65.9567L41.5018 64.0654ZM71.3813 25.6394C71.9847 25.2807 72.8184 24.9037 73.6914 24.6705C74.5799 24.4331 75.395 24.375 76.0197 24.529L76.6179 22.1016C75.4237 21.8073 74.1443 21.9618 73.0462 22.2552C71.9326 22.5527 70.8876 23.0246 70.1041 23.4903L71.3813 25.6394ZM77.3457 22.5507L77.1362 22.3696L75.5013 24.2609L75.7108 24.442L77.3457 22.5507Z" fill="#00AE99"/>
+<path d="M52 102C79.6142 102 102 79.6142 102 52C102 24.3858 79.6142 2 52 2C24.3858 2 2 24.3858 2 52C2 79.6142 24.3858 102 52 102Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/customize.svg b/packages/website/ts/icons/illustrations/customize.svg
new file mode 100644
index 000000000..1f018ee7a
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/customize.svg
@@ -0,0 +1 @@
+<svg width="152" height="152" viewBox="0 0 152 152" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M76 151c41.421 0 75-33.579 75-75S117.421 1 76 1 1 34.579 1 76s33.579 75 75 75z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M120.5 122.906H31.503c-12.943 0-23.478-10.485-23.478-23.478 0-12.993 10.485-23.478 23.478-23.478H120.5" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M120.499 122.906c12.967 0 23.478-10.511 23.478-23.478 0-12.967-10.511-23.478-23.478-23.478-12.967 0-23.478 10.511-23.478 23.478 0 12.967 10.511 23.478 23.478 23.478z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M120.5 122.906H31.503c-12.943 0-23.478-10.485-23.478-23.478 0-12.993 10.485-23.478 23.478-23.478H120.5" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M120.499 122.906c12.967 0 23.478-10.511 23.478-23.478 0-12.967-10.511-23.478-23.478-23.478-12.967 0-23.478 10.511-23.478 23.478 0 12.967 10.511 23.478 23.478 23.478z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M31.5 29.093h88.996c12.943 0 23.478 10.485 23.478 23.478 0 12.993-10.485 23.478-23.478 23.478H31.499" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M31.503 76.052c12.967 0 23.478-10.512 23.478-23.478 0-12.967-10.511-23.479-23.478-23.479-12.966 0-23.478 10.512-23.478 23.479 0 12.966 10.512 23.478 23.478 23.478z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/></svg> \ No newline at end of file
diff --git a/packages/website/ts/icons/illustrations/decentralisedLoans.svg b/packages/website/ts/icons/illustrations/decentralisedLoans.svg
new file mode 100755
index 000000000..72d0de7fc
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/decentralisedLoans.svg
@@ -0,0 +1,13 @@
+<svg width="151" height="150" viewBox="0 0 151 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="76" cy="75" r="73" stroke="#00AE99" stroke-width="3"/>
+<rect x="3" y="75" width="45.9619" height="45.9619" transform="rotate(-45 3 75)" stroke="#00AE99" stroke-width="3"/>
+<rect x="85" y="75" width="45" height="45" transform="rotate(-45 85 75)" stroke="#00AE99" stroke-width="3"/>
+<path d="M89 79L76 92M100 115L85 100L71.5 113.5L63 105L76 92M100 115L113 102M100 115L106 121C97.6605 129.494 89.3395 138.006 81 146.5L38.5 104M76 92L63 79" stroke="#00AE99" stroke-width="3"/>
+<path d="M63.5 71.5L76.5 58.5M52.5 35.5L67.5 50.5L81 37L89.5 45.5L76.5 58.5M52.5 35.5L39.5 48.5M52.5 35.5L46.5 29.5C54.8395 21.0061 63.1605 12.4939 71.5 4L114 46.5M76.5 58.5L89.5 71.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M93 134.5L87 128.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M99 128L93.5 122.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M87 140L81.5 134.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M60.5 16.5L66.5 22.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M54.5 23L60 28.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M66.5 11L72 16.5" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/description.svg b/packages/website/ts/icons/illustrations/description.svg
new file mode 100755
index 000000000..1887b182e
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/description.svg
@@ -0,0 +1,21 @@
+<svg width="353" height="80" viewBox="0 0 353 80" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M130.818 77C151.253 77 167.818 60.4345 167.818 40C167.818 19.5655 151.253 3 130.818 3C110.384 3 93.8181 19.5655 93.8181 40C93.8181 60.4345 110.384 77 130.818 77Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M140.505 11.9474V21.0965H149.654" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M149.655 21.0964V49.351H124.562V11.9473H140.506L149.655 21.0964Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M121.131 68.0529V58.9038H111.982" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M111.982 58.9039V30.6494H137.075V68.053H121.131L111.982 58.9039Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M40 77C60.4345 77 77 60.4345 77 40C77 19.5655 60.4345 3 40 3C19.5655 3 3.00001 19.5655 3.00001 40C3.00001 60.4345 19.5655 77 40 77Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M40.0037 76.9359C60.4007 76.9359 76.9357 60.4009 76.9357 40.0038C76.9357 19.6068 60.4007 3.07178 40.0037 3.07178C19.6066 3.07178 3.07159 19.6068 3.07159 40.0038C3.07159 60.4009 19.6066 76.9359 40.0037 76.9359Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M30.0225 54.7728V56.2728H31.5225H51.4155H52.9155V54.7728V48.9811V47.4811H51.4155H46.3684V22.5411V21.0411H44.8684H38.5732H38.1123L37.7309 21.2999L30.6803 26.0843L30.0225 26.5306V27.3255V34.2922V37.1228L32.3648 35.5335L37.0732 32.3385V47.4811H31.5225H30.0225V48.9811V54.7728Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M3.06793 39.7483C10.7062 38.4893 16.5817 31.9422 16.5817 23.8843C16.5817 20.275 15.4066 17.0015 13.3921 14.3156C7.09688 20.9465 3.15187 29.9277 3.06793 39.7483Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M3.06793 40.2518C3.15187 50.1563 7.09688 59.0535 13.3921 65.6845C15.4066 62.9986 16.5817 59.725 16.5817 56.1158C16.5817 48.0579 10.7062 41.4269 3.06793 40.2518Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M76.9322 39.7483C69.294 38.4893 63.4184 31.9422 63.4184 23.8843C63.4184 20.275 64.5936 17.0015 66.608 14.3156C72.9033 20.9465 76.8483 29.9277 76.9322 39.7483Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M76.9321 40.2518C76.8482 50.1563 72.9031 59.0536 66.6079 65.6846C64.5934 62.9986 63.4183 59.7251 63.4183 56.1158C63.4183 48.0579 69.2939 41.4269 76.9321 40.2518Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M221.987 77C242.421 77 258.987 60.4345 258.987 40C258.987 19.5655 242.421 3 221.987 3C201.552 3 184.987 19.5655 184.987 40C184.987 60.4345 201.552 77 221.987 77Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M221.987 77C242.421 77 258.987 60.4345 258.987 40C258.987 19.5655 242.421 3 221.987 3C201.552 3 184.987 19.5655 184.987 40C184.987 60.4345 201.552 77 221.987 77Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M225.754 38.1178V16.3887H228.848V10.2668H215.125V16.3887H218.219V38.1178C211.156 39.7996 205.908 46.1905 205.908 53.725C205.908 62.605 213.106 69.8032 221.986 69.8032C230.866 69.8032 238.065 62.605 238.065 53.725C238.065 46.1232 232.817 39.7996 225.754 38.1178Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M228.848 10.1979H215.124V16.3197H228.848V10.1979Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M208.6 44.7092H235.307" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M312.805 77C333.239 77 349.805 60.4345 349.805 40C349.805 19.5655 333.239 3 312.805 3C292.37 3 275.805 19.5655 275.805 40C275.805 60.4345 292.37 77 312.805 77Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M312.607 15.2613L290.287 45.3102H312.607L312.668 64.4778L334.926 34.3678H312.607V15.2613Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/descriptionBolt.svg b/packages/website/ts/icons/illustrations/descriptionBolt.svg
new file mode 100755
index 000000000..45e51240f
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/descriptionBolt.svg
@@ -0,0 +1,4 @@
+<svg width="78" height="78" viewBox="0 0 78 78" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M38.8049 76C59.2395 76 75.8049 59.4345 75.8049 39C75.8049 18.5655 59.2395 2 38.8049 2C18.3704 2 1.80493 18.5655 1.80493 39C1.80493 59.4345 18.3704 76 38.8049 76Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M38.6065 14.2613L16.2874 44.3102H38.6065L38.6679 63.4778L60.9257 33.3678H38.6065V14.2613Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/descriptionCoin.svg b/packages/website/ts/icons/illustrations/descriptionCoin.svg
new file mode 100755
index 000000000..d1015b98d
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/descriptionCoin.svg
@@ -0,0 +1,9 @@
+<svg width="78" height="78" viewBox="0 0 78 78" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M39 76C59.4345 76 76 59.4345 76 39C76 18.5655 59.4345 2 39 2C18.5655 2 2.00001 18.5655 2.00001 39C2.00001 59.4345 18.5655 76 39 76Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M39.0037 75.9359C59.4007 75.9359 75.9357 59.4009 75.9357 39.0038C75.9357 18.6068 59.4007 2.07178 39.0037 2.07178C18.6066 2.07178 2.07159 18.6068 2.07159 39.0038C2.07159 59.4009 18.6066 75.9359 39.0037 75.9359Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M29.0225 53.7728V55.2728H30.5225H50.4155H51.9155V53.7728V47.9811V46.4811H50.4155H45.3684V21.5411V20.0411H43.8684H37.5732H37.1123L36.7309 20.2999L29.6803 25.0843L29.0225 25.5306V26.3255V33.2922V36.1228L31.3648 34.5335L36.0732 31.3385V46.4811H30.5225H29.0225V47.9811V53.7728Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M2.06793 38.7483C9.70615 37.4893 15.5817 30.9422 15.5817 22.8843C15.5817 19.275 14.4066 16.0015 12.3921 13.3156C6.09688 19.9465 2.15187 28.9277 2.06793 38.7483Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M2.06793 39.2518C2.15187 49.1563 6.09688 58.0535 12.3921 64.6845C14.4066 61.9986 15.5817 58.725 15.5817 55.1158C15.5817 47.0579 9.70615 40.4269 2.06793 39.2518Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M75.9322 38.7483C68.294 37.4893 62.4184 30.9422 62.4184 22.8843C62.4184 19.275 63.5936 16.0015 65.608 13.3156C71.9033 19.9465 75.8483 28.9277 75.9322 38.7483Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M75.9321 39.2518C75.8482 49.1563 71.9031 58.0536 65.6079 64.6846C63.5934 61.9986 62.4183 58.7251 62.4183 55.1158C62.4183 47.0579 68.2939 40.4269 75.9321 39.2518Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/descriptionCopy.svg b/packages/website/ts/icons/illustrations/descriptionCopy.svg
new file mode 100755
index 000000000..6c9b5f0fc
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/descriptionCopy.svg
@@ -0,0 +1,7 @@
+<svg width="78" height="78" viewBox="0 0 78 78" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M38.8181 3.5C19.212 3.5 3.31812 19.3939 3.31812 39C3.31812 58.6061 19.212 74.5 38.8181 74.5C58.4242 74.5 74.3181 58.6061 74.3181 39C74.3181 19.3939 58.4242 3.5 38.8181 3.5ZM0.318115 39C0.318115 17.737 17.5552 0.5 38.8181 0.5C60.0811 0.5 77.3181 17.737 77.3181 39C77.3181 60.263 60.0811 77.5 38.8181 77.5C17.5552 77.5 0.318115 60.263 0.318115 39Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M47.0054 10.9473H50.0054V18.5964H57.6545V21.5964H47.0054V10.9473Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M31.0619 9.44727H49.1268L59.1546 19.475V49.8509H31.0619V9.44727ZM34.0619 12.4473V46.8509H56.1546V20.7177L47.8842 12.4473H34.0619Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M19.9818 56.4038H30.6309V67.0529H27.6309V59.4038H19.9818V56.4038Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M18.4818 28.1494H46.5745V68.553H28.5096L18.4818 58.5253V28.1494ZM21.4818 31.1494V57.2826L29.7522 65.553H43.5745V31.1494H21.4818Z" fill="#00AE99"/>
+</svg> \ No newline at end of file
diff --git a/packages/website/ts/icons/illustrations/descriptionFlask.svg b/packages/website/ts/icons/illustrations/descriptionFlask.svg
new file mode 100755
index 000000000..703b069d5
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/descriptionFlask.svg
@@ -0,0 +1,7 @@
+<svg width="78" height="78" viewBox="0 0 78 78" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M38.9868 76C59.4213 76 75.9868 59.4345 75.9868 39C75.9868 18.5655 59.4213 2 38.9868 2C18.5523 2 1.9868 18.5655 1.9868 39C1.9868 59.4345 18.5523 76 38.9868 76Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M38.9868 76C59.4213 76 75.9868 59.4345 75.9868 39C75.9868 18.5655 59.4213 2 38.9868 2C18.5523 2 1.9868 18.5655 1.9868 39C1.9868 59.4345 18.5523 76 38.9868 76Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M42.7537 37.1178V15.3887H45.8483V9.26685H32.1246V15.3887H35.2192V37.1178C28.1555 38.7996 22.9083 45.1905 22.9083 52.725C22.9083 61.605 30.1064 68.8032 38.9864 68.8032C47.8664 68.8032 55.0646 61.605 55.0646 52.725C55.0646 45.1232 49.8174 38.7996 42.7537 37.1178Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M45.848 9.19794H32.1243V15.3197H45.848V9.19794Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M25.5996 43.7092H52.3069" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/eficientDesign.svg b/packages/website/ts/icons/illustrations/eficientDesign.svg
new file mode 100755
index 000000000..6b8f852c3
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/eficientDesign.svg
@@ -0,0 +1,11 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M45 88C68.7482 88 88 68.7482 88 45C88 21.2518 68.7482 2 45 2C21.2518 2 2 21.2518 2 45C2 68.7482 21.2518 88 45 88Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M70.2962 31.8956L57.4584 19.3542L44.833 32.1067L57.6708 44.6481L70.2962 31.8956Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M74.8267 14.5717L57.4829 19.3431L70.311 31.8859L74.8267 14.5717Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M32.184 19.5506L19.5587 32.3031L32.3965 44.8445L45.0218 32.092L32.184 19.5506Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M14.7418 15.0572L19.5451 32.2857L32.1719 19.5429L14.7418 15.0572Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M19.698 57.5441L32.5358 70.0856L45.1612 57.3331L32.3234 44.7916L19.698 57.5441Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M15.1732 74.8574L32.517 70.086L19.6889 57.5432L15.1732 74.8574Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M57.8244 69.8803L70.4497 57.1278L57.6119 44.5863L44.9865 57.3389L57.8244 69.8803Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M75.2582 74.3715L70.4548 57.1429L57.8281 69.8858L75.2582 74.3715Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/eth-based-tokens.svg b/packages/website/ts/icons/illustrations/eth-based-tokens.svg
new file mode 100644
index 000000000..b0370d234
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/eth-based-tokens.svg
@@ -0,0 +1,6 @@
+<svg width="84" height="84" viewBox="0 0 84 84" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path fill-rule="evenodd" clip-rule="evenodd" d="M42.1187 1.19995L42.1199 1.19995C42.3379 1.19995 42.5464 1.20714 42.7361 1.21368L42.743 1.21392C42.9394 1.2207 43.1165 1.22671 43.2972 1.22671C43.3058 1.22671 43.3145 1.22682 43.3232 1.22705C65.4565 1.80301 83.2002 19.9314 83.2002 42.1999C83.2002 64.8526 64.8528 83.1999 42.2002 83.1999C19.5476 83.1999 1.2002 64.8526 1.2002 42.1999C1.2002 19.5752 19.5195 1.22738 42.1187 1.19995ZM42.1205 3.19995C20.6264 3.22636 3.2002 20.6778 3.2002 42.1999C3.2002 63.748 20.6521 81.1999 42.2002 81.1999C63.7482 81.1999 81.2002 63.748 81.2002 42.1999C81.2002 21.0212 64.3285 3.781 43.2837 3.2267C43.0706 3.22641 42.8668 3.21938 42.681 3.21297L42.6741 3.21274C42.4779 3.20597 42.301 3.19997 42.1205 3.19995Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M68.0979 42.2001C68.0979 42.5434 67.9218 42.8627 67.6314 43.0459L42.7337 58.7489C42.4077 58.9544 41.9927 58.9544 41.6667 58.7489L16.769 43.0459C16.4786 42.8628 16.3025 42.5434 16.3025 42.2001C16.3025 41.8567 16.4786 41.5374 16.769 41.3543L41.6667 25.6513C41.9927 25.4457 42.4077 25.4457 42.7337 25.6513L67.6314 41.3543C67.9218 41.5374 68.0979 41.8567 68.0979 42.2001ZM42.2002 27.6794L19.177 42.2001L42.2002 56.7208L65.2234 42.2001L42.2002 27.6794Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M66.1803 49.8738C66.5224 50.2245 66.5601 50.7714 66.2693 51.1656L43.005 82.7131C42.8165 82.9687 42.5178 83.1196 42.2002 83.1196C41.8826 83.1196 41.5838 82.9687 41.3953 82.7131L18.1311 51.1656C17.8403 50.7714 17.878 50.2245 18.2201 49.8739C18.5621 49.5232 19.1079 49.4719 19.5092 49.7528L42.2002 65.6307L64.8912 49.7528C65.2925 49.4719 65.8383 49.5232 66.1803 49.8738ZM61.0375 54.8904L42.7735 67.6705C42.4292 67.9114 41.9711 67.9114 41.6268 67.6705L23.3628 54.8904L42.2002 80.4347L61.0375 54.8904Z" fill="#00AE99"/>
+<path fill-rule="evenodd" clip-rule="evenodd" d="M42.2002 1.28039C42.5439 1.28039 42.8635 1.45687 43.0465 1.74773L68.1713 41.6673L66.4786 42.7326L42.2002 4.15775L17.9218 42.7327L16.2291 41.6673L41.3539 1.74773C41.5369 1.45687 41.8565 1.28039 42.2002 1.28039Z" fill="#00AE99"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/extensibleArchitecture.svg b/packages/website/ts/icons/illustrations/extensibleArchitecture.svg
new file mode 100755
index 000000000..7674b3289
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/extensibleArchitecture.svg
@@ -0,0 +1,11 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M45.0089 45.022L80.128 45.022L80.128 68.6648L68.5 68.6648" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M44.9968 45.0043L69.8295 69.837L53.1116 86.5548L44.9968 78.4399" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M45 44.9999V80.119H21.3572V69" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M44.9932 44.9767L20.1605 69.8094L3.44264 53.0916L11.5575 44.9767" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M45.0066 44.9802L9.88753 44.9802L9.88753 21.3373L21 21.3373" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M45.0057 44.9928L20.173 20.1601L36.8908 3.44228L45.0057 11.5571" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M45.0133 44.9977L45.0133 9.87867L68.6561 9.87867L68.6561 21" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M45.0249 45.006H62H78.4605L86.5754 36.8911L69.8575 20.1733L45.0249 45.006Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M45 88C68.7482 88 88 68.7482 88 45C88 21.2518 68.7482 2 45 2C21.2518 2 2 21.2518 2 45C2 68.7482 21.2518 88 45 88Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/flexibleIntegration.svg b/packages/website/ts/icons/illustrations/flexibleIntegration.svg
new file mode 100755
index 000000000..dee44d4c0
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/flexibleIntegration.svg
@@ -0,0 +1,12 @@
+<svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M75 148C115.317 148 148 115.317 148 75C148 34.6832 115.317 2 75 2C34.6832 2 2 34.6832 2 75C2 115.317 34.6832 148 75 148Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<rect x="45" y="4" width="30" height="71" rx="15" stroke="#00AE99" stroke-width="3"/>
+<rect x="45" y="4" width="30" height="30" rx="15" stroke="#00AE99" stroke-width="3"/>
+<rect x="116" y="45" width="30" height="30" rx="15" stroke="#00AE99" stroke-width="3"/>
+<rect x="75" y="116" width="30" height="30" rx="15" stroke="#00AE99" stroke-width="3"/>
+<rect x="4" y="75" width="30" height="30" rx="15" stroke="#00AE99" stroke-width="3"/>
+<rect x="75" y="75" width="30" height="71" rx="15" stroke="#00AE99" stroke-width="3"/>
+<rect x="75" y="45" width="71" height="30" rx="15" stroke="#00AE99" stroke-width="3"/>
+<rect x="4" y="75" width="71" height="30" rx="15" stroke="#00AE99" stroke-width="3"/>
+<path d="M43.5 19V60H46.5V19H43.5ZM30 73.5C22.5442 73.5 16.5 67.4558 16.5 60H13.5C13.5 69.1127 20.8873 76.5 30 76.5V73.5ZM43.5 60C43.5 67.4558 37.4558 73.5 30 73.5V76.5C39.1127 76.5 46.5 69.1127 46.5 60H43.5ZM106.5 131V90H103.5V131H106.5ZM120 76.5C127.456 76.5 133.5 82.5442 133.5 90H136.5C136.5 80.8873 129.113 73.5 120 73.5V76.5ZM120 73.5C110.887 73.5 103.5 80.8873 103.5 90H106.5C106.5 82.5442 112.544 76.5 120 76.5V73.5ZM131 43.5H90V46.5H131V43.5ZM90 43.5C82.5442 43.5 76.5 37.4558 76.5 30H73.5C73.5 39.1127 80.8873 46.5 90 46.5V43.5ZM90 13.5C80.8873 13.5 73.5 20.8873 73.5 30H76.5C76.5 22.5442 82.5442 16.5 90 16.5V13.5ZM19 106.5H60V103.5H19V106.5ZM73.5 120C73.5 127.456 67.4558 133.5 60 133.5V136.5C69.1127 136.5 76.5 129.113 76.5 120H73.5ZM60 106.5C67.4558 106.5 73.5 112.544 73.5 120H76.5C76.5 110.887 69.1127 103.5 60 103.5V106.5ZM139.099 40.8017C136.843 42.4964 134.041 43.5 131 43.5V46.5C134.713 46.5 138.143 45.2719 140.901 43.2004L139.099 40.8017ZM90 16.5H116.5V13.5H90V16.5ZM16.5 60V33H13.5V60H16.5ZM40.8008 10.8995C42.496 13.1559 43.5 15.9585 43.5 19H46.5C46.5 15.2865 45.2714 11.8556 43.1992 9.09752L40.8008 10.8995ZM19 103.5C15.2865 103.5 11.8556 104.729 9.09752 106.801L10.8995 109.199C13.1559 107.504 15.9585 106.5 19 106.5V103.5ZM60 133.5H33V136.5H60V133.5ZM109.199 139.1C107.504 136.844 106.5 134.041 106.5 131H103.5C103.5 134.714 104.729 138.144 106.801 140.902L109.199 139.1ZM133.5 90V116.5H136.5V90H133.5Z" fill="#00AE99"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/flexibleIntegration0xInstant.svg b/packages/website/ts/icons/illustrations/flexibleIntegration0xInstant.svg
new file mode 100755
index 000000000..bb5116b8b
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/flexibleIntegration0xInstant.svg
@@ -0,0 +1,17 @@
+<svg width="250" height="250" viewBox="0 0 250 250" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M125 247C192.379 247 247 192.379 247 125C247 57.6213 192.379 3 125 3C57.6213 3 3 57.6213 3 125C3 192.379 57.6213 247 125 247Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M125 2V49.5839C125 63.4281 113.777 74.651 99.9329 74.651V74.651C86.0887 74.651 74.8658 63.4281 74.8658 49.5839V13" stroke="#00AE99" stroke-width="3"/>
+<rect x="25" y="75" width="50.1342" height="50.1342" rx="25.0671" stroke="#00AE99" stroke-width="3"/>
+<rect x="125" y="25" width="50.1342" height="50.1342" rx="25.0671" stroke="#00AE99" stroke-width="3"/>
+<rect x="108" y="88" width="34" height="34" rx="17" stroke="#00AE99" stroke-width="3"/>
+<rect x="175" y="125" width="50.1342" height="50.1342" rx="25.0671" stroke="#00AE99" stroke-width="3"/>
+<rect x="75" y="175" width="50.1342" height="50.1342" rx="25.0671" stroke="#00AE99" stroke-width="3"/>
+<path d="M125 248V200.067C125 186.223 136.223 175 150.067 175V175C163.911 175 175.134 186.223 175.134 200.067V236.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M246.5 125H200.067C186.223 125 175 113.777 175 99.9328V99.9328C175 86.0886 186.223 74.8657 200.067 74.8657H235.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M200 73.5001H150V76.5001H200V73.5001ZM150 73.5001C137.021 73.5001 126.5 62.9788 126.5 50.0001H123.5C123.5 64.6356 135.364 76.5001 150 76.5001V73.5001ZM150 23.5001C135.364 23.5001 123.5 35.3645 123.5 50.0001H126.5C126.5 37.0214 137.021 26.5001 150 26.5001V23.5001ZM223.12 54.2318C221.128 65.1907 211.533 73.5001 200 73.5001V76.5001C213.009 76.5001 223.825 67.1282 226.072 54.7682L223.12 54.2318ZM150 26.5001H195V23.5001H150V26.5001Z" fill="#00AE99"/>
+<path d="M3 125H49.5839C63.4281 125 74.651 136.223 74.651 150.067V150.067C74.651 163.911 63.4281 175.134 49.5839 175.134H14" stroke="#00AE99" stroke-width="3"/>
+<path d="M73.5 50V100H76.5V50H73.5ZM50 123.5C37.0213 123.5 26.5 112.979 26.5 100H23.5C23.5 114.636 35.3645 126.5 50 126.5V123.5ZM73.5 100C73.5 112.979 62.9787 123.5 50 123.5V126.5C64.6355 126.5 76.5 114.636 76.5 100H73.5ZM223.5 150V194H226.5V150H223.5ZM176.5 200V150H173.5V200H176.5ZM200 126.5C212.979 126.5 223.5 137.021 223.5 150H226.5C226.5 135.364 214.636 123.5 200 123.5V126.5ZM200 123.5C185.364 123.5 173.5 135.364 173.5 150H176.5C176.5 137.021 187.021 126.5 200 126.5V123.5ZM50 176.5H100V173.5H50V176.5ZM123.5 200C123.5 212.979 112.979 223.5 100 223.5V226.5C114.636 226.5 126.5 214.636 126.5 200H123.5ZM100 176.5C112.979 176.5 123.5 187.021 123.5 200H126.5C126.5 185.364 114.636 173.5 100 173.5V176.5ZM54.7016 26.9701C65.4275 29.1474 73.5 38.6326 73.5 50H76.5C76.5 37.1778 67.3949 26.4855 55.2984 24.0301L54.7016 26.9701ZM26.5 100V55H23.5V100H26.5ZM100 223.5H55V226.5H100V223.5ZM50 173.5C37.1778 173.5 26.4855 182.605 24.0301 194.702L26.9701 195.298C29.1474 184.572 38.6326 176.5 50 176.5V173.5ZM195.768 223.12C184.809 221.128 176.5 211.533 176.5 200H173.5C173.5 213.009 182.872 223.825 195.232 226.072L195.768 223.12Z" fill="#00AE99"/>
+<rect x="75" y="75" width="100" height="100" stroke="#00AE99" stroke-width="3"/>
+<rect x="86" y="144" width="78" height="19" stroke="#00AE99" stroke-width="3"/>
+<path d="M88 134H162" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/flexibleOrders.svg b/packages/website/ts/icons/illustrations/flexibleOrders.svg
new file mode 100755
index 000000000..f4545ae38
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/flexibleOrders.svg
@@ -0,0 +1,4 @@
+<svg width="91" height="90" viewBox="0 0 91 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M2 45C2 68.7579 21.2421 88 45 88C68.7579 88 88 68.7579 88 45C88 21.6448 69.3906 2.63278 46.1793 2.02876C45.7478 2.02876 45.3452 2 44.9137 2C21.2134 2.02876 2 21.2709 2 45Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M67.7548 20.2253V59.6647C67.7548 65.8083 62.7745 70.7886 56.6309 70.7886V70.7886C50.4873 70.7886 45.507 65.8083 45.507 59.6647V31.3492C45.507 25.2057 40.5266 20.2253 34.383 20.2253V20.2253C28.2395 20.2253 23.2591 25.2057 23.2591 31.3492V70.7886M67.7548 20.2253L60.676 27.3042M67.7548 20.2253L74.8337 27.3042M23.2591 70.7886L15.6746 63.2041M23.2591 70.7886L30.8436 63.2041" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/gamingAndCollectibles.svg b/packages/website/ts/icons/illustrations/gamingAndCollectibles.svg
new file mode 100755
index 000000000..c66af5088
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/gamingAndCollectibles.svg
@@ -0,0 +1,18 @@
+<svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="116" cy="34" r="32" stroke="#00AE99" stroke-width="3"/>
+<circle cx="116" cy="34" r="14" stroke="#00AE99" stroke-width="3"/>
+<path d="M116 5L121.216 17.9481L133.046 10.5385L129.655 24.0794L143.581 25.0385L132.878 34L143.581 42.9615L129.655 43.9206L133.046 57.4615L121.216 50.0519L116 63L110.784 50.0519L98.9542 57.4615L102.345 43.9206L88.4194 42.9615L99.122 34L88.4194 25.0385L102.345 24.0794L98.9542 10.5385L110.784 17.9481L116 5Z" stroke="#00AE99" stroke-width="3"/>
+<circle cx="34" cy="34" r="32" stroke="#00AE99" stroke-width="3"/>
+<path d="M66 34H45M2 34H23" stroke="#00AE99" stroke-width="3"/>
+<circle cx="34" cy="34" r="11" stroke="#00AE99" stroke-width="3"/>
+<circle cx="34" cy="34" r="4" stroke="#00AE99" stroke-width="3"/>
+<circle cx="116" cy="116" r="32" stroke="#00AE99" stroke-width="3"/>
+<circle cx="116" cy="116" r="6" stroke="#00AE99" stroke-width="3"/>
+<path d="M103 114C103 110.686 100.314 108 97 108C93.6863 108 91 110.686 91 114" stroke="#00AE99" stroke-width="3"/>
+<path d="M141 114C141 110.686 138.314 108 135 108C131.686 108 129 110.686 129 114" stroke="#00AE99" stroke-width="3"/>
+<path d="M116 122V125C116 128.866 112.866 132 109 132V132C105.134 132 102 128.866 102 125V124" stroke="#00AE99" stroke-width="3"/>
+<path d="M123 133V134C123 137.866 119.866 141 116 141V141C112.134 141 109 137.866 109 134V133" stroke="#00AE99" stroke-width="3"/>
+<path d="M116 122V125C116 128.866 119.134 132 123 132V132C126.866 132 130 128.866 130 125V124" stroke="#00AE99" stroke-width="3"/>
+<circle cx="34" cy="116" r="32" stroke="#00AE99" stroke-width="3"/>
+<path d="M33.5556 142L7 113.1M33.5556 142L61 113.1M33.5556 142L22 113.1M33.5556 142L46.4444 113.1M7 113.1L16.8889 98H33.5556M7 113.1H22M61 113.1L51.1111 98H33.5556M61 113.1H46.4444M22 113.1H46.4444M22 113.1L33.5556 98M46.4444 113.1L33.5556 98" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/generateRevenueForYourBusiness-large.svg b/packages/website/ts/icons/illustrations/generateRevenueForYourBusiness-large.svg
new file mode 100755
index 000000000..681b8c41e
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/generateRevenueForYourBusiness-large.svg
@@ -0,0 +1,28 @@
+<svg width="250" height="250" viewBox="0 0 250 250" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M177.423 216C176.501 218.606 176 221.411 176 224.333C176 227.953 176.769 231.394 178.154 234.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M177.423 199.333C176.501 201.94 176 204.745 176 207.667C176 216.712 180.804 224.636 188 229.025" stroke="#00AE99" stroke-width="3"/>
+<path d="M224.577 182.667C225.499 185.273 226 188.078 226 191C226 191.504 225.985 192.004 225.956 192.5M177.423 182.667C176.501 185.273 176 188.078 176 191C176 204.807 187.193 216 201 216C202.712 216 204.384 215.828 206 215.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M224.577 166C225.499 168.606 226 171.411 226 174.333C226 188.14 214.807 199.333 201 199.333C187.193 199.333 176 188.14 176 174.333C176 171.411 176.501 168.606 177.423 166" stroke="#00AE99" stroke-width="3"/>
+<path d="M224.577 149.333C225.499 151.94 226 154.745 226 157.667C226 171.474 214.807 182.667 201 182.667C187.193 182.667 176 171.474 176 157.667C176 154.745 176.501 151.94 177.423 149.333" stroke="#00AE99" stroke-width="3"/>
+<path d="M224.577 132.667C225.499 135.273 226 138.078 226 141C226 154.807 214.807 166 201 166C187.193 166 176 154.807 176 141C176 138.078 176.501 135.273 177.423 132.667" stroke="#00AE99" stroke-width="3"/>
+<path d="M224.577 116C225.499 118.606 226 121.411 226 124.333C226 138.14 214.807 149.333 201 149.333C187.193 149.333 176 138.14 176 124.333C176 121.411 176.501 118.606 177.423 116" stroke="#00AE99" stroke-width="3"/>
+<path d="M224.577 99.3333C225.499 101.94 226 104.745 226 107.667C226 121.474 214.807 132.667 201 132.667C187.193 132.667 176 121.474 176 107.667C176 104.745 176.501 101.94 177.423 99.3333" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="201" cy="91" rx="25" ry="25" stroke="#00AE99" stroke-width="3"/>
+<path d="M193.5 101V102.5H195H207H208.5V101V97.2266V95.7266H207H204.551V80V78.5H203.051H199.253H198.762L198.366 78.7901L194.113 81.9073L193.5 82.3568V83.1172V87.6563V90.6153L195.887 88.8661L197.753 87.4982V95.7266H195H193.5V97.2266V101Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M148.577 216.667C149.499 219.273 150 222.078 150 225C150 233.805 145.449 241.546 138.57 246M101.423 216.667C100.501 219.273 100 222.078 100 225C100 233.805 104.551 241.546 111.43 246" stroke="#00AE99" stroke-width="3"/>
+<path d="M148.577 234.667C149.499 237.273 150 240.078 150 243C150 243.335 149.993 243.668 149.98 244M101.423 234.667C100.501 237.273 100 240.078 100 243C100 243.335 100.007 243.668 100.02 244" stroke="#00AE99" stroke-width="3"/>
+<path d="M148.577 200C149.499 202.606 150 205.411 150 208.333C150 222.14 138.807 233.333 125 233.333C111.193 233.333 100 222.14 100 208.333C100 205.411 100.501 202.606 101.423 200" stroke="#00AE99" stroke-width="3"/>
+<path d="M148.577 183.333C149.499 185.94 150 188.745 150 191.667C150 205.474 138.807 216.667 125 216.667C111.193 216.667 100 205.474 100 191.667C100 188.745 100.501 185.94 101.423 183.333" stroke="#00AE99" stroke-width="3"/>
+<path d="M148.577 166.667C149.499 169.273 150 172.078 150 175C150 188.807 138.807 200 125 200C111.193 200 100 188.807 100 175C100 172.078 100.501 169.273 101.423 166.667" stroke="#00AE99" stroke-width="3"/>
+<path d="M148.577 150C149.499 152.606 150 155.411 150 158.333C150 172.14 138.807 183.333 125 183.333C111.193 183.333 100 172.14 100 158.333C100 155.411 100.501 152.606 101.423 150" stroke="#00AE99" stroke-width="3"/>
+<path d="M148.577 133.333C149.499 135.94 150 138.745 150 141.667C150 155.474 138.807 166.667 125 166.667C111.193 166.667 100 155.474 100 141.667C100 138.745 100.501 135.94 101.423 133.333" stroke="#00AE99" stroke-width="3"/>
+<circle cx="125" cy="125" r="25" stroke="#00AE99" stroke-width="3"/>
+<path d="M117.5 135V136.5H119H131H132.5V135V131.227V129.727H131H128.551V114V112.5H127.051H123.253H122.762L122.366 112.79L118.113 115.907L117.5 116.357V117.117V121.656V124.615L119.887 122.866L121.753 121.498V129.727H119H117.5V131.227V135Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M71.5775 216.333C72.4987 218.94 73 221.745 73 224.667C73 227.966 72.3608 231.116 71.1996 234" stroke="#00AE99" stroke-width="3"/>
+<path d="M71.5774 199.667C72.4987 202.273 73 205.078 73 208C73 216.834 68.4176 224.599 61.5 229.045" stroke="#00AE99" stroke-width="3"/>
+<path d="M23 191.333C23 188.411 23.5013 185.606 24.4225 183M71.5774 183C72.4987 185.606 73 188.411 73 191.333C73 205.14 61.8071 216.333 48 216.333C46.8122 216.333 45.6437 216.25 44.5 216.09" stroke="#00AE99" stroke-width="3"/>
+<path d="M71.5774 166.333C72.4987 168.94 73 171.745 73 174.667C73 188.474 61.8071 199.667 48 199.667C34.1929 199.667 23 188.474 23 174.667C23 171.745 23.5013 168.94 24.4225 166.333" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="48" cy="158" rx="25" ry="25" stroke="#00AE99" stroke-width="3"/>
+<path d="M40.5 168V169.5H42H54H55.5V168V164.227V162.727H54H51.5506V147V145.5H50.0506H46.2532H45.7623L45.3665 145.79L41.1133 148.907L40.5 149.357V150.117V154.656V157.615L42.8867 155.866L44.7532 154.498V162.727H42H40.5V164.227V168Z" stroke="#00AE99" stroke-width="3"/>
+<circle cx="125" cy="125" r="121.667" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/getInTouch.svg b/packages/website/ts/icons/illustrations/getInTouch.svg
new file mode 100755
index 000000000..f44365351
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/getInTouch.svg
@@ -0,0 +1,13 @@
+<svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="75" cy="75" r="73" stroke="#00AE99" stroke-width="3"/>
+<path d="M113 75C113 85.3064 108.897 94.6546 102.235 101.5C98.4048 105.436 71 132.5 71 132.5V112.792C51.8933 110.793 37 94.6359 37 75C37 54.0132 54.0132 37 75 37C95.9868 37 113 54.0132 113 75Z" stroke="#00AE99" stroke-width="3"/>
+<circle cx="75" cy="75" r="4" stroke="#00AE99" stroke-width="3"/>
+<circle cx="91" cy="75" r="4" stroke="#00AE99" stroke-width="3"/>
+<circle cx="59" cy="75" r="4" stroke="#00AE99" stroke-width="3"/>
+<path d="M76 37H137.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M37 73.5L37 12M113 137.5L113 75" stroke="#00AE99" stroke-width="3"/>
+<path d="M13 113H71.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M49.087 47.5264L92.574 4.03932" stroke="#00AE99" stroke-width="3"/>
+<path d="M47.3192 100.913L3.8321 57.4259M146.314 92.4277L102.12 48.2335" stroke="#00AE99" stroke-width="3"/>
+<path d="M58.2793 145.814L101.766 102.327" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/getStarted.svg b/packages/website/ts/icons/illustrations/getStarted.svg
new file mode 100644
index 000000000..627e1810b
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/getStarted.svg
@@ -0,0 +1,13 @@
+<svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g>
+<circle cx="75" cy="75" r="73" stroke="#00AE99" stroke-width="3"/>
+<circle cx="75" cy="75" r="58" stroke="#00AE99" stroke-width="3"/>
+<path d="M62.9792 62.9792L36.6447 113.355L87.0208 87.0208M62.9792 62.9792L113.355 36.6447L87.0208 87.0208M62.9792 62.9792L87.0208 87.0208" stroke="#00AE99" stroke-width="3"/>
+<path d="M75 2V17M75 133V148" stroke="#00AE99" stroke-width="3"/>
+<path d="M2 75L17 75M133 75L148 75" stroke="#00AE99" stroke-width="3"/>
+<path d="M11.7801 38.5L24.7705 46M125.229 104L138.22 111.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M38.5001 11.7801L46.0001 24.7705M104 125.229L111.5 138.22" stroke="#00AE99" stroke-width="3"/>
+<path d="M111.5 11.7801L104 24.7705M46 125.229L38.5 138.22" stroke="#00AE99" stroke-width="3"/>
+<path d="M138.22 38.5L125.229 46M24.7705 104L11.7801 111.5" stroke="#00AE99" stroke-width="3"/>
+</g>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/launchKit.svg b/packages/website/ts/icons/illustrations/launchKit.svg
new file mode 100644
index 000000000..fa11584af
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/launchKit.svg
@@ -0,0 +1,18 @@
+<svg width="404" height="404" viewBox="0 0 404 404" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="202" cy="202" r="200" stroke="#00AE99" stroke-width="3"/>
+<rect x="61" y="251" width="39" height="92" rx="19.5" stroke="#00AE99" stroke-width="3"/>
+<rect x="100" y="251" width="39" height="92" rx="19.5" stroke="#00AE99" stroke-width="3"/>
+<rect x="139" y="251" width="39" height="92" rx="19.5" stroke="#00AE99" stroke-width="3"/>
+<rect x="61" y="251" width="39" height="39" rx="19.5" stroke="#00AE99" stroke-width="3"/>
+<rect x="100" y="251" width="39" height="39" rx="19.5" stroke="#00AE99" stroke-width="3"/>
+<rect x="139" y="304" width="39" height="39" rx="19.5" stroke="#00AE99" stroke-width="3"/>
+<rect x="178" y="304" width="39" height="39" rx="19.5" stroke="#00AE99" stroke-width="3"/>
+<rect x="178" y="251" width="39" height="92" rx="19.5" stroke="#00AE99" stroke-width="3"/>
+<circle cx="100" cy="212" r="39" stroke="#00AE99" stroke-width="3"/>
+<circle cx="178" cy="212" r="39" stroke="#00AE99" stroke-width="3"/>
+<rect x="61" y="79" width="156" height="94" stroke="#00AE99" stroke-width="3"/>
+<rect width="39" height="18" transform="matrix(1 0 0 -1 84 79)" stroke="#00AE99" stroke-width="3"/>
+<rect width="39" height="18" transform="matrix(1 0 0 -1 155 79)" stroke="#00AE99" stroke-width="3"/>
+<path d="M217 94V61H250M217 94L250 61M217 94H250V61M217 94V241.125M250 61H333M333 61H343V251H217V241.125M333 61V241.125H217" stroke="#00AE99" stroke-width="3"/>
+<path d="M275.825 252L218 343H341L275.825 252Z" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/launchKit_versionB.svg b/packages/website/ts/icons/illustrations/launchKit_versionB.svg
new file mode 100755
index 000000000..45f9ecc75
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/launchKit_versionB.svg
@@ -0,0 +1,7 @@
+<svg width="404" height="404" viewBox="0 0 404 404" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="202" cy="202" r="200" stroke="#00AE99" stroke-width="3"/>
+<path d="M111.093 201.667L201.622 292.195M111.093 201.667L24.7433 115.316L115.098 24.6137L188.958 98.4738M111.093 201.667L24.7432 288.017L114.053 379.764L201.622 292.195M111.093 201.667L167.107 145.653M292.151 201.667L201.622 292.195M292.151 201.667L379.546 289.062L289.191 379.764L201.622 292.195M292.151 201.667L380.59 113.227L290.236 22.5243L214.983 97.7774M292.151 201.667L236.137 145.653M201.622 292.195L201.622 400.137M201.622 400.137L254.81 346.95M201.622 400.137L148.435 346.95" stroke="#00AE99" stroke-width="3"/>
+<path d="M202 85L262 145H142L202 85Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M202 146L262 205H142L202 146Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M245 249L202 206L159 249" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/legalResources.svg b/packages/website/ts/icons/illustrations/legalResources.svg
new file mode 100755
index 000000000..a8ba7fceb
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/legalResources.svg
@@ -0,0 +1,4 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M2.00001 45C2.00001 68.7578 21.2421 88 45 88C68.7579 88 88 68.7578 88 45C88 21.6448 69.3906 2.63278 46.1793 2.02876C45.7478 2.02876 45.3452 2 44.9137 2C21.2134 2.02876 2.00001 21.2709 2.00001 45Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M45 76V11M45 76H15H75H45ZM45 11H24M45 11H66M24 11L4 47M24 11L44 47M66 11L46 47M66 11L86 47M4 47H44M4 47C4 47 4 65 24 65C44 65 44 47 44 47M46 47H86M46 47C46 47 46 65 66 65C85.25 65 86 47 86 47" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/logo-mark.svg b/packages/website/ts/icons/illustrations/logo-mark.svg
new file mode 100644
index 000000000..4e9c9d2cb
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/logo-mark.svg
@@ -0,0 +1,6 @@
+<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M6.30134 18.9605L8.63004 16.5511L5.73498 12.6444L2.04888 7.4287C0.746637 9.65112 0 12.2381 0 15C0 19.5753 2.04888 23.6718 5.28027 26.4229L9.95919 23.1161C8.36771 22.1247 7.08565 20.6812 6.30134 18.9605Z" fill="white"/>
+<path d="M11.0395 6.30134L13.4489 8.63004L17.3556 5.73498L22.5713 2.04888C20.3489 0.746637 17.7619 0 15 0C10.4247 0 6.32825 2.04888 3.57713 5.28027L6.88386 9.95919C7.87534 8.36771 9.31883 7.08565 11.0395 6.30134Z" fill="white"/>
+<path d="M21.37 13.4489L24.265 17.3556L27.9511 22.5713C29.2534 20.3489 30 17.7619 30 15C30 10.4247 27.9511 6.32825 24.7197 3.57713L20.0408 6.88386C21.6323 7.87534 22.9144 9.31883 23.6987 11.0395L21.37 13.4489Z" fill="white"/>
+<path d="M26.4229 24.7197L23.1161 20.0408C22.1247 21.6323 20.6812 22.9144 18.9605 23.6987L16.5511 21.37L12.6444 24.265L7.4287 27.9511C9.65112 29.2534 12.2381 30 15 30C19.5753 30 23.6718 27.9511 26.4229 24.7197Z" fill="white"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/logo-outlined.svg b/packages/website/ts/icons/illustrations/logo-outlined.svg
new file mode 100644
index 000000000..a09d2355f
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/logo-outlined.svg
@@ -0,0 +1,14 @@
+<svg width="400" height="406" viewBox="0 0 400 406" fill="none" xmlns="http://www.w3.org/2000/svg">
+<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="400" height="406">
+<ellipse cx="200" cy="202.967" rx="200" ry="202.744" fill="#C4C4C4"/>
+</mask>
+<g mask="url(#mask0)">
+<path d="M162.629 260.116L161.587 258.71L159.447 260.297L161.753 261.631L162.629 260.116ZM193.062 269.329L192.945 271.075L192.953 271.076L193.062 269.329ZM234.92 258.634L235.854 260.113L235.86 260.109L234.92 258.634ZM250.83 244.761L252.163 245.895L253.051 244.85L252.25 243.738L250.83 244.761ZM238.764 228.665L240.146 227.592L240.141 227.585L240.135 227.578L238.764 228.665ZM235.24 224.217L236.612 223.13L235.079 221.196L233.761 223.282L235.24 224.217ZM216.446 240.631L215.231 241.89L216.098 242.727L217.189 242.216L216.446 240.631ZM204.487 229.088L205.702 227.829L204.636 226.8L203.445 227.682L204.487 229.088ZM137.215 166.291L138.602 165.224L137.006 163.149L135.699 165.418L137.215 166.291ZM128.139 196.154L126.393 196.035L126.392 196.044L128.139 196.154ZM138.924 237.666L137.455 238.618H137.455L138.924 237.666ZM152.912 253.445L151.79 254.787L152.824 255.652L153.924 254.873L152.912 253.445ZM169.143 241.478L170.204 242.87L170.211 242.864L170.218 242.859L169.143 241.478ZM173.628 237.984L174.703 239.364L176.66 237.839L174.567 236.507L173.628 237.984ZM157.077 219.24L155.833 218.008L154.968 218.882L155.497 219.992L157.077 219.24ZM168.822 207.379L170.066 208.611L171.142 207.524L170.209 206.312L168.822 207.379ZM232.57 140.982L233.582 142.41L235.808 140.833L233.447 139.467L232.57 140.982ZM202.138 131.769L202.018 133.515L202.021 133.515L202.138 131.769ZM160.173 142.464L161.114 143.94L161.117 143.938L160.173 142.464ZM144.263 156.337L142.93 155.203L142.042 156.248L142.843 157.36L144.263 156.337ZM156.329 172.433L154.946 173.506L154.952 173.513L154.957 173.52L156.329 172.433ZM159.853 176.881L158.481 177.968L159.996 179.88L161.322 177.832L159.853 176.881ZM178.753 160.467L179.961 159.201L179.1 158.379L178.019 158.878L178.753 160.467ZM189.965 171.163L188.757 172.429L189.8 173.424L190.976 172.591L189.965 171.163ZM258.091 234.489L256.699 235.55L258.301 237.651L259.611 235.357L258.091 234.489ZM267.06 204.944L268.806 205.065L268.807 205.054L267.06 204.944ZM256.276 163.432L257.748 162.486L257.744 162.48L256.276 163.432ZM242.287 147.653L243.41 146.311L242.376 145.446L241.276 146.225L242.287 147.653ZM226.057 159.62L224.995 158.228L224.988 158.234L224.981 158.239L226.057 159.62ZM221.572 163.114L220.496 161.734L218.526 163.27L220.642 164.597L221.572 163.114ZM238.23 181.858L236.65 182.61L236.658 182.628L236.667 182.646L238.23 181.858ZM238.336 182.07L239.592 183.289L240.46 182.395L239.899 181.282L238.336 182.07ZM227.018 193.719L225.763 192.499L224.712 193.58L225.626 194.779L227.018 193.719ZM161.753 261.631C170.951 266.952 181.568 270.316 192.945 271.075L193.178 267.583C182.345 266.86 172.246 263.658 163.505 258.601L161.753 261.631ZM192.953 271.076C208.709 272.053 223.488 267.928 235.854 260.113L233.985 257.154C222.219 264.589 208.167 268.512 193.17 267.583L192.953 271.076ZM235.86 260.109C241.988 256.203 247.459 251.428 252.163 245.895L249.497 243.628C245.018 248.896 239.811 253.44 233.979 257.158L235.86 260.109ZM252.25 243.738C248.498 238.53 244.428 233.112 240.146 227.592L237.381 229.737C241.642 235.231 245.687 240.615 249.41 245.784L252.25 243.738ZM240.135 227.578C239.548 226.837 238.961 226.095 238.373 225.354C237.786 224.613 237.199 223.872 236.612 223.13L233.868 225.304C234.455 226.045 235.043 226.786 235.63 227.528C236.217 228.269 236.805 229.01 237.392 229.751L240.135 227.578ZM233.761 223.282C229.462 230.082 223.103 235.581 215.704 239.046L217.189 242.216C225.166 238.48 232.048 232.542 236.719 225.152L233.761 223.282ZM217.662 239.372L205.702 227.829L203.272 230.347L215.231 241.89L217.662 239.372ZM203.445 227.682L161.587 258.71L163.671 261.522L205.529 230.494L203.445 227.682ZM135.699 165.418C130.444 174.538 127.159 184.855 126.393 196.035L129.885 196.274C130.614 185.639 133.736 175.836 138.732 167.165L135.699 165.418ZM126.392 196.044C125.407 211.676 129.568 226.449 137.455 238.618L140.392 236.714C132.904 225.162 128.949 211.131 129.886 196.264L126.392 196.044ZM137.455 238.618C141.395 244.696 146.211 250.122 151.79 254.787L154.035 252.102C148.722 247.66 144.14 242.496 140.392 236.714L137.455 238.618ZM153.924 254.873C159.176 251.152 164.638 247.116 170.204 242.87L168.081 240.087C162.542 244.313 157.113 248.324 151.901 252.017L153.924 254.873ZM170.218 242.859C171.713 241.694 173.208 240.529 174.703 239.364L172.552 236.603C171.057 237.768 169.562 238.933 168.067 240.098L170.218 242.859ZM174.567 236.507C167.693 232.132 162.147 225.819 158.657 218.488L155.497 219.992C159.267 227.91 165.253 234.728 172.688 239.46L174.567 236.507ZM158.32 220.471L170.066 208.611L167.579 206.148L155.833 218.008L158.32 220.471ZM170.209 206.312L138.602 165.224L135.828 167.358L167.435 208.446L170.209 206.312ZM233.447 139.467C224.248 134.146 213.631 130.782 202.254 130.023L202.021 133.515C212.855 134.238 222.953 137.44 231.694 142.497L233.447 139.467ZM202.258 130.023C186.496 128.937 171.602 133.064 159.229 140.991L161.117 143.938C172.876 136.404 187.027 132.482 202.018 133.515L202.258 130.023ZM159.232 140.989C153.105 144.895 147.634 149.67 142.93 155.203L145.596 157.47C150.075 152.202 155.282 147.658 161.114 143.94L159.232 140.989ZM142.843 157.36C146.594 162.568 150.665 167.986 154.946 173.506L157.712 171.361C153.451 165.867 149.406 160.483 145.683 155.314L142.843 157.36ZM154.957 173.52C155.545 174.261 156.132 175.003 156.719 175.744C157.307 176.485 157.894 177.226 158.481 177.968L161.225 175.794C160.637 175.053 160.05 174.312 159.463 173.57C158.875 172.829 158.288 172.088 157.701 171.347L154.957 173.52ZM161.322 177.832C165.736 171.011 171.997 165.515 179.487 162.056L178.019 158.878C169.919 162.619 163.152 168.561 158.384 175.93L161.322 177.832ZM177.545 161.733L188.757 172.429L191.173 169.896L179.961 159.201L177.545 161.733ZM190.976 172.591L233.582 142.41L231.559 139.554L188.953 169.735L190.976 172.591ZM259.611 235.357C264.754 226.349 268.04 216.141 268.806 205.065L265.315 204.823C264.586 215.35 261.465 225.05 256.571 233.621L259.611 235.357ZM268.807 205.054C269.792 189.418 265.63 174.754 257.748 162.486L254.803 164.378C262.298 176.043 266.251 189.971 265.314 204.834L268.807 205.054ZM257.744 162.48C253.804 156.402 248.989 150.976 243.41 146.311L241.165 148.996C246.478 153.438 251.059 158.602 254.807 164.384L257.744 162.48ZM241.276 146.225C236.024 149.946 230.561 153.982 224.995 158.228L227.118 161.011C232.657 156.785 238.086 152.774 243.299 149.081L241.276 146.225ZM224.981 158.239C224.234 158.822 223.486 159.404 222.739 159.987C221.991 160.569 221.244 161.151 220.496 161.734L222.648 164.495C223.395 163.912 224.143 163.33 224.89 162.747C225.637 162.165 226.385 161.583 227.132 161L224.981 158.239ZM220.642 164.597C227.616 168.971 233.159 175.281 236.65 182.61L239.81 181.106C236.039 173.186 230.05 166.365 222.502 161.632L220.642 164.597ZM236.667 182.646L236.774 182.858L239.899 181.282L239.792 181.07L236.667 182.646ZM237.081 180.85L225.763 192.499L228.273 194.938L239.592 183.289L237.081 180.85ZM225.626 194.779L256.699 235.55L259.483 233.428L228.41 192.658L225.626 194.779Z" fill="#00AE99"/>
+<ellipse cx="60.0003" cy="200.535" rx="68" ry="68.9328" stroke="#00AE99" stroke-width="3.5"/>
+<ellipse cx="201.6" cy="61.8583" rx="68.8" ry="69.7438" stroke="#00AE99" stroke-width="3.5"/>
+<rect x="267.2" y="133.224" width="137.6" height="137.866" stroke="#00AE99" stroke-width="3.5"/>
+<rect width="99.6242" height="99.6242" transform="matrix(0.702274 -0.711907 0.702274 0.711907 271.273 342.124)" stroke="#00AE99" stroke-width="3.5"/>
+<path d="M267.2 340.833C267.2 301.418 235.248 269.467 195.834 269.467H-11.2003V412.198H195.834C235.248 412.198 267.2 380.247 267.2 340.833V340.833Z" stroke="#00AE99" stroke-width="3.5"/>
+</g>
+<path d="M398.25 202.967C398.25 313.996 309.468 403.961 200 403.961C90.532 403.961 1.75 313.996 1.75 202.967C1.75 91.939 90.532 1.97368 200 1.97368C309.468 1.97368 398.25 91.939 398.25 202.967Z" stroke="#00AE99" stroke-width="3.5"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/long-term-impact.svg b/packages/website/ts/icons/illustrations/long-term-impact.svg
new file mode 100644
index 000000000..dbd051598
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/long-term-impact.svg
@@ -0,0 +1,9 @@
+<svg width="104" height="104" viewBox="0 0 104 104" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M52 102C79.6142 102 102 79.6142 102 52C102 24.3858 79.6142 2 52 2C24.3858 2 2 24.3858 2 52C2 79.6142 24.3858 102 52 102Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M51.8639 91.7959C73.9553 91.7959 91.8639 73.8873 91.8639 51.7959C91.8639 29.7045 73.9553 11.7959 51.8639 11.7959C29.7726 11.7959 11.864 29.7045 11.864 51.7959C11.864 73.8873 29.7726 91.7959 51.8639 91.7959Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M51.8636 91.7959C65.0741 91.7959 75.7833 73.8873 75.7833 51.7959C75.7833 29.7045 65.0741 11.7959 51.8636 11.7959C38.6531 11.7959 27.9438 29.7045 27.9438 51.7959C27.9438 73.8873 38.6531 91.7959 51.8636 91.7959Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M51.864 11.7959V91.7959" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M91.8639 51.796H11.864" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M86.6201 71.7827H17.1084" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M86.6201 31.7823H17.1084" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+</svg> \ No newline at end of file
diff --git a/packages/website/ts/icons/illustrations/low-cost.svg b/packages/website/ts/icons/illustrations/low-cost.svg
new file mode 100644
index 000000000..530cbdd79
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/low-cost.svg
@@ -0,0 +1,30 @@
+<svg width="82" height="82" viewBox="0 0 82 82" fill="none" xmlns="http://www.w3.org/2000/svg">
+<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="82" height="82">
+<path d="M41 79.9333C62.5023 79.9333 79.9333 62.5023 79.9333 41C79.9333 19.4977 62.5023 2.06665 41 2.06665C19.4977 2.06665 2.06665 19.4977 2.06665 41C2.06665 62.5023 19.4977 79.9333 41 79.9333Z" fill="#00AE99" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</mask>
+<g mask="url(#mask0)">
+<ellipse cx="41" cy="76" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="41" cy="71" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="41" cy="66" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="41" cy="61" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="41" cy="56" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<circle cx="41" cy="50" r="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<circle cx="41" cy="44" r="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="18" cy="89" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="18" cy="84" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="18" cy="79" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="18" cy="74" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="18" cy="69" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<circle cx="18" cy="63" r="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<circle cx="18" cy="57" r="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="64" cy="70" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="64" cy="64" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="64" cy="59" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="64" cy="54" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="64" cy="49" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="64" cy="44" rx="8" ry="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<circle cx="64" cy="38" r="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<circle cx="64" cy="32" r="8" fill="#F3F6F4" stroke="#00AE99" stroke-width="3"/>
+<circle cx="41" cy="41" r="38.9333" stroke="#00AE99" stroke-width="3"/>
+</g>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/marketingDesignHelp.svg b/packages/website/ts/icons/illustrations/marketingDesignHelp.svg
new file mode 100755
index 000000000..1e65bd54f
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/marketingDesignHelp.svg
@@ -0,0 +1,11 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M45 88C68.7482 88 88 68.7482 88 45C88 21.2518 68.7482 2 45 2C21.2518 2 2 21.2518 2 45C2 68.7482 21.2518 88 45 88Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M70.2962 31.8956L57.4583 19.3541L44.833 32.1066L57.6708 44.6481L70.2962 31.8956Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M74.8267 14.5717L57.4829 19.3431L70.311 31.8859L74.8267 14.5717Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M32.184 19.5506L19.5587 32.3031L32.3965 44.8446L45.0218 32.092L32.184 19.5506Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M14.7418 15.0572L19.5451 32.2858L32.1719 19.5429L14.7418 15.0572Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M19.698 57.5441L32.5358 70.0856L45.1612 57.3331L32.3234 44.7916L19.698 57.5441Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M15.1732 74.8574L32.517 70.086L19.6889 57.5432L15.1732 74.8574Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M57.8243 69.8803L70.4497 57.1277L57.6119 44.5863L44.9865 57.3388L57.8243 69.8803Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+<path d="M75.2581 74.3715L70.4548 57.1429L57.828 69.8857L75.2581 74.3715Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="bevel"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/milestoneGrants.svg b/packages/website/ts/icons/illustrations/milestoneGrants.svg
new file mode 100755
index 000000000..2c581864f
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/milestoneGrants.svg
@@ -0,0 +1,7 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M2 45C2 68.7578 21.2421 88 45 88C68.7579 88 88 68.7578 88 45C88 21.6448 69.3906 2.63278 46.1793 2.02876C45.7478 2.02876 45.3452 2 44.9137 2C21.2134 2.02876 2 21.2709 2 45Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M86.5 55.5L45 14L3.5 55.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M45 14C41.1667 18.8333 35.8 30.8 45 40C56.5 51.5 52 59.5 45 67C38.5223 73.9404 40.1798 83.4498 44.0292 88" stroke="#00AE99" stroke-width="3"/>
+<path d="M78 73L45 40L12 73" stroke="#00AE99" stroke-width="3"/>
+<path d="M62.5 84.5L45 67L27.5 84.5" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/networkedLiquidity-small.svg b/packages/website/ts/icons/illustrations/networkedLiquidity-small.svg
new file mode 100755
index 000000000..4b65a5353
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/networkedLiquidity-small.svg
@@ -0,0 +1,20 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M39 8.48029C33.2192 9.42014 27.8875 11.702 23.335 14.9961M50.9349 8.48029C56.7423 9.41185 62.0964 11.6963 66.6651 15M75 23.3344C78.2924 27.8864 80.574 33.2182 81.5163 39M81.5163 51.0017C80.574 56.7845 78.2925 62.1161 75 66.6678M66.6651 75.002C62.0964 78.306 56.7423 80.5917 50.9349 81.5271M39 81.5165C33.2177 80.5746 27.8865 78.2936 23.335 75.002M15 66.6678C11.7076 62.1161 9.42602 56.7845 8.48376 51.0017M8.48376 39.0004C9.42608 33.2186 11.7078 27.8868 14.9996 23.3344" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M42.163 47.837C40.6123 46.2863 40.6123 43.7489 42.163 42.163C43.7137 40.6123 46.2511 40.6123 47.837 42.163C49.3877 43.7137 49.3877 46.2511 47.837 47.837C46.2511 49.3877 43.7137 49.3877 42.163 47.837Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M42.163 30.837C40.6123 29.2863 40.6123 26.7489 42.163 25.163C43.7137 23.6123 46.2511 23.6123 47.837 25.163C49.3877 26.7137 49.3877 29.2511 47.837 30.837C46.2511 32.3877 43.7137 32.3877 42.163 30.837Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M42.163 64.837C40.6123 63.2863 40.6123 60.7489 42.163 59.163C43.7137 57.6123 46.2511 57.6123 47.837 59.163C49.3877 60.7137 49.3877 63.2511 47.837 64.837C46.2511 66.3877 43.7137 66.3877 42.163 64.837Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M40.7445 12.2555C38.4185 9.92952 38.4185 6.12335 40.7445 3.74449C43.0705 1.4185 46.8766 1.4185 49.2555 3.74449C51.5815 6.07048 51.5815 9.87665 49.2555 12.2555C46.8766 14.5815 43.0705 14.5815 40.7445 12.2555Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M40.7445 86.2555C38.4185 83.9295 38.4185 80.1233 40.7445 77.7445C43.0705 75.4185 46.8766 75.4185 49.2555 77.7445C51.5815 80.0705 51.5815 83.8767 49.2555 86.2555C46.8766 88.5815 43.0705 88.5815 40.7445 86.2555Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M30.837 47.837C29.2863 49.3877 26.7489 49.3877 25.163 47.837C23.6123 46.2863 23.6123 43.7489 25.163 42.163C26.7137 40.6123 29.2511 40.6123 30.837 42.163C32.3877 43.7489 32.3877 46.2863 30.837 47.837Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M64.837 47.837C63.2863 49.3877 60.7489 49.3877 59.163 47.837C57.6123 46.2863 57.6123 43.7489 59.163 42.163C60.7137 40.6123 63.2511 40.6123 64.837 42.163C66.3877 43.7489 66.3877 46.2863 64.837 47.837Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M12.2555 49.2555C9.92952 51.5815 6.12335 51.5815 3.74449 49.2555C1.4185 46.9295 1.4185 43.1234 3.74449 40.7445C6.07048 38.4185 9.87665 38.4185 12.2555 40.7445C14.5815 43.1233 14.5815 46.9295 12.2555 49.2555Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M86.2555 49.2555C83.9295 51.5815 80.1233 51.5815 77.7445 49.2555C75.4185 46.9295 75.4185 43.1234 77.7445 40.7445C80.0705 38.4185 83.8767 38.4185 86.2555 40.7445C88.5815 43.1233 88.5815 46.9295 86.2555 49.2555Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M32.9792 36.9913C30.7863 36.9913 28.992 35.1971 28.9671 32.9792C28.9671 30.7862 30.7614 28.992 32.9792 28.9671C35.1722 28.9671 36.9665 30.7613 36.9914 32.9792C36.9665 35.1971 35.1722 36.9913 32.9792 36.9913Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M57.0209 61.0329C54.8279 61.0329 53.0337 59.2387 53.0087 57.0208C53.0087 54.8278 54.803 53.0336 57.0209 53.0087C59.2138 53.0087 61.0081 54.8029 61.033 57.0208C61.0081 59.2387 59.2138 61.0329 57.0209 61.0329Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M18.8371 24.8552C15.5476 24.8552 12.8563 22.1639 12.8189 18.837C12.8189 15.5476 15.5103 12.8562 18.8371 12.8188C22.1265 12.8188 24.8179 15.5102 24.8553 18.837C24.8179 22.1639 22.1265 24.8552 18.8371 24.8552Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M71.163 77.1812C67.8736 77.1812 65.1822 74.4898 65.1448 71.163C65.1448 67.8735 67.8362 65.1822 71.163 65.1448C74.4525 65.1448 77.1438 67.8361 77.1812 71.163C77.1438 74.4898 74.4525 77.1812 71.163 77.1812Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M36.9913 57.0209C36.9913 59.2138 35.197 61.0081 32.9791 61.033C30.7862 61.033 28.9919 59.2388 28.967 57.0209C28.967 54.8279 30.7612 53.0337 32.9791 53.0088C35.197 53.0337 36.9913 54.8279 36.9913 57.0209Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M61.0329 32.9793C61.0329 35.1722 59.2386 36.9665 57.0208 36.9914C54.8278 36.9914 53.0335 35.1971 53.0086 32.9793C53.0086 30.7863 54.8029 28.992 57.0208 28.9671C59.2386 28.992 61.0329 30.7863 61.0329 32.9793Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M24.8552 71.163C24.8552 74.4525 22.1639 77.1438 18.837 77.1812C15.5476 77.1812 12.8562 74.4899 12.8188 71.163C12.8188 67.8736 15.5102 65.1822 18.837 65.1448C22.1639 65.1822 24.8552 67.8736 24.8552 71.163Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M77.1812 18.8371C77.1812 22.1266 74.4898 24.8179 71.163 24.8553C67.8735 24.8553 65.1822 22.1639 65.1448 18.8371C65.1448 15.5477 67.8361 12.8563 71.163 12.8189C74.4898 12.8563 77.1812 15.5477 77.1812 18.8371Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/networkedLiquidity.svg b/packages/website/ts/icons/illustrations/networkedLiquidity.svg
new file mode 100755
index 000000000..c50ba7e7c
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/networkedLiquidity.svg
@@ -0,0 +1,28 @@
+<svg width="151" height="150" viewBox="0 0 151 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M138.211 65C136.62 55.0255 132.688 45.8318 126.996 38M138.211 85C136.62 94.9746 132.688 104.168 126.996 112M112.994 126C105.164 131.69 95.972 135.62 86 137.211M66 137.211C56.0279 135.62 46.8364 131.69 39.0059 126M25.0043 112C19.3121 104.168 15.3801 94.9746 13.7892 85M13.7892 65C15.3801 55.0255 19.3121 45.8318 25.0043 38M39.0059 24C46.8364 18.3101 56.0279 14.3797 66 12.7893M86 12.7893C95.9721 14.3797 105.164 18.3101 112.994 24" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M75.9998 21.882C81.4901 21.882 85.9408 17.4313 85.9408 11.941C85.9408 6.45074 81.4901 2 75.9998 2C70.5096 2 66.0588 6.45074 66.0588 11.941C66.0588 17.4313 70.5096 21.882 75.9998 21.882Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M75.9998 148C81.4901 148 85.9408 143.549 85.9408 138.059C85.9408 132.569 81.4901 128.118 75.9998 128.118C70.5096 128.118 66.0588 132.569 66.0588 138.059C66.0588 143.549 70.5096 148 75.9998 148Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M129.118 75.0001C129.118 80.4903 133.569 84.9411 139.059 84.9411C144.549 84.9411 149 80.4903 149 75.0001C149 69.5098 144.549 65.0591 139.059 65.0591C133.569 65.0591 129.118 69.5098 129.118 75.0001Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M2.99982 75.0001C2.99982 80.4903 7.45056 84.9411 12.9408 84.9411C18.4311 84.9411 22.8818 80.4903 22.8818 75.0001C22.8818 69.5098 18.4311 65.0591 12.9408 65.0591C7.45056 65.0591 2.99982 69.5098 2.99982 75.0001Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M113.56 37.4399C117.442 41.3221 123.737 41.3221 127.619 37.4399C131.501 33.5577 131.501 27.2634 127.619 23.3812C123.737 19.499 117.442 19.499 113.56 23.3812C109.678 27.2634 109.678 33.5577 113.56 37.4399Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M24.381 126.619C28.2632 130.501 34.5575 130.501 38.4397 126.619C42.322 122.737 42.322 116.442 38.4398 112.56C34.5576 108.678 28.2632 108.678 24.381 112.56C20.4988 116.442 20.4988 122.737 24.381 126.619Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M38.4397 37.4399C42.3219 33.5577 42.3219 27.2634 38.4397 23.3812C34.5575 19.499 28.2632 19.499 24.381 23.3812C20.4988 27.2634 20.4988 33.5577 24.381 37.4399C28.2632 41.3221 34.5575 41.3221 38.4397 37.4399Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M127.619 126.619C131.501 122.737 131.501 116.442 127.619 112.56C123.736 108.678 117.442 108.678 113.56 112.56C109.678 116.442 109.678 122.737 113.56 126.619C117.442 130.501 123.737 130.501 127.619 126.619Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M71.8365 79.1636C69.5464 76.8735 69.5464 73.1261 71.8365 70.784C74.1265 68.4939 77.8739 68.4939 80.216 70.784C82.5061 73.074 82.5061 76.8214 80.216 79.1636C77.8739 81.4537 74.1265 81.4537 71.8365 79.1636Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M51.7456 79.1636C49.4556 76.8735 49.4556 73.1261 51.7456 70.784C54.0357 68.4939 57.7831 68.4939 60.1252 70.784C62.4153 73.074 62.4153 76.8214 60.1252 79.1636C57.7831 81.4537 54.0878 81.4537 51.7456 79.1636Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M31.7071 79.1636C29.417 76.8735 29.417 73.1261 31.7071 70.784C33.9971 68.4939 37.7445 68.4939 40.0867 70.784C42.3767 73.074 42.3767 76.8214 40.0867 79.1636C37.7445 81.4537 33.9971 81.4537 31.7071 79.1636Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M91.8748 79.1636C89.5847 76.8736 89.5847 73.1262 91.8748 70.784C94.1649 68.4939 97.9123 68.4939 100.254 70.784C102.544 73.0741 102.544 76.8215 100.254 79.1636C97.9123 81.4537 94.1649 81.4537 91.8748 79.1636Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M111.912 79.1636C109.622 76.8736 109.622 73.1262 111.912 70.784C114.202 68.4939 117.95 68.4939 120.292 70.784C122.582 73.0741 122.582 76.8215 120.292 79.1636C117.95 81.4537 114.202 81.4537 111.912 79.1636Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M55.9113 60.7908C55.9113 57.5118 58.5657 54.9094 61.7926 54.9094C65.0716 54.9094 67.6739 57.5638 67.6739 60.7908C67.6739 64.0697 65.0195 66.6721 61.7926 66.6721C58.5657 66.7241 55.9113 64.0697 55.9113 60.7908Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M41.7526 46.6344C41.7526 43.3554 44.407 40.7531 47.6339 40.7531C50.9129 40.7531 53.5152 43.4075 53.5152 46.6344C53.5152 49.9134 50.8608 52.5157 47.6339 52.5157C44.3549 52.5157 41.7526 49.9134 41.7526 46.6344Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M84.2758 89.1566C84.2758 85.8776 86.9302 83.2753 90.1571 83.2753C93.4361 83.2753 96.0384 85.9297 96.0384 89.1566C96.0384 92.4356 93.384 95.0379 90.1571 95.0379C86.8781 95.09 84.2758 92.4356 84.2758 89.1566Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M98.4327 103.365C98.4327 100.086 101.087 97.4841 104.314 97.4841C107.593 97.4841 110.195 100.139 110.195 103.365C110.195 106.644 107.541 109.247 104.314 109.247C101.087 109.247 98.4327 106.592 98.4327 103.365Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M90.1579 54.9094C93.4369 54.9094 96.0392 57.5638 96.0392 60.7907C96.0392 64.0697 93.3848 66.672 90.1579 66.672C86.8789 66.672 84.2766 64.0176 84.2766 60.7907C84.2766 57.5638 86.8789 54.9094 90.1579 54.9094Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M104.366 40.7531C107.645 40.7531 110.248 43.4075 110.248 46.6344C110.248 49.9134 107.593 52.5157 104.366 52.5157C101.087 52.5157 98.4851 49.8613 98.4851 46.6344C98.4331 43.3554 101.087 40.7531 104.366 40.7531Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M61.7933 83.2753C65.0722 83.2753 67.6746 85.9297 67.6746 89.1566C67.6746 92.4356 65.0202 95.0379 61.7933 95.0379C58.5143 95.0379 55.9119 92.3835 55.9119 89.1566C55.9119 85.8776 58.5663 83.2753 61.7933 83.2753Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M47.6344 97.4323C50.9134 97.4323 53.5158 100.087 53.5158 103.314C53.5158 106.593 50.8614 109.195 47.6344 109.195C44.3555 109.195 41.7531 106.541 41.7531 103.314C41.7531 100.087 44.3555 97.4323 47.6344 97.4323Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M71.836 50.7461C74.1261 48.456 77.8735 48.456 80.2156 50.7461C82.5057 53.0362 82.5057 56.7836 80.2156 59.1257C77.9255 61.4158 74.1781 61.4158 71.836 59.1257C69.4939 56.7836 69.4939 53.0882 71.836 50.7461Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M71.836 30.7078C74.1261 28.4177 77.8735 28.4177 80.2156 30.7078C82.5057 32.9979 82.5057 36.7453 80.2156 39.0874C77.9255 41.3775 74.1781 41.3775 71.836 39.0874C69.4939 36.7453 69.4939 32.9979 71.836 30.7078Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M71.836 90.8745C74.1261 88.5844 77.8735 88.5844 80.2156 90.8745C82.5057 93.1646 82.5057 96.912 80.2156 99.2541C77.9255 101.544 74.1781 101.544 71.836 99.2541C69.4939 96.912 69.4939 93.1646 71.836 90.8745Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M71.836 110.913C74.1261 108.622 77.8735 108.622 80.2156 110.913C82.5057 113.203 82.5057 116.95 80.2156 119.292C77.9255 121.582 74.1781 121.582 71.836 119.292C69.4939 116.95 69.4939 113.203 71.836 110.913Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/orderBooks.svg b/packages/website/ts/icons/illustrations/orderBooks.svg
new file mode 100755
index 000000000..44e001ff0
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/orderBooks.svg
@@ -0,0 +1,8 @@
+<svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="75" cy="75" r="73" stroke="#00AE99" stroke-width="3"/>
+<path d="M75 64V75M75 75H69V128H75M75 75H81V128H75M75 128V139" stroke="#00AE99" stroke-width="3"/>
+<path d="M98 16V27M98 27H92V75H98M98 27H104V75H98M98 75V86" stroke="#00AE99" stroke-width="3"/>
+<path d="M52 16V27M52 27H46V75H52M52 27H58V75H52M52 75V86" stroke="#00AE99" stroke-width="3"/>
+<path d="M29 64V75M29 75H23V100H29M29 75H35V100H29M29 100V111" stroke="#00AE99" stroke-width="3"/>
+<path d="M121 64V75M121 75H115V100H121M121 75H127V100H121M121 100V111" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/predictionMarkets.svg b/packages/website/ts/icons/illustrations/predictionMarkets.svg
new file mode 100755
index 000000000..820b79416
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/predictionMarkets.svg
@@ -0,0 +1,7 @@
+<svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M126.5 126.737C139.78 113.518 148 95.2188 148 75C148 34.6832 115.317 2 75 2C34.6832 2 2 34.6832 2 75C2 94.9638 10.0138 113.056 23 126.235" stroke="#00AE99" stroke-width="3"/>
+<path d="M127 4V22M127 40V22M127 22H109H145" stroke="#00AE99" stroke-width="3"/>
+<path d="M104 37V45M104 53V45M104 45H96H112" stroke="#00AE99" stroke-width="3"/>
+<rect x="19" y="137" width="112" height="11" stroke="#00AE99" stroke-width="3"/>
+<rect x="23" y="126" width="104" height="11" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/protocol.svg b/packages/website/ts/icons/illustrations/protocol.svg
new file mode 100644
index 000000000..5c9c1531a
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/protocol.svg
@@ -0,0 +1 @@
+<svg width="144" height="144" viewBox="0 0 144 144" fill="none" xmlns="http://www.w3.org/2000/svg"><g style="mix-blend-mode:screen" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"><path d="M72 132.722c33.536 0 60.722-27.186 60.722-60.722S105.536 11.278 72 11.278 11.278 38.464 11.278 72 38.464 132.722 72 132.722z"/><path d="M72 20.557A9.278 9.278 0 1 0 72 2a9.278 9.278 0 0 0 0 18.557zM114.942 38.336a9.278 9.278 0 1 0-9.278-9.278 9.278 9.278 0 0 0 9.278 9.278zM132.722 81.278A9.278 9.278 0 0 0 142 72a9.278 9.278 0 0 0-9.278-9.278 9.278 9.278 0 1 0 0 18.556zM114.942 124.221a9.279 9.279 0 1 0 0-18.557 9.279 9.279 0 0 0 0 18.557zM72 142a9.278 9.278 0 0 0 9.278-9.278 9.278 9.278 0 1 0-18.556 0A9.278 9.278 0 0 0 72 142zM29.058 124.221a9.278 9.278 0 0 0 9.278-9.279 9.278 9.278 0 0 0-9.278-9.278 9.278 9.278 0 0 0-9.279 9.278 9.278 9.278 0 0 0 9.279 9.279zM11.278 81.278a9.278 9.278 0 1 0 0-18.556 9.278 9.278 0 0 0 0 18.556zM29.058 38.336a9.278 9.278 0 1 0 0-18.557 9.278 9.278 0 0 0 0 18.557zM68.114 75.886c-2.138-2.137-2.138-5.635 0-7.82 2.137-2.138 5.635-2.138 7.82 0 2.138 2.137 2.138 5.634 0 7.82-2.185 2.138-5.683 2.138-7.82 0zM49.363 75.886c-2.137-2.137-2.137-5.635 0-7.82 2.137-2.138 5.635-2.138 7.821 0 2.137 2.137 2.137 5.634 0 7.82a5.571 5.571 0 0 1-7.821 0zM30.66 75.886c-2.137-2.137-2.137-5.635 0-7.82 2.138-2.138 5.636-2.138 7.822 0 2.137 2.137 2.137 5.634 0 7.82-2.186 2.138-5.684 2.138-7.821 0zM86.816 75.886c-2.137-2.137-2.137-5.635 0-7.82 2.138-2.138 5.635-2.138 7.821 0 2.138 2.137 2.138 5.634 0 7.82-2.186 2.138-5.683 2.138-7.82 0zM105.518 75.886c-2.137-2.137-2.137-5.635 0-7.82 2.138-2.138 5.635-2.138 7.821 0 2.138 2.137 2.138 5.634 0 7.82-2.186 2.138-5.683 2.138-7.821 0zM53.25 58.738c0-3.06 2.477-5.489 5.489-5.489 3.06 0 5.489 2.477 5.489 5.49 0 3.06-2.478 5.489-5.49 5.489-3.011.048-5.489-2.43-5.489-5.49zM40.036 45.525c0-3.06 2.478-5.489 5.49-5.489 3.06 0 5.489 2.477 5.489 5.49 0 3.06-2.478 5.489-5.49 5.489a5.453 5.453 0 0 1-5.489-5.49zM79.724 85.213c0-3.06 2.477-5.49 5.49-5.49 3.06 0 5.488 2.478 5.488 5.49 0 3.06-2.477 5.49-5.489 5.49-3.06.048-5.49-2.43-5.49-5.49zM92.937 98.475c0-3.06 2.477-5.49 5.49-5.49a5.483 5.483 0 0 1 5.488 5.49c0 3.06-2.477 5.489-5.489 5.489s-5.49-2.478-5.49-5.49zM85.213 53.25c3.06 0 5.49 2.477 5.49 5.488 0 3.06-2.478 5.49-5.49 5.49a5.483 5.483 0 0 1-5.49-5.49 5.483 5.483 0 0 1 5.49-5.489zM98.475 40.036c3.06 0 5.489 2.477 5.489 5.49 0 3.06-2.477 5.489-5.49 5.489a5.484 5.484 0 0 1-5.489-5.49c-.048-3.06 2.43-5.489 5.49-5.489zM58.739 79.724c3.06 0 5.489 2.477 5.489 5.489 0 3.06-2.478 5.49-5.49 5.49a5.483 5.483 0 0 1-5.489-5.49c0-3.06 2.478-5.49 5.49-5.49zM45.525 92.937c3.06 0 5.49 2.477 5.49 5.49a5.483 5.483 0 0 1-5.49 5.488 5.483 5.483 0 0 1-5.489-5.489 5.484 5.484 0 0 1 5.49-5.49zM68.114 49.363c2.137-2.138 5.635-2.138 7.82 0 2.138 2.137 2.138 5.635 0 7.82-2.137 2.138-5.634 2.138-7.82 0a5.483 5.483 0 0 1 0-7.82zM68.114 30.66c2.137-2.137 5.635-2.137 7.82 0 2.138 2.138 2.138 5.636 0 7.822-2.137 2.137-5.634 2.137-7.82 0-2.186-2.186-2.186-5.684 0-7.821zM68.114 86.816c2.137-2.137 5.635-2.137 7.82 0 2.138 2.138 2.138 5.635 0 7.821-2.137 2.137-5.634 2.137-7.82 0-2.186-2.186-2.186-5.683 0-7.82zM68.114 105.518c2.137-2.137 5.635-2.137 7.82 0 2.138 2.138 2.138 5.635 0 7.821-2.137 2.138-5.634 2.138-7.82 0-2.186-2.186-2.186-5.683 0-7.821z"/></g></svg> \ No newline at end of file
diff --git a/packages/website/ts/icons/illustrations/ready-to-build.svg b/packages/website/ts/icons/illustrations/ready-to-build.svg
new file mode 100644
index 000000000..a26a4e236
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/ready-to-build.svg
@@ -0,0 +1 @@
+<svg width="152" height="152" viewBox="0 0 152 152" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M76 151c41.421 0 75-33.579 75-75S117.421 1 76 1 1 34.579 1 76s33.579 75 75 75z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M76 1.502l-30.852 44.8H76L76.05 76l30.803-44.9H76.001V1.502zM76 75.997l-30.853 44.799H76l.05 29.699 30.803-44.899H76V75.997z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10" stroke-linejoin="round"/><path d="M1.502 75.998l44.8 30.852V75.998L76 75.948 31.1 45.144v30.853H1.503zM76 76l45.101 31.522V76L151 75.95l-45.202-31.47V76H76z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10" stroke-linejoin="round"/></svg> \ No newline at end of file
diff --git a/packages/website/ts/icons/illustrations/recruitingSupport.svg b/packages/website/ts/icons/illustrations/recruitingSupport.svg
new file mode 100755
index 000000000..d630b23d7
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/recruitingSupport.svg
@@ -0,0 +1,7 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M2 45C2 68.7578 21.2421 88 45 88C68.7579 88 88 68.7578 88 45C88 21.6448 69.3906 2.63278 46.1793 2.02876C45.7478 2.02876 45.3452 2 44.9137 2C21.2134 2.02876 2 21.2709 2 45Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M30 45C30 53.2876 36.7124 60 45 60C53.2876 60 60 53.2876 60 45C60 36.8528 53.5084 30.2207 45.4114 30.01C45.2609 30.01 45.1204 30 44.9699 30C36.7023 30.01 30 36.7224 30 45Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M21 45C21 58.2602 31.7398 69 45 69C58.2602 69 69 58.2602 69 45C69 31.9645 58.6134 21.3532 45.6582 21.0161C45.4174 21.0161 45.1926 21 44.9518 21C31.7237 21.0161 21 31.7559 21 45Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M56.5 56L76 75.5" stroke="#00AE99" stroke-width="3"/>
+<path d="M45 70.5C54.0057 70.5 62.1515 74.8777 67.8311 81.94L70.1689 80.06C63.9926 72.3798 55.0243 67.5 45 67.5V70.5ZM45 67.5C34.9757 67.5 26.0074 72.3798 19.8311 80.06L22.1689 81.94C27.8485 74.8777 35.9943 70.5 45 70.5V67.5Z" fill="#00AE99"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/right-thing.svg b/packages/website/ts/icons/illustrations/right-thing.svg
new file mode 100644
index 000000000..eba2bbc36
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/right-thing.svg
@@ -0,0 +1,6 @@
+<svg width="104" height="104" viewBox="0 0 104 104" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M52 102C79.6142 102 102 79.6142 102 52C102 24.3858 79.6142 2 52 2C24.3858 2 2 24.3858 2 52C2 79.6142 24.3858 102 52 102Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M92.0611 24.6135C81.9235 14.476 65.4872 14.476 55.3496 24.6135L51.6804 28.286L48.008 24.6135C37.8704 14.476 21.4341 14.476 11.2965 24.6135C1.15897 34.7511 1.15897 51.1874 11.2965 61.325L14.969 64.9974L51.6804 101.706L88.3918 64.9942L92.0643 61.3218C102.199 51.1874 102.199 34.7511 92.0611 24.6135Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M81.2925 45.1702C73.8581 37.7358 61.8044 37.7358 54.3731 45.1702L51.6796 47.8637L48.9861 45.1702C41.5517 37.7358 29.4979 37.7358 22.0635 45.1702C14.6291 52.6046 14.6291 64.6583 22.0635 72.0928L24.757 74.7863L51.6764 101.709L78.599 74.7863L81.2925 72.0928C88.7269 64.6583 88.7269 52.6046 81.2925 45.1702Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M70.5248 65.73C65.7935 60.9987 58.1223 60.9987 53.3942 65.73L51.6796 67.4446L49.9649 65.73C45.2336 60.9987 37.5625 60.9987 32.8344 65.73C28.1031 70.4613 28.1031 78.1324 32.8344 82.8605L34.5491 84.5752L51.6796 101.706L68.8101 84.5752L70.5248 82.8605C75.256 78.1292 75.256 70.4613 70.5248 65.73Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/robustSmartContracts.svg b/packages/website/ts/icons/illustrations/robustSmartContracts.svg
new file mode 100755
index 000000000..060f2d00c
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/robustSmartContracts.svg
@@ -0,0 +1,6 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M45 88C68.7482 88 88 68.7482 88 45C88 21.2518 68.7482 2 45 2C21.2518 2 2 21.2518 2 45C2 68.7482 21.2518 88 45 88Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M70 29V79H20V11H52M70 29L52 11M70 29V11H52" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M30 45H60M30 55H60M30 65H60" stroke="#00AE99" stroke-width="3"/>
+<path d="M52 11V29H70" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/rocketship.svg b/packages/website/ts/icons/illustrations/rocketship.svg
new file mode 100644
index 000000000..e9b4b83ab
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/rocketship.svg
@@ -0,0 +1,9 @@
+<svg width="124" height="124" viewBox="0 0 124 124" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M44.6582 74.4521L12.4089 95.6738M18.9394 103.633L46.699 76.2888" stroke="#00AE99" stroke-width="2.5"/>
+<path d="M51.3926 80.5745L34.6538 115.266M25.8784 109.96L49.1477 78.5338" stroke="#00AE99" stroke-width="2.5"/>
+<path d="M77.212 78.8086L75.9699 78.949L75.9699 78.949L77.212 78.8086ZM77.603 60.0842L76.4001 59.7443L77.603 60.0842ZM84.9562 43.7018L83.979 42.9223L83.9342 42.9785L83.8961 43.0394L84.9562 43.7018ZM73.085 87.8359L72.2661 88.7803L73.2262 89.6128L74.0428 88.6391L73.085 87.8359ZM56.5473 79.3763L57.4218 80.2694L57.459 80.2331L57.493 80.1937L56.5473 79.3763ZM53.8137 79.4142L54.6312 78.4685L54.6311 78.4685L53.8137 79.4142ZM53.0049 80.3499L53.7507 81.3531L53.8608 81.2712L53.9505 81.1674L53.0049 80.3499ZM51.4635 80.243L52.2809 79.2973L52.2809 79.2973L51.4635 80.243ZM61.3832 68.3677L60.5429 69.2931L60.5542 69.3034L60.5658 69.3134L61.3832 68.3677ZM74.9165 85.3062L75.9718 85.9761L75.9718 85.9761L74.9165 85.3062ZM91.434 27.7957L92.5916 27.3241L92.4784 27.0462L92.2514 26.85L91.434 27.7957ZM42.7642 49.0315L42.8049 50.2809L42.8049 50.2809L42.7642 49.0315ZM61.2349 45.9355L61.7453 47.0765L61.2349 45.9355ZM76.3811 36.2894L77.1898 37.2424L77.2446 37.1959L77.2937 37.1435L76.3811 36.2894ZM34.429 54.4212L33.4956 53.5898L32.6503 54.5386L33.613 55.3682L34.429 54.4212ZM45.1923 69.5609L44.2467 68.7435L44.2127 68.7828L44.182 68.8248L45.1923 69.5609ZM45.5503 72.2712L46.3678 71.3256L46.3678 71.3256L45.5503 72.2712ZM44.7415 73.207L43.7958 72.3895L43.7061 72.4933L43.641 72.6141L44.7415 73.207ZM45.0703 74.7167L45.8878 73.771L45.8878 73.771L45.0703 74.7167ZM55.3854 63.1831L54.5679 64.1288L54.5795 64.1388L54.5913 64.1485L55.3854 63.1831ZM36.667 52.2431L35.8515 51.2958L35.8515 51.2958L36.667 52.2431ZM91.1826 27.5784L92 26.6327L91.773 26.4365L91.4817 26.3647L91.1826 27.5784ZM83.9509 43.0422L61.4101 69.1188L63.3014 70.7536L85.8422 44.6771L83.9509 43.0422ZM78.4541 78.6681C78.0305 74.9211 76.5083 68.5531 78.8059 60.4242L76.4001 59.7443C73.9348 68.4667 75.5746 75.4525 75.9699 78.949L78.4541 78.6681ZM78.8059 60.4242C80.6674 53.8382 84.3943 46.96 86.0163 44.3642L83.8961 43.0394C82.2037 45.748 78.349 52.8492 76.4001 59.7443L78.8059 60.4242ZM85.9334 44.4813C86.7782 43.4222 88.106 41.5706 89.3107 39.7677C90.4904 38.002 91.6492 36.1406 92.0741 35.11L89.7628 34.1571C89.4497 34.9164 88.4417 36.5683 87.232 38.3788C86.0471 40.1522 84.7628 41.9398 83.979 42.9223L85.9334 44.4813ZM73.904 86.8915L60.2718 75.0706L58.634 76.9594L72.2661 88.7803L73.904 86.8915ZM58.5072 75.1976L55.6017 78.5589L57.493 80.1937L60.3985 76.8324L58.5072 75.1976ZM55.6728 78.4831C55.6952 78.4612 55.6589 78.4988 55.5624 78.5515C55.474 78.5998 55.3704 78.6413 55.265 78.6627C55.163 78.6835 55.0696 78.6837 54.9818 78.6633C54.8989 78.6441 54.7803 78.5974 54.6312 78.4685L52.9963 80.3599C53.9198 81.1581 54.9373 81.2805 55.7629 81.1126C56.5187 80.959 57.1181 80.5669 57.4218 80.2694L55.6728 78.4831ZM52.8681 78.5968L52.0592 79.5325L53.9505 81.1674L54.7594 80.2317L52.8681 78.5968ZM52.2591 79.3468C52.279 79.332 52.2917 79.3249 52.2958 79.3226C52.3006 79.32 52.302 79.3197 52.3006 79.3202C52.2965 79.3217 52.2938 79.3219 52.2957 79.3217C52.2974 79.3216 52.3007 79.3216 52.3054 79.3221C52.3102 79.3227 52.3147 79.3237 52.3182 79.3249C52.3218 79.326 52.3213 79.3263 52.3164 79.3236C52.3115 79.3208 52.2994 79.3133 52.2809 79.2973L50.646 81.1886C51.8617 82.2394 53.2052 81.7587 53.7507 81.3531L52.2591 79.3468ZM60.5658 69.3134C61.2107 69.8709 61.7136 71.4882 60.5236 72.8649L62.4149 74.4998C64.5664 72.0109 63.8212 68.8229 62.2006 67.422L60.5658 69.3134ZM60.5236 72.8649L58.5072 75.1976L60.3985 76.8324L62.4149 74.4998L60.5236 72.8649ZM74.0428 88.6391C74.5796 87.999 75.2848 87.0584 75.9718 85.9761L73.8611 84.6363C73.2323 85.627 72.5921 86.4784 72.1273 87.0326L74.0428 88.6391ZM75.9718 85.9761C76.6408 84.9221 77.3127 83.7022 77.792 82.4704C78.2624 81.2613 78.5956 79.9197 78.4541 78.6681L75.9699 78.949C76.045 79.6133 75.8726 80.509 75.4621 81.5639C75.0605 82.5961 74.4763 83.6671 73.8611 84.6363L75.9718 85.9761ZM75.7339 84.3606L62.2867 72.7367L60.6518 74.628L74.099 86.2519L75.7339 84.3606ZM60.2703 75.0693L54.4097 70.0034L52.7748 71.8947L58.6354 76.9607L60.2703 75.0693ZM57.4148 66.5254C58.723 67.6581 59.9087 68.7173 60.5429 69.2931L62.2235 67.4423C61.5753 66.8537 60.3749 65.7815 59.0512 64.6354L57.4148 66.5254ZM48.6813 76.6305L52.9964 80.3599L54.6311 78.4685L50.316 74.739L48.6813 76.6305ZM47.2951 78.2921L50.646 81.1886L52.2809 79.2973L48.9299 76.4007L47.2951 78.2921ZM92.0741 35.11C92.483 34.1181 92.8555 32.8177 93.0125 31.4685C93.1677 30.1352 93.1262 28.6366 92.5916 27.3241L90.2763 28.2672C90.5897 29.0365 90.6594 30.0618 90.5293 31.1795C90.4011 32.2814 90.0918 33.359 89.7628 34.1571L92.0741 35.11ZM75.2878 35.5538L52.747 61.6303L54.6383 63.2652L77.1792 37.1886L75.2878 35.5538ZM42.8049 50.2809C46.3218 50.1661 53.4713 50.778 61.7453 47.0765L60.7244 44.7945C53.0135 48.244 46.4923 47.6592 42.7234 47.7822L42.8049 50.2809ZM61.7453 47.0765C68.2859 44.1505 74.7546 39.309 77.1898 37.2424L75.5723 35.3363C73.2384 37.3168 66.9718 41.9996 60.7244 44.7945L61.7453 47.0765ZM77.2937 37.1435C78.1525 36.2258 79.7355 34.6963 81.3187 33.2674C82.9352 31.8084 84.4239 30.572 85.1299 30.1523L83.8526 28.0033C82.8943 28.5728 81.2201 29.9887 79.6437 31.4115C78.034 32.8643 76.3941 34.446 75.4684 35.4352L77.2937 37.1435ZM33.613 55.3682L47.2819 67.1466L48.9138 65.2527L35.2449 53.4743L33.613 55.3682ZM47.1522 65.3822L44.2467 68.7435L46.138 70.3784L49.0435 67.0171L47.1522 65.3822ZM44.182 68.8248C43.9317 69.1684 43.6304 69.8183 43.5877 70.5883C43.5411 71.4295 43.8094 72.4187 44.7329 73.2169L46.3678 71.3256C46.2187 71.1967 46.1553 71.0861 46.1243 71.0068C46.0914 70.9229 46.0781 70.8305 46.0839 70.7266C46.0899 70.6192 46.1159 70.5106 46.1509 70.4161C46.1892 70.3131 46.221 70.2717 46.2026 70.297L44.182 68.8248ZM44.6047 71.4538L43.7958 72.3895L45.6871 74.0244L46.496 73.0887L44.6047 71.4538ZM43.641 72.6141C43.3186 73.2126 43.0373 74.6115 44.2529 75.6624L45.8878 73.771C45.8693 73.755 45.8601 73.7441 45.8566 73.7397C45.8532 73.7353 45.8534 73.7348 45.8551 73.7381C45.8567 73.7414 45.8584 73.7457 45.8597 73.7504C45.8609 73.7549 45.8613 73.7583 45.8614 73.7599C45.8616 73.7618 45.8613 73.7592 45.8623 73.7549C45.8626 73.7534 45.8624 73.7548 45.8606 73.76C45.8589 73.7644 45.8537 73.7779 45.8419 73.7998L43.641 72.6141ZM56.2028 62.2375C54.5822 60.8366 51.32 60.5606 49.1686 63.0495L51.0599 64.6844C52.25 63.3077 53.9229 63.5713 54.5679 64.1288L56.2028 62.2375ZM49.1686 63.0495L47.1522 65.3822L49.0435 67.0171L51.0599 64.6844L49.1686 63.0495ZM35.3623 55.2527C35.8435 54.7125 36.5933 53.9559 37.4825 53.1904L35.8515 51.2958C34.88 52.1321 34.0513 52.966 33.4956 53.5898L35.3623 55.2527ZM37.4825 53.1904C38.3526 52.4414 39.3278 51.7084 40.291 51.1617C41.2754 50.6029 42.1367 50.3027 42.8049 50.2809L42.7234 47.7822C41.4645 47.8233 40.1853 48.347 39.057 48.9875C37.9074 49.6399 36.7976 50.4813 35.8515 51.2958L37.4825 53.1904ZM35.8496 53.1887L49.2968 64.8126L50.9317 62.9213L37.4845 51.2974L35.8496 53.1887ZM47.2804 67.1453L53.141 72.2113L54.7759 70.3199L48.9153 65.254L47.2804 67.1453ZM59.4158 64.9506C58.0903 63.8066 56.8557 62.774 56.1795 62.2178L54.5913 64.1485C55.2529 64.6927 56.4724 65.7127 57.7825 66.8433L59.4158 64.9506ZM50.6824 75.0557L46.3678 71.3256L44.7328 73.2168L49.0474 76.9469L50.6824 75.0557ZM49.2387 76.6676L45.8878 73.771L44.2529 75.6624L47.6038 78.559L49.2387 76.6676ZM85.1299 30.1523C85.872 29.7113 86.8935 29.2494 87.9652 28.9631C89.0523 28.6726 90.0769 28.5933 90.8835 28.792L91.4817 26.3647C90.1056 26.0255 88.6168 26.2013 87.3199 26.5478C86.0077 26.8984 84.7749 27.4551 83.8526 28.0033L85.1299 30.1523ZM92.2514 26.85L92 26.6327L90.3651 28.524L90.6165 28.7413L92.2514 26.85Z" fill="#00AE99"/>
+<path d="M66.0818 13.4286V16.2857M66.0818 19.1428V16.2857M66.0818 16.2857H63.2246H68.9389" stroke="#00AE99" stroke-width="2.5"/>
+<path d="M108.122 62V64.8571M108.122 67.7143V64.8571M108.122 64.8571H105.265H110.979" stroke="#00AE99" stroke-width="2.5"/>
+<path d="M37.9182 25.6735V28.5307M37.9182 31.3878V28.5307M37.9182 28.5307H35.061H40.7753" stroke="#00AE99" stroke-width="2.5"/>
+<path d="M62 122C95.1371 122 122 95.1371 122 62C122 28.8629 95.1371 2 62 2C28.8629 2 2 28.8629 2 62C2 95.1371 28.8629 122 62 122Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/secureTrading.svg b/packages/website/ts/icons/illustrations/secureTrading.svg
new file mode 100755
index 000000000..21912961d
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/secureTrading.svg
@@ -0,0 +1,15 @@
+<svg width="91" height="90" viewBox="0 0 91 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M2 45C2 68.7579 21.2421 88 45 88C68.7579 88 88 68.7579 88 45C88 21.6448 69.3906 2.63278 46.1793 2.02876C45.7478 2.02876 45.3452 2 44.9137 2C21.2134 2.02876 2 21.2709 2 45Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M15 15H75V75H62.8125H26.25H15V15Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M68.2435 21.7253H21.7253V68.2436H30.4475H58.7945H68.2435V21.7253Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M14.6464 44.9844H21.7253" stroke="#00AE99" stroke-width="3"/>
+<path d="M14.6464 34.8718H21.7253" stroke="#00AE99" stroke-width="3"/>
+<path d="M14.6464 55.0971H21.7253" stroke="#00AE99" stroke-width="3"/>
+<circle cx="44.9844" cy="44.9844" r="14.1577" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M44.9844 30.8267V38.9168" stroke="#00AE99" stroke-width="3"/>
+<path d="M32.1647 38.9766L39.4902 42.4097" stroke="#00AE99" stroke-width="3"/>
+<path d="M35.2801 55.2932L40.8255 49.4026" stroke="#00AE99" stroke-width="3"/>
+<path d="M54.7349 55.2497L49.1632 49.3839" stroke="#00AE99" stroke-width="3"/>
+<path d="M57.8132 38.996L50.4825 42.4181" stroke="#00AE99" stroke-width="3"/>
+<ellipse cx="44.9844" cy="44.9844" rx="5.05633" ry="5.05633" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/social-discord.svg b/packages/website/ts/icons/illustrations/social-discord.svg
new file mode 100644
index 000000000..144f6e061
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/social-discord.svg
@@ -0,0 +1,3 @@
+<svg width="40" height="44" viewBox="0 0 40 44" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M34.8156 0C37.3489 0 39.3921 2.04861 39.5129 4.45939V43.2425L34.6895 39.1471L32.0409 36.7363L29.1509 34.2175L30.3581 38.1904H5.06478C2.5387 38.1904 0.488281 36.2715 0.488281 33.7292V4.46839C0.488281 2.05762 2.5423 0.00540532 5.07379 0.00540532H34.803L34.8156 0ZM23.7924 10.2395H23.7383L23.3744 10.5998C27.1095 11.6809 28.9166 13.3691 28.9166 13.3691C26.5095 12.1656 24.3401 11.5638 22.1708 11.3205C20.6033 11.0773 19.0357 11.2052 17.7114 11.3205H17.3511C16.5042 11.3205 14.7025 11.6809 12.2881 12.6448C11.4467 13.0106 10.9638 13.2502 10.9638 13.2502C10.9638 13.2502 12.7692 11.4449 16.7475 10.4809L16.5042 10.2377C16.5042 10.2377 13.4917 10.1224 10.2395 12.5259C10.2395 12.5259 6.98727 18.1907 6.98727 25.1744C6.98727 25.1744 8.78905 28.3094 13.7313 28.4284C13.7313 28.4284 14.452 27.468 15.1817 26.623C12.407 25.7798 11.3259 24.0933 11.3259 24.0933C11.3259 24.0933 11.5674 24.2122 11.9295 24.4536H12.0376C12.0917 24.4536 12.1169 24.4807 12.1457 24.5077V24.5185C12.1746 24.5473 12.1998 24.5726 12.2539 24.5726C12.8484 24.8176 13.443 25.059 13.9295 25.2933C14.7691 25.6572 15.8484 26.0194 17.1727 26.259C18.8483 26.5023 20.769 26.6194 22.9564 26.259C24.0374 26.0158 25.1185 25.778 26.1996 25.2951C26.9023 24.9347 27.7671 24.5744 28.7166 23.9672C28.7166 23.9672 27.6356 25.6536 24.7437 26.4969C25.3383 27.3365 26.1761 28.2986 26.1761 28.2986C31.1202 28.1905 33.0409 25.0554 33.149 25.1888C33.149 18.2159 29.8788 12.5403 29.8788 12.5403C26.9329 10.353 24.1762 10.2701 23.6897 10.2701L23.7906 10.2341L23.7924 10.2395ZM24.0951 18.1907C25.3617 18.1907 26.3834 19.2718 26.3834 20.5961C26.3834 21.9294 25.3563 23.0104 24.0951 23.0104C22.8339 23.0104 21.8068 21.9294 21.8068 20.6069C21.8105 19.2736 22.8393 18.1961 24.0951 18.1961V18.1907ZM15.9096 18.1907C17.1709 18.1907 18.1907 19.2718 18.1907 20.5961C18.1907 21.9294 17.1637 23.0104 15.9024 23.0104C14.6412 23.0104 13.6142 21.9294 13.6142 20.6069C13.6142 19.2736 14.6412 18.1961 15.9024 18.1961L15.9096 18.1907Z" fill="white"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/social-fb.svg b/packages/website/ts/icons/illustrations/social-fb.svg
new file mode 100644
index 000000000..e50cf107a
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/social-fb.svg
@@ -0,0 +1,3 @@
+<svg width="38" height="38" viewBox="0 0 38 38" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M35.9037 0H2.09633C0.938917 0 0 0.938917 0 2.09633V35.9037C0 37.0627 0.938917 38 2.09633 38H20.2952V23.2845H15.3409V17.5513H20.2952V13.3158C20.2952 8.40908 23.294 5.73958 27.6719 5.73958C29.7698 5.73958 31.5733 5.89317 32.0989 5.96283V11.0928H29.0573C26.6823 11.0928 26.22 12.2344 26.22 13.8969V17.556H31.8947L31.1584 23.3035H26.22V38H35.9021C37.0627 38 38 37.0627 38 35.9037V2.09633C38 0.938917 37.0627 0 35.9037 0Z" fill="white"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/social-github.svg b/packages/website/ts/icons/illustrations/social-github.svg
new file mode 100644
index 000000000..ef0025582
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/social-github.svg
@@ -0,0 +1,3 @@
+<svg width="38" height="38" viewBox="0 0 38 38" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M19 0.17334C8.5025 0.17334 0 8.68059 0 19.1733C0 27.5698 5.4435 34.69 12.9913 37.1996C13.9412 37.3785 14.2896 36.7911 14.2896 36.286C14.2896 35.8348 14.2738 34.6393 14.2658 33.056C8.98067 34.2023 7.866 30.5068 7.866 30.5068C7.0015 28.3139 5.75225 27.7281 5.75225 27.7281C4.03117 26.5501 5.88525 26.5738 5.88525 26.5738C7.79317 26.7068 8.79542 28.5308 8.79542 28.5308C10.4896 31.4363 13.243 30.5971 14.3292 30.111C14.5002 28.8823 14.9894 28.0448 15.5325 27.5698C11.3129 27.0948 6.878 25.4608 6.878 18.1806C6.878 16.1064 7.61425 14.4123 8.83342 13.0823C8.61967 12.6025 7.97842 10.6708 8.99967 8.05359C8.99967 8.05359 10.5909 7.54376 14.2247 10.0011C15.7447 9.57834 17.3597 9.36934 18.9747 9.35984C20.5897 9.36934 22.2047 9.57834 23.7247 10.0011C27.3347 7.54376 28.9259 8.05359 28.9259 8.05359C29.9472 10.6708 29.3059 12.6025 29.1159 13.0823C30.3272 14.4123 31.0634 16.1064 31.0634 18.1806C31.0634 25.4798 26.6222 27.0868 22.3947 27.5539C23.0597 28.1239 23.6772 29.2893 23.6772 31.0689C23.6772 33.6118 23.6534 35.6543 23.6534 36.2718C23.6534 36.7705 23.9859 37.3643 24.9597 37.1743C32.5613 34.6821 38 27.5571 38 19.1733C38 8.68059 29.4928 0.17334 19 0.17334Z" fill="white"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/social-newsletter.svg b/packages/website/ts/icons/illustrations/social-newsletter.svg
new file mode 100644
index 000000000..572cb8ed9
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/social-newsletter.svg
@@ -0,0 +1,3 @@
+<svg width="38" height="30" viewBox="0 0 38 30" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M38 3.125V26.875C38 28.2208 36.9708 29.25 35.625 29.25H33.25V7.69608L19 17.9292L4.75 7.69608V29.25H2.375C1.02758 29.25 0 28.2208 0 26.875V3.125C0 2.45208 0.2565 1.85833 0.682417 1.434C1.10833 1.00333 1.70367 0.75 2.375 0.75H3.16667L19 12.2292L34.8333 0.75H35.625C36.2979 0.75 36.8917 1.0065 37.3176 1.434C37.7451 1.85833 38 2.45208 38 3.125Z" fill="white"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/social-reddit.svg b/packages/website/ts/icons/illustrations/social-reddit.svg
new file mode 100644
index 000000000..b93510b36
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/social-reddit.svg
@@ -0,0 +1,3 @@
+<svg width="50" height="41" viewBox="0 0 50 41" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M4.49975 24.6813C4.37725 25.2447 4.31396 25.8246 4.31396 26.4105C4.31396 33.4398 13.3012 39.1687 24.3505 39.1687C35.3957 39.1687 44.383 33.4439 44.383 26.4105C44.383 25.8511 44.3238 25.2958 44.2156 24.7588L44.1849 24.6935C44.1421 24.5812 44.1257 24.4689 44.1257 24.3566C43.5092 21.9577 41.8452 19.7813 39.4382 18.0215C39.3463 17.9888 39.2585 17.9418 39.1809 17.8785C39.1278 17.8377 39.089 17.7928 39.0441 17.7479C35.3855 15.2285 30.1508 13.6483 24.3526 13.6483C18.6054 13.6483 13.4217 15.1979 9.76307 17.6723C9.73449 17.7091 9.70386 17.7397 9.66303 17.7724C9.58341 17.8398 9.49154 17.8949 9.39762 17.9255C6.93542 19.6854 5.22861 21.8801 4.59162 24.3015C4.59162 24.4199 4.56304 24.5343 4.51608 24.6506L4.49975 24.6813ZM24.4526 35.7898C20.7899 35.7898 18.2113 34.9956 16.5658 33.3459C16.2126 32.9907 16.2126 32.4129 16.5658 32.0556C16.9251 31.7188 17.5049 31.7188 17.8622 32.0556C19.1484 33.3398 21.3024 33.9809 24.4526 33.9809C27.6008 33.9809 29.7425 33.3684 31.0246 32.0842C31.3615 31.7494 31.9433 31.7494 32.3088 32.0842C32.6457 32.4517 32.6457 33.0336 32.3088 33.4011C30.6571 35.0507 28.0928 35.8469 24.424 35.8469L24.4526 35.7898ZM17.0905 20.3285C15.2244 20.3285 13.6667 21.8903 13.6667 23.7523C13.6667 25.6102 15.2244 27.121 17.0905 27.121C18.9565 27.121 20.4612 25.6102 20.4612 23.7523C20.4612 21.8903 18.9524 20.3285 17.0905 20.3285ZM31.8576 20.3285C29.9915 20.3285 28.4317 21.8903 28.4317 23.7523C28.4317 25.6102 29.9915 27.121 31.8576 27.121C33.7236 27.121 35.2283 25.6102 35.2283 23.7523C35.2283 21.8903 33.7196 20.3285 31.8576 20.3285ZM41.1429 17.0721C43.2601 18.7728 44.8178 20.7899 45.612 23.001C46.5308 22.315 47.08 21.237 47.08 20.0427C47.08 17.997 45.416 16.3351 43.3683 16.3351C42.5537 16.3351 41.7799 16.5984 41.1429 17.0762V17.0721ZM5.53486 16.3392C3.4871 16.3392 1.82522 18.0051 1.82522 20.0508C1.82522 21.1594 2.31317 22.1905 3.14003 22.8867C3.95872 20.6837 5.53282 18.6952 7.65815 17.0149C7.04158 16.5862 6.30455 16.3432 5.5369 16.3432V16.3392H5.53486ZM24.3526 41C12.2947 41 2.48875 34.4566 2.48875 26.4187C2.48875 25.8572 2.5357 25.308 2.62758 24.767C1.00856 23.7605 0 21.9863 0 20.0427C0 16.9884 2.50508 14.5037 5.56344 14.5037C6.9395 14.5037 8.22368 15.006 9.23225 15.8961C13.0215 13.4645 18.1276 11.9333 23.7523 11.8292L27.4517 0.55124L28.2766 0.745195C28.2766 0.745195 28.3092 0.745194 28.3092 0.749278L36.931 2.77662C37.6334 1.1474 39.2544 0 41.147 0C43.6562 0 45.7019 2.0498 45.7019 4.561C45.7019 7.07629 43.6541 9.122 41.147 9.122C38.6399 9.122 36.5942 7.0722 36.5942 4.56917L28.7318 2.7072L25.7368 11.8476C31.1471 12.0619 36.0409 13.5911 39.7097 15.9737C40.7183 15.0264 42.0453 14.5058 43.452 14.5058C46.5104 14.5058 49.0011 16.9823 49.0011 20.0406C49.0011 22.0557 47.8987 23.8911 46.1878 24.8691C46.247 25.3897 46.3082 25.8777 46.3082 26.3983C46.2776 34.4382 36.4962 40.9816 24.422 40.9816L24.3526 41ZM41.051 1.82726C39.5402 1.82726 38.3153 3.05019 38.3153 4.55896C38.3153 6.06568 39.5402 7.29474 41.051 7.29474C42.5455 7.29474 43.7664 6.06976 43.7664 4.57121C43.7664 3.07469 42.5455 1.85176 41.0163 1.85176L41.051 1.82726Z" fill="white"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/social-twitter.svg b/packages/website/ts/icons/illustrations/social-twitter.svg
new file mode 100644
index 000000000..bc8e2f7d7
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/social-twitter.svg
@@ -0,0 +1,3 @@
+<svg width="45" height="36" viewBox="0 0 45 36" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M44.8202 4.28708C43.1869 5.00497 41.4429 5.49403 39.6067 5.71733C41.478 4.58974 42.9175 2.81253 43.5985 0.692059C41.8434 1.71631 39.8983 2.46189 37.8276 2.87712C36.1741 1.10729 33.8174 0 31.2005 0C26.1863 0 22.1206 4.06562 22.1206 9.07428C22.1206 9.79402 22.2037 10.4861 22.355 11.1486C14.807 10.7924 8.11705 7.16789 3.63989 1.68862C2.85186 3.02107 2.41079 4.56944 2.41079 6.25622C2.41079 9.41201 4.01637 12.1858 6.44872 13.8153C4.95941 13.7674 3.55869 13.3577 2.33697 12.6785V12.7911C2.33697 17.1926 5.46139 20.8633 9.61928 21.6993C8.85709 21.9041 8.05246 22.0149 7.22752 22.0149C6.64804 22.0149 6.09255 21.9595 5.53705 21.8562C6.70156 25.4604 10.0493 28.0884 14.0337 28.1622C10.9333 30.5964 7.00422 32.047 2.77251 32.047C2.05276 32.047 1.33487 32.0045 0.613281 31.9233C4.65306 34.4959 9.41258 36 14.5597 36C31.2687 36 40.3947 22.1662 40.3947 10.189C40.3947 9.80325 40.3947 9.41385 40.367 9.0263C42.1405 7.75475 43.6889 6.14733 44.9069 4.32399L44.8202 4.28708Z" fill="white"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/stableTokens.svg b/packages/website/ts/icons/illustrations/stableTokens.svg
new file mode 100755
index 000000000..9e854b0e6
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/stableTokens.svg
@@ -0,0 +1,10 @@
+<svg width="150" height="150" viewBox="0 0 150 150" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="75" cy="75" r="73" stroke="#00AE99" stroke-width="3"/>
+<path d="M32 96H119M32 96V85H119V96M32 96H36V106.5H48M103 142V106.5M48 142V106.5M119 96H115V106.5H103M103 106.5H92.25M48 106.5H58.75M75.5 106.5V148M75.5 106.5H58.75M75.5 106.5H92.25M58.75 106.5V146M92.25 106.5V146" stroke="#00AE99" stroke-width="3"/>
+<path d="M75.3265 76.5343C93.1472 76.5343 107.594 62.0878 107.594 44.2672C107.594 26.4465 93.1472 12 75.3265 12C57.5058 12 43.0593 26.4465 43.0593 44.2672C43.0593 62.0878 57.5058 76.5343 75.3265 76.5343Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M66.4197 57.1739V58.6739H67.9197H85.2999H86.7999V57.1739V52.1138V50.6138H85.2999H81.0799V29.0134V27.5134H79.5799H74.0798H73.6189L73.2375 27.7722L67.0774 31.9523L66.4197 32.3986V33.1935V39.2803V42.1109L68.7619 40.5215L72.5798 37.9308V50.6138H67.9197H66.4197V52.1138V57.1739Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M43.0593 44.0473C49.7328 42.9472 54.8662 37.2271 54.8662 30.187C54.8662 27.0337 53.8395 24.1736 52.0795 21.8269C46.5794 27.6203 43.1327 35.4671 43.0593 44.0473Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M43.0593 44.4871C43.1327 53.1405 46.5794 60.914 52.0795 66.7074C53.8395 64.3607 54.8662 61.5007 54.8662 58.3473C54.8662 51.3072 49.7328 45.5137 43.0593 44.4871Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M107.594 44.0473C100.92 42.9472 95.7869 37.2271 95.7869 30.187C95.7869 27.0337 96.8135 24.1736 98.5736 21.8269C104.074 27.6203 107.52 35.4671 107.594 44.0473Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M107.594 44.4871C107.52 53.1405 104.074 60.914 98.5736 66.7074C96.8135 64.3607 95.7869 61.5007 95.7869 58.3473C95.7869 51.3072 100.92 45.5137 107.594 44.4871Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/standardForExchange.svg b/packages/website/ts/icons/illustrations/standardForExchange.svg
new file mode 100755
index 000000000..f8075ed6d
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/standardForExchange.svg
@@ -0,0 +1,12 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0)">
+<path d="M2 45C2 68.7579 21.2421 88 45 88C68.7579 88 88 68.7579 88 45C88 21.6448 69.3906 2.63278 46.1793 2.02876C45.7478 2.02876 45.3452 2 44.9137 2C21.2134 2.02876 2 21.2709 2 45Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M30 21L2 45L30 69V56.5H59.5V69L88 45L59.5 21V34H30V21Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M45 1V89" stroke="#00AE99" stroke-width="3"/>
+</g>
+<defs>
+<clipPath id="clip0">
+<rect width="90" height="90" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/support.svg b/packages/website/ts/icons/illustrations/support.svg
new file mode 100644
index 000000000..368e7cc02
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/support.svg
@@ -0,0 +1 @@
+<svg width="152" height="152" viewBox="0 0 152 152" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M76 151c41.421 0 75-33.579 75-75S117.421 1 76 1 1 34.579 1 76s33.579 75 75 75z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M114.869 14.138H38.226v124.818h76.643V14.138z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M101.73 26.189H51.365v100.73h50.365V26.189z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/><path d="M76.547 76.554c13.908 0 25.183-11.275 25.183-25.183 0-13.907-11.275-25.182-25.183-25.182-13.907 0-25.182 11.275-25.182 25.182 0 13.908 11.275 25.183 25.182 25.183zM76.547 126.919c13.908 0 25.183-11.274 25.183-25.182S90.455 76.554 76.547 76.554c-13.907 0-25.182 11.275-25.182 25.183s11.275 25.182 25.182 25.182z" stroke="#00AE99" stroke-width="2" stroke-miterlimit="10"/></svg> \ No newline at end of file
diff --git a/packages/website/ts/icons/illustrations/supportForAllEthereumStandards-large.svg b/packages/website/ts/icons/illustrations/supportForAllEthereumStandards-large.svg
new file mode 100755
index 000000000..1f840204a
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/supportForAllEthereumStandards-large.svg
@@ -0,0 +1,28 @@
+<svg width="250" height="250" viewBox="0 0 250 250" fill="none" xmlns="http://www.w3.org/2000/svg">
+<g clip-path="url(#clip0)">
+<path d="M192.122 112.755C221.878 112.755 246 88.6333 246 58.8776C246 29.1218 221.878 5 192.122 5C162.367 5 138.245 29.1218 138.245 58.8776C138.245 88.6333 162.367 112.755 192.122 112.755Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M206.229 18.0288V31.3513H219.551" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M219.551 31.3511V72.494H183.012V18.0287H206.229L219.551 31.3511Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M178.016 99.7268V86.4043H164.694" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M164.694 86.4045V45.2616H201.233V99.7269H178.016L164.694 86.4045Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M59.8776 114.323C89.6333 114.323 113.755 90.2008 113.755 60.445C113.755 30.6893 89.6333 6.56747 59.8776 6.56747C30.1218 6.56747 6 30.6893 6 60.445C6 90.2008 30.1218 114.323 59.8776 114.323Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M59.8775 114.224C89.5786 114.224 113.656 90.1464 113.656 60.4453C113.656 30.7442 89.5786 6.66666 59.8775 6.66666C30.1764 6.66666 6.09888 30.7442 6.09888 60.4453C6.09888 90.1464 30.1764 114.224 59.8775 114.224Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M46.0329 81.9563V83.4563H47.5329H76.5H78V81.9563V73.5229V72.0229H76.5H68.4665V35.0223V33.5223H66.9665H57.7997H57.3388L56.9574 33.7811L46.6906 40.7478L46.0329 41.1942V41.9891V52.1337V54.9643L48.3751 53.3749L56.2997 47.9975V72.0229H47.5329H46.0329V73.5229V81.9563Z" stroke="#00AE99" stroke-width="3"/>
+<path d="M6.09889 60.0786C17.2213 58.2452 25.777 48.7118 25.777 36.9782C25.777 31.7226 24.0658 26.9559 21.1325 23.0447C11.9656 32.7004 6.22112 45.7784 6.09889 60.0786Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M6.09889 60.8116C6.22112 75.2341 11.9656 88.1898 21.1325 97.8456C24.0658 93.9344 25.777 89.1676 25.777 83.912C25.777 72.1785 17.2213 62.5228 6.09889 60.8116Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M113.656 60.0786C102.534 58.2452 93.9781 48.7118 93.9781 36.9782C93.9781 31.7226 95.6892 26.9559 98.6226 23.0447C107.789 32.7004 113.534 45.7784 113.656 60.0786Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M113.656 60.8117C113.534 75.2342 107.789 88.1899 98.6226 97.8456C95.6892 93.9345 93.9781 89.1677 93.9781 83.9121C93.9781 72.1786 102.534 62.5229 113.656 60.8117Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M59.8776 246.567C89.6333 246.567 113.755 222.446 113.755 192.69C113.755 162.934 89.6333 138.812 59.8776 138.812C30.1218 138.812 6 162.934 6 192.69C6 222.446 30.1218 246.567 59.8776 246.567Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M59.8776 246.567C89.6333 246.567 113.755 222.446 113.755 192.69C113.755 162.934 89.6333 138.812 59.8776 138.812C30.1218 138.812 6 162.934 6 192.69C6 222.446 30.1218 246.567 59.8776 246.567Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M65.3633 189.944V158.303H69.8695V149.389H49.8858V158.303H54.3919V189.944C44.1062 192.393 36.4654 201.699 36.4654 212.67C36.4654 225.601 46.947 236.083 59.8776 236.083C72.8082 236.083 83.2899 225.601 83.2899 212.67C83.2899 201.601 75.6491 192.393 65.3633 189.944Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M69.8694 149.294H49.8857V158.208H69.8694V149.294Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M40.3837 199.547H79.2735" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M192.122 246.567C221.878 246.567 246 222.446 246 192.69C246 162.934 221.878 138.812 192.122 138.812C162.367 138.812 138.245 162.934 138.245 192.69C138.245 222.446 162.367 246.567 192.122 246.567Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M191.833 156.667L159.333 200.422H191.833L191.923 228.333L224.333 184.489H191.833V156.667Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</g>
+<defs>
+<clipPath id="clip0">
+<rect width="250" height="250" fill="white"/>
+</clipPath>
+</defs>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/supportForAllEthereumStandards.svg b/packages/website/ts/icons/illustrations/supportForAllEthereumStandards.svg
new file mode 100755
index 000000000..32a4d8602
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/supportForAllEthereumStandards.svg
@@ -0,0 +1,21 @@
+<svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M152.898 90.2041C176.703 90.2041 196 70.9066 196 47.102C196 23.2974 176.703 4 152.898 4C129.093 4 109.796 23.2974 109.796 47.102C109.796 70.9066 129.093 90.2041 152.898 90.2041Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M164.183 14.423V25.081H174.841" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M174.841 25.0809V57.9952H145.61V14.4229H164.183L174.841 25.0809Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M141.613 79.7814V69.1234H130.955" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M130.955 69.1236V36.2093H160.186V79.7815H141.613L130.955 69.1236Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M47.102 91.4581C70.9066 91.4581 90.2041 72.1606 90.2041 48.356C90.2041 24.5514 70.9066 5.25398 47.102 5.25398C23.2974 5.25398 4 24.5514 4 48.356C4 72.1606 23.2974 91.4581 47.102 91.4581Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M47.102 91.3791C70.8629 91.3791 90.1249 72.1171 90.1249 48.3562C90.1249 24.5953 70.8629 5.33333 47.102 5.33333C23.3411 5.33333 4.0791 24.5953 4.0791 48.3562C4.0791 72.1171 23.3411 91.3791 47.102 91.3791Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M35.9761 65.5651V66.8151H37.2261H60.3998H61.6498V65.5651V58.8183V57.5683H60.3998H54.023V28.0178V26.7678H52.773H45.4395H45.0555L44.7377 26.9835L36.5242 32.5569L35.9761 32.9289V33.5913V41.7069V44.0658L37.928 42.7413L44.1895 38.4924V57.5683H37.2261H35.9761V58.8183V65.5651Z" stroke="#00AE99" stroke-width="2.5"/>
+<path d="M4.0791 48.0629C12.977 46.5962 19.8216 38.9694 19.8216 29.5826C19.8216 25.3781 18.4527 21.5647 16.106 18.4357C8.77251 26.1603 4.17688 36.6227 4.0791 48.0629Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M4.0791 48.6493C4.17688 60.1873 8.77251 70.5519 16.106 78.2765C18.4527 75.1475 19.8216 71.3341 19.8216 67.1296C19.8216 57.7428 12.977 50.0182 4.0791 48.6493Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M90.1248 48.0629C81.2269 46.5962 74.3823 38.9694 74.3823 29.5826C74.3823 25.3781 75.7512 21.5647 78.0979 18.4357C85.4314 26.1603 90.027 36.6227 90.1248 48.0629Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M90.1248 48.6494C90.027 60.1874 85.4314 70.552 78.0979 78.2765C75.7512 75.1476 74.3823 71.3342 74.3823 67.1297C74.3823 57.7429 81.2269 50.0183 90.1248 48.6494Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M47.102 197.254C70.9066 197.254 90.2041 177.957 90.2041 154.152C90.2041 130.347 70.9066 111.05 47.102 111.05C23.2974 111.05 4 130.347 4 154.152C4 177.957 23.2974 197.254 47.102 197.254Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M47.102 197.254C70.9066 197.254 90.2041 177.957 90.2041 154.152C90.2041 130.347 70.9066 111.05 47.102 111.05C23.2974 111.05 4 130.347 4 154.152C4 177.957 23.2974 197.254 47.102 197.254Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M51.4904 151.955V126.642H55.0953V119.511H39.1084V126.642H42.7133V151.955C34.4847 153.914 28.3721 161.359 28.3721 170.136C28.3721 180.481 36.7574 188.866 47.1019 188.866C57.4464 188.866 65.8317 180.481 65.8317 170.136C65.8317 161.281 59.719 153.914 51.4904 151.955Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M55.0953 119.435H39.1084V126.566H55.0953V119.435Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M31.5068 159.638H62.6187" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M152.898 197.254C176.703 197.254 196 177.957 196 154.152C196 130.347 176.703 111.05 152.898 111.05C129.093 111.05 109.796 130.347 109.796 154.152C109.796 177.957 129.093 197.254 152.898 197.254Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+<path d="M152.667 125.333L126.667 160.338H152.667L152.738 182.667L178.667 147.591H152.667V125.333Z" stroke="#00AE99" stroke-width="2.5" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/techSupport.svg b/packages/website/ts/icons/illustrations/techSupport.svg
new file mode 100755
index 000000000..e52084f67
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/techSupport.svg
@@ -0,0 +1,13 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="45" cy="45" r="43" stroke="#00AE99" stroke-width="3"/>
+<circle cx="45" cy="45" r="26.5068" stroke="#00AE99" stroke-width="3"/>
+<circle cx="45" cy="45" r="10.0137" stroke="#00AE99" stroke-width="3"/>
+<path d="M88 45C88 49.5545 84.3079 53.2466 79.7534 53.2466C75.199 53.2466 71.5068 49.5545 71.5068 45" stroke="#00AE99" stroke-width="3"/>
+<path d="M18.4932 45C18.4932 40.4455 14.801 36.7534 10.2466 36.7534C5.69212 36.7534 2 40.4455 2 45" stroke="#00AE99" stroke-width="3"/>
+<path d="M37.9193 37.9193C34.6988 41.1397 29.4773 41.1397 26.2568 37.9193C23.0363 34.6988 23.0363 29.4773 26.2568 26.2568" stroke="#00AE99" stroke-width="3"/>
+<path d="M63.7432 63.743C66.9637 60.5225 66.9637 55.3011 63.7432 52.0806C60.5227 48.8601 55.3013 48.8601 52.0808 52.0806" stroke="#00AE99" stroke-width="3"/>
+<path d="M45 18.4932C49.5545 18.4932 53.2466 14.801 53.2466 10.2466C53.2466 5.69212 49.5545 2 45 2" stroke="#00AE99" stroke-width="3"/>
+<path d="M45 88C40.4455 88 36.7534 84.3079 36.7534 79.7534C36.7534 75.199 40.4455 71.5068 45 71.5068" stroke="#00AE99" stroke-width="3"/>
+<path d="M26.2568 63.7433C29.4773 66.9638 34.6988 66.9638 37.9193 63.7433C41.1397 60.5228 41.1397 55.3014 37.9193 52.0809" stroke="#00AE99" stroke-width="3"/>
+<path d="M52.0808 37.9193C48.8603 34.6988 48.8603 29.4774 52.0808 26.2569C55.3013 23.0364 60.5227 23.0364 63.7432 26.2569" stroke="#00AE99" stroke-width="3"/>
+</svg>
diff --git a/packages/website/ts/icons/illustrations/tokens.svg b/packages/website/ts/icons/illustrations/tokens.svg
new file mode 100644
index 000000000..966615265
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/tokens.svg
@@ -0,0 +1 @@
+<svg width="249" height="251" viewBox="0 0 152 152" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M192 112c30.376 0 55-24.624 55-55S222.376 2 192 2s-55 24.624-55 55 24.624 55 55 55z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/><path d="M206.4 15.3v13.6H220" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/><path d="M220 28.9v42h-37.3V15.3h23.7L220 28.9zM177.6 98.7V85.1H164" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/><path d="M164 85.1v-42h37.3v55.6h-23.7L164 85.1zM57 113.6c30.376 0 55-24.624 55-55s-24.624-55-55-55-55 24.624-55 55 24.624 55 55 55z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/><path d="M57 102.6c24.3 0 44-19.7 44-44s-19.7-44-44-44-44 19.7-44 44 19.7 44 44 44z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/><path d="M45.4 76.2v1.5h26.7v-9.9h-7.8V36.3h-9.461l-.381.259-8.4 5.7-.658.446V54.63l2.342-1.589 6.058-4.11V67.8h-8.4V76.2z" stroke="#00AE99" stroke-width="3"/><path d="M13 58.3c9.1-1.5 16.1-9.3 16.1-18.9 0-4.3-1.4-8.2-3.8-11.4-7.5 7.9-12.2 18.6-12.3 30.3zM13 58.9c.1 11.8 4.8 22.4 12.3 30.3 2.4-3.2 3.8-7.1 3.8-11.4 0-9.6-7-17.5-16.1-18.9zM101 58.3c-9.1-1.5-16.1-9.3-16.1-18.9 0-4.3 1.4-8.2 3.8-11.4 7.5 7.9 12.2 18.6 12.3 30.3zM101 58.9c-.1 11.8-4.8 22.4-12.3 30.3-2.4-3.2-3.8-7.1-3.8-11.4 0-9.6 7-17.5 16.1-18.9zM57 248.6c30.376 0 55-24.624 55-55s-24.624-55-55-55-55 24.624-55 55 24.624 55 55 55z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/><path d="M57 248.6c30.376 0 55-24.624 55-55s-24.624-55-55-55-55 24.624-55 55 24.624 55 55 55z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/><path d="M62.6 190.8v-32.3h4.6v-9.1H46.8v9.1h4.6v32.3c-10.5 2.5-18.3 12-18.3 23.2 0 13.2 10.7 23.9 23.9 23.9s23.9-10.7 23.9-23.9c0-11.3-7.8-20.7-18.3-23.2z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/><path d="M67.2 149.3H46.8v9.1h20.4v-9.1zM37.1 200.6h39.7M192 248.6c30.376 0 55-24.624 55-55s-24.624-55-55-55-55 24.624-55 55 24.624 55 55 55z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/><path d="M192 149.6l-36.4 52.9H192l.1 35.1 36.3-53H192v-35z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/></svg> \ No newline at end of file
diff --git a/packages/website/ts/icons/illustrations/vcIntroductions.svg b/packages/website/ts/icons/illustrations/vcIntroductions.svg
new file mode 100755
index 000000000..024cadab3
--- /dev/null
+++ b/packages/website/ts/icons/illustrations/vcIntroductions.svg
@@ -0,0 +1,11 @@
+<svg width="90" height="90" viewBox="0 0 90 90" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M2 45C2 68.7578 21.2421 88 45 88C68.7579 88 88 68.7578 88 45C88 21.6448 69.3906 2.63278 46.1793 2.02876C45.7478 2.02876 45.3452 2 44.9137 2C21.2134 2.02876 2 21.2709 2 45Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10" stroke-linejoin="round"/>
+<path d="M45 4L9 28H81L45 4Z" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M40 28L40 70" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M26 28L26 70" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M63 28L63 70" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M17 28L17 70" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M50 28L50 70" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M73 28L73 70" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+<path d="M12 72.5V71H78V72.5M71.5 79H18.5" stroke="#00AE99" stroke-width="3" stroke-miterlimit="10"/>
+</svg>
diff --git a/packages/website/ts/icons/logo-with-type.svg b/packages/website/ts/icons/logo-with-type.svg
new file mode 100644
index 000000000..25abf149e
--- /dev/null
+++ b/packages/website/ts/icons/logo-with-type.svg
@@ -0,0 +1 @@
+<svg width="81" height="40" viewBox="0 0 81 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.402 25.28l3.105-3.212-3.86-5.209-4.915-6.954A19.904 19.904 0 0 0 0 20c0 6.1 2.732 11.562 7.04 15.23l6.239-4.408a12.796 12.796 0 0 1-4.877-5.541zM14.72 8.402l3.212 3.105 5.209-3.86 6.954-4.915A19.904 19.904 0 0 0 20 0C13.9 0 8.438 2.732 4.77 7.04l4.408 6.239a12.795 12.795 0 0 1 5.541-4.877zM28.493 17.932l3.86 5.209 4.915 6.954A19.904 19.904 0 0 0 40 20c0-6.1-2.732-11.562-7.04-15.23L26.72 9.178a12.796 12.796 0 0 1 4.877 5.541l-3.105 3.213zM35.23 32.96l-4.408-6.239a12.795 12.795 0 0 1-5.541 4.877l-3.213-3.105-5.209 3.86-6.954 4.915A19.904 19.904 0 0 0 20 40c6.1 0 11.562-2.732 15.23-7.04z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M51.726 19.689c0-6.471 2.704-9.689 6.912-9.689 4.19 0 6.947 3.27 6.947 9.689 0 6.418-2.758 9.671-6.947 9.671-4.19 0-6.912-3.253-6.912-9.671zm6.894-7.59c-3.04 0-4.543 2.815-4.543 7.607 0 2.256.336 4.005.972 5.282l5.975-12.085c-.69-.542-1.485-.804-2.404-.804zm-2.351 14.428c.672.507 1.45.77 2.369.77 3.04 0 4.578-2.834 4.578-7.59 0-2.204-.318-3.936-.972-5.247l-5.975 12.067zm24.377-10.93l-3.853 6.47L81 29.027h-2.581l-3.377-5.63h-.954l-3.447 5.63h-2.51l4.224-6.872-3.8-6.559h2.44l3.11 5.334h.973l3.182-5.334h2.386z" fill="#fff"/></svg> \ No newline at end of file
diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx
index 96e7184f8..45054772c 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -4,12 +4,8 @@ import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom';
import { MetaTags } from 'ts/components/meta_tags';
-import { About } from 'ts/containers/about';
import { DocsHome } from 'ts/containers/docs_home';
import { FAQ } from 'ts/containers/faq';
-import { Jobs } from 'ts/containers/jobs';
-import { Landing } from 'ts/containers/landing';
-import { LaunchKit } from 'ts/containers/launch_kit';
import { NotFound } from 'ts/containers/not_found';
import { Wiki } from 'ts/containers/wiki';
import { createLazyComponent } from 'ts/lazy_component';
@@ -19,6 +15,18 @@ import { store } from 'ts/redux/store';
import { WebsiteLegacyPaths, WebsitePaths } from 'ts/types';
import { muiTheme } from 'ts/utils/mui_theme';
+// Next (new website) routes. We should rename them later
+import { NextAboutJobs } from 'ts/pages/about/jobs';
+import { NextAboutMission } from 'ts/pages/about/mission';
+import { NextAboutPress } from 'ts/pages/about/press';
+import { NextAboutTeam } from 'ts/pages/about/team';
+import { NextEcosystem } from 'ts/pages/ecosystem';
+import { Next0xInstant } from 'ts/pages/instant';
+import { NextLanding } from 'ts/pages/landing';
+import { NextLaunchKit } from 'ts/pages/launch_kit';
+import { NextMarketMaker } from 'ts/pages/market_maker';
+import { NextWhy } from 'ts/pages/why';
+
// Check if we've introduced an update that requires us to clear the tradeHistory local storage entries
tradeHistoryStorage.clearIfRequired();
trackedTokenStorage.clearIfRequired();
@@ -40,6 +48,9 @@ const LazyZeroExJSDocumentation = createLazyComponent('Documentation', async ()
const LazyContractWrappersDocumentation = createLazyComponent('Documentation', async () =>
import(/* webpackChunkName: "contractWrapperDocs" */ 'ts/containers/contract_wrappers_documentation'),
);
+const LazyMigrationsDocumentation = createLazyComponent('Documentation', async () =>
+ import(/* webpackChunkName: "migrationsDocs" */ 'ts/containers/migrations_documentation'),
+);
const LazyOrderWatcherDocumentation = createLazyComponent('Documentation', async () =>
import(/* webpackChunkName: "orderWatcherDocs" */ 'ts/containers/order_watcher_documentation'),
);
@@ -86,14 +97,34 @@ render(
<Provider store={store}>
<div>
<Switch>
- <Route exact={true} path="/" component={Landing as any} />
+ {/* Next (new site) routes */}
+ <Route exact={true} path="/" component={NextLanding as any} />
+ <Route exact={true} path={WebsitePaths.Why} component={NextWhy as any} />
+ <Route
+ exact={true}
+ path={WebsitePaths.MarketMaker}
+ component={NextMarketMaker as any}
+ />
+ <Route exact={true} path={WebsitePaths.Instant} component={Next0xInstant as any} />
+ <Route exact={true} path={WebsitePaths.LaunchKit} component={NextLaunchKit as any} />
+ <Route exact={true} path={WebsitePaths.Ecosystem} component={NextEcosystem as any} />
+ <Route
+ exact={true}
+ path={WebsitePaths.AboutMission}
+ component={NextAboutMission as any}
+ />
+ <Route exact={true} path={WebsitePaths.AboutTeam} component={NextAboutTeam as any} />
+ <Route exact={true} path={WebsitePaths.AboutPress} component={NextAboutPress as any} />
+ <Route exact={true} path={WebsitePaths.AboutJobs} component={NextAboutJobs as any} />
+ {/*
+ Note(ez): We remove/replace all old routes with next routes
+ once we're ready to put a ring on it. for now let's keep em there for reference
+ */}
<Redirect from="/otc" to={`${WebsitePaths.Portal}`} />
- <Route path={WebsitePaths.LaunchKit} component={LaunchKit as any} />
- <Route path={WebsitePaths.Careers} component={Jobs as any} />
<Route path={WebsitePaths.Portal} component={LazyPortal} />
<Route path={WebsitePaths.FAQ} component={FAQ as any} />
- <Route path={WebsitePaths.About} component={About as any} />
<Route path={WebsitePaths.Wiki} component={Wiki as any} />
+
<Route
path={`${WebsitePaths.ZeroExJs}/:version?`}
component={LazyZeroExJSDocumentation}
@@ -103,6 +134,10 @@ render(
component={LazyContractWrappersDocumentation}
/>
<Route
+ path={`${WebsitePaths.Migrations}/:version?`}
+ component={LazyMigrationsDocumentation}
+ />
+ <Route
path={`${WebsitePaths.OrderWatcher}/:version?`}
component={LazyOrderWatcherDocumentation}
/>
@@ -157,7 +192,8 @@ render(
path={`${WebsiteLegacyPaths.Deployer}/:version?`}
component={LazySolCompilerDocumentation}
/>
- <Route path={WebsiteLegacyPaths.Jobs} component={Jobs as any} />
+ <Redirect from={WebsiteLegacyPaths.Jobs} to={WebsitePaths.AboutJobs} />
+ <Redirect from={WebsitePaths.Careers} to={WebsitePaths.AboutJobs} />
<Route component={NotFound as any} />
</Switch>
</div>
diff --git a/packages/website/ts/pages/about/about.tsx b/packages/website/ts/pages/about/about.tsx
deleted file mode 100644
index dfe8926b0..000000000
--- a/packages/website/ts/pages/about/about.tsx
+++ /dev/null
@@ -1,413 +0,0 @@
-import { colors, Link, Styles } from '@0x/react-shared';
-import * as _ from 'lodash';
-import * as React from 'react';
-import * as DocumentTitle from 'react-document-title';
-import { Footer } from 'ts/components/footer';
-import { TopBar } from 'ts/components/top_bar/top_bar';
-import { Profile } from 'ts/pages/about/profile';
-import { Dispatcher } from 'ts/redux/dispatcher';
-import { ProfileInfo, WebsitePaths } from 'ts/types';
-import { Translate } from 'ts/utils/translate';
-import { utils } from 'ts/utils/utils';
-
-const teamRow1: ProfileInfo[] = [
- {
- name: 'Will Warren',
- title: 'Co-founder & CEO',
- description: `Smart contract R&D. Previously applied physics at Los Alamos \
- Nat Lab. Mechanical engineering at UC San Diego. PhD dropout.`,
- image: '/images/team/will.jpg',
- linkedIn: 'https://www.linkedin.com/in/will-warren-92aab62b/',
- github: 'https://github.com/willwarren89',
- medium: 'https://medium.com/@willwarren89',
- },
- {
- name: 'Amir Bandeali',
- title: 'Co-founder & CTO',
- description: `Smart contract R&D. Previously fixed income trader at DRW. \
- Finance at University of Illinois, Urbana-Champaign.`,
- image: '/images/team/amir.png',
- linkedIn: 'https://www.linkedin.com/in/abandeali1/',
- github: 'https://github.com/abandeali1',
- medium: 'https://medium.com/@abandeali1',
- },
- {
- name: 'Fabio Berger',
- title: 'Senior Engineer',
- description: `Full-stack blockchain engineer. Previously software engineer \
- at Airtable and founder of WealthLift. Computer Science at Duke.`,
- image: '/images/team/fabio.jpg',
- linkedIn: 'https://www.linkedin.com/in/fabio-berger-03ab261a/',
- github: 'https://github.com/fabioberger',
- medium: 'https://medium.com/@fabioberger',
- },
-];
-
-const teamRow2: ProfileInfo[] = [
- {
- name: 'Alex Xu',
- title: 'Director of Operations',
- description: `Strategy and operations. Previously digital marketing at Google \
- and vendor management at Amazon. Economics at UC San Diego.`,
- image: '/images/team/alex.jpg',
- linkedIn: 'https://www.linkedin.com/in/alex-xu/',
- github: '',
- medium: 'https://medium.com/@aqxu',
- },
- {
- name: 'Leonid Logvinov',
- title: 'Engineer',
- description: `Full-stack blockchain engineer. Previously blockchain engineer \
- at Neufund. Computer Science at University of Warsaw.`,
- image: '/images/team/leonid.png',
- linkedIn: 'https://www.linkedin.com/in/leonidlogvinov/',
- github: 'https://github.com/LogvinovLeon',
- medium: 'https://medium.com/@Logvinov',
- },
- {
- name: 'Ben Burns',
- title: 'Designer',
- description: `Product, motion, and graphic designer. Previously designer \
- at Airtable and Apple. Digital Design at University of Cincinnati.`,
- image: '/images/team/ben.jpg',
- linkedIn: 'https://www.linkedin.com/in/ben-burns-30170478/',
- github: '',
- medium: '',
- },
-];
-
-const teamRow3: ProfileInfo[] = [
- {
- name: 'Brandon Millman',
- title: 'Senior Engineer',
- description: `Full-stack engineer. Previously senior software engineer at \
- Twitter. Computer Science and Electrical Engineering at Duke.`,
- image: '/images/team/brandon.png',
- linkedIn: 'https://www.linkedin.com/in/brandon-millman-b093a022/',
- github: 'https://github.com/BMillman19',
- medium: 'https://medium.com/@bchillman',
- },
- {
- name: 'Tom Schmidt',
- title: 'Product Manager',
- description: `Previously engineering at Apple, product management at Facebook and Instagram. Computer Science at Stanford.`,
- image: '/images/team/tom.jpg',
- linkedIn: 'https://www.linkedin.com/in/tomhschmidt/',
- github: 'https://github.com/tomhschmidt',
- medium: '',
- },
- {
- name: 'Jacob Evans',
- title: 'Ecosystem Engineer',
- description: `Previously software engineer at Qantas and RSA Security.`,
- image: '/images/team/jacob.jpg',
- linkedIn: 'https://www.linkedin.com/in/dekzter/',
- github: 'https://github.com/dekz',
- medium: '',
- },
-];
-
-const teamRow4: ProfileInfo[] = [
- {
- name: 'Blake Henderson',
- title: 'Operations Associate',
- description: `Operations and Analytics. Previously analytics at LinkedIn. Economics at UC San Diego.`,
- image: '/images/team/blake.jpg',
- linkedIn: 'https://www.linkedin.com/in/blakerhenderson/',
- github: '',
- medium: '',
- },
- {
- name: 'Zack Skelly',
- title: 'Lead Recruiter',
- description: `Talent. Previously first recruiter at Heap, recruiting at Dropbox and Google. English Rhetoric and Composition at Pepperdine.`,
- image: '/images/team/zach.png',
- linkedIn: 'https://www.linkedin.com/in/zackaryskelly/',
- github: '',
- medium: '',
- },
- {
- name: 'Greg Hysen',
- title: 'Blockchain Engineer',
- description: `Smart contract R&D. Previously lead distributed systems engineer at Hivemapper. Computer Science at University of Waterloo.`,
- image: '/images/team/greg.jpeg',
- linkedIn: 'https://www.linkedin.com/in/gregory-hysen-71741463/',
- github: 'https://github.com/hysz',
- medium: '',
- },
-];
-
-const teamRow5: ProfileInfo[] = [
- {
- name: 'Remco Bloemen',
- title: 'Technical Fellow',
- description: `Previously cofounder at Neufund and Coblue. Part III at Cambridge. PhD dropout at Twente Business School.`,
- image: '/images/team/remco.jpeg',
- linkedIn: 'https://www.linkedin.com/in/remcobloemen/',
- github: 'http://github.com/recmo',
- medium: '',
- },
- {
- name: 'Francesco Agosti',
- title: 'Engineer',
- description: `Full-stack engineer. Previously senior software engineer at Yelp. Computer Science at Duke.`,
- image: 'images/team/fragosti.png',
- linkedIn: 'https://www.linkedin.com/in/fragosti/',
- github: 'http://github.com/fragosti',
- },
- {
- name: 'Mel Oberto',
- title: 'Office Ops / Executive Assistant',
- description: `Daily Operations. Previously People Operations Associate at Heap. Marketing and MBA at Sacred Heart University.`,
- image: 'images/team/mel.png',
- linkedIn: 'https://www.linkedin.com/in/melanieoberto',
- },
-];
-
-const teamRow6: ProfileInfo[] = [
- {
- name: 'Alex Browne',
- title: 'Engineer in Residence',
- description: `Full-stack blockchain engineer. Previously at Plaid. Open source guru and footgun dismantler. Computer Science and Electrical Engineering at Duke.`,
- image: 'images/team/alexbrowne.png',
- linkedIn: 'https://www.linkedin.com/in/stephenalexbrowne/',
- github: 'http://github.com/albrow',
- },
- {
- name: 'Peter Zeitz',
- title: 'Research Fellow',
- description: `Researching decentralized governance. Previously Assistant Professor of Economics at National University of Singapore Business School. PhD in Economics at UCLA.`,
- image: 'images/team/peter.jpg',
- linkedIn: 'https://www.linkedin.com/in/peter-z-7b9595163/',
- },
- {
- name: 'Chris Kalani',
- title: 'Director of Design',
- description: `Previously founded Wake (acquired by InVision). Early Facebook product designer.`,
- image: 'images/team/chris.png',
- linkedIn: 'https://www.linkedin.com/in/chriskalani/',
- github: 'https://github.com/chriskalani',
- },
-];
-
-const teamRow7: ProfileInfo[] = [
- {
- name: 'Clay Robbins',
- title: 'Ecosystem Development Lead',
- description: `Growth & Business Development. Previously product and partnerships at Square. Economics at Dartmouth College.`,
- image: 'images/team/clay.png',
- linkedIn: 'https://www.linkedin.com/in/robbinsclay/',
- },
- {
- name: 'Matt Taylor',
- title: 'Marketing Lead',
- description: `Growth & Marketing. Previously marketing at Abra and Square. Economics and Philosophy at Claremont McKenna College.`,
- image: 'images/team/matt.jpg',
- linkedIn: 'https://www.linkedin.com/in/mattytay/',
- },
- {
- name: 'Eugene Aumson',
- title: 'Engineer',
- description: `Developer Experience. Previously senior software engineer in foreign exchange applications at Bloomberg LP.`,
- image: 'images/team/gene.jpg',
- linkedIn: 'https://www.linkedin.com/in/aumson/',
- github: 'https://github.com/feuGeneA',
- },
-];
-
-const teamRow8: ProfileInfo[] = [
- {
- name: 'Weijie Wu',
- title: 'Research Fellow',
- description: `Researching decentralized governance. Previously Researcher at Huawei and Assistant Professor at Shanghai Jiao Tong University. PhD in Computer Science at The Chinese University of Hong Kong.`,
- image: 'images/team/weijie.png',
- linkedIn: 'https://www.linkedin.com/in/weijiewu/',
- },
- {
- name: 'Rahul Singireddy',
- title: 'Relayer Success Manager',
- description: `Previously community at Zeppelin, growth at Dharma, and cryptocurrency contributor at Forbes. Symbolic Systems at Stanford.`,
- image: 'images/team/rahul.png',
- linkedIn: 'https://www.linkedin.com/in/rahul-singireddy-3037908a/',
- },
- {
- name: 'Jason Somensatto',
- title: 'Strategic Legal Counsel',
- description: `Legal. Previously head of blockchain and crypto practice at Orrick. JD from George Washington University and undergrad at UVA.`,
- image: 'images/team/jason.png',
- linkedIn: 'https://www.linkedin.com/in/jasonsomensatto/',
- },
-];
-
-const teamRow9: ProfileInfo[] = [
- {
- name: 'Steve Klebanoff',
- title: 'Senior Engineer',
- description: ` Full-stack engineer. Previously Staff Software Engineer at AppFolio. Computer Science & Cognitive Psychology at Northeastern University.`,
- image: 'images/team/steve.png',
- linkedIn: 'https://www.linkedin.com/in/steveklebanoff/',
- github: 'https://github.com/steveklebanoff',
- },
-];
-
-const advisors1: ProfileInfo[] = [
- {
- name: 'Fred Ehrsam',
- description: 'Co-founder of Coinbase. Previously FX trader at Goldman Sachs.',
- image: '/images/advisors/fred.jpg',
- linkedIn: 'https://www.linkedin.com/in/fredehrsam/',
- medium: 'https://medium.com/@FEhrsam',
- twitter: 'https://twitter.com/FEhrsam',
- },
- {
- name: 'Olaf Carlson-Wee',
- image: '/images/advisors/olaf.png',
- description: 'Founder of Polychain Capital. First hire at Coinbase. Angel investor.',
- linkedIn: 'https://www.linkedin.com/in/olafcw/',
- angellist: 'https://angel.co/olafcw',
- },
- {
- name: 'Joey Krug',
- description: `Co-CIO at Pantera Capital. Founder of Augur. Thiel 20 Under 20 Fellow.`,
- image: '/images/advisors/joey.jpg',
- linkedIn: 'https://www.linkedin.com/in/joeykrug/',
- github: 'https://github.com/joeykrug',
- angellist: 'https://angel.co/joeykrug',
- },
-];
-
-const advisors2: ProfileInfo[] = [
- {
- name: 'Linda Xie',
- description: 'Co-founder of Scalar Capital. Previously PM at Coinbase.',
- image: '/images/advisors/linda.jpg',
- linkedIn: 'https://www.linkedin.com/in/lindaxie/',
- medium: 'https://medium.com/@linda.xie',
- twitter: 'https://twitter.com/ljxie',
- },
- {
- name: 'David Sacks',
- description: 'General Partner at Craft Ventures. Original COO of PayPal. Founder of Yammer.',
- image: '/images/advisors/david.png',
- linkedIn: 'https://www.linkedin.com/in/davidoliversacks/',
- medium: 'https://medium.com/@davidsacks',
- twitter: 'https://twitter.com/DavidSacks',
- },
-];
-
-export interface AboutProps {
- source: string;
- location: Location;
- translate: Translate;
- dispatcher: Dispatcher;
-}
-
-interface AboutState {}
-
-const styles: Styles = {
- header: {
- fontFamily: 'Roboto Mono',
- fontSize: 36,
- color: 'black',
- paddingTop: 110,
- },
- weAreHiring: {
- fontSize: 30,
- color: colors.darkestGrey,
- fontFamily: 'Roboto Mono',
- letterSpacing: 7.5,
- },
-};
-
-export class About extends React.Component<AboutProps, AboutState> {
- public componentDidMount(): void {
- window.scrollTo(0, 0);
- }
- public render(): React.ReactNode {
- return (
- <div style={{ backgroundColor: colors.lightestGrey }}>
- <DocumentTitle title="0x About Us" />
- <TopBar
- blockchainIsLoaded={false}
- location={this.props.location}
- style={{ backgroundColor: colors.lightestGrey }}
- translate={this.props.translate}
- />
- <div id="about" className="mx-auto max-width-4 py4" style={{ color: colors.grey800 }}>
- <div className="mx-auto pb4 sm-px3" style={{ maxWidth: 435 }}>
- <div style={styles.header}>About us:</div>
- <div
- className="pt3"
- style={{
- fontSize: 17,
- color: colors.darkestGrey,
- lineHeight: 1.5,
- }}
- >
- Our team is a globally distributed group with backgrounds in engineering, research, business
- and design. We are passionate about decentralized technology and its potential to act as an
- equalizing force in the world.
- </div>
- </div>
- <div className="pt3 md-px4 lg-px0">
- <div className="clearfix pb3">{this._renderProfiles(teamRow1)}</div>
- <div className="clearfix">{this._renderProfiles(teamRow2)}</div>
- <div className="clearfix">{this._renderProfiles(teamRow3)}</div>
- <div className="clearfix">{this._renderProfiles(teamRow4)}</div>
- <div className="clearfix">{this._renderProfiles(teamRow5)}</div>
- <div className="clearfix">{this._renderProfiles(teamRow6)}</div>
- <div className="clearfix">{this._renderProfiles(teamRow7)}</div>
- <div className="clearfix">{this._renderProfiles(teamRow8)}</div>
- <div className="clearfix">{this._renderProfiles(teamRow9)}</div>
- </div>
- <div className="pt3 pb2">
- <div
- className="pt2 pb3 sm-center md-pl4 lg-pl0 md-ml3"
- style={{
- color: colors.grey,
- fontSize: 24,
- fontFamily: 'Roboto Mono',
- }}
- >
- Advisors:
- </div>
- <div className="clearfix">{this._renderProfiles(advisors1)}</div>
- <div className="clearfix">{this._renderProfiles(advisors2)}</div>
- </div>
- <div className="mx-auto py4 sm-px3" style={{ maxWidth: 308 }}>
- <div className="pb2" style={styles.weAreHiring}>
- WE'RE HIRING
- </div>
- <div
- className="pb4 mb4"
- style={{
- fontSize: 16,
- color: colors.darkestGrey,
- lineHeight: 1.5,
- letterSpacing: '0.5px',
- }}
- >
- We are seeking outstanding candidates to{' '}
- <Link to={WebsitePaths.Careers} textDecoration="underline" fontColor="black">
- join our team
- </Link>
- . We value passion, diversity and unique perspectives.
- </div>
- </div>
- </div>
- <Footer translate={this.props.translate} dispatcher={this.props.dispatcher} />
- </div>
- );
- }
- private _renderProfiles(profiles: ProfileInfo[]): React.ReactNode {
- const numIndiv = profiles.length;
- const colSize = utils.getColSize(numIndiv);
- return _.map(profiles, profile => {
- return (
- <div key={`profile-${profile.name}`}>
- <Profile colSize={colSize} profileInfo={profile} />
- </div>
- );
- });
- }
-}
diff --git a/packages/website/ts/pages/about/jobs.tsx b/packages/website/ts/pages/about/jobs.tsx
new file mode 100644
index 000000000..ee1aa6cef
--- /dev/null
+++ b/packages/website/ts/pages/about/jobs.tsx
@@ -0,0 +1,236 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import DocumentTitle from 'react-document-title';
+import styled from 'styled-components';
+
+import { AboutPageLayout } from 'ts/components/aboutPageLayout';
+import { Link } from 'ts/components/link';
+import { Column, FlexWrap, Section } from 'ts/components/newLayout';
+import { Heading, Paragraph } from 'ts/components/text';
+import { Container } from 'ts/components/ui/container';
+import { colors } from 'ts/style/colors';
+import { WebsiteBackendJobInfo } from 'ts/types';
+import { backendClient } from 'ts/utils/backend_client';
+import { constants } from 'ts/utils/constants';
+
+const OPEN_POSITIONS_HASH = 'positions';
+
+interface PositionProps {
+ title: string;
+ location: string;
+ href: string;
+}
+
+interface PositionItemProps {
+ position: PositionProps;
+}
+
+const Position: React.FunctionComponent<PositionItemProps> = (props: PositionItemProps) => {
+ const { position } = props;
+ return (
+ <PositionWrap>
+ <StyledColumn width="50%">
+ <Container position="relative" top="-3px" paddingRight="12px">
+ <Heading asElement="h3" size="small" fontWeight="400" marginBottom="0">
+ <a href={position.href} target="_blank">
+ {position.title}
+ </a>
+ </Heading>
+ </Container>
+ </StyledColumn>
+
+ <StyledColumn width="30%" padding="0 40px 0 0">
+ <Paragraph isMuted={true} marginBottom="0">
+ {position.location}
+ </Paragraph>
+ </StyledColumn>
+
+ <StyledColumn width="20%">
+ <Paragraph marginBottom="0" textAlign="right" color={colors.brandDark} fontWeight={400}>
+ <Link href={position.href} target="_blank">
+ Apply
+ </Link>
+ </Paragraph>
+ </StyledColumn>
+ </PositionWrap>
+ );
+};
+
+export interface NextAboutJobsProps {}
+interface NextAboutJobsState {
+ jobInfos: WebsiteBackendJobInfo[];
+}
+
+export class NextAboutJobs extends React.Component<NextAboutJobsProps, NextAboutJobsState> {
+ private _isUnmounted: boolean;
+ private static _convertJobInfoToPositionProps(jobInfo: WebsiteBackendJobInfo): PositionProps {
+ return {
+ title: jobInfo.title,
+ location: jobInfo.office,
+ href: jobInfo.url,
+ };
+ }
+ constructor(props: NextAboutJobsProps) {
+ super(props);
+ this.state = {
+ jobInfos: [],
+ };
+ }
+
+ public componentWillMount(): void {
+ // tslint:disable-next-line:no-floating-promises
+ this._fetchJobInfosAsync();
+ }
+ public componentWillUnmount(): void {
+ this._isUnmounted = true;
+ }
+ public render(): React.ReactNode {
+ const positions = this.state.jobInfos.map(jobInfo => NextAboutJobs._convertJobInfoToPositionProps(jobInfo));
+ return (
+ <AboutPageLayout
+ title="Join Us in Our Mission"
+ description={
+ <>
+ <Paragraph size="medium">
+ To create a tokenized world where all value can flow freely.
+ </Paragraph>
+ <Paragraph size="medium">
+ We are growing an ecosystem of businesses and projects by solving difficult challenges to
+ make our technology intuitive, flexible, and accessible to all. Join us in building
+ infrastructure upon which the exchange of all assets will take place.
+ </Paragraph>
+ </>
+ }
+ linkLabel="Our mission and values"
+ href={constants.URL_MISSION_AND_VALUES_BLOG_POST}
+ >
+ <DocumentTitle title="Jobs at 0x" />
+ <Section bgColor="#F3F6F4" isFlex={true} maxWidth="1170px" wrapWidth="100%">
+ <Column maxWidth="442px">
+ <Heading size="medium" marginBottom="30px">
+ Powered by a Diverse, Global Community
+ </Heading>
+
+ <Paragraph>
+ We're a highly technical team with varied backgrounds in engineering, science, business,
+ finance, and research. While the Core Team is headquartered in San Francisco, there are 30+
+ teams building on 0x and hundreds of thousands of participants behind our efforts worldwide.
+ We're passionate about open-source software and decentralized technology's potential to act
+ as an equalizing force in the world.
+ </Paragraph>
+ </Column>
+
+ <Column maxWidth="600px">
+ <ImageWrap>
+ <img src="/images/jobs/map@2x.png" height="365" alt="Map of community" />
+ </ImageWrap>
+ </Column>
+ </Section>
+
+ <Section isFlex={true} maxWidth="1170px" wrapWidth="100%">
+ <Column>
+ <Heading size="medium">Benefits</Heading>
+ </Column>
+
+ <Column maxWidth="826px">
+ <BenefitsList>
+ <li>Comprehensive Insurance</li>
+ <li>Unlimited Vacation</li>
+ <li>Meals and snacks provided daily</li>
+ <li>Flexible hours and liberal work-from-home-policy</li>
+ <li>Supportive of remote working</li>
+ <li>Transportation, phone, and wellness expense</li>
+ <li>Relocation assistance</li>
+ <li>Optional team excursions</li>
+ <li>Competitive salary</li>
+ <li>Cryptocurrency based compensation</li>
+ </BenefitsList>
+ </Column>
+ </Section>
+
+ <Section id={OPEN_POSITIONS_HASH} isFlex={true} maxWidth="1170px" wrapWidth="100%">
+ <Column>
+ <Heading size="medium">
+ Current<br />Openings
+ </Heading>
+ </Column>
+
+ <Column maxWidth="826px">
+ {_.map(positions, (position, index) => (
+ <Position key={`position-${index}`} position={position} />
+ ))}
+ </Column>
+ </Section>
+ </AboutPageLayout>
+ );
+ }
+ private async _fetchJobInfosAsync(): Promise<void> {
+ try {
+ if (!this._isUnmounted) {
+ this.setState({
+ jobInfos: [],
+ });
+ }
+ const jobInfos = await backendClient.getJobInfosAsync();
+ if (!this._isUnmounted) {
+ this.setState({
+ jobInfos,
+ });
+ }
+ } catch (error) {
+ if (!this._isUnmounted) {
+ this.setState({
+ jobInfos: [],
+ });
+ }
+ }
+ }
+}
+
+const BenefitsList = styled.ul`
+ color: #000;
+ font-weight: 300;
+ line-height: 1.444444444;
+ list-style: disc;
+ columns: auto 2;
+ column-gap: 80px;
+
+ li {
+ margin-bottom: 1em;
+ }
+`;
+
+const ImageWrap = styled.figure`
+ @media (min-width: 768px) {
+ height: 600px;
+ padding-left: 60px;
+ display: flex;
+ align-items: flex-end;
+ }
+`;
+
+const StyledColumn = styled(Column)`
+ flex-shrink: 0;
+
+ @media (max-width: 768px) {
+ & + & {
+ margin-top: 15px;
+ }
+ }
+`;
+
+const PositionWrap = styled(FlexWrap)`
+ margin-bottom: 40px;
+ padding-bottom: 30px;
+ position: relative;
+
+ &:after {
+ content: '';
+ width: 100%;
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ height: 1px;
+ background-color: #e3e3e3;
+ }
+`;
diff --git a/packages/website/ts/pages/about/mission.tsx b/packages/website/ts/pages/about/mission.tsx
new file mode 100644
index 000000000..ab8949fae
--- /dev/null
+++ b/packages/website/ts/pages/about/mission.tsx
@@ -0,0 +1,97 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import DocumentTitle from 'react-document-title';
+import styled from 'styled-components';
+
+import { AboutPageLayout } from 'ts/components/aboutPageLayout';
+import { Definition } from 'ts/components/definition';
+import { Image } from 'ts/components/image';
+import { Column, Section } from 'ts/components/newLayout';
+import { Heading } from 'ts/components/text';
+import { constants } from 'ts/utils/constants';
+
+const values = [
+ {
+ title: 'Do The Right Thing',
+ description:
+ 'We acknowledge the broad subjectivity behind doing “the right thing,” and are committed to rigorously exploring its nuance in our decision making. We believe this responsibility drives our decision making above all else, and pledge to act in the best interest of our peers, community, and society as a whole.',
+ icon: 'right-thing',
+ },
+ {
+ title: 'Consistently Ship',
+ description:
+ 'Achieving our mission requires dedication and diligence. We aspire to be an organization that consistently ships. We set high-impact goals that are rooted in data and pride ourselves in consistently outputting outstanding results across the organization.',
+ icon: 'consistently-ship',
+ },
+ {
+ title: 'Focus on Long-term Impact',
+ description:
+ 'We anticipate that over time, awareness of the fundamentally disruptive nature of frictionless global exchange will cause some to see this technology as a threat. There will be setbacks, some will claim that this technology is too disruptive, and we will face adversity. Persistence and a healthy long-term focus will see us through these battles.',
+ icon: 'long-term-impact',
+ },
+];
+
+export const NextAboutMission = () => (
+ <AboutPageLayout
+ title="Creating a tokenized world where all value can flow freely."
+ description="0x is important infrastructure for the emerging crypto economy and enables markets to be created that couldn't have existed before. As more assets become tokenized, public blockchains provide the opportunity to establish a new financial stack that is more efficient, transparent, and equitable than any system in the past."
+ linkLabel="Our mission and values"
+ href={constants.URL_MISSION_AND_VALUES_BLOG_POST}
+ >
+ <DocumentTitle title="Our Mission - 0x" />
+ <Section isFullWidth={true} isPadded={false}>
+ <FullWidthImage>
+ <Image src="/images/about/about-office.png" alt="0x Offices" isCentered={true} />
+ </FullWidthImage>
+ </Section>
+
+ <Section isFlex={true} maxWidth="1170px" wrapWidth="100%">
+ <Column>
+ <Heading size="medium" maxWidth="226px">
+ Core Values
+ </Heading>
+ </Column>
+
+ <Column width="70%" maxWidth="826px">
+ <Column width="100%" maxWidth="800px">
+ {_.map(values, (item, index) => (
+ <StyledDefinition
+ icon={item.icon}
+ title={item.title}
+ description={item.description}
+ isInlineIcon={true}
+ iconSize="large"
+ />
+ ))}
+ </Column>
+ </Column>
+ </Section>
+ </AboutPageLayout>
+);
+
+const StyledDefinition = styled(Definition)`
+ & + & {
+ margin-top: 30px;
+ padding-top: 30px;
+ border-top: 1px solid #eaeaea;
+ }
+`;
+
+const FullWidthImage = styled.figure`
+ width: 100vw;
+ margin-left: calc(50% - 50vw);
+
+ img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ }
+
+ @media (min-width: 768px) {
+ height: 500px;
+ }
+
+ @media (max-width: 768px) {
+ height: 400px;
+ }
+`;
diff --git a/packages/website/ts/pages/about/press.tsx b/packages/website/ts/pages/about/press.tsx
new file mode 100644
index 000000000..03003d656
--- /dev/null
+++ b/packages/website/ts/pages/about/press.tsx
@@ -0,0 +1,94 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import DocumentTitle from 'react-document-title';
+import styled from 'styled-components';
+
+import { AboutPageLayout } from 'ts/components/aboutPageLayout';
+import { Button } from 'ts/components/button';
+import { Column, FlexWrap } from 'ts/components/newLayout';
+import { Paragraph } from 'ts/components/text';
+
+interface HighlightProps {
+ logo: string;
+ title?: string;
+ text: string;
+ href: string;
+}
+
+interface HighlightItemProps {
+ highlight: HighlightProps;
+}
+
+const highlights: HighlightProps[] = [
+ {
+ logo: '/images/press/logo-forbes.png',
+ title: 'Forbes',
+ text:
+ '0x Instant is aiming to aid businesses and developers such as news sites, crypto wallets, dApps or price trackers to monetize or add a new revenue stream to their existing pipeline.',
+ href:
+ 'https://www.forbes.com/sites/rebeccacampbell1/2018/12/06/0x-launches-instant-delivers-an-easy-and-flexible-way-to-buy-crypto-tokens/#bfb73a843561',
+ },
+ {
+ logo: '/images/press/logo-venturebeat.png',
+ title: 'VentureBeat',
+ text: '0x leads the way for ‘tokenization’ of the world, and collectible game items are next',
+ href:
+ 'https://venturebeat.com/2018/09/24/0x-leads-the-way-for-tokenization-of-the-world-and-collectible-game-items-are-next/',
+ },
+ {
+ logo: '/images/press/logo-fortune.png',
+ title: 'Fortune',
+ text:
+ 'In the future, many traditional investments like real estate and corporate shares will come in the form of digital tokens that are bought and transferred on a blockchain.',
+ href: 'http://fortune.com/2018/09/06/0x-harbor-blockchain/',
+ },
+ {
+ logo: '/images/press/logo-techcrunch.png',
+ title: 'TechCrunch',
+ text:
+ '0x allows any developer to quickly build their own decentralized cryptocurrency exchange and decide their own fees.',
+ href: 'https://techcrunch.com/2018/07/16/0x/',
+ },
+];
+
+export const NextAboutPress = () => (
+ <AboutPageLayout
+ title="Press Highlights"
+ description={
+ <>
+ <Paragraph size="medium" marginBottom="60px">
+ Want to write about 0x? <a href="mailto:team@0xproject.com">Get in touch.</a>
+ </Paragraph>
+
+ {_.map(highlights, (highlight, index) => (
+ <Highlight key={`highlight-${index}`} highlight={highlight} />
+ ))}
+ </>
+ }
+ >
+ <DocumentTitle title="Press Highlights - 0x" />
+ </AboutPageLayout>
+);
+
+export const Highlight: React.FunctionComponent<HighlightItemProps> = (props: HighlightItemProps) => {
+ const { highlight } = props;
+ return (
+ <HighlightWrap>
+ <Column>
+ <img src={highlight.logo} alt={highlight.title} />
+ </Column>
+
+ <Column width="60%" maxWidth="560px">
+ <Paragraph isMuted={false}>{highlight.text}</Paragraph>
+ <Button href={highlight.href} isWithArrow={true} isNoBorder={true} target="_blank">
+ Read Article
+ </Button>
+ </Column>
+ </HighlightWrap>
+ );
+};
+
+const HighlightWrap = styled(FlexWrap)`
+ border-top: 1px solid #eaeaea;
+ padding: 30px 0;
+`;
diff --git a/packages/website/ts/pages/about/profile.tsx b/packages/website/ts/pages/about/profile.tsx
deleted file mode 100644
index 2361c6418..000000000
--- a/packages/website/ts/pages/about/profile.tsx
+++ /dev/null
@@ -1,80 +0,0 @@
-import { colors, Styles } from '@0x/react-shared';
-import * as _ from 'lodash';
-import * as React from 'react';
-import { ProfileInfo } from 'ts/types';
-
-const IMAGE_DIMENSION = 149;
-const styles: Styles = {
- subheader: {
- textTransform: 'uppercase',
- fontSize: 32,
- margin: 0,
- },
- imageContainer: {
- width: IMAGE_DIMENSION,
- height: IMAGE_DIMENSION,
- boxShadow: 'rgba(0, 0, 0, 0.19) 2px 5px 10px',
- },
-};
-
-interface ProfileProps {
- colSize: number;
- profileInfo: ProfileInfo;
-}
-
-export const Profile = (props: ProfileProps) => {
- return (
- <div className={`lg-col md-col lg-col-${props.colSize} md-col-6`}>
- <div style={{ maxWidth: 300 }} className="mx-auto lg-px3 md-px3 sm-px4 sm-pb3">
- <div className="circle overflow-hidden mx-auto" style={styles.imageContainer}>
- <img width={IMAGE_DIMENSION} src={props.profileInfo.image} />
- </div>
- <div className="center" style={{ fontSize: 18, fontWeight: 'bold', paddingTop: 20 }}>
- {props.profileInfo.name}
- </div>
- {!_.isUndefined(props.profileInfo.title) && (
- <div
- className="pt1 center"
- style={{
- fontSize: 14,
- fontFamily: 'Roboto Mono',
- color: colors.darkGrey,
- whiteSpace: 'nowrap',
- }}
- >
- {props.profileInfo.title.toUpperCase()}
- </div>
- )}
- <div style={{ minHeight: 60, lineHeight: 1.4 }} className="pt1 pb2 mx-auto lg-h6 md-h6 sm-h5 sm-center">
- {props.profileInfo.description}
- </div>
- <div className="flex pb3 sm-hide xs-hide" style={{ width: 280, opacity: 0.5 }}>
- {renderSocialMediaIcons(props.profileInfo)}
- </div>
- </div>
- </div>
- );
-};
-
-function renderSocialMediaIcons(profileInfo: ProfileInfo): React.ReactNode {
- const icons = [
- renderSocialMediaIcon('zmdi-github-box', profileInfo.github),
- renderSocialMediaIcon('zmdi-linkedin-box', profileInfo.linkedIn),
- renderSocialMediaIcon('zmdi-twitter-box', profileInfo.twitter),
- ];
- return icons;
-}
-
-function renderSocialMediaIcon(iconName: string, url: string): React.ReactNode {
- if (_.isEmpty(url)) {
- return null;
- }
-
- return (
- <div key={url} className="pr1">
- <a href={url} style={{ color: 'inherit' }} target="_blank" className="text-decoration-none">
- <i className={`zmdi ${iconName}`} style={{ ...styles.socalIcon }} />
- </a>
- </div>
- );
-}
diff --git a/packages/website/ts/pages/about/team.tsx b/packages/website/ts/pages/about/team.tsx
new file mode 100644
index 000000000..41d6c2cf8
--- /dev/null
+++ b/packages/website/ts/pages/about/team.tsx
@@ -0,0 +1,286 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import DocumentTitle from 'react-document-title';
+import styled from 'styled-components';
+
+import { colors } from 'ts/style/colors';
+
+import { AboutPageLayout } from 'ts/components/aboutPageLayout';
+import { Column, Section } from 'ts/components/newLayout';
+import { Heading, Paragraph } from 'ts/components/text';
+import { WebsitePaths } from 'ts/types';
+
+interface TeamMember {
+ name: string;
+ title: string;
+ imageUrl?: string;
+}
+
+const team: TeamMember[] = [
+ {
+ imageUrl: '/images/team/willw.jpg',
+ name: 'Will Warren',
+ title: 'co-founder & CEO',
+ },
+ {
+ imageUrl: '/images/team/amirb.jpg',
+ name: 'Amir Bandeali',
+ title: 'Co-founder & CTO',
+ },
+ {
+ imageUrl: '/images/team/fabiob.jpg',
+ name: 'Fabio Berger',
+ title: 'senior engineer',
+ },
+ {
+ imageUrl: '/images/team/alexv.jpg',
+ name: 'Alex Xu',
+ title: 'Director of operations',
+ },
+ {
+ imageUrl: '/images/team/leonidL.jpg',
+ name: 'Leonid Logvinov',
+ title: 'engineer',
+ },
+ {
+ imageUrl: '/images/team/benb.jpg',
+ name: 'Ben Burns',
+ title: 'designer',
+ },
+ {
+ imageUrl: '/images/team/brandonm.jpg',
+ name: 'Brandon Millman',
+ title: 'senior engineer',
+ },
+ {
+ imageUrl: '/images/team/toms.jpg',
+ name: 'Tom Schmidt',
+ title: 'product manager',
+ },
+ {
+ imageUrl: '/images/team/jacobe.jpg',
+ name: 'Jacob Evans',
+ title: 'ecosystem engineer',
+ },
+ {
+ imageUrl: '/images/team/blake.jpg',
+ name: 'Blake Henderson',
+ title: 'ecosystem programs lead',
+ },
+ {
+ imageUrl: '/images/team/zack.jpg',
+ name: 'Zack Skelly',
+ title: 'lead recruiter',
+ },
+ {
+ imageUrl: '/images/team/greg.jpg',
+ name: 'Greg Hysen',
+ title: 'blockchain engineer',
+ },
+ {
+ imageUrl: '/images/team/remcoB.jpg',
+ name: 'Remco Bloemen',
+ title: 'technical fellow',
+ },
+ {
+ imageUrl: '/images/team/francesco.jpg',
+ name: 'Francesco Agosti',
+ title: 'engineer',
+ },
+ {
+ imageUrl: '/images/team/melo.jpg',
+ name: 'Mel Oberto',
+ title: 'people operations associate',
+ },
+ {
+ imageUrl: '/images/team/alexb.jpg',
+ name: 'Alex Browne',
+ title: 'engineer in residence',
+ },
+ {
+ imageUrl: '/images/team/peterz.jpg',
+ name: 'Peter Zeitz',
+ title: 'research fellow',
+ },
+ {
+ imageUrl: '/images/team/chrisk.jpg',
+ name: 'Chris Kalani',
+ title: 'director of design',
+ },
+ {
+ imageUrl: '/images/team/clayr.jpg',
+ name: 'Clay Robbins',
+ title: 'ecosystem development lead',
+ },
+ {
+ imageUrl: '/images/team/mattt.jpg',
+ name: 'Matt Taylor',
+ title: 'marketing lead',
+ },
+ {
+ imageUrl: '/images/team/eugenea.jpg',
+ name: 'Eugene Aumson',
+ title: 'engineer',
+ },
+ {
+ imageUrl: '/images/team/weijew.jpg',
+ name: 'Weijie Wu',
+ title: 'research fellow',
+ },
+ {
+ imageUrl: '/images/team/rahuls.jpg',
+ name: 'Rahul Singireddy',
+ title: 'relayer success manager',
+ },
+ {
+ imageUrl: '/images/team/jasons.jpg',
+ name: 'Jason Somensatto',
+ title: 'strategic legal counsel',
+ },
+ {
+ imageUrl: '/images/team/steveK.jpg',
+ name: 'Steve Klebanoff',
+ title: 'senior engineer',
+ },
+ {
+ imageUrl: '/images/team/xianny.jpg',
+ name: 'Xianny Ng',
+ title: 'engineer',
+ },
+];
+
+const advisors: TeamMember[] = [
+ {
+ imageUrl: '/images/team/advisors/frede.jpg',
+ name: 'Fred Ehrsam',
+ title: 'Advisor',
+ },
+ {
+ imageUrl: '/images/team/advisors/olafc.jpg',
+ name: 'Olaf Carlson-Wee',
+ title: 'Advisor',
+ },
+ {
+ imageUrl: '/images/team/advisors/joeyk.jpg',
+ name: 'Joey Krug',
+ title: 'Advisor',
+ },
+ {
+ imageUrl: '/images/team/advisors/lindax.jpg',
+ name: 'Linda Xie',
+ title: 'Advisor',
+ },
+ {
+ imageUrl: '/images/team/advisors/davids.jpg',
+ name: 'David Sacks',
+ title: 'Advisor',
+ },
+];
+
+export const NextAboutTeam = () => (
+ <AboutPageLayout
+ title="We are a global, growing team"
+ description="We are a distributed team with backgrounds in engineering, academic research, business, and design. The 0x Core Team is passionate about accelerating the adoption decentralized technology and believe in its potential to be an equalizing force in the world. Join us and do the most impactful work of your life."
+ linkLabel="Join the team"
+ to={WebsitePaths.AboutJobs}
+ >
+ <DocumentTitle title="Our Team - 0x" />
+ <Section maxWidth="1170px" wrapWidth="100%" isFlex={true} flexBreakpoint="900px">
+ <Column>
+ <Heading size="medium">0x Team</Heading>
+ </Column>
+
+ <Column width="70%" maxWidth="800px">
+ <StyledGrid>
+ {_.map(team, (info: TeamMember, index: number) => (
+ <Member key={`team-${index}`} name={info.name} title={info.title} imageUrl={info.imageUrl} />
+ ))}
+ </StyledGrid>
+ </Column>
+ </Section>
+
+ <Section bgColor="#F3F6F4" maxWidth="1170px" wrapWidth="100%" flexBreakpoint="900px" isFlex={true}>
+ <Column>
+ <Heading size="medium">Advisors</Heading>
+ </Column>
+
+ <Column width="70%" maxWidth="800px">
+ <StyledGrid>
+ {_.map(advisors, (info: TeamMember, index: number) => (
+ <Member key={`advisor-${index}`} name={info.name} title={info.title} imageUrl={info.imageUrl} />
+ ))}
+ </StyledGrid>
+ </Column>
+ </Section>
+ </AboutPageLayout>
+);
+
+const StyledGrid = styled.div`
+ &:after {
+ content: '';
+ clear: both;
+ }
+`;
+
+const Member = ({ name, title, imageUrl }: TeamMember) => (
+ <StyledMember>
+ <img src={imageUrl} alt={name} />
+ <Name>{name}</Name>
+ <MemberTitle isMuted={0.5} size={14} style={{ textTransform: 'capitalize' }}>
+ {title}
+ </MemberTitle>
+ </StyledMember>
+);
+
+const StyledMember = styled.div`
+ margin-bottom: 10px;
+ float: left;
+ width: calc(50% - 15px);
+ margin-right: 15px;
+
+ @media (max-width: 600px) {
+ &:nth-child(2n + 1) {
+ clear: left;
+ }
+ }
+
+ img,
+ svg {
+ width: 100%;
+ height: auto;
+ object-fit: contain;
+ margin-bottom: 10px;
+ }
+
+ @media (min-width: 600px) {
+ width: calc(33.3333% - 30px);
+ margin-right: 20px;
+
+ &:nth-child(3n + 1) {
+ clear: left;
+ }
+ }
+
+ @media (min-width: 900px) {
+ width: calc(25% - 30px);
+
+ &:nth-child(3n + 1) {
+ clear: none;
+ }
+
+ &:nth-child(4n + 1) {
+ clear: left;
+ }
+ }
+`;
+
+const Name = styled.h3`
+ color: ${colors.textDarkPrimary};
+ font-size: 14px;
+ line-height: 1;
+ margin: 0;
+`;
+
+const MemberTitle = styled(Paragraph)`
+ font-size: 14px;
+`;
diff --git a/packages/website/ts/pages/community.tsx b/packages/website/ts/pages/community.tsx
new file mode 100644
index 000000000..7c02fed82
--- /dev/null
+++ b/packages/website/ts/pages/community.tsx
@@ -0,0 +1,289 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { colors } from 'ts/style/colors';
+
+import { Banner } from 'ts/components/banner';
+import { Button } from 'ts/components/button';
+import { Icon } from 'ts/components/icon';
+import { ModalContact } from 'ts/components/modals/modal_contact';
+import { Column, Section, WrapGrid } from 'ts/components/newLayout';
+import { SiteWrap } from 'ts/components/siteWrap';
+import { Heading, Paragraph } from 'ts/components/text';
+
+interface EventProps {
+ title: string;
+ date: string;
+ signupUrl: string;
+ imageUrl: string;
+}
+
+interface CommunityLinkProps {
+ bgColor: string;
+ title?: string;
+ icon?: string;
+ url: string;
+}
+
+const events: EventProps[] = [
+ {
+ title: '0x London Meetup',
+ date: 'October 20th 2018',
+ imageUrl: '/images/events/london.jpg',
+ signupUrl: '#',
+ },
+ {
+ title: '0x Berlin Meetup',
+ date: 'October 20th 2018',
+ imageUrl: '/images/events/berlin.jpg',
+ signupUrl: '#',
+ },
+ {
+ title: '0x San Francisco Meetup',
+ date: 'October 20th 2018',
+ imageUrl: '/images/events/sf.jpg',
+ signupUrl: '#',
+ },
+];
+const communityLinks: CommunityLinkProps[] = [
+ {
+ bgColor: '#1DA1F2',
+ title: 'Twitter',
+ icon: 'social-twitter',
+ url: 'https://twitter.com/0xProject',
+ },
+ {
+ bgColor: '#FF4500',
+ title: 'Reddit',
+ icon: 'social-reddit',
+ url: 'https://twitter.com/0xProject',
+ },
+ {
+ bgColor: '#7289DA',
+ title: 'Twitter',
+ icon: 'social-discord',
+ url: 'https://twitter.com/0xProject',
+ },
+ {
+ bgColor: '#3B5998',
+ title: 'Facebook',
+ icon: 'social-fb',
+ url: 'https://twitter.com/0xProject',
+ },
+ {
+ bgColor: '#181717',
+ title: 'GitHub',
+ icon: 'social-github',
+ url: 'https://twitter.com/0xProject',
+ },
+ {
+ bgColor: '#003831',
+ title: 'Newsletter',
+ icon: 'social-newsletter',
+ url: 'https://twitter.com/0xProject',
+ },
+];
+
+export class NextCommunity extends React.Component {
+ public state = {
+ isContactModalOpen: false,
+ };
+ public render(): React.ReactNode {
+ return (
+ <SiteWrap theme="light">
+ <Section isTextCentered={true}>
+ <Column>
+ <Heading size="medium" isCentered={true}>
+ Community
+ </Heading>
+ <Paragraph size="medium" isCentered={true} isMuted={true} marginBottom="0">
+ The 0x community is a global, passionate group of crypto developers and enthusiasts. The
+ official channels below provide a great forum for connecting and engaging with the
+ community.
+ </Paragraph>
+ <LinkWrap>
+ <Button to="#" isWithArrow={true} isAccentColor={true}>
+ Join the 0x community
+ </Button>
+ </LinkWrap>
+ </Column>
+ </Section>
+
+ <Section isFullWidth={true}>
+ <WrapGrid
+ isTextCentered={true}
+ isWrapped={true}
+ isFullWidth={false}
+ isCentered={false}
+ maxWidth="1151px"
+ >
+ {_.map(communityLinks, (link: CommunityLinkProps, index: number) => (
+ <CommunityLink
+ key={`cl-${index}`}
+ icon={link.icon}
+ title={link.title}
+ bgColor={link.bgColor}
+ url={link.url}
+ />
+ ))}
+ </WrapGrid>
+ </Section>
+
+ <EventsWrapper
+ bgColor={colors.backgroundLight}
+ isFullWidth={true}
+ isCentered={true}
+ isTextCentered={true}
+ >
+ <Column maxWidth="720px">
+ <Heading size="medium" asElement="h2" isCentered={true} maxWidth="507px" marginBottom="30px">
+ Upcoming Events
+ </Heading>
+ <Paragraph size="medium" isCentered={true} isMuted={true}>
+ 0x meetups happen all over the world on a monthly basis and are hosted by devoted members of
+ the community. Want to host a meetup in your city? Reach out for help finding a venue,
+ connecting with local 0x mentors, and promoting your events.
+ </Paragraph>
+ <LinkWrap>
+ <Button to="#" isWithArrow={true} isAccentColor={true}>
+ Get in Touch
+ </Button>
+ <Button to="#" isWithArrow={true} isAccentColor={true}>
+ Join Newsletter
+ </Button>
+ </LinkWrap>
+ </Column>
+ <WrapGrid
+ isTextCentered={true}
+ isWrapped={true}
+ isFullWidth={false}
+ isCentered={false}
+ maxWidth="1149px"
+ >
+ {_.map(events, (ev: EventProps, index: number) => (
+ <Event
+ key={`event-${index}`}
+ title={ev.title}
+ date={ev.date}
+ signupUrl={ev.signupUrl}
+ imageUrl={ev.imageUrl}
+ />
+ ))}
+ </WrapGrid>
+ </EventsWrapper>
+
+ <Banner
+ heading="Ready to get started?"
+ subline="Dive into our docs, or contact us if needed"
+ mainCta={{ text: 'Get Started', href: '/docs' }}
+ secondaryCta={{ text: 'Get in Touch', onClick: this._onOpenContactModal.bind(this) }}
+ />
+ <ModalContact isOpen={this.state.isContactModalOpen} onDismiss={this._onDismissContactModal} />
+ </SiteWrap>
+ );
+ }
+
+ public _onOpenContactModal = (): void => {
+ this.setState({ isContactModalOpen: true });
+ };
+
+ public _onDismissContactModal = (): void => {
+ this.setState({ isContactModalOpen: false });
+ };
+}
+
+const Event: React.FunctionComponent<EventProps> = (event: EventProps) => (
+ <StyledEvent>
+ <EventIcon name="logo-mark" size={30} margin={0} />
+ <EventImage src={event.imageUrl} alt="" />
+ <EventContent>
+ <Heading color={colors.white} size="small" marginBottom="0">
+ {event.title}
+ </Heading>
+ <Paragraph color={colors.white} isMuted={0.65}>
+ {event.date}
+ </Paragraph>
+ <Button color={colors.white} href={event.signupUrl} isWithArrow={true}>
+ Sign Up
+ </Button>
+ </EventContent>
+ </StyledEvent>
+);
+
+const CommunityLink: React.FunctionComponent<CommunityLinkProps> = (props: CommunityLinkProps) => (
+ <StyledCommunityLink bgColor={props.bgColor} href={props.url}>
+ <CommunityIcon name={props.icon} size={44} margin={0} />
+ <CommunityTitle color={colors.white} isMuted={false} marginBottom="0">
+ {props.title}
+ </CommunityTitle>
+ </StyledCommunityLink>
+);
+
+// Events
+const EventsWrapper = styled(Section)`
+ display: flex;
+ align-items: center;
+ flex-direction: column;
+`;
+
+// Event
+const StyledEvent = styled.div`
+ background-color: ${colors.brandDark};
+ width: calc((100% / 3) - 30px);
+ text-align: left;
+ height: 424px;
+ margin-top: 130px;
+ position: relative;
+`;
+
+const EventIcon = styled(Icon)`
+ position: absolute;
+ top: 30px;
+ left: 30px;
+`;
+
+const EventImage = styled.img`
+ width: 100%;
+ height: 260px;
+ object-fit: cover;
+`;
+
+const EventContent = styled.div`
+ padding: 30px 30px;
+`;
+
+interface StyledCommunityLinkProps {
+ bgColor: string;
+}
+const StyledCommunityLink = styled.a`
+ background-color: ${(props: StyledCommunityLinkProps) => props.bgColor};
+ color: ${colors.white};
+ width: 175px;
+ height: 175px;
+ text-align: center;
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+`;
+
+const CommunityTitle = styled(Paragraph)`
+ font-size: 20px;
+ font-weight: 400;
+`;
+
+const CommunityIcon = styled(Icon)`
+ margin-bottom: 20px;
+`;
+
+// Misc
+const LinkWrap = styled.div`
+ display: inline-flex;
+ margin-top: 60px;
+
+ a + a {
+ margin-left: 60px;
+ }
+`;
diff --git a/packages/website/ts/pages/documentation/developers_page.tsx b/packages/website/ts/pages/documentation/developers_page.tsx
index a84be7bfe..fcca2b6ad 100644
--- a/packages/website/ts/pages/documentation/developers_page.tsx
+++ b/packages/website/ts/pages/documentation/developers_page.tsx
@@ -2,6 +2,7 @@ import { colors, constants as sharedConstants, utils as sharedUtils } from '@0x/
import * as _ from 'lodash';
import * as React from 'react';
import DocumentTitle from 'react-document-title';
+import { Helmet } from 'react-helmet';
import { DocsLogo } from 'ts/components/documentation/docs_logo';
import { DocsTopBar } from 'ts/components/documentation/docs_top_bar';
import { Container } from 'ts/components/ui/container';
@@ -146,6 +147,9 @@ export class DevelopersPage extends React.Component<DevelopersPageProps, Develop
} 50%, ${colors.white} 100%)`}
>
<DocumentTitle title="0x Docs" />
+ <Helmet>
+ <link rel="stylesheet" href="/css/github-gist.css" />
+ </Helmet>
<Container className="flex mx-auto" height="100vh">
<Container
className="sm-hide xs-hide relative"
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index adf2261b5..3ae071774 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -39,6 +39,7 @@ const docIdToSubpackageName: { [id: string]: string } = {
[DocPackages.OrderWatcher]: 'order-watcher',
[DocPackages.EthereumTypes]: 'ethereum-types',
[DocPackages.AssetBuyer]: 'asset-buyer',
+ [DocPackages.Migrations]: 'migrations',
};
export interface DocPageProps {
diff --git a/packages/website/ts/pages/documentation/docs_home.tsx b/packages/website/ts/pages/documentation/docs_home.tsx
index e3328f3fa..fd3932bfa 100644
--- a/packages/website/ts/pages/documentation/docs_home.tsx
+++ b/packages/website/ts/pages/documentation/docs_home.tsx
@@ -44,13 +44,21 @@ const TUTORIALS: TutorialInfo[] = [
to: `${WebsitePaths.Wiki}#Find,-Submit,-Fill-Order-From-Relayer`,
},
},
+ {
+ iconUrl: '/images/developers/tutorials/integrate_0x_instant.svg',
+ description: Key.Integrate0xInstantDescription,
+ link: {
+ title: Key.Integrate0xInstant,
+ to: `${WebsitePaths.Wiki}#Get-Started-With-Instant`,
+ },
+ },
];
const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
[Categories.ZeroExProtocol]: [
{
description:
- 'A library for interacting with the 0x protocol. It is a high level package which combines a number of smaller specific-purpose packages such as [order-utils](https://0xproject.com/docs/order-utils) and [contract-wrappers](https://0xproject.com/docs/contract-wrappers).',
+ 'A library for interacting with the 0x protocol. It is a high level package which combines a number of smaller specific-purpose packages such as [order-utils](https://0x.org/docs/order-utils) and [contract-wrappers](https://0x.org/docs/contract-wrappers).',
link: {
title: '0x.js',
to: WebsitePaths.ZeroExJs,
@@ -92,6 +100,14 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
},
},
{
+ description: 'A Python Standard Relayer API client',
+ link: {
+ title: '0x-sra-client.py',
+ to: 'https://pypi.org/project/0x-sra-client/',
+ shouldOpenInNewTab: true,
+ },
+ },
+ {
description:
'An http & websocket client for interacting with relayers that have implemented the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api)',
link: {
@@ -109,6 +125,14 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
},
{
description:
+ "A package to deploy the 0x protocol's system of smart contracts to the testnet of your choice",
+ link: {
+ title: '@0x/migrations',
+ to: WebsitePaths.Migrations,
+ },
+ },
+ {
+ description:
'A collection of 0x-related JSON-schemas (incl. SRA request/response schemas, 0x order message format schema, etc...)',
link: {
title: '@0x/json-schemas',
@@ -133,6 +157,23 @@ const CATEGORY_TO_PACKAGES: ObjectMap<Package[]> = {
},
{
description:
+ 'A tiny utility library for getting known deployed contract addresses for a particular network.',
+ link: {
+ title: '@0x/contract-addresses',
+ to: 'https://www.npmjs.com/package/@0x/contract-addresses',
+ shouldOpenInNewTab: true,
+ },
+ },
+ {
+ description: 'Smart contract compilation artifacts for the latest version of the 0x protocol.',
+ link: {
+ title: '@0x/contract-artifacts',
+ to: 'https://www.npmjs.com/package/@0x/contract-artifacts',
+ shouldOpenInNewTab: true,
+ },
+ },
+ {
+ description:
'Contains the Standard Relayer API OpenAPI Spec. The package distributes both a javascript object version and a json version.',
link: {
title: '@0x/sra-spec',
diff --git a/packages/website/ts/pages/ecosystem.tsx b/packages/website/ts/pages/ecosystem.tsx
new file mode 100644
index 000000000..8e367b21f
--- /dev/null
+++ b/packages/website/ts/pages/ecosystem.tsx
@@ -0,0 +1,128 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import DocumentTitle from 'react-document-title';
+import styled from 'styled-components';
+
+import { colors } from 'ts/style/colors';
+
+import { Button } from 'ts/components/button';
+import { Icon } from 'ts/components/icon';
+import { Column, Section, WrapGrid } from 'ts/components/newLayout';
+import { SiteWrap } from 'ts/components/siteWrap';
+import { Heading, Paragraph } from 'ts/components/text';
+import { constants } from 'ts/utils/constants';
+
+interface BenefitProps {
+ title: string;
+ icon: string;
+ description: string;
+}
+
+const benefits: BenefitProps[] = [
+ {
+ icon: 'milestoneGrants',
+ title: 'Milestone Grants',
+ description:
+ 'Receive non-dilutive capital ranging from $10,000 to $100,000, with grant sizes awarded based on the quality of your team, vision, execution, and community involvement.',
+ },
+ {
+ icon: 'vcIntroductions',
+ title: 'VC Introductions',
+ description: 'Connect with leading venture capital firms that could participate in your next funding round.',
+ },
+ {
+ icon: 'techSupport',
+ title: 'Technical Support',
+ description: 'Receive ongoing technical assistance from knowledgeable and responsive 0x developers.',
+ },
+ {
+ icon: 'recruitingSupport',
+ title: 'Recruiting Assistance',
+ description: 'Grow your team by accessing an exclusive pool of top engineering and business operations talent.',
+ },
+ {
+ icon: 'eficientDesign',
+ title: 'Marketing and Design Help',
+ description:
+ 'Get strategic advice on product positioning, customer acquisition, and UI/UX design that can impact the growth of your business.',
+ },
+ {
+ icon: 'legalResources',
+ title: 'Legal Resources',
+ description: 'Access important legal resources that will help you navigate the regulatory landscape.',
+ },
+];
+
+export const NextEcosystem = () => (
+ <SiteWrap theme="light">
+ <DocumentTitle title="Ecosystem Acceleration Program: Jumpstart your Business on 0x" />
+ <Section isTextCentered={true}>
+ <Column>
+ <Heading size="medium" isCentered={true}>
+ Jumpstart your Business on 0x
+ </Heading>
+ <Paragraph size="medium" isCentered={true} isMuted={true} marginBottom="0">
+ The Ecosystem Acceleration Program gives teams access to a variety of services including funding,
+ dedicated technical support, and recruiting assistance. We created the Ecosystem Acceleration
+ Program to bolster the expansion of both infrastructure projects and relayers building on 0x.
+ </Paragraph>
+ <LinkWrap>
+ <Button
+ href={constants.URL_ECOSYSTEM_APPLY}
+ isWithArrow={true}
+ isAccentColor={true}
+ shouldUseAnchorTag={true}
+ >
+ Apply now
+ </Button>
+ <Button
+ href={constants.URL_ECOSYSTEM_BLOG_POST}
+ isWithArrow={true}
+ isAccentColor={true}
+ shouldUseAnchorTag={true}
+ target="_blank"
+ >
+ Learn More
+ </Button>
+ </LinkWrap>
+ </Column>
+ </Section>
+
+ <Section bgColor={colors.backgroundLight} isFullWidth={true}>
+ <Column>
+ <Heading
+ size={34}
+ fontWeight="400"
+ asElement="h2"
+ isCentered={true}
+ maxWidth="507px"
+ marginBottom="70px"
+ >
+ Join a vibrant ecosystem of projects in the 0x Network.
+ </Heading>
+ </Column>
+ <WrapGrid isTextCentered={true} isWrapped={true} isFullWidth={true}>
+ {_.map(benefits, (benefit: BenefitProps, index) => (
+ <Column key={`benefit-${index}`} width="33%" padding="0 45px 30px">
+ <Icon name={benefit.icon} size="medium" margin={[0, 0, 'small', 0]} />
+ <Heading color={colors.textDarkPrimary} size="small" marginBottom="10px" isCentered={true}>
+ {benefit.title}
+ </Heading>
+ <Paragraph isMuted={true} isCentered={true}>
+ {benefit.description}
+ </Paragraph>
+ </Column>
+ ))}
+ </WrapGrid>
+ </Section>
+ </SiteWrap>
+);
+
+const LinkWrap = styled.div`
+ display: inline-flex;
+ margin-top: 60px;
+
+ a + a {
+ margin-left: 60px;
+ }
+`;
diff --git a/packages/website/ts/pages/faq/faq.tsx b/packages/website/ts/pages/faq/faq.tsx
index 10d91bae8..8cde7224e 100644
--- a/packages/website/ts/pages/faq/faq.tsx
+++ b/packages/website/ts/pages/faq/faq.tsx
@@ -2,7 +2,7 @@ import { colors, Styles } from '@0x/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
import * as DocumentTitle from 'react-document-title';
-import { Footer } from 'ts/components/footer';
+import { Footer } from 'ts/components/old_footer';
import { TopBar } from 'ts/components/top_bar/top_bar';
import { Question } from 'ts/pages/faq/question';
import { Dispatcher } from 'ts/redux/dispatcher';
@@ -379,7 +379,7 @@ const sections: FAQSection[] = [
<div>
Join our{' '}
<a href={constants.URL_ZEROEX_CHAT} target="_blank">
- Rocket.chat
+ Discord
</a>! As an open source project, 0x will rely on a worldwide community of passionate developers
to contribute proposals, ideas and code.
</div>
diff --git a/packages/website/ts/pages/instant.tsx b/packages/website/ts/pages/instant.tsx
new file mode 100644
index 000000000..b97bb35a4
--- /dev/null
+++ b/packages/website/ts/pages/instant.tsx
@@ -0,0 +1,261 @@
+import { utils as sharedUtils } from '@0x/react-shared';
+import * as _ from 'lodash';
+import * as React from 'react';
+import DocumentTitle from 'react-document-title';
+import styled, { keyframes } from 'styled-components';
+
+import { Banner } from 'ts/components/banner';
+import { Button } from 'ts/components/button';
+import { Definition } from 'ts/components/definition';
+import { Hero } from 'ts/components/hero';
+import { Section, SectionProps } from 'ts/components/newLayout';
+import { SiteWrap } from 'ts/components/siteWrap';
+import { Heading, Paragraph } from 'ts/components/text';
+import { Configurator } from 'ts/pages/instant/configurator';
+import { colors } from 'ts/style/colors';
+import { WebsitePaths } from 'ts/types';
+import { utils } from 'ts/utils/utils';
+
+import { ModalContact } from '../components/modals/modal_contact';
+
+const CONFIGURATOR_MIN_WIDTH_PX = 1050;
+
+export const getStartedClick = () => {
+ if (window.innerWidth < CONFIGURATOR_MIN_WIDTH_PX) {
+ utils.openUrl(`${WebsitePaths.Wiki}#Get-Started-With-Instant`);
+ } else {
+ sharedUtils.setUrlHash('configurator');
+ sharedUtils.scrollToHash('configurator', '');
+ }
+};
+
+const featuresData = [
+ {
+ title: 'Support ERC-20 and ERC-721 tokens',
+ icon: 'supportForAllEthereumStandards-large',
+ description:
+ 'Seamlessly integrate token purchasing into your product experience by offering digital assets ranging from in-game items to stablecoins.',
+ links: [
+ {
+ label: 'Get Started',
+ onClick: getStartedClick,
+ shouldUseAnchorTag: true,
+ },
+ {
+ label: 'Explore the Docs',
+ url: `${WebsitePaths.Wiki}#Get-Started-With-Instant`,
+ },
+ ],
+ },
+ {
+ title: 'Generate revenue for your business',
+ icon: 'generateRevenueForYourBusiness-large',
+ description:
+ 'With just a few lines of code, you can earn up to 5% in affiliate fees on every transaction from your crypto wallet or dApp.',
+ links: [
+ {
+ label: 'Learn about affiliate fees',
+ url: `${WebsitePaths.Wiki}#Learn-About-Affiliate-Fees`,
+ },
+ ],
+ },
+ {
+ title: 'Easy and flexible integration',
+ icon: 'flexibleIntegration0xInstant',
+ description:
+ 'Use our out-of-the-box design or customize the user interface by integrating via the AssetBuyer engine.. You can also tap into 0x networked liquidity or choose your own liquidity pool.',
+ links: [
+ {
+ label: 'Explore AssetBuyer',
+ url: `${WebsitePaths.Docs}/asset-buyer`,
+ },
+ ],
+ },
+];
+
+interface Props {
+ theme: {
+ bgColor: string;
+ textColor: string;
+ linkColor: string;
+ };
+}
+
+export class Next0xInstant extends React.Component<Props> {
+ public state = {
+ isContactModalOpen: false,
+ };
+ public render(): React.ReactNode {
+ return (
+ <SiteWrap>
+ <DocumentTitle title="0x Instant: Quick and secure crypto purchasing" />
+ <Hero
+ title="Introducing 0x Instant"
+ description="A free and flexible way to offer simple crypto purchasing in any app or website"
+ actions={<Button onClick={getStartedClick}>Get Started</Button>}
+ />
+
+ <Section isFullWidth={true} isPadded={false} padding="30px 0">
+ <MarqueeWrap>
+ <div>
+ {[...Array(18)].map((item, index) => (
+ <Card key={`card-${index}`} index={index}>
+ <img src={`/images/0x-instant/widget-${index % 6 + 1}.png`} />
+ </Card>
+ ))}
+ </div>
+ </MarqueeWrap>
+ </Section>
+
+ <Section>
+ {_.map(featuresData, (item, index) => (
+ <Definition
+ key={`definition-${index}`}
+ icon={item.icon}
+ title={item.title}
+ description={item.description}
+ isInlineIcon={true}
+ iconSize={240}
+ actions={item.links}
+ />
+ ))}
+ </Section>
+
+ <ConfiguratorSection
+ id="configurator"
+ maxWidth="1386px"
+ padding="0 58px 70px"
+ bgColor={colors.backgroundDark}
+ >
+ <Heading>0x Instant Configurator</Heading>
+ <Configurator />
+ </ConfiguratorSection>
+
+ <Banner
+ heading="Need more flexibility?"
+ subline="Dive into our docs, or contact us if needed"
+ mainCta={{ text: 'Explore the Docs', href: `${WebsitePaths.Wiki}#Get-Started-With-Instant` }}
+ secondaryCta={{ text: 'Get in Touch', onClick: this._onOpenContactModal.bind(this) }}
+ />
+ <ModalContact isOpen={this.state.isContactModalOpen} onDismiss={this._onDismissContactModal} />
+
+ <Section maxWidth="1170px" isPadded={false} padding="60px 0">
+ <Paragraph size="small" isMuted={0.5}>
+ Disclaimer: The laws and regulations applicable to the use and exchange of digital assets and
+ blockchain-native tokens, including through any software developed using the licensed work
+ created by ZeroEx Intl. (the “Work”), vary by jurisdiction. As set forth in the Apache License,
+ Version 2.0 applicable to the Work, developers are “solely responsible for determining the
+ appropriateness of using or redistributing the Work,” which includes responsibility for ensuring
+ compliance with any such applicable laws and regulations.
+ </Paragraph>
+ <Paragraph size="small" isMuted={0.5}>
+ See the Apache License, Version 2.0 for the specific language governing all applicable
+ permissions and limitations.
+ </Paragraph>
+ </Section>
+ </SiteWrap>
+ );
+ }
+
+ public _onOpenContactModal = (): void => {
+ this.setState({ isContactModalOpen: true });
+ };
+
+ public _onDismissContactModal = (): void => {
+ this.setState({ isContactModalOpen: false });
+ };
+}
+
+// scroll animation calc is simply (imageWidth * totalRepetitions) / 2
+// img width is 370px
+const scroll = keyframes`
+ 0% { transform: translate3d(-2220px, 0, 0) }
+ 100% { transform: translate3d(-4440px, 0, 0) }
+`;
+
+const scrollMobile = keyframes`
+ 0% { transform: translate3d(0, 0, 0) }
+ 100% { transform: translate3d(-1800px, 0, 0) }
+`;
+
+const fadeUp = keyframes`
+ 0% {
+ opacity: 0;
+ transform: translateY(50px);
+ }
+ 100% {
+ opacity: 1;
+ transform: translateY(0px);
+ }
+`;
+
+const ConfiguratorSection =
+ styled(Section) <
+ SectionProps >
+ `
+ @media (max-width: ${CONFIGURATOR_MIN_WIDTH_PX}px) {
+ display: none;
+ }
+`;
+
+// width = 370 * 12
+// mobile width = 300
+const MarqueeWrap = styled.div`
+ width: 100vw;
+ height: 514px;
+ padding-bottom: 60px;
+
+ @media (max-width: 768px) {
+ width: calc(100% + 60px);
+ margin-left: -30px;
+ overflow: hidden;
+ }
+
+ > div {
+ height: auto;
+ display: flex;
+ will-change: transform;
+ transform: translate3d(-2220px, 0, 0);
+ }
+
+ @media (min-width: 768px) {
+ > div {
+ width: 6660px;
+ animation: ${scroll} 70s linear infinite;
+ }
+ }
+
+ @media (max-width: 768px) {
+ > div {
+ width: 5400px;
+ animation: ${scrollMobile} 70s linear infinite;
+ }
+ }
+`;
+
+const Card =
+ styled.div <
+ { index: number } >
+ `
+ opacity: 0;
+ flex-shrink: 0;
+ transform: translateY(10px);
+ will-change: opacity, transform;
+ animation: ${fadeUp} 0.75s ${props => `${props.index * 0.05}s`} forwards;
+
+ img {
+ height: auto;
+ }
+
+ @media (min-width: 768px) {
+ img {
+ width: 370px;
+ }
+ }
+
+ @media (max-width: 768px) {
+ img {
+ width: 300px;
+ }
+ }
+`;
diff --git a/packages/website/ts/pages/instant/code_demo.tsx b/packages/website/ts/pages/instant/code_demo.tsx
new file mode 100644
index 000000000..c59f148b8
--- /dev/null
+++ b/packages/website/ts/pages/instant/code_demo.tsx
@@ -0,0 +1,183 @@
+import * as React from 'react';
+import * as CopyToClipboard from 'react-copy-to-clipboard';
+import SyntaxHighlighter from 'react-syntax-highlighter';
+
+import { Button } from 'ts/components/button';
+import { Container } from 'ts/components/ui/container';
+import { styled } from 'ts/style/theme';
+import { zIndex } from 'ts/style/z_index';
+
+const CustomPre = styled.pre`
+ margin: 0px;
+ line-height: 24px;
+ overflow: scroll;
+ width: 100%;
+ height: 100%;
+ max-height: 800px;
+ border-radius: 4px;
+ code {
+ background-color: inherit !important;
+ border-radius: 0px;
+ font-family: 'Roboto Mono', sans-serif;
+ border: none;
+ }
+ code:first-of-type {
+ background-color: #060d0d !important;
+ color: #999;
+ min-height: 100%;
+ text-align: center;
+ margin-right: 15px;
+ line-height: 25px;
+ padding: 10px 7px !important;
+ }
+ code:last-of-type {
+ position: relative;
+ top: 10px;
+ top: 0;
+ padding-top: 11px;
+ display: inline-block;
+ line-height: 25px;
+ }
+`;
+
+const customStyle = {
+ 'hljs-comment': {
+ color: '#7e7887',
+ },
+ 'hljs-quote': {
+ color: '#7e7887',
+ },
+ 'hljs-variable': {
+ color: '#be4678',
+ },
+ 'hljs-template-variable': {
+ color: '#be4678',
+ },
+ 'hljs-attribute': {
+ color: '#be4678',
+ },
+ 'hljs-regexp': {
+ color: '#be4678',
+ },
+ 'hljs-link': {
+ color: '#be4678',
+ },
+ 'hljs-tag': {
+ color: '#61f5ff',
+ },
+ 'hljs-name': {
+ color: '#61f5ff',
+ },
+ 'hljs-selector-id': {
+ color: '#be4678',
+ },
+ 'hljs-selector-class': {
+ color: '#be4678',
+ },
+ 'hljs-number': {
+ color: '#c994ff',
+ },
+ 'hljs-meta': {
+ color: '#61f5ff',
+ },
+ 'hljs-built_in': {
+ color: '#aa573c',
+ },
+ 'hljs-builtin-name': {
+ color: '#aa573c',
+ },
+ 'hljs-literal': {
+ color: '#aa573c',
+ },
+ 'hljs-type': {
+ color: '#aa573c',
+ },
+ 'hljs-params': {
+ color: '#aa573c',
+ },
+ 'hljs-string': {
+ color: '#bcff88',
+ },
+ 'hljs-symbol': {
+ color: '#2a9292',
+ },
+ 'hljs-bullet': {
+ color: '#2a9292',
+ },
+ 'hljs-title': {
+ color: '#576ddb',
+ },
+ 'hljs-section': {
+ color: '#576ddb',
+ },
+ 'hljs-keyword': {
+ color: '#955ae7',
+ },
+ 'hljs-selector-tag': {
+ color: '#955ae7',
+ },
+ 'hljs-deletion': {
+ color: '#19171c',
+ display: 'inline-block',
+ width: '100%',
+ backgroundColor: '#be4678',
+ },
+ 'hljs-addition': {
+ color: '#19171c',
+ display: 'inline-block',
+ width: '100%',
+ backgroundColor: '#2a9292',
+ },
+ hljs: {
+ display: 'block',
+ overflowX: 'hidden',
+ background: '#1B2625',
+ color: 'white',
+ fontSize: '12px',
+ },
+ 'hljs-emphasis': {
+ fontStyle: 'italic',
+ },
+ 'hljs-strong': {
+ fontWeight: 'bold',
+ },
+};
+
+export interface CodeDemoProps {
+ children: string;
+}
+
+export interface CodeDemoState {
+ didCopyCode: boolean;
+}
+
+export class CodeDemo extends React.Component<CodeDemoProps, CodeDemoState> {
+ public state: CodeDemoState = {
+ didCopyCode: false,
+ };
+ public render(): React.ReactNode {
+ const copyButtonText = this.state.didCopyCode ? 'Copied!' : 'Copy';
+ return (
+ <Container position="relative" height="100%">
+ <Container position="absolute" top="10px" right="10px" zIndex={zIndex.overlay - 1}>
+ <CopyToClipboard text={this.props.children} onCopy={this._handleCopyClick}>
+ <StyledButton>{copyButtonText}</StyledButton>
+ </CopyToClipboard>
+ </Container>
+ <SyntaxHighlighter language="html" style={customStyle} showLineNumbers={true} PreTag={CustomPre}>
+ {this.props.children}
+ </SyntaxHighlighter>
+ </Container>
+ );
+ }
+ private readonly _handleCopyClick = () => {
+ this.setState({ didCopyCode: true });
+ };
+}
+
+const StyledButton = styled(Button)`
+ border-radius: 4px;
+ font-size: 15px;
+ font-weight: 400;
+ padding: 9px 21px 7px;
+`;
diff --git a/packages/website/ts/pages/instant/config_generator.tsx b/packages/website/ts/pages/instant/config_generator.tsx
new file mode 100644
index 000000000..e43d47119
--- /dev/null
+++ b/packages/website/ts/pages/instant/config_generator.tsx
@@ -0,0 +1,332 @@
+import { StandardRelayerAPIOrderProvider } from '@0x/asset-buyer';
+import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
+import { assetDataUtils } from '@0x/order-utils';
+import { ObjectMap } from '@0x/types';
+import * as _ from 'lodash';
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { CheckMark } from 'ts/components/ui/check_mark';
+import { Container } from 'ts/components/ui/container';
+import { MultiSelect } from 'ts/components/ui/multi_select';
+import { Spinner } from 'ts/components/ui/spinner';
+import { Text } from 'ts/components/ui/text';
+import { ConfigGeneratorAddressInput } from 'ts/pages/instant/config_generator_address_input';
+import { FeePercentageSlider } from 'ts/pages/instant/fee_percentage_slider';
+import { colors } from 'ts/style/colors';
+import { WebsitePaths } from 'ts/types';
+import { constants } from 'ts/utils/constants';
+
+// New components
+import { Heading } from 'ts/components/text';
+import { Select, SelectItemConfig } from 'ts/pages/instant/select';
+
+import { assetMetaDataMap } from '../../../../instant/src/data/asset_meta_data_map';
+import { ERC20AssetMetaData, ZeroExInstantBaseConfig } from '../../../../instant/src/types';
+
+export interface ConfigGeneratorProps {
+ value: ZeroExInstantBaseConfig;
+ onConfigChange: (config: ZeroExInstantBaseConfig) => void;
+}
+
+export interface ConfigGeneratorState {
+ isLoadingAvailableTokens: boolean;
+ // Address to token info
+ availableTokens?: ObjectMap<ERC20AssetMetaData>;
+}
+
+const SRA_ENDPOINTS = ['https://api.radarrelay.com/0x/v2/', 'https://sra.bamboorelay.com/0x/v2/'];
+
+export class ConfigGenerator extends React.Component<ConfigGeneratorProps, ConfigGeneratorState> {
+ public state: ConfigGeneratorState = {
+ isLoadingAvailableTokens: true,
+ };
+ public componentDidMount(): void {
+ // tslint:disable-next-line:no-floating-promises
+ this._setAvailableAssetsFromOrderProvider();
+ }
+ public componentDidUpdate(prevProps: ConfigGeneratorProps): void {
+ if (prevProps.value.orderSource !== this.props.value.orderSource) {
+ // tslint:disable-next-line:no-floating-promises
+ this._setAvailableAssetsFromOrderProvider();
+ const newConfig: ZeroExInstantBaseConfig = {
+ ...this.props.value,
+ availableAssetDatas: undefined,
+ };
+ this.props.onConfigChange(newConfig);
+ }
+ }
+ public render(): React.ReactNode {
+ const { value } = this.props;
+ if (!_.isString(value.orderSource)) {
+ throw new Error('ConfigGenerator component only supports string values as an orderSource.');
+ }
+ return (
+ <Container minWidth="350px">
+ <ConfigGeneratorSection title="Liquidity Source">
+ <Select
+ shouldIncludeEmpty={false}
+ id=""
+ value={value.orderSource}
+ items={this._generateItems()}
+ onChange={this._handleSRASelection.bind(this)}
+ />
+ </ConfigGeneratorSection>
+ <ConfigGeneratorSection {...this._getTokenSelectorProps()}>
+ {this._renderTokenMultiSelectOrSpinner()}
+ </ConfigGeneratorSection>
+ <ConfigGeneratorSection title="Transaction fee ETH address" marginBottom="10px" isOptional={true}>
+ <ConfigGeneratorAddressInput
+ value={value.affiliateInfo ? value.affiliateInfo.feeRecipient : ''}
+ onChange={this._handleAffiliateAddressChange}
+ />
+ </ConfigGeneratorSection>
+ <ConfigGeneratorSection
+ title="Fee percentage"
+ actionText="Learn more"
+ onActionTextClick={this._handleAffiliatePercentageLearnMoreClick}
+ >
+ <FeePercentageSlider
+ value={value.affiliateInfo.feePercentage}
+ onChange={this._handleAffiliatePercentageChange}
+ isDisabled={
+ _.isUndefined(value.affiliateInfo) ||
+ _.isUndefined(value.affiliateInfo.feeRecipient) ||
+ _.isEmpty(value.affiliateInfo.feeRecipient)
+ }
+ />
+ </ConfigGeneratorSection>
+ </Container>
+ );
+ }
+ private readonly _getTokenSelectorProps = (): ConfigGeneratorSectionProps => {
+ if (_.isEmpty(this.state.availableTokens)) {
+ return {
+ title: 'What tokens can users buy?',
+ };
+ }
+ if (_.isUndefined(this.props.value.availableAssetDatas)) {
+ return {
+ title: 'What tokens can users buy?',
+ actionText: 'Unselect All',
+ onActionTextClick: this._handleUnselectAllClick,
+ };
+ }
+ return {
+ title: 'What tokens can users buy?',
+ actionText: 'Select All',
+ onActionTextClick: this._handleSelectAllClick,
+ };
+ };
+ private readonly _generateItems = (): SelectItemConfig[] => {
+ return _.map(SRA_ENDPOINTS, endpoint => ({
+ label: endpoint,
+ value: endpoint,
+ onClick: this._handleSRASelection.bind(this, endpoint),
+ }));
+ };
+ private readonly _handleAffiliatePercentageLearnMoreClick = (): void => {
+ window.open(`${WebsitePaths.Wiki}#Learn-About-Affiliate-Fees`, '_blank');
+ };
+ private readonly _handleSRASelection = (event: React.ChangeEvent<HTMLSelectElement>) => {
+ const sraEndpoint = event.target.value;
+ const newConfig: ZeroExInstantBaseConfig = {
+ ...this.props.value,
+ orderSource: sraEndpoint,
+ };
+ this.props.onConfigChange(newConfig);
+ };
+ private readonly _handleAffiliateAddressChange = (address: string, isValid: boolean) => {
+ const oldConfig: ZeroExInstantBaseConfig = this.props.value;
+ const newConfig: ZeroExInstantBaseConfig = {
+ ...oldConfig,
+ affiliateInfo: {
+ feeRecipient: address,
+ feePercentage: oldConfig.affiliateInfo.feePercentage,
+ },
+ };
+ this.props.onConfigChange(newConfig);
+ };
+ private readonly _handleAffiliatePercentageChange = (value: number) => {
+ const oldConfig: ZeroExInstantBaseConfig = this.props.value;
+ const newConfig: ZeroExInstantBaseConfig = {
+ ...oldConfig,
+ affiliateInfo: {
+ feeRecipient: oldConfig.affiliateInfo.feeRecipient,
+ feePercentage: value,
+ },
+ };
+ this.props.onConfigChange(newConfig);
+ };
+ private readonly _handleSelectAllClick = () => {
+ const newConfig: ZeroExInstantBaseConfig = {
+ ...this.props.value,
+ availableAssetDatas: undefined,
+ };
+ this.props.onConfigChange(newConfig);
+ };
+ private readonly _handleUnselectAllClick = () => {
+ const newConfig: ZeroExInstantBaseConfig = {
+ ...this.props.value,
+ availableAssetDatas: [],
+ };
+ this.props.onConfigChange(newConfig);
+ };
+ private readonly _handleTokenClick = (assetData: string) => {
+ const { value } = this.props;
+ let newAvailableAssetDatas: string[] = [];
+ const allKnownAssetDatas = _.keys(this.state.availableTokens);
+ const availableAssetDatas = value.availableAssetDatas;
+ if (_.isUndefined(availableAssetDatas)) {
+ // It being undefined means it's all tokens.
+ newAvailableAssetDatas = _.pull(allKnownAssetDatas, assetData);
+ } else if (!_.includes(availableAssetDatas, assetData)) {
+ // Add it
+ newAvailableAssetDatas = [...availableAssetDatas, assetData];
+ if (newAvailableAssetDatas.length === allKnownAssetDatas.length) {
+ // If all tokens are manually selected, just show none.
+ newAvailableAssetDatas = undefined;
+ }
+ } else {
+ // Remove it
+ newAvailableAssetDatas = _.pull(availableAssetDatas, assetData);
+ }
+ const newConfig: ZeroExInstantBaseConfig = {
+ ...this.props.value,
+ availableAssetDatas: newAvailableAssetDatas,
+ };
+ this.props.onConfigChange(newConfig);
+ };
+ private readonly _setAvailableAssetsFromOrderProvider = async (): Promise<void> => {
+ const { value } = this.props;
+ if (!_.isUndefined(value.orderSource) && _.isString(value.orderSource)) {
+ this.setState({ isLoadingAvailableTokens: true });
+ const networkId = constants.NETWORK_ID_MAINNET;
+ const sraOrderProvider = new StandardRelayerAPIOrderProvider(value.orderSource, networkId);
+ const etherTokenAddress = getContractAddressesForNetworkOrThrow(networkId).etherToken;
+ const etherTokenAssetData = assetDataUtils.encodeERC20AssetData(etherTokenAddress);
+ const assetDatas = await sraOrderProvider.getAvailableMakerAssetDatasAsync(etherTokenAssetData);
+ const availableTokens = _.reduce(
+ assetDatas,
+ (acc, assetData) => {
+ const metaDataIfExists = assetMetaDataMap[assetData] as ERC20AssetMetaData;
+ if (metaDataIfExists) {
+ acc[assetData] = metaDataIfExists;
+ }
+ return acc;
+ },
+ {} as ObjectMap<ERC20AssetMetaData>,
+ );
+ this.setState({ availableTokens, isLoadingAvailableTokens: false });
+ }
+ };
+ private readonly _renderTokenMultiSelectOrSpinner = (): React.ReactNode => {
+ const { value } = this.props;
+ const { availableTokens, isLoadingAvailableTokens } = this.state;
+ const multiSelectHeight = '200px';
+ if (isLoadingAvailableTokens) {
+ return (
+ <Container
+ className="flex flex-column items-center justify-center"
+ height={multiSelectHeight}
+ backgroundColor={colors.white}
+ borderRadius="4px"
+ width="100%"
+ >
+ <Container position="relative" left="12px" marginBottom="20px">
+ <Spinner />
+ </Container>
+ <Text fontSize="16px">Loading...</Text>
+ </Container>
+ );
+ }
+ const availableAssetDatas = _.keys(availableTokens);
+ if (availableAssetDatas.length === 0) {
+ return (
+ <Container
+ className="flex flex-column items-center justify-center"
+ height={multiSelectHeight}
+ backgroundColor={colors.white}
+ borderRadius="4px"
+ width="100%"
+ >
+ <Text fontSize="16px">No tokens available. Try another endpoint?</Text>
+ </Container>
+ );
+ }
+ const items = _.map(_.keys(availableTokens), assetData => {
+ const metaData = availableTokens[assetData];
+ return {
+ value: assetData,
+ renderItemContent: (isSelected: boolean) => (
+ <Container className="flex items-center">
+ <Container marginRight="10px">
+ <CheckMark isChecked={isSelected} color={colors.brandLight} />
+ </Container>
+ <CheckboxText isSelected={isSelected}>
+ {metaData.symbol.toUpperCase()} — {metaData.name}
+ </CheckboxText>
+ </Container>
+ ),
+ onClick: this._handleTokenClick.bind(this, assetData),
+ };
+ });
+ return <MultiSelect items={items} selectedValues={value.availableAssetDatas} height={multiSelectHeight} />;
+ };
+}
+
+export interface ConfigGeneratorSectionProps {
+ title: string;
+ actionText?: string;
+ onActionTextClick?: () => void;
+ isOptional?: boolean;
+ marginBottom?: string;
+}
+
+export const ConfigGeneratorSection: React.StatelessComponent<ConfigGeneratorSectionProps> = ({
+ title,
+ actionText,
+ onActionTextClick,
+ isOptional,
+ marginBottom,
+ children,
+}) => (
+ <Container marginBottom={marginBottom}>
+ <Container marginBottom="10px" className="flex justify-between items-center">
+ <Heading size="small" marginBottom="0" isFlex={true}>
+ <span>{title}</span>
+ {isOptional && <OptionalText> Optional</OptionalText>}
+ </Heading>
+ {actionText && <OptionalAction onClick={onActionTextClick}>{actionText}</OptionalAction>}
+ </Container>
+ {children}
+ </Container>
+);
+
+ConfigGeneratorSection.defaultProps = {
+ marginBottom: '30px',
+};
+
+const OptionalText = styled.span`
+ display: inline;
+ font-size: 14px;
+ color: #999999;
+ flex-shrink: 0;
+`;
+
+interface CheckboxTextProps {
+ isSelected?: boolean;
+}
+
+const CheckboxText =
+ styled.span <
+ CheckboxTextProps >
+ `
+ font-size: 14px;
+ line-height: 18px;
+ color: ${props => (props.isSelected ? colors.brandDark : '#666666')}
+`;
+
+const OptionalAction = styled(OptionalText)`
+ cursor: pointer;
+`;
diff --git a/packages/website/ts/pages/instant/config_generator_address_input.tsx b/packages/website/ts/pages/instant/config_generator_address_input.tsx
new file mode 100644
index 000000000..890e39da6
--- /dev/null
+++ b/packages/website/ts/pages/instant/config_generator_address_input.tsx
@@ -0,0 +1,84 @@
+import { addressUtils } from '@0x/utils';
+import * as _ from 'lodash';
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { colors } from 'ts/style/colors';
+
+import { Container } from 'ts/components/ui/container';
+
+import { Paragraph } from 'ts/components/text';
+
+export interface ConfigGeneratorAddressInputProps {
+ value?: string;
+ onChange?: (address: string, isValid: boolean) => void;
+}
+
+export interface ConfigGeneratorAddressInputState {
+ errMsg: string;
+}
+
+export interface InputProps {
+ className?: string;
+ value?: string;
+ width?: string;
+ fontSize?: string;
+ fontColor?: string;
+ padding?: string;
+ placeholderColor?: string;
+ placeholder?: string;
+ backgroundColor?: string;
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
+}
+
+export class ConfigGeneratorAddressInput extends React.Component<
+ ConfigGeneratorAddressInputProps,
+ ConfigGeneratorAddressInputState
+> {
+ public state = {
+ errMsg: '',
+ };
+ public render(): React.ReactNode {
+ const { errMsg } = this.state;
+ const hasError = !_.isEmpty(errMsg);
+ return (
+ <Container height="80px">
+ <Input value={this.props.value} onChange={this._handleChange} placeholder="0xe99...aa8da4" />
+ <Container marginTop="5px" isHidden={!hasError} height="25px">
+ <Paragraph size="small" isNoMargin={true}>
+ {errMsg}
+ </Paragraph>
+ </Container>
+ </Container>
+ );
+ }
+
+ private readonly _handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
+ const address = event.target.value;
+ const isValidAddress = addressUtils.isAddress(address.toLowerCase()) || address === '';
+ const errMsg = isValidAddress ? '' : 'Please enter a valid Ethereum address';
+ this.setState({
+ errMsg,
+ });
+ this.props.onChange(address, isValidAddress);
+ };
+}
+
+const PlainInput: React.StatelessComponent<InputProps> = ({ value, className, placeholder, onChange }) => (
+ <input className={className} value={value} onChange={onChange} placeholder={placeholder} />
+);
+
+export const Input = styled(PlainInput)`
+ background-color: ${colors.white};
+ color: ${colors.textDarkSecondary};
+ font-size: 1rem;
+ width: 100%;
+ padding: 16px 20px 18px;
+ border-radius: 4px;
+ border: 1px solid transparent;
+ outline: none;
+ &::placeholder {
+ color: #333333;
+ opacity: 0.5;
+ }
+`;
diff --git a/packages/website/ts/pages/instant/configurator.tsx b/packages/website/ts/pages/instant/configurator.tsx
new file mode 100644
index 000000000..a63e1752e
--- /dev/null
+++ b/packages/website/ts/pages/instant/configurator.tsx
@@ -0,0 +1,104 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import styled from 'styled-components';
+
+import { CodeDemo } from 'ts/pages/instant/code_demo';
+import { ConfigGenerator } from 'ts/pages/instant/config_generator';
+
+import { Link } from 'ts/components/link';
+import { Column, FlexWrap } from 'ts/components/newLayout';
+import { Heading } from 'ts/components/text';
+import { WebsitePaths } from 'ts/types';
+
+import { ZeroExInstantBaseConfig } from '../../../../instant/src/types';
+
+export interface ConfiguratorState {
+ instantConfig: ZeroExInstantBaseConfig;
+}
+
+export class Configurator extends React.Component {
+ public state: ConfiguratorState = {
+ instantConfig: {
+ orderSource: 'https://api.radarrelay.com/0x/v2/',
+ availableAssetDatas: undefined,
+ affiliateInfo: {
+ feeRecipient: '',
+ feePercentage: 0,
+ },
+ },
+ };
+ public render(): React.ReactNode {
+ const codeToDisplay = this._generateCodeDemoCode();
+ return (
+ <FlexWrap isFlex={true}>
+ <Column width="442px" padding="0 70px 0 0">
+ <ConfigGenerator value={this.state.instantConfig} onConfigChange={this._handleConfigChange} />
+ </Column>
+ <Column width="100%">
+ <HeadingWrapper>
+ <Heading size="small" marginBottom="15px">
+ Code Snippet
+ </Heading>
+ <Link href={`${WebsitePaths.Wiki}#Get-Started-With-Instant`} isBlock={true} target="_blank">
+ Explore the Docs
+ </Link>
+ </HeadingWrapper>
+ <CodeDemo key={codeToDisplay}>{codeToDisplay}</CodeDemo>
+ </Column>
+ </FlexWrap>
+ );
+ }
+ private readonly _handleConfigChange = (config: ZeroExInstantBaseConfig) => {
+ this.setState({
+ instantConfig: config,
+ });
+ };
+ private readonly _generateCodeDemoCode = (): string => {
+ const { instantConfig } = this.state;
+ return `<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <script src="https://instant.0x.org/instant.js"></script>
+ </head>
+ <body>
+ <script>
+ zeroExInstant.render({
+ orderSource: '${instantConfig.orderSource}',${
+ !_.isUndefined(instantConfig.affiliateInfo) && instantConfig.affiliateInfo.feeRecipient
+ ? `\n affiliateInfo: {
+ feeRecipient: '${instantConfig.affiliateInfo.feeRecipient.toLowerCase()}',
+ feePercentage: ${instantConfig.affiliateInfo.feePercentage}
+ },`
+ : ''
+ }${
+ !_.isUndefined(instantConfig.availableAssetDatas)
+ ? `\n availableAssetDatas: ${this._renderAvailableAssetDatasString(
+ instantConfig.availableAssetDatas,
+ )}`
+ : ''
+ }
+ }, 'body');
+ </script>
+ </body>
+ </html>`;
+ };
+ private readonly _renderAvailableAssetDatasString = (availableAssetDatas: string[]): string => {
+ const stringAvailableAssetDatas = availableAssetDatas.map(assetData => `'${assetData}'`);
+ if (availableAssetDatas.length < 2) {
+ return `[${stringAvailableAssetDatas.join(', ')}]`;
+ }
+ return `[\n ${stringAvailableAssetDatas.join(
+ ', \n ',
+ )}\n ]`;
+ };
+}
+
+const HeadingWrapper = styled.div`
+ display: flex;
+ justify-content: space-between;
+
+ a {
+ transform: translateY(-8px);
+ }
+`;
diff --git a/packages/website/ts/pages/instant/fee_percentage_slider.tsx b/packages/website/ts/pages/instant/fee_percentage_slider.tsx
new file mode 100644
index 000000000..c4d9f908f
--- /dev/null
+++ b/packages/website/ts/pages/instant/fee_percentage_slider.tsx
@@ -0,0 +1,80 @@
+import Slider from 'rc-slider';
+import * as React from 'react';
+import styled from 'styled-components';
+import 'ts/pages/instant/rc-slider.css';
+
+import { colors } from 'ts/style/colors';
+
+const SliderWithTooltip = (Slider as any).createSliderWithTooltip(Slider);
+// tslint:disable-next-line:no-unused-expression
+
+export interface FeePercentageSliderProps {
+ value: number;
+ isDisabled?: boolean;
+ onChange: (value: number) => void;
+}
+
+export class FeePercentageSlider extends React.Component<FeePercentageSliderProps> {
+ public render(): React.ReactNode {
+ return (
+ <StyledSlider
+ min={0}
+ max={0.05}
+ step={0.0025}
+ value={this.props.value}
+ disabled={this.props.isDisabled}
+ onChange={this.props.onChange}
+ tipFormatter={this._feePercentageSliderFormatter}
+ tipProps={{ placement: 'bottom', overlayStyle: { backgroundColor: '#fff', borderRadius: '4px' } }}
+ trackStyle={{
+ backgroundColor: colors.brandLight,
+ }}
+ railStyle={{
+ backgroundColor: 'rgba(255, 255, 255, 0.2)',
+ }}
+ handleStyle={{
+ border: 'none',
+ boxShadow: 'none',
+ }}
+ activeDotStyle={{
+ boxShadow: 'none',
+ border: 'none',
+ }}
+ />
+ );
+ }
+ private readonly _feePercentageSliderFormatter = (value: number): React.ReactNode => {
+ return <Text>{`${(value * 100).toFixed(2)}%`}</Text>;
+ };
+}
+
+const StyledSlider = styled(SliderWithTooltip)`
+ .rc-slider-tooltip__inner {
+ box-shadow: none !important;
+ background-color: ${colors.white} !important;
+ border-radius: 4px !important;
+ padding: 3px 12px !important;
+ height: auto !important;
+ position: relative;
+ top: 7px;
+ &:after {
+ border: solid transparent;
+ content: ' ';
+ height: 0;
+ width: 0;
+ position: absolute;
+ pointer-events: none;
+ border-width: 6px;
+ bottom: 100%;
+ left: 100%;
+ border-bottom-color: ${colors.white};
+ margin-left: -60%;
+ }
+ }
+`;
+
+const Text = styled.span`
+ color: #000000;
+ font-size: 12px;
+ line-height: 18px;
+`;
diff --git a/packages/website/ts/pages/instant/rc-slider.css b/packages/website/ts/pages/instant/rc-slider.css
new file mode 100644
index 000000000..63038324e
--- /dev/null
+++ b/packages/website/ts/pages/instant/rc-slider.css
@@ -0,0 +1,295 @@
+.rc-slider {
+ position: relative;
+ height: 14px;
+ padding: 5px 0;
+ width: 100%;
+ border-radius: 6px;
+ -ms-touch-action: none;
+ touch-action: none;
+ box-sizing: border-box;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+}
+
+.rc-slider * {
+ box-sizing: border-box;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+}
+
+.rc-slider-rail {
+ position: absolute;
+ width: 100%;
+ background-color: #e9e9e9;
+ height: 4px;
+ border-radius: 6px;
+}
+
+.rc-slider-track {
+ position: absolute;
+ left: 0;
+ height: 4px;
+ border-radius: 6px;
+ background-color: #abe2fb;
+}
+
+.rc-slider-handle {
+ position: absolute;
+ margin-left: -7px;
+ margin-top: -5px;
+ width: 14px;
+ height: 14px;
+ cursor: pointer;
+ cursor: -webkit-grab;
+ cursor: grab;
+ border-radius: 50%;
+ border: solid 2px #96dbfa;
+ background-color: #fff;
+ -ms-touch-action: pan-x;
+ touch-action: pan-x;
+}
+
+.rc-slider-handle:focus {
+ border-color: #57c5f7;
+ box-shadow: 0 0 0 5px #96dbfa;
+ outline: none;
+}
+
+.rc-slider-handle-click-focused:focus {
+ border-color: #96dbfa;
+ box-shadow: unset;
+}
+
+.rc-slider-handle:hover {
+ border-color: #57c5f7;
+}
+
+.rc-slider-handle:active {
+ border-color: #57c5f7;
+ box-shadow: 0 0 5px #57c5f7;
+ cursor: -webkit-grabbing;
+ cursor: grabbing;
+}
+
+.rc-slider-mark {
+ position: absolute;
+ top: 18px;
+ left: 0;
+ width: 100%;
+ font-size: 12px;
+}
+
+.rc-slider-mark-text {
+ position: absolute;
+ display: inline-block;
+ vertical-align: middle;
+ text-align: center;
+ cursor: pointer;
+ color: #999;
+}
+
+.rc-slider-mark-text-active {
+ color: #666;
+}
+
+.rc-slider-step {
+ position: absolute;
+ width: 100%;
+ height: 4px;
+ background: transparent;
+}
+
+.rc-slider-dot {
+ position: absolute;
+ bottom: -2px;
+ margin-left: -4px;
+ width: 8px;
+ height: 8px;
+ border: 2px solid #e9e9e9;
+ background-color: #fff;
+ cursor: pointer;
+ border-radius: 50%;
+ vertical-align: middle;
+}
+
+.rc-slider-dot-active {
+ border-color: #96dbfa;
+}
+
+.rc-slider-disabled {
+ opacity: 0.2;
+}
+
+.rc-slider-disabled .rc-slider-track {
+ background-color: #ccc;
+}
+
+.rc-slider-disabled .rc-slider-handle,
+.rc-slider-disabled .rc-slider-dot {
+ border-color: #ccc;
+ box-shadow: none;
+ background-color: #fff;
+ cursor: not-allowed;
+}
+
+.rc-slider-disabled .rc-slider-mark-text,
+.rc-slider-disabled .rc-slider-dot {
+ cursor: not-allowed !important;
+}
+
+.rc-slider-vertical {
+ width: 14px;
+ height: 100%;
+ padding: 0 5px;
+}
+
+.rc-slider-vertical .rc-slider-rail {
+ height: 100%;
+ width: 4px;
+}
+
+.rc-slider-vertical .rc-slider-track {
+ left: 5px;
+ bottom: 0;
+ width: 4px;
+}
+
+.rc-slider-vertical .rc-slider-handle {
+ margin-left: -5px;
+ margin-bottom: -7px;
+ -ms-touch-action: pan-y;
+ touch-action: pan-y;
+}
+
+.rc-slider-vertical .rc-slider-mark {
+ top: 0;
+ left: 18px;
+ height: 100%;
+}
+
+.rc-slider-vertical .rc-slider-step {
+ height: 100%;
+ width: 4px;
+}
+
+.rc-slider-vertical .rc-slider-dot {
+ left: 2px;
+ margin-bottom: -4px;
+}
+
+.rc-slider-vertical .rc-slider-dot:first-child {
+ margin-bottom: -4px;
+}
+
+.rc-slider-vertical .rc-slider-dot:last-child {
+ margin-bottom: -4px;
+}
+
+.rc-slider-tooltip-zoom-down-enter,
+.rc-slider-tooltip-zoom-down-appear {
+ animation-duration: .3s;
+ animation-fill-mode: both;
+ display: block !important;
+ animation-play-state: paused;
+}
+
+.rc-slider-tooltip-zoom-down-leave {
+ animation-duration: .3s;
+ animation-fill-mode: both;
+ display: block !important;
+ animation-play-state: paused;
+}
+
+.rc-slider-tooltip-zoom-down-enter.rc-slider-tooltip-zoom-down-enter-active,
+.rc-slider-tooltip-zoom-down-appear.rc-slider-tooltip-zoom-down-appear-active {
+ animation-name: rcSliderTooltipZoomDownIn;
+ animation-play-state: running;
+}
+
+.rc-slider-tooltip-zoom-down-leave.rc-slider-tooltip-zoom-down-leave-active {
+ animation-name: rcSliderTooltipZoomDownOut;
+ animation-play-state: running;
+}
+
+.rc-slider-tooltip-zoom-down-enter,
+.rc-slider-tooltip-zoom-down-appear {
+ transform: scale(0, 0);
+ animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
+}
+
+.rc-slider-tooltip-zoom-down-leave {
+ animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
+}
+
+@keyframes rcSliderTooltipZoomDownIn {
+ 0% {
+ opacity: 0;
+ transform-origin: 50% 100%;
+ transform: scale(0, 0);
+ }
+
+ 100% {
+ transform-origin: 50% 100%;
+ transform: scale(1, 1);
+ }
+}
+
+@keyframes rcSliderTooltipZoomDownOut {
+ 0% {
+ transform-origin: 50% 100%;
+ transform: scale(1, 1);
+ }
+
+ 100% {
+ opacity: 0;
+ transform-origin: 50% 100%;
+ transform: scale(0, 0);
+ }
+}
+
+.rc-slider-tooltip {
+ position: absolute;
+ left: -9999px;
+ top: -9999px;
+ visibility: visible;
+ box-sizing: border-box;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+}
+
+.rc-slider-tooltip * {
+ box-sizing: border-box;
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+}
+
+.rc-slider-tooltip-hidden {
+ display: none;
+}
+
+.rc-slider-tooltip-placement-top {
+ padding: 4px 0 8px 0;
+}
+
+.rc-slider-tooltip-inner {
+ padding: 4px 6px 4px;
+ min-width: 24px;
+ height: 24px;
+ font-size: 12px;
+ line-height: 1;
+ color: #000;
+ text-align: center;
+ text-decoration: none;
+}
+
+.rc-slider-tooltip-arrow {
+ position: absolute;
+ width: 0;
+ height: 0;
+ border-color: transparent;
+ border-style: solid;
+}
+
+.rc-slider-tooltip-placement-top .rc-slider-tooltip-arrow {
+ bottom: 4px;
+ left: 50%;
+ margin-left: -4px;
+ border-width: 4px 4px 0;
+ border-top-color: #6c6c6c;
+}
diff --git a/packages/website/ts/pages/instant/select.tsx b/packages/website/ts/pages/instant/select.tsx
new file mode 100644
index 000000000..d4146cfb0
--- /dev/null
+++ b/packages/website/ts/pages/instant/select.tsx
@@ -0,0 +1,74 @@
+import * as React from 'react';
+import styled from 'styled-components';
+
+export interface SelectItemConfig {
+ label: string;
+ value?: string;
+ onClick?: () => void;
+}
+
+interface SelectProps {
+ value?: string;
+ id: string;
+ items: SelectItemConfig[];
+ emptyText?: string;
+ onChange?: (ev: React.ChangeEvent<HTMLSelectElement>) => void;
+ shouldIncludeEmpty: boolean;
+}
+
+export const Select: React.FunctionComponent<SelectProps> = ({
+ value,
+ id,
+ items,
+ shouldIncludeEmpty,
+ emptyText,
+ onChange,
+}) => {
+ return (
+ <Container>
+ <StyledSelect id={id} onChange={onChange}>
+ {shouldIncludeEmpty && <option value="">{emptyText}</option>}
+ {items.map((item, index) => (
+ <option
+ key={`${id}-item-${index}`}
+ value={item.value}
+ selected={item.value === value}
+ onClick={item.onClick}
+ >
+ {item.label}
+ </option>
+ ))}
+ </StyledSelect>
+ <Caret width="12" height="7" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path d="M11 1L6 6 1 1" stroke="#666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
+ </Caret>
+ </Container>
+ );
+};
+
+Select.defaultProps = {
+ emptyText: 'Select...',
+ shouldIncludeEmpty: true,
+};
+
+const Container = styled.div`
+ background-color: #fff;
+ border-radius: 4px;
+ display: flex;
+ width: 100%;
+ position: relative;
+`;
+
+const StyledSelect = styled.select`
+ appearance: none;
+ border: 0;
+ font-size: 1rem;
+ width: 100%;
+ padding: 20px 20px 20px 20px;
+`;
+
+const Caret = styled.svg`
+ position: absolute;
+ right: 20px;
+ top: calc(50% - 4px);
+`;
diff --git a/packages/website/ts/pages/jobs/benefits.tsx b/packages/website/ts/pages/jobs/benefits.tsx
deleted file mode 100644
index 563b72e63..000000000
--- a/packages/website/ts/pages/jobs/benefits.tsx
+++ /dev/null
@@ -1,158 +0,0 @@
-import * as _ from 'lodash';
-import * as React from 'react';
-
-import { Circle } from 'ts/components/ui/circle';
-import { Container } from 'ts/components/ui/container';
-import { Image } from 'ts/components/ui/image';
-import { Text } from 'ts/components/ui/text';
-import { colors } from 'ts/style/colors';
-import { styled } from 'ts/style/theme';
-import { ScreenWidths } from 'ts/types';
-import { constants } from 'ts/utils/constants';
-
-const BENEFITS = [
- 'Comprehensive insurance (medical, dental, and vision)',
- 'Unlimited vacation (three weeks per year minimum)',
- 'Meals and snacks provided in-office daily',
- 'Flexible hours and liberal work-from-home-policy',
- 'Supportive remote working environment',
- 'Transportation, phone, and wellness expense',
- 'Relocation assistance',
- 'Optional team excursions (fully paid, often international)',
- 'Competitive salary and cryptocurrency-based compensation',
-];
-
-interface Value {
- iconSrc: string;
- text: string;
-}
-const VALUES: Value[] = [
- {
- iconSrc: 'images/jobs/heart-icon.svg',
- text: 'Do the right thing',
- },
- {
- iconSrc: 'images/jobs/ship-icon.svg',
- text: 'Consistently ship',
- },
- {
- iconSrc: 'images/jobs/calendar-icon.svg',
- text: 'Focus on long term impact',
- },
-];
-
-export interface BenefitsProps {
- screenWidth: ScreenWidths;
-}
-
-export const Benefits = (props: BenefitsProps) => {
- const isSmallScreen = props.screenWidth === ScreenWidths.Sm;
- return (
- <Container className="flex flex-column items-center py4 px3" backgroundColor={colors.white}>
- {!isSmallScreen ? (
- <Container className="flex" maxWidth="1200px">
- <BenefitsList />
- <Container marginLeft="120px">
- <ValuesList />
- </Container>
- </Container>
- ) : (
- <Container className="flex-column">
- <BenefitsList />
- <Container marginTop="50px">
- <ValuesList />
- </Container>
- </Container>
- )}
- </Container>
- );
-};
-
-const Header: React.StatelessComponent = ({ children }) => (
- <Container marginBottom="30px">
- <Text fontFamily="Roboto Mono" fontSize="24px" fontColor={colors.black}>
- {children}
- </Text>
- </Container>
-);
-
-interface BenefitsListProps {
- className?: string;
-}
-const PlainBenefitsList: React.StatelessComponent<BenefitsListProps> = ({ className }) => {
- return (
- <Container className={className}>
- <Header>Benefits</Header>
- {_.map(BENEFITS, benefit => <BenefitItem key={benefit} description={benefit} />)}
- </Container>
- );
-};
-const BenefitsList = styled(PlainBenefitsList)`
- transform: translateY(30px);
-`;
-
-interface BenefitItemProps {
- description: string;
-}
-
-const BenefitItem: React.StatelessComponent<BenefitItemProps> = ({ description }) => (
- <Container marginBottom="15px">
- <div className="flex">
- <Circle className="flex-none pr2 pt1" diameter={8} fillColor={colors.black} />
- <div className="flex-auto">
- <Text fontSize="14px" lineHeight="24px">
- {description}
- </Text>
- </div>
- </div>
- </Container>
-);
-
-interface ValuesListProps {
- className?: string;
-}
-const PlainValuesList: React.StatelessComponent<ValuesListProps> = ({ className }) => {
- return (
- <Container className={className} maxWidth="270px">
- <Header>Our Values</Header>
- {_.map(VALUES, value => <ValueItem key={value.text} {...value} />)}
- <Text fontSize="14px" lineHeight="26px">
- We care deeply about our culture and values, and encourage you to{' '}
- <a
- style={{ color: colors.mediumBlue, textDecoration: 'none' }}
- target="_blank"
- href={constants.URL_MISSION_AND_VALUES_BLOG_POST}
- >
- read more on our blog
- </a>.
- </Text>
- </Container>
- );
-};
-
-const ValuesList = styled(PlainValuesList)`
- border-color: ${colors.beigeWhite};
- border-radius: 7px;
- border-width: 1px;
- border-style: solid;
- padding-left: 38px;
- padding-right: 38px;
- padding-top: 28px;
- padding-bottom: 28px;
-`;
-
-type ValueItemProps = Value;
-const ValueItem: React.StatelessComponent<ValueItemProps> = ({ iconSrc, text }) => {
- return (
- <Container marginBottom="25px">
- <div className="flex items-center">
- <Image className="flex-none pr2" width="20px" src={iconSrc} />
- <div className="flex-auto">
- <Text fontSize="14px" lineHeight="24px" fontWeight="bold">
- {text}
- </Text>
- </div>
- </div>
- </Container>
- );
-};
diff --git a/packages/website/ts/pages/jobs/jobs.tsx b/packages/website/ts/pages/jobs/jobs.tsx
deleted file mode 100644
index 728e17f9e..000000000
--- a/packages/website/ts/pages/jobs/jobs.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import { colors, utils as sharedUtils } from '@0x/react-shared';
-import * as _ from 'lodash';
-import * as React from 'react';
-import * as DocumentTitle from 'react-document-title';
-
-import { Footer } from 'ts/components/footer';
-import { MetaTags } from 'ts/components/meta_tags';
-import { TopBar } from 'ts/components/top_bar/top_bar';
-import { Container } from 'ts/components/ui/container';
-import { Benefits } from 'ts/pages/jobs/benefits';
-import { Join0x } from 'ts/pages/jobs/join_0x';
-import { Mission } from 'ts/pages/jobs/mission';
-import { OpenPositions } from 'ts/pages/jobs/open_positions';
-import { Dispatcher } from 'ts/redux/dispatcher';
-import { ScreenWidths } from 'ts/types';
-import { Translate } from 'ts/utils/translate';
-import { utils } from 'ts/utils/utils';
-
-const OPEN_POSITIONS_HASH = 'positions';
-const THROTTLE_TIMEOUT = 100;
-const DOCUMENT_TITLE = 'Careers at 0x';
-const DOCUMENT_DESCRIPTION = 'Join 0x in creating a tokenized world where all value can flow freely';
-
-export interface JobsProps {
- location: Location;
- translate: Translate;
- dispatcher: Dispatcher;
- screenWidth: ScreenWidths;
-}
-
-export interface JobsState {}
-
-export class Jobs extends React.Component<JobsProps, JobsState> {
- // TODO: consolidate this small screen scaffolding into one place (its being used in portal and docs as well)
- private readonly _throttledScreenWidthUpdate: () => void;
- public constructor(props: JobsProps) {
- super(props);
- this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT);
- }
- public componentDidMount(): void {
- window.addEventListener('resize', this._throttledScreenWidthUpdate);
- window.scrollTo(0, 0);
- }
- public render(): React.ReactNode {
- return (
- <Container overflowX="hidden">
- <MetaTags title={DOCUMENT_TITLE} description={DOCUMENT_DESCRIPTION} />
- <DocumentTitle title={DOCUMENT_TITLE} />
- <TopBar
- blockchainIsLoaded={false}
- location={this.props.location}
- style={{ backgroundColor: colors.white, position: 'relative' }}
- translate={this.props.translate}
- />
- <Join0x onCallToActionClick={this._onJoin0xCallToActionClick.bind(this)} />
- <Mission screenWidth={this.props.screenWidth} />
- <Benefits screenWidth={this.props.screenWidth} />
- <OpenPositions hash={OPEN_POSITIONS_HASH} screenWidth={this.props.screenWidth} />
- <Footer translate={this.props.translate} dispatcher={this.props.dispatcher} />
- </Container>
- );
- }
- private _onJoin0xCallToActionClick(): void {
- sharedUtils.setUrlHash(OPEN_POSITIONS_HASH);
- sharedUtils.scrollToHash(OPEN_POSITIONS_HASH, '');
- }
- private _updateScreenWidth(): void {
- const newScreenWidth = utils.getScreenWidth();
- this.props.dispatcher.updateScreenWidth(newScreenWidth);
- }
-}
diff --git a/packages/website/ts/pages/jobs/join_0x.tsx b/packages/website/ts/pages/jobs/join_0x.tsx
deleted file mode 100644
index e869cd455..000000000
--- a/packages/website/ts/pages/jobs/join_0x.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { colors } from '@0x/react-shared';
-
-import * as React from 'react';
-
-import { Button } from 'ts/components/ui/button';
-import { Container } from 'ts/components/ui/container';
-import { Image } from 'ts/components/ui/image';
-import { Text } from 'ts/components/ui/text';
-import { constants } from 'ts/utils/constants';
-
-const BUTTON_TEXT = 'View open positions';
-
-export interface Join0xProps {
- onCallToActionClick: () => void;
-}
-
-export const Join0x = (props: Join0xProps) => (
- <div className="clearfix center lg-py4 md-py4" style={{ backgroundColor: colors.white, color: colors.black }}>
- <div
- className="mx-auto inline-block align-middle py4"
- style={{ lineHeight: '44px', textAlign: 'center', position: 'relative' }}
- >
- <Container className="sm-hide xs-hide" position="absolute" left="100%" marginLeft="80px">
- <Image src="images/jobs/hero-dots-right.svg" width="400px" />
- </Container>
- <Container className="sm-hide xs-hide" position="absolute" right="100%" marginRight="80px">
- <Image src="images/jobs/hero-dots-left.svg" width="400px" />
- </Container>
- <div className="h2 sm-center sm-pt3" style={{ fontFamily: 'Roboto Mono' }}>
- Join Us in Our Mission
- </div>
- <Container className="pb2 lg-pt2 md-pt2 sm-pt3 sm-px3 sm-center" maxWidth="537px">
- <Text fontSize="14px" lineHeight="30px">
- At 0x, our mission is to create a tokenized world where all value can flow freely.
- <br />
- <br />We are powering a growing ecosystem of decentralized applications and solving novel challenges
- to make our technology intuitive, flexible, and accessible to all.{' '}
- <a
- style={{ color: colors.mediumBlue, textDecoration: 'none' }}
- target="_blank"
- href={constants.URL_MISSION_AND_VALUES_BLOG_POST}
- >
- Read more
- </a>{' '}
- about our mission, and join us in building financial infrastructure upon which the exchange of
- anything of value will take place.
- </Text>
- </Container>
- <div className="py3">
- <Button
- type="button"
- backgroundColor={colors.black}
- width="290px"
- fontColor={colors.white}
- fontSize="18px"
- fontFamily="Roboto Mono"
- onClick={props.onCallToActionClick}
- >
- {BUTTON_TEXT}
- </Button>
- </div>
- </div>
- </div>
-);
diff --git a/packages/website/ts/pages/jobs/mission.tsx b/packages/website/ts/pages/jobs/mission.tsx
deleted file mode 100644
index 28546f985..000000000
--- a/packages/website/ts/pages/jobs/mission.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-import * as React from 'react';
-
-import { Container } from 'ts/components/ui/container';
-import { Image } from 'ts/components/ui/image';
-import { Text } from 'ts/components/ui/text';
-import { colors } from 'ts/style/colors';
-import { ScreenWidths } from 'ts/types';
-
-export interface MissionProps {
- screenWidth: ScreenWidths;
-}
-export const Mission = (props: MissionProps) => {
- const shouldShowImage = props.screenWidth === ScreenWidths.Lg;
- const image = <Image src="/images/jobs/world-map.svg" maxWidth="500px" maxHeight="280px" />;
- const missionStatementClassName = !shouldShowImage ? 'center' : undefined;
- const missionStatement = (
- <Container className={missionStatementClassName} maxWidth="388px">
- <Text fontFamily="Roboto Mono" fontSize="22px" lineHeight="31px">
- Powered by a Diverse<br />Worldwide Community
- </Text>
- <Container marginTop="32px">
- <Text fontSize="14px" lineHeight="2em">
- We're a highly technical team with varied backgrounds in engineering, science, business, finance,
- and research. While the core team is headquartered in San Francisco, there are 30+ teams building on
- 0x and hundreds of thousands of participants behind our efforts globally. We're passionate about
- open-source software and decentralized technology's potential to act as an equalizing force in the
- world.
- </Text>
- </Container>
- </Container>
- );
- return (
- <div
- className="flex flex-column items-center py4 px3"
- style={{ backgroundColor: colors.jobsPageBackground, color: colors.black }}
- >
- {shouldShowImage ? (
- <Container className="flex items-center" maxWidth="1200px">
- {image}
- <Container marginLeft="115px">{missionStatement}</Container>
- </Container>
- ) : (
- <Container className="flex flex-column items-center">{missionStatement}</Container>
- )}
- </div>
- );
-};
diff --git a/packages/website/ts/pages/jobs/open_positions.tsx b/packages/website/ts/pages/jobs/open_positions.tsx
deleted file mode 100644
index b8442a9c4..000000000
--- a/packages/website/ts/pages/jobs/open_positions.tsx
+++ /dev/null
@@ -1,179 +0,0 @@
-import * as _ from 'lodash';
-import CircularProgress from 'material-ui/CircularProgress';
-import * as React from 'react';
-
-import { Container } from 'ts/components/ui/container';
-import { Retry } from 'ts/components/ui/retry';
-import { Text } from 'ts/components/ui/text';
-import { colors } from 'ts/style/colors';
-import { styled } from 'ts/style/theme';
-import { ScreenWidths, WebsiteBackendJobInfo } from 'ts/types';
-import { backendClient } from 'ts/utils/backend_client';
-import { constants } from 'ts/utils/constants';
-import { utils } from 'ts/utils/utils';
-
-const TABLE_ROW_MIN_HEIGHT = 100;
-
-export interface OpenPositionsProps {
- hash: string;
- screenWidth: ScreenWidths;
-}
-export interface OpenPositionsState {
- jobInfos?: WebsiteBackendJobInfo[];
- error?: Error;
-}
-
-export class OpenPositions extends React.Component<OpenPositionsProps, OpenPositionsState> {
- private _isUnmounted: boolean;
- constructor(props: OpenPositionsProps) {
- super(props);
- this._isUnmounted = false;
- this.state = {
- jobInfos: undefined,
- error: undefined,
- };
- }
- public componentWillMount(): void {
- // tslint:disable-next-line:no-floating-promises
- this._fetchJobInfosAsync();
- }
- public componentWillUnmount(): void {
- this._isUnmounted = true;
- }
- public render(): React.ReactNode {
- const isReadyToRender = _.isUndefined(this.state.error) && !_.isUndefined(this.state.jobInfos);
- const isSmallScreen = utils.isMobileWidth(this.props.screenWidth);
- return (
- <Container id={this.props.hash} className="mx-auto pb4 px3 max-width-4">
- {!isSmallScreen && (
- <hr style={{ border: 0, borderTop: 1, borderStyle: 'solid', borderColor: colors.beigeWhite }} />
- )}
- <Container marginTop="64px" marginBottom="50px">
- <Text fontFamily="Roboto Mono" fontSize="24px" fontColor={colors.black}>
- Open Positions
- </Text>
- </Container>
- {isReadyToRender ? this._renderTable() : this._renderLoading()}
- </Container>
- );
- }
- private _renderLoading(): React.ReactNode {
- return (
- // TODO: consolidate this loading component with the one in portal and RelayerIndex
- // TODO: possibly refactor into a generic loading container with spinner and retry UI
- <div className="center">
- {_.isUndefined(this.state.error) ? (
- <CircularProgress size={40} thickness={5} />
- ) : (
- <Retry onRetry={this._fetchJobInfosAsync.bind(this)} />
- )}
- </div>
- );
- }
- private _renderTable(): React.ReactNode {
- return (
- <Container width="100%">
- <div>
- {_.map(this.state.jobInfos, jobInfo => {
- return (
- <JobInfoTableRow
- key={jobInfo.id}
- screenWidth={this.props.screenWidth}
- jobInfo={jobInfo}
- onClick={this._openJobInfoUrl.bind(this, jobInfo)}
- />
- );
- })}
- </div>
- <Container className="center" marginTop="70px">
- <Text fontStyle="italic" fontSize="14px">
- Interested in telling us why you'd be a valuable addition to the team outside of the positions
- listed above?{' '}
- <a
- style={{ color: colors.mediumBlue, textDecoration: 'none' }}
- href={`mailto:${constants.EMAIL_JOBS}`}
- >
- Email us!
- </a>
- </Text>
- </Container>
- </Container>
- );
- }
- private async _fetchJobInfosAsync(): Promise<void> {
- try {
- if (!this._isUnmounted) {
- this.setState({
- jobInfos: undefined,
- error: undefined,
- });
- }
- const jobInfos = await backendClient.getJobInfosAsync();
- if (!this._isUnmounted) {
- this.setState({
- jobInfos,
- });
- }
- } catch (error) {
- if (!this._isUnmounted) {
- this.setState({
- error,
- });
- }
- }
- }
- private _openJobInfoUrl(jobInfo: WebsiteBackendJobInfo): void {
- const url = jobInfo.url;
- utils.openUrl(url);
- }
-}
-
-export interface JobInfoTableRowProps {
- className?: string;
- screenWidth: ScreenWidths;
- jobInfo: WebsiteBackendJobInfo;
- onClick?: (event: React.MouseEvent<HTMLElement>) => void;
-}
-
-const PlainJobInfoTableRow: React.StatelessComponent<JobInfoTableRowProps> = ({
- className,
- screenWidth,
- jobInfo,
- onClick,
-}) => {
- const isSmallScreen = screenWidth === ScreenWidths.Sm;
- const titleClassName = isSmallScreen ? 'col col-12 center' : 'col col-5';
- const paddingLeft = isSmallScreen ? undefined : '30px';
- return (
- <Container className={className} onClick={onClick} marginBottom="30px" paddingLeft={paddingLeft}>
- <Container className="flex items-center" minHeight={TABLE_ROW_MIN_HEIGHT} width="100%">
- <Container className="clearfix container" width="100%">
- <Container className={titleClassName}>
- <Text fontSize="16px" fontWeight="bold" fontColor={colors.mediumBlue}>
- {jobInfo.title}
- </Text>
- </Container>
- {!isSmallScreen && (
- <Container className="col col-3">
- <Text fontSize="16px">{jobInfo.department}</Text>
- </Container>
- )}
- {!isSmallScreen && (
- <Container className="col col-4 center">
- <Text fontSize="16px">{jobInfo.office}</Text>
- </Container>
- )}
- </Container>
- </Container>
- </Container>
- );
-};
-
-export const JobInfoTableRow = styled(PlainJobInfoTableRow)`
- cursor: pointer;
- background-color: ${colors.grey100};
- border-radius: 7px;
- &:hover {
- opacity: 0.5;
- }
-`;
diff --git a/packages/website/ts/pages/jobs/photo_rail.tsx b/packages/website/ts/pages/jobs/photo_rail.tsx
deleted file mode 100644
index acc9dcb91..000000000
--- a/packages/website/ts/pages/jobs/photo_rail.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import * as _ from 'lodash';
-import * as React from 'react';
-
-import { FilledImage } from 'ts/components/ui/filled_image';
-
-export interface PhotoRailProps {
- images: string[];
-}
-
-export const PhotoRail = (props: PhotoRailProps) => {
- return (
- <div className="clearfix" style={{ height: 490 }}>
- {_.map(props.images, (image: string) => {
- return (
- <div key={image} className="col lg-col-4 md-col-4 col-12 center" style={{ height: '100%' }}>
- <FilledImage src={image} />
- </div>
- );
- })}
- </div>
- );
-};
diff --git a/packages/website/ts/pages/landing.tsx b/packages/website/ts/pages/landing.tsx
new file mode 100644
index 000000000..b47d34dce
--- /dev/null
+++ b/packages/website/ts/pages/landing.tsx
@@ -0,0 +1,44 @@
+import * as React from 'react';
+import DocumentTitle from 'react-document-title';
+
+import { SectionLandingAbout } from 'ts/components/sections/landing/about';
+import { SectionLandingClients } from 'ts/components/sections/landing/clients';
+import { SectionLandingCta } from 'ts/components/sections/landing/cta';
+import { SectionLandingHero } from 'ts/components/sections/landing/hero';
+import { SiteWrap } from 'ts/components/siteWrap';
+
+import { ModalContact } from 'ts/components/modals/modal_contact';
+
+interface Props {
+ theme: {
+ bgColor: string;
+ textColor: string;
+ linkColor: string;
+ };
+}
+
+export class NextLanding extends React.Component<Props> {
+ public state = {
+ isContactModalOpen: false,
+ };
+ public render(): React.ReactNode {
+ return (
+ <SiteWrap theme="dark">
+ <DocumentTitle title="0x: The protocol for trading tokens on Ethereum" />
+ <SectionLandingHero />
+ <SectionLandingAbout />
+ <SectionLandingClients />
+ <SectionLandingCta onContactClick={this._onOpenContactModal} />
+ <ModalContact isOpen={this.state.isContactModalOpen} onDismiss={this._onDismissContactModal} />
+ </SiteWrap>
+ );
+ }
+
+ public _onOpenContactModal = (): void => {
+ this.setState({ isContactModalOpen: true });
+ };
+
+ public _onDismissContactModal = (): void => {
+ this.setState({ isContactModalOpen: false });
+ };
+}
diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx
deleted file mode 100644
index bb76efe21..000000000
--- a/packages/website/ts/pages/landing/landing.tsx
+++ /dev/null
@@ -1,620 +0,0 @@
-import { colors, Link } from '@0x/react-shared';
-import * as _ from 'lodash';
-import * as React from 'react';
-import DocumentTitle from 'react-document-title';
-import { Footer } from 'ts/components/footer';
-import { SubscribeForm } from 'ts/components/forms/subscribe_form';
-import { TopBar } from 'ts/components/top_bar/top_bar';
-import { CallToAction } from 'ts/components/ui/button';
-import { Container } from 'ts/components/ui/container';
-import { Image } from 'ts/components/ui/image';
-import { Text } from 'ts/components/ui/text';
-import { TypedText } from 'ts/components/ui/typed_text';
-import { Dispatcher } from 'ts/redux/dispatcher';
-import { Deco, Key, Language, ScreenWidths, WebsitePaths } from 'ts/types';
-import { constants } from 'ts/utils/constants';
-import { Translate } from 'ts/utils/translate';
-import { utils } from 'ts/utils/utils';
-
-interface BoxContent {
- title: string;
- description: string;
- imageUrl: string;
- classNames: string;
- maxWidth: number;
-}
-interface UseCase {
- imageUrl: string;
- type: string;
- description: string;
- classNames: string;
- style?: React.CSSProperties;
-}
-interface Project {
- logoFileName: string;
- projectUrl: string;
-}
-
-const THROTTLE_TIMEOUT = 100;
-const WHATS_NEW_TITLE = 'Introducing the 0x Launch Kit';
-const WHATS_NEW_URL = 'https://blog.0xproject.com/introducing-the-0x-launch-kit-4acdc3453585';
-const TITLE_STYLE: React.CSSProperties = {
- fontFamily: 'Roboto Mono',
- color: colors.grey,
- fontWeight: 300,
- letterSpacing: 3,
-};
-const ROTATING_LIST = [
- 'tokens',
- 'game items',
- 'digital art',
- 'futures',
- 'stocks',
- 'derivatives',
- 'loans',
- 'cats',
- 'everything',
-];
-
-const relayerProjects: Project[] = [
- {
- logoFileName: 'ethfinex.png',
- projectUrl: constants.PROJECT_URL_ETHFINEX,
- },
- {
- logoFileName: 'radar_relay.png',
- projectUrl: constants.PROJECT_URL_RADAR_RELAY,
- },
- {
- logoFileName: 'paradex.png',
- projectUrl: constants.PROJECT_URL_PARADEX,
- },
- {
- logoFileName: 'the_ocean.png',
- projectUrl: constants.PROJECT_URL_0CEAN,
- },
- {
- logoFileName: 'amadeus.png',
- projectUrl: constants.PROJECT_URL_AMADEUS,
- },
- {
- logoFileName: 'ddex.png',
- projectUrl: constants.PROJECT_URL_DDEX,
- },
- {
- logoFileName: 'decent_ex.png',
- projectUrl: constants.PROJECT_URL_DECENT_EX,
- },
- {
- logoFileName: 'dextroid.png',
- projectUrl: constants.PROJECT_URL_DEXTROID,
- },
- {
- logoFileName: 'ercdex.png',
- projectUrl: constants.PROJECT_URL_ERC_DEX,
- },
- {
- logoFileName: 'open_relay.png',
- projectUrl: constants.PROJECT_URL_OPEN_RELAY,
- },
- {
- logoFileName: 'idt.png',
- projectUrl: constants.PROJECT_URL_IDT,
- },
- {
- logoFileName: 'imtoken.png',
- projectUrl: constants.PROJECT_URL_IMTOKEN,
- },
-];
-
-export interface LandingProps {
- location: Location;
- translate: Translate;
- dispatcher: Dispatcher;
-}
-
-interface LandingState {
- screenWidth: ScreenWidths;
-}
-
-export class Landing extends React.Component<LandingProps, LandingState> {
- private readonly _throttledScreenWidthUpdate: () => void;
- constructor(props: LandingProps) {
- super(props);
- this.state = {
- screenWidth: utils.getScreenWidth(),
- };
- this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT);
- }
- public componentDidMount(): void {
- window.addEventListener('resize', this._throttledScreenWidthUpdate);
- window.scrollTo(0, 0);
- }
- public componentWillUnmount(): void {
- window.removeEventListener('resize', this._throttledScreenWidthUpdate);
- }
- public render(): React.ReactNode {
- return (
- <div id="landing" className="clearfix" style={{ color: colors.grey500 }}>
- <DocumentTitle title="0x Protocol" />
- <TopBar
- blockchainIsLoaded={false}
- location={this.props.location}
- isNightVersion={true}
- style={{ backgroundColor: colors.heroGrey, position: 'relative' }}
- translate={this.props.translate}
- />
- {this._renderHero()}
- {this._renderProjects(
- relayerProjects,
- this.props.translate.get(Key.RelayersHeader, Deco.Upper),
- colors.projectsGrey,
- true,
- )}
- {this._renderInfoBoxes()}
- {this._renderTokenizationSection()}
- {this._renderUseCases()}
- {this._renderCallToAction()}
- <Footer translate={this.props.translate} dispatcher={this.props.dispatcher} />
- </div>
- );
- }
- private _renderHero(): React.ReactNode {
- const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm;
- const left = 'col lg-col-6 md-col-6 col-12 lg-pl4 md-pl4 sm-pl0 sm-px3 sm-center';
- const flexClassName = isSmallScreen
- ? 'flex items-center flex-column justify-center'
- : 'flex items-center justify-center';
- return (
- <div className="clearfix py4" style={{ backgroundColor: colors.heroGrey }}>
- <div className="mx-auto max-width-4 clearfix">
- {this._renderWhatsNew()}
- <div className={`${flexClassName} lg-pt4 md-pt4 sm-pt2 lg-pb4 md-pb4 lg-mt4 md-mt4 sm-mt2 sm-mb4`}>
- <Container marginTop="30px" marginBottom="30px" marginLeft="15px" marginRight="15px">
- <Image src="/images/landing/0x_homepage.svg" maxWidth="100%" height="auto" />
- </Container>
- <div className={left} style={{ color: colors.white, height: 390, lineHeight: '390px' }}>
- <div
- className="inline-block lg-align-middle md-align-middle sm-align-top"
- style={{
- paddingLeft: isSmallScreen ? 0 : 12,
- lineHeight: '36px',
- }}
- >
- <Text
- className="sm-pb2"
- fontFamily="Roboto"
- display="inline-block"
- fontColor={colors.grey300}
- fontWeight={500}
- lineHeight="1.3em"
- fontSize={isSmallScreen ? '28px' : '36px'}
- >
- {this.props.translate.get(Key.TopHeader, Deco.Cap)}
- {this.props.translate.getLanguage() === Language.English && (
- <React.Fragment>
- {' '}
- for{' '}
- <TypedText
- fontFamily="Roboto"
- display="inline-block"
- fontColor={colors.white}
- fontWeight={700}
- lineHeight="1.3em"
- fontSize={isSmallScreen ? '28px' : '36px'}
- textList={ROTATING_LIST}
- shouldRepeat={true}
- />
- </React.Fragment>
- )}
- </Text>
- <Container
- className={`pt3 flex clearfix sm-mx-auto ${isSmallScreen ? 'justify-center' : ''}`}
- >
- <Container paddingRight="20px">
- <Link to={WebsitePaths.Docs}>
- <CallToAction type="light">
- {this.props.translate.get(Key.BuildCallToAction, Deco.Cap)}
- </CallToAction>
- </Link>
- </Container>
- <div>
- <Link to={WebsitePaths.Portal}>
- <CallToAction>
- {this.props.translate.get(Key.TradeCallToAction, Deco.Cap)}
- </CallToAction>
- </Link>
- </div>
- </Container>
- </div>
- </div>
- </div>
- </div>
- {this.props.translate.getLanguage() === Language.English && <SubscribeForm />}
- </div>
- );
- }
- private _renderWhatsNew(): React.ReactNode {
- return (
- <div className="sm-center sm-px1">
- <a href={WHATS_NEW_URL} target="_blank" className="inline-block text-decoration-none">
- <div className="flex items-center sm-pl0 md-pl2 lg-pl0">
- <Container
- paddingTop="3px"
- paddingLeft="8px"
- paddingBottom="3px"
- paddingRight="8px"
- backgroundColor={colors.white}
- borderRadius={6}
- >
- <Text fontSize="14px" fontWeight={500} fontColor={colors.heroGrey}>
- New
- </Text>
- </Container>
- <Container marginLeft="12px">
- <Text fontSize="16px" fontWeight={500} fontColor={colors.grey300}>
- {WHATS_NEW_TITLE}
- </Text>
- </Container>
- </div>
- </a>
- </div>
- );
- }
- private _renderProjects(
- projects: Project[],
- title: string,
- backgroundColor: string,
- isTitleCenter: boolean,
- ): React.ReactNode {
- const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm;
- const projectList = _.map(projects, (project: Project, i: number) => {
- const isRelayersOnly = projects.length === 12;
- let colWidth: number;
- switch (this.state.screenWidth) {
- case ScreenWidths.Sm:
- colWidth = 4;
- break;
-
- case ScreenWidths.Md:
- colWidth = 3;
- break;
-
- case ScreenWidths.Lg:
- colWidth = isRelayersOnly ? 2 : 2 - i % 2;
- break;
-
- default:
- throw new Error(`Encountered unknown ScreenWidths value: ${this.state.screenWidth}`);
- }
- return (
- <div key={`project-${project.logoFileName}`} className={`col col-${colWidth} center`}>
- <div>
- <a href={project.projectUrl} target="_blank" className="text-decoration-none">
- <img
- src={`/images/landing/project_logos/${project.logoFileName}`}
- height={isSmallScreen ? 60 : 92}
- />
- </a>
- </div>
- </div>
- );
- });
- return (
- <div className={`clearfix py4 ${isTitleCenter && 'center'}`} style={{ backgroundColor }}>
- <div className="mx-auto max-width-4 clearfix sm-px3">
- <div className="h4 pb3 lg-pl0 md-pl3 sm-pl2" style={TITLE_STYLE}>
- {title}
- </div>
- <div className="clearfix">{projectList}</div>
- <div
- className="pt3 mx-auto center"
- style={{
- color: colors.landingLinkGrey,
- fontFamily: 'Roboto Mono',
- maxWidth: 300,
- fontSize: 14,
- }}
- >
- {this.props.translate.get(Key.FullListPrompt)}{' '}
- <Link to={WebsitePaths.Portal} textDecoration="underline" fontColor={colors.landingLinkGrey}>
- {this.props.translate.get(Key.FullListLink)}
- </Link>
- </div>
- </div>
- </div>
- );
- }
- private _renderTokenizationSection(): React.ReactNode {
- const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm;
- return (
- <div className="clearfix lg-py4 md-py4 sm-pb4 sm-pt2" style={{ backgroundColor: colors.grey100 }}>
- <div className="mx-auto max-width-4 py4 clearfix">
- {isSmallScreen && this._renderTokenCloud()}
- <div
- className="col lg-col-6 md-col-6 col-12 center"
- style={{ color: colors.darkestGrey, height: 364, lineHeight: '364px' }}
- >
- <div
- className="mx-auto inline-block lg-align-middle md-align-middle sm-align-top"
- style={{ maxWidth: 385, lineHeight: '44px', textAlign: 'left' }}
- >
- <div className="lg-h1 md-h1 sm-h2 sm-center sm-pt3" style={{ fontFamily: 'Roboto Mono' }}>
- {this.props.translate.get(Key.TokenizedSectionHeader, Deco.Cap)}
- </div>
- <div
- className="pb2 lg-pt2 md-pt2 sm-pt3 sm-px3 h5 sm-center"
- style={{ fontFamily: 'Roboto Mono', lineHeight: 1.7, maxWidth: 370 }}
- >
- {this.props.translate.get(Key.TokenizedSectionDescription, Deco.Cap)}
- </div>
- <div className="flex pt1 sm-px3">{this._renderMissionAndValuesButton()}</div>
- </div>
- </div>
- {!isSmallScreen && this._renderTokenCloud()}
- </div>
- </div>
- );
- }
- private _renderTokenCloud(): React.ReactNode {
- const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm;
- return (
- <div className="col lg-col-6 md-col-6 col-12 center">
- <img src="/images/landing/tokenized_world.png" height={isSmallScreen ? 280 : 364.5} />
- </div>
- );
- }
- private _renderMissionAndValuesButton(): React.ReactNode {
- return (
- <a
- href={constants.URL_MISSION_AND_VALUES_BLOG_POST}
- target="_blank"
- className="inline-block text-decoration-none"
- >
- <CallToAction>{this.props.translate.get(Key.OurMissionAndValues, Deco.CapWords)}</CallToAction>
- </a>
- );
- }
- private _renderInfoBoxes(): React.ReactNode {
- const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm;
- const boxStyle: React.CSSProperties = {
- maxWidth: 253,
- height: 402,
- backgroundColor: colors.grey50,
- borderRadius: 5,
- padding: '10px 24px 24px',
- };
- const boxContents: BoxContent[] = [
- {
- title: this.props.translate.get(Key.BenefitOneTitle, Deco.Cap),
- description: this.props.translate.get(Key.BenefitOneDescription, Deco.Cap),
- imageUrl: '/images/landing/distributed_network.png',
- classNames: '',
- maxWidth: 160,
- },
- {
- title: this.props.translate.get(Key.BenefitTwoTitle, Deco.Cap),
- description: this.props.translate.get(Key.BenefitTwoDescription, Deco.Cap),
- imageUrl: '/images/landing/liquidity.png',
- classNames: 'mx-auto',
- maxWidth: 160,
- },
- {
- title: this.props.translate.get(Key.BenefitThreeTitle, Deco.Cap),
- description: this.props.translate.get(Key.BenefitThreeDescription, Deco.Cap),
- imageUrl: '/images/landing/exchange_everywhere.png',
- classNames: 'right',
- maxWidth: 130,
- },
- ];
- const boxes = _.map(boxContents, (boxContent: BoxContent) => {
- return (
- <div key={`box-${boxContent.title}`} className="col lg-col-4 md-col-4 col-12 sm-pb4">
- <div className={`center sm-mx-auto ${!isSmallScreen && boxContent.classNames}`} style={boxStyle}>
- <Container className="flex items-center" height="210px">
- <img
- className="mx-auto"
- src={boxContent.imageUrl}
- style={{ height: 'auto', maxWidth: boxContent.maxWidth }}
- />
- </Container>
- <div className="h3" style={{ color: 'black', fontFamily: 'Roboto Mono' }}>
- {boxContent.title}
- </div>
- <div className="pt2 pb2" style={{ fontFamily: 'Roboto Mono', fontSize: 14 }}>
- {boxContent.description}
- </div>
- </div>
- </div>
- );
- });
- return (
- <div className="clearfix" style={{ backgroundColor: colors.heroGrey }}>
- <div className="center pb3 pt4" style={TITLE_STYLE}>
- {this.props.translate.get(Key.BenefitsHeader, Deco.Upper)}
- </div>
- <div className="mx-auto pb4 sm-mt2 clearfix" style={{ maxWidth: '60em' }}>
- {boxes}
- </div>
- </div>
- );
- }
- private _getUseCases(): UseCase[] {
- const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm;
- const isEnglish = this.props.translate.getLanguage() === Language.English;
- if (isEnglish) {
- return [
- {
- imageUrl: '/images/landing/governance_icon.png',
- type: this.props.translate.get(Key.GamingAndCollectables, Deco.Upper),
- description: this.props.translate.get(Key.GamingAndCollectablesDescription, Deco.Cap),
- classNames: 'lg-px2 md-px2',
- },
- {
- imageUrl: '/images/landing/prediction_market_icon.png',
- type: this.props.translate.get(Key.PredictionMarkets, Deco.Upper),
- description: this.props.translate.get(Key.PredictionMarketsDescription, Deco.Cap),
- classNames: 'lg-px2 md-px2',
- },
- {
- imageUrl: '/images/landing/fund_management_icon.png',
- type: this.props.translate.get(Key.OrderBooks, Deco.Upper),
- description: this.props.translate.get(Key.OrderBooksDescription, Deco.Cap),
- classNames: 'lg-px2 md-px2',
- },
- {
- imageUrl: '/images/landing/loans_icon.png',
- type: this.props.translate.get(Key.DecentralizedLoans, Deco.Upper),
- description: this.props.translate.get(Key.DecentralizedLoansDescription, Deco.Cap),
- classNames: 'lg-pr2 md-pr2 lg-col-6 md-col-6',
- style: {
- width: 291,
- float: 'right',
- marginTop: !isSmallScreen ? 38 : 0,
- },
- },
- {
- imageUrl: '/images/landing/stable_tokens_icon.png',
- type: this.props.translate.get(Key.StableTokens, Deco.Upper),
- description: this.props.translate.get(Key.StableTokensDescription, Deco.Cap),
- classNames: 'lg-pl2 md-pl2 lg-col-6 md-col-6',
- style: { width: 291, marginTop: !isSmallScreen ? 38 : 0 },
- },
- ];
- } else {
- return [
- {
- imageUrl: '/images/landing/governance_icon.png',
- type: this.props.translate.get(Key.DecentralizedGovernance, Deco.Upper),
- description: this.props.translate.get(Key.DecentralizedGovernanceDescription, Deco.Cap),
- classNames: 'lg-px2 md-px2',
- },
- {
- imageUrl: '/images/landing/prediction_market_icon.png',
- type: this.props.translate.get(Key.PredictionMarkets, Deco.Upper),
- description: this.props.translate.get(Key.PredictionMarketsDescription, Deco.Cap),
- classNames: 'lg-px2 md-px2',
- },
- {
- imageUrl: '/images/landing/stable_tokens_icon.png',
- type: this.props.translate.get(Key.StableTokens, Deco.Upper),
- description: this.props.translate.get(Key.StableTokensDescription, Deco.Cap),
- classNames: 'lg-px2 md-px2',
- },
- {
- imageUrl: '/images/landing/loans_icon.png',
- type: this.props.translate.get(Key.DecentralizedLoans, Deco.Upper),
- description: this.props.translate.get(Key.DecentralizedLoansDescription, Deco.Cap),
- classNames: 'lg-pr2 md-pr2 lg-col-6 md-col-6',
- style: {
- width: 291,
- float: 'right',
- marginTop: !isSmallScreen ? 38 : 0,
- },
- },
- {
- imageUrl: '/images/landing/fund_management_icon.png',
- type: this.props.translate.get(Key.FundManagement, Deco.Upper),
- description: this.props.translate.get(Key.FundManagementDescription, Deco.Cap),
- classNames: 'lg-pl2 md-pl2 lg-col-6 md-col-6',
- style: { width: 291, marginTop: !isSmallScreen ? 38 : 0 },
- },
- ];
- }
- }
- private _renderUseCases(): React.ReactNode {
- const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm;
- const useCases = this._getUseCases();
- const cases = _.map(useCases, (useCase: UseCase) => {
- const style = _.isUndefined(useCase.style) || isSmallScreen ? {} : useCase.style;
- const useCaseBoxStyle = {
- color: colors.grey,
- border: `1px solid ${colors.grey750}`,
- borderRadius: 4,
- maxWidth: isSmallScreen ? 375 : 'none',
- ...style,
- };
- const typeStyle: React.CSSProperties = {
- color: colors.lightGrey,
- fontSize: 13,
- textTransform: 'uppercase',
- fontFamily: 'Roboto Mono',
- fontWeight: 300,
- };
- return (
- <div
- key={`useCase-${useCase.type}`}
- className={`col lg-col-4 md-col-4 col-12 sm-pt3 sm-px3 sm-pb3 ${useCase.classNames}`}
- >
- <div className="relative p2 pb2 sm-mx-auto" style={useCaseBoxStyle}>
- <div className="absolute center" style={{ top: -35, width: 'calc(100% - 32px)' }}>
- <img src={useCase.imageUrl} style={{ height: 50 }} />
- </div>
- <div className="pt2 center" style={typeStyle}>
- {useCase.type}
- </div>
- <div
- className="pt2"
- style={{
- lineHeight: 1.5,
- fontSize: 14,
- overflow: 'hidden',
- height: 124,
- }}
- >
- {useCase.description}
- </div>
- </div>
- </div>
- );
- });
- return (
- <div className="clearfix py4" style={{ backgroundColor: colors.heroGrey }}>
- <div className="center h4 pb3 lg-pl0 md-pl3 sm-pl2" style={TITLE_STYLE}>
- {this.props.translate.get(Key.UseCasesHeader, Deco.Upper)}
- </div>
- <div className="mx-auto pb4 pt3 mt1 sm-mt2 clearfix" style={{ maxWidth: '67em' }}>
- {cases}
- </div>
- </div>
- );
- }
- private _renderCallToAction(): React.ReactNode {
- const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm;
- const callToActionClassNames =
- 'lg-pr3 md-pr3 lg-right-align md-right-align sm-center sm-px3 h4 lg-table-cell md-table-cell';
- return (
- <div className="clearfix pb4" style={{ backgroundColor: colors.heroGrey }}>
- <div className="mx-auto max-width-4 pb4 mb3 clearfix center">
- <div className="center inline-block" style={{ textAlign: 'left' }}>
- <div
- className={callToActionClassNames}
- style={{
- fontFamily: 'Roboto Mono',
- color: colors.white,
- lineHeight: isSmallScreen ? 1.7 : 3,
- }}
- >
- {this.props.translate.get(Key.FinalCallToAction, Deco.Cap)}
- </div>
- <div className="sm-center sm-pt2 lg-table-cell md-table-cell">
- <Link to={WebsitePaths.Docs}>
- <CallToAction fontSize="15px">
- {this.props.translate.get(Key.BuildCallToAction, Deco.Cap)}
- </CallToAction>
- </Link>
- </div>
- </div>
- </div>
- </div>
- );
- }
- private _updateScreenWidth(): void {
- const newScreenWidth = utils.getScreenWidth();
- if (newScreenWidth !== this.state.screenWidth) {
- this.setState({
- screenWidth: newScreenWidth,
- });
- }
- }
-} // tslint:disable:max-file-line-count
diff --git a/packages/website/ts/pages/launch_kit.tsx b/packages/website/ts/pages/launch_kit.tsx
new file mode 100644
index 000000000..dd4de4d99
--- /dev/null
+++ b/packages/website/ts/pages/launch_kit.tsx
@@ -0,0 +1,125 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import DocumentTitle from 'react-document-title';
+
+import { Hero } from 'ts/components/hero';
+
+import { Banner } from 'ts/components/banner';
+import { Button } from 'ts/components/button';
+import { Definition } from 'ts/components/definition';
+import { Icon } from 'ts/components/icon';
+import { SiteWrap } from 'ts/components/siteWrap';
+
+import { Section } from 'ts/components/newLayout';
+import { constants } from 'ts/utils/constants';
+
+import { ModalContact } from '../components/modals/modal_contact';
+
+const offersData = [
+ {
+ icon: 'supportForAllEthereumStandards',
+ title: 'Perfect for developers who need a simple drop-in marketplace',
+ description: (
+ <ul>
+ <li>Quickly launch a market for your project’s token</li>
+ <li>Seamlessly create an in-game marketplace for digital items and collectables</li>
+ <li>Easily build a 0x relayer for your local market</li>
+ </ul>
+ ),
+ },
+];
+
+export class NextLaunchKit extends React.Component {
+ public state = {
+ isContactModalOpen: false,
+ };
+ public render(): React.ReactNode {
+ return (
+ <SiteWrap theme="dark">
+ <DocumentTitle title="0x Launch Kit: Launch a relayer in under a minute" />
+ <Hero
+ isLargeTitle={false}
+ isFullWidth={false}
+ title="0x Launch Kit"
+ description="Launch a relayer in under a minute"
+ figure={<Icon name="launchKit" size="hero" margin={['small', 0, 'small', 0]} />}
+ actions={<HeroActions />}
+ />
+
+ <Section bgColor="dark" isFlex={true} maxWidth="1170px">
+ <Definition
+ title="Networked Liquidity Pool"
+ titleSize="small"
+ description="Tap into and share liquidity with other relayers"
+ icon="networkedLiquidity"
+ iconSize="medium"
+ isInline={true}
+ />
+
+ <Definition
+ title="Extensible Code Repo"
+ titleSize="small"
+ description="Fork and extend to support modes of exchange"
+ icon="code-repo"
+ iconSize="medium"
+ isInline={true}
+ />
+
+ <Definition
+ title="Exchange Ethereum based Tokens"
+ titleSize="small"
+ description="Enable trading for any ERC-20 or ERC-721 asset"
+ icon="eth-based-tokens"
+ iconSize="medium"
+ isInline={true}
+ />
+ </Section>
+
+ <Section>
+ {_.map(offersData, (item, index) => (
+ <Definition
+ key={`offers-${index}`}
+ icon={item.icon}
+ title={item.title}
+ description={item.description}
+ isInlineIcon={true}
+ iconSize={240}
+ />
+ ))}
+ </Section>
+
+ <Banner
+ heading="Need more flexibility?"
+ subline="Dive into our docs, or contact us if needed"
+ mainCta={{
+ text: 'Get Started',
+ href: `${constants.URL_LAUNCH_KIT}/#table-of-contents`,
+ shouldOpenInNewTab: true,
+ }}
+ secondaryCta={{ text: 'Get in Touch', onClick: this._onOpenContactModal.bind(this) }}
+ />
+ <ModalContact isOpen={this.state.isContactModalOpen} onDismiss={this._onDismissContactModal} />
+ </SiteWrap>
+ );
+ }
+
+ public _onOpenContactModal = (): void => {
+ this.setState({ isContactModalOpen: true });
+ };
+
+ public _onDismissContactModal = (): void => {
+ this.setState({ isContactModalOpen: false });
+ };
+}
+
+const HeroActions = () => (
+ <React.Fragment>
+ <Button href={constants.URL_LAUNCH_KIT} isInline={true} target="_blank">
+ Get Started
+ </Button>
+
+ <Button href={constants.URL_LAUNCH_KIT_BLOG_POST} isTransparent={true} isInline={true} target="_blank">
+ Learn More!
+ </Button>
+ </React.Fragment>
+);
diff --git a/packages/website/ts/pages/launch_kit/launch_kit.tsx b/packages/website/ts/pages/launch_kit/launch_kit.tsx
deleted file mode 100644
index 4ea56dbd4..000000000
--- a/packages/website/ts/pages/launch_kit/launch_kit.tsx
+++ /dev/null
@@ -1,335 +0,0 @@
-import { colors, Link } from '@0x/react-shared';
-import * as _ from 'lodash';
-import * as React from 'react';
-import DocumentTitle from 'react-document-title';
-import { Footer } from 'ts/components/footer';
-import { TopBar } from 'ts/components/top_bar/top_bar';
-import { Button } from 'ts/components/ui/button';
-import { Container } from 'ts/components/ui/container';
-import { Image } from 'ts/components/ui/image';
-import { Text } from 'ts/components/ui/text';
-import { Dispatcher } from 'ts/redux/dispatcher';
-import { Deco, Key, ScreenWidths } from 'ts/types';
-import { constants } from 'ts/utils/constants';
-import { Translate } from 'ts/utils/translate';
-import { utils } from 'ts/utils/utils';
-
-export interface LaunchKitProps {
- location: Location;
- translate: Translate;
- dispatcher: Dispatcher;
-}
-
-interface LaunchKitState {
- screenWidth: ScreenWidths;
-}
-
-const THROTTLE_TIMEOUT = 100;
-const lighterBackgroundColor = '#222222';
-const darkerBackgroundColor = '#1B1B1B';
-const grayText = '#999999';
-
-interface Benefit {
- icon: string;
- description: string;
-}
-
-export class LaunchKit extends React.Component<LaunchKitProps, LaunchKitState> {
- private readonly _throttledScreenWidthUpdate: () => void;
- constructor(props: LaunchKitProps) {
- super(props);
- this.state = {
- screenWidth: utils.getScreenWidth(),
- };
- this._throttledScreenWidthUpdate = _.throttle(this._updateScreenWidth.bind(this), THROTTLE_TIMEOUT);
- }
- public componentDidMount(): void {
- window.addEventListener('resize', this._throttledScreenWidthUpdate);
- window.scrollTo(0, 0);
- }
- public componentWillUnmount(): void {
- window.removeEventListener('resize', this._throttledScreenWidthUpdate);
- }
- public render(): React.ReactNode {
- return (
- <div id="launchKit" className="clearfix" style={{ color: colors.grey500 }}>
- <DocumentTitle title="0x Launch Kit" />
- <TopBar
- blockchainIsLoaded={false}
- location={this.props.location}
- isNightVersion={true}
- style={{ backgroundColor: lighterBackgroundColor, position: 'relative' }}
- translate={this.props.translate}
- />
- {this._renderHero()}
- {this._renderSection()}
- {this._renderCallToAction()}
- {this._renderDisclaimer()}
- <Footer
- backgroundColor={darkerBackgroundColor}
- translate={this.props.translate}
- dispatcher={this.props.dispatcher}
- />
- </div>
- );
- }
- private _renderHero(): React.ReactNode {
- const BENEFITS_1: Benefit[] = [
- {
- icon: '/images/launch_kit/shared_liquidity.svg',
- description: this.props.translate.get(Key.TapIntoAndShare, Deco.Cap),
- },
- {
- icon: '/images/launch_kit/fork.svg',
- description: this.props.translate.get(Key.ForkAndExtend, Deco.Cap),
- },
- {
- icon: '/images/launch_kit/enable_trading.svg',
- description: this.props.translate.get(Key.EnableTrading, Deco.Cap),
- },
- ];
- const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm;
- const smallButtonPadding = '12px 30px 12px 30px';
- const largeButtonPadding = '14px 60px 14px 60px';
- const left = 'col lg-col-6 md-col-6 col-12 lg-pl2 md-pl2 sm-pl0 sm-px3 sm-center';
- const flexClassName = isSmallScreen
- ? 'flex items-center flex-column justify-center'
- : 'flex items-center justify-center';
- return (
- <div className="clearfix pt4" style={{ backgroundColor: lighterBackgroundColor }}>
- <div className="mx-auto max-width-4 clearfix">
- <div className={`${flexClassName} lg-pb4 md-pb4 sm-mb4`}>
- <div className={left} style={{ color: colors.white }}>
- <div
- className="inline-block lg-align-middle md-align-middle sm-align-top"
- style={{
- paddingLeft: isSmallScreen ? 0 : 12,
- lineHeight: '36px',
- }}
- >
- <Text
- className="sm-pb2"
- fontFamily="Roboto"
- display="inline-block"
- fontColor={colors.white}
- fontWeight="bold"
- lineHeight="1.3em"
- letterSpacing="1px"
- fontSize={isSmallScreen ? '38px' : '46px'}
- >
- {this.props.translate.get(Key.LaunchKit, Deco.CapWords)}
- </Text>
- <Container paddingTop="18px">
- <Text fontColor={colors.linkSectionGrey} fontSize="18px">
- {this.props.translate.get(Key.LaunchKitPitch, Deco.Cap)}
- </Text>
- </Container>
- <Container
- paddingTop="54px"
- className={`flex clearfix sm-mx-auto ${isSmallScreen ? 'justify-center' : ''}`}
- >
- <Container paddingRight="20px">
- <Link to={constants.URL_LAUNCH_KIT} shouldOpenInNewTab={true}>
- <Button
- padding={isSmallScreen ? smallButtonPadding : largeButtonPadding}
- borderRadius="4px"
- borderColor={colors.white}
- >
- <Text fontSize="16px" fontWeight="bold">
- {this.props.translate.get(Key.GetStarted, Deco.Cap)}
- </Text>
- </Button>
- </Link>
- </Container>
- <div>
- <Link to={constants.URL_LAUNCH_KIT_BLOG_POST} shouldOpenInNewTab={true}>
- <Button
- backgroundColor={lighterBackgroundColor}
- borderColor={colors.white}
- fontColor={colors.white}
- padding={isSmallScreen ? smallButtonPadding : largeButtonPadding}
- borderRadius="4px"
- >
- <Text fontSize="16px" fontWeight="bold" fontColor={colors.white}>
- {this.props.translate.get(Key.LearnMore, Deco.Cap)}
- </Text>
- </Button>
- </Link>
- </div>
- </Container>
- </div>
- </div>
- <Container
- marginTop={isSmallScreen ? '60px' : '30px'}
- marginBottom="30px"
- marginLeft="15px"
- marginRight="15px"
- >
- <Image
- src="/images/launch_kit/0x_cupboard.svg"
- maxWidth={isSmallScreen ? '75%' : '100%'}
- height="auto"
- />
- </Container>
- </div>
- </div>
- {this._renderBenefits(BENEFITS_1)}
- </div>
- );
- }
- private _renderSection(): React.ReactNode {
- const BENEFITS_2: Benefit[] = [
- {
- icon: '/images/launch_kit/secondary_market.svg',
- description: this.props.translate.get(Key.QuicklyLaunch, Deco.Cap),
- },
- {
- icon: '/images/launch_kit/in_game_marketplace.svg',
- description: this.props.translate.get(Key.SeemlesslyCreate, Deco.Cap),
- },
- {
- icon: '/images/launch_kit/local_market.svg',
- description: this.props.translate.get(Key.LocalMarket, Deco.Cap),
- },
- ];
- return (
- <div className="clearfix pb4" style={{ backgroundColor: darkerBackgroundColor }}>
- <Container
- className="mx-auto"
- textAlign="center"
- paddingTop="89px"
- paddingBottom="89px"
- maxWidth="421px"
- paddingLeft="10px"
- paddingRight="10px"
- >
- <Text fontSize="26px" lineHeight="37px" fontWeight="medium" fontColor={colors.white}>
- {this.props.translate.get(Key.PerfectForDevelopers, Deco.Cap)}
- </Text>
- </Container>
- {this._renderBenefits(BENEFITS_2)}
- </div>
- );
- }
- private _renderCallToAction(): React.ReactNode {
- const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm;
- const smallButtonPadding = '8px 14px 8px 14px';
- const largeButtonPadding = '8px 14px 8px 14px';
- return (
- <Container
- className="clearfix"
- backgroundColor={lighterBackgroundColor}
- paddingTop="90px"
- paddingBottom="90px"
- >
- <Container className="clearfix mx-auto" maxWidth="850px">
- <Container className="lg-left md-left sm-mx-auto sm-pb3" width="348px">
- <Text fontColor={colors.white} fontSize="18px">
- View our comprehensive documentation to start building today.
- </Text>
- </Container>
- <Container
- className={`lg-right md-right flex clearfix sm-mx-auto ${
- isSmallScreen ? 'justify-center' : ''
- }`}
- paddingTop="5px"
- >
- <Container paddingRight="20px">
- <Link to={`${constants.URL_LAUNCH_KIT}/#table-of-contents`} shouldOpenInNewTab={true}>
- <Button
- padding={isSmallScreen ? smallButtonPadding : largeButtonPadding}
- borderRadius="4px"
- backgroundColor={lighterBackgroundColor}
- borderColor={colors.white}
- >
- <Text fontSize="16px" fontWeight="bold" fontColor={colors.white}>
- {this.props.translate.get(Key.ExploreTheDocs, Deco.Cap)}
- </Text>
- </Button>
- </Link>
- </Container>
- <div>
- <Link to={constants.URL_ZEROEX_CHAT} shouldOpenInNewTab={true}>
- <Button
- padding={isSmallScreen ? smallButtonPadding : largeButtonPadding}
- borderRadius="4px"
- >
- <Text fontSize="16px" fontWeight="bold">
- {this.props.translate.get(Key.GetInTouch, Deco.Cap)}
- </Text>
- </Button>
- </Link>
- </div>
- </Container>
- </Container>
- </Container>
- );
- }
- private _renderBenefits(benefits: Benefit[]): React.ReactNode {
- return (
- <Container className="lg-flex md-flex justify-between mx-auto pb4" maxWidth="890px">
- {_.map(benefits, benefit => {
- return (
- <Container className="mx-auto sm-pb4" width="240px">
- <Container textAlign="center">
- <img src={benefit.icon} />
- </Container>
- <Container paddingTop="26px">
- <Text
- fontSize="18px"
- lineHeight="28px"
- textAlign="center"
- fontColor={colors.linkSectionGrey}
- >
- {benefit.description}
- </Text>
- </Container>
- </Container>
- );
- })}
- </Container>
- );
- }
- private _renderDisclaimer(): React.ReactNode {
- return (
- <Container
- className="clearfix"
- backgroundColor={darkerBackgroundColor}
- paddingTop="70px"
- paddingBottom="70px"
- >
- <Container className="mx-auto" maxWidth="850px" paddingLeft="20px" paddingRight="20px">
- <Text fontColor={grayText} fontSize="10px">
- <b>Disclaimer:</b> The laws and regulations applicable to the use and exchange of digital assets
- and blockchain-native tokens, including through any software developed using the licensed work
- created by ZeroEx Intl. (the “Work”), vary by jurisdiction. As set forth in the Apache License,
- Version 2.0 applicable to the Work, developers are “solely responsible for determining the
- appropriateness of using or redistributing the Work,” which includes responsibility for ensuring
- compliance with any such applicable laws and regulations.
- </Text>
- <Container paddingTop="15px">
- <Text fontColor={grayText} fontSize="10px">
- See the{' '}
- <Link
- to={constants.URL_APACHE_LICENSE}
- shouldOpenInNewTab={true}
- textDecoration="underline"
- >
- Apache License, Version 2.0
- </Link>{' '}
- for the specific language governing all applicable permissions and limitations.
- </Text>
- </Container>
- </Container>
- </Container>
- );
- }
- private _updateScreenWidth(): void {
- const newScreenWidth = utils.getScreenWidth();
- if (newScreenWidth !== this.state.screenWidth) {
- this.setState({
- screenWidth: newScreenWidth,
- });
- }
- }
-}
diff --git a/packages/website/ts/pages/market_maker.tsx b/packages/website/ts/pages/market_maker.tsx
new file mode 100644
index 000000000..854870358
--- /dev/null
+++ b/packages/website/ts/pages/market_maker.tsx
@@ -0,0 +1,162 @@
+import * as _ from 'lodash';
+import { opacify } from 'polished';
+import * as React from 'react';
+
+import { Banner } from 'ts/components/banner';
+import { Button } from 'ts/components/button';
+import { Action, Definition } from 'ts/components/definition';
+import { Hero } from 'ts/components/hero';
+import { ModalContact, ModalContactType } from 'ts/components/modals/modal_contact';
+import { Section } from 'ts/components/newLayout';
+import { SiteWrap } from 'ts/components/siteWrap';
+import { colors } from 'ts/style/colors';
+import { WebsitePaths } from 'ts/types';
+
+interface OfferData {
+ icon: string;
+ title: string;
+ description: string;
+ links?: Action[];
+}
+export interface NextMarketMakerProps {}
+
+export class NextMarketMaker extends React.Component<NextMarketMakerProps> {
+ public state = {
+ isContactModalOpen: false,
+ };
+
+ private readonly _offersData: OfferData[];
+
+ constructor(props: NextMarketMakerProps) {
+ super(props);
+ this._offersData = [
+ {
+ icon: 'supportForAllEthereumStandards',
+ title: 'Comprehensive Tutorials',
+ description:
+ 'Stay on the bleeding edge of crypto by learning how to market make on decentralized exchanges. The network of 0x relayers provides market makers a first-mover advantage to capture larger spreads, find arbitrage opportunities, and trade on new types of exchanges like prediction markets and non-fungible token marketplaces.',
+ links: [
+ {
+ label: 'Explore the Docs',
+ url: `${WebsitePaths.Wiki}#Market-Making-on-0x`,
+ },
+ ],
+ },
+ {
+ icon: 'generateRevenueForYourBusiness-large',
+ title: 'Market Making Compensation',
+ description: 'Accepted applicants can receive up to $15,000 for completing onboarding',
+ },
+ {
+ icon: 'getInTouch',
+ title: 'Dedicated Support',
+ description:
+ 'The 0x team will provide 1:1 onboarding assistance and promptly answer all your questions. They will walk you through the tutorials so that you know how to read 0x order types, spin up an Ethereum node, and execute trades on the blockchain.',
+ links: [
+ {
+ label: 'Contact Us',
+ onClick: this._onOpenContactModal,
+ shouldUseAnchorTag: true,
+ },
+ ],
+ },
+ ];
+ }
+
+ public render(): React.ReactNode {
+ return (
+ <SiteWrap theme="light">
+ <Hero
+ maxWidth="865px"
+ maxWidthHeading="715px"
+ isLargeTitle={false}
+ isFullWidth={false}
+ isCenteredMobile={false}
+ title="Bring liquidity to the markets of the future"
+ description="Market makers (MMs) are important stakeholders in the 0x ecosystem. The Market Making Program provides a set of resources that help onboard MMs to bring liquidity to the 0x network. The Program includes tutorials, monetary incentives, and 1:1 support from the 0x team."
+ actions={this._renderHeroActions()}
+ />
+
+ <Section bgColor="light" isFlex={true} maxWidth="1170px">
+ <Definition
+ title="Secure Trading"
+ titleSize="small"
+ description="Take full custody of your assets to eliminate counterparty risk"
+ icon="secureTrading"
+ iconSize="medium"
+ isInline={true}
+ />
+
+ <Definition
+ title="Networked Liquidity Pool"
+ titleSize="small"
+ description="Use one pool of capital across multiple relayers to trade against a large group of takers"
+ icon="networkedLiquidity"
+ iconSize="medium"
+ isInline={true}
+ />
+
+ <Definition
+ title="Low Cost"
+ titleSize="small"
+ description="Pay no gas fees to make 0x orders"
+ icon="low-cost"
+ iconSize="medium"
+ isInline={true}
+ />
+ </Section>
+
+ <Section>
+ {_.map(this._offersData, (item, index) => (
+ <Definition
+ key={`offers-${index}`}
+ icon={item.icon}
+ title={item.title}
+ description={item.description}
+ isInlineIcon={true}
+ iconSize={240}
+ fontSize="medium"
+ actions={item.links}
+ />
+ ))}
+ </Section>
+
+ <Banner
+ heading="Start trading today."
+ subline="Check out our Market Making tutorials to get started"
+ mainCta={{ text: 'Tutorials', href: `${WebsitePaths.Wiki}#Market-Making-on-0x` }}
+ secondaryCta={{ text: 'Apply Now', onClick: this._onOpenContactModal }}
+ />
+ <ModalContact
+ isOpen={this.state.isContactModalOpen}
+ onDismiss={this._onDismissContactModal}
+ modalContactType={ModalContactType.MarketMaker}
+ />
+ </SiteWrap>
+ );
+ }
+
+ private readonly _onOpenContactModal = (): void => {
+ this.setState({ isContactModalOpen: true });
+ };
+
+ private readonly _onDismissContactModal = (): void => {
+ this.setState({ isContactModalOpen: false });
+ };
+
+ private readonly _renderHeroActions = () => (
+ <>
+ <Button href={`${WebsitePaths.Wiki}#Market-Making-on-0x`} bgColor="dark" isInline={true}>
+ Get Started
+ </Button>
+ <Button
+ onClick={this._onOpenContactModal}
+ borderColor={opacify(0.4)(colors.brandDark)}
+ isTransparent={true}
+ isInline={true}
+ >
+ Apply Now
+ </Button>
+ </>
+ );
+}
diff --git a/packages/website/ts/pages/not_found.tsx b/packages/website/ts/pages/not_found.tsx
index a7992a8fa..6abd8fc80 100644
--- a/packages/website/ts/pages/not_found.tsx
+++ b/packages/website/ts/pages/not_found.tsx
@@ -1,5 +1,5 @@
import * as React from 'react';
-import { Footer } from 'ts/components/footer';
+import { Footer } from 'ts/components/old_footer';
import { TopBar } from 'ts/components/top_bar/top_bar';
import { FullscreenMessage } from 'ts/pages/fullscreen_message';
import { Dispatcher } from 'ts/redux/dispatcher';
diff --git a/packages/website/ts/pages/why.tsx b/packages/website/ts/pages/why.tsx
new file mode 100644
index 000000000..197ce5fc9
--- /dev/null
+++ b/packages/website/ts/pages/why.tsx
@@ -0,0 +1,309 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import DocumentTitle from 'react-document-title';
+import ScrollableAnchor, { configureAnchors } from 'react-scrollable-anchor';
+import styled from 'styled-components';
+
+import { Banner } from 'ts/components/banner';
+import { Button } from 'ts/components/button';
+import { Definition } from 'ts/components/definition';
+import { Hero } from 'ts/components/hero';
+import { Column, Section, WrapSticky } from 'ts/components/newLayout';
+import { SiteWrap } from 'ts/components/siteWrap';
+import { Slide, Slider } from 'ts/components/slider/slider';
+import { Heading } from 'ts/components/text';
+
+import { ModalContact } from '../components/modals/modal_contact';
+
+const offersData = [
+ {
+ icon: 'robustSmartContracts',
+ title: 'Robust Smart Contracts',
+ description: `0x Protocol's smart contracts have been put through two rounds of rigorous security audits.`,
+ },
+ {
+ icon: 'extensibleArchitecture',
+ title: 'Extensible Architecture',
+ description: `0x's modular pipeline enables you to plug in your own smart contracts through an extensible API.`,
+ },
+ {
+ icon: 'eficientDesign',
+ title: 'Efficient Design',
+ description: `0x’s off-chain order relay with on-chain settlement is a gas efficient approach to p2p exchange, reducing blockchain bloat.`,
+ },
+];
+
+const functionalityData = [
+ {
+ icon: 'secureTrading',
+ title: 'Secure Non-custodial Trading',
+ description: 'Enable tokens to be traded wallet-to-wallet with no deposits or withdrawals.',
+ },
+ {
+ icon: 'flexibleOrders',
+ title: 'Flexible Order Types',
+ description: 'Choose to sell assets at a specific “buy it now” price or allow potential buyers to submit bids.',
+ },
+ {
+ icon: 'buildBusiness',
+ title: 'Build a Business',
+ description:
+ 'Monetize your product by taking fees on each transaction and join a growing number of relayers in the 0x ecosystem.',
+ },
+];
+
+const useCaseSlides = [
+ {
+ icon: 'gamingAndCollectibles',
+ title: 'Games & Collectibles',
+ description:
+ 'Artists and game makers are tokenizing digital art and in-game items known as non-fungible tokens (NFTs). 0x enables these creators to add exchange functionality by providing the ability to build marketplaces for NFT trading.',
+ },
+ {
+ icon: 'predictionMarkets',
+ title: 'Prediction Markets',
+ description:
+ 'Decentralized prediction markets and cryptodervivative platforms generate sets of tokens that represent a financial stake in the outcomes of events. 0x allows these tokens to be instantly tradable in liquid markets.',
+ },
+ {
+ icon: 'orderBooks',
+ title: 'Order Books',
+ description:
+ 'There are thousands of decentralized apps and protocols that have native utility tokens. 0x provides professional exchanges with the ability to host order books and facilitates the exchange of these assets.',
+ },
+ {
+ icon: 'decentralisedLoans',
+ title: 'Decentralized Loans',
+ description:
+ 'Efficient lending requires liquid markets where investors can buy and re-sell loans. 0x enables an ecosystem of lenders to self-organize and efficiently determine market prices for all outstanding loans.',
+ },
+ {
+ icon: 'stableTokens',
+ title: 'Stable Tokens',
+ description:
+ 'Novel economic constructs such as stable coins require efficient, liquid markets to succeed. 0x will facilitate the underlying economic mechanisms that allow these tokens to remain stable.',
+ },
+];
+
+configureAnchors({ offset: -60 });
+
+export class NextWhy extends React.Component {
+ public state = {
+ isContactModalOpen: false,
+ };
+ public render(): React.ReactNode {
+ const buildAction = (
+ <Button href="/docs" isWithArrow={true} isAccentColor={true}>
+ Build on 0x
+ </Button>
+ );
+ return (
+ <SiteWrap theme="dark">
+ <DocumentTitle title="Features & Benefits - 0x" />
+ <Hero
+ title="The exchange layer for the crypto economy"
+ description="The world's assets are becoming tokenized on public blockchains. 0x Protocol is free, open-source infrastracture that developers and businesses utilize to build products that enable the purchasing and trading of crypto tokens."
+ actions={buildAction}
+ />
+
+ <Section bgColor="dark" isFlex={true} maxWidth="1170px">
+ <Definition
+ title="Support for all Ethereum Standards"
+ titleSize="small"
+ description="0x Protocol facitilites the decentralized exchange of a growing number of Ethereum-based tokens, including all ERC-20 and ERC-721 assets."
+ icon="supportForAllEthereumStandards"
+ iconSize="large"
+ isInline={true}
+ />
+
+ <Definition
+ title="Networked Liquidity"
+ titleSize="small"
+ description="0x is lowering the barrier to entry by building a layer of networked liquidity that allows businesses to tap into a shared pool of digital assets."
+ icon="networkedLiquidity"
+ iconSize="large"
+ isInline={true}
+ />
+
+ <Definition
+ title="Flexible Integration"
+ titleSize="small"
+ description="0x is a modular system that enables businesses and projects, known as relayers, to easily add exchange functionality to any product experience."
+ icon="flexibleIntegration"
+ iconSize="large"
+ isInline={true}
+ />
+ </Section>
+
+ <Section maxWidth="1170px" isFlex={true} isFullWidth={true}>
+ <Column>
+ <NavStickyWrap offsetTop="130px">
+ <ChapterLink href="#benefits">Benefits</ChapterLink>
+ <ChapterLink href="#cases">Use Cases</ChapterLink>
+ <ChapterLink href="#functionality">Features</ChapterLink>
+ </NavStickyWrap>
+ </Column>
+
+ <Column width="55%" maxWidth="826px">
+ <Column width="100%" maxWidth="560px" padding="0 30px 0 0">
+ <ScrollableAnchor id="benefits">
+ <SectionWrap>
+ <SectionTitle size="medium" marginBottom="60px" isNoBorder={true}>
+ What 0x offers
+ </SectionTitle>
+
+ {_.map(offersData, (item, index) => (
+ <Definition
+ key={`offers-${index}`}
+ icon={item.icon}
+ title={item.title}
+ titleSize="small"
+ description={item.description}
+ isWithMargin={true}
+ />
+ ))}
+ </SectionWrap>
+ </ScrollableAnchor>
+
+ <ScrollableAnchor id="cases">
+ <SectionWrap isNotRelative={true}>
+ <SectionTitle size="medium" marginBottom="60px">
+ Use Cases
+ </SectionTitle>
+ <Slider>
+ {_.map(useCaseSlides, (item, index) => (
+ <Slide
+ key={`useCaseSlide-${index}`}
+ heading={item.title}
+ text={item.description}
+ icon={item.icon}
+ />
+ ))}
+ </Slider>
+ </SectionWrap>
+ </ScrollableAnchor>
+
+ <ScrollableAnchor id="functionality">
+ <SectionWrap>
+ <SectionTitle size="medium" marginBottom="60px">
+ Exchange Functionality
+ </SectionTitle>
+
+ {_.map(functionalityData, (item, index) => (
+ <Definition
+ key={`functionality-${index}`}
+ icon={item.icon}
+ title={item.title}
+ titleSize="small"
+ description={item.description}
+ isWithMargin={true}
+ />
+ ))}
+ </SectionWrap>
+ </ScrollableAnchor>
+ </Column>
+ </Column>
+ </Section>
+
+ <Banner
+ heading="Ready to get started?"
+ subline="Dive into our docs, or contact us if needed"
+ mainCta={{ text: 'Get Started', href: '/docs' }}
+ secondaryCta={{ text: 'Get in Touch', onClick: this._onOpenContactModal.bind(this) }}
+ />
+ <ModalContact isOpen={this.state.isContactModalOpen} onDismiss={this._onDismissContactModal} />
+ </SiteWrap>
+ );
+ }
+
+ public _onOpenContactModal = (): void => {
+ this.setState({ isContactModalOpen: true });
+ };
+
+ public _onDismissContactModal = (): void => {
+ this.setState({ isContactModalOpen: false });
+ };
+}
+
+interface SectionProps {
+ isNotRelative?: boolean;
+}
+
+const SectionWrap =
+ styled.div <
+ SectionProps >
+ `
+ position: ${props => !props.isNotRelative && 'relative'};
+
+ & + & {
+ padding-top: 60px;
+ margin-top: 60px;
+ }
+
+ @media (min-width: 768px) {
+ & + &:before {
+ width: 100vw;
+ }
+ }
+
+ @media (max-width: 768px) {
+ text-align: left;
+
+ & + &:before {
+ width: 100%;
+ }
+ }
+`;
+
+interface SectionTitleProps {
+ isNoBorder?: boolean;
+}
+const SectionTitle =
+ styled(Heading) <
+ SectionTitleProps >
+ `
+ position: relative;
+
+ ${props =>
+ !props.isNoBorder &&
+ `
+ &:before {
+ content: '';
+ width: 100vw;
+ position: absolute;
+ top: -53px;
+ left: 0;
+ height: 1px;
+ background-color: #3d3d3d;
+ }
+ `}
+
+
+ @media (max-width: 768px) {
+ &:before {
+ width: calc(100vw - 60px);
+ }
+ }
+`;
+
+const NavStickyWrap = styled(WrapSticky)`
+ padding-left: 60px;
+ z-index: 15;
+
+ @media (max-width: 768px) {
+ display: none;
+ }
+`;
+
+const ChapterLink = styled.a`
+ color: ${props => props.theme.textColor};
+ font-size: 22px;
+ margin-bottom: 25px;
+ display: block;
+ opacity: 0.8;
+
+ &:hover,
+ &:active {
+ opacity: 1;
+ }
+`;
diff --git a/packages/website/ts/style/colors.ts b/packages/website/ts/style/colors.ts
index 0620bae0f..356d72f7e 100644
--- a/packages/website/ts/style/colors.ts
+++ b/packages/website/ts/style/colors.ts
@@ -13,6 +13,17 @@ const appColors = {
jobsPageOpenPositionRow: sharedColors.grey100,
metaMaskOrange: '#f68c24',
metaMaskTransparentOrange: 'rgba(255, 248, 242, 0.8)',
+ brandLight: '#00AE99',
+ brandDark: '#003831',
+ backgroundDark: '#111A19',
+ backgroundBlack: '#000000',
+ backgroundLight: '#F3F6F4',
+ textDarkPrimary: '#000000',
+ textDarkSecondary: '#5C5C5C',
+ white: '#fff',
+ instantPrimaryBackground: '#222222',
+ instantSecondaryBackground: '#333333',
+ instantTertiaryBackground: '#444444',
};
export const colors = {
diff --git a/packages/website/ts/style/theme.ts b/packages/website/ts/style/theme.ts
index ce7d6975d..94bd0169a 100644
--- a/packages/website/ts/style/theme.ts
+++ b/packages/website/ts/style/theme.ts
@@ -4,7 +4,7 @@ import * as styledComponents from 'styled-components';
const {
default: styled,
css,
- injectGlobal,
+ createGlobalStyle,
keyframes,
ThemeProvider,
} = styledComponents as styledComponents.ThemedStyledComponentsModule<IThemeInterface>;
@@ -14,4 +14,4 @@ export interface IThemeInterface {}
export const theme = {};
-export { styled, css, injectGlobal, keyframes, ThemeProvider };
+export { styled, css, createGlobalStyle, keyframes, ThemeProvider };
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index 444a8348d..37bd73063 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -352,7 +352,16 @@ export enum WebsitePaths {
Home = '/',
FAQ = '/faq',
About = '/about',
+ AboutMission = '/about/mission',
+ AboutTeam = '/about/team',
+ AboutPress = '/about/press',
+ AboutJobs = '/about/jobs',
+ Community = '/community',
LaunchKit = '/launch-kit',
+ Instant = '/instant',
+ Ecosystem = '/eap',
+ MarketMaker = '/market-maker',
+ Why = '/why',
Whitepaper = '/pdfs/0x_white_paper.pdf',
SmartContracts = '/docs/contracts',
Connect = '/docs/connect',
@@ -366,6 +375,7 @@ export enum WebsitePaths {
OrderUtils = '/docs/order-utils',
EthereumTypes = '/docs/ethereum-types',
AssetBuyer = '/docs/asset-buyer',
+ Migrations = '/docs/migrations',
Careers = '/careers',
}
@@ -383,6 +393,7 @@ export enum DocPackages {
ContractWrappers = 'CONTRACT_WRAPPERS',
OrderWatcher = 'ORDER_WATCHER',
AssetBuyer = 'ASSET_BUYER',
+ Migrations = 'MIGRATIONS',
}
export enum Key {
@@ -460,7 +471,7 @@ export enum Key {
Website = 'WEBSITE',
Developers = 'DEVELOPERS',
Home = 'HOME',
- RocketChat = 'ROCKETCHAT',
+ Discord = 'DISCORD',
TradeCallToAction = 'TRADE_CALL_TO_ACTION',
OurMissionAndValues = 'OUR_MISSION_AND_VALUES',
BuildARelayer = 'BUILD_A_RELAYER',
@@ -471,6 +482,8 @@ export enum Key {
OrderBasicsDescription = 'ORDER_BASICS_DESCRIPTION',
UseNetworkedLiquidity = 'USE_NETWORKED_LIQUIDITY',
UseNetworkedLiquidityDescription = 'USE_NETWORKED_LIQUIDITY_DESCRIPTION',
+ Integrate0xInstant = 'INTEGRATE_0X_INSTANT',
+ Integrate0xInstantDescription = 'INTEGRATE_0X_INSTANT_DESCRIPTION',
ViewAllDocumentation = 'VIEW_ALL_DOCUMENTATION',
Sandbox = 'SANDBOX',
Github = 'GITHUB',
@@ -493,6 +506,7 @@ export enum Key {
GetInTouch = 'GET_IN_TOUCH',
LearnMore = 'LEARN_MORE',
GetStarted = 'GET_STARTED',
+ ProtocolSpecification = 'PROTOCOL_SPECIFICATION',
}
export enum SmartContractDocSections {
diff --git a/packages/website/ts/utils/configs.ts b/packages/website/ts/utils/configs.ts
index 7b74eccfb..fab382b07 100644
--- a/packages/website/ts/utils/configs.ts
+++ b/packages/website/ts/utils/configs.ts
@@ -13,9 +13,9 @@ export const configs = {
// WARNING: ZRX & WETH MUST always be default trackedTokens
DEFAULT_TRACKED_TOKEN_SYMBOLS: ['WETH', 'ZRX'],
DOMAIN_STAGING: 'staging-0xproject.s3-website-us-east-1.amazonaws.com',
- DOMAIN_DOGFOOD: 'dogfood.0xproject.com',
+ DOMAIN_DOGFOOD: 'dogfood.0x.org',
DOMAINS_DEVELOPMENT: ['0xproject.localhost:3572', 'localhost:3572', '127.0.0.1'],
- DOMAIN_PRODUCTION: '0xproject.com',
+ DOMAIN_PRODUCTION: '0x.org',
GOOGLE_ANALYTICS_ID: 'UA-98720122-1',
LAST_LOCAL_STORAGE_FILL_CLEARANCE_DATE: '2017-11-22',
LAST_LOCAL_STORAGE_TRACKED_TOKEN_CLEARANCE_DATE: '2018-9-7',
diff --git a/packages/website/ts/utils/constants.ts b/packages/website/ts/utils/constants.ts
index e9afc8763..ada8de549 100644
--- a/packages/website/ts/utils/constants.ts
+++ b/packages/website/ts/utils/constants.ts
@@ -2,8 +2,8 @@ import { ALink } from '@0x/react-shared';
import { BigNumber } from '@0x/utils';
import { Key, WebsitePaths } from 'ts/types';
-const URL_FORUM = 'https://forum.0xproject.com';
-const URL_ZEROEX_CHAT = 'https://chat.0xproject.com';
+const URL_FORUM = 'https://forum.0x.org';
+const URL_ZEROEX_CHAT = 'https://discord.gg/d3FTX3M';
export const constants = {
DECIMAL_PLACES_ETH: 18,
@@ -47,7 +47,7 @@ export const constants = {
TAKER_FEE: new BigNumber(0),
TESTNET_NAME: 'Kovan',
NUMERAL_USD_FORMAT: '$0,0.00',
- EMAIL_JOBS: 'jobs@0xproject.com',
+ EMAIL_JOBS: 'jobs@0x.org',
PROJECT_URL_ETHFINEX: 'https://www.ethfinex.com/',
PROJECT_URL_AMADEUS: 'http://amadeusrelay.org',
PROJECT_URL_DDEX: 'https://ddex.io',
@@ -75,12 +75,16 @@ export const constants = {
URL_APACHE_LICENSE: 'http://www.apache.org/licenses/LICENSE-2.0',
URL_BITLY_API: 'https://api-ssl.bitly.com',
URL_BLOG: 'https://blog.0xproject.com/latest',
- URL_DISCOURSE_FORUM: 'https://forum.0xproject.com',
+ URL_DISCOURSE_FORUM: 'https://forum.0x.org',
+ URL_ECOSYSTEM_APPLY: 'https://0x.smapply.io/',
+ URL_ECOSYSTEM_BLOG_POST: 'https://blog.0xproject.com/announcing-the-0x-ecosystem-acceleration-program-89d1cb89d565',
URL_FIREFOX_U2F_ADDON: 'https://addons.mozilla.org/en-US/firefox/addon/u2f-support-add-on/',
- URL_TESTNET_FAUCET: 'https://faucet.0xproject.com',
+ URL_TESTNET_FAUCET: 'https://faucet.0x.org',
URL_GITHUB_ORG: 'https://github.com/0xProject',
URL_GITHUB_WIKI: 'https://github.com/0xProject/wiki',
URL_FORUM,
+ URL_PROTOCOL_SPECIFICATION:
+ 'https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md',
URL_METAMASK_CHROME_STORE: 'https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn',
URL_METAMASK_FIREFOX_STORE: 'https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/',
URL_COINBASE_WALLET_IOS_APP_STORE: 'https://itunes.apple.com/us/app/coinbase-wallet/id1278383455?mt=8',
@@ -94,7 +98,9 @@ export const constants = {
URL_SANDBOX: 'https://codesandbox.io/s/1qmjyp7p5j',
URL_STANDARD_RELAYER_API_GITHUB: 'https://github.com/0xProject/standard-relayer-api/blob/master/README.md',
URL_TWITTER: 'https://twitter.com/0xproject',
+ URL_FACEBOOK: 'https://www.facebook.com/0xProject/',
URL_WETH_IO: 'https://weth.io/',
+ URL_CANONICAL_WETH_POST: 'https://blog.0xproject.com/canonical-weth-a9aa7d0279dd',
URL_ZEROEX_CHAT,
URL_LAUNCH_KIT: 'https://github.com/0xProject/0x-launch-kit',
URL_LAUNCH_KIT_BLOG_POST: 'https://blog.0xproject.com/introducing-the-0x-launch-kit-4acdc3453585',
diff --git a/packages/website/tsconfig.json b/packages/website/tsconfig.json
index 7d5f31b7f..8fbba17bb 100644
--- a/packages/website/tsconfig.json
+++ b/packages/website/tsconfig.json
@@ -20,5 +20,9 @@
"module": "esnext",
"moduleResolution": "node"
},
+ "awesomeTypescriptLoaderOptions": {
+ "useCache": true,
+ "reportFiles": ["./ts/**/*"]
+ },
"include": ["./ts/**/*"]
}
diff --git a/packages/website/tslint.json b/packages/website/tslint.json
index 50f5be4f6..3022b2c84 100644
--- a/packages/website/tslint.json
+++ b/packages/website/tslint.json
@@ -5,6 +5,7 @@
"no-object-literal-type-assertion": false,
"completed-docs": false,
"prefer-function-over-method": false,
- "custom-no-magic-numbers": false
+ "custom-no-magic-numbers": false,
+ "semicolon": [true, "always", "ignore-bound-class-methods"]
}
}
diff --git a/packages/website/webpack.config.js b/packages/website/webpack.config.js
index 33d5f648b..d9bdd91ad 100644
--- a/packages/website/webpack.config.js
+++ b/packages/website/webpack.config.js
@@ -3,6 +3,7 @@ const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin');
const childProcess = require('child_process');
+const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const GIT_SHA = childProcess
.execSync('git rev-parse HEAD')
@@ -55,6 +56,21 @@ const config = {
test: /\.css$/,
loaders: ['style-loader', 'css-loader'],
},
+ {
+ test: /\.svg$/,
+ use: [
+ {
+ loader: "react-svg-loader",
+ options: {
+ svgo: {
+ plugins: [
+ { removeViewBox: false }
+ ],
+ }
+ }
+ }
+ ]
+ },
],
},
optimization: {
@@ -70,6 +86,7 @@ const config = {
],
},
devServer: {
+ host: '0.0.0.0',
port: 3572,
historyApiFallback: {
// Fixes issue where having dots in URL path that aren't part of fileNames causes webpack-dev-server
@@ -85,6 +102,13 @@ const config = {
],
},
disableHostCheck: true,
+ // Fixes assertion error
+ // Source: https://github.com/webpack/webpack-dev-server/issues/1491
+ https: {
+ spdy: {
+ protocols: ['http/1.1']
+ }
+ },
},
};
@@ -92,6 +116,9 @@ module.exports = (_env, argv) => {
let plugins = [];
if (argv.mode === 'development') {
config.mode = 'development';
+ plugins.concat([
+ new BundleAnalyzerPlugin(),
+ ]);
} else {
config.mode = 'production';
plugins = plugins.concat([
@@ -109,7 +136,7 @@ module.exports = (_env, argv) => {
new RollbarSourceMapPlugin({
accessToken: '32c39bfa4bb6440faedc1612a9c13d28',
version: GIT_SHA,
- publicPath: 'https://0xproject.com/',
+ publicPath: 'https://0x.org/',
}),
]);
}
diff --git a/python-packages/json_schemas/.discharge.json b/python-packages/json_schemas/.discharge.json
new file mode 100644
index 000000000..66d95679f
--- /dev/null
+++ b/python-packages/json_schemas/.discharge.json
@@ -0,0 +1,13 @@
+{
+ "domain": "0x-json-schemas-py",
+ "build_command": "python setup.py build_sphinx",
+ "upload_directory": "build/docs/html",
+ "index_key": "index.html",
+ "error_key": "index.html",
+ "trailing_slashes": true,
+ "cache": 3600,
+ "aws_profile": "default",
+ "aws_region": "us-east-1",
+ "cdn": false,
+ "dns_configured": true
+}
diff --git a/python-packages/json_schemas/.pylintrc b/python-packages/json_schemas/.pylintrc
new file mode 100644
index 000000000..937bc6313
--- /dev/null
+++ b/python-packages/json_schemas/.pylintrc
@@ -0,0 +1,3 @@
+[MESSAGES CONTROL]
+disable=C0330,line-too-long,fixme,too-few-public-methods,too-many-ancestors
+# C0330 is "bad hanging indent". we use indents per `black`.
diff --git a/python-packages/json_schemas/README.md b/python-packages/json_schemas/README.md
new file mode 100644
index 000000000..ef8e888f3
--- /dev/null
+++ b/python-packages/json_schemas/README.md
@@ -0,0 +1,45 @@
+## 0x-json-schemas
+
+0x JSON schemas for those developing on top of 0x protocol.
+
+Read the [documentation](http://0x-json-schemas-py.s3-website-us-east-1.amazonaws.com/)
+
+## Installing
+
+```bash
+pip install 0x-json-schemas
+```
+
+## 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 Code and Dependencies
+
+Ensure that you have installed Python >=3.6 and Docker. Then:
+
+```bash
+pip install -e .[dev]
+```
+
+### Test
+
+Tests depend on a running ganache instance with the 0x contracts deployed in it. For convenience, a docker container is provided that has ganache-cli and a snapshot containing the necessary contracts. A shortcut is provided to run that docker container: `./setup.py ganache`. With that running, the tests can be run with `./setup.py test`.
+
+### Clean
+
+`./setup.py clean --all`
+
+### Lint
+
+`./setup.py lint`
+
+### Build Documentation
+
+`./setup.py build_sphinx`
+
+### More
+
+See `./setup.py --help-commands` for more info.
diff --git a/python-packages/json_schemas/setup.py b/python-packages/json_schemas/setup.py
new file mode 100755
index 000000000..7813f101f
--- /dev/null
+++ b/python-packages/json_schemas/setup.py
@@ -0,0 +1,191 @@
+#!/usr/bin/env python
+
+"""setuptools module for json_schemas package."""
+
+import distutils.command.build_py
+from distutils.command.clean import clean
+import subprocess # nosec
+from shutil import rmtree
+from os import environ, path
+from sys import argv
+
+from setuptools import find_packages, setup
+from setuptools.command.test import test as TestCommand
+
+
+class TestCommandExtension(TestCommand):
+ """Run pytest tests."""
+
+ def run_tests(self):
+ """Invoke pytest."""
+ import pytest
+
+ exit(pytest.main())
+
+
+class LintCommand(distutils.command.build_py.build_py):
+ """Custom setuptools command class for running linters."""
+
+ description = "Run linters"
+
+ def run(self):
+ """Run linter shell commands."""
+ lint_commands = [
+ # formatter:
+ "black --line-length 79 --check --diff src test setup.py".split(),
+ # style guide checker (formerly pep8):
+ "pycodestyle src test setup.py".split(),
+ # docstring style checker:
+ "pydocstyle src test setup.py".split(),
+ # static type checker:
+ "mypy src test setup.py".split(),
+ # security issue checker:
+ "bandit -r src ./setup.py".split(),
+ # general linter:
+ "pylint src test setup.py".split(),
+ # pylint takes relatively long to run, so it runs last, to enable
+ # fast failures.
+ ]
+
+ # tell mypy where to find interface stubs for 3rd party libs
+ environ["MYPYPATH"] = path.join(
+ path.dirname(path.realpath(argv[0])), "stubs"
+ )
+
+ for lint_command in lint_commands:
+ print(
+ "Running lint command `", " ".join(lint_command).strip(), "`"
+ )
+ subprocess.check_call(lint_command) # nosec
+
+
+class CleanCommandExtension(clean):
+ """Custom command to do custom cleanup."""
+
+ def run(self):
+ """Run the regular clean, followed by our custom commands."""
+ super().run()
+ rmtree("dist", ignore_errors=True)
+ rmtree(".mypy_cache", ignore_errors=True)
+ rmtree(".tox", ignore_errors=True)
+ rmtree(".pytest_cache", ignore_errors=True)
+ rmtree("src/*.egg-info", ignore_errors=True)
+
+
+class TestPublishCommand(distutils.command.build_py.build_py):
+ """Custom command to publish to test.pypi.org."""
+
+ description = (
+ "Publish dist/* to test.pypi.org. Run sdist & bdist_wheel first."
+ )
+
+ def run(self):
+ """Run twine to upload to test.pypi.org."""
+ subprocess.check_call( # nosec
+ (
+ "twine upload --repository-url https://test.pypi.org/legacy/"
+ + " --verbose dist/*"
+ ).split()
+ )
+
+
+class PublishCommand(distutils.command.build_py.build_py):
+ """Custom command to publish to pypi.org."""
+
+ description = "Publish dist/* to pypi.org. Run sdist & bdist_wheel first."
+
+ def run(self):
+ """Run twine to upload to pypi.org."""
+ subprocess.check_call("twine upload dist/*".split()) # nosec
+
+
+class PublishDocsCommand(distutils.command.build_py.build_py):
+ """Custom command to publish docs to S3."""
+
+ description = (
+ "Publish docs to "
+ + "http://0x-json-schemas-py.s3-website-us-east-1.amazonaws.com/"
+ )
+
+ def run(self):
+ """Run npm package `discharge` to build & upload docs."""
+ subprocess.check_call("discharge deploy".split()) # nosec
+
+
+with open("README.md", "r") as file_handle:
+ README_MD = file_handle.read()
+
+
+setup(
+ name="0x-json-schemas",
+ version="1.0.0",
+ description="JSON schemas for 0x applications",
+ long_description=README_MD,
+ long_description_content_type="text/markdown",
+ url=(
+ "https://github.com/0xProject/0x-monorepo/tree/development"
+ + "/python-packages/json_schemas"
+ ),
+ author="F. Eugene Aumson",
+ author_email="feuGeneA@users.noreply.github.com",
+ cmdclass={
+ "clean": CleanCommandExtension,
+ "lint": LintCommand,
+ "test": TestCommandExtension,
+ "test_publish": TestPublishCommand,
+ "publish": PublishCommand,
+ "publish_docs": PublishDocsCommand,
+ },
+ install_requires=["jsonschema", "mypy_extensions", "stringcase"],
+ extras_require={
+ "dev": [
+ "bandit",
+ "black",
+ "coverage",
+ "coveralls",
+ "mypy",
+ "mypy_extensions",
+ "pycodestyle",
+ "pydocstyle",
+ "pylint",
+ "pytest",
+ "sphinx",
+ "tox",
+ "twine",
+ ]
+ },
+ python_requires=">=3.6, <4",
+ package_data={"zero_ex.json_schemas": ["py.typed", "schemas/*"]},
+ package_dir={"": "src"},
+ license="Apache 2.0",
+ keywords=(
+ "ethereum cryptocurrency 0x decentralized blockchain dex exchange"
+ ),
+ namespace_packages=["zero_ex"],
+ packages=find_packages("src"),
+ classifiers=[
+ "Development Status :: 2 - Pre-Alpha",
+ "Intended Audience :: Developers",
+ "Intended Audience :: Financial and Insurance Industry",
+ "License :: OSI Approved :: Apache Software License",
+ "Natural Language :: English",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3 :: Only",
+ "Programming Language :: Python :: 3.6",
+ "Programming Language :: Python :: 3.7",
+ "Topic :: Internet :: WWW/HTTP",
+ "Topic :: Office/Business :: Financial",
+ "Topic :: Other/Nonlisted Topic",
+ "Topic :: Security :: Cryptography",
+ "Topic :: Software Development :: Libraries",
+ "Topic :: Utilities",
+ ],
+ zip_safe=False, # required per mypy
+ command_options={
+ "build_sphinx": {
+ "source_dir": ("setup.py", "src"),
+ "build_dir": ("setup.py", "build/docs"),
+ }
+ },
+)
diff --git a/python-packages/json_schemas/src/conf.py b/python-packages/json_schemas/src/conf.py
new file mode 100644
index 000000000..1ae1493e3
--- /dev/null
+++ b/python-packages/json_schemas/src/conf.py
@@ -0,0 +1,54 @@
+"""Configuration file for the Sphinx documentation builder."""
+
+# Reference: http://www.sphinx-doc.org/en/master/config
+
+from typing import List
+import pkg_resources
+
+
+# pylint: disable=invalid-name
+# because these variables are not named in upper case, as globals should be.
+
+project = "0x-json-schemas"
+# pylint: disable=redefined-builtin
+copyright = "2018, ZeroEx, Intl."
+author = "F. Eugene Aumson"
+version = pkg_resources.get_distribution("0x-json-schemas").version
+release = "" # The full version, including alpha/beta/rc tags
+
+extensions = [
+ "sphinx.ext.autodoc",
+ "sphinx.ext.doctest",
+ "sphinx.ext.intersphinx",
+ "sphinx.ext.coverage",
+ "sphinx.ext.viewcode",
+]
+
+templates_path = ["doc_templates"]
+
+source_suffix = ".rst"
+# eg: source_suffix = [".rst", ".md"]
+
+master_doc = "index" # The master toctree document.
+
+language = None
+
+exclude_patterns: List[str] = []
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = None
+
+html_theme = "alabaster"
+
+html_static_path = ["doc_static"]
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = "json_schemaspydoc"
+
+# -- Extension configuration:
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {"https://docs.python.org/": None}
diff --git a/python-packages/json_schemas/src/doc_static/.gitkeep b/python-packages/json_schemas/src/doc_static/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/python-packages/json_schemas/src/doc_static/.gitkeep
diff --git a/python-packages/json_schemas/src/index.rst b/python-packages/json_schemas/src/index.rst
new file mode 100644
index 000000000..3de809aa3
--- /dev/null
+++ b/python-packages/json_schemas/src/index.rst
@@ -0,0 +1,18 @@
+.. source for the sphinx-generated build/docs/web/index.html
+
+Python zero_ex.json_schemas
+===========================
+
+.. toctree::
+ :maxdepth: 2
+ :caption: Contents:
+
+.. automodule:: zero_ex.json_schemas
+ :members:
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/python-packages/json_schemas/src/zero_ex/__init__.py b/python-packages/json_schemas/src/zero_ex/__init__.py
new file mode 100644
index 000000000..e90d833db
--- /dev/null
+++ b/python-packages/json_schemas/src/zero_ex/__init__.py
@@ -0,0 +1,2 @@
+"""0x Python API."""
+__import__("pkg_resources").declare_namespace(__name__)
diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/__init__.py b/python-packages/json_schemas/src/zero_ex/json_schemas/__init__.py
new file mode 100644
index 000000000..10c564b99
--- /dev/null
+++ b/python-packages/json_schemas/src/zero_ex/json_schemas/__init__.py
@@ -0,0 +1,83 @@
+"""JSON schemas and associated utilities."""
+
+from os import path
+import json
+from typing import Mapping
+
+from pkg_resources import resource_string
+import jsonschema
+from stringcase import snakecase
+
+
+class _LocalRefResolver(jsonschema.RefResolver):
+ """Resolve package-local JSON schema id's."""
+
+ def __init__(self):
+ """Initialize a new instance."""
+ jsonschema.RefResolver.__init__(self, "", "")
+
+ @staticmethod
+ def resolve_from_url(url: str) -> str:
+ """Resolve the given URL.
+
+ :param url: a string representing the URL of the JSON schema to fetch.
+ :returns: a string representing the deserialized JSON schema
+ :raises jsonschema.ValidationError: when the resource associated with
+ `url` does not exist.
+ """
+ ref = url.replace("file://", "")
+ return json.loads(
+ resource_string(
+ "zero_ex.json_schemas",
+ f"schemas/{snakecase(ref.lstrip('/'))}.json",
+ )
+ )
+
+
+# Instantiate the `_LocalRefResolver()` only once so that `assert_valid()` can
+# perform multiple schema validations without reading from disk the schema
+# every time.
+_LOCAL_RESOLVER = _LocalRefResolver()
+
+
+def assert_valid(data: Mapping, schema_id: str) -> None:
+ """Validate the given `data` against the specified `schema`.
+
+ :param data: Python dictionary to be validated as a JSON object.
+ :param schema_id: id property of the JSON schema to validate against. Must
+ be one of those listed in `the 0x JSON schema files
+ <https://github.com/0xProject/0x-monorepo/tree/development/packages/json-schemas/schemas>`_.
+
+ Raises an exception if validation fails.
+
+ >>> assert_valid(
+ ... {'v': 27, 'r': '0x'+'f'*64, 's': '0x'+'f'*64},
+ ... '/ecSignatureSchema',
+ ... )
+ """
+ # noqa
+
+ _, schema = _LOCAL_RESOLVER.resolve(schema_id)
+ jsonschema.validate(data, schema, resolver=_LOCAL_RESOLVER)
+
+
+def assert_valid_json(data: str, schema_id: str) -> None:
+ """Validate the given `data` against the specified `schema`.
+
+ :param data: JSON string to be validated.
+ :param schema_id: id property of the JSON schema to validate against. Must
+ be one of those listed in `the 0x JSON schema files
+ <https://github.com/0xProject/0x-monorepo/tree/development/packages/json-schemas/schemas>`_.
+
+ Raises an exception if validation fails.
+
+ >>> assert_valid_json(
+ ... r'''{
+ ... "v": 27,
+ ... "r": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+ ... "s": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
+ ... }''',
+ ... '/ecSignatureSchema',
+ ... )
+ """ # noqa: E501 (line too long)
+ assert_valid(json.loads(data), schema_id)
diff --git a/python-packages/json_schemas/src/zero_ex/json_schemas/py.typed b/python-packages/json_schemas/src/zero_ex/json_schemas/py.typed
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/python-packages/json_schemas/src/zero_ex/json_schemas/py.typed
diff --git a/python-packages/order_utils/src/zero_ex/json_schemas/schemas b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas
index b8257372c..b8257372c 120000
--- a/python-packages/order_utils/src/zero_ex/json_schemas/schemas
+++ b/python-packages/json_schemas/src/zero_ex/json_schemas/schemas
diff --git a/python-packages/json_schemas/stubs/distutils/__init__.pyi b/python-packages/json_schemas/stubs/distutils/__init__.pyi
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/python-packages/json_schemas/stubs/distutils/__init__.pyi
diff --git a/python-packages/json_schemas/stubs/distutils/command/__init__.pyi b/python-packages/json_schemas/stubs/distutils/command/__init__.pyi
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/python-packages/json_schemas/stubs/distutils/command/__init__.pyi
diff --git a/python-packages/json_schemas/stubs/distutils/command/clean.pyi b/python-packages/json_schemas/stubs/distutils/command/clean.pyi
new file mode 100644
index 000000000..46a42ddb1
--- /dev/null
+++ b/python-packages/json_schemas/stubs/distutils/command/clean.pyi
@@ -0,0 +1,7 @@
+from distutils.core import Command
+
+class clean(Command):
+ def initialize_options(self: clean) -> None: ...
+ def finalize_options(self: clean) -> None: ...
+ def run(self: clean) -> None: ...
+ ...
diff --git a/python-packages/json_schemas/stubs/jsonschema/__init__.pyi b/python-packages/json_schemas/stubs/jsonschema/__init__.pyi
new file mode 100644
index 000000000..442e2f65e
--- /dev/null
+++ b/python-packages/json_schemas/stubs/jsonschema/__init__.pyi
@@ -0,0 +1,11 @@
+from typing import Any, Dict, Tuple
+
+
+class RefResolver:
+ def resolve(self, url: str) -> Tuple[str, Dict]:
+ ...
+
+
+class ValidationError(Exception): pass
+
+def validate(instance: Any, schema: Dict, cls=None, *args, **kwargs) -> None: pass
diff --git a/python-packages/json_schemas/stubs/jsonschema/exceptions.pyi b/python-packages/json_schemas/stubs/jsonschema/exceptions.pyi
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/python-packages/json_schemas/stubs/jsonschema/exceptions.pyi
diff --git a/python-packages/json_schemas/stubs/pytest/__init__.pyi b/python-packages/json_schemas/stubs/pytest/__init__.pyi
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/python-packages/json_schemas/stubs/pytest/__init__.pyi
diff --git a/python-packages/json_schemas/stubs/pytest/raises.pyi b/python-packages/json_schemas/stubs/pytest/raises.pyi
new file mode 100644
index 000000000..2e3b29f3d
--- /dev/null
+++ b/python-packages/json_schemas/stubs/pytest/raises.pyi
@@ -0,0 +1 @@
+def raises(exception: Exception) -> ExceptionInfo: ...
diff --git a/python-packages/json_schemas/stubs/setuptools/__init__.pyi b/python-packages/json_schemas/stubs/setuptools/__init__.pyi
new file mode 100644
index 000000000..8ea8d32b7
--- /dev/null
+++ b/python-packages/json_schemas/stubs/setuptools/__init__.pyi
@@ -0,0 +1,8 @@
+from distutils.dist import Distribution
+from typing import Any, List
+
+def setup(**attrs: Any) -> Distribution: ...
+
+class Command: ...
+
+def find_packages(where: str) -> List[str]: ...
diff --git a/python-packages/json_schemas/stubs/setuptools/command/__init__.pyi b/python-packages/json_schemas/stubs/setuptools/command/__init__.pyi
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/python-packages/json_schemas/stubs/setuptools/command/__init__.pyi
diff --git a/python-packages/json_schemas/stubs/setuptools/command/test.pyi b/python-packages/json_schemas/stubs/setuptools/command/test.pyi
new file mode 100644
index 000000000..c5ec770ad
--- /dev/null
+++ b/python-packages/json_schemas/stubs/setuptools/command/test.pyi
@@ -0,0 +1,3 @@
+from setuptools import Command
+
+class test(Command): ...
diff --git a/python-packages/json_schemas/stubs/stringcase/__init__.pyi b/python-packages/json_schemas/stubs/stringcase/__init__.pyi
new file mode 100644
index 000000000..56d784cf5
--- /dev/null
+++ b/python-packages/json_schemas/stubs/stringcase/__init__.pyi
@@ -0,0 +1,2 @@
+def snakecase(_: str):
+ ...
diff --git a/python-packages/json_schemas/test/__init__.py b/python-packages/json_schemas/test/__init__.py
new file mode 100644
index 000000000..ce724e180
--- /dev/null
+++ b/python-packages/json_schemas/test/__init__.py
@@ -0,0 +1 @@
+"""Tests of zero_ex.json_schemas."""
diff --git a/python-packages/json_schemas/test/test_doctest.py b/python-packages/json_schemas/test/test_doctest.py
new file mode 100644
index 000000000..2aa576422
--- /dev/null
+++ b/python-packages/json_schemas/test/test_doctest.py
@@ -0,0 +1,25 @@
+"""Exercise doctests for all of our modules."""
+
+from doctest import testmod
+import pkgutil
+import importlib
+
+import zero_ex.json_schemas
+
+
+def test_all_doctests():
+ """Gather zero_ex.json_schemas.* modules and doctest them."""
+ # json_schemas module
+ module = "zero_ex.json_schemas"
+ print(module)
+ failure_count, _ = testmod(importlib.import_module(module))
+ assert failure_count == 0
+
+ # any json_schemas.* sub-modules
+ for (_, modname, _) in pkgutil.walk_packages(
+ path=zero_ex.json_schemas.__path__, prefix="zero_ex.json_schemas"
+ ):
+ module = importlib.import_module(modname)
+ print(module)
+ (failure_count, _) = testmod(module)
+ assert failure_count == 0
diff --git a/python-packages/json_schemas/test/test_json_schemas.py b/python-packages/json_schemas/test/test_json_schemas.py
new file mode 100644
index 000000000..d0e9840b3
--- /dev/null
+++ b/python-packages/json_schemas/test/test_json_schemas.py
@@ -0,0 +1,41 @@
+"""Tests of zero_ex.json_schemas"""
+
+
+from zero_ex.json_schemas import _LOCAL_RESOLVER, assert_valid
+
+
+NULL_ADDRESS = "0x0000000000000000000000000000000000000000"
+
+EMPTY_ORDER = {
+ "makerAddress": NULL_ADDRESS,
+ "takerAddress": NULL_ADDRESS,
+ "senderAddress": NULL_ADDRESS,
+ "feeRecipientAddress": NULL_ADDRESS,
+ "makerAssetData": NULL_ADDRESS,
+ "takerAssetData": NULL_ADDRESS,
+ "salt": "0",
+ "makerFee": "0",
+ "takerFee": "0",
+ "makerAssetAmount": "0",
+ "takerAssetAmount": "0",
+ "expirationTimeSeconds": "0",
+ "exchangeAddress": NULL_ADDRESS,
+}
+
+
+def test_assert_valid_caches_resources():
+ """Test that the JSON ref resolver in `assert_valid()` caches resources
+
+ In order to test the cache we much access the private class of
+ `json_schemas` and reset the LRU cache on `_LocalRefResolver`.
+ For this to happen, we need to disable errror `W0212`
+ on _LOCAL_RESOLVER
+ """
+ _LOCAL_RESOLVER._remote_cache.cache_clear() # pylint: disable=W0212
+
+ assert_valid(EMPTY_ORDER, "/orderSchema")
+ cache_info = (
+ _LOCAL_RESOLVER._remote_cache.cache_info() # pylint: disable=W0212
+ )
+ assert cache_info.currsize == 4
+ assert cache_info.hits == 10
diff --git a/python-packages/json_schemas/tox.ini b/python-packages/json_schemas/tox.ini
new file mode 100644
index 000000000..1d5de646e
--- /dev/null
+++ b/python-packages/json_schemas/tox.ini
@@ -0,0 +1,25 @@
+# tox (https://tox.readthedocs.io/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = py37
+
+[testenv]
+commands =
+ pip install -e .[dev]
+ python setup.py test
+
+[testenv:run_tests_against_test_deployment]
+commands =
+ # install dependencies from real PyPI
+ pip install jsonschema mypy_extensions pytest
+ # install package-under-test from test PyPI
+ pip install --index-url https://test.pypi.org/legacy/ 0x-json-schemas
+ pytest test
+
+[testenv:run_tests_against_deployment]
+commands =
+ pip install 0x-json-schemas
+ pytest test
diff --git a/python-packages/order_utils/setup.py b/python-packages/order_utils/setup.py
index 125de5ff7..06533e60a 100755
--- a/python-packages/order_utils/setup.py
+++ b/python-packages/order_utils/setup.py
@@ -137,14 +137,8 @@ class GanacheCommand(distutils.command.build_py.build_py):
def run(self):
"""Run ganache."""
cmd_line = (
- "docker run -d -p 8545:8545 0xorg/ganache-cli --gasLimit"
- + " 10000000 --db /snapshot --noVMErrorsOnRPCResponse -p 8545"
- + " --networkId 50 -m"
+ "docker run -d -p 8545:8545 0xorg/ganache-cli:2.2.2"
).split()
- cmd_line.append(
- "concert load couple harbor equip island argue ramp clarify fence"
- + " smart topic"
- )
subprocess.call(cmd_line) # nosec
@@ -171,9 +165,9 @@ setup(
"ganache": GanacheCommand,
},
install_requires=[
+ "0x-json-schemas",
"eth-abi",
"eth_utils",
- "jsonschema",
"mypy_extensions",
"web3",
],
@@ -198,7 +192,6 @@ setup(
package_data={
"zero_ex.order_utils": ["py.typed"],
"zero_ex.contract_artifacts": ["artifacts/*"],
- "zero_ex.json_schemas": ["schemas/*"],
},
package_dir={"": "src"},
license="Apache 2.0",
diff --git a/python-packages/order_utils/src/index.rst b/python-packages/order_utils/src/index.rst
index 551487ab1..4d27a4b17 100644
--- a/python-packages/order_utils/src/index.rst
+++ b/python-packages/order_utils/src/index.rst
@@ -22,9 +22,6 @@ See source for class properties. Sphinx does not easily generate class property
.. autoclass:: zero_ex.order_utils.asset_data_utils.ERC721AssetData
-.. automodule:: zero_ex.json_schemas
- :members:
-
Indices and tables
==================
diff --git a/python-packages/order_utils/src/zero_ex/dev_utils/type_assertions.py b/python-packages/order_utils/src/zero_ex/dev_utils/type_assertions.py
index 1dcfb39a9..4681315a8 100644
--- a/python-packages/order_utils/src/zero_ex/dev_utils/type_assertions.py
+++ b/python-packages/order_utils/src/zero_ex/dev_utils/type_assertions.py
@@ -80,8 +80,6 @@ def assert_is_provider(value: Any, name: str) -> None:
If `value` isn't a Web3 provider, raise a TypeError.
"""
- # TODO: make this provider check more flexible.
- # https://app.asana.com/0/684263176955174/901300863045491/f
if not isinstance(value, BaseProvider):
raise TypeError(
f"Expected variable '{name}' to be an instance of a Web3 provider,"
diff --git a/python-packages/order_utils/src/zero_ex/json_schemas/__init__.py b/python-packages/order_utils/src/zero_ex/json_schemas/__init__.py
deleted file mode 100644
index 2a1728b8a..000000000
--- a/python-packages/order_utils/src/zero_ex/json_schemas/__init__.py
+++ /dev/null
@@ -1,61 +0,0 @@
-"""JSON schemas and associated utilities."""
-
-from os import path
-import json
-from typing import Mapping
-
-from pkg_resources import resource_string
-import jsonschema
-
-
-def assert_valid(data: Mapping, schema_id: str) -> None:
- """Validate the given `data` against the specified `schema`.
-
- :param data: Python dictionary to be validated as a JSON object.
- :param schema_id: id property of the JSON schema to validate against. Must
- be one of those listed in `the 0x JSON schema files
- <https://github.com/0xProject/0x-monorepo/tree/development/packages/json-schemas/schemas>`_.
-
- Raises an exception if validation fails.
-
- >>> assert_valid(
- ... {'v': 27, 'r': '0x'+'f'*64, 's': '0x'+'f'*64},
- ... '/ECSignature',
- ... )
- """
- # noqa
- class LocalRefResolver(jsonschema.RefResolver):
- """Resolve package-local JSON schema id's."""
-
- def __init__(self):
- self.ref_to_file = {
- "/addressSchema": "address_schema.json",
- "/hexSchema": "hex_schema.json",
- "/orderSchema": "order_schema.json",
- "/wholeNumberSchema": "whole_number_schema.json",
- "/ECSignature": "ec_signature_schema.json",
- "/ecSignatureParameterSchema": (
- "ec_signature_parameter_schema.json" + ""
- ),
- }
- jsonschema.RefResolver.__init__(self, "", "")
-
- def resolve_from_url(self, url):
- """Resolve the given URL."""
- ref = url.replace("file://", "")
- if ref in self.ref_to_file:
- return json.loads(
- resource_string(
- "zero_ex.json_schemas",
- f"schemas/{self.ref_to_file[ref]}",
- )
- )
- raise jsonschema.ValidationError(
- f"Unknown ref '{ref}'. "
- + f"Known refs: {list(self.ref_to_file.keys())}."
- )
-
- resolver = LocalRefResolver()
- jsonschema.validate(
- data, resolver.resolve_from_url(schema_id), resolver=resolver
- )
diff --git a/python-packages/order_utils/stubs/jsonschema/__init__.pyi b/python-packages/order_utils/stubs/jsonschema/__init__.pyi
deleted file mode 100644
index 762b58b22..000000000
--- a/python-packages/order_utils/stubs/jsonschema/__init__.pyi
+++ /dev/null
@@ -1,5 +0,0 @@
-from typing import Any, Dict
-
-class RefResolver: pass
-
-def validate(instance: Any, schema: Dict, cls=None, *args, **kwargs) -> None: pass
diff --git a/python-packages/order_utils/stubs/web3/__init___BASE_31011.pyi b/python-packages/order_utils/stubs/web3/__init___BASE_31011.pyi
new file mode 100644
index 000000000..fcecc7434
--- /dev/null
+++ b/python-packages/order_utils/stubs/web3/__init___BASE_31011.pyi
@@ -0,0 +1,26 @@
+from typing import Dict, Optional, Union
+
+from web3.utils import datatypes
+
+
+class Web3:
+ class HTTPProvider: ...
+
+ def __init__(self, provider: HTTPProvider) -> None: ...
+
+ @staticmethod
+ def sha3(
+ primitive: Optional[Union[bytes, int, None]] = None,
+ text: Optional[str] = None,
+ hexstr: Optional[str] = None
+ ) -> bytes: ...
+
+ class net:
+ version: str
+ ...
+
+ class eth:
+ @staticmethod
+ def contract(address: str, abi: Dict) -> datatypes.Contract: ...
+ ...
+ ...
diff --git a/python-packages/order_utils/test/test_doctest.py b/python-packages/order_utils/test/test_doctest.py
index f692b3b6c..297f75e75 100644
--- a/python-packages/order_utils/test/test_doctest.py
+++ b/python-packages/order_utils/test/test_doctest.py
@@ -2,16 +2,17 @@
from doctest import testmod
import pkgutil
+import importlib
import zero_ex
def test_all_doctests():
"""Gather zero_ex.* modules and doctest them."""
- for (importer, modname, _) in pkgutil.walk_packages(
+ for (_, modname, _) in pkgutil.walk_packages(
path=zero_ex.__path__, prefix="zero_ex."
):
- module = importer.find_module(modname).load_module(modname)
+ module = importlib.import_module(modname)
print(module)
(failure_count, _) = testmod(module)
assert failure_count == 0
diff --git a/python-packages/sra_client/README.md b/python-packages/sra_client/README.md
new file mode 100644
index 000000000..279fb41a4
--- /dev/null
+++ b/python-packages/sra_client/README.md
@@ -0,0 +1,332 @@
+# 0x-sra-client
+
+A Python client for interacting with servers conforming to [the Standard Relayer API specification](https://github.com/0xProject/0x-monorepo/tree/development/packages/sra-spec).
+
+# Schemas
+
+The [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x.js/tree/development/packages/json-schemas). Examples of each payload and response can be found in the 0x.js library's [test suite](https://github.com/0xProject/0x.js/blob/development/packages/json-schemas/test/schema_test.ts#L1).
+
+```bash
+pip install 0x-json-schemas
+```
+
+You can easily validate your API's payloads and responses using the [0x-json-schemas](https://github.com/0xProject/0x.js/tree/development/python-packages/json_schemas) package:
+
+```python
+from zero_ex.json_schemas import assert_valid
+from zero_ex.order_utils import Order
+
+order: Order = {
+ 'makerAddress': "0x0000000000000000000000000000000000000000",
+ 'takerAddress': "0x0000000000000000000000000000000000000000",
+ 'feeRecipientAddress': "0x0000000000000000000000000000000000000000",
+ 'senderAddress': "0x0000000000000000000000000000000000000000",
+ 'makerAssetAmount': "1000000000000000000",
+ 'takerAssetAmount': "1000000000000000000",
+ 'makerFee': "0",
+ 'takerFee': "0",
+ 'expirationTimeSeconds': "12345",
+ 'salt': "12345",
+ 'makerAssetData': "0x0000000000000000000000000000000000000000",
+ 'takerAssetData': "0x0000000000000000000000000000000000000000",
+ 'exchangeAddress': "0x0000000000000000000000000000000000000000",
+}
+
+assert_valid(order, "/orderSchema")
+```
+
+# Pagination
+
+Requests that return potentially large collections should respond to the **?page** and **?perPage** parameters. For example:
+
+```bash
+$ curl https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20
+```
+
+Page numbering should be 1-indexed, not 0-indexed. If a query provides an unreasonable (ie. too high) `perPage` value, the response can return a validation error as specified in the [errors section](#section/Errors). If the query specifies a `page` that does not exist (ie. there are not enough `records`), the response should just return an empty `records` array.
+
+All endpoints that are paginated should return a `total`, `page`, `perPage` and a `records` value in the top level of the collection. The value of `total` should be the total number of records for a given query, whereas `records` should be an array representing the response to the query for that page. `page` and `perPage`, are the same values that were specified in the request. See the note in [miscellaneous](#section/Misc.) about formatting `snake_case` vs. `lowerCamelCase`.
+
+These requests include the [`/v2/asset_pairs`](#operation/getAssetPairs), [`/v2/orders`](#operation/getOrders), [`/v2/fee_recipients`](#operation/getFeeRecipients) and [`/v2/orderbook`](#operation/getOrderbook) endpoints.
+
+# Network Id
+
+All requests should be able to specify a **?networkId** query param for all supported networks. For example:
+
+```bash
+$ curl https://api.example-relayer.com/v2/asset_pairs?networkId=1
+```
+
+If the query param is not provided, it should default to **1** (mainnet).
+
+Networks and their Ids:
+
+| Network Id | Network Name |
+| ---------- | ------------ |
+| 1 | Mainnet |
+| 42 | Kovan |
+| 3 | Ropsten |
+| 4 | Rinkeby |
+
+If a certain network is not supported, the response should **400** as specified in the [error response](#section/Errors) section. For example:
+
+```json
+{
+ \"code\": 100,
+ \"reason\": \"Validation failed\",
+ \"validationErrors\": [
+ {
+ \"field\": \"networkId\",
+ \"code\": 1006,
+ \"reason\": \"Network id 42 is not supported\"
+ }
+ ]
+}
+```
+
+# Link Header
+
+A [Link Header](https://tools.ietf.org/html/rfc5988) can be included in a response to provide clients with more context about paging
+For example:
+
+```bash
+Link: <https://api.example-relayer.com/v2/asset_pairs?page=3&perPage=20>; rel=\"next\",
+<https://api.github.com/user/repos?page=10&perPage=20>; rel=\"last\"
+```
+
+This `Link` response header contains one or more Hypermedia link relations.
+
+The possible `rel` values are:
+
+| Name | Description |
+| ----- | ------------------------------------------------------------- |
+| next | The link relation for the immediate next page of results. |
+| last | The link relation for the last page of results. |
+| first | The link relation for the first page of results. |
+| prev | The link relation for the immediate previous page of results. |
+
+# Rate Limits
+
+Rate limit guidance for clients can be optionally returned in the response headers:
+
+| Header Name | Description |
+| --------------------- | ---------------------------------------------------------------------------- |
+| X-RateLimit-Limit | The maximum number of requests you're permitted to make per hour. |
+| X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |
+| X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds. |
+
+For example:
+
+```bash
+$ curl -i https://api.example-relayer.com/v2/asset_pairs
+HTTP/1.1 200 OK
+Date: Mon, 20 Oct 2017 12:30:06 GMT
+Status: 200 OK
+X-RateLimit-Limit: 60
+X-RateLimit-Remaining: 56
+X-RateLimit-Reset: 1372700873
+```
+
+When a rate limit is exceeded, a status of **429 Too Many Requests** should be returned.
+
+# Errors
+
+Unless the spec defines otherwise, errors to bad requests should respond with HTTP 4xx or status codes.
+
+## Common error codes
+
+| Code | Reason |
+| ---- | --------------------------------------- |
+| 400 | Bad Request – Invalid request format |
+| 404 | Not found |
+| 429 | Too many requests - Rate limit exceeded |
+| 500 | Internal Server Error |
+| 501 | Not Implemented |
+
+## Error reporting format
+
+For all **400** responses, see the [error response schema](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/schemas/relayer_api_error_response_schema.ts#L1).
+
+```json
+{
+ \"code\": 101,
+ \"reason\": \"Validation failed\",
+ \"validationErrors\": [
+ {
+ \"field\": \"maker\",
+ \"code\": 1002,
+ \"reason\": \"Invalid address\"
+ }
+ ]
+}
+```
+
+General error codes:
+
+```bash
+100 - Validation Failed
+101 - Malformed JSON
+102 - Order submission disabled
+103 - Throttled
+```
+
+Validation error codes:
+
+```bash
+1000 - Required field
+1001 - Incorrect format
+1002 - Invalid address
+1003 - Address not supported
+1004 - Value out of range
+1005 - Invalid signature or hash
+1006 - Unsupported option
+```
+
+# Asset Data Encoding
+
+As we now support multiple [token transfer proxies](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#assetproxy), the identifier of which proxy to use for the token transfer must be encoded, along with the token information. Each proxy in 0x v2 has a unique identifier. If you're using 0x.js there will be helper methods for this [encoding](https://0xproject.com/docs/0x.js#zeroEx-encodeERC20AssetData) and [decoding](https://0xproject.com/docs/0x.js#zeroEx-decodeAssetProxyId).
+
+The identifier for the Proxy uses a similar scheme to [ABI function selectors](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#function-selector).
+
+```js
+// ERC20 Proxy ID 0xf47261b0
+bytes4(keccak256('ERC20Token(address)'));
+// ERC721 Proxy ID 0x02571792
+bytes4(keccak256('ERC721Token(address,uint256)'));
+```
+
+Asset data is encoded using [ABI encoding](https://solidity.readthedocs.io/en/develop/abi-spec.html).
+
+For example, encoding the ERC20 token contract (address: 0x1dc4c1cefef38a777b15aa20260a54e584b16c48) using the ERC20 Transfer Proxy (id: 0xf47261b0) would be:
+
+```bash
+0xf47261b00000000000000000000000001dc4c1cefef38a777b15aa20260a54e584b16c48
+```
+
+Encoding the ERC721 token contract (address: `0x371b13d97f4bf77d724e78c16b7dc74099f40e84`), token id (id: `99`, which hex encoded is `0x63`) and the ERC721 Transfer Proxy (id: 0x02571792) would be:
+
+```bash
+0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063
+```
+
+For more information see [the Asset Proxy](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#erc20proxy) section of the v2 spec and the [Ethereum ABI Spec](https://solidity.readthedocs.io/en/develop/abi-spec.html).
+
+# Meta Data in Order Responses
+
+In v2 of the standard relayer API we added the `metaData` field. It is meant to provide a standard place for relayers to put optional, custom or non-standard fields that may of interest to the consumer of the API.
+
+A good example of such a field is `remainingTakerAssetAmount`, which is a convenience field that communicates how much of a 0x order is potentially left to be filled. Unlike the other fields in a 0x order, it is not guaranteed to be correct as it is derived from whatever mechanism the implementer (ie. the relayer) is using. While convenient for prototyping and low stakes situations, we recommend validating the value of the field by checking the state of the blockchain yourself, such as by using [Order Watcher](https://0xproject.com/wiki#0x-OrderWatcher).
+
+# Misc.
+
+* All requests and responses should be of **application/json** content type
+* All token amounts are sent in amounts of the smallest level of precision (base units). (e.g if a token has 18 decimal places, selling 1 token would show up as selling `'1000000000000000000'` units by this API).
+* All addresses are sent as lower-case (non-checksummed) Ethereum addresses with the `0x` prefix.
+* All parameters are to be written in `lowerCamelCase`.
+
+This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
+
+* API version: 2.0.0
+* Package version: 1.0.0
+* Build package: org.openapitools.codegen.languages.PythonClientCodegen
+
+## Requirements.
+
+Python 2.7 and 3.4+
+
+## Installation & Usage
+
+### pip install
+
+If the python package is hosted on Github, you can install directly from Github
+
+```sh
+pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
+```
+
+(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
+
+Then import the package:
+
+```python
+import sra_client
+```
+
+### Setuptools
+
+Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
+
+```sh
+python setup.py install --user
+```
+
+(or `sudo python setup.py install` to install the package for all users)
+
+Then import the package:
+
+```python
+import sra_client
+```
+
+## Getting Started
+
+Please follow the [installation procedure](#installation--usage) and then run the following:
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi(sra_client.ApiClient(configuration))
+asset_data_a = 0xf47261b04c32345ced77393b3530b1eed0f346429d # str | The assetData value for the first asset in the pair. (optional)
+asset_data_b = 0x0257179264389b814a946f3e92105513705ca6b990 # str | The assetData value for the second asset in the pair. (optional)
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+page = 3 # float | The number of the page to request in the collection. (optional) (default to 1)
+per_page = 10 # float | The number of records to return per page. (optional) (default to 100)
+
+try:
+ api_response = api_instance.get_asset_pairs(asset_data_a=asset_data_a, asset_data_b=asset_data_b, network_id=network_id, page=page, per_page=per_page)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_asset_pairs: %s\n" % e)
+```
+
+## Documentation for API Endpoints
+
+All URIs are relative to _http://localhost_
+
+| Class | Method | HTTP request | Description |
+| ------------ | --------------------------------------------------------------- | ----------------------------- | ----------- |
+| _DefaultApi_ | [**get_asset_pairs**](docs/DefaultApi.md#get_asset_pairs) | **GET** /v2/asset_pairs |
+| _DefaultApi_ | [**get_fee_recipients**](docs/DefaultApi.md#get_fee_recipients) | **GET** /v2/fee_recipients |
+| _DefaultApi_ | [**get_order**](docs/DefaultApi.md#get_order) | **GET** /v2/order/{orderHash} |
+| _DefaultApi_ | [**get_order_config**](docs/DefaultApi.md#get_order_config) | **POST** /v2/order_config |
+| _DefaultApi_ | [**get_orderbook**](docs/DefaultApi.md#get_orderbook) | **GET** /v2/orderbook |
+| _DefaultApi_ | [**get_orders**](docs/DefaultApi.md#get_orders) | **GET** /v2/orders |
+| _DefaultApi_ | [**post_order**](docs/DefaultApi.md#post_order) | **POST** /v2/order |
+
+## Documentation For Models
+
+* [OrderSchema](docs/OrderSchema.md)
+* [PaginatedCollectionSchema](docs/PaginatedCollectionSchema.md)
+* [RelayerApiAssetDataPairsResponseSchema](docs/RelayerApiAssetDataPairsResponseSchema.md)
+* [RelayerApiAssetDataTradeInfoSchema](docs/RelayerApiAssetDataTradeInfoSchema.md)
+* [RelayerApiErrorResponseSchema](docs/RelayerApiErrorResponseSchema.md)
+* [RelayerApiErrorResponseSchemaValidationErrors](docs/RelayerApiErrorResponseSchemaValidationErrors.md)
+* [RelayerApiFeeRecipientsResponseSchema](docs/RelayerApiFeeRecipientsResponseSchema.md)
+* [RelayerApiOrderConfigPayloadSchema](docs/RelayerApiOrderConfigPayloadSchema.md)
+* [RelayerApiOrderConfigResponseSchema](docs/RelayerApiOrderConfigResponseSchema.md)
+* [RelayerApiOrderSchema](docs/RelayerApiOrderSchema.md)
+* [RelayerApiOrderbookResponseSchema](docs/RelayerApiOrderbookResponseSchema.md)
+* [RelayerApiOrdersChannelSubscribePayloadSchema](docs/RelayerApiOrdersChannelSubscribePayloadSchema.md)
+* [RelayerApiOrdersChannelSubscribeSchema](docs/RelayerApiOrdersChannelSubscribeSchema.md)
+* [RelayerApiOrdersChannelUpdateSchema](docs/RelayerApiOrdersChannelUpdateSchema.md)
+* [RelayerApiOrdersResponseSchema](docs/RelayerApiOrdersResponseSchema.md)
+* [SignedOrderSchema](docs/SignedOrderSchema.md)
+
+## Documentation For Authorization
+
+All endpoints do not require authorization.
diff --git a/python-packages/sra_client/docs/DefaultApi.md b/python-packages/sra_client/docs/DefaultApi.md
new file mode 100644
index 000000000..942188bc6
--- /dev/null
+++ b/python-packages/sra_client/docs/DefaultApi.md
@@ -0,0 +1,397 @@
+# sra_client.DefaultApi
+
+All URIs are relative to _http://localhost_
+
+| Method | HTTP request | Description |
+| ---------------------------------------------------------- | ----------------------------- | ----------- |
+| [**get_asset_pairs**](DefaultApi.md#get_asset_pairs) | **GET** /v2/asset_pairs |
+| [**get_fee_recipients**](DefaultApi.md#get_fee_recipients) | **GET** /v2/fee_recipients |
+| [**get_order**](DefaultApi.md#get_order) | **GET** /v2/order/{orderHash} |
+| [**get_order_config**](DefaultApi.md#get_order_config) | **POST** /v2/order_config |
+| [**get_orderbook**](DefaultApi.md#get_orderbook) | **GET** /v2/orderbook |
+| [**get_orders**](DefaultApi.md#get_orders) | **GET** /v2/orders |
+| [**post_order**](DefaultApi.md#post_order) | **POST** /v2/order |
+
+# **get_asset_pairs**
+
+> RelayerApiAssetDataPairsResponseSchema get_asset_pairs(asset_data_a=asset_data_a, asset_data_b=asset_data_b, network_id=network_id, page=page, per_page=per_page)
+
+Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+asset_data_a = 0xf47261b04c32345ced77393b3530b1eed0f346429d # str | The assetData value for the first asset in the pair. (optional)
+asset_data_b = 0x0257179264389b814a946f3e92105513705ca6b990 # str | The assetData value for the second asset in the pair. (optional)
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+page = 3 # float | The number of the page to request in the collection. (optional) (default to 1)
+per_page = 10 # float | The number of records to return per page. (optional) (default to 100)
+
+try:
+ api_response = api_instance.get_asset_pairs(asset_data_a=asset_data_a, asset_data_b=asset_data_b, network_id=network_id, page=page, per_page=per_page)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_asset_pairs: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---------------- | --------- | ----------------------------------------------------- | -------------------------- |
+| **asset_data_a** | **str** | The assetData value for the first asset in the pair. | [optional] |
+| **asset_data_b** | **str** | The assetData value for the second asset in the pair. | [optional] |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **page** | **float** | The number of the page to request in the collection. | [optional][default to 1] |
+| **per_page** | **float** | The number of records to return per page. | [optional][default to 100] |
+
+### Return type
+
+[**RelayerApiAssetDataPairsResponseSchema**](RelayerApiAssetDataPairsResponseSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: Not defined
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_fee_recipients**
+
+> RelayerApiFeeRecipientsResponseSchema get_fee_recipients(network_id=network_id, page=page, per_page=per_page)
+
+Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination).
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+page = 3 # float | The number of the page to request in the collection. (optional) (default to 1)
+per_page = 10 # float | The number of records to return per page. (optional) (default to 100)
+
+try:
+ api_response = api_instance.get_fee_recipients(network_id=network_id, page=page, per_page=per_page)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_fee_recipients: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| -------------- | --------- | ---------------------------------------------------- | -------------------------- |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **page** | **float** | The number of the page to request in the collection. | [optional][default to 1] |
+| **per_page** | **float** | The number of records to return per page. | [optional][default to 100] |
+
+### Return type
+
+[**RelayerApiFeeRecipientsResponseSchema**](RelayerApiFeeRecipientsResponseSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: Not defined
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_order**
+
+> RelayerApiOrderSchema get_order(order_hash, network_id=network_id)
+
+Retrieves the 0x order with meta info that is associated with the hash.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+order_hash = 0xd4b103c42d2512eef3fee775e097f044291615d25f5d71e0ac70dbd49d223591 # str | The hash of the desired 0x order.
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+
+try:
+ api_response = api_instance.get_order(order_hash, network_id=network_id)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_order: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| -------------- | --------- | --------------------------------- | ------------------------ |
+| **order_hash** | **str** | The hash of the desired 0x order. |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+
+### Return type
+
+[**RelayerApiOrderSchema**](RelayerApiOrderSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: Not defined
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_order_config**
+
+> RelayerApiOrderConfigResponseSchema get_order_config(network_id=network_id, relayer_api_order_config_payload_schema=relayer_api_order_config_payload_schema)
+
+Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+relayer_api_order_config_payload_schema = {"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"1","makerAssetData":"0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498","takerAssetData":"0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","expirationTimeSeconds":"1532560590"} # RelayerApiOrderConfigPayloadSchema | The fields of a 0x order the relayer may want to decide what configuration to send back. (optional)
+
+try:
+ api_response = api_instance.get_order_config(network_id=network_id, relayer_api_order_config_payload_schema=relayer_api_order_config_payload_schema)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_order_config: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------------------------------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ------------------------ |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **relayer_api_order_config_payload_schema** | [**RelayerApiOrderConfigPayloadSchema**](RelayerApiOrderConfigPayloadSchema.md) | The fields of a 0x order the relayer may want to decide what configuration to send back. | [optional] |
+
+### Return type
+
+[**RelayerApiOrderConfigResponseSchema**](RelayerApiOrderConfigResponseSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: application/json
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_orderbook**
+
+> RelayerApiOrderbookResponseSchema get_orderbook(base_asset_data, quote_asset_data, network_id=network_id, page=page, per_page=per_page)
+
+Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` \* `perPage` > `total` for a certain collection, the `records` for that collection should just be empty.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+base_asset_data = 0xf47261b04c32345ced77393b3530b1eed0f346429d # str | assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price.
+quote_asset_data = 0xf47261b04c32345ced77393b3530b1eed0f346429d # str | assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required).
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+page = 3 # float | The number of the page to request in the collection. (optional) (default to 1)
+per_page = 10 # float | The number of records to return per page. (optional) (default to 100)
+
+try:
+ api_response = api_instance.get_orderbook(base_asset_data, quote_asset_data, network_id=network_id, page=page, per_page=per_page)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_orderbook: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| -------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
+| **base_asset_data** | **str** | assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price. |
+| **quote_asset_data** | **str** | assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required). |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **page** | **float** | The number of the page to request in the collection. | [optional][default to 1] |
+| **per_page** | **float** | The number of records to return per page. | [optional][default to 100] |
+
+### Return type
+
+[**RelayerApiOrderbookResponseSchema**](RelayerApiOrderbookResponseSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: Not defined
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **get_orders**
+
+> RelayerApiOrdersResponseSchema get_orders(maker_asset_proxy_id=maker_asset_proxy_id, taker_asset_proxy_id=taker_asset_proxy_id, maker_asset_address=maker_asset_address, taker_asset_address=taker_asset_address, exchange_address=exchange_address, sender_address=sender_address, maker_asset_data=maker_asset_data, taker_asset_data=taker_asset_data, trader_asset_data=trader_asset_data, maker_address=maker_address, taker_address=taker_address, trader_address=trader_address, fee_recipient_address=fee_recipient_address, network_id=network_id, page=page, per_page=per_page)
+
+Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+maker_asset_proxy_id = 0xf47261b0 # str | The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721). (optional)
+taker_asset_proxy_id = 0x02571792 # str | The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721). (optional)
+maker_asset_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | The contract address for the maker asset. (optional)
+taker_asset_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | The contract address for the taker asset. (optional)
+exchange_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+sender_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+maker_asset_data = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+taker_asset_data = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+trader_asset_data = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+maker_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+taker_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+trader_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+fee_recipient_address = 0xe41d2489571d322189246dafa5ebde1f4699f498 # str | Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) (optional)
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+page = 3 # float | The number of the page to request in the collection. (optional) (default to 1)
+per_page = 10 # float | The number of records to return per page. (optional) (default to 100)
+
+try:
+ api_response = api_instance.get_orders(maker_asset_proxy_id=maker_asset_proxy_id, taker_asset_proxy_id=taker_asset_proxy_id, maker_asset_address=maker_asset_address, taker_asset_address=taker_asset_address, exchange_address=exchange_address, sender_address=sender_address, maker_asset_data=maker_asset_data, taker_asset_data=taker_asset_data, trader_asset_data=trader_asset_data, maker_address=maker_address, taker_address=taker_address, trader_address=trader_address, fee_recipient_address=fee_recipient_address, network_id=network_id, page=page, per_page=per_page)
+ pprint(api_response)
+except ApiException as e:
+ print("Exception when calling DefaultApi->get_orders: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
+| **maker_asset_proxy_id** | **str** | The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \&quot;0xf47261b0\&quot; for ERC20, \&quot;0x02571792\&quot; for ERC721). | [optional] |
+| **taker_asset_proxy_id** | **str** | The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \&quot;0xf47261b0\&quot; for ERC20, \&quot;0x02571792\&quot; for ERC721). | [optional] |
+| **maker_asset_address** | **str** | The contract address for the maker asset. | [optional] |
+| **taker_asset_address** | **str** | The contract address for the taker asset. | [optional] |
+| **exchange_address** | **str** | Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **sender_address** | **str** | Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **maker_asset_data** | **str** | Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **taker_asset_data** | **str** | Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **trader_asset_data** | **str** | Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **maker_address** | **str** | Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **taker_address** | **str** | Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **trader_address** | **str** | Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **fee_recipient_address** | **str** | Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format) | [optional] |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **page** | **float** | The number of the page to request in the collection. | [optional][default to 1] |
+| **per_page** | **float** | The number of records to return per page. | [optional][default to 100] |
+
+### Return type
+
+[**RelayerApiOrdersResponseSchema**](RelayerApiOrdersResponseSchema.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: Not defined
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+# **post_order**
+
+> post_order(network_id=network_id, signed_order_schema=signed_order_schema)
+
+Submit a signed order to the relayer.
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import sra_client
+from sra_client.rest import ApiException
+from pprint import pprint
+
+# create an instance of the API class
+api_instance = sra_client.DefaultApi()
+network_id = 42 # float | The id of the Ethereum network (optional) (default to 1)
+signed_order_schema = {"makerAddress":"0x9e56625509c2f60af937f23b7b532600390e8c8b","takerAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","feeRecipientAddress":"0xb046140686d052fff581f63f8136cce132e857da","senderAddress":"0xa2b31dacf30a9c50ca473337c01d8a201ae33e32","makerAssetAmount":"10000000000000000","takerAssetAmount":"20000000000000000","makerFee":"100000000000000","takerFee":"200000000000000","expirationTimeSeconds":"1532560590","salt":"1532559225","makerAssetData":"0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498","takerAssetData":"0x02571792000000000000000000000000371b13d97f4bf77d724e78c16b7dc74099f40e840000000000000000000000000000000000000000000000000000000000000063","exchangeAddress":"0x12459c951127e0c374ff9105dda097662a027093","signature":"0x012761a3ed31b43c8780e905a260a35faefcc527be7516aa11c0256729b5b351bc33"} # SignedOrderSchema | A valid signed 0x order based on the schema. (optional)
+
+try:
+ api_instance.post_order(network_id=network_id, signed_order_schema=signed_order_schema)
+except ApiException as e:
+ print("Exception when calling DefaultApi->post_order: %s\n" % e)
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ----------------------- | --------------------------------------------- | -------------------------------------------- | ------------------------ |
+| **network_id** | **float** | The id of the Ethereum network | [optional][default to 1] |
+| **signed_order_schema** | [**SignedOrderSchema**](SignedOrderSchema.md) | A valid signed 0x order based on the schema. | [optional] |
+
+### Return type
+
+void (empty response body)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+* **Content-Type**: application/json
+* **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/OrderSchema.md b/python-packages/sra_client/docs/OrderSchema.md
new file mode 100644
index 000000000..5378c95f4
--- /dev/null
+++ b/python-packages/sra_client/docs/OrderSchema.md
@@ -0,0 +1,21 @@
+# OrderSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| --------------------------- | ------- | ----------- | ----- |
+| **maker_address** | **str** | |
+| **taker_address** | **str** | |
+| **maker_fee** | **str** | |
+| **taker_fee** | **str** | |
+| **sender_address** | **str** | |
+| **maker_asset_amount** | **str** | |
+| **taker_asset_amount** | **str** | |
+| **maker_asset_data** | **str** | |
+| **taker_asset_data** | **str** | |
+| **salt** | **str** | |
+| **exchange_address** | **str** | |
+| **fee_recipient_address** | **str** | |
+| **expiration_time_seconds** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/PaginatedCollectionSchema.md b/python-packages/sra_client/docs/PaginatedCollectionSchema.md
new file mode 100644
index 000000000..969cbf7b5
--- /dev/null
+++ b/python-packages/sra_client/docs/PaginatedCollectionSchema.md
@@ -0,0 +1,11 @@
+# PaginatedCollectionSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ------------ | --------- | ----------- | ----- |
+| **total** | **float** | |
+| **per_page** | **float** | |
+| **page** | **float** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiAssetDataPairsResponseSchema.md b/python-packages/sra_client/docs/RelayerApiAssetDataPairsResponseSchema.md
new file mode 100644
index 000000000..0e87e8dc0
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiAssetDataPairsResponseSchema.md
@@ -0,0 +1,9 @@
+# RelayerApiAssetDataPairsResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ----------- | ---------------- | ----------- | ----- |
+| **records** | **list[object]** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiAssetDataTradeInfoSchema.md b/python-packages/sra_client/docs/RelayerApiAssetDataTradeInfoSchema.md
new file mode 100644
index 000000000..15de4e4ad
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiAssetDataTradeInfoSchema.md
@@ -0,0 +1,12 @@
+# RelayerApiAssetDataTradeInfoSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| -------------- | --------- | ----------- | ---------- |
+| **asset_data** | **str** | |
+| **min_amount** | **str** | | [optional] |
+| **max_amount** | **str** | | [optional] |
+| **precision** | **float** | | [optional] |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiErrorResponseSchema.md b/python-packages/sra_client/docs/RelayerApiErrorResponseSchema.md
new file mode 100644
index 000000000..11e3b32a9
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiErrorResponseSchema.md
@@ -0,0 +1,11 @@
+# RelayerApiErrorResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| --------------------- | ----------------------------------------------------------------------------------------------------------- | ----------- | ---------- |
+| **code** | **int** | |
+| **reason** | **str** | |
+| **validation_errors** | [**list[RelayerApiErrorResponseSchemaValidationErrors]**](RelayerApiErrorResponseSchemaValidationErrors.md) | | [optional] |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiErrorResponseSchemaValidationErrors.md b/python-packages/sra_client/docs/RelayerApiErrorResponseSchemaValidationErrors.md
new file mode 100644
index 000000000..2147b3822
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiErrorResponseSchemaValidationErrors.md
@@ -0,0 +1,11 @@
+# RelayerApiErrorResponseSchemaValidationErrors
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---------- | ------- | ----------- | ----- |
+| **field** | **str** | |
+| **code** | **int** | |
+| **reason** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiFeeRecipientsResponseSchema.md b/python-packages/sra_client/docs/RelayerApiFeeRecipientsResponseSchema.md
new file mode 100644
index 000000000..f12582a81
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiFeeRecipientsResponseSchema.md
@@ -0,0 +1,9 @@
+# RelayerApiFeeRecipientsResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ----------- | ------------- | ----------- | ----- |
+| **records** | **list[str]** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrderConfigPayloadSchema.md b/python-packages/sra_client/docs/RelayerApiOrderConfigPayloadSchema.md
new file mode 100644
index 000000000..ee0800066
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrderConfigPayloadSchema.md
@@ -0,0 +1,16 @@
+# RelayerApiOrderConfigPayloadSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| --------------------------- | ------- | ----------- | ----- |
+| **maker_address** | **str** | |
+| **taker_address** | **str** | |
+| **maker_asset_amount** | **str** | |
+| **taker_asset_amount** | **str** | |
+| **maker_asset_data** | **str** | |
+| **taker_asset_data** | **str** | |
+| **exchange_address** | **str** | |
+| **expiration_time_seconds** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrderConfigResponseSchema.md b/python-packages/sra_client/docs/RelayerApiOrderConfigResponseSchema.md
new file mode 100644
index 000000000..2ebafdf47
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrderConfigResponseSchema.md
@@ -0,0 +1,12 @@
+# RelayerApiOrderConfigResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ------------------------- | ------- | ----------- | ----- |
+| **maker_fee** | **str** | |
+| **taker_fee** | **str** | |
+| **fee_recipient_address** | **str** | |
+| **sender_address** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrderSchema.md b/python-packages/sra_client/docs/RelayerApiOrderSchema.md
new file mode 100644
index 000000000..bbdffe2f4
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrderSchema.md
@@ -0,0 +1,10 @@
+# RelayerApiOrderSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ------------- | --------------------------------- | ----------- | ----- |
+| **order** | [**OrderSchema**](OrderSchema.md) | |
+| **meta_data** | [**object**](.md) | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrderbookResponseSchema.md b/python-packages/sra_client/docs/RelayerApiOrderbookResponseSchema.md
new file mode 100644
index 000000000..6fb7c88ff
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrderbookResponseSchema.md
@@ -0,0 +1,10 @@
+# RelayerApiOrderbookResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| -------- | ----------------------------------------------------------------------- | ----------- | ----- |
+| **bids** | [**RelayerApiOrdersResponseSchema**](RelayerApiOrdersResponseSchema.md) | |
+| **asks** | [**RelayerApiOrdersResponseSchema**](RelayerApiOrdersResponseSchema.md) | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribePayloadSchema.md b/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribePayloadSchema.md
new file mode 100644
index 000000000..97c2cbc21
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribePayloadSchema.md
@@ -0,0 +1,16 @@
+# RelayerApiOrdersChannelSubscribePayloadSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ------------------------ | --------- | ----------- | ---------- |
+| **maker_asset_proxy_id** | **str** | | [optional] |
+| **taker_asset_proxy_id** | **str** | | [optional] |
+| **network_id** | **float** | | [optional] |
+| **maker_asset_address** | **str** | | [optional] |
+| **taker_asset_address** | **str** | | [optional] |
+| **maker_asset_data** | **str** | | [optional] |
+| **taker_asset_data** | **str** | | [optional] |
+| **trader_asset_data** | **str** | | [optional] |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribeSchema.md b/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribeSchema.md
new file mode 100644
index 000000000..5e1c96c24
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrdersChannelSubscribeSchema.md
@@ -0,0 +1,12 @@
+# RelayerApiOrdersChannelSubscribeSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| -------------- | ----------------------------------------------------------------------------------------------------- | ----------- | ---------- |
+| **type** | **str** | |
+| **channel** | **str** | |
+| **request_id** | **str** | |
+| **payload** | [**RelayerApiOrdersChannelSubscribePayloadSchema**](RelayerApiOrdersChannelSubscribePayloadSchema.md) | | [optional] |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrdersChannelUpdateSchema.md b/python-packages/sra_client/docs/RelayerApiOrdersChannelUpdateSchema.md
new file mode 100644
index 000000000..8d763367a
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrdersChannelUpdateSchema.md
@@ -0,0 +1,12 @@
+# RelayerApiOrdersChannelUpdateSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| -------------- | ----------------------------------------------------------- | ----------- | ---------- |
+| **type** | **str** | |
+| **channel** | **str** | |
+| **request_id** | **str** | |
+| **payload** | [**list[RelayerApiOrderSchema]**](RelayerApiOrderSchema.md) | | [optional] |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/RelayerApiOrdersResponseSchema.md b/python-packages/sra_client/docs/RelayerApiOrdersResponseSchema.md
new file mode 100644
index 000000000..8989d346b
--- /dev/null
+++ b/python-packages/sra_client/docs/RelayerApiOrdersResponseSchema.md
@@ -0,0 +1,9 @@
+# RelayerApiOrdersResponseSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ----------- | ----------------------------------------------------------- | ----------- | ----- |
+| **records** | [**list[RelayerApiOrderSchema]**](RelayerApiOrderSchema.md) | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/docs/SignedOrderSchema.md b/python-packages/sra_client/docs/SignedOrderSchema.md
new file mode 100644
index 000000000..4c753e6cc
--- /dev/null
+++ b/python-packages/sra_client/docs/SignedOrderSchema.md
@@ -0,0 +1,9 @@
+# SignedOrderSchema
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ------------- | ------- | ----------- | ----- |
+| **signature** | **str** | |
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
diff --git a/python-packages/sra_client/generate.sh b/python-packages/sra_client/generate.sh
new file mode 100755
index 000000000..91967dee3
--- /dev/null
+++ b/python-packages/sra_client/generate.sh
@@ -0,0 +1,26 @@
+# This file provided not so much to be run but rather more for posterity, as a
+# record of how this generated code was produced.
+
+GENERATOR_JAR=http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.3.4/openapi-generator-cli-3.3.4.jar
+GENERATOR_JAR_BASENAME=$(basename $GENERATOR_JAR)
+
+if [ -f $GENERATOR_JAR_BASENAME ]; then
+ if [ "$(openssl dgst -sha256 $GENERATOR_JAR_BASENAME)" \
+ != "SHA256($GENERATOR_JAR_BASENAME)= 24cb04939110cffcdd7062d2f50c6f61159dc3e0ca3b8aecbae6ade53ad3dc8c" \
+ ]; then
+ rm $GENERATOR_JAR_BASENAME
+ fi
+fi
+
+if [ ! -f $GENERATOR_JAR_BASENAME ]; then
+ wget $GENERATOR_JAR
+fi
+
+PYTHON_POST_PROCESS_FILE="black --line-length 79" \
+ java -jar openapi-generator-cli-3.3.4.jar \
+ generate \
+ --input-spec http://unpkg.com/@0x/sra-spec@1.0.11/lib/api.json \
+ --output . \
+ --generator-name python \
+ --config openapi-generator-cli-config.json \
+ --enable-post-process-file
diff --git a/python-packages/sra_client/openapi-generator-cli-config.json b/python-packages/sra_client/openapi-generator-cli-config.json
new file mode 100644
index 000000000..cc619e465
--- /dev/null
+++ b/python-packages/sra_client/openapi-generator-cli-config.json
@@ -0,0 +1,4 @@
+{
+ "packageName": "sra_client",
+ "projectName": "0x-sra-client"
+}
diff --git a/python-packages/sra_client/requirements.txt b/python-packages/sra_client/requirements.txt
new file mode 100644
index 000000000..bafdc0753
--- /dev/null
+++ b/python-packages/sra_client/requirements.txt
@@ -0,0 +1,5 @@
+certifi >= 14.05.14
+six >= 1.10
+python_dateutil >= 2.5.3
+setuptools >= 21.0.0
+urllib3 >= 1.15.1
diff --git a/python-packages/sra_client/setup.py b/python-packages/sra_client/setup.py
new file mode 100755
index 000000000..b47f71ae7
--- /dev/null
+++ b/python-packages/sra_client/setup.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+
+import subprocess
+import distutils.command.build_py
+
+from setuptools import setup, find_packages # noqa: H301
+
+NAME = "0x-sra-client"
+VERSION = "1.0.0"
+# To install the library, run the following
+#
+# python setup.py install
+#
+# prerequisite: setuptools
+# http://pypi.python.org/pypi/setuptools
+
+with open("README.md", "r") as file_handle:
+ README_MD = file_handle.read()
+
+REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"]
+
+class TestPublishCommand(distutils.command.build_py.build_py):
+ """Custom command to publish to test.pypi.org."""
+
+ description = (
+ "Publish dist/* to test.pypi.org. Run sdist & bdist_wheel first."
+ )
+
+ def run(self):
+ """Run twine to upload to test.pypi.org."""
+ subprocess.check_call( # nosec
+ (
+ "twine upload --repository-url https://test.pypi.org/legacy/"
+ + " --verbose dist/*"
+ ).split()
+ )
+
+
+class PublishCommand(distutils.command.build_py.build_py):
+ """Custom command to publish to pypi.org."""
+
+ description = "Publish dist/* to pypi.org. Run sdist & bdist_wheel first."
+
+ def run(self):
+ """Run twine to upload to pypi.org."""
+ subprocess.check_call("twine upload dist/*".split()) # nosec
+
+
+setup(
+ name=NAME,
+ version=VERSION,
+ description="Standard Relayer REST API",
+ author_email="",
+ url="https://github.com/0xproject/0x-monorepo/python-packages/sra_client",
+ keywords=["OpenAPI", "OpenAPI-Generator", "Standard Relayer REST API"],
+ install_requires=REQUIRES,
+ packages=find_packages(),
+ include_package_data=True,
+ long_description=README_MD,
+ long_description_content_type="text/markdown",
+ cmdclass={
+ "test_publish": TestPublishCommand,
+ "publish": PublishCommand,
+ },
+)
diff --git a/python-packages/sra_client/sra_client/__init__.py b/python-packages/sra_client/sra_client/__init__.py
new file mode 100644
index 000000000..fc02976a5
--- /dev/null
+++ b/python-packages/sra_client/sra_client/__init__.py
@@ -0,0 +1,59 @@
+# coding: utf-8
+
+# flake8: noqa
+
+
+from __future__ import absolute_import
+
+__version__ = "1.0.0"
+
+# import apis into sdk package
+from sra_client.api.default_api import DefaultApi
+
+# import ApiClient
+from sra_client.api_client import ApiClient
+from sra_client.configuration import Configuration
+
+# import models into sdk package
+from sra_client.models.order_schema import OrderSchema
+from sra_client.models.paginated_collection_schema import (
+ PaginatedCollectionSchema,
+)
+from sra_client.models.relayer_api_asset_data_pairs_response_schema import (
+ RelayerApiAssetDataPairsResponseSchema,
+)
+from sra_client.models.relayer_api_asset_data_trade_info_schema import (
+ RelayerApiAssetDataTradeInfoSchema,
+)
+from sra_client.models.relayer_api_error_response_schema import (
+ RelayerApiErrorResponseSchema,
+)
+from sra_client.models.relayer_api_error_response_schema_validation_errors import (
+ RelayerApiErrorResponseSchemaValidationErrors,
+)
+from sra_client.models.relayer_api_fee_recipients_response_schema import (
+ RelayerApiFeeRecipientsResponseSchema,
+)
+from sra_client.models.relayer_api_order_config_payload_schema import (
+ RelayerApiOrderConfigPayloadSchema,
+)
+from sra_client.models.relayer_api_order_config_response_schema import (
+ RelayerApiOrderConfigResponseSchema,
+)
+from sra_client.models.relayer_api_order_schema import RelayerApiOrderSchema
+from sra_client.models.relayer_api_orderbook_response_schema import (
+ RelayerApiOrderbookResponseSchema,
+)
+from sra_client.models.relayer_api_orders_channel_subscribe_payload_schema import (
+ RelayerApiOrdersChannelSubscribePayloadSchema,
+)
+from sra_client.models.relayer_api_orders_channel_subscribe_schema import (
+ RelayerApiOrdersChannelSubscribeSchema,
+)
+from sra_client.models.relayer_api_orders_channel_update_schema import (
+ RelayerApiOrdersChannelUpdateSchema,
+)
+from sra_client.models.relayer_api_orders_response_schema import (
+ RelayerApiOrdersResponseSchema,
+)
+from sra_client.models.signed_order_schema import SignedOrderSchema
diff --git a/python-packages/sra_client/sra_client/api/__init__.py b/python-packages/sra_client/sra_client/api/__init__.py
new file mode 100644
index 000000000..b7b206bb1
--- /dev/null
+++ b/python-packages/sra_client/sra_client/api/__init__.py
@@ -0,0 +1,6 @@
+from __future__ import absolute_import
+
+# flake8: noqa
+
+# import apis into api package
+from sra_client.api.default_api import DefaultApi
diff --git a/python-packages/sra_client/sra_client/api/default_api.py b/python-packages/sra_client/sra_client/api/default_api.py
new file mode 100644
index 000000000..2d65db609
--- /dev/null
+++ b/python-packages/sra_client/sra_client/api/default_api.py
@@ -0,0 +1,976 @@
+# coding: utf-8
+
+
+from __future__ import absolute_import
+
+import re # noqa: F401
+
+# python 2 and python 3 compatibility library
+import six
+
+from sra_client.api_client import ApiClient
+
+
+class DefaultApi(object):
+ """NOTE: This class is auto generated by OpenAPI Generator
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ def __init__(self, api_client=None):
+ if api_client is None:
+ api_client = ApiClient()
+ self.api_client = api_client
+
+ def get_asset_pairs(self, **kwargs): # noqa: E501
+ """get_asset_pairs # noqa: E501
+
+ Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_asset_pairs(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str asset_data_a: The assetData value for the first asset in the pair.
+ :param str asset_data_b: The assetData value for the second asset in the pair.
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiAssetDataPairsResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_asset_pairs_with_http_info(**kwargs) # noqa: E501
+ else:
+ (data) = self.get_asset_pairs_with_http_info(
+ **kwargs
+ ) # noqa: E501
+ return data
+
+ def get_asset_pairs_with_http_info(self, **kwargs): # noqa: E501
+ """get_asset_pairs # noqa: E501
+
+ Retrieves a list of available asset pairs and the information required to trade them (in any order). Setting only `assetDataA` or `assetDataB` returns pairs filtered by that asset only. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_asset_pairs_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str asset_data_a: The assetData value for the first asset in the pair.
+ :param str asset_data_b: The assetData value for the second asset in the pair.
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiAssetDataPairsResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = [
+ "asset_data_a",
+ "asset_data_b",
+ "network_id",
+ "page",
+ "per_page",
+ ] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_asset_pairs" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "asset_data_a" in local_var_params:
+ query_params.append(
+ ("assetDataA", local_var_params["asset_data_a"])
+ ) # noqa: E501
+ if "asset_data_b" in local_var_params:
+ query_params.append(
+ ("assetDataB", local_var_params["asset_data_b"])
+ ) # noqa: E501
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+ if "page" in local_var_params:
+ query_params.append(
+ ("page", local_var_params["page"])
+ ) # noqa: E501
+ if "per_page" in local_var_params:
+ query_params.append(
+ ("perPage", local_var_params["per_page"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/asset_pairs",
+ "GET",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiAssetDataPairsResponseSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def get_fee_recipients(self, **kwargs): # noqa: E501
+ """get_fee_recipients # noqa: E501
+
+ Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination). # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_fee_recipients(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiFeeRecipientsResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_fee_recipients_with_http_info(
+ **kwargs
+ ) # noqa: E501
+ else:
+ (data) = self.get_fee_recipients_with_http_info(
+ **kwargs
+ ) # noqa: E501
+ return data
+
+ def get_fee_recipients_with_http_info(self, **kwargs): # noqa: E501
+ """get_fee_recipients # noqa: E501
+
+ Retrieves a collection of all fee recipient addresses for a relayer. This endpoint should be [paginated](#section/Pagination). # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_fee_recipients_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiFeeRecipientsResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = ["network_id", "page", "per_page"] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_fee_recipients" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+ if "page" in local_var_params:
+ query_params.append(
+ ("page", local_var_params["page"])
+ ) # noqa: E501
+ if "per_page" in local_var_params:
+ query_params.append(
+ ("perPage", local_var_params["per_page"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/fee_recipients",
+ "GET",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiFeeRecipientsResponseSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def get_order(self, order_hash, **kwargs): # noqa: E501
+ """get_order # noqa: E501
+
+ Retrieves the 0x order with meta info that is associated with the hash. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_order(order_hash, async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str order_hash: The hash of the desired 0x order. (required)
+ :param float network_id: The id of the Ethereum network
+ :return: RelayerApiOrderSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_order_with_http_info(
+ order_hash, **kwargs
+ ) # noqa: E501
+ else:
+ (data) = self.get_order_with_http_info(
+ order_hash, **kwargs
+ ) # noqa: E501
+ return data
+
+ def get_order_with_http_info(self, order_hash, **kwargs): # noqa: E501
+ """get_order # noqa: E501
+
+ Retrieves the 0x order with meta info that is associated with the hash. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_order_with_http_info(order_hash, async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str order_hash: The hash of the desired 0x order. (required)
+ :param float network_id: The id of the Ethereum network
+ :return: RelayerApiOrderSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = ["order_hash", "network_id"] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_order" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+ # verify the required parameter 'order_hash' is set
+ if (
+ "order_hash" not in local_var_params
+ or local_var_params["order_hash"] is None
+ ):
+ raise ValueError(
+ "Missing the required parameter `order_hash` when calling `get_order`"
+ ) # noqa: E501
+
+ collection_formats = {}
+
+ path_params = {}
+ if "order_hash" in local_var_params:
+ path_params["orderHash"] = local_var_params[
+ "order_hash"
+ ] # noqa: E501
+
+ query_params = []
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/order/{orderHash}",
+ "GET",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiOrderSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def get_order_config(self, **kwargs): # noqa: E501
+ """get_order_config # noqa: E501
+
+ Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_order_config(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param RelayerApiOrderConfigPayloadSchema relayer_api_order_config_payload_schema: The fields of a 0x order the relayer may want to decide what configuration to send back.
+ :return: RelayerApiOrderConfigResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_order_config_with_http_info(**kwargs) # noqa: E501
+ else:
+ (data) = self.get_order_config_with_http_info(
+ **kwargs
+ ) # noqa: E501
+ return data
+
+ def get_order_config_with_http_info(self, **kwargs): # noqa: E501
+ """get_order_config # noqa: E501
+
+ Relayers have full discretion over the orders that they are willing to host on their orderbooks (e.g what fees they charge, etc...). In order for traders to discover their requirements programmatically, they can send an incomplete order to this endpoint and receive the missing fields, specifc to that order. This gives relayers a large amount of flexibility to tailor fees to unique traders, trading pairs and volume amounts. Submit a partial order and receive information required to complete the order: `senderAddress`, `feeRecipientAddress`, `makerFee`, `takerFee`. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_order_config_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param RelayerApiOrderConfigPayloadSchema relayer_api_order_config_payload_schema: The fields of a 0x order the relayer may want to decide what configuration to send back.
+ :return: RelayerApiOrderConfigResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = [
+ "network_id",
+ "relayer_api_order_config_payload_schema",
+ ] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_order_config" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ if "relayer_api_order_config_payload_schema" in local_var_params:
+ body_params = local_var_params[
+ "relayer_api_order_config_payload_schema"
+ ]
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # HTTP header `Content-Type`
+ header_params[
+ "Content-Type"
+ ] = self.api_client.select_header_content_type( # noqa: E501
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/order_config",
+ "POST",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiOrderConfigResponseSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def get_orderbook(
+ self, base_asset_data, quote_asset_data, **kwargs
+ ): # noqa: E501
+ """get_orderbook # noqa: E501
+
+ Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_orderbook(base_asset_data, quote_asset_data, async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str base_asset_data: assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price. (required)
+ :param str quote_asset_data: assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required). (required)
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiOrderbookResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_orderbook_with_http_info(
+ base_asset_data, quote_asset_data, **kwargs
+ ) # noqa: E501
+ else:
+ (data) = self.get_orderbook_with_http_info(
+ base_asset_data, quote_asset_data, **kwargs
+ ) # noqa: E501
+ return data
+
+ def get_orderbook_with_http_info(
+ self, base_asset_data, quote_asset_data, **kwargs
+ ): # noqa: E501
+ """get_orderbook # noqa: E501
+
+ Retrieves the orderbook for a given asset pair. This endpoint should be [paginated](#section/Pagination). Bids will be sorted in descending order by price, and asks will be sorted in ascending order by price. Within the price sorted orders, the orders are further sorted by _taker fee price_ which is defined as the **takerFee** divided by **takerTokenAmount**. After _taker fee price_, orders are to be sorted by expiration in ascending order. The way pagination works for this endpoint is that the **page** and **perPage** query params apply to both `bids` and `asks` collections, and if `page` * `perPage` > `total` for a certain collection, the `records` for that collection should just be empty. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_orderbook_with_http_info(base_asset_data, quote_asset_data, async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str base_asset_data: assetData (makerAssetData or takerAssetData) designated as the base currency in the [currency pair calculation](https://en.wikipedia.org/wiki/Currency_pair) of price. (required)
+ :param str quote_asset_data: assetData (makerAssetData or takerAssetData) designated as the quote currency in the currency pair calculation of price (required). (required)
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiOrderbookResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = [
+ "base_asset_data",
+ "quote_asset_data",
+ "network_id",
+ "page",
+ "per_page",
+ ] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_orderbook" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+ # verify the required parameter 'base_asset_data' is set
+ if (
+ "base_asset_data" not in local_var_params
+ or local_var_params["base_asset_data"] is None
+ ):
+ raise ValueError(
+ "Missing the required parameter `base_asset_data` when calling `get_orderbook`"
+ ) # noqa: E501
+ # verify the required parameter 'quote_asset_data' is set
+ if (
+ "quote_asset_data" not in local_var_params
+ or local_var_params["quote_asset_data"] is None
+ ):
+ raise ValueError(
+ "Missing the required parameter `quote_asset_data` when calling `get_orderbook`"
+ ) # noqa: E501
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "base_asset_data" in local_var_params:
+ query_params.append(
+ ("baseAssetData", local_var_params["base_asset_data"])
+ ) # noqa: E501
+ if "quote_asset_data" in local_var_params:
+ query_params.append(
+ ("quoteAssetData", local_var_params["quote_asset_data"])
+ ) # noqa: E501
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+ if "page" in local_var_params:
+ query_params.append(
+ ("page", local_var_params["page"])
+ ) # noqa: E501
+ if "per_page" in local_var_params:
+ query_params.append(
+ ("perPage", local_var_params["per_page"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/orderbook",
+ "GET",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiOrderbookResponseSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def get_orders(self, **kwargs): # noqa: E501
+ """get_orders # noqa: E501
+
+ Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_orders(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str maker_asset_proxy_id: The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).
+ :param str taker_asset_proxy_id: The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).
+ :param str maker_asset_address: The contract address for the maker asset.
+ :param str taker_asset_address: The contract address for the taker asset.
+ :param str exchange_address: Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str sender_address: Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str maker_asset_data: Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str taker_asset_data: Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str trader_asset_data: Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str maker_address: Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str taker_address: Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str trader_address: Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str fee_recipient_address: Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiOrdersResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.get_orders_with_http_info(**kwargs) # noqa: E501
+ else:
+ (data) = self.get_orders_with_http_info(**kwargs) # noqa: E501
+ return data
+
+ def get_orders_with_http_info(self, **kwargs): # noqa: E501
+ """get_orders # noqa: E501
+
+ Retrieves a list of orders given query parameters. This endpoint should be [paginated](#section/Pagination). For querying an entire orderbook snapshot, the [orderbook endpoint](#operation/getOrderbook) is recommended. If both makerAssetData and takerAssetData are specified, returned orders will be sorted by price determined by (takerTokenAmount/makerTokenAmount) in ascending order. By default, orders returned by this endpoint are unsorted. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.get_orders_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param str maker_asset_proxy_id: The maker [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).
+ :param str taker_asset_proxy_id: The taker asset [asset proxy id](https://0xproject.com/docs/0x.js#types-AssetProxyId) (example: \"0xf47261b0\" for ERC20, \"0x02571792\" for ERC721).
+ :param str maker_asset_address: The contract address for the maker asset.
+ :param str taker_asset_address: The contract address for the taker asset.
+ :param str exchange_address: Same as exchangeAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str sender_address: Same as senderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str maker_asset_data: Same as makerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str taker_asset_data: Same as takerAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str trader_asset_data: Same as traderAssetData in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str maker_address: Same as makerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str taker_address: Same as takerAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str trader_address: Same as traderAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param str fee_recipient_address: Same as feeRecipientAddress in the [0x Protocol v2 Specification](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#order-message-format)
+ :param float network_id: The id of the Ethereum network
+ :param float page: The number of the page to request in the collection.
+ :param float per_page: The number of records to return per page.
+ :return: RelayerApiOrdersResponseSchema
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = [
+ "maker_asset_proxy_id",
+ "taker_asset_proxy_id",
+ "maker_asset_address",
+ "taker_asset_address",
+ "exchange_address",
+ "sender_address",
+ "maker_asset_data",
+ "taker_asset_data",
+ "trader_asset_data",
+ "maker_address",
+ "taker_address",
+ "trader_address",
+ "fee_recipient_address",
+ "network_id",
+ "page",
+ "per_page",
+ ] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method get_orders" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "maker_asset_proxy_id" in local_var_params:
+ query_params.append(
+ ("makerAssetProxyId", local_var_params["maker_asset_proxy_id"])
+ ) # noqa: E501
+ if "taker_asset_proxy_id" in local_var_params:
+ query_params.append(
+ ("takerAssetProxyId", local_var_params["taker_asset_proxy_id"])
+ ) # noqa: E501
+ if "maker_asset_address" in local_var_params:
+ query_params.append(
+ ("makerAssetAddress", local_var_params["maker_asset_address"])
+ ) # noqa: E501
+ if "taker_asset_address" in local_var_params:
+ query_params.append(
+ ("takerAssetAddress", local_var_params["taker_asset_address"])
+ ) # noqa: E501
+ if "exchange_address" in local_var_params:
+ query_params.append(
+ ("exchangeAddress", local_var_params["exchange_address"])
+ ) # noqa: E501
+ if "sender_address" in local_var_params:
+ query_params.append(
+ ("senderAddress", local_var_params["sender_address"])
+ ) # noqa: E501
+ if "maker_asset_data" in local_var_params:
+ query_params.append(
+ ("makerAssetData", local_var_params["maker_asset_data"])
+ ) # noqa: E501
+ if "taker_asset_data" in local_var_params:
+ query_params.append(
+ ("takerAssetData", local_var_params["taker_asset_data"])
+ ) # noqa: E501
+ if "trader_asset_data" in local_var_params:
+ query_params.append(
+ ("traderAssetData", local_var_params["trader_asset_data"])
+ ) # noqa: E501
+ if "maker_address" in local_var_params:
+ query_params.append(
+ ("makerAddress", local_var_params["maker_address"])
+ ) # noqa: E501
+ if "taker_address" in local_var_params:
+ query_params.append(
+ ("takerAddress", local_var_params["taker_address"])
+ ) # noqa: E501
+ if "trader_address" in local_var_params:
+ query_params.append(
+ ("traderAddress", local_var_params["trader_address"])
+ ) # noqa: E501
+ if "fee_recipient_address" in local_var_params:
+ query_params.append(
+ (
+ "feeRecipientAddress",
+ local_var_params["fee_recipient_address"],
+ )
+ ) # noqa: E501
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+ if "page" in local_var_params:
+ query_params.append(
+ ("page", local_var_params["page"])
+ ) # noqa: E501
+ if "per_page" in local_var_params:
+ query_params.append(
+ ("perPage", local_var_params["per_page"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/orders",
+ "GET",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type="RelayerApiOrdersResponseSchema", # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
+
+ def post_order(self, **kwargs): # noqa: E501
+ """post_order # noqa: E501
+
+ Submit a signed order to the relayer. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.post_order(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param SignedOrderSchema signed_order_schema: A valid signed 0x order based on the schema.
+ :return: None
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+ kwargs["_return_http_data_only"] = True
+ if kwargs.get("async_req"):
+ return self.post_order_with_http_info(**kwargs) # noqa: E501
+ else:
+ (data) = self.post_order_with_http_info(**kwargs) # noqa: E501
+ return data
+
+ def post_order_with_http_info(self, **kwargs): # noqa: E501
+ """post_order # noqa: E501
+
+ Submit a signed order to the relayer. # noqa: E501
+ This method makes a synchronous HTTP request by default. To make an
+ asynchronous HTTP request, please pass async_req=True
+ >>> thread = api.post_order_with_http_info(async_req=True)
+ >>> result = thread.get()
+
+ :param async_req bool
+ :param float network_id: The id of the Ethereum network
+ :param SignedOrderSchema signed_order_schema: A valid signed 0x order based on the schema.
+ :return: None
+ If the method is called asynchronously,
+ returns the request thread.
+ """
+
+ local_var_params = locals()
+
+ all_params = ["network_id", "signed_order_schema"] # noqa: E501
+ all_params.append("async_req")
+ all_params.append("_return_http_data_only")
+ all_params.append("_preload_content")
+ all_params.append("_request_timeout")
+
+ for key, val in six.iteritems(local_var_params["kwargs"]):
+ if key not in all_params:
+ raise TypeError(
+ "Got an unexpected keyword argument '%s'"
+ " to method post_order" % key
+ )
+ local_var_params[key] = val
+ del local_var_params["kwargs"]
+
+ collection_formats = {}
+
+ path_params = {}
+
+ query_params = []
+ if "network_id" in local_var_params:
+ query_params.append(
+ ("networkId", local_var_params["network_id"])
+ ) # noqa: E501
+
+ header_params = {}
+
+ form_params = []
+ local_var_files = {}
+
+ body_params = None
+ if "signed_order_schema" in local_var_params:
+ body_params = local_var_params["signed_order_schema"]
+ # HTTP header `Accept`
+ header_params["Accept"] = self.api_client.select_header_accept(
+ ["application/json"]
+ ) # noqa: E501
+
+ # HTTP header `Content-Type`
+ header_params[
+ "Content-Type"
+ ] = self.api_client.select_header_content_type( # noqa: E501
+ ["application/json"]
+ ) # noqa: E501
+
+ # Authentication setting
+ auth_settings = [] # noqa: E501
+
+ return self.api_client.call_api(
+ "/v2/order",
+ "POST",
+ path_params,
+ query_params,
+ header_params,
+ body=body_params,
+ post_params=form_params,
+ files=local_var_files,
+ response_type=None, # noqa: E501
+ auth_settings=auth_settings,
+ async_req=local_var_params.get("async_req"),
+ _return_http_data_only=local_var_params.get(
+ "_return_http_data_only"
+ ), # noqa: E501
+ _preload_content=local_var_params.get("_preload_content", True),
+ _request_timeout=local_var_params.get("_request_timeout"),
+ collection_formats=collection_formats,
+ )
diff --git a/python-packages/sra_client/sra_client/api_client.py b/python-packages/sra_client/sra_client/api_client.py
new file mode 100644
index 000000000..6139fdb42
--- /dev/null
+++ b/python-packages/sra_client/sra_client/api_client.py
@@ -0,0 +1,730 @@
+# coding: utf-8
+
+from __future__ import absolute_import
+
+import datetime
+import json
+import mimetypes
+from multiprocessing.pool import ThreadPool
+import os
+import re
+import tempfile
+
+# python 2 and python 3 compatibility library
+import six
+from six.moves.urllib.parse import quote
+
+from sra_client.configuration import Configuration
+import sra_client.models
+from sra_client import rest
+
+
+class ApiClient(object):
+ """Generic API client for OpenAPI client library builds.
+
+ OpenAPI generic API client. This client handles the client-
+ server communication, and is invariant across implementations. Specifics of
+ the methods and models for each application are generated from the OpenAPI
+ templates.
+
+ NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+ Do not edit the class manually.
+
+ :param configuration: .Configuration object for this client
+ :param header_name: a header to pass when making calls to the API.
+ :param header_value: a header value to pass when making calls to
+ the API.
+ :param cookie: a cookie to include in the header when making calls
+ to the API
+ :param pool_threads: The number of threads to use for async requests
+ to the API. More threads means more concurrent API requests.
+ """
+
+ PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
+ NATIVE_TYPES_MAPPING = {
+ "int": int,
+ "long": int if six.PY3 else long, # noqa: F821
+ "float": float,
+ "str": str,
+ "bool": bool,
+ "date": datetime.date,
+ "datetime": datetime.datetime,
+ "object": object,
+ }
+ _pool = None
+
+ def __init__(
+ self,
+ configuration=None,
+ header_name=None,
+ header_value=None,
+ cookie=None,
+ pool_threads=None,
+ ):
+ if configuration is None:
+ configuration = Configuration()
+ self.configuration = configuration
+ self.pool_threads = pool_threads
+
+ self.rest_client = rest.RESTClientObject(configuration)
+ self.default_headers = {}
+ if header_name is not None:
+ self.default_headers[header_name] = header_value
+ self.cookie = cookie
+ # Set default User-Agent.
+ self.user_agent = "OpenAPI-Generator/1.0.0/python"
+
+ def __del__(self):
+ if self._pool:
+ self._pool.close()
+ self._pool.join()
+ self._pool = None
+
+ @property
+ def pool(self):
+ """Create thread pool on first request
+ avoids instantiating unused threadpool for blocking clients.
+ """
+ if self._pool is None:
+ self._pool = ThreadPool(self.pool_threads)
+ return self._pool
+
+ @property
+ def user_agent(self):
+ """User agent for this API client"""
+ return self.default_headers["User-Agent"]
+
+ @user_agent.setter
+ def user_agent(self, value):
+ self.default_headers["User-Agent"] = value
+
+ def set_default_header(self, header_name, header_value):
+ self.default_headers[header_name] = header_value
+
+ def __call_api(
+ self,
+ resource_path,
+ method,
+ path_params=None,
+ query_params=None,
+ header_params=None,
+ body=None,
+ post_params=None,
+ files=None,
+ response_type=None,
+ auth_settings=None,
+ _return_http_data_only=None,
+ collection_formats=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+
+ config = self.configuration
+
+ # header parameters
+ header_params = header_params or {}
+ header_params.update(self.default_headers)
+ if self.cookie:
+ header_params["Cookie"] = self.cookie
+ if header_params:
+ header_params = self.sanitize_for_serialization(header_params)
+ header_params = dict(
+ self.parameters_to_tuples(header_params, collection_formats)
+ )
+
+ # path parameters
+ if path_params:
+ path_params = self.sanitize_for_serialization(path_params)
+ path_params = self.parameters_to_tuples(
+ path_params, collection_formats
+ )
+ for k, v in path_params:
+ # specified safe chars, encode everything
+ resource_path = resource_path.replace(
+ "{%s}" % k,
+ quote(str(v), safe=config.safe_chars_for_path_param),
+ )
+
+ # query parameters
+ if query_params:
+ query_params = self.sanitize_for_serialization(query_params)
+ query_params = self.parameters_to_tuples(
+ query_params, collection_formats
+ )
+
+ # post parameters
+ if post_params or files:
+ post_params = self.prepare_post_parameters(post_params, files)
+ post_params = self.sanitize_for_serialization(post_params)
+ post_params = self.parameters_to_tuples(
+ post_params, collection_formats
+ )
+
+ # auth setting
+ self.update_params_for_auth(header_params, query_params, auth_settings)
+
+ # body
+ if body:
+ body = self.sanitize_for_serialization(body)
+
+ # request url
+ url = self.configuration.host + resource_path
+
+ # perform request and return response
+ response_data = self.request(
+ method,
+ url,
+ query_params=query_params,
+ headers=header_params,
+ post_params=post_params,
+ body=body,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ )
+
+ self.last_response = response_data
+
+ return_data = response_data
+ if _preload_content:
+ # deserialize response data
+ if response_type:
+ return_data = self.deserialize(response_data, response_type)
+ else:
+ return_data = None
+
+ if _return_http_data_only:
+ return return_data
+ else:
+ return (
+ return_data,
+ response_data.status,
+ response_data.getheaders(),
+ )
+
+ def sanitize_for_serialization(self, obj):
+ """Builds a JSON POST object.
+
+ If obj is None, return None.
+ If obj is str, int, long, float, bool, return directly.
+ If obj is datetime.datetime, datetime.date
+ convert to string in iso8601 format.
+ If obj is list, sanitize each element in the list.
+ If obj is dict, return the dict.
+ If obj is OpenAPI model, return the properties dict.
+
+ :param obj: The data to serialize.
+ :return: The serialized form of data.
+ """
+ if obj is None:
+ return None
+ elif isinstance(obj, self.PRIMITIVE_TYPES):
+ return obj
+ elif isinstance(obj, list):
+ return [
+ self.sanitize_for_serialization(sub_obj) for sub_obj in obj
+ ]
+ elif isinstance(obj, tuple):
+ return tuple(
+ self.sanitize_for_serialization(sub_obj) for sub_obj in obj
+ )
+ elif isinstance(obj, (datetime.datetime, datetime.date)):
+ return obj.isoformat()
+
+ if isinstance(obj, dict):
+ obj_dict = obj
+ else:
+ # Convert model obj to dict except
+ # attributes `openapi_types`, `attribute_map`
+ # and attributes which value is not None.
+ # Convert attribute name to json key in
+ # model definition for request.
+ obj_dict = {
+ obj.attribute_map[attr]: getattr(obj, attr)
+ for attr, _ in six.iteritems(obj.openapi_types)
+ if getattr(obj, attr) is not None
+ }
+
+ return {
+ key: self.sanitize_for_serialization(val)
+ for key, val in six.iteritems(obj_dict)
+ }
+
+ def deserialize(self, response, response_type):
+ """Deserializes response into an object.
+
+ :param response: RESTResponse object to be deserialized.
+ :param response_type: class literal for
+ deserialized object, or string of class name.
+
+ :return: deserialized object.
+ """
+ # handle file downloading
+ # save response body into a tmp file and return the instance
+ if response_type == "file":
+ return self.__deserialize_file(response)
+
+ # fetch data from response object
+ try:
+ data = json.loads(response.data)
+ except ValueError:
+ data = response.data
+
+ return self.__deserialize(data, response_type)
+
+ def __deserialize(self, data, klass):
+ """Deserializes dict, list, str into an object.
+
+ :param data: dict, list or str.
+ :param klass: class literal, or string of class name.
+
+ :return: object.
+ """
+ if data is None:
+ return None
+
+ if type(klass) == str:
+ if klass.startswith("list["):
+ sub_kls = re.match(r"list\[(.*)\]", klass).group(1)
+ return [
+ self.__deserialize(sub_data, sub_kls) for sub_data in data
+ ]
+
+ if klass.startswith("dict("):
+ sub_kls = re.match(r"dict\(([^,]*), (.*)\)", klass).group(2)
+ return {
+ k: self.__deserialize(v, sub_kls)
+ for k, v in six.iteritems(data)
+ }
+
+ # convert str to class
+ if klass in self.NATIVE_TYPES_MAPPING:
+ klass = self.NATIVE_TYPES_MAPPING[klass]
+ else:
+ klass = getattr(sra_client.models, klass)
+
+ if klass in self.PRIMITIVE_TYPES:
+ return self.__deserialize_primitive(data, klass)
+ elif klass == object:
+ return self.__deserialize_object(data)
+ elif klass == datetime.date:
+ return self.__deserialize_date(data)
+ elif klass == datetime.datetime:
+ return self.__deserialize_datatime(data)
+ else:
+ return self.__deserialize_model(data, klass)
+
+ def call_api(
+ self,
+ resource_path,
+ method,
+ path_params=None,
+ query_params=None,
+ header_params=None,
+ body=None,
+ post_params=None,
+ files=None,
+ response_type=None,
+ auth_settings=None,
+ async_req=None,
+ _return_http_data_only=None,
+ collection_formats=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ """Makes the HTTP request (synchronous) and returns deserialized data.
+
+ To make an async_req request, set the async_req parameter.
+
+ :param resource_path: Path to method endpoint.
+ :param method: Method to call.
+ :param path_params: Path parameters in the url.
+ :param query_params: Query parameters in the url.
+ :param header_params: Header parameters to be
+ placed in the request header.
+ :param body: Request body.
+ :param post_params dict: Request post form parameters,
+ for `application/x-www-form-urlencoded`, `multipart/form-data`.
+ :param auth_settings list: Auth Settings names for the request.
+ :param response: Response data type.
+ :param files dict: key -> filename, value -> filepath,
+ for `multipart/form-data`.
+ :param async_req bool: execute request asynchronously
+ :param _return_http_data_only: response data without head status code
+ and headers
+ :param collection_formats: dict of collection formats for path, query,
+ header, and post parameters.
+ :param _preload_content: if False, the urllib3.HTTPResponse object will
+ be returned without reading/decoding response
+ data. Default is True.
+ :param _request_timeout: timeout setting for this request. If one
+ number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ :return:
+ If async_req parameter is True,
+ the request will be called asynchronously.
+ The method will return the request thread.
+ If parameter async_req is False or missing,
+ then the method will return the response directly.
+ """
+ if not async_req:
+ return self.__call_api(
+ resource_path,
+ method,
+ path_params,
+ query_params,
+ header_params,
+ body,
+ post_params,
+ files,
+ response_type,
+ auth_settings,
+ _return_http_data_only,
+ collection_formats,
+ _preload_content,
+ _request_timeout,
+ )
+ else:
+ thread = self.pool.apply_async(
+ self.__call_api,
+ (
+ resource_path,
+ method,
+ path_params,
+ query_params,
+ header_params,
+ body,
+ post_params,
+ files,
+ response_type,
+ auth_settings,
+ _return_http_data_only,
+ collection_formats,
+ _preload_content,
+ _request_timeout,
+ ),
+ )
+ return thread
+
+ def request(
+ self,
+ method,
+ url,
+ query_params=None,
+ headers=None,
+ post_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ """Makes the HTTP request using RESTClient."""
+ if method == "GET":
+ return self.rest_client.GET(
+ url,
+ query_params=query_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ headers=headers,
+ )
+ elif method == "HEAD":
+ return self.rest_client.HEAD(
+ url,
+ query_params=query_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ headers=headers,
+ )
+ elif method == "OPTIONS":
+ return self.rest_client.OPTIONS(
+ url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+ elif method == "POST":
+ return self.rest_client.POST(
+ url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+ elif method == "PUT":
+ return self.rest_client.PUT(
+ url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+ elif method == "PATCH":
+ return self.rest_client.PATCH(
+ url,
+ query_params=query_params,
+ headers=headers,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+ elif method == "DELETE":
+ return self.rest_client.DELETE(
+ url,
+ query_params=query_params,
+ headers=headers,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+ else:
+ raise ValueError(
+ "http method must be `GET`, `HEAD`, `OPTIONS`,"
+ " `POST`, `PATCH`, `PUT` or `DELETE`."
+ )
+
+ def parameters_to_tuples(self, params, collection_formats):
+ """Get parameters as list of tuples, formatting collections.
+
+ :param params: Parameters as dict or list of two-tuples
+ :param dict collection_formats: Parameter collection formats
+ :return: Parameters as list of tuples, collections formatted
+ """
+ new_params = []
+ if collection_formats is None:
+ collection_formats = {}
+ for k, v in (
+ six.iteritems(params) if isinstance(params, dict) else params
+ ): # noqa: E501
+ if k in collection_formats:
+ collection_format = collection_formats[k]
+ if collection_format == "multi":
+ new_params.extend((k, value) for value in v)
+ else:
+ if collection_format == "ssv":
+ delimiter = " "
+ elif collection_format == "tsv":
+ delimiter = "\t"
+ elif collection_format == "pipes":
+ delimiter = "|"
+ else: # csv is the default
+ delimiter = ","
+ new_params.append(
+ (k, delimiter.join(str(value) for value in v))
+ )
+ else:
+ new_params.append((k, v))
+ return new_params
+
+ def prepare_post_parameters(self, post_params=None, files=None):
+ """Builds form parameters.
+
+ :param post_params: Normal form parameters.
+ :param files: File parameters.
+ :return: Form parameters with files.
+ """
+ params = []
+
+ if post_params:
+ params = post_params
+
+ if files:
+ for k, v in six.iteritems(files):
+ if not v:
+ continue
+ file_names = v if type(v) is list else [v]
+ for n in file_names:
+ with open(n, "rb") as f:
+ filename = os.path.basename(f.name)
+ filedata = f.read()
+ mimetype = (
+ mimetypes.guess_type(filename)[0]
+ or "application/octet-stream"
+ )
+ params.append(
+ tuple([k, tuple([filename, filedata, mimetype])])
+ )
+
+ return params
+
+ def select_header_accept(self, accepts):
+ """Returns `Accept` based on an array of accepts provided.
+
+ :param accepts: List of headers.
+ :return: Accept (e.g. application/json).
+ """
+ if not accepts:
+ return
+
+ accepts = [x.lower() for x in accepts]
+
+ if "application/json" in accepts:
+ return "application/json"
+ else:
+ return ", ".join(accepts)
+
+ def select_header_content_type(self, content_types):
+ """Returns `Content-Type` based on an array of content_types provided.
+
+ :param content_types: List of content-types.
+ :return: Content-Type (e.g. application/json).
+ """
+ if not content_types:
+ return "application/json"
+
+ content_types = [x.lower() for x in content_types]
+
+ if "application/json" in content_types or "*/*" in content_types:
+ return "application/json"
+ else:
+ return content_types[0]
+
+ def update_params_for_auth(self, headers, querys, auth_settings):
+ """Updates header and query params based on authentication setting.
+
+ :param headers: Header parameters dict to be updated.
+ :param querys: Query parameters tuple list to be updated.
+ :param auth_settings: Authentication setting identifiers list.
+ """
+ if not auth_settings:
+ return
+
+ for auth in auth_settings:
+ auth_setting = self.configuration.auth_settings().get(auth)
+ if auth_setting:
+ if not auth_setting["value"]:
+ continue
+ elif auth_setting["in"] == "header":
+ headers[auth_setting["key"]] = auth_setting["value"]
+ elif auth_setting["in"] == "query":
+ querys.append((auth_setting["key"], auth_setting["value"]))
+ else:
+ raise ValueError(
+ "Authentication token must be in `query` or `header`"
+ )
+
+ def __deserialize_file(self, response):
+ """Deserializes body to file
+
+ Saves response body into a file in a temporary folder,
+ using the filename from the `Content-Disposition` header if provided.
+
+ :param response: RESTResponse.
+ :return: file path.
+ """
+ fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
+ os.close(fd)
+ os.remove(path)
+
+ content_disposition = response.getheader("Content-Disposition")
+ if content_disposition:
+ filename = re.search(
+ r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition
+ ).group(1)
+ path = os.path.join(os.path.dirname(path), filename)
+
+ with open(path, "wb") as f:
+ f.write(response.data)
+
+ return path
+
+ def __deserialize_primitive(self, data, klass):
+ """Deserializes string to primitive type.
+
+ :param data: str.
+ :param klass: class literal.
+
+ :return: int, long, float, str, bool.
+ """
+ try:
+ return klass(data)
+ except UnicodeEncodeError:
+ return six.text_type(data)
+ except TypeError:
+ return data
+
+ def __deserialize_object(self, value):
+ """Return an original value.
+
+ :return: object.
+ """
+ return value
+
+ def __deserialize_date(self, string):
+ """Deserializes string to date.
+
+ :param string: str.
+ :return: date.
+ """
+ try:
+ from dateutil.parser import parse
+
+ return parse(string).date()
+ except ImportError:
+ return string
+ except ValueError:
+ raise rest.ApiException(
+ status=0,
+ reason="Failed to parse `{0}` as date object".format(string),
+ )
+
+ def __deserialize_datatime(self, string):
+ """Deserializes string to datetime.
+
+ The string should be in iso8601 datetime format.
+
+ :param string: str.
+ :return: datetime.
+ """
+ try:
+ from dateutil.parser import parse
+
+ return parse(string)
+ except ImportError:
+ return string
+ except ValueError:
+ raise rest.ApiException(
+ status=0,
+ reason=(
+ "Failed to parse `{0}` as datetime object".format(string)
+ ),
+ )
+
+ def __deserialize_model(self, data, klass):
+ """Deserializes list or dict to model.
+
+ :param data: dict, list.
+ :param klass: class literal.
+ :return: model object.
+ """
+
+ if not klass.openapi_types and not hasattr(
+ klass, "get_real_child_model"
+ ):
+ return data
+
+ kwargs = {}
+ if klass.openapi_types is not None:
+ for attr, attr_type in six.iteritems(klass.openapi_types):
+ if (
+ data is not None
+ and klass.attribute_map[attr] in data
+ and isinstance(data, (list, dict))
+ ):
+ value = data[klass.attribute_map[attr]]
+ kwargs[attr] = self.__deserialize(value, attr_type)
+
+ instance = klass(**kwargs)
+
+ if hasattr(instance, "get_real_child_model"):
+ klass_name = instance.get_real_child_model(data)
+ if klass_name:
+ instance = self.__deserialize(data, klass_name)
+ return instance
diff --git a/python-packages/sra_client/sra_client/configuration.py b/python-packages/sra_client/sra_client/configuration.py
new file mode 100644
index 000000000..9b0cc05bb
--- /dev/null
+++ b/python-packages/sra_client/sra_client/configuration.py
@@ -0,0 +1,225 @@
+# coding: utf-8
+
+
+from __future__ import absolute_import
+
+import copy
+import logging
+import multiprocessing
+import sys
+import urllib3
+
+import six
+from six.moves import http_client as httplib
+
+
+class TypeWithDefault(type):
+ def __init__(cls, name, bases, dct):
+ super(TypeWithDefault, cls).__init__(name, bases, dct)
+ cls._default = None
+
+ def __call__(cls):
+ if cls._default is None:
+ cls._default = type.__call__(cls)
+ return copy.copy(cls._default)
+
+ def set_default(cls, default):
+ cls._default = copy.copy(default)
+
+
+class Configuration(six.with_metaclass(TypeWithDefault, object)):
+ """NOTE: This class is auto generated by OpenAPI Generator
+
+ Ref: https://openapi-generator.tech
+ Do not edit the class manually.
+ """
+
+ def __init__(self):
+ """Constructor"""
+ # Default Base url
+ self.host = "http://localhost:3000"
+ # Temp file folder for downloading files
+ self.temp_folder_path = None
+
+ # Authentication Settings
+ # dict to store API key(s)
+ self.api_key = {}
+ # dict to store API prefix (e.g. Bearer)
+ self.api_key_prefix = {}
+ # Username for HTTP basic authentication
+ self.username = ""
+ # Password for HTTP basic authentication
+ self.password = ""
+
+ # Logging Settings
+ self.logger = {}
+ self.logger["package_logger"] = logging.getLogger("sra_client")
+ self.logger["urllib3_logger"] = logging.getLogger("urllib3")
+ # Log format
+ self.logger_format = "%(asctime)s %(levelname)s %(message)s"
+ # Log stream handler
+ self.logger_stream_handler = None
+ # Log file handler
+ self.logger_file_handler = None
+ # Debug file location
+ self.logger_file = None
+ # Debug switch
+ self.debug = False
+
+ # SSL/TLS verification
+ # Set this to false to skip verifying SSL certificate when calling API
+ # from https server.
+ self.verify_ssl = True
+ # Set this to customize the certificate file to verify the peer.
+ self.ssl_ca_cert = None
+ # client certificate file
+ self.cert_file = None
+ # client key file
+ self.key_file = None
+ # Set this to True/False to enable/disable SSL hostname verification.
+ self.assert_hostname = None
+
+ # urllib3 connection pool's maximum number of connections saved
+ # per pool. urllib3 uses 1 connection as default value, but this is
+ # not the best value when you are making a lot of possibly parallel
+ # requests to the same host, which is often the case here.
+ # cpu_count * 5 is used as default value to increase performance.
+ self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
+
+ # Proxy URL
+ self.proxy = None
+ # Safe chars for path_param
+ self.safe_chars_for_path_param = ""
+
+ @property
+ def logger_file(self):
+ """The logger file.
+
+ If the logger_file is None, then add stream handler and remove file
+ handler. Otherwise, add file handler and remove stream handler.
+
+ :param value: The logger_file path.
+ :type: str
+ """
+ return self.__logger_file
+
+ @logger_file.setter
+ def logger_file(self, value):
+ """The logger file.
+
+ If the logger_file is None, then add stream handler and remove file
+ handler. Otherwise, add file handler and remove stream handler.
+
+ :param value: The logger_file path.
+ :type: str
+ """
+ self.__logger_file = value
+ if self.__logger_file:
+ # If set logging file,
+ # then add file handler and remove stream handler.
+ self.logger_file_handler = logging.FileHandler(self.__logger_file)
+ self.logger_file_handler.setFormatter(self.logger_formatter)
+ for _, logger in six.iteritems(self.logger):
+ logger.addHandler(self.logger_file_handler)
+
+ @property
+ def debug(self):
+ """Debug status
+
+ :param value: The debug status, True or False.
+ :type: bool
+ """
+ return self.__debug
+
+ @debug.setter
+ def debug(self, value):
+ """Debug status
+
+ :param value: The debug status, True or False.
+ :type: bool
+ """
+ self.__debug = value
+ if self.__debug:
+ # if debug status is True, turn on debug logging
+ for _, logger in six.iteritems(self.logger):
+ logger.setLevel(logging.DEBUG)
+ # turn on httplib debug
+ httplib.HTTPConnection.debuglevel = 1
+ else:
+ # if debug status is False, turn off debug logging,
+ # setting log level to default `logging.WARNING`
+ for _, logger in six.iteritems(self.logger):
+ logger.setLevel(logging.WARNING)
+ # turn off httplib debug
+ httplib.HTTPConnection.debuglevel = 0
+
+ @property
+ def logger_format(self):
+ """The logger format.
+
+ The logger_formatter will be updated when sets logger_format.
+
+ :param value: The format string.
+ :type: str
+ """
+ return self.__logger_format
+
+ @logger_format.setter
+ def logger_format(self, value):
+ """The logger format.
+
+ The logger_formatter will be updated when sets logger_format.
+
+ :param value: The format string.
+ :type: str
+ """
+ self.__logger_format = value
+ self.logger_formatter = logging.Formatter(self.__logger_format)
+
+ def get_api_key_with_prefix(self, identifier):
+ """Gets API key (with prefix if set).
+
+ :param identifier: The identifier of apiKey.
+ :return: The token for api key authentication.
+ """
+ if self.api_key.get(identifier) and self.api_key_prefix.get(
+ identifier
+ ):
+ return (
+ self.api_key_prefix[identifier]
+ + " "
+ + self.api_key[identifier]
+ ) # noqa: E501
+ elif self.api_key.get(identifier):
+ return self.api_key[identifier]
+
+ def get_basic_auth_token(self):
+ """Gets HTTP basic authentication header (string).
+
+ :return: The token for basic HTTP authentication.
+ """
+ return urllib3.util.make_headers(
+ basic_auth=self.username + ":" + self.password
+ ).get("authorization")
+
+ def auth_settings(self):
+ """Gets Auth Settings dict for api client.
+
+ :return: The Auth Settings information dict.
+ """
+ return {}
+
+ def to_debug_report(self):
+ """Gets the essential information for debugging.
+
+ :return: The report for debugging.
+ """
+ return (
+ "Python SDK Debug Report:\n"
+ "OS: {env}\n"
+ "Python Version: {pyversion}\n"
+ "Version of the API: 2.0.0\n"
+ "SDK Package Version: 1.0.0".format(
+ env=sys.platform, pyversion=sys.version
+ )
+ )
diff --git a/python-packages/sra_client/sra_client/models/__init__.py b/python-packages/sra_client/sra_client/models/__init__.py
new file mode 100644
index 000000000..5e6d1baa3
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/__init__.py
@@ -0,0 +1,49 @@
+# coding: utf-8
+
+# flake8: noqa
+
+from __future__ import absolute_import
+
+# import models into model package
+from sra_client.models.order_schema import OrderSchema
+from sra_client.models.paginated_collection_schema import (
+ PaginatedCollectionSchema,
+)
+from sra_client.models.relayer_api_asset_data_pairs_response_schema import (
+ RelayerApiAssetDataPairsResponseSchema,
+)
+from sra_client.models.relayer_api_asset_data_trade_info_schema import (
+ RelayerApiAssetDataTradeInfoSchema,
+)
+from sra_client.models.relayer_api_error_response_schema import (
+ RelayerApiErrorResponseSchema,
+)
+from sra_client.models.relayer_api_error_response_schema_validation_errors import (
+ RelayerApiErrorResponseSchemaValidationErrors,
+)
+from sra_client.models.relayer_api_fee_recipients_response_schema import (
+ RelayerApiFeeRecipientsResponseSchema,
+)
+from sra_client.models.relayer_api_order_config_payload_schema import (
+ RelayerApiOrderConfigPayloadSchema,
+)
+from sra_client.models.relayer_api_order_config_response_schema import (
+ RelayerApiOrderConfigResponseSchema,
+)
+from sra_client.models.relayer_api_order_schema import RelayerApiOrderSchema
+from sra_client.models.relayer_api_orderbook_response_schema import (
+ RelayerApiOrderbookResponseSchema,
+)
+from sra_client.models.relayer_api_orders_channel_subscribe_payload_schema import (
+ RelayerApiOrdersChannelSubscribePayloadSchema,
+)
+from sra_client.models.relayer_api_orders_channel_subscribe_schema import (
+ RelayerApiOrdersChannelSubscribeSchema,
+)
+from sra_client.models.relayer_api_orders_channel_update_schema import (
+ RelayerApiOrdersChannelUpdateSchema,
+)
+from sra_client.models.relayer_api_orders_response_schema import (
+ RelayerApiOrdersResponseSchema,
+)
+from sra_client.models.signed_order_schema import SignedOrderSchema
diff --git a/python-packages/sra_client/sra_client/models/order_schema.py b/python-packages/sra_client/sra_client/models/order_schema.py
new file mode 100644
index 000000000..48fef39d8
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/order_schema.py
@@ -0,0 +1,550 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class OrderSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "maker_address": "str",
+ "taker_address": "str",
+ "maker_fee": "str",
+ "taker_fee": "str",
+ "sender_address": "str",
+ "maker_asset_amount": "str",
+ "taker_asset_amount": "str",
+ "maker_asset_data": "str",
+ "taker_asset_data": "str",
+ "salt": "str",
+ "exchange_address": "str",
+ "fee_recipient_address": "str",
+ "expiration_time_seconds": "str",
+ }
+
+ attribute_map = {
+ "maker_address": "makerAddress",
+ "taker_address": "takerAddress",
+ "maker_fee": "makerFee",
+ "taker_fee": "takerFee",
+ "sender_address": "senderAddress",
+ "maker_asset_amount": "makerAssetAmount",
+ "taker_asset_amount": "takerAssetAmount",
+ "maker_asset_data": "makerAssetData",
+ "taker_asset_data": "takerAssetData",
+ "salt": "salt",
+ "exchange_address": "exchangeAddress",
+ "fee_recipient_address": "feeRecipientAddress",
+ "expiration_time_seconds": "expirationTimeSeconds",
+ }
+
+ def __init__(
+ self,
+ maker_address=None,
+ taker_address=None,
+ maker_fee=None,
+ taker_fee=None,
+ sender_address=None,
+ maker_asset_amount=None,
+ taker_asset_amount=None,
+ maker_asset_data=None,
+ taker_asset_data=None,
+ salt=None,
+ exchange_address=None,
+ fee_recipient_address=None,
+ expiration_time_seconds=None,
+ ): # noqa: E501
+ """OrderSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._maker_address = None
+ self._taker_address = None
+ self._maker_fee = None
+ self._taker_fee = None
+ self._sender_address = None
+ self._maker_asset_amount = None
+ self._taker_asset_amount = None
+ self._maker_asset_data = None
+ self._taker_asset_data = None
+ self._salt = None
+ self._exchange_address = None
+ self._fee_recipient_address = None
+ self._expiration_time_seconds = None
+ self.discriminator = None
+
+ self.maker_address = maker_address
+ self.taker_address = taker_address
+ self.maker_fee = maker_fee
+ self.taker_fee = taker_fee
+ self.sender_address = sender_address
+ self.maker_asset_amount = maker_asset_amount
+ self.taker_asset_amount = taker_asset_amount
+ self.maker_asset_data = maker_asset_data
+ self.taker_asset_data = taker_asset_data
+ self.salt = salt
+ self.exchange_address = exchange_address
+ self.fee_recipient_address = fee_recipient_address
+ self.expiration_time_seconds = expiration_time_seconds
+
+ @property
+ def maker_address(self):
+ """Gets the maker_address of this OrderSchema. # noqa: E501
+
+
+ :return: The maker_address of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_address
+
+ @maker_address.setter
+ def maker_address(self, maker_address):
+ """Sets the maker_address of this OrderSchema.
+
+
+ :param maker_address: The maker_address of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if maker_address is None:
+ raise ValueError(
+ "Invalid value for `maker_address`, must not be `None`"
+ ) # noqa: E501
+ if maker_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", maker_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._maker_address = maker_address
+
+ @property
+ def taker_address(self):
+ """Gets the taker_address of this OrderSchema. # noqa: E501
+
+
+ :return: The taker_address of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_address
+
+ @taker_address.setter
+ def taker_address(self, taker_address):
+ """Sets the taker_address of this OrderSchema.
+
+
+ :param taker_address: The taker_address of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if taker_address is None:
+ raise ValueError(
+ "Invalid value for `taker_address`, must not be `None`"
+ ) # noqa: E501
+ if taker_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", taker_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._taker_address = taker_address
+
+ @property
+ def maker_fee(self):
+ """Gets the maker_fee of this OrderSchema. # noqa: E501
+
+
+ :return: The maker_fee of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_fee
+
+ @maker_fee.setter
+ def maker_fee(self, maker_fee):
+ """Sets the maker_fee of this OrderSchema.
+
+
+ :param maker_fee: The maker_fee of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if maker_fee is None:
+ raise ValueError(
+ "Invalid value for `maker_fee`, must not be `None`"
+ ) # noqa: E501
+ if maker_fee is not None and not re.search(
+ r"^\\d+$", maker_fee
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_fee`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._maker_fee = maker_fee
+
+ @property
+ def taker_fee(self):
+ """Gets the taker_fee of this OrderSchema. # noqa: E501
+
+
+ :return: The taker_fee of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_fee
+
+ @taker_fee.setter
+ def taker_fee(self, taker_fee):
+ """Sets the taker_fee of this OrderSchema.
+
+
+ :param taker_fee: The taker_fee of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if taker_fee is None:
+ raise ValueError(
+ "Invalid value for `taker_fee`, must not be `None`"
+ ) # noqa: E501
+ if taker_fee is not None and not re.search(
+ r"^\\d+$", taker_fee
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_fee`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._taker_fee = taker_fee
+
+ @property
+ def sender_address(self):
+ """Gets the sender_address of this OrderSchema. # noqa: E501
+
+
+ :return: The sender_address of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._sender_address
+
+ @sender_address.setter
+ def sender_address(self, sender_address):
+ """Sets the sender_address of this OrderSchema.
+
+
+ :param sender_address: The sender_address of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if sender_address is None:
+ raise ValueError(
+ "Invalid value for `sender_address`, must not be `None`"
+ ) # noqa: E501
+ if sender_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", sender_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `sender_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._sender_address = sender_address
+
+ @property
+ def maker_asset_amount(self):
+ """Gets the maker_asset_amount of this OrderSchema. # noqa: E501
+
+
+ :return: The maker_asset_amount of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_amount
+
+ @maker_asset_amount.setter
+ def maker_asset_amount(self, maker_asset_amount):
+ """Sets the maker_asset_amount of this OrderSchema.
+
+
+ :param maker_asset_amount: The maker_asset_amount of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_amount is None:
+ raise ValueError(
+ "Invalid value for `maker_asset_amount`, must not be `None`"
+ ) # noqa: E501
+ if maker_asset_amount is not None and not re.search(
+ r"^\\d+$", maker_asset_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._maker_asset_amount = maker_asset_amount
+
+ @property
+ def taker_asset_amount(self):
+ """Gets the taker_asset_amount of this OrderSchema. # noqa: E501
+
+
+ :return: The taker_asset_amount of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_amount
+
+ @taker_asset_amount.setter
+ def taker_asset_amount(self, taker_asset_amount):
+ """Sets the taker_asset_amount of this OrderSchema.
+
+
+ :param taker_asset_amount: The taker_asset_amount of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_amount is None:
+ raise ValueError(
+ "Invalid value for `taker_asset_amount`, must not be `None`"
+ ) # noqa: E501
+ if taker_asset_amount is not None and not re.search(
+ r"^\\d+$", taker_asset_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._taker_asset_amount = taker_asset_amount
+
+ @property
+ def maker_asset_data(self):
+ """Gets the maker_asset_data of this OrderSchema. # noqa: E501
+
+
+ :return: The maker_asset_data of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_data
+
+ @maker_asset_data.setter
+ def maker_asset_data(self, maker_asset_data):
+ """Sets the maker_asset_data of this OrderSchema.
+
+
+ :param maker_asset_data: The maker_asset_data of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_data is None:
+ raise ValueError(
+ "Invalid value for `maker_asset_data`, must not be `None`"
+ ) # noqa: E501
+ if maker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", maker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._maker_asset_data = maker_asset_data
+
+ @property
+ def taker_asset_data(self):
+ """Gets the taker_asset_data of this OrderSchema. # noqa: E501
+
+
+ :return: The taker_asset_data of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_data
+
+ @taker_asset_data.setter
+ def taker_asset_data(self, taker_asset_data):
+ """Sets the taker_asset_data of this OrderSchema.
+
+
+ :param taker_asset_data: The taker_asset_data of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_data is None:
+ raise ValueError(
+ "Invalid value for `taker_asset_data`, must not be `None`"
+ ) # noqa: E501
+ if taker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", taker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._taker_asset_data = taker_asset_data
+
+ @property
+ def salt(self):
+ """Gets the salt of this OrderSchema. # noqa: E501
+
+
+ :return: The salt of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._salt
+
+ @salt.setter
+ def salt(self, salt):
+ """Sets the salt of this OrderSchema.
+
+
+ :param salt: The salt of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if salt is None:
+ raise ValueError(
+ "Invalid value for `salt`, must not be `None`"
+ ) # noqa: E501
+ if salt is not None and not re.search(r"^\\d+$", salt): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `salt`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._salt = salt
+
+ @property
+ def exchange_address(self):
+ """Gets the exchange_address of this OrderSchema. # noqa: E501
+
+
+ :return: The exchange_address of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._exchange_address
+
+ @exchange_address.setter
+ def exchange_address(self, exchange_address):
+ """Sets the exchange_address of this OrderSchema.
+
+
+ :param exchange_address: The exchange_address of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if exchange_address is None:
+ raise ValueError(
+ "Invalid value for `exchange_address`, must not be `None`"
+ ) # noqa: E501
+ if exchange_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", exchange_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `exchange_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._exchange_address = exchange_address
+
+ @property
+ def fee_recipient_address(self):
+ """Gets the fee_recipient_address of this OrderSchema. # noqa: E501
+
+
+ :return: The fee_recipient_address of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._fee_recipient_address
+
+ @fee_recipient_address.setter
+ def fee_recipient_address(self, fee_recipient_address):
+ """Sets the fee_recipient_address of this OrderSchema.
+
+
+ :param fee_recipient_address: The fee_recipient_address of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if fee_recipient_address is None:
+ raise ValueError(
+ "Invalid value for `fee_recipient_address`, must not be `None`"
+ ) # noqa: E501
+ if fee_recipient_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", fee_recipient_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `fee_recipient_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._fee_recipient_address = fee_recipient_address
+
+ @property
+ def expiration_time_seconds(self):
+ """Gets the expiration_time_seconds of this OrderSchema. # noqa: E501
+
+
+ :return: The expiration_time_seconds of this OrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._expiration_time_seconds
+
+ @expiration_time_seconds.setter
+ def expiration_time_seconds(self, expiration_time_seconds):
+ """Sets the expiration_time_seconds of this OrderSchema.
+
+
+ :param expiration_time_seconds: The expiration_time_seconds of this OrderSchema. # noqa: E501
+ :type: str
+ """
+ if expiration_time_seconds is None:
+ raise ValueError(
+ "Invalid value for `expiration_time_seconds`, must not be `None`"
+ ) # noqa: E501
+ if expiration_time_seconds is not None and not re.search(
+ r"^\\d+$", expiration_time_seconds
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `expiration_time_seconds`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._expiration_time_seconds = expiration_time_seconds
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, OrderSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/paginated_collection_schema.py b/python-packages/sra_client/sra_client/models/paginated_collection_schema.py
new file mode 100644
index 000000000..4c73d31f4
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/paginated_collection_schema.py
@@ -0,0 +1,161 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class PaginatedCollectionSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"total": "float", "per_page": "float", "page": "float"}
+
+ attribute_map = {"total": "total", "per_page": "perPage", "page": "page"}
+
+ def __init__(self, total=None, per_page=None, page=None): # noqa: E501
+ """PaginatedCollectionSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._total = None
+ self._per_page = None
+ self._page = None
+ self.discriminator = None
+
+ self.total = total
+ self.per_page = per_page
+ self.page = page
+
+ @property
+ def total(self):
+ """Gets the total of this PaginatedCollectionSchema. # noqa: E501
+
+
+ :return: The total of this PaginatedCollectionSchema. # noqa: E501
+ :rtype: float
+ """
+ return self._total
+
+ @total.setter
+ def total(self, total):
+ """Sets the total of this PaginatedCollectionSchema.
+
+
+ :param total: The total of this PaginatedCollectionSchema. # noqa: E501
+ :type: float
+ """
+ if total is None:
+ raise ValueError(
+ "Invalid value for `total`, must not be `None`"
+ ) # noqa: E501
+
+ self._total = total
+
+ @property
+ def per_page(self):
+ """Gets the per_page of this PaginatedCollectionSchema. # noqa: E501
+
+
+ :return: The per_page of this PaginatedCollectionSchema. # noqa: E501
+ :rtype: float
+ """
+ return self._per_page
+
+ @per_page.setter
+ def per_page(self, per_page):
+ """Sets the per_page of this PaginatedCollectionSchema.
+
+
+ :param per_page: The per_page of this PaginatedCollectionSchema. # noqa: E501
+ :type: float
+ """
+ if per_page is None:
+ raise ValueError(
+ "Invalid value for `per_page`, must not be `None`"
+ ) # noqa: E501
+
+ self._per_page = per_page
+
+ @property
+ def page(self):
+ """Gets the page of this PaginatedCollectionSchema. # noqa: E501
+
+
+ :return: The page of this PaginatedCollectionSchema. # noqa: E501
+ :rtype: float
+ """
+ return self._page
+
+ @page.setter
+ def page(self, page):
+ """Sets the page of this PaginatedCollectionSchema.
+
+
+ :param page: The page of this PaginatedCollectionSchema. # noqa: E501
+ :type: float
+ """
+ if page is None:
+ raise ValueError(
+ "Invalid value for `page`, must not be `None`"
+ ) # noqa: E501
+
+ self._page = page
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, PaginatedCollectionSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_asset_data_pairs_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_asset_data_pairs_response_schema.py
new file mode 100644
index 000000000..97110b13a
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_asset_data_pairs_response_schema.py
@@ -0,0 +1,107 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiAssetDataPairsResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"records": "list[object]"}
+
+ attribute_map = {"records": "records"}
+
+ def __init__(self, records=None): # noqa: E501
+ """RelayerApiAssetDataPairsResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._records = None
+ self.discriminator = None
+
+ self.records = records
+
+ @property
+ def records(self):
+ """Gets the records of this RelayerApiAssetDataPairsResponseSchema. # noqa: E501
+
+
+ :return: The records of this RelayerApiAssetDataPairsResponseSchema. # noqa: E501
+ :rtype: list[object]
+ """
+ return self._records
+
+ @records.setter
+ def records(self, records):
+ """Sets the records of this RelayerApiAssetDataPairsResponseSchema.
+
+
+ :param records: The records of this RelayerApiAssetDataPairsResponseSchema. # noqa: E501
+ :type: list[object]
+ """
+ if records is None:
+ raise ValueError(
+ "Invalid value for `records`, must not be `None`"
+ ) # noqa: E501
+
+ self._records = records
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiAssetDataPairsResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_asset_data_trade_info_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_asset_data_trade_info_schema.py
new file mode 100644
index 000000000..c449d0a6a
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_asset_data_trade_info_schema.py
@@ -0,0 +1,209 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiAssetDataTradeInfoSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "asset_data": "str",
+ "min_amount": "str",
+ "max_amount": "str",
+ "precision": "float",
+ }
+
+ attribute_map = {
+ "asset_data": "assetData",
+ "min_amount": "minAmount",
+ "max_amount": "maxAmount",
+ "precision": "precision",
+ }
+
+ def __init__(
+ self, asset_data=None, min_amount=None, max_amount=None, precision=None
+ ): # noqa: E501
+ """RelayerApiAssetDataTradeInfoSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._asset_data = None
+ self._min_amount = None
+ self._max_amount = None
+ self._precision = None
+ self.discriminator = None
+
+ self.asset_data = asset_data
+ if min_amount is not None:
+ self.min_amount = min_amount
+ if max_amount is not None:
+ self.max_amount = max_amount
+ if precision is not None:
+ self.precision = precision
+
+ @property
+ def asset_data(self):
+ """Gets the asset_data of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+
+
+ :return: The asset_data of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._asset_data
+
+ @asset_data.setter
+ def asset_data(self, asset_data):
+ """Sets the asset_data of this RelayerApiAssetDataTradeInfoSchema.
+
+
+ :param asset_data: The asset_data of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :type: str
+ """
+ if asset_data is None:
+ raise ValueError(
+ "Invalid value for `asset_data`, must not be `None`"
+ ) # noqa: E501
+ if asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._asset_data = asset_data
+
+ @property
+ def min_amount(self):
+ """Gets the min_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+
+
+ :return: The min_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._min_amount
+
+ @min_amount.setter
+ def min_amount(self, min_amount):
+ """Sets the min_amount of this RelayerApiAssetDataTradeInfoSchema.
+
+
+ :param min_amount: The min_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :type: str
+ """
+ if min_amount is not None and not re.search(
+ r"^\\d+$", min_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `min_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._min_amount = min_amount
+
+ @property
+ def max_amount(self):
+ """Gets the max_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+
+
+ :return: The max_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._max_amount
+
+ @max_amount.setter
+ def max_amount(self, max_amount):
+ """Sets the max_amount of this RelayerApiAssetDataTradeInfoSchema.
+
+
+ :param max_amount: The max_amount of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :type: str
+ """
+ if max_amount is not None and not re.search(
+ r"^\\d+$", max_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `max_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._max_amount = max_amount
+
+ @property
+ def precision(self):
+ """Gets the precision of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+
+
+ :return: The precision of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :rtype: float
+ """
+ return self._precision
+
+ @precision.setter
+ def precision(self, precision):
+ """Sets the precision of this RelayerApiAssetDataTradeInfoSchema.
+
+
+ :param precision: The precision of this RelayerApiAssetDataTradeInfoSchema. # noqa: E501
+ :type: float
+ """
+
+ self._precision = precision
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiAssetDataTradeInfoSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema.py
new file mode 100644
index 000000000..fd06bb9f4
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema.py
@@ -0,0 +1,176 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiErrorResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "code": "int",
+ "reason": "str",
+ "validation_errors": "list[RelayerApiErrorResponseSchemaValidationErrors]",
+ }
+
+ attribute_map = {
+ "code": "code",
+ "reason": "reason",
+ "validation_errors": "validationErrors",
+ }
+
+ def __init__(
+ self, code=None, reason=None, validation_errors=None
+ ): # noqa: E501
+ """RelayerApiErrorResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._code = None
+ self._reason = None
+ self._validation_errors = None
+ self.discriminator = None
+
+ self.code = code
+ self.reason = reason
+ if validation_errors is not None:
+ self.validation_errors = validation_errors
+
+ @property
+ def code(self):
+ """Gets the code of this RelayerApiErrorResponseSchema. # noqa: E501
+
+
+ :return: The code of this RelayerApiErrorResponseSchema. # noqa: E501
+ :rtype: int
+ """
+ return self._code
+
+ @code.setter
+ def code(self, code):
+ """Sets the code of this RelayerApiErrorResponseSchema.
+
+
+ :param code: The code of this RelayerApiErrorResponseSchema. # noqa: E501
+ :type: int
+ """
+ if code is None:
+ raise ValueError(
+ "Invalid value for `code`, must not be `None`"
+ ) # noqa: E501
+ if code is not None and code > 103: # noqa: E501
+ raise ValueError(
+ "Invalid value for `code`, must be a value less than or equal to `103`"
+ ) # noqa: E501
+ if code is not None and code < 100: # noqa: E501
+ raise ValueError(
+ "Invalid value for `code`, must be a value greater than or equal to `100`"
+ ) # noqa: E501
+
+ self._code = code
+
+ @property
+ def reason(self):
+ """Gets the reason of this RelayerApiErrorResponseSchema. # noqa: E501
+
+
+ :return: The reason of this RelayerApiErrorResponseSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._reason
+
+ @reason.setter
+ def reason(self, reason):
+ """Sets the reason of this RelayerApiErrorResponseSchema.
+
+
+ :param reason: The reason of this RelayerApiErrorResponseSchema. # noqa: E501
+ :type: str
+ """
+ if reason is None:
+ raise ValueError(
+ "Invalid value for `reason`, must not be `None`"
+ ) # noqa: E501
+
+ self._reason = reason
+
+ @property
+ def validation_errors(self):
+ """Gets the validation_errors of this RelayerApiErrorResponseSchema. # noqa: E501
+
+
+ :return: The validation_errors of this RelayerApiErrorResponseSchema. # noqa: E501
+ :rtype: list[RelayerApiErrorResponseSchemaValidationErrors]
+ """
+ return self._validation_errors
+
+ @validation_errors.setter
+ def validation_errors(self, validation_errors):
+ """Sets the validation_errors of this RelayerApiErrorResponseSchema.
+
+
+ :param validation_errors: The validation_errors of this RelayerApiErrorResponseSchema. # noqa: E501
+ :type: list[RelayerApiErrorResponseSchemaValidationErrors]
+ """
+
+ self._validation_errors = validation_errors
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiErrorResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema_validation_errors.py b/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema_validation_errors.py
new file mode 100644
index 000000000..ee344bbf7
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_error_response_schema_validation_errors.py
@@ -0,0 +1,171 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiErrorResponseSchemaValidationErrors(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"field": "str", "code": "int", "reason": "str"}
+
+ attribute_map = {"field": "field", "code": "code", "reason": "reason"}
+
+ def __init__(self, field=None, code=None, reason=None): # noqa: E501
+ """RelayerApiErrorResponseSchemaValidationErrors - a model defined in OpenAPI""" # noqa: E501
+
+ self._field = None
+ self._code = None
+ self._reason = None
+ self.discriminator = None
+
+ self.field = field
+ self.code = code
+ self.reason = reason
+
+ @property
+ def field(self):
+ """Gets the field of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+
+
+ :return: The field of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :rtype: str
+ """
+ return self._field
+
+ @field.setter
+ def field(self, field):
+ """Sets the field of this RelayerApiErrorResponseSchemaValidationErrors.
+
+
+ :param field: The field of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :type: str
+ """
+ if field is None:
+ raise ValueError(
+ "Invalid value for `field`, must not be `None`"
+ ) # noqa: E501
+
+ self._field = field
+
+ @property
+ def code(self):
+ """Gets the code of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+
+
+ :return: The code of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :rtype: int
+ """
+ return self._code
+
+ @code.setter
+ def code(self, code):
+ """Sets the code of this RelayerApiErrorResponseSchemaValidationErrors.
+
+
+ :param code: The code of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :type: int
+ """
+ if code is None:
+ raise ValueError(
+ "Invalid value for `code`, must not be `None`"
+ ) # noqa: E501
+ if code is not None and code > 1006: # noqa: E501
+ raise ValueError(
+ "Invalid value for `code`, must be a value less than or equal to `1006`"
+ ) # noqa: E501
+ if code is not None and code < 1000: # noqa: E501
+ raise ValueError(
+ "Invalid value for `code`, must be a value greater than or equal to `1000`"
+ ) # noqa: E501
+
+ self._code = code
+
+ @property
+ def reason(self):
+ """Gets the reason of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+
+
+ :return: The reason of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :rtype: str
+ """
+ return self._reason
+
+ @reason.setter
+ def reason(self, reason):
+ """Sets the reason of this RelayerApiErrorResponseSchemaValidationErrors.
+
+
+ :param reason: The reason of this RelayerApiErrorResponseSchemaValidationErrors. # noqa: E501
+ :type: str
+ """
+ if reason is None:
+ raise ValueError(
+ "Invalid value for `reason`, must not be `None`"
+ ) # noqa: E501
+
+ self._reason = reason
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(
+ other, RelayerApiErrorResponseSchemaValidationErrors
+ ):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_fee_recipients_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_fee_recipients_response_schema.py
new file mode 100644
index 000000000..002eb00d7
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_fee_recipients_response_schema.py
@@ -0,0 +1,107 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiFeeRecipientsResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"records": "list[str]"}
+
+ attribute_map = {"records": "records"}
+
+ def __init__(self, records=None): # noqa: E501
+ """RelayerApiFeeRecipientsResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._records = None
+ self.discriminator = None
+
+ self.records = records
+
+ @property
+ def records(self):
+ """Gets the records of this RelayerApiFeeRecipientsResponseSchema. # noqa: E501
+
+
+ :return: The records of this RelayerApiFeeRecipientsResponseSchema. # noqa: E501
+ :rtype: list[str]
+ """
+ return self._records
+
+ @records.setter
+ def records(self, records):
+ """Sets the records of this RelayerApiFeeRecipientsResponseSchema.
+
+
+ :param records: The records of this RelayerApiFeeRecipientsResponseSchema. # noqa: E501
+ :type: list[str]
+ """
+ if records is None:
+ raise ValueError(
+ "Invalid value for `records`, must not be `None`"
+ ) # noqa: E501
+
+ self._records = records
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiFeeRecipientsResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_order_config_payload_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_order_config_payload_schema.py
new file mode 100644
index 000000000..8d19d80e2
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_order_config_payload_schema.py
@@ -0,0 +1,372 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrderConfigPayloadSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "maker_address": "str",
+ "taker_address": "str",
+ "maker_asset_amount": "str",
+ "taker_asset_amount": "str",
+ "maker_asset_data": "str",
+ "taker_asset_data": "str",
+ "exchange_address": "str",
+ "expiration_time_seconds": "str",
+ }
+
+ attribute_map = {
+ "maker_address": "makerAddress",
+ "taker_address": "takerAddress",
+ "maker_asset_amount": "makerAssetAmount",
+ "taker_asset_amount": "takerAssetAmount",
+ "maker_asset_data": "makerAssetData",
+ "taker_asset_data": "takerAssetData",
+ "exchange_address": "exchangeAddress",
+ "expiration_time_seconds": "expirationTimeSeconds",
+ }
+
+ def __init__(
+ self,
+ maker_address=None,
+ taker_address=None,
+ maker_asset_amount=None,
+ taker_asset_amount=None,
+ maker_asset_data=None,
+ taker_asset_data=None,
+ exchange_address=None,
+ expiration_time_seconds=None,
+ ): # noqa: E501
+ """RelayerApiOrderConfigPayloadSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._maker_address = None
+ self._taker_address = None
+ self._maker_asset_amount = None
+ self._taker_asset_amount = None
+ self._maker_asset_data = None
+ self._taker_asset_data = None
+ self._exchange_address = None
+ self._expiration_time_seconds = None
+ self.discriminator = None
+
+ self.maker_address = maker_address
+ self.taker_address = taker_address
+ self.maker_asset_amount = maker_asset_amount
+ self.taker_asset_amount = taker_asset_amount
+ self.maker_asset_data = maker_asset_data
+ self.taker_asset_data = taker_asset_data
+ self.exchange_address = exchange_address
+ self.expiration_time_seconds = expiration_time_seconds
+
+ @property
+ def maker_address(self):
+ """Gets the maker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The maker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_address
+
+ @maker_address.setter
+ def maker_address(self, maker_address):
+ """Sets the maker_address of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param maker_address: The maker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_address is None:
+ raise ValueError(
+ "Invalid value for `maker_address`, must not be `None`"
+ ) # noqa: E501
+ if maker_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", maker_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._maker_address = maker_address
+
+ @property
+ def taker_address(self):
+ """Gets the taker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The taker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_address
+
+ @taker_address.setter
+ def taker_address(self, taker_address):
+ """Sets the taker_address of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param taker_address: The taker_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_address is None:
+ raise ValueError(
+ "Invalid value for `taker_address`, must not be `None`"
+ ) # noqa: E501
+ if taker_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", taker_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._taker_address = taker_address
+
+ @property
+ def maker_asset_amount(self):
+ """Gets the maker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The maker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_amount
+
+ @maker_asset_amount.setter
+ def maker_asset_amount(self, maker_asset_amount):
+ """Sets the maker_asset_amount of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param maker_asset_amount: The maker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_amount is None:
+ raise ValueError(
+ "Invalid value for `maker_asset_amount`, must not be `None`"
+ ) # noqa: E501
+ if maker_asset_amount is not None and not re.search(
+ r"^\\d+$", maker_asset_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._maker_asset_amount = maker_asset_amount
+
+ @property
+ def taker_asset_amount(self):
+ """Gets the taker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The taker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_amount
+
+ @taker_asset_amount.setter
+ def taker_asset_amount(self, taker_asset_amount):
+ """Sets the taker_asset_amount of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param taker_asset_amount: The taker_asset_amount of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_amount is None:
+ raise ValueError(
+ "Invalid value for `taker_asset_amount`, must not be `None`"
+ ) # noqa: E501
+ if taker_asset_amount is not None and not re.search(
+ r"^\\d+$", taker_asset_amount
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_amount`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._taker_asset_amount = taker_asset_amount
+
+ @property
+ def maker_asset_data(self):
+ """Gets the maker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The maker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_data
+
+ @maker_asset_data.setter
+ def maker_asset_data(self, maker_asset_data):
+ """Sets the maker_asset_data of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param maker_asset_data: The maker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_data is None:
+ raise ValueError(
+ "Invalid value for `maker_asset_data`, must not be `None`"
+ ) # noqa: E501
+ if maker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", maker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._maker_asset_data = maker_asset_data
+
+ @property
+ def taker_asset_data(self):
+ """Gets the taker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The taker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_data
+
+ @taker_asset_data.setter
+ def taker_asset_data(self, taker_asset_data):
+ """Sets the taker_asset_data of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param taker_asset_data: The taker_asset_data of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_data is None:
+ raise ValueError(
+ "Invalid value for `taker_asset_data`, must not be `None`"
+ ) # noqa: E501
+ if taker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", taker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._taker_asset_data = taker_asset_data
+
+ @property
+ def exchange_address(self):
+ """Gets the exchange_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The exchange_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._exchange_address
+
+ @exchange_address.setter
+ def exchange_address(self, exchange_address):
+ """Sets the exchange_address of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param exchange_address: The exchange_address of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if exchange_address is None:
+ raise ValueError(
+ "Invalid value for `exchange_address`, must not be `None`"
+ ) # noqa: E501
+ if exchange_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", exchange_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `exchange_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._exchange_address = exchange_address
+
+ @property
+ def expiration_time_seconds(self):
+ """Gets the expiration_time_seconds of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+
+
+ :return: The expiration_time_seconds of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._expiration_time_seconds
+
+ @expiration_time_seconds.setter
+ def expiration_time_seconds(self, expiration_time_seconds):
+ """Sets the expiration_time_seconds of this RelayerApiOrderConfigPayloadSchema.
+
+
+ :param expiration_time_seconds: The expiration_time_seconds of this RelayerApiOrderConfigPayloadSchema. # noqa: E501
+ :type: str
+ """
+ if expiration_time_seconds is None:
+ raise ValueError(
+ "Invalid value for `expiration_time_seconds`, must not be `None`"
+ ) # noqa: E501
+ if expiration_time_seconds is not None and not re.search(
+ r"^\\d+$", expiration_time_seconds
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `expiration_time_seconds`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._expiration_time_seconds = expiration_time_seconds
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrderConfigPayloadSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_order_config_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_order_config_response_schema.py
new file mode 100644
index 000000000..a6bfcf32b
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_order_config_response_schema.py
@@ -0,0 +1,228 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrderConfigResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "maker_fee": "str",
+ "taker_fee": "str",
+ "fee_recipient_address": "str",
+ "sender_address": "str",
+ }
+
+ attribute_map = {
+ "maker_fee": "makerFee",
+ "taker_fee": "takerFee",
+ "fee_recipient_address": "feeRecipientAddress",
+ "sender_address": "senderAddress",
+ }
+
+ def __init__(
+ self,
+ maker_fee=None,
+ taker_fee=None,
+ fee_recipient_address=None,
+ sender_address=None,
+ ): # noqa: E501
+ """RelayerApiOrderConfigResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._maker_fee = None
+ self._taker_fee = None
+ self._fee_recipient_address = None
+ self._sender_address = None
+ self.discriminator = None
+
+ self.maker_fee = maker_fee
+ self.taker_fee = taker_fee
+ self.fee_recipient_address = fee_recipient_address
+ self.sender_address = sender_address
+
+ @property
+ def maker_fee(self):
+ """Gets the maker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+
+
+ :return: The maker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_fee
+
+ @maker_fee.setter
+ def maker_fee(self, maker_fee):
+ """Sets the maker_fee of this RelayerApiOrderConfigResponseSchema.
+
+
+ :param maker_fee: The maker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :type: str
+ """
+ if maker_fee is None:
+ raise ValueError(
+ "Invalid value for `maker_fee`, must not be `None`"
+ ) # noqa: E501
+ if maker_fee is not None and not re.search(
+ r"^\\d+$", maker_fee
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_fee`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._maker_fee = maker_fee
+
+ @property
+ def taker_fee(self):
+ """Gets the taker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+
+
+ :return: The taker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_fee
+
+ @taker_fee.setter
+ def taker_fee(self, taker_fee):
+ """Sets the taker_fee of this RelayerApiOrderConfigResponseSchema.
+
+
+ :param taker_fee: The taker_fee of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :type: str
+ """
+ if taker_fee is None:
+ raise ValueError(
+ "Invalid value for `taker_fee`, must not be `None`"
+ ) # noqa: E501
+ if taker_fee is not None and not re.search(
+ r"^\\d+$", taker_fee
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_fee`, must be a follow pattern or equal to `/^\\d+$/`"
+ ) # noqa: E501
+
+ self._taker_fee = taker_fee
+
+ @property
+ def fee_recipient_address(self):
+ """Gets the fee_recipient_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+
+
+ :return: The fee_recipient_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._fee_recipient_address
+
+ @fee_recipient_address.setter
+ def fee_recipient_address(self, fee_recipient_address):
+ """Sets the fee_recipient_address of this RelayerApiOrderConfigResponseSchema.
+
+
+ :param fee_recipient_address: The fee_recipient_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :type: str
+ """
+ if fee_recipient_address is None:
+ raise ValueError(
+ "Invalid value for `fee_recipient_address`, must not be `None`"
+ ) # noqa: E501
+ if fee_recipient_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", fee_recipient_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `fee_recipient_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._fee_recipient_address = fee_recipient_address
+
+ @property
+ def sender_address(self):
+ """Gets the sender_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+
+
+ :return: The sender_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._sender_address
+
+ @sender_address.setter
+ def sender_address(self, sender_address):
+ """Sets the sender_address of this RelayerApiOrderConfigResponseSchema.
+
+
+ :param sender_address: The sender_address of this RelayerApiOrderConfigResponseSchema. # noqa: E501
+ :type: str
+ """
+ if sender_address is None:
+ raise ValueError(
+ "Invalid value for `sender_address`, must not be `None`"
+ ) # noqa: E501
+ if sender_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", sender_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `sender_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._sender_address = sender_address
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrderConfigResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_order_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_order_schema.py
new file mode 100644
index 000000000..5ee45cb30
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_order_schema.py
@@ -0,0 +1,134 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrderSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"order": "OrderSchema", "meta_data": "object"}
+
+ attribute_map = {"order": "order", "meta_data": "metaData"}
+
+ def __init__(self, order=None, meta_data=None): # noqa: E501
+ """RelayerApiOrderSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._order = None
+ self._meta_data = None
+ self.discriminator = None
+
+ self.order = order
+ self.meta_data = meta_data
+
+ @property
+ def order(self):
+ """Gets the order of this RelayerApiOrderSchema. # noqa: E501
+
+
+ :return: The order of this RelayerApiOrderSchema. # noqa: E501
+ :rtype: OrderSchema
+ """
+ return self._order
+
+ @order.setter
+ def order(self, order):
+ """Sets the order of this RelayerApiOrderSchema.
+
+
+ :param order: The order of this RelayerApiOrderSchema. # noqa: E501
+ :type: OrderSchema
+ """
+ if order is None:
+ raise ValueError(
+ "Invalid value for `order`, must not be `None`"
+ ) # noqa: E501
+
+ self._order = order
+
+ @property
+ def meta_data(self):
+ """Gets the meta_data of this RelayerApiOrderSchema. # noqa: E501
+
+
+ :return: The meta_data of this RelayerApiOrderSchema. # noqa: E501
+ :rtype: object
+ """
+ return self._meta_data
+
+ @meta_data.setter
+ def meta_data(self, meta_data):
+ """Sets the meta_data of this RelayerApiOrderSchema.
+
+
+ :param meta_data: The meta_data of this RelayerApiOrderSchema. # noqa: E501
+ :type: object
+ """
+ if meta_data is None:
+ raise ValueError(
+ "Invalid value for `meta_data`, must not be `None`"
+ ) # noqa: E501
+
+ self._meta_data = meta_data
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrderSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_orderbook_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_orderbook_response_schema.py
new file mode 100644
index 000000000..364785b03
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_orderbook_response_schema.py
@@ -0,0 +1,137 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrderbookResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "bids": "RelayerApiOrdersResponseSchema",
+ "asks": "RelayerApiOrdersResponseSchema",
+ }
+
+ attribute_map = {"bids": "bids", "asks": "asks"}
+
+ def __init__(self, bids=None, asks=None): # noqa: E501
+ """RelayerApiOrderbookResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._bids = None
+ self._asks = None
+ self.discriminator = None
+
+ self.bids = bids
+ self.asks = asks
+
+ @property
+ def bids(self):
+ """Gets the bids of this RelayerApiOrderbookResponseSchema. # noqa: E501
+
+
+ :return: The bids of this RelayerApiOrderbookResponseSchema. # noqa: E501
+ :rtype: RelayerApiOrdersResponseSchema
+ """
+ return self._bids
+
+ @bids.setter
+ def bids(self, bids):
+ """Sets the bids of this RelayerApiOrderbookResponseSchema.
+
+
+ :param bids: The bids of this RelayerApiOrderbookResponseSchema. # noqa: E501
+ :type: RelayerApiOrdersResponseSchema
+ """
+ if bids is None:
+ raise ValueError(
+ "Invalid value for `bids`, must not be `None`"
+ ) # noqa: E501
+
+ self._bids = bids
+
+ @property
+ def asks(self):
+ """Gets the asks of this RelayerApiOrderbookResponseSchema. # noqa: E501
+
+
+ :return: The asks of this RelayerApiOrderbookResponseSchema. # noqa: E501
+ :rtype: RelayerApiOrdersResponseSchema
+ """
+ return self._asks
+
+ @asks.setter
+ def asks(self, asks):
+ """Sets the asks of this RelayerApiOrderbookResponseSchema.
+
+
+ :param asks: The asks of this RelayerApiOrderbookResponseSchema. # noqa: E501
+ :type: RelayerApiOrdersResponseSchema
+ """
+ if asks is None:
+ raise ValueError(
+ "Invalid value for `asks`, must not be `None`"
+ ) # noqa: E501
+
+ self._asks = asks
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrderbookResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_payload_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_payload_schema.py
new file mode 100644
index 000000000..f6bb758f9
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_payload_schema.py
@@ -0,0 +1,344 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrdersChannelSubscribePayloadSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "maker_asset_proxy_id": "str",
+ "taker_asset_proxy_id": "str",
+ "network_id": "float",
+ "maker_asset_address": "str",
+ "taker_asset_address": "str",
+ "maker_asset_data": "str",
+ "taker_asset_data": "str",
+ "trader_asset_data": "str",
+ }
+
+ attribute_map = {
+ "maker_asset_proxy_id": "makerAssetProxyId",
+ "taker_asset_proxy_id": "takerAssetProxyId",
+ "network_id": "networkId",
+ "maker_asset_address": "makerAssetAddress",
+ "taker_asset_address": "takerAssetAddress",
+ "maker_asset_data": "makerAssetData",
+ "taker_asset_data": "takerAssetData",
+ "trader_asset_data": "traderAssetData",
+ }
+
+ def __init__(
+ self,
+ maker_asset_proxy_id=None,
+ taker_asset_proxy_id=None,
+ network_id=None,
+ maker_asset_address=None,
+ taker_asset_address=None,
+ maker_asset_data=None,
+ taker_asset_data=None,
+ trader_asset_data=None,
+ ): # noqa: E501
+ """RelayerApiOrdersChannelSubscribePayloadSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._maker_asset_proxy_id = None
+ self._taker_asset_proxy_id = None
+ self._network_id = None
+ self._maker_asset_address = None
+ self._taker_asset_address = None
+ self._maker_asset_data = None
+ self._taker_asset_data = None
+ self._trader_asset_data = None
+ self.discriminator = None
+
+ if maker_asset_proxy_id is not None:
+ self.maker_asset_proxy_id = maker_asset_proxy_id
+ if taker_asset_proxy_id is not None:
+ self.taker_asset_proxy_id = taker_asset_proxy_id
+ if network_id is not None:
+ self.network_id = network_id
+ if maker_asset_address is not None:
+ self.maker_asset_address = maker_asset_address
+ if taker_asset_address is not None:
+ self.taker_asset_address = taker_asset_address
+ if maker_asset_data is not None:
+ self.maker_asset_data = maker_asset_data
+ if taker_asset_data is not None:
+ self.taker_asset_data = taker_asset_data
+ if trader_asset_data is not None:
+ self.trader_asset_data = trader_asset_data
+
+ @property
+ def maker_asset_proxy_id(self):
+ """Gets the maker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The maker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_proxy_id
+
+ @maker_asset_proxy_id.setter
+ def maker_asset_proxy_id(self, maker_asset_proxy_id):
+ """Sets the maker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param maker_asset_proxy_id: The maker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_proxy_id is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", maker_asset_proxy_id
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_proxy_id`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._maker_asset_proxy_id = maker_asset_proxy_id
+
+ @property
+ def taker_asset_proxy_id(self):
+ """Gets the taker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The taker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_proxy_id
+
+ @taker_asset_proxy_id.setter
+ def taker_asset_proxy_id(self, taker_asset_proxy_id):
+ """Sets the taker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param taker_asset_proxy_id: The taker_asset_proxy_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_proxy_id is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", taker_asset_proxy_id
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_proxy_id`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._taker_asset_proxy_id = taker_asset_proxy_id
+
+ @property
+ def network_id(self):
+ """Gets the network_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The network_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: float
+ """
+ return self._network_id
+
+ @network_id.setter
+ def network_id(self, network_id):
+ """Sets the network_id of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param network_id: The network_id of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: float
+ """
+
+ self._network_id = network_id
+
+ @property
+ def maker_asset_address(self):
+ """Gets the maker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The maker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_address
+
+ @maker_asset_address.setter
+ def maker_asset_address(self, maker_asset_address):
+ """Sets the maker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param maker_asset_address: The maker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", maker_asset_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._maker_asset_address = maker_asset_address
+
+ @property
+ def taker_asset_address(self):
+ """Gets the taker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The taker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_address
+
+ @taker_asset_address.setter
+ def taker_asset_address(self, taker_asset_address):
+ """Sets the taker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param taker_asset_address: The taker_asset_address of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_address is not None and not re.search(
+ r"^0x[0-9a-f]{40}$", taker_asset_address
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_address`, must be a follow pattern or equal to `/^0x[0-9a-f]{40}$/`"
+ ) # noqa: E501
+
+ self._taker_asset_address = taker_asset_address
+
+ @property
+ def maker_asset_data(self):
+ """Gets the maker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The maker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._maker_asset_data
+
+ @maker_asset_data.setter
+ def maker_asset_data(self, maker_asset_data):
+ """Sets the maker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param maker_asset_data: The maker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if maker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", maker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `maker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._maker_asset_data = maker_asset_data
+
+ @property
+ def taker_asset_data(self):
+ """Gets the taker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The taker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._taker_asset_data
+
+ @taker_asset_data.setter
+ def taker_asset_data(self, taker_asset_data):
+ """Sets the taker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param taker_asset_data: The taker_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if taker_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", taker_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `taker_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._taker_asset_data = taker_asset_data
+
+ @property
+ def trader_asset_data(self):
+ """Gets the trader_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+
+
+ :return: The trader_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._trader_asset_data
+
+ @trader_asset_data.setter
+ def trader_asset_data(self, trader_asset_data):
+ """Sets the trader_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema.
+
+
+ :param trader_asset_data: The trader_asset_data of this RelayerApiOrdersChannelSubscribePayloadSchema. # noqa: E501
+ :type: str
+ """
+ if trader_asset_data is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", trader_asset_data
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `trader_asset_data`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._trader_asset_data = trader_asset_data
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(
+ other, RelayerApiOrdersChannelSubscribePayloadSchema
+ ):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_schema.py
new file mode 100644
index 000000000..2f72d5307
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_subscribe_schema.py
@@ -0,0 +1,211 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrdersChannelSubscribeSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "type": "str",
+ "channel": "str",
+ "request_id": "str",
+ "payload": "RelayerApiOrdersChannelSubscribePayloadSchema",
+ }
+
+ attribute_map = {
+ "type": "type",
+ "channel": "channel",
+ "request_id": "requestId",
+ "payload": "payload",
+ }
+
+ def __init__(
+ self, type=None, channel=None, request_id=None, payload=None
+ ): # noqa: E501
+ """RelayerApiOrdersChannelSubscribeSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._type = None
+ self._channel = None
+ self._request_id = None
+ self._payload = None
+ self.discriminator = None
+
+ self.type = type
+ self.channel = channel
+ self.request_id = request_id
+ if payload is not None:
+ self.payload = payload
+
+ @property
+ def type(self):
+ """Gets the type of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+
+
+ :return: The type of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._type
+
+ @type.setter
+ def type(self, type):
+ """Sets the type of this RelayerApiOrdersChannelSubscribeSchema.
+
+
+ :param type: The type of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :type: str
+ """
+ if type is None:
+ raise ValueError(
+ "Invalid value for `type`, must not be `None`"
+ ) # noqa: E501
+ allowed_values = ["subscribe"] # noqa: E501
+ if type not in allowed_values:
+ raise ValueError(
+ "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501
+ type, allowed_values
+ )
+ )
+
+ self._type = type
+
+ @property
+ def channel(self):
+ """Gets the channel of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+
+
+ :return: The channel of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._channel
+
+ @channel.setter
+ def channel(self, channel):
+ """Sets the channel of this RelayerApiOrdersChannelSubscribeSchema.
+
+
+ :param channel: The channel of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :type: str
+ """
+ if channel is None:
+ raise ValueError(
+ "Invalid value for `channel`, must not be `None`"
+ ) # noqa: E501
+ allowed_values = ["orders"] # noqa: E501
+ if channel not in allowed_values:
+ raise ValueError(
+ "Invalid value for `channel` ({0}), must be one of {1}".format( # noqa: E501
+ channel, allowed_values
+ )
+ )
+
+ self._channel = channel
+
+ @property
+ def request_id(self):
+ """Gets the request_id of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+
+
+ :return: The request_id of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._request_id
+
+ @request_id.setter
+ def request_id(self, request_id):
+ """Sets the request_id of this RelayerApiOrdersChannelSubscribeSchema.
+
+
+ :param request_id: The request_id of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :type: str
+ """
+ if request_id is None:
+ raise ValueError(
+ "Invalid value for `request_id`, must not be `None`"
+ ) # noqa: E501
+
+ self._request_id = request_id
+
+ @property
+ def payload(self):
+ """Gets the payload of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+
+
+ :return: The payload of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :rtype: RelayerApiOrdersChannelSubscribePayloadSchema
+ """
+ return self._payload
+
+ @payload.setter
+ def payload(self, payload):
+ """Sets the payload of this RelayerApiOrdersChannelSubscribeSchema.
+
+
+ :param payload: The payload of this RelayerApiOrdersChannelSubscribeSchema. # noqa: E501
+ :type: RelayerApiOrdersChannelSubscribePayloadSchema
+ """
+
+ self._payload = payload
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrdersChannelSubscribeSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_update_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_update_schema.py
new file mode 100644
index 000000000..68aa2fddb
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_orders_channel_update_schema.py
@@ -0,0 +1,211 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrdersChannelUpdateSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {
+ "type": "str",
+ "channel": "str",
+ "request_id": "str",
+ "payload": "list[RelayerApiOrderSchema]",
+ }
+
+ attribute_map = {
+ "type": "type",
+ "channel": "channel",
+ "request_id": "requestId",
+ "payload": "payload",
+ }
+
+ def __init__(
+ self, type=None, channel=None, request_id=None, payload=None
+ ): # noqa: E501
+ """RelayerApiOrdersChannelUpdateSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._type = None
+ self._channel = None
+ self._request_id = None
+ self._payload = None
+ self.discriminator = None
+
+ self.type = type
+ self.channel = channel
+ self.request_id = request_id
+ if payload is not None:
+ self.payload = payload
+
+ @property
+ def type(self):
+ """Gets the type of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+
+
+ :return: The type of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._type
+
+ @type.setter
+ def type(self, type):
+ """Sets the type of this RelayerApiOrdersChannelUpdateSchema.
+
+
+ :param type: The type of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :type: str
+ """
+ if type is None:
+ raise ValueError(
+ "Invalid value for `type`, must not be `None`"
+ ) # noqa: E501
+ allowed_values = ["update"] # noqa: E501
+ if type not in allowed_values:
+ raise ValueError(
+ "Invalid value for `type` ({0}), must be one of {1}".format( # noqa: E501
+ type, allowed_values
+ )
+ )
+
+ self._type = type
+
+ @property
+ def channel(self):
+ """Gets the channel of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+
+
+ :return: The channel of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._channel
+
+ @channel.setter
+ def channel(self, channel):
+ """Sets the channel of this RelayerApiOrdersChannelUpdateSchema.
+
+
+ :param channel: The channel of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :type: str
+ """
+ if channel is None:
+ raise ValueError(
+ "Invalid value for `channel`, must not be `None`"
+ ) # noqa: E501
+ allowed_values = ["orders"] # noqa: E501
+ if channel not in allowed_values:
+ raise ValueError(
+ "Invalid value for `channel` ({0}), must be one of {1}".format( # noqa: E501
+ channel, allowed_values
+ )
+ )
+
+ self._channel = channel
+
+ @property
+ def request_id(self):
+ """Gets the request_id of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+
+
+ :return: The request_id of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._request_id
+
+ @request_id.setter
+ def request_id(self, request_id):
+ """Sets the request_id of this RelayerApiOrdersChannelUpdateSchema.
+
+
+ :param request_id: The request_id of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :type: str
+ """
+ if request_id is None:
+ raise ValueError(
+ "Invalid value for `request_id`, must not be `None`"
+ ) # noqa: E501
+
+ self._request_id = request_id
+
+ @property
+ def payload(self):
+ """Gets the payload of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+
+
+ :return: The payload of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :rtype: list[RelayerApiOrderSchema]
+ """
+ return self._payload
+
+ @payload.setter
+ def payload(self, payload):
+ """Sets the payload of this RelayerApiOrdersChannelUpdateSchema.
+
+
+ :param payload: The payload of this RelayerApiOrdersChannelUpdateSchema. # noqa: E501
+ :type: list[RelayerApiOrderSchema]
+ """
+
+ self._payload = payload
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrdersChannelUpdateSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/relayer_api_orders_response_schema.py b/python-packages/sra_client/sra_client/models/relayer_api_orders_response_schema.py
new file mode 100644
index 000000000..d72b74cb7
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/relayer_api_orders_response_schema.py
@@ -0,0 +1,107 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class RelayerApiOrdersResponseSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"records": "list[RelayerApiOrderSchema]"}
+
+ attribute_map = {"records": "records"}
+
+ def __init__(self, records=None): # noqa: E501
+ """RelayerApiOrdersResponseSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._records = None
+ self.discriminator = None
+
+ self.records = records
+
+ @property
+ def records(self):
+ """Gets the records of this RelayerApiOrdersResponseSchema. # noqa: E501
+
+
+ :return: The records of this RelayerApiOrdersResponseSchema. # noqa: E501
+ :rtype: list[RelayerApiOrderSchema]
+ """
+ return self._records
+
+ @records.setter
+ def records(self, records):
+ """Sets the records of this RelayerApiOrdersResponseSchema.
+
+
+ :param records: The records of this RelayerApiOrdersResponseSchema. # noqa: E501
+ :type: list[RelayerApiOrderSchema]
+ """
+ if records is None:
+ raise ValueError(
+ "Invalid value for `records`, must not be `None`"
+ ) # noqa: E501
+
+ self._records = records
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, RelayerApiOrdersResponseSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/models/signed_order_schema.py b/python-packages/sra_client/sra_client/models/signed_order_schema.py
new file mode 100644
index 000000000..8c71bff89
--- /dev/null
+++ b/python-packages/sra_client/sra_client/models/signed_order_schema.py
@@ -0,0 +1,113 @@
+# coding: utf-8
+
+
+import pprint
+import re # noqa: F401
+
+import six
+
+
+class SignedOrderSchema(object):
+ """NOTE: This class is auto generated by OpenAPI Generator.
+ Ref: https://openapi-generator.tech
+
+ Do not edit the class manually.
+ """
+
+ """
+ Attributes:
+ openapi_types (dict): The key is attribute name
+ and the value is attribute type.
+ attribute_map (dict): The key is attribute name
+ and the value is json key in definition.
+ """
+ openapi_types = {"signature": "str"}
+
+ attribute_map = {"signature": "signature"}
+
+ def __init__(self, signature=None): # noqa: E501
+ """SignedOrderSchema - a model defined in OpenAPI""" # noqa: E501
+
+ self._signature = None
+ self.discriminator = None
+
+ self.signature = signature
+
+ @property
+ def signature(self):
+ """Gets the signature of this SignedOrderSchema. # noqa: E501
+
+
+ :return: The signature of this SignedOrderSchema. # noqa: E501
+ :rtype: str
+ """
+ return self._signature
+
+ @signature.setter
+ def signature(self, signature):
+ """Sets the signature of this SignedOrderSchema.
+
+
+ :param signature: The signature of this SignedOrderSchema. # noqa: E501
+ :type: str
+ """
+ if signature is None:
+ raise ValueError(
+ "Invalid value for `signature`, must not be `None`"
+ ) # noqa: E501
+ if signature is not None and not re.search(
+ r"^0x(([0-9a-f][0-9a-f])+)?$", signature
+ ): # noqa: E501
+ raise ValueError(
+ r"Invalid value for `signature`, must be a follow pattern or equal to `/^0x(([0-9a-f][0-9a-f])+)?$/`"
+ ) # noqa: E501
+
+ self._signature = signature
+
+ def to_dict(self):
+ """Returns the model properties as a dict"""
+ result = {}
+
+ for attr, _ in six.iteritems(self.openapi_types):
+ value = getattr(self, attr)
+ if isinstance(value, list):
+ result[attr] = list(
+ map(
+ lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
+ value,
+ )
+ )
+ elif hasattr(value, "to_dict"):
+ result[attr] = value.to_dict()
+ elif isinstance(value, dict):
+ result[attr] = dict(
+ map(
+ lambda item: (item[0], item[1].to_dict())
+ if hasattr(item[1], "to_dict")
+ else item,
+ value.items(),
+ )
+ )
+ else:
+ result[attr] = value
+
+ return result
+
+ def to_str(self):
+ """Returns the string representation of the model"""
+ return pprint.pformat(self.to_dict())
+
+ def __repr__(self):
+ """For `print` and `pprint`"""
+ return self.to_str()
+
+ def __eq__(self, other):
+ """Returns true if both objects are equal"""
+ if not isinstance(other, SignedOrderSchema):
+ return False
+
+ return self.__dict__ == other.__dict__
+
+ def __ne__(self, other):
+ """Returns true if both objects are not equal"""
+ return not self == other
diff --git a/python-packages/sra_client/sra_client/rest.py b/python-packages/sra_client/sra_client/rest.py
new file mode 100644
index 000000000..b38cabd70
--- /dev/null
+++ b/python-packages/sra_client/sra_client/rest.py
@@ -0,0 +1,421 @@
+# coding: utf-8
+
+
+from __future__ import absolute_import
+
+import io
+import json
+import logging
+import re
+import ssl
+
+import certifi
+
+# python 2 and python 3 compatibility library
+import six
+from six.moves.urllib.parse import urlencode
+
+try:
+ import urllib3
+except ImportError:
+ raise ImportError("OpenAPI Python client requires urllib3.")
+
+
+logger = logging.getLogger(__name__)
+
+
+class RESTResponse(io.IOBase):
+ def __init__(self, resp):
+ self.urllib3_response = resp
+ self.status = resp.status
+ self.reason = resp.reason
+ self.data = resp.data
+
+ def getheaders(self):
+ """Returns a dictionary of the response headers."""
+ return self.urllib3_response.getheaders()
+
+ def getheader(self, name, default=None):
+ """Returns a given response header."""
+ return self.urllib3_response.getheader(name, default)
+
+
+class RESTClientObject(object):
+ def __init__(self, configuration, pools_size=4, maxsize=None):
+ # urllib3.PoolManager will pass all kw parameters to connectionpool
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
+ # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
+ # maxsize is the number of requests to host that are allowed in parallel # noqa: E501
+ # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
+
+ # cert_reqs
+ if configuration.verify_ssl:
+ cert_reqs = ssl.CERT_REQUIRED
+ else:
+ cert_reqs = ssl.CERT_NONE
+
+ # ca_certs
+ if configuration.ssl_ca_cert:
+ ca_certs = configuration.ssl_ca_cert
+ else:
+ # if not set certificate file, use Mozilla's root certificates.
+ ca_certs = certifi.where()
+
+ addition_pool_args = {}
+ if configuration.assert_hostname is not None:
+ addition_pool_args[
+ "assert_hostname"
+ ] = configuration.assert_hostname # noqa: E501
+
+ if maxsize is None:
+ if configuration.connection_pool_maxsize is not None:
+ maxsize = configuration.connection_pool_maxsize
+ else:
+ maxsize = 4
+
+ # https pool manager
+ if configuration.proxy:
+ self.pool_manager = urllib3.ProxyManager(
+ num_pools=pools_size,
+ maxsize=maxsize,
+ cert_reqs=cert_reqs,
+ ca_certs=ca_certs,
+ cert_file=configuration.cert_file,
+ key_file=configuration.key_file,
+ proxy_url=configuration.proxy,
+ **addition_pool_args
+ )
+ else:
+ self.pool_manager = urllib3.PoolManager(
+ num_pools=pools_size,
+ maxsize=maxsize,
+ cert_reqs=cert_reqs,
+ ca_certs=ca_certs,
+ cert_file=configuration.cert_file,
+ key_file=configuration.key_file,
+ **addition_pool_args
+ )
+
+ def request(
+ self,
+ method,
+ url,
+ query_params=None,
+ headers=None,
+ body=None,
+ post_params=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ """Perform requests.
+
+ :param method: http request method
+ :param url: http request url
+ :param query_params: query parameters in the url
+ :param headers: http request headers
+ :param body: request json body, for `application/json`
+ :param post_params: request post parameters,
+ `application/x-www-form-urlencoded`
+ and `multipart/form-data`
+ :param _preload_content: if False, the urllib3.HTTPResponse object will
+ be returned without reading/decoding response
+ data. Default is True.
+ :param _request_timeout: timeout setting for this request. If one
+ number provided, it will be total request
+ timeout. It can also be a pair (tuple) of
+ (connection, read) timeouts.
+ """
+ method = method.upper()
+ assert method in [
+ "GET",
+ "HEAD",
+ "DELETE",
+ "POST",
+ "PUT",
+ "PATCH",
+ "OPTIONS",
+ ]
+
+ if post_params and body:
+ raise ValueError(
+ "body parameter cannot be used with post_params parameter."
+ )
+
+ post_params = post_params or {}
+ headers = headers or {}
+
+ timeout = None
+ if _request_timeout:
+ if isinstance(
+ _request_timeout, (int,) if six.PY3 else (int, long)
+ ): # noqa: E501,F821
+ timeout = urllib3.Timeout(total=_request_timeout)
+ elif (
+ isinstance(_request_timeout, tuple)
+ and len(_request_timeout) == 2
+ ):
+ timeout = urllib3.Timeout(
+ connect=_request_timeout[0], read=_request_timeout[1]
+ )
+
+ if "Content-Type" not in headers:
+ headers["Content-Type"] = "application/json"
+
+ try:
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
+ if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
+ if query_params:
+ url += "?" + urlencode(query_params)
+ if re.search("json", headers["Content-Type"], re.IGNORECASE):
+ request_body = None
+ if body is not None:
+ request_body = json.dumps(body)
+ r = self.pool_manager.request(
+ method,
+ url,
+ body=request_body,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers,
+ )
+ elif (
+ headers["Content-Type"]
+ == "application/x-www-form-urlencoded"
+ ): # noqa: E501
+ r = self.pool_manager.request(
+ method,
+ url,
+ fields=post_params,
+ encode_multipart=False,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers,
+ )
+ elif headers["Content-Type"] == "multipart/form-data":
+ # must del headers['Content-Type'], or the correct
+ # Content-Type which generated by urllib3 will be
+ # overwritten.
+ del headers["Content-Type"]
+ r = self.pool_manager.request(
+ method,
+ url,
+ fields=post_params,
+ encode_multipart=True,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers,
+ )
+ # Pass a `string` parameter directly in the body to support
+ # other content types than Json when `body` argument is
+ # provided in serialized form
+ elif isinstance(body, str):
+ request_body = body
+ r = self.pool_manager.request(
+ method,
+ url,
+ body=request_body,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers,
+ )
+ else:
+ # Cannot generate the request from given parameters
+ msg = """Cannot prepare a request message for provided
+ arguments. Please check that your arguments match
+ declared content type."""
+ raise ApiException(status=0, reason=msg)
+ # For `GET`, `HEAD`
+ else:
+ r = self.pool_manager.request(
+ method,
+ url,
+ fields=query_params,
+ preload_content=_preload_content,
+ timeout=timeout,
+ headers=headers,
+ )
+ except urllib3.exceptions.SSLError as e:
+ msg = "{0}\n{1}".format(type(e).__name__, str(e))
+ raise ApiException(status=0, reason=msg)
+
+ if _preload_content:
+ r = RESTResponse(r)
+
+ # In the python 3, the response.data is bytes.
+ # we need to decode it to string.
+ if six.PY3:
+ r.data = r.data.decode("utf8")
+
+ # log response body
+ logger.debug("response body: %s", r.data)
+
+ if not 200 <= r.status <= 299:
+ raise ApiException(http_resp=r)
+
+ return r
+
+ def GET(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "GET",
+ url,
+ headers=headers,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ query_params=query_params,
+ )
+
+ def HEAD(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "HEAD",
+ url,
+ headers=headers,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ query_params=query_params,
+ )
+
+ def OPTIONS(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ post_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "OPTIONS",
+ url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+
+ def DELETE(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "DELETE",
+ url,
+ headers=headers,
+ query_params=query_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+
+ def POST(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ post_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "POST",
+ url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+
+ def PUT(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ post_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "PUT",
+ url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+
+ def PATCH(
+ self,
+ url,
+ headers=None,
+ query_params=None,
+ post_params=None,
+ body=None,
+ _preload_content=True,
+ _request_timeout=None,
+ ):
+ return self.request(
+ "PATCH",
+ url,
+ headers=headers,
+ query_params=query_params,
+ post_params=post_params,
+ _preload_content=_preload_content,
+ _request_timeout=_request_timeout,
+ body=body,
+ )
+
+
+class ApiException(Exception):
+ def __init__(self, status=None, reason=None, http_resp=None):
+ if http_resp:
+ self.status = http_resp.status
+ self.reason = http_resp.reason
+ self.body = http_resp.data
+ self.headers = http_resp.getheaders()
+ else:
+ self.status = status
+ self.reason = reason
+ self.body = None
+ self.headers = None
+
+ def __str__(self):
+ """Custom error messages for exception"""
+ error_message = "({0})\n" "Reason: {1}\n".format(
+ self.status, self.reason
+ )
+ if self.headers:
+ error_message += "HTTP response headers: {0}\n".format(
+ self.headers
+ )
+
+ if self.body:
+ error_message += "HTTP response body: {0}\n".format(self.body)
+
+ return error_message
diff --git a/python-packages/sra_client/test-requirements.txt b/python-packages/sra_client/test-requirements.txt
new file mode 100644
index 000000000..2702246c0
--- /dev/null
+++ b/python-packages/sra_client/test-requirements.txt
@@ -0,0 +1,5 @@
+coverage>=4.0.3
+nose>=1.3.7
+pluggy>=0.3.1
+py>=1.4.31
+randomize>=0.13
diff --git a/python-packages/sra_client/test/__init__.py b/python-packages/sra_client/test/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/python-packages/sra_client/test/__init__.py
diff --git a/python-packages/sra_client/test/test_default_api.py b/python-packages/sra_client/test/test_default_api.py
new file mode 100644
index 000000000..d23c6173f
--- /dev/null
+++ b/python-packages/sra_client/test/test_default_api.py
@@ -0,0 +1,35 @@
+# coding: utf-8
+
+
+from __future__ import absolute_import
+
+import unittest
+
+import sra_client
+from sra_client.api.default_api import DefaultApi # noqa: E501
+from sra_client.models.relayer_api_asset_data_pairs_response_schema import (
+ RelayerApiAssetDataPairsResponseSchema
+)
+from sra_client.rest import ApiException
+
+
+class TestDefaultApi(unittest.TestCase):
+ """DefaultApi unit test stubs"""
+
+ def setUp(self):
+ self.api = sra_client.api.default_api.DefaultApi() # noqa: E501
+
+ def tearDown(self):
+ pass
+
+ def test_get_asset_pairs(self):
+ """Test case for get_asset_pairs
+
+ """
+ expected = RelayerApiAssetDataPairsResponseSchema([])
+ actual = self.api.get_asset_pairs()
+ self.assertEqual(actual, expected)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/python-packages/sra_client/tox.ini b/python-packages/sra_client/tox.ini
new file mode 100644
index 000000000..69d59f4ff
--- /dev/null
+++ b/python-packages/sra_client/tox.ini
@@ -0,0 +1,24 @@
+[tox]
+envlist = py27, py3
+
+[testenv]
+deps=-r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+
+commands=
+ nosetests \
+ []
+
+[testenv:run_tests_against_test_deployment]
+commands =
+ # install dependencies from real PyPI
+ pip install mypy_extensions pytest
+ # install package-under-test from test PyPI
+ pip install --index-url https://test.pypi.org/legacy/ 0x-sra-client
+ pytest test
+
+[testenv:run_tests_against_deployment]
+deps=pytest
+commands =
+ pip install 0x-sra-client
+ pytest test
diff --git a/tsconfig.json b/tsconfig.json
index bbcb0a6d2..751115554 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -20,9 +20,18 @@
// any top-level TypeScript code.
"include": [],
"references": [
+ { "path": "./contracts/examples" },
+ { "path": "./contracts/extensions" },
+ { "path": "./contracts/interfaces" },
+ { "path": "./contracts/libs" },
+ { "path": "./contracts/multisig" },
+ { "path": "./contracts/protocol" },
+ { "path": "./contracts/test-utils" },
+ { "path": "./contracts/tokens" },
+ { "path": "./contracts/utils" },
{ "path": "./packages/0x.js" },
- { "path": "./packages/abi-gen" },
{ "path": "./packages/abi-gen-wrappers" },
+ { "path": "./packages/abi-gen" },
{ "path": "./packages/assert" },
{ "path": "./packages/asset-buyer" },
{ "path": "./packages/base-contract" },
@@ -30,7 +39,6 @@
{ "path": "./packages/contract-addresses" },
{ "path": "./packages/contract-artifacts" },
{ "path": "./packages/contract-wrappers" },
- { "path": "./packages/contracts" },
{ "path": "./packages/dev-utils" },
{ "path": "./packages/ethereum-types" },
{ "path": "./packages/fill-scenarios" },
@@ -40,6 +48,7 @@
{ "path": "./packages/monorepo-scripts" },
{ "path": "./packages/order-utils" },
{ "path": "./packages/order-watcher" },
+ { "path": "./packages/pipeline" },
{ "path": "./packages/react-docs" },
{ "path": "./packages/react-shared" },
{ "path": "./packages/sol-compiler" },
@@ -56,5 +65,8 @@
// Skipping website because it requires allowJs: false and this is
// incompatible with project references.
// { "path": "./packages/website" }
+ // Skipping instant because it only produces a UMD bundle
+ // which it uses webpack to create
+ // { "path": "./packages/instant" },
]
}