From 6b03cfd40d720096bf772c2966b1372c0e54bf51 Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 12:05:54 -0700 Subject: Add new react and types --- packages/website/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages') diff --git a/packages/website/package.json b/packages/website/package.json index 57cc4ce4b..d5157850c 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -42,10 +42,10 @@ "numeral": "^2.0.6", "polished": "^1.9.2", "query-string": "^6.0.0", - "react": "15.6.1", + "react": "^16.4.2", "react-copy-to-clipboard": "^4.2.3", "react-document-title": "^2.0.3", - "react-dom": "15.6.1", + "react-dom": "^16.4.2", "react-helmet": "^5.2.0", "react-popper": "^1.0.0-beta.6", "react-redux": "^5.0.3", @@ -73,9 +73,9 @@ "@types/node": "^8.0.53", "@types/numeral": "^0.0.22", "@types/query-string": "^5.1.0", - "@types/react": "16.3.13", + "@types/react": "^16.4.2", "@types/react-copy-to-clipboard": "^4.2.0", - "@types/react-dom": "^16.0.3", + "@types/react-dom": "^16.0.7", "@types/react-helmet": "^5.0.6", "@types/react-redux": "^4.4.37", "@types/react-router-dom": "^4.0.4", -- cgit v1.2.3 From 48ab151ec2aaf09f325d1118277ae0d78135de88 Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 14:20:55 -0700 Subject: Update react and remove tap event plugin [deprecated] --- packages/react-shared/package.json | 4 ++-- packages/website/package.json | 1 - packages/website/ts/index.tsx | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) (limited to 'packages') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 27927bbc8..6f43a9733 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -45,8 +45,8 @@ "is-mobile": "^0.2.2", "lodash": "^4.17.5", "material-ui": "^0.17.1", - "react": "15.6.1", - "react-dom": "15.6.1", + "react": "^16.4.2", + "react-dom": "^16.4.2", "react-highlight": "0xproject/react-highlight", "react-markdown": "^3.2.2", "react-scroll": "0xproject/react-scroll#similar-to-pr-330", diff --git a/packages/website/package.json b/packages/website/package.json index 9eed39572..377ce8bc0 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -51,7 +51,6 @@ "react-redux": "^5.0.3", "react-router-dom": "^4.1.1", "react-scroll": "0xproject/react-scroll#similar-to-pr-330", - "react-tap-event-plugin": "^2.0.1", "react-tooltip": "^3.2.7", "redux": "^3.6.0", "redux-devtools-extension": "^2.13.2", diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index 981c6f2cb..9e59b00ac 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -3,7 +3,6 @@ import * as React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom'; -import * as injectTapEventPlugin from 'react-tap-event-plugin'; import { MetaTags } from 'ts/components/meta_tags'; import { About } from 'ts/containers/about'; import { FAQ } from 'ts/containers/faq'; @@ -17,8 +16,6 @@ import { tradeHistoryStorage } from 'ts/local_storage/trade_history_storage'; import { store } from 'ts/redux/store'; import { WebsiteLegacyPaths, WebsitePaths } from 'ts/types'; import { muiTheme } from 'ts/utils/mui_theme'; -// Polyfills -injectTapEventPlugin(); // Check if we've introduced an update that requires us to clear the tradeHistory local storage entries tradeHistoryStorage.clearIfRequired(); -- cgit v1.2.3 From 374ee2db329aee32e59d487152b2a3b66e25144d Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 15:05:46 -0700 Subject: Upgrade react in react-docs --- packages/react-docs/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 47b266e8e..ecd3d955d 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -46,8 +46,8 @@ "compare-versions": "^3.0.1", "lodash": "^4.17.5", "material-ui": "^0.17.1", - "react": "15.6.1", - "react-dom": "15.6.1", + "react": "^16.4.2", + "react-dom": "^16.4.2", "react-markdown": "^3.2.2", "react-scroll": "0xproject/react-scroll#similar-to-pr-330", "react-tooltip": "^3.2.7", -- cgit v1.2.3 From 65120e84e25f70f014bb195539720aa3dc0f8eec Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 15:11:14 -0700 Subject: Upgrade react-highlight to version that depends on React 16 --- packages/react-shared/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 6f43a9733..b59a6201e 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -47,7 +47,7 @@ "material-ui": "^0.17.1", "react": "^16.4.2", "react-dom": "^16.4.2", - "react-highlight": "0xproject/react-highlight", + "react-highlight": "0xproject/react-highlight#e5201e6a6bf276d3a6bf4828252c886c386d3666", "react-markdown": "^3.2.2", "react-scroll": "0xproject/react-scroll#similar-to-pr-330", "react-tap-event-plugin": "^2.0.1" -- cgit v1.2.3 From ec96c3bb7740d9bb3743946fd4b5c4d31c653dc7 Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 15:15:55 -0700 Subject: Upgrade react-shared used by website to one that depends on react 16 --- packages/website/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/website/package.json b/packages/website/package.json index 377ce8bc0..abad4ab0c 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -21,7 +21,7 @@ "@0xproject/contract-wrappers": "^0.0.5", "@0xproject/order-utils": "^0.0.9", "@0xproject/react-docs": "^1.0.6", - "@0xproject/react-shared": "^0.2.3", + "@0xproject/react-shared": "^1.0.7", "@0xproject/subproviders": "^2.0.0", "@0xproject/types": "^0.8.1", "@0xproject/typescript-typings": "^0.4.3", -- cgit v1.2.3 From 813b2ca1fb767febdd610200bf6e39b90bfc117d Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 15:29:22 -0700 Subject: Bump react-highlight in react-shared once more --- packages/react-shared/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index b59a6201e..6d6c17830 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -47,7 +47,7 @@ "material-ui": "^0.17.1", "react": "^16.4.2", "react-dom": "^16.4.2", - "react-highlight": "0xproject/react-highlight#e5201e6a6bf276d3a6bf4828252c886c386d3666", + "react-highlight": "0xproject/react-highlight#2f40a42e0a3f0ad126f9f42d505b97b603fc7162", "react-markdown": "^3.2.2", "react-scroll": "0xproject/react-scroll#similar-to-pr-330", "react-tap-event-plugin": "^2.0.1" -- cgit v1.2.3 From 641d86cb9833852ef1e1e0fa5b666db0692e30f4 Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 15:40:04 -0700 Subject: Add typescript dependency to typescript-typings (no idea how it was working) --- packages/typescript-typings/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index c047a5328..c02613e28 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -32,7 +32,8 @@ }, "devDependencies": { "copyfiles": "^2.0.0", - "shx": "^0.2.2" + "shx": "^0.2.2", + "typescript": "3.0.1" }, "publishConfig": { "access": "public" -- cgit v1.2.3 From 103e1aa250bc6ce3189aec5ab373f5644c6d4a93 Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 15:45:43 -0700 Subject: Upgrade typescript version used by sra-spec --- packages/sra-spec/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json index 706f9f0aa..35b51432f 100644 --- a/packages/sra-spec/package.json +++ b/packages/sra-spec/package.json @@ -52,7 +52,7 @@ "swagger-cli": "^2.1.1", "ts-node": "^7.0.0", "tslint": "5.11.0", - "typescript": "2.7.1" + "typescript": "3.0.1" }, "publishConfig": { "access": "public" -- cgit v1.2.3 From ad161a973e5453ec267510f54d88621517254039 Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 15:59:14 -0700 Subject: Change all onTouchTap to onClick --- packages/website/ts/components/dialogs/blockchain_err_dialog.tsx | 2 +- packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx | 4 ++-- packages/website/ts/components/dialogs/ledger_config_dialog.tsx | 2 +- packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx | 2 +- packages/website/ts/components/dialogs/send_dialog.tsx | 4 ++-- .../website/ts/components/dialogs/track_token_confirmation_dialog.tsx | 4 ++-- packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx | 2 +- .../ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx | 2 +- packages/website/ts/components/fill_warning_dialog.tsx | 4 ++-- packages/website/ts/components/generate_order/asset_picker.tsx | 4 ++-- packages/website/ts/components/token_balances.tsx | 2 +- packages/website/ts/components/top_bar/top_bar.tsx | 2 +- packages/website/ts/components/ui/lifecycle_raised_button.tsx | 2 +- 13 files changed, 18 insertions(+), 18 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx index c8e10303f..18c060991 100644 --- a/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx +++ b/packages/website/ts/components/dialogs/blockchain_err_dialog.tsx @@ -22,7 +22,7 @@ export class BlockchainErrDialog extends React.Component, ]; diff --git a/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx b/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx index 5f4bf8519..f2cfb279a 100644 --- a/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx +++ b/packages/website/ts/components/dialogs/eth_weth_conversion_dialog.tsx @@ -54,8 +54,8 @@ export class EthWethConversionDialog extends React.Component< } public render(): React.ReactNode { const convertDialogActions = [ - , - , + , + , ]; const title = this.props.direction === Side.Deposit ? 'Wrap ETH' : 'Unwrap WETH'; return !_.isUndefined(this.props.etherBalanceInWei) ? ( diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx index d2f373d67..fbc6c868b 100644 --- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx +++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx @@ -64,7 +64,7 @@ export class LedgerConfigDialog extends React.Component, + , ]; const dialogTitle = this.state.stepIndex === LedgerSteps.CONNECT ? 'Connect to your Ledger' : 'Select desired address'; diff --git a/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx b/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx index 41a17fe96..ef295762b 100644 --- a/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx +++ b/packages/website/ts/components/dialogs/portal_disclaimer_dialog.tsx @@ -13,7 +13,7 @@ export const PortalDisclaimerDialog = (props: PortalDisclaimerDialogProps) => { ]} + actions={[]} open={props.isOpen} onRequestClose={props.onToggleDialog} autoScrollBodyContent={true} diff --git a/packages/website/ts/components/dialogs/send_dialog.tsx b/packages/website/ts/components/dialogs/send_dialog.tsx index c1179dbd0..2754b153f 100644 --- a/packages/website/ts/components/dialogs/send_dialog.tsx +++ b/packages/website/ts/components/dialogs/send_dialog.tsx @@ -38,13 +38,13 @@ export class SendDialog extends React.Component, + , , ]; return ( diff --git a/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx b/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx index 3751ce06f..c8d5af6b6 100644 --- a/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx +++ b/packages/website/ts/components/dialogs/track_token_confirmation_dialog.tsx @@ -43,12 +43,12 @@ export class TrackTokenConfirmationDialog extends React.Component< , , ]} open={this.props.isOpen} diff --git a/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx b/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx index 3ebab03ef..afbb30b82 100644 --- a/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx +++ b/packages/website/ts/components/dialogs/u2f_not_supported_dialog.tsx @@ -14,7 +14,7 @@ export const U2fNotSupportedDialog = (props: U2fNotSupportedDialogProps) => { ]} + actions={[]} open={props.isOpen} onRequestClose={props.onToggleDialog} autoScrollBodyContent={true} 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 index 78b270c1e..cf2c4dda5 100644 --- a/packages/website/ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx +++ b/packages/website/ts/components/dialogs/wrapped_eth_section_notice_dialog.tsx @@ -14,7 +14,7 @@ export const WrappedEthSectionNoticeDialog = (props: WrappedEthSectionNoticeDial title="Dedicated Wrapped Ether Section" titleStyle={{ fontWeight: 100 }} actions={[ - , + , ]} open={props.isOpen} onRequestClose={props.onToggleDialog} diff --git a/packages/website/ts/components/fill_warning_dialog.tsx b/packages/website/ts/components/fill_warning_dialog.tsx index 45c492221..4821aaabe 100644 --- a/packages/website/ts/components/fill_warning_dialog.tsx +++ b/packages/website/ts/components/fill_warning_dialog.tsx @@ -18,12 +18,12 @@ export const FillWarningDialog = (props: FillWarningDialogProps) => { props.onToggleDialog(didCancel)} // tslint:disable-line:jsx-no-lambda + onClick={() => props.onToggleDialog(didCancel)} // tslint:disable-line:jsx-no-lambda />, props.onToggleDialog(!didCancel)} // tslint:disable-line:jsx-no-lambda + onClick={() => props.onToggleDialog(!didCancel)} // tslint:disable-line:jsx-no-lambda />, ]} open={props.isOpen} diff --git a/packages/website/ts/components/generate_order/asset_picker.tsx b/packages/website/ts/components/generate_order/asset_picker.tsx index 2dca3483f..98aad6c62 100644 --- a/packages/website/ts/components/generate_order/asset_picker.tsx +++ b/packages/website/ts/components/generate_order/asset_picker.tsx @@ -73,12 +73,12 @@ export class AssetPicker extends React.Component, , ], }, diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx index 969ef32ff..7e7a8d1fa 100644 --- a/packages/website/ts/components/token_balances.tsx +++ b/packages/website/ts/components/token_balances.tsx @@ -165,7 +165,7 @@ export class TokenBalances extends React.Component, ]; const isTestNetwork = utils.isTestNetwork(this.props.networkId); diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 9ef8211a9..8580c3a6e 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -410,7 +410,7 @@ export class TopBar extends React.Component { {this.props.translate.get(Key.Blog, Deco.Cap)} - + {this.props.translate.get(Key.Faq, Deco.Cap)} diff --git a/packages/website/ts/components/ui/lifecycle_raised_button.tsx b/packages/website/ts/components/ui/lifecycle_raised_button.tsx index 380fbc77d..0bb99b9d8 100644 --- a/packages/website/ts/components/ui/lifecycle_raised_button.tsx +++ b/packages/website/ts/components/ui/lifecycle_raised_button.tsx @@ -71,7 +71,7 @@ export class LifeCycleRaisedButton extends React.Component ); -- cgit v1.2.3 From 91a9014a50cca8e0d42634666fe409839aeae8cf Mon Sep 17 00:00:00 2001 From: fragosti Date: Fri, 24 Aug 2018 16:48:48 -0700 Subject: Simplify dropdown component --- packages/website/ts/components/ui/drop_down.tsx | 40 ++++++++++--------------- 1 file changed, 15 insertions(+), 25 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/components/ui/drop_down.tsx b/packages/website/ts/components/ui/drop_down.tsx index 4d5caef08..752c92e02 100644 --- a/packages/website/ts/components/ui/drop_down.tsx +++ b/packages/website/ts/components/ui/drop_down.tsx @@ -25,6 +25,7 @@ export interface DropDownProps { interface DropDownState { isDropDownOpen: boolean; + isHovering: boolean; anchorEl?: HTMLInputElement; } @@ -35,11 +36,21 @@ export class DropDown extends React.Component { activateEvent: DropdownMouseEvent.Hover, closeEvent: DropdownMouseEvent.Hover, }; - private _isHovering: boolean; private _popoverCloseCheckIntervalId: number; + public static getDerivedStateFromProps(props: DropDownProps, state: DropDownState): Partial { + switch (props.activateEvent) { + case DropdownMouseEvent.Click: + return { isDropDownOpen: state.isDropDownOpen }; + case DropdownMouseEvent.Hover: + return { isDropDownOpen: state.isHovering }; + default: + return {}; + } + } constructor(props: DropDownProps) { super(props); this.state = { + isHovering: false, isDropDownOpen: false, }; } @@ -51,15 +62,6 @@ export class DropDown extends React.Component { public componentWillUnmount(): void { window.clearInterval(this._popoverCloseCheckIntervalId); } - public componentWillReceiveProps(_nextProps: DropDownProps): void { - // HACK: If the popoverContent is updated to a different dimension and the users - // mouse is no longer above it, the dropdown can enter an inconsistent state where - // it believes the user is still hovering over it. In order to remedy this, we - // call hoverOff whenever the dropdown receives updated props. This is a hack - // because it will effectively close the dropdown on any prop update, barring - // dropdowns from having dynamic content. - this._onHoverOff(); - } public render(): React.ReactNode { return (
{ } } private _onHover(event: React.FormEvent): void { - this._isHovering = true; - if (this.props.activateEvent === DropdownMouseEvent.Hover) { - this._checkIfShouldOpenPopover(event); - } + this.setState({ isHovering: true }); } private _onHoverOff(): void { - this._isHovering = false; - } - private _checkIfShouldOpenPopover(event: React.FormEvent): void { - if (this.state.isDropDownOpen) { - return; // noop - } - this.setState({ - isDropDownOpen: true, - anchorEl: event.currentTarget, - }); + this.setState({ isHovering: false }); } private _checkIfShouldClosePopover(): void { if (!this.state.isDropDownOpen) { return; // noop } - if (this.props.closeEvent === DropdownMouseEvent.Hover && !this._isHovering) { + if (this.props.closeEvent === DropdownMouseEvent.Hover && !this.state.isHovering) { this._closePopover(); } } -- cgit v1.2.3 From 260313a6aeab6f64fa274e9aec5c61c6fcaa64e5 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 23 Aug 2018 15:48:15 -0700 Subject: Initial OrderValidator wrapper --- packages/contract-wrappers/package.json | 2 +- packages/contract-wrappers/src/artifacts.ts | 2 + .../contract-wrappers/src/contract_wrappers.ts | 6 ++ .../contract_wrappers/order_validator_wrapper.ts | 72 ++++++++++++++++++++++ packages/contract-wrappers/src/types.ts | 16 +++++ 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts (limited to 'packages') diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index 7d9417d65..a49a81d61 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -14,7 +14,7 @@ "watch_without_deps": "yarn pre_build && tsc -w", "build": "yarn pre_build && tsc", "pre_build": "run-s update_artifacts_v2_beta update_artifacts_v2 generate_contract_wrappers copy_artifacts", - "generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(Exchange|DummyERC20Token|DummyERC721Token|ZRXToken|ERC20Token|ERC721Token|WETH9|ERC20Proxy|ERC721Proxy|Forwarder).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers", + "generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(Exchange|DummyERC20Token|DummyERC721Token|ZRXToken|ERC20Token|ERC721Token|WETH9|ERC20Proxy|ERC721Proxy|Forwarder|OrderValidator).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers", "lint": "tslint --project . --exclude **/src/contract_wrappers/**/* --exclude **/lib/**/*", "test:circleci": "run-s test:coverage", "test": "yarn run_mocha", diff --git a/packages/contract-wrappers/src/artifacts.ts b/packages/contract-wrappers/src/artifacts.ts index 7e67544d2..925f34162 100644 --- a/packages/contract-wrappers/src/artifacts.ts +++ b/packages/contract-wrappers/src/artifacts.ts @@ -8,6 +8,7 @@ import * as ERC721Proxy from './artifacts/ERC721Proxy.json'; import * as ERC721Token from './artifacts/ERC721Token.json'; import * as Exchange from './artifacts/Exchange.json'; import * as Forwarder from './artifacts/Forwarder.json'; +import * as OrderValidator from './artifacts/OrderValidator.json'; import * as EtherToken from './artifacts/WETH9.json'; import * as ZRXToken from './artifacts/ZRXToken.json'; @@ -22,4 +23,5 @@ export const artifacts = { ERC20Proxy: (ERC20Proxy as any) as ContractArtifact, ERC721Proxy: (ERC721Proxy as any) as ContractArtifact, Forwarder: (Forwarder as any) as ContractArtifact, + OrderValidator: (OrderValidator as any) as ContractArtifact, }; diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index 4277a0746..8ca0fc93c 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -12,6 +12,7 @@ import { ERC721TokenWrapper } from './contract_wrappers/erc721_token_wrapper'; import { EtherTokenWrapper } from './contract_wrappers/ether_token_wrapper'; import { ExchangeWrapper } from './contract_wrappers/exchange_wrapper'; import { ForwarderWrapper } from './contract_wrappers/forwarder_wrapper'; +import { OrderValidatorWrapper } from './contract_wrappers/order_validator_wrapper'; import { ContractWrappersConfigSchema } from './schemas/contract_wrappers_config_schema'; import { contractWrappersPrivateNetworkConfigSchema } from './schemas/contract_wrappers_private_network_config_schema'; import { contractWrappersPublicNetworkConfigSchema } from './schemas/contract_wrappers_public_network_config_schema'; @@ -52,6 +53,10 @@ export class ContractWrappers { * An instance of the ForwarderWrapper class containing methods for interacting with any Forwarder smart contract. */ public forwarder: ForwarderWrapper; + /** + * An instance of the OrderValidatorWrapper class containing methods for interacting with any OrderValidator smart contract. + */ + public orderValidator: OrderValidatorWrapper; private _web3Wrapper: Web3Wrapper; /** @@ -116,6 +121,7 @@ export class ContractWrappers { config.forwarderContractAddress, config.zrxContractAddress, ); + this.orderValidator = new OrderValidatorWrapper(this._web3Wrapper, config.networkId); } /** * Sets a new web3 provider for 0x.js. Updating the provider will stop all diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts new file mode 100644 index 000000000..6857dcd69 --- /dev/null +++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts @@ -0,0 +1,72 @@ +import { schemas } from '@0xproject/json-schemas'; +import { SignedOrder } from '@0xproject/types'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import { ContractAbi } from 'ethereum-types'; +import * as _ from 'lodash'; + +import { artifacts } from '../artifacts'; +import { OrdersAndTradersInfo } from '../types'; +import { assert } from '../utils/assert'; + +import { ContractWrapper } from './contract_wrapper'; +import { OrderValidatorContract } from './generated/order_validator'; + +/** + * This class includes the functionality related to interacting with the OrderValidator contract. + */ +export class OrderValidatorWrapper extends ContractWrapper { + public abi: ContractAbi = artifacts.OrderValidator.compilerOutput.abi; + private _orderValidatorContractIfExists?: OrderValidatorContract; + /** + * Instantiate OrderValidatorWrapper + * @param web3Wrapper Web3Wrapper instance to use + * @param networkId Desired networkId + */ + constructor(web3Wrapper: Web3Wrapper, networkId: number) { + super(web3Wrapper, networkId); + } + /** + * Get and object conforming to OrdersAndTradersInfo containing on-chain information of the provided orders and addresses + * @return OrdersAndTradersInfo + */ + public async getOrdersAndTradersInfoAsync( + orders: SignedOrder[], + takerAddresses: string[], + ): Promise { + assert.doesConformToSchema('orders', orders, schemas.signedOrdersSchema); + _.forEach(takerAddresses, (takerAddress, index) => + assert.isETHAddressHex(`takerAddresses[${index}]`, takerAddress), + ); + assert.assert(orders.length === takerAddresses.length, 'Expected orders.length to equal takerAddresses.length'); + const OrderValidatorContractInstance = await this._getOrderValidatorContractAsync(); + const ordersAndTradersInfo = await OrderValidatorContractInstance.getOrdersAndTradersInfo.callAsync( + orders, + takerAddresses, + ); + const result = { + ordersInfo: ordersAndTradersInfo[0], + tradersInfo: ordersAndTradersInfo[1], + }; + return result; + } + // HACK: We don't want this method to be visible to the other units within that package but not to the end user. + // TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused. + // tslint:disable-next-line:no-unused-variable + private _invalidateContractInstance(): void { + delete this._orderValidatorContractIfExists; + } + private async _getOrderValidatorContractAsync(): Promise { + if (!_.isUndefined(this._orderValidatorContractIfExists)) { + return this._orderValidatorContractIfExists; + } + const [abi, address] = await this._getContractAbiAndAddressFromArtifactsAsync(artifacts.OrderValidator); + const contractInstance = new OrderValidatorContract( + abi, + address, + this._web3Wrapper.getProvider(), + this._web3Wrapper.getContractDefaults(), + ); + this._orderValidatorContractIfExists = contractInstance; + return this._orderValidatorContractIfExists; + } +} diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index 2b3cdc591..efc102a33 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -188,3 +188,19 @@ export enum OrderStatus { FULLY_FILLED, CANCELLED, } + +export interface TraderInfo { + makerBalance: BigNumber; + makerAllowance: BigNumber; + takerBalance: BigNumber; + takerAllowance: BigNumber; + makerZrxBalance: BigNumber; + makerZrxAllowance: BigNumber; + takerZrxBalance: BigNumber; + takerZrxAllowance: BigNumber; +} + +export interface OrdersAndTradersInfo { + ordersInfo: OrderInfo[]; + tradersInfo: TraderInfo[]; +} -- cgit v1.2.3 From 898bd75a18f24742aca2ac6beef4208b8f91f98b Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 23 Aug 2018 19:05:03 -0700 Subject: Remove some unused variables in forwarder wrapper test --- packages/contract-wrappers/test/forwarder_wrapper_test.ts | 3 --- 1 file changed, 3 deletions(-) (limited to 'packages') diff --git a/packages/contract-wrappers/test/forwarder_wrapper_test.ts b/packages/contract-wrappers/test/forwarder_wrapper_test.ts index d0b21225c..a969807b2 100644 --- a/packages/contract-wrappers/test/forwarder_wrapper_test.ts +++ b/packages/contract-wrappers/test/forwarder_wrapper_test.ts @@ -25,10 +25,8 @@ describe('ForwarderWrapper', () => { blockPollingIntervalMs: 0, }; const fillableAmount = new BigNumber(5); - const takerTokenFillAmount = new BigNumber(5); let contractWrappers: ContractWrappers; let fillScenarios: FillScenarios; - let forwarderContractAddress: string; let exchangeContractAddress: string; let zrxTokenAddress: string; let userAddresses: string[]; @@ -46,7 +44,6 @@ describe('ForwarderWrapper', () => { before(async () => { await blockchainLifecycle.startAsync(); contractWrappers = new ContractWrappers(provider, contractWrappersConfig); - forwarderContractAddress = contractWrappers.forwarder.getContractAddress(); exchangeContractAddress = contractWrappers.exchange.getContractAddress(); userAddresses = await web3Wrapper.getAvailableAddressesAsync(); zrxTokenAddress = tokenUtils.getProtocolTokenAddress(); -- cgit v1.2.3 From 0736c413572e6e55dcc7866a03b8da2eb46a406f Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 23 Aug 2018 19:05:05 -0700 Subject: Add test for order validator --- .../test/order_validator_wrapper_test.ts | 141 +++++++++++++++++++++ packages/contract-wrappers/test/utils/constants.ts | 1 + 2 files changed, 142 insertions(+) create mode 100644 packages/contract-wrappers/test/order_validator_wrapper_test.ts (limited to 'packages') diff --git a/packages/contract-wrappers/test/order_validator_wrapper_test.ts b/packages/contract-wrappers/test/order_validator_wrapper_test.ts new file mode 100644 index 000000000..0226adec7 --- /dev/null +++ b/packages/contract-wrappers/test/order_validator_wrapper_test.ts @@ -0,0 +1,141 @@ +import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; +import { FillScenarios } from '@0xproject/fill-scenarios'; +import { assetDataUtils, orderHashUtils } from '@0xproject/order-utils'; +import { DoneCallback, SignedOrder } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; +import * as chai from 'chai'; +import { BlockParamLiteral } from 'ethereum-types'; +import 'mocha'; + +import { ContractWrappers, ExchangeCancelEventArgs, ExchangeEvents, ExchangeFillEventArgs, OrderStatus } from '../src'; +import { DecodedLogEvent, OrderInfo, TraderInfo } from '../src/types'; + +import { chaiSetup } from './utils/chai_setup'; +import { constants } from './utils/constants'; +import { tokenUtils } from './utils/token_utils'; +import { provider, web3Wrapper } from './utils/web3_wrapper'; + +chaiSetup.configure(); +const expect = chai.expect; +const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); + +describe('OrderValidator', () => { + const contractWrappersConfig = { + networkId: constants.TESTRPC_NETWORK_ID, + blockPollingIntervalMs: 0, + }; + const fillableAmount = new BigNumber(5); + const partialFillAmount = new BigNumber(2); + let contractWrappers: ContractWrappers; + let fillScenarios: FillScenarios; + let exchangeContractAddress: string; + let zrxTokenAddress: string; + let zrxTokenAssetData: string; + let userAddresses: string[]; + let coinbase: string; + let makerAddress: string; + let takerAddress: string; + let feeRecipient: string; + let anotherMakerAddress: string; + let makerTokenAddress: string; + let takerTokenAddress: string; + let makerAssetData: string; + let takerAssetData: string; + let signedOrder: SignedOrder; + let anotherSignedOrder: SignedOrder; + before(async () => { + await blockchainLifecycle.startAsync(); + contractWrappers = new ContractWrappers(provider, contractWrappersConfig); + exchangeContractAddress = contractWrappers.exchange.getContractAddress(); + userAddresses = await web3Wrapper.getAvailableAddressesAsync(); + zrxTokenAddress = tokenUtils.getProtocolTokenAddress(); + zrxTokenAssetData = assetDataUtils.encodeERC20AssetData(zrxTokenAddress); + fillScenarios = new FillScenarios( + provider, + userAddresses, + zrxTokenAddress, + exchangeContractAddress, + contractWrappers.erc20Proxy.getContractAddress(), + contractWrappers.erc721Proxy.getContractAddress(), + ); + [coinbase, makerAddress, takerAddress, feeRecipient, anotherMakerAddress] = userAddresses; + [makerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses(); + takerTokenAddress = tokenUtils.getWethTokenAddress(); + [makerAssetData, takerAssetData] = [ + assetDataUtils.encodeERC20AssetData(makerTokenAddress), + assetDataUtils.encodeERC20AssetData(takerTokenAddress), + ]; + + signedOrder = await fillScenarios.createFillableSignedOrderAsync( + makerAssetData, + takerAssetData, + makerAddress, + constants.NULL_ADDRESS, + fillableAmount, + ); + anotherSignedOrder = await fillScenarios.createFillableSignedOrderAsync( + zrxTokenAssetData, + takerAssetData, + makerAddress, + constants.NULL_ADDRESS, + fillableAmount, + ); + }); + after(async () => { + await blockchainLifecycle.revertAsync(); + }); + beforeEach(async () => { + await blockchainLifecycle.startAsync(); + }); + afterEach(async () => { + await blockchainLifecycle.revertAsync(); + }); + describe('#getOrdersAndTradersInfoAsync', () => { + let signedOrders: SignedOrder[]; + let takerAddresses: string[]; + let ordersInfo: OrderInfo[]; + let tradersInfo: TraderInfo[]; + beforeEach(async () => { + signedOrders = [signedOrder, anotherSignedOrder]; + takerAddresses = [takerAddress, takerAddress]; + const ordersAndTradersInfo = await contractWrappers.orderValidator.getOrdersAndTradersInfoAsync( + signedOrders, + takerAddresses, + ); + ordersInfo = ordersAndTradersInfo.ordersInfo; + tradersInfo = ordersAndTradersInfo.tradersInfo; + }); + it('should return the same number of order infos and trader infos as input orders', async () => { + expect(ordersInfo.length).to.be.equal(signedOrders.length); + expect(tradersInfo.length).to.be.equal(takerAddresses.length); + }); + it('should return correct on-chain order info for input orders', async () => { + const firstOrderInfo = ordersInfo[0]; + const secondOrderInfo = ordersInfo[1]; + expect(firstOrderInfo.orderStatus).to.be.equal(OrderStatus.FILLABLE); + expect(firstOrderInfo.orderTakerAssetFilledAmount).to.bignumber.equal(constants.ZERO_AMOUNT); + expect(secondOrderInfo.orderStatus).to.be.equal(OrderStatus.FILLABLE); + expect(secondOrderInfo.orderTakerAssetFilledAmount).to.bignumber.equal(constants.ZERO_AMOUNT); + }); + it('should return correct on-chain trader info for input takers', async () => { + const firstTraderInfo = tradersInfo[0]; + const secondTraderInfo = tradersInfo[1]; + expect(firstTraderInfo.makerBalance).to.bignumber.equal(new BigNumber(5)); + expect(firstTraderInfo.makerAllowance).to.bignumber.equal(new BigNumber(5)); + expect(firstTraderInfo.takerBalance).to.bignumber.equal(new BigNumber(0)); + expect(firstTraderInfo.takerAllowance).to.bignumber.equal(new BigNumber(0)); + expect(firstTraderInfo.makerZrxBalance).to.bignumber.equal(new BigNumber(5)); + expect(firstTraderInfo.makerZrxAllowance).to.bignumber.equal(new BigNumber(5)); + expect(firstTraderInfo.takerZrxBalance).to.bignumber.equal(new BigNumber(0)); + expect(firstTraderInfo.takerZrxAllowance).to.bignumber.equal(new BigNumber(0)); + expect(secondTraderInfo.makerBalance).to.bignumber.equal(new BigNumber(5)); + expect(secondTraderInfo.makerAllowance).to.bignumber.equal(new BigNumber(5)); + expect(secondTraderInfo.takerBalance).to.bignumber.equal(new BigNumber(0)); + expect(secondTraderInfo.takerAllowance).to.bignumber.equal(new BigNumber(0)); + expect(secondTraderInfo.makerZrxBalance).to.bignumber.equal(new BigNumber(5)); + expect(secondTraderInfo.makerZrxAllowance).to.bignumber.equal(new BigNumber(5)); + expect(secondTraderInfo.takerZrxBalance).to.bignumber.equal(new BigNumber(0)); + expect(secondTraderInfo.takerZrxAllowance).to.bignumber.equal(new BigNumber(0)); + }); + }); +}); diff --git a/packages/contract-wrappers/test/utils/constants.ts b/packages/contract-wrappers/test/utils/constants.ts index 60c3370a2..f38728b77 100644 --- a/packages/contract-wrappers/test/utils/constants.ts +++ b/packages/contract-wrappers/test/utils/constants.ts @@ -15,4 +15,5 @@ export const constants = { DUMMY_TOKEN_TOTAL_SUPPLY: new BigNumber(10 ** 27), // tslint:disable-line:custom-no-magic-numbers NUM_DUMMY_ERC20_TO_DEPLOY: 3, NUM_DUMMY_ERC721_TO_DEPLOY: 1, + ZERO_AMOUNT: new BigNumber(0), }; -- cgit v1.2.3 From d6c670dfcb1bd74f675a9a1cf3b86cfcf6cd85df Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 10:28:07 -0700 Subject: Add getOrderAndTraderInfoAsync to wrapper --- .../contract_wrappers/order_validator_wrapper.ts | 22 ++++++++++++++++++++-- packages/contract-wrappers/src/types.ts | 4 ++++ 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts index 6857dcd69..1e06d191c 100644 --- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts @@ -5,7 +5,7 @@ import { ContractAbi } from 'ethereum-types'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { OrdersAndTradersInfo } from '../types'; +import { OrderAndTraderInfo, OrdersAndTradersInfo } from '../types'; import { assert } from '../utils/assert'; import { ContractWrapper } from './contract_wrapper'; @@ -26,7 +26,25 @@ export class OrderValidatorWrapper extends ContractWrapper { super(web3Wrapper, networkId); } /** - * Get and object conforming to OrdersAndTradersInfo containing on-chain information of the provided orders and addresses + * Get and object conforming to OrderAndTraderInfo containing on-chain information of the provided order and address + * @return OrderAndTraderInfo + */ + public async getOrderAndTraderInfoAsync(order: SignedOrder, takerAddress: string): Promise { + assert.doesConformToSchema('order', order, schemas.signedOrderSchema); + assert.isETHAddressHex('takerAddress', takerAddress); + const OrderValidatorContractInstance = await this._getOrderValidatorContractAsync(); + const orderAndTraderInfo = await OrderValidatorContractInstance.getOrderAndTraderInfo.callAsync( + order, + takerAddress, + ); + const result = { + orderInfo: orderAndTraderInfo[0], + traderInfo: orderAndTraderInfo[1], + }; + return result; + } + /** + * Get an object conforming to OrdersAndTradersInfo containing on-chain information of the provided orders and addresses * @return OrdersAndTradersInfo */ public async getOrdersAndTradersInfoAsync( diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index efc102a33..e73a09fe3 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -204,3 +204,7 @@ export interface OrdersAndTradersInfo { ordersInfo: OrderInfo[]; tradersInfo: TraderInfo[]; } +export interface OrderAndTraderInfo { + orderInfo: OrderInfo; + traderInfo: TraderInfo; +} -- cgit v1.2.3 From 68f2dc11b4361af125f9f2ab367d758f673928ea Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 10:54:50 -0700 Subject: Add getTraderInfo and getTradersInfo to wrapper --- .../contract_wrappers/order_validator_wrapper.ts | 29 ++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts index 1e06d191c..dac243434 100644 --- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts @@ -5,7 +5,7 @@ import { ContractAbi } from 'ethereum-types'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { OrderAndTraderInfo, OrdersAndTradersInfo } from '../types'; +import { OrderAndTraderInfo, OrdersAndTradersInfo, TraderInfo } from '../types'; import { assert } from '../utils/assert'; import { ContractWrapper } from './contract_wrapper'; @@ -26,7 +26,7 @@ export class OrderValidatorWrapper extends ContractWrapper { super(web3Wrapper, networkId); } /** - * Get and object conforming to OrderAndTraderInfo containing on-chain information of the provided order and address + * Get an object conforming to OrderAndTraderInfo containing on-chain information of the provided order and address * @return OrderAndTraderInfo */ public async getOrderAndTraderInfoAsync(order: SignedOrder, takerAddress: string): Promise { @@ -67,6 +67,31 @@ export class OrderValidatorWrapper extends ContractWrapper { }; return result; } + /** + * Get an object conforming to TraderInfo containing on-chain balance and allowances for maker and taker of order + * @return TraderInfo + */ + public async getTraderInfoAsync(order: SignedOrder, takerAddress: string): Promise { + assert.doesConformToSchema('order', order, schemas.signedOrderSchema); + assert.isETHAddressHex('takerAddress', takerAddress); + const OrderValidatorContractInstance = await this._getOrderValidatorContractAsync(); + const result = await OrderValidatorContractInstance.getTraderInfo.callAsync(order, takerAddress); + return result; + } + /** + * Get an array of objects conforming to TraderInfo containing on-chain balance and allowances for maker and taker of order + * @return array of TraderInfo + */ + public async getTradersInfoAsync(orders: SignedOrder[], takerAddresses: string[]): Promise { + assert.doesConformToSchema('orders', orders, schemas.signedOrdersSchema); + _.forEach(takerAddresses, (takerAddress, index) => + assert.isETHAddressHex(`takerAddresses[${index}]`, takerAddress), + ); + assert.assert(orders.length === takerAddresses.length, 'Expected orders.length to equal takerAddresses.length'); + const OrderValidatorContractInstance = await this._getOrderValidatorContractAsync(); + const result = await OrderValidatorContractInstance.getTradersInfo.callAsync(orders, takerAddresses); + return result; + } // HACK: We don't want this method to be visible to the other units within that package but not to the end user. // TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused. // tslint:disable-next-line:no-unused-variable -- cgit v1.2.3 From be2f4cbdcafa19cc8433ff2dc2f0ff6befd64578 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 11:01:53 -0700 Subject: Add getBalanceAndAllowance to wrapper --- .../src/contract_wrappers/order_validator_wrapper.ts | 20 +++++++++++++++++++- packages/contract-wrappers/src/types.ts | 6 ++++++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts index dac243434..3b83fc53b 100644 --- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts @@ -5,7 +5,7 @@ import { ContractAbi } from 'ethereum-types'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { OrderAndTraderInfo, OrdersAndTradersInfo, TraderInfo } from '../types'; +import { BalanceAndAllowance, OrderAndTraderInfo, OrdersAndTradersInfo, TraderInfo } from '../types'; import { assert } from '../utils/assert'; import { ContractWrapper } from './contract_wrapper'; @@ -92,6 +92,24 @@ export class OrderValidatorWrapper extends ContractWrapper { const result = await OrderValidatorContractInstance.getTradersInfo.callAsync(orders, takerAddresses); return result; } + /** + * Get an object conforming to BalanceAndAllowance containing on-chain balance and allowance for some address and assetData + * @return BalanceAndAllowance + */ + public async getBalanceAndAllowanceAsync(address: string, assetData: string): Promise { + assert.isETHAddressHex('address', address); + assert.isHexString('assetData', assetData); + const OrderValidatorContractInstance = await this._getOrderValidatorContractAsync(); + const balanceAndAllowance = await OrderValidatorContractInstance.getBalanceAndAllowance.callAsync( + address, + assetData, + ); + const result = { + balance: balanceAndAllowance[0], + allowance: balanceAndAllowance[1], + }; + return result; + } // HACK: We don't want this method to be visible to the other units within that package but not to the end user. // TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused. // tslint:disable-next-line:no-unused-variable diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index e73a09fe3..c51e0ae48 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -204,7 +204,13 @@ export interface OrdersAndTradersInfo { ordersInfo: OrderInfo[]; tradersInfo: TraderInfo[]; } + export interface OrderAndTraderInfo { orderInfo: OrderInfo; traderInfo: TraderInfo; } + +export interface BalanceAndAllowance { + balance: BigNumber; + allowance: BigNumber; +} -- cgit v1.2.3 From f7469080f929d2364b1621e92857c76cb008bec9 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 12:59:53 -0700 Subject: Update getOrdersAndTradersInfo to return an array instead --- .../src/contract_wrappers/order_validator_wrapper.ts | 19 ++++++++++++------- packages/contract-wrappers/src/types.ts | 5 ----- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'packages') diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts index 3b83fc53b..854a93bbf 100644 --- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts @@ -44,13 +44,13 @@ export class OrderValidatorWrapper extends ContractWrapper { return result; } /** - * Get an object conforming to OrdersAndTradersInfo containing on-chain information of the provided orders and addresses - * @return OrdersAndTradersInfo + * Get an array of objects conforming to OrderAndTraderInfo containing on-chain information of the provided orders and addresses + * @return array of OrderAndTraderInfo */ public async getOrdersAndTradersInfoAsync( orders: SignedOrder[], takerAddresses: string[], - ): Promise { + ): Promise { assert.doesConformToSchema('orders', orders, schemas.signedOrdersSchema); _.forEach(takerAddresses, (takerAddress, index) => assert.isETHAddressHex(`takerAddresses[${index}]`, takerAddress), @@ -61,10 +61,15 @@ export class OrderValidatorWrapper extends ContractWrapper { orders, takerAddresses, ); - const result = { - ordersInfo: ordersAndTradersInfo[0], - tradersInfo: ordersAndTradersInfo[1], - }; + const orderInfos = ordersAndTradersInfo[0]; + const traderInfos = ordersAndTradersInfo[1]; + const result = _.map(orderInfos, (orderInfo, index) => { + const traderInfo = traderInfos[index]; + return { + orderInfo, + traderInfo, + }; + }); return result; } /** diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index c51e0ae48..e0b12b7c9 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -200,11 +200,6 @@ export interface TraderInfo { takerZrxAllowance: BigNumber; } -export interface OrdersAndTradersInfo { - ordersInfo: OrderInfo[]; - tradersInfo: TraderInfo[]; -} - export interface OrderAndTraderInfo { orderInfo: OrderInfo; traderInfo: TraderInfo; -- cgit v1.2.3 From b0f210dea9b89fddb877dcdb0fd21a5ec08cc0d5 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 13:02:49 -0700 Subject: Add getERC721Owner to wrapper --- .../src/contract_wrappers/order_validator_wrapper.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts index 854a93bbf..a1e02989d 100644 --- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts @@ -1,11 +1,12 @@ import { schemas } from '@0xproject/json-schemas'; import { SignedOrder } from '@0xproject/types'; +import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import { ContractAbi } from 'ethereum-types'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; -import { BalanceAndAllowance, OrderAndTraderInfo, OrdersAndTradersInfo, TraderInfo } from '../types'; +import { BalanceAndAllowance, OrderAndTraderInfo, TraderInfo } from '../types'; import { assert } from '../utils/assert'; import { ContractWrapper } from './contract_wrapper'; @@ -115,6 +116,17 @@ export class OrderValidatorWrapper extends ContractWrapper { }; return result; } + /** + * Get owner address of tokenId by calling `token.ownerOf(tokenId)`, but returns a null owner instead of reverting on an unowned token. + * @return Owner of tokenId or null address if unowned + */ + public async getERC721TokenOwnerAsync(tokenAddress: string, tokenId: BigNumber): Promise { + assert.isETHAddressHex('tokenAddress', tokenAddress); + assert.isBigNumber('tokenId', tokenId); + const OrderValidatorContractInstance = await this._getOrderValidatorContractAsync(); + const result = await OrderValidatorContractInstance.getERC721TokenOwner.callAsync(tokenAddress, tokenId); + return result; + } // HACK: We don't want this method to be visible to the other units within that package but not to the end user. // TS doesn't give that possibility and therefore we make it private and access it over an any cast. Because of that tslint sees it as unused. // tslint:disable-next-line:no-unused-variable -- cgit v1.2.3 From 38e6d26145d771165263d676ea62d0514191bbe7 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 13:31:12 -0700 Subject: Add params to all function comments --- .../src/contract_wrappers/order_validator_wrapper.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'packages') diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts index a1e02989d..b33428306 100644 --- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts @@ -28,6 +28,8 @@ export class OrderValidatorWrapper extends ContractWrapper { } /** * Get an object conforming to OrderAndTraderInfo containing on-chain information of the provided order and address + * @param order An object conforming to SignedOrder + * @param takerAddress An ethereum address * @return OrderAndTraderInfo */ public async getOrderAndTraderInfoAsync(order: SignedOrder, takerAddress: string): Promise { @@ -46,6 +48,8 @@ export class OrderValidatorWrapper extends ContractWrapper { } /** * Get an array of objects conforming to OrderAndTraderInfo containing on-chain information of the provided orders and addresses + * @param orders An array of objects conforming to SignedOrder + * @param takerAddresses An array of ethereum addresses * @return array of OrderAndTraderInfo */ public async getOrdersAndTradersInfoAsync( @@ -75,6 +79,8 @@ export class OrderValidatorWrapper extends ContractWrapper { } /** * Get an object conforming to TraderInfo containing on-chain balance and allowances for maker and taker of order + * @param order An object conforming to SignedOrder + * @param takerAddress An ethereum address * @return TraderInfo */ public async getTraderInfoAsync(order: SignedOrder, takerAddress: string): Promise { @@ -86,6 +92,8 @@ export class OrderValidatorWrapper extends ContractWrapper { } /** * Get an array of objects conforming to TraderInfo containing on-chain balance and allowances for maker and taker of order + * @param orders An array of objects conforming to SignedOrder + * @param takerAddresses An array of ethereum addresses * @return array of TraderInfo */ public async getTradersInfoAsync(orders: SignedOrder[], takerAddresses: string[]): Promise { @@ -100,6 +108,8 @@ export class OrderValidatorWrapper extends ContractWrapper { } /** * Get an object conforming to BalanceAndAllowance containing on-chain balance and allowance for some address and assetData + * @param address An ethereum address + * @param assetData An encoded string that can be decoded by a specified proxy contract * @return BalanceAndAllowance */ public async getBalanceAndAllowanceAsync(address: string, assetData: string): Promise { @@ -118,6 +128,8 @@ export class OrderValidatorWrapper extends ContractWrapper { } /** * Get owner address of tokenId by calling `token.ownerOf(tokenId)`, but returns a null owner instead of reverting on an unowned token. + * @param tokenAddress An ethereum address + * @param tokenId An ERC721 tokenId * @return Owner of tokenId or null address if unowned */ public async getERC721TokenOwnerAsync(tokenAddress: string, tokenId: BigNumber): Promise { -- cgit v1.2.3 From 6c039bbeb1fb0a3120a215b2f52e0259bde2553d Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 13:43:19 -0700 Subject: Update OrderValidator artifact to include getBalancesAndAllowances function --- .../2.0.0-beta-testnet/OrderValidator.json | 175 +++++++++++++-------- 1 file changed, 113 insertions(+), 62 deletions(-) (limited to 'packages') diff --git a/packages/migrations/artifacts/2.0.0-beta-testnet/OrderValidator.json b/packages/migrations/artifacts/2.0.0-beta-testnet/OrderValidator.json index 99805c766..add00d3ce 100644 --- a/packages/migrations/artifacts/2.0.0-beta-testnet/OrderValidator.json +++ b/packages/migrations/artifacts/2.0.0-beta-testnet/OrderValidator.json @@ -410,6 +410,33 @@ "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": [ @@ -536,15 +563,15 @@ "evm": { "bytecode": { "linkReferences": {}, - "object": "0x60806040523480156200001157600080fd5b5060405162001b0d38038062001b0d833981018060405262000037919081019062000186565b60008054600160a060020a031916600160a060020a03841617905580516200006790600190602084019062000070565b5050506200026b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000b357805160ff1916838001178555620000e3565b82800160010185558215620000e3579182015b82811115620000e3578251825591602001919060010190620000c6565b50620000f1929150620000f5565b5090565b6200011291905b80821115620000f15760008155600101620000fc565b90565b60006200012382516200022c565b9392505050565b6000601f820183136200013c57600080fd5b8151620001536200014d8262000204565b620001dd565b915080825260208301602083018583830111156200017057600080fd5b6200017d83828462000238565b50505092915050565b600080604083850312156200019a57600080fd5b6000620001a8858562000115565b92505060208301516001604060020a03811115620001c557600080fd5b620001d3858286016200012a565b9150509250929050565b6040518181016001604060020a0381118282101715620001fc57600080fd5b604052919050565b60006001604060020a038211156200021b57600080fd5b506020601f91909101601f19160190565b600160a060020a031690565b60005b83811015620002555781810151838201526020016200023b565b8381111562000265576000848401525b50505050565b611892806200027b6000396000f3006080604052600436106100775763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304ad1e53811461007c5780632cd0fc73146100b35780634b95de13146100e1578063690d31141461010f578063b69884631461013c578063f241ffb014610169575b600080fd5b34801561008857600080fd5b5061009c610097366004611118565b610196565b6040516100aa9291906116af565b60405180910390f35b3480156100bf57600080fd5b506100d36100ce366004610fc6565b610263565b6040516100aa9291906116f9565b3480156100ed57600080fd5b506101016100fc36600461107d565b610794565b6040516100aa92919061161a565b34801561011b57600080fd5b5061012f61012a36600461107d565b61086b565b6040516100aa9190611650565b34801561014857600080fd5b5061015c610157366004611018565b610925565b6040516100aa91906115f1565b34801561017557600080fd5b50610189610184366004611118565b610970565b6040516100aa91906116dc565b61019e610bba565b6101a6610bda565b6000546040517fc75e0a8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063c75e0a81906101fc9087906004016116cb565b606060405180830381600087803b15801561021657600080fd5b505af115801561022a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061024e91908101906110fa565b915061025a8484610970565b90509250929050565b60008080808080808061027c898263ffffffff610a8e16565b955061028f89601063ffffffff610afb16565b6000546040517f6070410800000000000000000000000000000000000000000000000000000000815291965073ffffffffffffffffffffffffffffffffffffffff16906360704108906102e6908990600401611661565b602060405180830381600087803b15801561030057600080fd5b505af1158015610314573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103389190810190610fa0565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190209094507fffffffff00000000000000000000000000000000000000000000000000000000878116911614156104ed576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616906370a08231906103eb908d906004016115f1565b602060405180830381600087803b15801561040557600080fd5b505af1158015610419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061043d919081019061115f565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815290985073ffffffffffffffffffffffffffffffffffffffff86169063dd62ed3e90610494908d9088906004016115ff565b602060405180830381600087803b1580156104ae57600080fd5b505af11580156104c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104e6919081019061115f565b9650610787565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190207fffffffff000000000000000000000000000000000000000000000000000000008781169116141561074c5761055c89602463ffffffff610b5c16565b92506105688584610925565b91508173ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16146105a45760006105a7565b60015b60ff1697508473ffffffffffffffffffffffffffffffffffffffff1663e985e9c58b866040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016106039291906115ff565b602060405180830381600087803b15801561061d57600080fd5b505af1158015610631573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061065591908101906110dc565b8061073157508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1663081812fc856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016106c791906116eb565b602060405180830381600087803b1580156106e157600080fd5b505af11580156106f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107199190810190610fa0565b73ffffffffffffffffffffffffffffffffffffffff16145b90508061073f576000610742565b60015b60ff169650610787565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077e9061167f565b60405180910390fd5b5050505050509250929050565b6000546040517f7e9d74dc000000000000000000000000000000000000000000000000000000008152606091829173ffffffffffffffffffffffffffffffffffffffff90911690637e9d74dc906107ef90879060040161163f565b600060405180830381600087803b15801561080957600080fd5b505af115801561081d573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526108639190810190611048565b915061025a84845b606060006060600085519250826040519080825280602002602001820160405280156108b157816020015b61089e610bda565b8152602001906001900390816108965790505b509150600090505b808314610918576108f886828151811015156108d157fe5b9060200190602002015186838151811015156108e957fe5b90602001906020020151610970565b828281518110151561090657fe5b602090810290910101526001016108b9565b8193505b50505092915050565b60006040517f6352211e000000000000000000000000000000000000000000000000000000008152826004820152602081602483875afa801561096757815192505b50505b92915050565b610978610bda565b606061098d8460000151856101400151610263565b602084015282526101608401516109a5908490610263565b60608401526040808401919091526001805482516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008688161502019094169390930492830181900481028201810190945281815292830182828015610a545780601f10610a2957610100808354040283529160200191610a54565b820191906000526020600020905b815481529060010190602001808311610a3757829003601f168201915b50505050509050610a69846000015182610263565b60a08401526080830152610a7d8382610263565b60e084015260c08301525092915050565b600081600401835110151515610ad0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077e9061169f565b5050602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b600081601401835110151515610b3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077e9061168f565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000610b688383610b6f565b9392505050565b600081602001835110151515610bb1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077e9061166f565b50016020015190565b604080516060810182526000808252602082018190529181019190915290565b6101006040519081016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000610b6882356117ac565b6000610b6882516117ac565b6000601f82018313610c4957600080fd5b8135610c5c610c578261173b565b611714565b91508181835260208401935060208101905083856020840282011115610c8157600080fd5b60005b83811015610cad5781610c978882610c20565b8452506020928301929190910190600101610c84565b5050505092915050565b6000601f82018313610cc857600080fd5b8151610cd6610c578261173b565b91508181835260208401935060208101905083856060840282011115610cfb57600080fd5b60005b83811015610cad5781610d118882610de4565b84525060209092019160609190910190600101610cfe565b6000601f82018313610d3a57600080fd5b8135610d48610c578261173b565b81815260209384019390925082018360005b83811015610cad5781358601610d708882610e3f565b8452506020928301929190910190600101610d5a565b6000610b6882516117f3565b6000610b6882516117c5565b6000601f82018313610daf57600080fd5b8135610dbd610c578261175c565b91508082526020830160208301858383011115610dd957600080fd5b61091c8382846117f8565b600060608284031215610df657600080fd5b610e006060611714565b90506000610e0e8484610f94565b8252506020610e1f84848301610d92565b6020830152506040610e3384828501610d92565b60408301525092915050565b60006101808284031215610e5257600080fd5b610e5d610180611714565b90506000610e6b8484610c20565b8252506020610e7c84848301610c20565b6020830152506040610e9084828501610c20565b6040830152506060610ea484828501610c20565b6060830152506080610eb884828501610f88565b60808301525060a0610ecc84828501610f88565b60a08301525060c0610ee084828501610f88565b60c08301525060e0610ef484828501610f88565b60e083015250610100610f0984828501610f88565b61010083015250610120610f1f84828501610f88565b6101208301525061014082013567ffffffffffffffff811115610f4157600080fd5b610f4d84828501610d9e565b6101408301525061016082013567ffffffffffffffff811115610f6f57600080fd5b610f7b84828501610d9e565b6101608301525092915050565b6000610b6882356117c5565b6000610b6882516117ed565b600060208284031215610fb257600080fd5b6000610fbe8484610c2c565b949350505050565b60008060408385031215610fd957600080fd5b6000610fe58585610c20565b925050602083013567ffffffffffffffff81111561100257600080fd5b61100e85828601610d9e565b9150509250929050565b6000806040838503121561102b57600080fd5b60006110378585610c20565b925050602061100e85828601610f88565b60006020828403121561105a57600080fd5b815167ffffffffffffffff81111561107157600080fd5b610fbe84828501610cb7565b6000806040838503121561109057600080fd5b823567ffffffffffffffff8111156110a757600080fd5b6110b385828601610d29565b925050602083013567ffffffffffffffff8111156110d057600080fd5b61100e85828601610c38565b6000602082840312156110ee57600080fd5b6000610fbe8484610d86565b60006060828403121561110c57600080fd5b6000610fbe8484610de4565b6000806040838503121561112b57600080fd5b823567ffffffffffffffff81111561114257600080fd5b61114e85828601610e3f565b925050602061100e85828601610c20565b60006020828403121561117157600080fd5b6000610fbe8484610d92565b611186816117ac565b82525050565b6000611197826117a8565b8084526020840193506111a9836117a2565b60005b828110156111d9576111bf868351611411565b6111c8826117a2565b6060969096019591506001016111ac565b5093949350505050565b60006111ee826117a8565b80845260208401935083602082028501611207856117a2565b60005b8481101561123e57838303885261122283835161144e565b925061122d826117a2565b60209890980197915060010161120a565b50909695505050505050565b6000611255826117a8565b808452602084019350611267836117a2565b60005b828110156111d95761127d868351611551565b611286826117a2565b6101009690960195915060010161126a565b611186816117c5565b611186816117c8565b60006112b5826117a8565b8084526112c9816020860160208601611804565b6112d281611830565b9093016020019392505050565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601781527f554e535550504f525445445f41535345545f50524f5859000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b602581527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160208201527f5549524544000000000000000000000000000000000000000000000000000000604082015260600190565b8051606083019061142284826115e8565b5060208201516114356020850182611298565b5060408201516114486040850182611298565b50505050565b8051600090610180840190611463858261117d565b506020830151611476602086018261117d565b506040830151611489604086018261117d565b50606083015161149c606086018261117d565b5060808301516114af6080860182611298565b5060a08301516114c260a0860182611298565b5060c08301516114d560c0860182611298565b5060e08301516114e860e0860182611298565b506101008301516114fd610100860182611298565b50610120830151611512610120860182611298565b5061014083015184820361014086015261152c82826112aa565b91505061016083015184820361016086015261154882826112aa565b95945050505050565b80516101008301906115638482611298565b5060208201516115766020850182611298565b5060408201516115896040850182611298565b50606082015161159c6060850182611298565b5060808201516115af6080850182611298565b5060a08201516115c260a0850182611298565b5060c08201516115d560c0850182611298565b5060e082015161144860e0850182611298565b611186816117ed565b6020810161096a828461117d565b6040810161160d828561117d565b610b68602083018461117d565b6040808252810161162b818561118c565b90508181036020830152610fbe818461124a565b60208082528101610b6881846111e3565b60208082528101610b68818461124a565b6020810161096a82846112a1565b6020808252810161096a816112df565b6020808252810161096a81611335565b6020808252810161096a81611365565b6020808252810161096a816113bb565b61016081016116be8285611411565b610b686060830184611551565b60208082528101610b68818461144e565b610100810161096a8284611551565b6020810161096a8284611298565b604081016117078285611298565b610b686020830184611298565b60405181810167ffffffffffffffff8111828210171561173357600080fd5b604052919050565b600067ffffffffffffffff82111561175257600080fd5b5060209081020190565b600067ffffffffffffffff82111561177357600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b151590565b82818337506000910152565b60005b8381101561181f578181015183820152602001611807565b838111156114485750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a723058200742593843de04ccb442f25f2474ff7a322e1281cdb1232118c18b3985166e7f6c6578706572696d656e74616cf50037", - "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH3 0x11 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH3 0x1B0D CODESIZE SUB DUP1 PUSH3 0x1B0D 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 0x1892 DUP1 PUSH3 0x27B 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 0x4AD1E53 DUP2 EQ PUSH2 0x7C JUMPI DUP1 PUSH4 0x2CD0FC73 EQ PUSH2 0xB3 JUMPI DUP1 PUSH4 0x4B95DE13 EQ PUSH2 0xE1 JUMPI DUP1 PUSH4 0x690D3114 EQ PUSH2 0x10F JUMPI DUP1 PUSH4 0xB6988463 EQ PUSH2 0x13C JUMPI DUP1 PUSH4 0xF241FFB0 EQ PUSH2 0x169 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 0x1118 JUMP JUMPDEST PUSH2 0x196 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP3 SWAP2 SWAP1 PUSH2 0x16AF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xBF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD3 PUSH2 0xCE CALLDATASIZE PUSH1 0x4 PUSH2 0xFC6 JUMP JUMPDEST PUSH2 0x263 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP3 SWAP2 SWAP1 PUSH2 0x16F9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xED JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x101 PUSH2 0xFC CALLDATASIZE PUSH1 0x4 PUSH2 0x107D JUMP JUMPDEST PUSH2 0x794 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP3 SWAP2 SWAP1 PUSH2 0x161A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x11B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x12F PUSH2 0x12A CALLDATASIZE PUSH1 0x4 PUSH2 0x107D JUMP JUMPDEST PUSH2 0x86B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP2 SWAP1 PUSH2 0x1650 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x148 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH2 0x157 CALLDATASIZE PUSH1 0x4 PUSH2 0x1018 JUMP JUMPDEST PUSH2 0x925 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP2 SWAP1 PUSH2 0x15F1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x175 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x189 PUSH2 0x184 CALLDATASIZE PUSH1 0x4 PUSH2 0x1118 JUMP JUMPDEST PUSH2 0x970 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP2 SWAP1 PUSH2 0x16DC JUMP JUMPDEST PUSH2 0x19E PUSH2 0xBBA JUMP JUMPDEST PUSH2 0x1A6 PUSH2 0xBDA JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0xC75E0A8100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0xC75E0A81 SWAP1 PUSH2 0x1FC SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0x16CB JUMP JUMPDEST PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x216 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x22A 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 0x24E SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x10FA JUMP JUMPDEST SWAP2 POP PUSH2 0x25A DUP5 DUP5 PUSH2 0x970 JUMP JUMPDEST SWAP1 POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP1 DUP1 DUP1 DUP1 DUP1 PUSH2 0x27C DUP10 DUP3 PUSH4 0xFFFFFFFF PUSH2 0xA8E AND JUMP JUMPDEST SWAP6 POP PUSH2 0x28F DUP10 PUSH1 0x10 PUSH4 0xFFFFFFFF PUSH2 0xAFB AND JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0x6070410800000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP2 SWAP7 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH4 0x60704108 SWAP1 PUSH2 0x2E6 SWAP1 DUP10 SWAP1 PUSH1 0x4 ADD PUSH2 0x1661 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x300 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x314 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 0x338 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xFA0 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 0x4ED JUMPI PUSH1 0x40 MLOAD PUSH32 0x70A0823100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 PUSH4 0x70A08231 SWAP1 PUSH2 0x3EB SWAP1 DUP14 SWAP1 PUSH1 0x4 ADD PUSH2 0x15F1 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x405 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x419 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 0x43D SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x115F JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xDD62ED3E00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP9 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 PUSH4 0xDD62ED3E SWAP1 PUSH2 0x494 SWAP1 DUP14 SWAP1 DUP9 SWAP1 PUSH1 0x4 ADD PUSH2 0x15FF JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x4AE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x4C2 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 0x4E6 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x115F JUMP JUMPDEST SWAP7 POP PUSH2 0x787 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 0x74C JUMPI PUSH2 0x55C DUP10 PUSH1 0x24 PUSH4 0xFFFFFFFF PUSH2 0xB5C AND JUMP JUMPDEST SWAP3 POP PUSH2 0x568 DUP6 DUP5 PUSH2 0x925 JUMP JUMPDEST SWAP2 POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP11 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x5A4 JUMPI PUSH1 0x0 PUSH2 0x5A7 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 0x603 SWAP3 SWAP2 SWAP1 PUSH2 0x15FF JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x61D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x631 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 0x655 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x10DC JUMP JUMPDEST DUP1 PUSH2 0x731 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 0x6C7 SWAP2 SWAP1 PUSH2 0x16EB JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x6E1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x6F5 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 0x719 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xFA0 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ JUMPDEST SWAP1 POP DUP1 PUSH2 0x73F JUMPI PUSH1 0x0 PUSH2 0x742 JUMP JUMPDEST PUSH1 0x1 JUMPDEST PUSH1 0xFF AND SWAP7 POP PUSH2 0x787 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x77E SWAP1 PUSH2 0x167F 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 0x7EF SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0x163F JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x809 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x81D 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 0x863 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1048 JUMP JUMPDEST SWAP2 POP PUSH2 0x25A 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 0x8B1 JUMPI DUP2 PUSH1 0x20 ADD JUMPDEST PUSH2 0x89E PUSH2 0xBDA JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 SWAP1 SUB SWAP1 DUP2 PUSH2 0x896 JUMPI SWAP1 POP JUMPDEST POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP1 DUP4 EQ PUSH2 0x918 JUMPI PUSH2 0x8F8 DUP7 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x8D1 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP7 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x8E9 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x970 JUMP JUMPDEST DUP3 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x906 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x8B9 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 0x967 JUMPI DUP2 MLOAD SWAP3 POP JUMPDEST POP POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x978 PUSH2 0xBDA JUMP JUMPDEST PUSH1 0x60 PUSH2 0x98D DUP5 PUSH1 0x0 ADD MLOAD DUP6 PUSH2 0x140 ADD MLOAD PUSH2 0x263 JUMP JUMPDEST PUSH1 0x20 DUP5 ADD MSTORE DUP3 MSTORE PUSH2 0x160 DUP5 ADD MLOAD PUSH2 0x9A5 SWAP1 DUP5 SWAP1 PUSH2 0x263 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 0xA54 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xA29 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xA54 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 0xA37 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0xA69 DUP5 PUSH1 0x0 ADD MLOAD DUP3 PUSH2 0x263 JUMP JUMPDEST PUSH1 0xA0 DUP5 ADD MSTORE PUSH1 0x80 DUP4 ADD MSTORE PUSH2 0xA7D DUP4 DUP3 PUSH2 0x263 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 0xAD0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x77E SWAP1 PUSH2 0x169F JUMP JUMPDEST POP POP PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xB3D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x77E SWAP1 PUSH2 0x168F JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP4 DUP4 PUSH2 0xB6F JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xBB1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x77E SWAP1 PUSH2 0x166F 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 0xB68 DUP3 CALLDATALOAD PUSH2 0x17AC JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP3 MLOAD PUSH2 0x17AC JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xC49 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xC5C PUSH2 0xC57 DUP3 PUSH2 0x173B JUMP JUMPDEST PUSH2 0x1714 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 0xC81 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xCAD JUMPI DUP2 PUSH2 0xC97 DUP9 DUP3 PUSH2 0xC20 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xC84 JUMP JUMPDEST POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xCC8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH2 0xCD6 PUSH2 0xC57 DUP3 PUSH2 0x173B 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 0xCFB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xCAD JUMPI DUP2 PUSH2 0xD11 DUP9 DUP3 PUSH2 0xDE4 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xCFE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xD3A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xD48 PUSH2 0xC57 DUP3 PUSH2 0x173B 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 0xCAD JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0xD70 DUP9 DUP3 PUSH2 0xE3F JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xD5A JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP3 MLOAD PUSH2 0x17F3 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP3 MLOAD PUSH2 0x17C5 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xDAF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xDBD PUSH2 0xC57 DUP3 PUSH2 0x175C JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0xDD9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x91C DUP4 DUP3 DUP5 PUSH2 0x17F8 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xDF6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xE00 PUSH1 0x60 PUSH2 0x1714 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0xE0E DUP5 DUP5 PUSH2 0xF94 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0xE1F DUP5 DUP5 DUP4 ADD PUSH2 0xD92 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0xE33 DUP5 DUP3 DUP6 ADD PUSH2 0xD92 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xE52 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xE5D PUSH2 0x180 PUSH2 0x1714 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0xE6B DUP5 DUP5 PUSH2 0xC20 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0xE7C DUP5 DUP5 DUP4 ADD PUSH2 0xC20 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0xE90 DUP5 DUP3 DUP6 ADD PUSH2 0xC20 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0xEA4 DUP5 DUP3 DUP6 ADD PUSH2 0xC20 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0xEB8 DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0xECC DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0xEE0 DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0xEF4 DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0xF09 DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0xF1F DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xF41 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xF4D DUP5 DUP3 DUP6 ADD PUSH2 0xD9E JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xF6F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xF7B DUP5 DUP3 DUP6 ADD PUSH2 0xD9E JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP3 CALLDATALOAD PUSH2 0x17C5 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP3 MLOAD PUSH2 0x17ED JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xFB2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xFBE DUP5 DUP5 PUSH2 0xC2C JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xFD9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xFE5 DUP6 DUP6 PUSH2 0xC20 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1002 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x100E DUP6 DUP3 DUP7 ADD PUSH2 0xD9E JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x102B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1037 DUP6 DUP6 PUSH2 0xC20 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x100E DUP6 DUP3 DUP7 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x105A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1071 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xFBE DUP5 DUP3 DUP6 ADD PUSH2 0xCB7 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x1090 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x10A7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x10B3 DUP6 DUP3 DUP7 ADD PUSH2 0xD29 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x10D0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x100E DUP6 DUP3 DUP7 ADD PUSH2 0xC38 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x10EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xFBE DUP5 DUP5 PUSH2 0xD86 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x110C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xFBE DUP5 DUP5 PUSH2 0xDE4 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x112B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1142 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x114E DUP6 DUP3 DUP7 ADD PUSH2 0xE3F JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x100E DUP6 DUP3 DUP7 ADD PUSH2 0xC20 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1171 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xFBE DUP5 DUP5 PUSH2 0xD92 JUMP JUMPDEST PUSH2 0x1186 DUP2 PUSH2 0x17AC JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1197 DUP3 PUSH2 0x17A8 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x11A9 DUP4 PUSH2 0x17A2 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x11D9 JUMPI PUSH2 0x11BF DUP7 DUP4 MLOAD PUSH2 0x1411 JUMP JUMPDEST PUSH2 0x11C8 DUP3 PUSH2 0x17A2 JUMP JUMPDEST PUSH1 0x60 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x11AC JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x11EE DUP3 PUSH2 0x17A8 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP DUP4 PUSH1 0x20 DUP3 MUL DUP6 ADD PUSH2 0x1207 DUP6 PUSH2 0x17A2 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP5 DUP2 LT ISZERO PUSH2 0x123E JUMPI DUP4 DUP4 SUB DUP9 MSTORE PUSH2 0x1222 DUP4 DUP4 MLOAD PUSH2 0x144E JUMP JUMPDEST SWAP3 POP PUSH2 0x122D DUP3 PUSH2 0x17A2 JUMP JUMPDEST PUSH1 0x20 SWAP9 SWAP1 SWAP9 ADD SWAP8 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x120A JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1255 DUP3 PUSH2 0x17A8 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x1267 DUP4 PUSH2 0x17A2 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x11D9 JUMPI PUSH2 0x127D DUP7 DUP4 MLOAD PUSH2 0x1551 JUMP JUMPDEST PUSH2 0x1286 DUP3 PUSH2 0x17A2 JUMP JUMPDEST PUSH2 0x100 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x126A JUMP JUMPDEST PUSH2 0x1186 DUP2 PUSH2 0x17C5 JUMP JUMPDEST PUSH2 0x1186 DUP2 PUSH2 0x17C8 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x12B5 DUP3 PUSH2 0x17A8 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x12C9 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x1804 JUMP JUMPDEST PUSH2 0x12D2 DUP2 PUSH2 0x1830 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 0x1422 DUP5 DUP3 PUSH2 0x15E8 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x1435 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x1448 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0x1463 DUP6 DUP3 PUSH2 0x117D JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0x1476 PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0x117D JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0x1489 PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0x117D JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0x149C PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x117D JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0x14AF PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0x14C2 PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x14D5 PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0x14E8 PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0x14FD PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0x1512 PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0x152C DUP3 DUP3 PUSH2 0x12AA JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0x1548 DUP3 DUP3 PUSH2 0x12AA JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH2 0x100 DUP4 ADD SWAP1 PUSH2 0x1563 DUP5 DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x1576 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x1589 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x159C PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0x80 DUP3 ADD MLOAD PUSH2 0x15AF PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xA0 DUP3 ADD MLOAD PUSH2 0x15C2 PUSH1 0xA0 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xC0 DUP3 ADD MLOAD PUSH2 0x15D5 PUSH1 0xC0 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xE0 DUP3 ADD MLOAD PUSH2 0x1448 PUSH1 0xE0 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST PUSH2 0x1186 DUP2 PUSH2 0x17ED JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x96A DUP3 DUP5 PUSH2 0x117D JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x160D DUP3 DUP6 PUSH2 0x117D JUMP JUMPDEST PUSH2 0xB68 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x117D JUMP JUMPDEST PUSH1 0x40 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x162B DUP2 DUP6 PUSH2 0x118C JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0xFBE DUP2 DUP5 PUSH2 0x124A JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB68 DUP2 DUP5 PUSH2 0x11E3 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB68 DUP2 DUP5 PUSH2 0x124A JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x96A DUP3 DUP5 PUSH2 0x12A1 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x96A DUP2 PUSH2 0x12DF JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x96A DUP2 PUSH2 0x1335 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x96A DUP2 PUSH2 0x1365 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x96A DUP2 PUSH2 0x13BB JUMP JUMPDEST PUSH2 0x160 DUP2 ADD PUSH2 0x16BE DUP3 DUP6 PUSH2 0x1411 JUMP JUMPDEST PUSH2 0xB68 PUSH1 0x60 DUP4 ADD DUP5 PUSH2 0x1551 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB68 DUP2 DUP5 PUSH2 0x144E JUMP JUMPDEST PUSH2 0x100 DUP2 ADD PUSH2 0x96A DUP3 DUP5 PUSH2 0x1551 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x96A DUP3 DUP5 PUSH2 0x1298 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x1707 DUP3 DUP6 PUSH2 0x1298 JUMP JUMPDEST PUSH2 0xB68 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x1298 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x1733 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1752 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 SWAP1 DUP2 MUL ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1773 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 0x181F JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1807 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x1448 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 SMOD TIMESTAMP MSIZE CODESIZE NUMBER 0xde DIV 0xcc 0xb4 TIMESTAMP CALLCODE 0x5f 0x24 PUSH21 0xFF7A322E1281CDB1232118C18B3985166E7F6C6578 PUSH17 0x6572696D656E74616CF500370000000000 ", - "sourceMap": "898:7576:11:-;;;1916:167;8:9:-1;5:2;;;30:1;27;20:12;5:2;1916:167:11;;;;;;;;;;;;;;;;;;;;;;;;2005:8;:31;;-1:-1:-1;;;;;;2005:31:11;-1:-1:-1;;;;;2005:31:11;;;;;2046:30;;;;-1:-1:-1;;2046:30:11;;;;;:::i;:::-;;1916:167;;898:7576;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;898:7576:11;;;-1:-1:-1;898:7576:11;:::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:7576:11;;;;;;" + "object": "0x60806040523480156200001157600080fd5b5060405162001d3a38038062001d3a833981018060405262000037919081019062000186565b60008054600160a060020a031916600160a060020a03841617905580516200006790600190602084019062000070565b5050506200026b565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000b357805160ff1916838001178555620000e3565b82800160010185558215620000e3579182015b82811115620000e3578251825591602001919060010190620000c6565b50620000f1929150620000f5565b5090565b6200011291905b80821115620000f15760008155600101620000fc565b90565b60006200012382516200022c565b9392505050565b6000601f820183136200013c57600080fd5b8151620001536200014d8262000204565b620001dd565b915080825260208301602083018583830111156200017057600080fd5b6200017d83828462000238565b50505092915050565b600080604083850312156200019a57600080fd5b6000620001a8858562000115565b92505060208301516001604060020a03811115620001c557600080fd5b620001d3858286016200012a565b9150509250929050565b6040518181016001604060020a0381118282101715620001fc57600080fd5b604052919050565b60006001604060020a038211156200021b57600080fd5b506020601f91909101601f19160190565b600160a060020a031690565b60005b83811015620002555781810151838201526020016200023b565b8381111562000265576000848401525b50505050565b611abf806200027b6000396000f3006080604052600436106100825763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304ad1e5381146100875780632cd0fc73146100be5780634b95de13146100ec578063690d31141461011a578063b698846314610147578063c6b7f4ee14610174578063f241ffb0146101a2575b600080fd5b34801561009357600080fd5b506100a76100a23660046112d3565b6101cf565b6040516100b59291906118dc565b60405180910390f35b3480156100ca57600080fd5b506100de6100d936600461118b565b61029c565b6040516100b5929190611926565b3480156100f857600080fd5b5061010c610107366004611238565b6107cd565b6040516100b5929190611822565b34801561012657600080fd5b5061013a610135366004611238565b6108a4565b6040516100b59190611858565b34801561015357600080fd5b506101676101623660046111d3565b61095e565b6040516100b591906117f9565b34801561018057600080fd5b5061019461018f366004611139565b6109a9565b6040516100b5929190611869565b3480156101ae57600080fd5b506101c26101bd3660046112d3565b610a86565b6040516100b59190611909565b6101d7610cd0565b6101df610cf0565b6000546040517fc75e0a8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063c75e0a81906102359087906004016118f8565b606060405180830381600087803b15801561024f57600080fd5b505af1158015610263573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061028791908101906112b5565b91506102938484610a86565b90509250929050565b6000808080808080806102b5898263ffffffff610ba416565b95506102c889601063ffffffff610c1116565b6000546040517f6070410800000000000000000000000000000000000000000000000000000000815291965073ffffffffffffffffffffffffffffffffffffffff169063607041089061031f90899060040161188e565b602060405180830381600087803b15801561033957600080fd5b505af115801561034d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103719190810190611113565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190209094507fffffffff0000000000000000000000000000000000000000000000000000000087811691161415610526576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616906370a0823190610424908d906004016117f9565b602060405180830381600087803b15801561043e57600080fd5b505af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610476919081019061131a565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815290985073ffffffffffffffffffffffffffffffffffffffff86169063dd62ed3e906104cd908d908890600401611807565b602060405180830381600087803b1580156104e757600080fd5b505af11580156104fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061051f919081019061131a565b96506107c0565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190207fffffffff00000000000000000000000000000000000000000000000000000000878116911614156107855761059589602463ffffffff610c7216565b92506105a1858461095e565b91508173ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16146105dd5760006105e0565b60015b60ff1697508473ffffffffffffffffffffffffffffffffffffffff1663e985e9c58b866040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161063c929190611807565b602060405180830381600087803b15801561065657600080fd5b505af115801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061068e9190810190611297565b8061076a57508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1663081812fc856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016107009190611918565b602060405180830381600087803b15801561071a57600080fd5b505af115801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107529190810190611113565b73ffffffffffffffffffffffffffffffffffffffff16145b90508061077857600061077b565b60015b60ff1696506107c0565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118ac565b60405180910390fd5b5050505050509250929050565b6000546040517f7e9d74dc000000000000000000000000000000000000000000000000000000008152606091829173ffffffffffffffffffffffffffffffffffffffff90911690637e9d74dc90610828908790600401611847565b600060405180830381600087803b15801561084257600080fd5b505af1158015610856573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261089c9190810190611203565b915061029384845b606060006060600085519250826040519080825280602002602001820160405280156108ea57816020015b6108d7610cf0565b8152602001906001900390816108cf5790505b509150600090505b80831461095157610931868281518110151561090a57fe5b90602001906020020151868381518110151561092257fe5b90602001906020020151610a86565b828281518110151561093f57fe5b602090810290910101526001016108f2565b8193505b50505092915050565b60006040517f6352211e000000000000000000000000000000000000000000000000000000008152826004820152602081602483875afa80156109a057815192505b50505b92915050565b6060806000606080600086519350836040519080825280602002602001820160405280156109e1578160200160208202803883390190505b50925083604051908082528060200260200182016040528015610a0e578160200160208202803883390190505b509150600090505b808414610a7957610a3e888883815181101515610a2f57fe5b9060200190602002015161029c565b8483815181101515610a4c57fe5b9060200190602002018484815181101515610a6357fe5b6020908102909101019190915252600101610a16565b5090969095509350505050565b610a8e610cf0565b6060610aa3846000015185610140015161029c565b60208401528252610160840151610abb90849061029c565b60608401526040808401919091526001805482516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008688161502019094169390930492830181900481028201810190945281815292830182828015610b6a5780601f10610b3f57610100808354040283529160200191610b6a565b820191906000526020600020905b815481529060010190602001808311610b4d57829003601f168201915b50505050509050610b7f84600001518261029c565b60a08401526080830152610b93838261029c565b60e084015260c08301525092915050565b600081600401835110151515610be6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118cc565b5050602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b600081601401835110151515610c53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118bc565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000610c7e8383610c85565b9392505050565b600081602001835110151515610cc7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b79061189c565b50016020015190565b604080516060810182526000808252602082018190529181019190915290565b6101006040519081016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000610c7e82356119d9565b6000610c7e82516119d9565b6000601f82018313610d5f57600080fd5b8135610d72610d6d82611968565b611941565b91508181835260208401935060208101905083856020840282011115610d9757600080fd5b60005b83811015610dc35781610dad8882610d36565b8452506020928301929190910190600101610d9a565b5050505092915050565b6000601f82018313610dde57600080fd5b8135610dec610d6d82611968565b81815260209384019390925082018360005b83811015610dc35781358601610e148882610f11565b8452506020928301929190910190600101610dfe565b6000601f82018313610e3b57600080fd5b8151610e49610d6d82611968565b91508181835260208401935060208101905083856060840282011115610e6e57600080fd5b60005b83811015610dc35781610e848882610f57565b84525060209092019160609190910190600101610e71565b6000601f82018313610ead57600080fd5b8135610ebb610d6d82611968565b81815260209384019390925082018360005b83811015610dc35781358601610ee38882610fb2565b8452506020928301929190910190600101610ecd565b6000610c7e8251611a20565b6000610c7e82516119f2565b6000601f82018313610f2257600080fd5b8135610f30610d6d82611989565b91508082526020830160208301858383011115610f4c57600080fd5b610955838284611a25565b600060608284031215610f6957600080fd5b610f736060611941565b90506000610f818484611107565b8252506020610f9284848301610f05565b6020830152506040610fa684828501610f05565b60408301525092915050565b60006101808284031215610fc557600080fd5b610fd0610180611941565b90506000610fde8484610d36565b8252506020610fef84848301610d36565b602083015250604061100384828501610d36565b604083015250606061101784828501610d36565b606083015250608061102b848285016110fb565b60808301525060a061103f848285016110fb565b60a08301525060c0611053848285016110fb565b60c08301525060e0611067848285016110fb565b60e08301525061010061107c848285016110fb565b61010083015250610120611092848285016110fb565b6101208301525061014082013567ffffffffffffffff8111156110b457600080fd5b6110c084828501610f11565b6101408301525061016082013567ffffffffffffffff8111156110e257600080fd5b6110ee84828501610f11565b6101608301525092915050565b6000610c7e82356119f2565b6000610c7e8251611a1a565b60006020828403121561112557600080fd5b60006111318484610d42565b949350505050565b6000806040838503121561114c57600080fd5b60006111588585610d36565b925050602083013567ffffffffffffffff81111561117557600080fd5b61118185828601610dcd565b9150509250929050565b6000806040838503121561119e57600080fd5b60006111aa8585610d36565b925050602083013567ffffffffffffffff8111156111c757600080fd5b61118185828601610f11565b600080604083850312156111e657600080fd5b60006111f28585610d36565b9250506020611181858286016110fb565b60006020828403121561121557600080fd5b815167ffffffffffffffff81111561122c57600080fd5b61113184828501610e2a565b6000806040838503121561124b57600080fd5b823567ffffffffffffffff81111561126257600080fd5b61126e85828601610e9c565b925050602083013567ffffffffffffffff81111561128b57600080fd5b61118185828601610d4e565b6000602082840312156112a957600080fd5b60006111318484610ef9565b6000606082840312156112c757600080fd5b60006111318484610f57565b600080604083850312156112e657600080fd5b823567ffffffffffffffff8111156112fd57600080fd5b61130985828601610fb2565b925050602061118185828601610d36565b60006020828403121561132c57600080fd5b60006111318484610f05565b611341816119d9565b82525050565b6000611352826119d5565b808452602084019350611364836119cf565b60005b828110156113945761137a868351611619565b611383826119cf565b606096909601959150600101611367565b5093949350505050565b60006113a9826119d5565b808452602084019350836020820285016113c2856119cf565b60005b848110156113f95783830388526113dd838351611656565b92506113e8826119cf565b6020989098019791506001016113c5565b50909695505050505050565b6000611410826119d5565b808452602084019350611422836119cf565b60005b8281101561139457611438868351611759565b611441826119cf565b61010096909601959150600101611425565b600061145e826119d5565b808452602084019350611470836119cf565b60005b82811015611394576114868683516114a0565b61148f826119cf565b602096909601959150600101611473565b611341816119f2565b611341816119f5565b60006114bd826119d5565b8084526114d1816020860160208601611a31565b6114da81611a5d565b9093016020019392505050565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601781527f554e535550504f525445445f41535345545f50524f5859000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b602581527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160208201527f5549524544000000000000000000000000000000000000000000000000000000604082015260600190565b8051606083019061162a84826117f0565b50602082015161163d60208501826114a0565b50604082015161165060408501826114a0565b50505050565b805160009061018084019061166b8582611338565b50602083015161167e6020860182611338565b5060408301516116916040860182611338565b5060608301516116a46060860182611338565b5060808301516116b760808601826114a0565b5060a08301516116ca60a08601826114a0565b5060c08301516116dd60c08601826114a0565b5060e08301516116f060e08601826114a0565b506101008301516117056101008601826114a0565b5061012083015161171a6101208601826114a0565b5061014083015184820361014086015261173482826114b2565b91505061016083015184820361016086015261175082826114b2565b95945050505050565b805161010083019061176b84826114a0565b50602082015161177e60208501826114a0565b50604082015161179160408501826114a0565b5060608201516117a460608501826114a0565b5060808201516117b760808501826114a0565b5060a08201516117ca60a08501826114a0565b5060c08201516117dd60c08501826114a0565b5060e082015161165060e08501826114a0565b61134181611a1a565b602081016109a38284611338565b604081016118158285611338565b610c7e6020830184611338565b604080825281016118338185611347565b905081810360208301526111318184611405565b60208082528101610c7e818461139e565b60208082528101610c7e8184611405565b6040808252810161187a8185611453565b905081810360208301526111318184611453565b602081016109a382846114a9565b602080825281016109a3816114e7565b602080825281016109a38161153d565b602080825281016109a38161156d565b602080825281016109a3816115c3565b61016081016118eb8285611619565b610c7e6060830184611759565b60208082528101610c7e8184611656565b61010081016109a38284611759565b602081016109a382846114a0565b6040810161193482856114a0565b610c7e60208301846114a0565b60405181810167ffffffffffffffff8111828210171561196057600080fd5b604052919050565b600067ffffffffffffffff82111561197f57600080fd5b5060209081020190565b600067ffffffffffffffff8211156119a057600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b151590565b82818337506000910152565b60005b83811015611a4c578181015183820152602001611a34565b838111156116505750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820d3d495bc287663ed8cb2a513cfad47804ffa6e4ad0cfa6d0d0eadf1f907483586c6578706572696d656e74616cf50037", + "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 POP 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 0xd3 0xd4 SWAP6 0xbc 0x28 PUSH23 0x63ED8CB2A513CFAD47804FFA6E4AD0CFA6D0D0EADF1F90 PUSH21 0x83586C6578706572696D656E74616CF50037000000 ", + "sourceMap": "898:8536:11:-;;;1916:167;8:9:-1;5:2;;;30:1;27;20:12;5:2;1916:167:11;;;;;;;;;;;;;;;;;;;;;;;;2005:8;:31;;-1:-1:-1;;;;;;2005:31:11;-1:-1:-1;;;;;2005:31:11;;;;;2046:30;;;;-1:-1:-1;;2046:30:11;;;;;:::i;:::-;;1916:167;;898:8536;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;898:8536:11;;;-1:-1:-1;898:8536:11;:::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:11;;;;;;" }, "deployedBytecode": { "linkReferences": {}, - "object": "0x6080604052600436106100775763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304ad1e53811461007c5780632cd0fc73146100b35780634b95de13146100e1578063690d31141461010f578063b69884631461013c578063f241ffb014610169575b600080fd5b34801561008857600080fd5b5061009c610097366004611118565b610196565b6040516100aa9291906116af565b60405180910390f35b3480156100bf57600080fd5b506100d36100ce366004610fc6565b610263565b6040516100aa9291906116f9565b3480156100ed57600080fd5b506101016100fc36600461107d565b610794565b6040516100aa92919061161a565b34801561011b57600080fd5b5061012f61012a36600461107d565b61086b565b6040516100aa9190611650565b34801561014857600080fd5b5061015c610157366004611018565b610925565b6040516100aa91906115f1565b34801561017557600080fd5b50610189610184366004611118565b610970565b6040516100aa91906116dc565b61019e610bba565b6101a6610bda565b6000546040517fc75e0a8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063c75e0a81906101fc9087906004016116cb565b606060405180830381600087803b15801561021657600080fd5b505af115801561022a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061024e91908101906110fa565b915061025a8484610970565b90509250929050565b60008080808080808061027c898263ffffffff610a8e16565b955061028f89601063ffffffff610afb16565b6000546040517f6070410800000000000000000000000000000000000000000000000000000000815291965073ffffffffffffffffffffffffffffffffffffffff16906360704108906102e6908990600401611661565b602060405180830381600087803b15801561030057600080fd5b505af1158015610314573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103389190810190610fa0565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190209094507fffffffff00000000000000000000000000000000000000000000000000000000878116911614156104ed576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616906370a08231906103eb908d906004016115f1565b602060405180830381600087803b15801561040557600080fd5b505af1158015610419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061043d919081019061115f565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815290985073ffffffffffffffffffffffffffffffffffffffff86169063dd62ed3e90610494908d9088906004016115ff565b602060405180830381600087803b1580156104ae57600080fd5b505af11580156104c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506104e6919081019061115f565b9650610787565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190207fffffffff000000000000000000000000000000000000000000000000000000008781169116141561074c5761055c89602463ffffffff610b5c16565b92506105688584610925565b91508173ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16146105a45760006105a7565b60015b60ff1697508473ffffffffffffffffffffffffffffffffffffffff1663e985e9c58b866040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016106039291906115ff565b602060405180830381600087803b15801561061d57600080fd5b505af1158015610631573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061065591908101906110dc565b8061073157508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1663081812fc856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016106c791906116eb565b602060405180830381600087803b1580156106e157600080fd5b505af11580156106f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107199190810190610fa0565b73ffffffffffffffffffffffffffffffffffffffff16145b90508061073f576000610742565b60015b60ff169650610787565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077e9061167f565b60405180910390fd5b5050505050509250929050565b6000546040517f7e9d74dc000000000000000000000000000000000000000000000000000000008152606091829173ffffffffffffffffffffffffffffffffffffffff90911690637e9d74dc906107ef90879060040161163f565b600060405180830381600087803b15801561080957600080fd5b505af115801561081d573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526108639190810190611048565b915061025a84845b606060006060600085519250826040519080825280602002602001820160405280156108b157816020015b61089e610bda565b8152602001906001900390816108965790505b509150600090505b808314610918576108f886828151811015156108d157fe5b9060200190602002015186838151811015156108e957fe5b90602001906020020151610970565b828281518110151561090657fe5b602090810290910101526001016108b9565b8193505b50505092915050565b60006040517f6352211e000000000000000000000000000000000000000000000000000000008152826004820152602081602483875afa801561096757815192505b50505b92915050565b610978610bda565b606061098d8460000151856101400151610263565b602084015282526101608401516109a5908490610263565b60608401526040808401919091526001805482516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008688161502019094169390930492830181900481028201810190945281815292830182828015610a545780601f10610a2957610100808354040283529160200191610a54565b820191906000526020600020905b815481529060010190602001808311610a3757829003601f168201915b50505050509050610a69846000015182610263565b60a08401526080830152610a7d8382610263565b60e084015260c08301525092915050565b600081600401835110151515610ad0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077e9061169f565b5050602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b600081601401835110151515610b3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077e9061168f565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000610b688383610b6f565b9392505050565b600081602001835110151515610bb1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077e9061166f565b50016020015190565b604080516060810182526000808252602082018190529181019190915290565b6101006040519081016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000610b6882356117ac565b6000610b6882516117ac565b6000601f82018313610c4957600080fd5b8135610c5c610c578261173b565b611714565b91508181835260208401935060208101905083856020840282011115610c8157600080fd5b60005b83811015610cad5781610c978882610c20565b8452506020928301929190910190600101610c84565b5050505092915050565b6000601f82018313610cc857600080fd5b8151610cd6610c578261173b565b91508181835260208401935060208101905083856060840282011115610cfb57600080fd5b60005b83811015610cad5781610d118882610de4565b84525060209092019160609190910190600101610cfe565b6000601f82018313610d3a57600080fd5b8135610d48610c578261173b565b81815260209384019390925082018360005b83811015610cad5781358601610d708882610e3f565b8452506020928301929190910190600101610d5a565b6000610b6882516117f3565b6000610b6882516117c5565b6000601f82018313610daf57600080fd5b8135610dbd610c578261175c565b91508082526020830160208301858383011115610dd957600080fd5b61091c8382846117f8565b600060608284031215610df657600080fd5b610e006060611714565b90506000610e0e8484610f94565b8252506020610e1f84848301610d92565b6020830152506040610e3384828501610d92565b60408301525092915050565b60006101808284031215610e5257600080fd5b610e5d610180611714565b90506000610e6b8484610c20565b8252506020610e7c84848301610c20565b6020830152506040610e9084828501610c20565b6040830152506060610ea484828501610c20565b6060830152506080610eb884828501610f88565b60808301525060a0610ecc84828501610f88565b60a08301525060c0610ee084828501610f88565b60c08301525060e0610ef484828501610f88565b60e083015250610100610f0984828501610f88565b61010083015250610120610f1f84828501610f88565b6101208301525061014082013567ffffffffffffffff811115610f4157600080fd5b610f4d84828501610d9e565b6101408301525061016082013567ffffffffffffffff811115610f6f57600080fd5b610f7b84828501610d9e565b6101608301525092915050565b6000610b6882356117c5565b6000610b6882516117ed565b600060208284031215610fb257600080fd5b6000610fbe8484610c2c565b949350505050565b60008060408385031215610fd957600080fd5b6000610fe58585610c20565b925050602083013567ffffffffffffffff81111561100257600080fd5b61100e85828601610d9e565b9150509250929050565b6000806040838503121561102b57600080fd5b60006110378585610c20565b925050602061100e85828601610f88565b60006020828403121561105a57600080fd5b815167ffffffffffffffff81111561107157600080fd5b610fbe84828501610cb7565b6000806040838503121561109057600080fd5b823567ffffffffffffffff8111156110a757600080fd5b6110b385828601610d29565b925050602083013567ffffffffffffffff8111156110d057600080fd5b61100e85828601610c38565b6000602082840312156110ee57600080fd5b6000610fbe8484610d86565b60006060828403121561110c57600080fd5b6000610fbe8484610de4565b6000806040838503121561112b57600080fd5b823567ffffffffffffffff81111561114257600080fd5b61114e85828601610e3f565b925050602061100e85828601610c20565b60006020828403121561117157600080fd5b6000610fbe8484610d92565b611186816117ac565b82525050565b6000611197826117a8565b8084526020840193506111a9836117a2565b60005b828110156111d9576111bf868351611411565b6111c8826117a2565b6060969096019591506001016111ac565b5093949350505050565b60006111ee826117a8565b80845260208401935083602082028501611207856117a2565b60005b8481101561123e57838303885261122283835161144e565b925061122d826117a2565b60209890980197915060010161120a565b50909695505050505050565b6000611255826117a8565b808452602084019350611267836117a2565b60005b828110156111d95761127d868351611551565b611286826117a2565b6101009690960195915060010161126a565b611186816117c5565b611186816117c8565b60006112b5826117a8565b8084526112c9816020860160208601611804565b6112d281611830565b9093016020019392505050565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601781527f554e535550504f525445445f41535345545f50524f5859000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b602581527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160208201527f5549524544000000000000000000000000000000000000000000000000000000604082015260600190565b8051606083019061142284826115e8565b5060208201516114356020850182611298565b5060408201516114486040850182611298565b50505050565b8051600090610180840190611463858261117d565b506020830151611476602086018261117d565b506040830151611489604086018261117d565b50606083015161149c606086018261117d565b5060808301516114af6080860182611298565b5060a08301516114c260a0860182611298565b5060c08301516114d560c0860182611298565b5060e08301516114e860e0860182611298565b506101008301516114fd610100860182611298565b50610120830151611512610120860182611298565b5061014083015184820361014086015261152c82826112aa565b91505061016083015184820361016086015261154882826112aa565b95945050505050565b80516101008301906115638482611298565b5060208201516115766020850182611298565b5060408201516115896040850182611298565b50606082015161159c6060850182611298565b5060808201516115af6080850182611298565b5060a08201516115c260a0850182611298565b5060c08201516115d560c0850182611298565b5060e082015161144860e0850182611298565b611186816117ed565b6020810161096a828461117d565b6040810161160d828561117d565b610b68602083018461117d565b6040808252810161162b818561118c565b90508181036020830152610fbe818461124a565b60208082528101610b6881846111e3565b60208082528101610b68818461124a565b6020810161096a82846112a1565b6020808252810161096a816112df565b6020808252810161096a81611335565b6020808252810161096a81611365565b6020808252810161096a816113bb565b61016081016116be8285611411565b610b686060830184611551565b60208082528101610b68818461144e565b610100810161096a8284611551565b6020810161096a8284611298565b604081016117078285611298565b610b686020830184611298565b60405181810167ffffffffffffffff8111828210171561173357600080fd5b604052919050565b600067ffffffffffffffff82111561175257600080fd5b5060209081020190565b600067ffffffffffffffff82111561177357600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b151590565b82818337506000910152565b60005b8381101561181f578181015183820152602001611807565b838111156114485750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a723058200742593843de04ccb442f25f2474ff7a322e1281cdb1232118c18b3985166e7f6c6578706572696d656e74616cf50037", - "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH2 0x77 JUMPI PUSH4 0xFFFFFFFF PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV AND PUSH4 0x4AD1E53 DUP2 EQ PUSH2 0x7C JUMPI DUP1 PUSH4 0x2CD0FC73 EQ PUSH2 0xB3 JUMPI DUP1 PUSH4 0x4B95DE13 EQ PUSH2 0xE1 JUMPI DUP1 PUSH4 0x690D3114 EQ PUSH2 0x10F JUMPI DUP1 PUSH4 0xB6988463 EQ PUSH2 0x13C JUMPI DUP1 PUSH4 0xF241FFB0 EQ PUSH2 0x169 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 0x1118 JUMP JUMPDEST PUSH2 0x196 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP3 SWAP2 SWAP1 PUSH2 0x16AF JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xBF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0xD3 PUSH2 0xCE CALLDATASIZE PUSH1 0x4 PUSH2 0xFC6 JUMP JUMPDEST PUSH2 0x263 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP3 SWAP2 SWAP1 PUSH2 0x16F9 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0xED JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x101 PUSH2 0xFC CALLDATASIZE PUSH1 0x4 PUSH2 0x107D JUMP JUMPDEST PUSH2 0x794 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP3 SWAP2 SWAP1 PUSH2 0x161A JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x11B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x12F PUSH2 0x12A CALLDATASIZE PUSH1 0x4 PUSH2 0x107D JUMP JUMPDEST PUSH2 0x86B JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP2 SWAP1 PUSH2 0x1650 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x148 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x15C PUSH2 0x157 CALLDATASIZE PUSH1 0x4 PUSH2 0x1018 JUMP JUMPDEST PUSH2 0x925 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP2 SWAP1 PUSH2 0x15F1 JUMP JUMPDEST CALLVALUE DUP1 ISZERO PUSH2 0x175 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x189 PUSH2 0x184 CALLDATASIZE PUSH1 0x4 PUSH2 0x1118 JUMP JUMPDEST PUSH2 0x970 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0xAA SWAP2 SWAP1 PUSH2 0x16DC JUMP JUMPDEST PUSH2 0x19E PUSH2 0xBBA JUMP JUMPDEST PUSH2 0x1A6 PUSH2 0xBDA JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0xC75E0A8100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP1 PUSH4 0xC75E0A81 SWAP1 PUSH2 0x1FC SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0x16CB JUMP JUMPDEST PUSH1 0x60 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x216 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x22A 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 0x24E SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x10FA JUMP JUMPDEST SWAP2 POP PUSH2 0x25A DUP5 DUP5 PUSH2 0x970 JUMP JUMPDEST SWAP1 POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 DUP1 DUP1 DUP1 DUP1 DUP1 DUP1 PUSH2 0x27C DUP10 DUP3 PUSH4 0xFFFFFFFF PUSH2 0xA8E AND JUMP JUMPDEST SWAP6 POP PUSH2 0x28F DUP10 PUSH1 0x10 PUSH4 0xFFFFFFFF PUSH2 0xAFB AND JUMP JUMPDEST PUSH1 0x0 SLOAD PUSH1 0x40 MLOAD PUSH32 0x6070410800000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP2 SWAP7 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH4 0x60704108 SWAP1 PUSH2 0x2E6 SWAP1 DUP10 SWAP1 PUSH1 0x4 ADD PUSH2 0x1661 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x300 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x314 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 0x338 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xFA0 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 0x4ED JUMPI PUSH1 0x40 MLOAD PUSH32 0x70A0823100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 PUSH4 0x70A08231 SWAP1 PUSH2 0x3EB SWAP1 DUP14 SWAP1 PUSH1 0x4 ADD PUSH2 0x15F1 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x405 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x419 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 0x43D SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x115F JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0xDD62ED3E00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE SWAP1 SWAP9 POP PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 PUSH4 0xDD62ED3E SWAP1 PUSH2 0x494 SWAP1 DUP14 SWAP1 DUP9 SWAP1 PUSH1 0x4 ADD PUSH2 0x15FF JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x4AE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x4C2 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 0x4E6 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x115F JUMP JUMPDEST SWAP7 POP PUSH2 0x787 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 0x74C JUMPI PUSH2 0x55C DUP10 PUSH1 0x24 PUSH4 0xFFFFFFFF PUSH2 0xB5C AND JUMP JUMPDEST SWAP3 POP PUSH2 0x568 DUP6 DUP5 PUSH2 0x925 JUMP JUMPDEST SWAP2 POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP11 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ PUSH2 0x5A4 JUMPI PUSH1 0x0 PUSH2 0x5A7 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 0x603 SWAP3 SWAP2 SWAP1 PUSH2 0x15FF JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x61D JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x631 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 0x655 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x10DC JUMP JUMPDEST DUP1 PUSH2 0x731 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 0x6C7 SWAP2 SWAP1 PUSH2 0x16EB JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x6E1 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x6F5 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 0x719 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0xFA0 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ JUMPDEST SWAP1 POP DUP1 PUSH2 0x73F JUMPI PUSH1 0x0 PUSH2 0x742 JUMP JUMPDEST PUSH1 0x1 JUMPDEST PUSH1 0xFF AND SWAP7 POP PUSH2 0x787 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x77E SWAP1 PUSH2 0x167F 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 0x7EF SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0x163F JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x809 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x81D 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 0x863 SWAP2 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1048 JUMP JUMPDEST SWAP2 POP PUSH2 0x25A 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 0x8B1 JUMPI DUP2 PUSH1 0x20 ADD JUMPDEST PUSH2 0x89E PUSH2 0xBDA JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 SWAP1 SUB SWAP1 DUP2 PUSH2 0x896 JUMPI SWAP1 POP JUMPDEST POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP1 DUP4 EQ PUSH2 0x918 JUMPI PUSH2 0x8F8 DUP7 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x8D1 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD DUP7 DUP4 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x8E9 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH2 0x970 JUMP JUMPDEST DUP3 DUP3 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x906 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE PUSH1 0x1 ADD PUSH2 0x8B9 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 0x967 JUMPI DUP2 MLOAD SWAP3 POP JUMPDEST POP POP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH2 0x978 PUSH2 0xBDA JUMP JUMPDEST PUSH1 0x60 PUSH2 0x98D DUP5 PUSH1 0x0 ADD MLOAD DUP6 PUSH2 0x140 ADD MLOAD PUSH2 0x263 JUMP JUMPDEST PUSH1 0x20 DUP5 ADD MSTORE DUP3 MSTORE PUSH2 0x160 DUP5 ADD MLOAD PUSH2 0x9A5 SWAP1 DUP5 SWAP1 PUSH2 0x263 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 0xA54 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xA29 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xA54 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 0xA37 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP SWAP1 POP PUSH2 0xA69 DUP5 PUSH1 0x0 ADD MLOAD DUP3 PUSH2 0x263 JUMP JUMPDEST PUSH1 0xA0 DUP5 ADD MSTORE PUSH1 0x80 DUP4 ADD MSTORE PUSH2 0xA7D DUP4 DUP3 PUSH2 0x263 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 0xAD0 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x77E SWAP1 PUSH2 0x169F JUMP JUMPDEST POP POP PUSH1 0x20 ADD MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x14 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xB3D JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x77E SWAP1 PUSH2 0x168F JUMP JUMPDEST POP ADD PUSH1 0x14 ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP4 DUP4 PUSH2 0xB6F JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0xBB1 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x77E SWAP1 PUSH2 0x166F 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 0xB68 DUP3 CALLDATALOAD PUSH2 0x17AC JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP3 MLOAD PUSH2 0x17AC JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xC49 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xC5C PUSH2 0xC57 DUP3 PUSH2 0x173B JUMP JUMPDEST PUSH2 0x1714 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 0xC81 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xCAD JUMPI DUP2 PUSH2 0xC97 DUP9 DUP3 PUSH2 0xC20 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xC84 JUMP JUMPDEST POP POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xCC8 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH2 0xCD6 PUSH2 0xC57 DUP3 PUSH2 0x173B 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 0xCFB JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xCAD JUMPI DUP2 PUSH2 0xD11 DUP9 DUP3 PUSH2 0xDE4 JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP1 SWAP3 ADD SWAP2 PUSH1 0x60 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xCFE JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xD3A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xD48 PUSH2 0xC57 DUP3 PUSH2 0x173B 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 0xCAD JUMPI DUP2 CALLDATALOAD DUP7 ADD PUSH2 0xD70 DUP9 DUP3 PUSH2 0xE3F JUMP JUMPDEST DUP5 MSTORE POP PUSH1 0x20 SWAP3 DUP4 ADD SWAP3 SWAP2 SWAP1 SWAP2 ADD SWAP1 PUSH1 0x1 ADD PUSH2 0xD5A JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP3 MLOAD PUSH2 0x17F3 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP3 MLOAD PUSH2 0x17C5 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1F DUP3 ADD DUP4 SGT PUSH2 0xDAF JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0xDBD PUSH2 0xC57 DUP3 PUSH2 0x175C JUMP JUMPDEST SWAP2 POP DUP1 DUP3 MSTORE PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP4 ADD DUP6 DUP4 DUP4 ADD GT ISZERO PUSH2 0xDD9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x91C DUP4 DUP3 DUP5 PUSH2 0x17F8 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xDF6 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xE00 PUSH1 0x60 PUSH2 0x1714 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0xE0E DUP5 DUP5 PUSH2 0xF94 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0xE1F DUP5 DUP5 DUP4 ADD PUSH2 0xD92 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0xE33 DUP5 DUP3 DUP6 ADD PUSH2 0xD92 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x180 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xE52 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xE5D PUSH2 0x180 PUSH2 0x1714 JUMP JUMPDEST SWAP1 POP PUSH1 0x0 PUSH2 0xE6B DUP5 DUP5 PUSH2 0xC20 JUMP JUMPDEST DUP3 MSTORE POP PUSH1 0x20 PUSH2 0xE7C DUP5 DUP5 DUP4 ADD PUSH2 0xC20 JUMP JUMPDEST PUSH1 0x20 DUP4 ADD MSTORE POP PUSH1 0x40 PUSH2 0xE90 DUP5 DUP3 DUP6 ADD PUSH2 0xC20 JUMP JUMPDEST PUSH1 0x40 DUP4 ADD MSTORE POP PUSH1 0x60 PUSH2 0xEA4 DUP5 DUP3 DUP6 ADD PUSH2 0xC20 JUMP JUMPDEST PUSH1 0x60 DUP4 ADD MSTORE POP PUSH1 0x80 PUSH2 0xEB8 DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH1 0x80 DUP4 ADD MSTORE POP PUSH1 0xA0 PUSH2 0xECC DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH1 0xA0 DUP4 ADD MSTORE POP PUSH1 0xC0 PUSH2 0xEE0 DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH1 0xC0 DUP4 ADD MSTORE POP PUSH1 0xE0 PUSH2 0xEF4 DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH1 0xE0 DUP4 ADD MSTORE POP PUSH2 0x100 PUSH2 0xF09 DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH2 0x100 DUP4 ADD MSTORE POP PUSH2 0x120 PUSH2 0xF1F DUP5 DUP3 DUP6 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH2 0x120 DUP4 ADD MSTORE POP PUSH2 0x140 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xF41 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xF4D DUP5 DUP3 DUP6 ADD PUSH2 0xD9E JUMP JUMPDEST PUSH2 0x140 DUP4 ADD MSTORE POP PUSH2 0x160 DUP3 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0xF6F JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xF7B DUP5 DUP3 DUP6 ADD PUSH2 0xD9E JUMP JUMPDEST PUSH2 0x160 DUP4 ADD MSTORE POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP3 CALLDATALOAD PUSH2 0x17C5 JUMP JUMPDEST PUSH1 0x0 PUSH2 0xB68 DUP3 MLOAD PUSH2 0x17ED JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xFB2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xFBE DUP5 DUP5 PUSH2 0xC2C JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xFD9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xFE5 DUP6 DUP6 PUSH2 0xC20 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1002 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x100E DUP6 DUP3 DUP7 ADD PUSH2 0xD9E JUMP JUMPDEST SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x102B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0x1037 DUP6 DUP6 PUSH2 0xC20 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x100E DUP6 DUP3 DUP7 ADD PUSH2 0xF88 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x105A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1071 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0xFBE DUP5 DUP3 DUP6 ADD PUSH2 0xCB7 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x1090 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x10A7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x10B3 DUP6 DUP3 DUP7 ADD PUSH2 0xD29 JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x10D0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x100E DUP6 DUP3 DUP7 ADD PUSH2 0xC38 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x10EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xFBE DUP5 DUP5 PUSH2 0xD86 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x110C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xFBE DUP5 DUP5 PUSH2 0xDE4 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x112B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT ISZERO PUSH2 0x1142 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x114E DUP6 DUP3 DUP7 ADD PUSH2 0xE3F JUMP JUMPDEST SWAP3 POP POP PUSH1 0x20 PUSH2 0x100E DUP6 DUP3 DUP7 ADD PUSH2 0xC20 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x1171 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x0 PUSH2 0xFBE DUP5 DUP5 PUSH2 0xD92 JUMP JUMPDEST PUSH2 0x1186 DUP2 PUSH2 0x17AC JUMP JUMPDEST DUP3 MSTORE POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1197 DUP3 PUSH2 0x17A8 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x11A9 DUP4 PUSH2 0x17A2 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x11D9 JUMPI PUSH2 0x11BF DUP7 DUP4 MLOAD PUSH2 0x1411 JUMP JUMPDEST PUSH2 0x11C8 DUP3 PUSH2 0x17A2 JUMP JUMPDEST PUSH1 0x60 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x11AC JUMP JUMPDEST POP SWAP4 SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x11EE DUP3 PUSH2 0x17A8 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP DUP4 PUSH1 0x20 DUP3 MUL DUP6 ADD PUSH2 0x1207 DUP6 PUSH2 0x17A2 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP5 DUP2 LT ISZERO PUSH2 0x123E JUMPI DUP4 DUP4 SUB DUP9 MSTORE PUSH2 0x1222 DUP4 DUP4 MLOAD PUSH2 0x144E JUMP JUMPDEST SWAP3 POP PUSH2 0x122D DUP3 PUSH2 0x17A2 JUMP JUMPDEST PUSH1 0x20 SWAP9 SWAP1 SWAP9 ADD SWAP8 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x120A JUMP JUMPDEST POP SWAP1 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1255 DUP3 PUSH2 0x17A8 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH1 0x20 DUP5 ADD SWAP4 POP PUSH2 0x1267 DUP4 PUSH2 0x17A2 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP3 DUP2 LT ISZERO PUSH2 0x11D9 JUMPI PUSH2 0x127D DUP7 DUP4 MLOAD PUSH2 0x1551 JUMP JUMPDEST PUSH2 0x1286 DUP3 PUSH2 0x17A2 JUMP JUMPDEST PUSH2 0x100 SWAP7 SWAP1 SWAP7 ADD SWAP6 SWAP2 POP PUSH1 0x1 ADD PUSH2 0x126A JUMP JUMPDEST PUSH2 0x1186 DUP2 PUSH2 0x17C5 JUMP JUMPDEST PUSH2 0x1186 DUP2 PUSH2 0x17C8 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x12B5 DUP3 PUSH2 0x17A8 JUMP JUMPDEST DUP1 DUP5 MSTORE PUSH2 0x12C9 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0x1804 JUMP JUMPDEST PUSH2 0x12D2 DUP2 PUSH2 0x1830 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 0x1422 DUP5 DUP3 PUSH2 0x15E8 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x1435 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x1448 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x0 SWAP1 PUSH2 0x180 DUP5 ADD SWAP1 PUSH2 0x1463 DUP6 DUP3 PUSH2 0x117D JUMP JUMPDEST POP PUSH1 0x20 DUP4 ADD MLOAD PUSH2 0x1476 PUSH1 0x20 DUP7 ADD DUP3 PUSH2 0x117D JUMP JUMPDEST POP PUSH1 0x40 DUP4 ADD MLOAD PUSH2 0x1489 PUSH1 0x40 DUP7 ADD DUP3 PUSH2 0x117D JUMP JUMPDEST POP PUSH1 0x60 DUP4 ADD MLOAD PUSH2 0x149C PUSH1 0x60 DUP7 ADD DUP3 PUSH2 0x117D JUMP JUMPDEST POP PUSH1 0x80 DUP4 ADD MLOAD PUSH2 0x14AF PUSH1 0x80 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xA0 DUP4 ADD MLOAD PUSH2 0x14C2 PUSH1 0xA0 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xC0 DUP4 ADD MLOAD PUSH2 0x14D5 PUSH1 0xC0 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xE0 DUP4 ADD MLOAD PUSH2 0x14E8 PUSH1 0xE0 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH2 0x100 DUP4 ADD MLOAD PUSH2 0x14FD PUSH2 0x100 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH2 0x120 DUP4 ADD MLOAD PUSH2 0x1512 PUSH2 0x120 DUP7 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH2 0x140 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x140 DUP7 ADD MSTORE PUSH2 0x152C DUP3 DUP3 PUSH2 0x12AA JUMP JUMPDEST SWAP2 POP POP PUSH2 0x160 DUP4 ADD MLOAD DUP5 DUP3 SUB PUSH2 0x160 DUP7 ADD MSTORE PUSH2 0x1548 DUP3 DUP3 PUSH2 0x12AA JUMP JUMPDEST SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST DUP1 MLOAD PUSH2 0x100 DUP4 ADD SWAP1 PUSH2 0x1563 DUP5 DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0x20 DUP3 ADD MLOAD PUSH2 0x1576 PUSH1 0x20 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD PUSH2 0x1589 PUSH1 0x40 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD PUSH2 0x159C PUSH1 0x60 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0x80 DUP3 ADD MLOAD PUSH2 0x15AF PUSH1 0x80 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xA0 DUP3 ADD MLOAD PUSH2 0x15C2 PUSH1 0xA0 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xC0 DUP3 ADD MLOAD PUSH2 0x15D5 PUSH1 0xC0 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST POP PUSH1 0xE0 DUP3 ADD MLOAD PUSH2 0x1448 PUSH1 0xE0 DUP6 ADD DUP3 PUSH2 0x1298 JUMP JUMPDEST PUSH2 0x1186 DUP2 PUSH2 0x17ED JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x96A DUP3 DUP5 PUSH2 0x117D JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x160D DUP3 DUP6 PUSH2 0x117D JUMP JUMPDEST PUSH2 0xB68 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x117D JUMP JUMPDEST PUSH1 0x40 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x162B DUP2 DUP6 PUSH2 0x118C JUMP JUMPDEST SWAP1 POP DUP2 DUP2 SUB PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0xFBE DUP2 DUP5 PUSH2 0x124A JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB68 DUP2 DUP5 PUSH2 0x11E3 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB68 DUP2 DUP5 PUSH2 0x124A JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x96A DUP3 DUP5 PUSH2 0x12A1 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x96A DUP2 PUSH2 0x12DF JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x96A DUP2 PUSH2 0x1335 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x96A DUP2 PUSH2 0x1365 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0x96A DUP2 PUSH2 0x13BB JUMP JUMPDEST PUSH2 0x160 DUP2 ADD PUSH2 0x16BE DUP3 DUP6 PUSH2 0x1411 JUMP JUMPDEST PUSH2 0xB68 PUSH1 0x60 DUP4 ADD DUP5 PUSH2 0x1551 JUMP JUMPDEST PUSH1 0x20 DUP1 DUP3 MSTORE DUP2 ADD PUSH2 0xB68 DUP2 DUP5 PUSH2 0x144E JUMP JUMPDEST PUSH2 0x100 DUP2 ADD PUSH2 0x96A DUP3 DUP5 PUSH2 0x1551 JUMP JUMPDEST PUSH1 0x20 DUP2 ADD PUSH2 0x96A DUP3 DUP5 PUSH2 0x1298 JUMP JUMPDEST PUSH1 0x40 DUP2 ADD PUSH2 0x1707 DUP3 DUP6 PUSH2 0x1298 JUMP JUMPDEST PUSH2 0xB68 PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0x1298 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP2 DUP2 ADD PUSH8 0xFFFFFFFFFFFFFFFF DUP2 GT DUP3 DUP3 LT OR ISZERO PUSH2 0x1733 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1752 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x20 SWAP1 DUP2 MUL ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT ISZERO PUSH2 0x1773 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 0x181F JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x1807 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x1448 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP1 JUMP STOP LOG2 PUSH6 0x627A7A723058 KECCAK256 SMOD TIMESTAMP MSIZE CODESIZE NUMBER 0xde DIV 0xcc 0xb4 TIMESTAMP CALLCODE 0x5f 0x24 PUSH21 0xFF7A322E1281CDB1232118C18B3985166E7F6C6578 PUSH17 0x6572696D656E74616CF500370000000000 ", - "sourceMap": "898:7576:11:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2336:352;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2336:352:11;;;;;;;;;;;;;;;;;;;;;;;;;;5614:1359;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5614:1359:11;;;;;;;;;;;;;;;;;;3018:384;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3018:384:11;;;;;;;;;;;;;;;;;;4716:452;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4716:452:11;;;;;;;;;;;;;;;;;7258:1214;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7258:1214:11;;;;;;;;;;;;;;;;;3661:739;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3661:739:11;;;;;;;;;;;;;;;;;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:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2556:28:11;;;;;;;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:11;;;;;;;;;2544:40;;2607:34;2621:5;2628:12;2607:13;:34::i;:::-;2594:47;-1:-1:-1;2336:352:11;;;;;:::o;5614:1359::-;5731:15;;;;;;;;5803:23;:9;5731:15;5803:23;:20;:23;:::i;:::-;5781:45;-1:-1:-1;5852:25:11;:9;5874:2;5852:25;:21;:25;:::i;:::-;5908:8;;:36;;;;;5836:41;;-1:-1:-1;5908:8:11;;;:22;;:36;;5931:12;;5908:36;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5908:36:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5908:36:11;;;;;;;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:11;;;;;;;;;977:32;;;;;;;;;;;;;;;;5887:57;;-1:-1:-1;5959:29:11;;;;;;;5955:975;;;6043:36;;;;;:28;;;;;;:36;;6072:6;;6043:36;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6043:36:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6043:36:11;;;;;;;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:11;;;;;;;;;6137:48;;;;;6033:46;;-1:-1:-1;6137:28:11;;;;;;:48;;6166:6;;6174:10;;6137:48;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6137:48:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6137:48:11;;;;;;;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:11;;;;;;;;;6125:60;;5955:975;;;1065: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:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6607:56:11;;;;;;;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:11;;;;;;;;;: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:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6667:40:11;;;;;;;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:11;;;;;;;;;: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:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3261:30:11;;;;;;39:16:-1;36:1;17:17;2:54;101:4;3261:30:11;80:15:-1;;;97:9;76:31;65:43;;120:4;113:20;3261:30:11;;;;;;;;;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;7258:1214::-;7364:13;7477:2;7471:9;7574:66;7565:7;7558:83;7678:7;7674:1;7665:7;7661:15;7654:32;8100:2;8047:7;7990:2;7943:7;7894:5;7849:3;7821:332;8280:7;8277:2;;;8321:7;8315:14;8306:23;;8277:2;-1:-1:-1;;7258:1214:11;;;;;:::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:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;15559:559:48:-;15679:13;15741:5;15749:1;15741:9;15729:1;:8;:21;;15708:105;;;;;;;;;;;;;;;;-1:-1:-1;;15869:2:48;15862:10;15856:17;16012:66;16000:79;;15559:559::o;10259:886::-;10380:14;10443:5;10451:2;10443:10;10431:1;:8;:22;;10410:135;;;;;;;;;;;;;;;;-1:-1:-1;11047:13:48;10792:2;11047:13;11041:20;11063:42;11037:69;;10259:886::o;14699:195::-;14820:14;14865:21;14877:1;14880:5;14865:11;:21::i;:::-;14857:30;14699:195;-1:-1:-1;;;14699:195:48:o;13281:490::-;13402:14;13465:5;13473:2;13465:10;13453:1;:8;:22;;13432:107;;;;;;;;;;;;;;;;-1:-1:-1;13718:13:48;13620:2;13718:13;13712:20;;13281:490::o;898:7576:11:-;;;;;;;;;-1:-1:-1;898:7576:11;;;;;;;;;;;;;;;;;:::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;;;;;;;;1028:791;;1172:4;1160:17;;1156:27;-1:-1;1146:2;;1197:1;1194;1187:12;1146:2;1227:6;1221:13;1249:103;1264:87;1344:6;1264:87;;1249:103;1240:112;;1369:5;1394:6;1387:5;1380:21;1424:4;1416:6;1412:17;1402:27;;1446:4;1441:3;1437:14;1430:21;;1499:6;1546:3;1538:4;1530:6;1526:17;1521:3;1517:27;1514:36;1511:2;;;1563:1;1560;1553:12;1511:2;1588:1;1573:240;1598:6;1595:1;1592:13;1573:240;;;1656:3;1678:71;1745:3;1733:10;1678:71;;;1666:84;;-1:-1;1773:4;1764:14;;;;1801:4;1792:14;;;;;1620:1;1613:9;1573:240;;1859:735;;1988:4;1976:17;;1972:27;-1:-1;1962:2;;2013:1;2010;2003:12;1962:2;2050:6;2037:20;2072:99;2087:83;2163:6;2087:83;;2072:99;2199:21;;;2243:4;2231:17;;;;2063:108;;-1:-1;2256:14;;2231:17;2351:1;2336:252;2361:6;2358:1;2355:13;2336:252;;;2444:3;2431:17;2423:6;2419:30;2468:56;2520:3;2508:10;2468:56;;;2456:69;;-1:-1;2548:4;2539:14;;;;2567;;;;;2383:1;2376:9;2336:252;;2602:116;;2677:36;2705:6;2699:13;2677:36;;2725:122;;2803:39;2834:6;2828:13;2803:39;;2855:432;;2945:4;2933:17;;2929:27;-1:-1;2919:2;;2970:1;2967;2960:12;2919:2;3007:6;2994:20;3029:60;3044:44;3081:6;3044:44;;3029:60;3020:69;;3109:6;3102:5;3095:21;3145:4;3137:6;3133:17;3178:4;3171:5;3167:16;3213:3;3204:6;3199:3;3195:16;3192:25;3189:2;;;3230:1;3227;3220:12;3189:2;3240:41;3274:6;3269:3;3264;3240:41;;3776:685;;3899:4;3887:9;3882:3;3878:19;3874:30;3871:2;;;3917:1;3914;3907:12;3871:2;3935:20;3950:4;3935:20;;;3926:29;-1:-1;4012:1;4043:58;4097:3;4077:9;4043:58;;;4019:83;;-1:-1;4168:2;4201:60;4257:3;4233:22;;;4201:60;;;4194:4;4187:5;4183:16;4176:86;4123:150;4346:2;4379:60;4435:3;4426:6;4415:9;4411:22;4379:60;;;4372:4;4365:5;4361:16;4354:86;4283:168;3865:596;;;;;5224:2205;;5332:5;5320:9;5315:3;5311:19;5307:31;5304:2;;;5351:1;5348;5341:12;5304:2;5369:21;5384:5;5369:21;;;5360:30;-1:-1;5448:1;5479:49;5524:3;5504:9;5479:49;;;5455:74;;-1:-1;5598:2;5631:49;5676:3;5652:22;;;5631:49;;;5624:4;5617:5;5613:16;5606:75;5550:142;5757:2;5790:49;5835:3;5826:6;5815:9;5811:22;5790:49;;;5783:4;5776:5;5772:16;5765:75;5702:149;5910:2;5943:49;5988:3;5979:6;5968:9;5964:22;5943:49;;;5936:4;5929:5;5925:16;5918:75;5861:143;6066:3;6100:49;6145:3;6136:6;6125:9;6121:22;6100:49;;;6093:4;6086:5;6082:16;6075:75;6014:147;6223:3;6257:49;6302:3;6293:6;6282:9;6278:22;6257:49;;;6250:4;6243:5;6239:16;6232:75;6171:147;6372:3;6406:49;6451:3;6442:6;6431:9;6427:22;6406:49;;;6399:4;6392:5;6388:16;6381:75;6328:139;6521:3;6555:49;6600:3;6591:6;6580:9;6576:22;6555:49;;;6548:4;6541:5;6537:16;6530:75;6477:139;6683:3;6718:49;6763:3;6754:6;6743:9;6739:22;6718:49;;;6710:5;6703;6699:17;6692:76;6626:153;6829:3;6864:49;6909:3;6900:6;6889:9;6885:22;6864:49;;;6856:5;6849;6845:17;6838:76;6789:136;7013:3;7002:9;6998:19;6985:33;7038:18;7030:6;7027:30;7024:2;;;7070:1;7067;7060:12;7024:2;7106:54;7156:3;7147:6;7136:9;7132:22;7106:54;;;7098:5;7091;7087:17;7080:81;6935:237;7260:3;7249:9;7245:19;7232:33;7285:18;7277:6;7274:30;7271:2;;;7317:1;7314;7307:12;7271:2;7353:54;7403:3;7394:6;7383:9;7379:22;7353:54;;;7345:5;7338;7334:17;7327:81;7182:237;5298:2131;;;;;9680:118;;9747:46;9785:6;9772:20;9747:46;;9934:118;;10010:37;10039:6;10033:13;10010:37;;10059:263;;10174:2;10162:9;10153:7;10149:23;10145:32;10142:2;;;10190:1;10187;10180:12;10142:2;10225:1;10242:64;10298:7;10278:9;10242:64;;;10232:74;10136:186;-1:-1;;;;10136:186;10329:470;;;10459:2;10447:9;10438:7;10434:23;10430:32;10427:2;;;10475:1;10472;10465:12;10427:2;10510:1;10527:53;10572:7;10552:9;10527:53;;;10517:63;;10489:97;10645:2;10634:9;10630:18;10617:32;10669:18;10661:6;10658:30;10655:2;;;10701:1;10698;10691:12;10655:2;10721:62;10775:7;10766:6;10755:9;10751:22;10721:62;;;10711:72;;10596:193;10421:378;;;;;;10806:366;;;10927:2;10915:9;10906:7;10902:23;10898:32;10895:2;;;10943:1;10940;10933:12;10895:2;10978:1;10995:53;11040:7;11020:9;10995:53;;;10985:63;;10957:97;11085:2;11103:53;11148:7;11139:6;11128:9;11124:22;11103:53;;11179:438;;11342:2;11330:9;11321:7;11317:23;11313:32;11310:2;;;11358:1;11355;11348:12;11310:2;11393:24;;11437:18;11426:30;;11423:2;;;11469:1;11466;11459:12;11423:2;11489:112;11593:7;11584:6;11573:9;11569:22;11489:112;;11624:676;;;11814:2;11802:9;11793:7;11789:23;11785:32;11782:2;;;11830:1;11827;11820:12;11782:2;11865:31;;11916:18;11905:30;;11902:2;;;11948:1;11945;11938:12;11902:2;11968:97;12057:7;12048:6;12037:9;12033:22;11968:97;;;11958:107;;11844:227;12130:2;12119:9;12115:18;12102:32;12154:18;12146:6;12143:30;12140:2;;;12186:1;12183;12176:12;12140:2;12206:78;12276:7;12267:6;12256:9;12252:22;12206:78;;12307:257;;12419:2;12407:9;12398:7;12394:23;12390:32;12387:2;;;12435:1;12432;12425:12;12387:2;12470:1;12487:61;12540:7;12520:9;12487:61;;12571:317;;12713:2;12701:9;12692:7;12688:23;12684:32;12681:2;;;12729:1;12726;12719:12;12681:2;12764:1;12781:91;12864:7;12844:9;12781:91;;12895:498;;;13039:2;13027:9;13018:7;13014:23;13010:32;13007:2;;;13055:1;13052;13045:12;13007:2;13090:31;;13141:18;13130:30;;13127:2;;;13173:1;13170;13163:12;13127:2;13193:76;13261:7;13252:6;13241:9;13237:22;13193:76;;;13183:86;;13069:206;13306:2;13324:53;13369:7;13360:6;13349:9;13345:22;13324:53;;13400:263;;13515:2;13503:9;13494:7;13490:23;13486:32;13483:2;;;13531:1;13528;13521:12;13483:2;13566:1;13583:64;13639:7;13619:9;13583:64;;13670:110;13743:31;13768:5;13743:31;;;13738:3;13731:44;13725:55;;;13854:755;;14035:77;14106:5;14035:77;;;14130:6;14125:3;14118:19;14154:4;14149:3;14145:14;14138:21;;14199:79;14272:5;14199:79;;;14299:1;14284:303;14309:6;14306:1;14303:13;14284:303;;;14349:103;14448:3;14439:6;14433:13;14349:103;;;14469:83;14545:6;14469:83;;;14575:4;14566:14;;;;;14459:93;-1:-1;14331:1;14324:9;14284:303;;;-1:-1;14600:3;;14014:595;-1:-1;;;;14014:595;14676:864;;14849:73;14916:5;14849:73;;;14940:6;14935:3;14928:19;14964:4;14959:3;14955:14;14948:21;;15012:3;15054:4;15046:6;15042:17;15037:3;15033:27;15080:75;15149:5;15080:75;;;15176:1;15161:340;15186:6;15183:1;15180:13;15161:340;;;15248:9;15242:4;15238:20;15233:3;15226:33;15274:96;15365:4;15356:6;15350:13;15274:96;;;15266:104;;15387:79;15459:6;15387:79;;;15489:4;15480:14;;;;;15377:89;-1:-1;15208:1;15201:9;15161:340;;;-1:-1;15514:4;;14828:712;-1:-1;;;;;;14828:712;15629:749;;15808:76;15878:5;15808:76;;;15902:6;15897:3;15890:19;15926:4;15921:3;15917:14;15910:21;;15971:78;16043:5;15971:78;;;16070:1;16055:301;16080:6;16077:1;16074:13;16055:301;;;16120:101;16217:3;16208:6;16202:13;16120:101;;;16238:82;16313:6;16238:82;;;16343:5;16334:15;;;;;16228:92;-1:-1;16102:1;16095:9;16055:301;;16386:110;16459:31;16484:5;16459:31;;16503:107;16574:30;16598:5;16574:30;;16617:289;;16713:34;16741:5;16713:34;;;16764:6;16759:3;16752:19;16776:63;16832:6;16825:4;16820:3;16816:14;16809:4;16802:5;16798:16;16776:63;;;16871:29;16893:6;16871:29;;;16851:50;;;16864:4;16851:50;;16693:213;-1:-1;;;16693:213;16914:397;17069:2;17057:15;;17106:66;17101:2;17092:12;;17085:88;17207:66;17202:2;17193:12;;17186:88;17302:2;17293:12;;17050:261;17320:296;17475:2;17463:15;;17512:66;17507:2;17498:12;;17491:88;17607:2;17598:12;;17456:160;17625:397;17780:2;17768:15;;17817:66;17812:2;17803:12;;17796:88;17918:66;17913:2;17904:12;;17897:88;18013:2;18004:12;;17761:261;18031:397;18186:2;18174:15;;18223:66;18218:2;18209:12;;18202:88;18324:66;18319:2;18310:12;;18303:88;18419:2;18410:12;;18167:261;18497:695;18710:22;;18634:4;18625:14;;;18744:57;18629:3;18710:22;18744:57;;;18654:159;18894:4;18887:5;18883:16;18877:23;18912:62;18968:4;18963:3;18959:14;18946:11;18912:62;;;18823:163;19085:4;19078:5;19074:16;19068:23;19103:62;19159:4;19154:3;19150:14;19137:11;19103:62;;;18996:181;18607:585;;;;20011:2419;20226:22;;20011:2419;;20148:5;20139:15;;;20260:61;20143:3;20226:22;20260:61;;;20169:164;20417:4;20410:5;20406:16;20400:23;20435:62;20491:4;20486:3;20482:14;20469:11;20435:62;;;20343:166;20600:4;20593:5;20589:16;20583:23;20618:62;20674:4;20669:3;20665:14;20652:11;20618:62;;;20519:173;20777:4;20770:5;20766:16;20760:23;20795:62;20851:4;20846:3;20842:14;20829:11;20795:62;;;20702:167;20957:4;20950:5;20946:16;20940:23;20975:62;21031:4;21026:3;21022:14;21009:11;20975:62;;;20879:170;21137:4;21130:5;21126:16;21120:23;21155:62;21211:4;21206:3;21202:14;21189:11;21155:62;;;21059:170;21309:4;21302:5;21298:16;21292:23;21327:62;21383:4;21378:3;21374:14;21361:11;21327:62;;;21239:162;21481:4;21474:5;21470:16;21464:23;21499:62;21555:4;21550:3;21546:14;21533:11;21499:62;;;21411:162;21666:5;21659;21655:17;21649:24;21685:63;21741:5;21736:3;21732:15;21719:11;21685:63;;;21583:177;21836:5;21829;21825:17;21819:24;21855:63;21911:5;21906:3;21902:15;21889:11;21855:63;;;21770:160;22016:5;22009;22005:17;21999:24;22069:3;22063:4;22059:14;22051:5;22046:3;22042:15;22035:39;22089:66;22150:4;22137:11;22089:66;;;22081:74;;21940:227;22253:5;22246;22242:17;22236:24;22306:3;22300:4;22296:14;22288:5;22283:3;22279:15;22272:39;22326:66;22387:4;22374:11;22326:66;;;22318:74;20121:2309;-1:-1;;;;;20121:2309;24987:1587;25200:22;;25122:5;25113:15;;;25234:61;25117:3;25200:22;25234:61;;;25143:164;25393:4;25386:5;25382:16;25376:23;25411:62;25467:4;25462:3;25458:14;25445:11;25411:62;;;25317:168;25569:4;25562:5;25558:16;25552:23;25587:62;25643:4;25638:3;25634:14;25621:11;25587:62;;;25495:166;25747:4;25740:5;25736:16;25730:23;25765:62;25821:4;25816:3;25812:14;25799:11;25765:62;;;25671:168;25926:4;25919:5;25915:16;25909:23;25944:62;26000:4;25995:3;25991:14;25978:11;25944:62;;;25849:169;26107:4;26100:5;26096:16;26090:23;26125:62;26181:4;26176:3;26172:14;26159:11;26125:62;;;26028:171;26286:4;26279:5;26275:16;26269:23;26304:62;26360:4;26355:3;26351:14;26338:11;26304:62;;;26209:169;26467:4;26460:5;26456:16;26450:23;26485:62;26541:4;26536:3;26532:14;26519:11;26485:62;;28363:104;28432:29;28455:5;28432:29;;28474:193;28582:2;28567:18;;28596:61;28571:9;28630:6;28596:61;;28674:294;28810:2;28795:18;;28824:61;28799:9;28858:6;28824:61;;;28896:62;28954:2;28943:9;28939:18;28930:6;28896:62;;28975:770;29301:2;29315:47;;;29286:18;;29376:144;29286:18;29506:6;29376:144;;;29368:152;;29568:9;29562:4;29558:20;29553:2;29542:9;29538:18;29531:48;29593:142;29730:4;29721:6;29593:142;;29752:417;29948:2;29962:47;;;29933:18;;30023:136;29933:18;30145:6;30023:136;;30176:429;30378:2;30392:47;;;30363:18;;30453:142;30363:18;30581:6;30453:142;;30612:189;30718:2;30703:18;;30732:59;30707:9;30764:6;30732:59;;30808:387;30989:2;31003:47;;;30974:18;;31064:121;30974:18;31064:121;;31202:387;31383:2;31397:47;;;31368:18;;31458:121;31368:18;31458:121;;31596:387;31777:2;31791:47;;;31762:18;;31852:121;31762:18;31852:121;;31990:387;32171:2;32185:47;;;32156:18;;32246:121;32156:18;32246:121;;32384:507;32626:3;32611:19;;32641:115;32615:9;32729:6;32641:115;;;32767:114;32877:2;32866:9;32862:18;32853:6;32767:114;;32898:333;33052:2;33066:47;;;33037:18;;33127:94;33037:18;33207:6;33127:94;;33238:298;33398:3;33383:19;;33413:113;33387:9;33499:6;33413:113;;33543:193;33651:2;33636:18;;33665:61;33640:9;33699:6;33665:61;;33743:294;33879:2;33864:18;;33893:61;33868:9;33927:6;33893:61;;;33965:62;34023:2;34012:9;34008:18;33999:6;33965:62;;34044:256;34106:2;34100:9;34132:17;;;34207:18;34192:34;;34228:22;;;34189:62;34186:2;;;34264:1;34261;34254:12;34186:2;34280;34273:22;34084:216;;-1:-1;34084:216;34307:258;;34466:18;34458:6;34455:30;34452:2;;;34498:1;34495;34488:12;34452:2;-1:-1;34527:4;34515:17;;;34545:15;;34389:176;35144:254;;35283:18;35275:6;35272:30;35269:2;;;35315:1;35312;35305:12;35269:2;-1:-1;35388:4;35359;35336:17;;;;35355:9;35332:33;35378:15;;35206:192;35672:144;35804:4;35792:17;;35773:43;36130:130;36243:12;;36227:33;37087:128;37167:42;37156:54;;37139:76;37222:79;37291:5;37274:27;37308:151;37387:66;37376:78;;37359:100;37552:88;37630:4;37619:16;;37602:38;37782:92;37855:13;37848:21;;37831:43;38149:145;38230:6;38225:3;38220;38207:30;-1:-1;38286:1;38268:16;;38261:27;38200:94;38303:268;38368:1;38375:101;38389:6;38386:1;38383:13;38375:101;;;38456:11;;;38450:18;38437:11;;;38430:39;38411:2;38404:10;38375:101;;;38491:6;38488:1;38485:13;38482:2;;;-1:-1;;38556:1;38538:16;;38531:27;38352:219;38579:97;38667:2;38647:14;38663:7;38643:28;;38627:49" + "object": "0x6080604052600436106100825763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304ad1e5381146100875780632cd0fc73146100be5780634b95de13146100ec578063690d31141461011a578063b698846314610147578063c6b7f4ee14610174578063f241ffb0146101a2575b600080fd5b34801561009357600080fd5b506100a76100a23660046112d3565b6101cf565b6040516100b59291906118dc565b60405180910390f35b3480156100ca57600080fd5b506100de6100d936600461118b565b61029c565b6040516100b5929190611926565b3480156100f857600080fd5b5061010c610107366004611238565b6107cd565b6040516100b5929190611822565b34801561012657600080fd5b5061013a610135366004611238565b6108a4565b6040516100b59190611858565b34801561015357600080fd5b506101676101623660046111d3565b61095e565b6040516100b591906117f9565b34801561018057600080fd5b5061019461018f366004611139565b6109a9565b6040516100b5929190611869565b3480156101ae57600080fd5b506101c26101bd3660046112d3565b610a86565b6040516100b59190611909565b6101d7610cd0565b6101df610cf0565b6000546040517fc75e0a8100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063c75e0a81906102359087906004016118f8565b606060405180830381600087803b15801561024f57600080fd5b505af1158015610263573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061028791908101906112b5565b91506102938484610a86565b90509250929050565b6000808080808080806102b5898263ffffffff610ba416565b95506102c889601063ffffffff610c1116565b6000546040517f6070410800000000000000000000000000000000000000000000000000000000815291965073ffffffffffffffffffffffffffffffffffffffff169063607041089061031f90899060040161188e565b602060405180830381600087803b15801561033957600080fd5b505af115801561034d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103719190810190611113565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190209094507fffffffff0000000000000000000000000000000000000000000000000000000087811691161415610526576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616906370a0823190610424908d906004016117f9565b602060405180830381600087803b15801561043e57600080fd5b505af1158015610452573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610476919081019061131a565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815290985073ffffffffffffffffffffffffffffffffffffffff86169063dd62ed3e906104cd908d908890600401611807565b602060405180830381600087803b1580156104e757600080fd5b505af11580156104fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061051f919081019061131a565b96506107c0565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190207fffffffff00000000000000000000000000000000000000000000000000000000878116911614156107855761059589602463ffffffff610c7216565b92506105a1858461095e565b91508173ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16146105dd5760006105e0565b60015b60ff1697508473ffffffffffffffffffffffffffffffffffffffff1663e985e9c58b866040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161063c929190611807565b602060405180830381600087803b15801561065657600080fd5b505af115801561066a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061068e9190810190611297565b8061076a57508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1663081812fc856040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016107009190611918565b602060405180830381600087803b15801561071a57600080fd5b505af115801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506107529190810190611113565b73ffffffffffffffffffffffffffffffffffffffff16145b90508061077857600061077b565b60015b60ff1696506107c0565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118ac565b60405180910390fd5b5050505050509250929050565b6000546040517f7e9d74dc000000000000000000000000000000000000000000000000000000008152606091829173ffffffffffffffffffffffffffffffffffffffff90911690637e9d74dc90610828908790600401611847565b600060405180830381600087803b15801561084257600080fd5b505af1158015610856573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261089c9190810190611203565b915061029384845b606060006060600085519250826040519080825280602002602001820160405280156108ea57816020015b6108d7610cf0565b8152602001906001900390816108cf5790505b509150600090505b80831461095157610931868281518110151561090a57fe5b90602001906020020151868381518110151561092257fe5b90602001906020020151610a86565b828281518110151561093f57fe5b602090810290910101526001016108f2565b8193505b50505092915050565b60006040517f6352211e000000000000000000000000000000000000000000000000000000008152826004820152602081602483875afa80156109a057815192505b50505b92915050565b6060806000606080600086519350836040519080825280602002602001820160405280156109e1578160200160208202803883390190505b50925083604051908082528060200260200182016040528015610a0e578160200160208202803883390190505b509150600090505b808414610a7957610a3e888883815181101515610a2f57fe5b9060200190602002015161029c565b8483815181101515610a4c57fe5b9060200190602002018484815181101515610a6357fe5b6020908102909101019190915252600101610a16565b5090969095509350505050565b610a8e610cf0565b6060610aa3846000015185610140015161029c565b60208401528252610160840151610abb90849061029c565b60608401526040808401919091526001805482516020601f60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101008688161502019094169390930492830181900481028201810190945281815292830182828015610b6a5780601f10610b3f57610100808354040283529160200191610b6a565b820191906000526020600020905b815481529060010190602001808311610b4d57829003601f168201915b50505050509050610b7f84600001518261029c565b60a08401526080830152610b93838261029c565b60e084015260c08301525092915050565b600081600401835110151515610be6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118cc565b5050602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b600081601401835110151515610c53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b7906118bc565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b6000610c7e8383610c85565b9392505050565b600081602001835110151515610cc7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b79061189c565b50016020015190565b604080516060810182526000808252602082018190529181019190915290565b6101006040519081016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6000610c7e82356119d9565b6000610c7e82516119d9565b6000601f82018313610d5f57600080fd5b8135610d72610d6d82611968565b611941565b91508181835260208401935060208101905083856020840282011115610d9757600080fd5b60005b83811015610dc35781610dad8882610d36565b8452506020928301929190910190600101610d9a565b5050505092915050565b6000601f82018313610dde57600080fd5b8135610dec610d6d82611968565b81815260209384019390925082018360005b83811015610dc35781358601610e148882610f11565b8452506020928301929190910190600101610dfe565b6000601f82018313610e3b57600080fd5b8151610e49610d6d82611968565b91508181835260208401935060208101905083856060840282011115610e6e57600080fd5b60005b83811015610dc35781610e848882610f57565b84525060209092019160609190910190600101610e71565b6000601f82018313610ead57600080fd5b8135610ebb610d6d82611968565b81815260209384019390925082018360005b83811015610dc35781358601610ee38882610fb2565b8452506020928301929190910190600101610ecd565b6000610c7e8251611a20565b6000610c7e82516119f2565b6000601f82018313610f2257600080fd5b8135610f30610d6d82611989565b91508082526020830160208301858383011115610f4c57600080fd5b610955838284611a25565b600060608284031215610f6957600080fd5b610f736060611941565b90506000610f818484611107565b8252506020610f9284848301610f05565b6020830152506040610fa684828501610f05565b60408301525092915050565b60006101808284031215610fc557600080fd5b610fd0610180611941565b90506000610fde8484610d36565b8252506020610fef84848301610d36565b602083015250604061100384828501610d36565b604083015250606061101784828501610d36565b606083015250608061102b848285016110fb565b60808301525060a061103f848285016110fb565b60a08301525060c0611053848285016110fb565b60c08301525060e0611067848285016110fb565b60e08301525061010061107c848285016110fb565b61010083015250610120611092848285016110fb565b6101208301525061014082013567ffffffffffffffff8111156110b457600080fd5b6110c084828501610f11565b6101408301525061016082013567ffffffffffffffff8111156110e257600080fd5b6110ee84828501610f11565b6101608301525092915050565b6000610c7e82356119f2565b6000610c7e8251611a1a565b60006020828403121561112557600080fd5b60006111318484610d42565b949350505050565b6000806040838503121561114c57600080fd5b60006111588585610d36565b925050602083013567ffffffffffffffff81111561117557600080fd5b61118185828601610dcd565b9150509250929050565b6000806040838503121561119e57600080fd5b60006111aa8585610d36565b925050602083013567ffffffffffffffff8111156111c757600080fd5b61118185828601610f11565b600080604083850312156111e657600080fd5b60006111f28585610d36565b9250506020611181858286016110fb565b60006020828403121561121557600080fd5b815167ffffffffffffffff81111561122c57600080fd5b61113184828501610e2a565b6000806040838503121561124b57600080fd5b823567ffffffffffffffff81111561126257600080fd5b61126e85828601610e9c565b925050602083013567ffffffffffffffff81111561128b57600080fd5b61118185828601610d4e565b6000602082840312156112a957600080fd5b60006111318484610ef9565b6000606082840312156112c757600080fd5b60006111318484610f57565b600080604083850312156112e657600080fd5b823567ffffffffffffffff8111156112fd57600080fd5b61130985828601610fb2565b925050602061118185828601610d36565b60006020828403121561132c57600080fd5b60006111318484610f05565b611341816119d9565b82525050565b6000611352826119d5565b808452602084019350611364836119cf565b60005b828110156113945761137a868351611619565b611383826119cf565b606096909601959150600101611367565b5093949350505050565b60006113a9826119d5565b808452602084019350836020820285016113c2856119cf565b60005b848110156113f95783830388526113dd838351611656565b92506113e8826119cf565b6020989098019791506001016113c5565b50909695505050505050565b6000611410826119d5565b808452602084019350611422836119cf565b60005b8281101561139457611438868351611759565b611441826119cf565b61010096909601959150600101611425565b600061145e826119d5565b808452602084019350611470836119cf565b60005b82811015611394576114868683516114a0565b61148f826119cf565b602096909601959150600101611473565b611341816119f2565b611341816119f5565b60006114bd826119d5565b8084526114d1816020860160208601611a31565b6114da81611a5d565b9093016020019392505050565b602681527f475245415445525f4f525f455155414c5f544f5f33325f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b601781527f554e535550504f525445445f41535345545f50524f5859000000000000000000602082015260400190565b602681527f475245415445525f4f525f455155414c5f544f5f32305f4c454e4754485f524560208201527f5155495245440000000000000000000000000000000000000000000000000000604082015260600190565b602581527f475245415445525f4f525f455155414c5f544f5f345f4c454e4754485f52455160208201527f5549524544000000000000000000000000000000000000000000000000000000604082015260600190565b8051606083019061162a84826117f0565b50602082015161163d60208501826114a0565b50604082015161165060408501826114a0565b50505050565b805160009061018084019061166b8582611338565b50602083015161167e6020860182611338565b5060408301516116916040860182611338565b5060608301516116a46060860182611338565b5060808301516116b760808601826114a0565b5060a08301516116ca60a08601826114a0565b5060c08301516116dd60c08601826114a0565b5060e08301516116f060e08601826114a0565b506101008301516117056101008601826114a0565b5061012083015161171a6101208601826114a0565b5061014083015184820361014086015261173482826114b2565b91505061016083015184820361016086015261175082826114b2565b95945050505050565b805161010083019061176b84826114a0565b50602082015161177e60208501826114a0565b50604082015161179160408501826114a0565b5060608201516117a460608501826114a0565b5060808201516117b760808501826114a0565b5060a08201516117ca60a08501826114a0565b5060c08201516117dd60c08501826114a0565b5060e082015161165060e08501826114a0565b61134181611a1a565b602081016109a38284611338565b604081016118158285611338565b610c7e6020830184611338565b604080825281016118338185611347565b905081810360208301526111318184611405565b60208082528101610c7e818461139e565b60208082528101610c7e8184611405565b6040808252810161187a8185611453565b905081810360208301526111318184611453565b602081016109a382846114a9565b602080825281016109a3816114e7565b602080825281016109a38161153d565b602080825281016109a38161156d565b602080825281016109a3816115c3565b61016081016118eb8285611619565b610c7e6060830184611759565b60208082528101610c7e8184611656565b61010081016109a38284611759565b602081016109a382846114a0565b6040810161193482856114a0565b610c7e60208301846114a0565b60405181810167ffffffffffffffff8111828210171561196057600080fd5b604052919050565b600067ffffffffffffffff82111561197f57600080fd5b5060209081020190565b600067ffffffffffffffff8211156119a057600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60200190565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b60ff1690565b151590565b82818337506000910152565b60005b83811015611a4c578181015183820152602001611a34565b838111156116505750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820d3d495bc287663ed8cb2a513cfad47804ffa6e4ad0cfa6d0d0eadf1f907483586c6578706572696d656e74616cf50037", + "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 POP 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 0xd3 0xd4 SWAP6 0xbc 0x28 PUSH23 0x63ED8CB2A513CFAD47804FFA6E4AD0CFA6D0D0EADF1F90 PUSH21 0x83586C6578706572696D656E74616CF50037000000 ", + "sourceMap": "898:8536:11:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2336:352;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2336:352:11;;;;;;;;;;;;;;;;;;;;;;;;;;5614:1359;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;5614:1359:11;;;;;;;;;;;;;;;;;;3018:384;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3018:384:11;;;;;;;;;;;;;;;;;;4716:452;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4716:452:11;;;;;;;;;;;;;;;;;8218:1214;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;8218:1214:11;;;;;;;;;;;;;;;;;7416:517;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;7416:517:11;;;;;;;;;;;;;;;;;;3661:739;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3661:739:11;;;;;;;;;;;;;;;;;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:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2556:28:11;;;;;;;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:11;;;;;;;;;2544:40;;2607:34;2621:5;2628:12;2607:13;:34::i;:::-;2594:47;-1:-1:-1;2336:352:11;;;;;:::o;5614:1359::-;5731:15;;;;;;;;5803:23;:9;5731:15;5803:23;:20;:23;:::i;:::-;5781:45;-1:-1:-1;5852:25:11;:9;5874:2;5852:25;:21;:25;:::i;:::-;5908:8;;:36;;;;;5836:41;;-1:-1:-1;5908:8:11;;;:22;;:36;;5931:12;;5908:36;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;5908:36:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;5908:36:11;;;;;;;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:11;;;;;;;;;977:32;;;;;;;;;;;;;;;;5887:57;;-1:-1:-1;5959:29:11;;;;;;;5955:975;;;6043:36;;;;;:28;;;;;;:36;;6072:6;;6043:36;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6043:36:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6043:36:11;;;;;;;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:11;;;;;;;;;6137:48;;;;;6033:46;;-1:-1:-1;6137:28:11;;;;;;:48;;6166:6;;6174:10;;6137:48;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;6137:48:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6137:48:11;;;;;;;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:11;;;;;;;;;6125:60;;5955:975;;;1065: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:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6607:56:11;;;;;;;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:11;;;;;;;;;: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:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;6667:40:11;;;;;;;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:11;;;;;;;;;: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:11;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3261:30:11;;;;;;39:16:-1;36:1;17:17;2:54;101:4;3261:30:11;80:15:-1;;;97:9;76:31;65:43;;120:4;113:20;3261:30:11;;;;;;;;;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:11;;;;;:::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:11;;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:11;;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:11;;7915:10;;-1:-1:-1;7416:517:11;-1:-1:-1;;;;7416:517:11: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:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;15559:559:53:-;15679:13;15741:5;15749:1;15741:9;15729:1;:8;:21;;15708:105;;;;;;;;;;;;;;;;-1:-1:-1;;15869:2:53;15862:10;15856:17;16012:66;16000:79;;15559:559::o;10259:886::-;10380:14;10443:5;10451:2;10443:10;10431:1;:8;:22;;10410:135;;;;;;;;;;;;;;;;-1:-1:-1;11047:13:53;10792:2;11047:13;11041:20;11063:42;11037:69;;10259:886::o;14699:195::-;14820:14;14865:21;14877:1;14880:5;14865:11;:21::i;:::-;14857:30;14699:195;-1:-1:-1;;;14699:195:53:o;13281:490::-;13402:14;13465:5;13473:2;13465:10;13453:1;:8;:22;;13432:107;;;;;;;;;;;;;;;;-1:-1:-1;13718:13:53;13620:2;13718:13;13712:20;;13281:490::o;898:8536:11:-;;;;;;;;;-1:-1:-1;898:8536:11;;;;;;;;;;;;;;;;;:::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:749;;17044:76;17114:5;17044:76;;;17138:6;17133:3;17126:19;17162:4;17157:3;17153:14;17146:21;;17207:78;17279:5;17207:78;;;17306:1;17291:301;17316:6;17313:1;17310:13;17291:301;;;17356:101;17453:3;17444:6;17438:13;17356:101;;;17474:82;17549:6;17474:82;;;17579:5;17570:15;;;;;17464:92;-1:-1;17338:1;17331:9;17291:301;;17653:590;;17788:54;17836:5;17788:54;;;17860:6;17855:3;17848:19;17884:4;17879:3;17875:14;17868:21;;17929:56;17979:5;17929:56;;;18006:1;17991:230;18016:6;18013:1;18010:13;17991:230;;;18056:53;18105:3;18096:6;18090:13;18056:53;;;18126:60;18179:6;18126:60;;;18209:4;18200:14;;;;;18116:70;-1:-1;18038:1;18031:9;17991:230;;18251:110;18324:31;18349:5;18324:31;;18368:107;18439:30;18463:5;18439:30;;18482:289;;18578:34;18606:5;18578:34;;;18629:6;18624:3;18617:19;18641:63;18697:6;18690:4;18685:3;18681:14;18674:4;18667:5;18663:16;18641:63;;;18736:29;18758:6;18736:29;;;18716:50;;;18729:4;18716:50;;18558:213;-1:-1;;;18558:213;18779:397;18934:2;18922:15;;18971:66;18966:2;18957:12;;18950:88;19072:66;19067:2;19058:12;;19051:88;19167:2;19158:12;;18915:261;19185:296;19340:2;19328:15;;19377:66;19372:2;19363:12;;19356:88;19472:2;19463:12;;19321:160;19490:397;19645:2;19633:15;;19682:66;19677:2;19668:12;;19661:88;19783:66;19778:2;19769:12;;19762:88;19878:2;19869:12;;19626:261;19896:397;20051:2;20039:15;;20088:66;20083:2;20074:12;;20067:88;20189:66;20184:2;20175:12;;20168:88;20284:2;20275:12;;20032:261;20362:695;20575:22;;20499:4;20490:14;;;20609:57;20494:3;20575:22;20609:57;;;20519:159;20759:4;20752:5;20748:16;20742:23;20777:62;20833:4;20828:3;20824:14;20811:11;20777:62;;;20688:163;20950:4;20943:5;20939:16;20933:23;20968:62;21024:4;21019:3;21015:14;21002:11;20968:62;;;20861:181;20472:585;;;;21876:2419;22091:22;;21876:2419;;22013:5;22004:15;;;22125:61;22008:3;22091:22;22125:61;;;22034:164;22282:4;22275:5;22271:16;22265:23;22300:62;22356:4;22351:3;22347:14;22334:11;22300:62;;;22208:166;22465:4;22458:5;22454:16;22448:23;22483:62;22539:4;22534:3;22530:14;22517:11;22483:62;;;22384:173;22642:4;22635:5;22631:16;22625:23;22660:62;22716:4;22711:3;22707:14;22694:11;22660:62;;;22567:167;22822:4;22815:5;22811:16;22805:23;22840:62;22896:4;22891:3;22887:14;22874:11;22840:62;;;22744:170;23002:4;22995:5;22991:16;22985:23;23020:62;23076:4;23071:3;23067:14;23054:11;23020:62;;;22924:170;23174:4;23167:5;23163:16;23157:23;23192:62;23248:4;23243:3;23239:14;23226:11;23192:62;;;23104:162;23346:4;23339:5;23335:16;23329:23;23364:62;23420:4;23415:3;23411:14;23398:11;23364:62;;;23276:162;23531:5;23524;23520:17;23514:24;23550:63;23606:5;23601:3;23597:15;23584:11;23550:63;;;23448:177;23701:5;23694;23690:17;23684:24;23720:63;23776:5;23771:3;23767:15;23754:11;23720:63;;;23635:160;23881:5;23874;23870:17;23864:24;23934:3;23928:4;23924:14;23916:5;23911:3;23907:15;23900:39;23954:66;24015:4;24002:11;23954:66;;;23946:74;;23805:227;24118:5;24111;24107:17;24101:24;24171:3;24165:4;24161:14;24153:5;24148:3;24144:15;24137:39;24191:66;24252:4;24239:11;24191:66;;;24183:74;21986:2309;-1:-1;;;;;21986:2309;26852:1587;27065:22;;26987:5;26978:15;;;27099:61;26982:3;27065:22;27099:61;;;27008:164;27258:4;27251:5;27247:16;27241:23;27276:62;27332:4;27327:3;27323:14;27310:11;27276:62;;;27182:168;27434:4;27427:5;27423:16;27417:23;27452:62;27508:4;27503:3;27499:14;27486:11;27452:62;;;27360:166;27612:4;27605:5;27601:16;27595:23;27630:62;27686:4;27681:3;27677:14;27664:11;27630:62;;;27536:168;27791:4;27784:5;27780:16;27774:23;27809:62;27865:4;27860:3;27856:14;27843:11;27809:62;;;27714:169;27972:4;27965:5;27961:16;27955:23;27990:62;28046:4;28041:3;28037:14;28024:11;27990:62;;;27893:171;28151:4;28144:5;28140:16;28134:23;28169:62;28225:4;28220:3;28216:14;28203:11;28169:62;;;28074:169;28332:4;28325:5;28321:16;28315:23;28350:62;28406:4;28401:3;28397:14;28384:11;28350:62;;30228:104;30297:29;30320:5;30297:29;;30339:193;30447:2;30432:18;;30461:61;30436:9;30495:6;30461:61;;30539:294;30675:2;30660:18;;30689:61;30664:9;30723:6;30689:61;;;30761:62;30819:2;30808:9;30804:18;30795:6;30761:62;;30840:770;31166:2;31180:47;;;31151:18;;31241:144;31151:18;31371:6;31241:144;;;31233:152;;31433:9;31427:4;31423:20;31418:2;31407:9;31403:18;31396:48;31458:142;31595:4;31586:6;31458:142;;31617:417;31813:2;31827:47;;;31798:18;;31888:136;31798:18;32010:6;31888:136;;32041:429;32243:2;32257:47;;;32228:18;;32318:142;32228:18;32446:6;32318:142;;32477:590;32713:2;32727:47;;;32698:18;;32788:98;32698:18;32872:6;32788:98;;;32780:106;;32934:9;32928:4;32924:20;32919:2;32908:9;32904:18;32897:48;32959:98;33052:4;33043:6;32959:98;;33074:189;33180:2;33165:18;;33194:59;33169:9;33226:6;33194:59;;33270:387;33451:2;33465:47;;;33436:18;;33526:121;33436:18;33526:121;;33664:387;33845:2;33859:47;;;33830:18;;33920:121;33830:18;33920:121;;34058:387;34239:2;34253:47;;;34224:18;;34314:121;34224:18;34314:121;;34452:387;34633:2;34647:47;;;34618:18;;34708:121;34618:18;34708:121;;34846:507;35088:3;35073:19;;35103:115;35077:9;35191:6;35103:115;;;35229:114;35339:2;35328:9;35324:18;35315:6;35229:114;;35360:333;35514:2;35528:47;;;35499:18;;35589:94;35499:18;35669:6;35589:94;;35700:298;35860:3;35845:19;;35875:113;35849:9;35961:6;35875:113;;36005:193;36113:2;36098:18;;36127:61;36102:9;36161:6;36127:61;;36205:294;36341:2;36326:18;;36355:61;36330:9;36389:6;36355:61;;;36427:62;36485:2;36474:9;36470:18;36461:6;36427:62;;36506:256;36568:2;36562:9;36594:17;;;36669:18;36654:34;;36690:22;;;36651:62;36648:2;;;36726:1;36723;36716:12;36648:2;36742;36735:22;36546:216;;-1:-1;36546:216;36769:258;;36928:18;36920:6;36917:30;36914:2;;;36960:1;36957;36950:12;36914:2;-1:-1;36989:4;36977:17;;;37007:15;;36851:176;37876:254;;38015:18;38007:6;38004:30;38001:2;;;38047:1;38044;38037:12;38001:2;-1:-1;38120:4;38091;38068:17;;;;38087:9;38064:33;38110:15;;37938:192;38404:144;38536:4;38524:17;;38505:43;38994:130;39107:12;;39091:33;40196:128;40276:42;40265:54;;40248:76;40331:79;40400:5;40383:27;40417:151;40496:66;40485:78;;40468:100;40661:88;40739:4;40728:16;;40711:38;40891:92;40964:13;40957:21;;40940:43;41258:145;41339:6;41334:3;41329;41316:30;-1:-1;41395:1;41377:16;;41370:27;41309:94;41412:268;41477:1;41484:101;41498:6;41495:1;41492:13;41484:101;;;41565:11;;;41559:18;41546:11;;;41539:39;41520:2;41513:10;41484:101;;;41600:6;41597:1;41594:13;41591:2;;;-1:-1;;41665:1;41647:16;;41640:27;41461:219;41688:97;41776:2;41756:14;41772:7;41752:28;;41736:49" } } }, @@ -585,149 +612,171 @@ "2.0.0/extensions/OrderValidator/OrderValidator.sol": { "id": 11 }, - "2.0.0/protocol/AssetProxy/interfaces/IAssetProxy.sol": { + "2.0.0/protocol/AssetProxy/ERC20Proxy.sol": { "id": 12 }, - "2.0.0/protocol/AssetProxy/interfaces/IAuthorizable.sol": { + "2.0.0/protocol/AssetProxy/ERC721Proxy.sol": { "id": 13 }, - "2.0.0/protocol/Exchange/Exchange.sol": { + "2.0.0/protocol/AssetProxy/MixinAuthorizable.sol": { "id": 14 }, - "2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol": { + "2.0.0/protocol/AssetProxy/interfaces/IAssetProxy.sol": { "id": 15 }, - "2.0.0/protocol/Exchange/MixinExchangeCore.sol": { + "2.0.0/protocol/AssetProxy/interfaces/IAuthorizable.sol": { "id": 16 }, - "2.0.0/protocol/Exchange/MixinMatchOrders.sol": { + "2.0.0/protocol/AssetProxy/mixins/MAuthorizable.sol": { "id": 17 }, - "2.0.0/protocol/Exchange/MixinSignatureValidator.sol": { + "2.0.0/protocol/Exchange/Exchange.sol": { "id": 18 }, - "2.0.0/protocol/Exchange/MixinTransactions.sol": { + "2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol": { "id": 19 }, - "2.0.0/protocol/Exchange/MixinWrapperFunctions.sol": { + "2.0.0/protocol/Exchange/MixinExchangeCore.sol": { "id": 20 }, - "2.0.0/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": { + "2.0.0/protocol/Exchange/MixinMatchOrders.sol": { "id": 21 }, - "2.0.0/protocol/Exchange/interfaces/IExchange.sol": { + "2.0.0/protocol/Exchange/MixinSignatureValidator.sol": { "id": 22 }, - "2.0.0/protocol/Exchange/interfaces/IExchangeCore.sol": { + "2.0.0/protocol/Exchange/MixinTransactions.sol": { "id": 23 }, - "2.0.0/protocol/Exchange/interfaces/IMatchOrders.sol": { + "2.0.0/protocol/Exchange/MixinWrapperFunctions.sol": { "id": 24 }, - "2.0.0/protocol/Exchange/interfaces/ISignatureValidator.sol": { + "2.0.0/protocol/Exchange/interfaces/IAssetProxyDispatcher.sol": { "id": 25 }, - "2.0.0/protocol/Exchange/interfaces/ITransactions.sol": { + "2.0.0/protocol/Exchange/interfaces/IExchange.sol": { "id": 26 }, - "2.0.0/protocol/Exchange/interfaces/IValidator.sol": { + "2.0.0/protocol/Exchange/interfaces/IExchangeCore.sol": { "id": 27 }, - "2.0.0/protocol/Exchange/interfaces/IWallet.sol": { + "2.0.0/protocol/Exchange/interfaces/IMatchOrders.sol": { "id": 28 }, - "2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol": { + "2.0.0/protocol/Exchange/interfaces/ISignatureValidator.sol": { "id": 29 }, - "2.0.0/protocol/Exchange/libs/LibAbiEncoder.sol": { + "2.0.0/protocol/Exchange/interfaces/ITransactions.sol": { "id": 30 }, - "2.0.0/protocol/Exchange/libs/LibConstants.sol": { + "2.0.0/protocol/Exchange/interfaces/IValidator.sol": { "id": 31 }, - "2.0.0/protocol/Exchange/libs/LibEIP712.sol": { + "2.0.0/protocol/Exchange/interfaces/IWallet.sol": { "id": 32 }, - "2.0.0/protocol/Exchange/libs/LibExchangeErrors.sol": { + "2.0.0/protocol/Exchange/interfaces/IWrapperFunctions.sol": { "id": 33 }, - "2.0.0/protocol/Exchange/libs/LibFillResults.sol": { + "2.0.0/protocol/Exchange/libs/LibAbiEncoder.sol": { "id": 34 }, - "2.0.0/protocol/Exchange/libs/LibMath.sol": { + "2.0.0/protocol/Exchange/libs/LibConstants.sol": { "id": 35 }, - "2.0.0/protocol/Exchange/libs/LibOrder.sol": { + "2.0.0/protocol/Exchange/libs/LibEIP712.sol": { "id": 36 }, - "2.0.0/protocol/Exchange/mixins/MAssetProxyDispatcher.sol": { + "2.0.0/protocol/Exchange/libs/LibExchangeErrors.sol": { "id": 37 }, - "2.0.0/protocol/Exchange/mixins/MExchangeCore.sol": { + "2.0.0/protocol/Exchange/libs/LibFillResults.sol": { "id": 38 }, - "2.0.0/protocol/Exchange/mixins/MMatchOrders.sol": { + "2.0.0/protocol/Exchange/libs/LibMath.sol": { "id": 39 }, - "2.0.0/protocol/Exchange/mixins/MSignatureValidator.sol": { + "2.0.0/protocol/Exchange/libs/LibOrder.sol": { "id": 40 }, - "2.0.0/protocol/Exchange/mixins/MTransactions.sol": { + "2.0.0/protocol/Exchange/mixins/MAssetProxyDispatcher.sol": { "id": 41 }, - "2.0.0/tokens/ERC20Token/ERC20Token.sol": { + "2.0.0/protocol/Exchange/mixins/MExchangeCore.sol": { "id": 42 }, - "2.0.0/tokens/ERC20Token/IERC20Token.sol": { + "2.0.0/protocol/Exchange/mixins/MMatchOrders.sol": { "id": 43 }, - "2.0.0/tokens/ERC721Token/ERC721Token.sol": { + "2.0.0/protocol/Exchange/mixins/MSignatureValidator.sol": { "id": 44 }, - "2.0.0/tokens/ERC721Token/IERC721Receiver.sol": { + "2.0.0/protocol/Exchange/mixins/MTransactions.sol": { "id": 45 }, - "2.0.0/tokens/ERC721Token/IERC721Token.sol": { + "2.0.0/protocol/Exchange/mixins/MWrapperFunctions.sol": { "id": 46 }, - "2.0.0/tokens/EtherToken/IEtherToken.sol": { + "2.0.0/tokens/ERC20Token/ERC20Token.sol": { "id": 47 }, - "2.0.0/utils/LibBytes/LibBytes.sol": { + "2.0.0/tokens/ERC20Token/IERC20Token.sol": { "id": 48 }, - "2.0.0/utils/Ownable/IOwnable.sol": { + "2.0.0/tokens/ERC721Token/ERC721Token.sol": { "id": 49 }, - "2.0.0/utils/Ownable/Ownable.sol": { + "2.0.0/tokens/ERC721Token/IERC721Receiver.sol": { "id": 50 }, - "2.0.0/utils/SafeMath/SafeMath.sol": { + "2.0.0/tokens/ERC721Token/IERC721Token.sol": { "id": 51 + }, + "2.0.0/tokens/EtherToken/IEtherToken.sol": { + "id": 52 + }, + "2.0.0/utils/LibBytes/LibBytes.sol": { + "id": 53 + }, + "2.0.0/utils/Ownable/IOwnable.sol": { + "id": 54 + }, + "2.0.0/utils/Ownable/Ownable.sol": { + "id": 55 + }, + "2.0.0/utils/ReentrancyGuard/ReentrancyGuard.sol": { + "id": 56 + }, + "2.0.0/utils/SafeMath/SafeMath.sol": { + "id": 57 } }, "sourceCodes": { - "2.0.0/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\n constructor (\n address _exchange,\n address _etherToken,\n address _zrxToken,\n bytes memory _zrxAssetData,\n bytes memory _wethAssetData\n )\n public\n LibConstants(\n _exchange,\n _etherToken,\n _zrxToken,\n _zrxAssetData,\n _wethAssetData\n )\n MixinForwarderCore()\n {}\n}\n", + "2.0.0/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\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", "2.0.0/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\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", - "2.0.0/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\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, TODO: look into gas consumption of assert/throw\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 switch success\n case 0 {\n mstore(fillResults, 0)\n mstore(add(fillResults, 32), 0)\n mstore(add(fillResults, 64), 0)\n mstore(add(fillResults, 96), 0)\n }\n case 1 {\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 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 uint256 remainingTakerAssetFillAmount = getPartialAmount(\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 uint256 remainingWethSellAmount = getPartialAmount(\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 safeAdd(remainingWethSellAmount, 1), // we add 1 wei to the fill amount to make up for rounding errors\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", - "2.0.0/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\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 if (proxyAddress != address(0)) {\n ETHER_TOKEN.approve(proxyAddress, MAX_UINT);\n ZRX_TOKEN.approve(proxyAddress, MAX_UINT);\n }\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 = getPartialAmount(\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 = getPartialAmount(\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", - "2.0.0/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\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 = getPartialAmount(\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", + "2.0.0/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\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, TODO: look into gas consumption of assert/throw\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 switch success\n case 0 {\n mstore(fillResults, 0)\n mstore(add(fillResults, 32), 0)\n mstore(add(fillResults, 64), 0)\n mstore(add(fillResults, 96), 0)\n }\n case 1 {\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 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 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 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 uint256 remainingWethSellAmount = getPartialAmountFloor(\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 safeAdd(remainingWethSellAmount, 1), // we add 1 wei to the fill amount to make up for rounding errors\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", + "2.0.0/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\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 if (proxyAddress != address(0)) {\n ETHER_TOKEN.approve(proxyAddress, MAX_UINT);\n ZRX_TOKEN.approve(proxyAddress, MAX_UINT);\n }\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", + "2.0.0/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\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", "2.0.0/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", "2.0.0/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", - "2.0.0/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 \"../../../protocol/Exchange/interfaces/IExchange.sol\";\nimport \"../../../tokens/EtherToken/IEtherToken.sol\";\nimport \"../../../tokens/ERC20Token/IERC20Token.sol\";\n\n\ncontract LibConstants {\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 address _etherToken,\n address _zrxToken,\n bytes memory _zrxAssetData,\n bytes memory _wethAssetData\n )\n public\n {\n EXCHANGE = IExchange(_exchange);\n ETHER_TOKEN = IEtherToken(_etherToken);\n ZRX_TOKEN = IERC20Token(_zrxToken);\n ZRX_ASSET_DATA = _zrxAssetData;\n WETH_ASSET_DATA = _wethAssetData;\n }\n}\n", + "2.0.0/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", "2.0.0/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\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", "2.0.0/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", "2.0.0/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", - "2.0.0/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 bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256(\"ERC20Token(address)\"));\n bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256(\"ERC721Token(address,uint256)\"));\n\n using LibBytes for bytes;\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 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", + "2.0.0/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 bytes4 constant internal ERC20_DATA_ID = bytes4(keccak256(\"ERC20Token(address)\"));\n bytes4 constant internal ERC721_DATA_ID = bytes4(keccak256(\"ERC721Token(address,uint256)\"));\n\n using LibBytes for bytes;\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", + "2.0.0/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 \"../../utils/LibBytes/LibBytes.sol\";\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 /////// Token contract address ///////\n // The token address is found as follows:\n // * It is stored at offset 4 in `assetData` contents.\n // * This is stored at offset 32 from `assetData`.\n // * The offset to `assetData` from Params is stored at offset\n // 4 in calldata.\n // * The offset of Params in calldata is 4.\n // So we read location 4 and add 32 + 4 + 4 to it.\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", + "2.0.0/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 \"../../utils/LibBytes/LibBytes.sol\";\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 // 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", + "2.0.0/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\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", "2.0.0/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\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", "2.0.0/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\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", + "2.0.0/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\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", "2.0.0/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\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", - "2.0.0/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 \"../../utils/LibBytes/LibBytes.sol\";\nimport \"./mixins/MAssetProxyDispatcher.sol\";\nimport \"../AssetProxy/interfaces/IAssetProxy.sol\";\n\n\ncontract MixinAssetProxyDispatcher is\n Ownable,\n MAssetProxyDispatcher\n{\n using LibBytes for bytes;\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) {\n // Ensure assetData length is valid\n require(\n assetData.length > 3,\n \"LENGTH_GREATER_THAN_3_REQUIRED\"\n );\n \n // Lookup assetProxy\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", - "2.0.0/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 \"./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 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 {\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(makerAddress, senderAddress, newOrderEpoch);\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 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 // 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 takerAddress,\n takerAssetFillAmount,\n takerAssetFilledAmount,\n signature\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(order, takerAddress, fillResults);\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 {\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 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 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 takerAssetFillAmount Desired amount of order to fill by taker.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @param signature Proof that the orders was created by its maker.\n function assertValidFill(\n Order memory order,\n OrderInfo memory orderInfo,\n address takerAddress,\n uint256 takerAssetFillAmount,\n uint256 takerAssetFilledAmount,\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 // Revert if fill amount is invalid\n require(\n takerAssetFillAmount != 0,\n \"INVALID_TAKER_AMOUNT\"\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 // Validate fill order rounding\n require(\n !isRoundingError(\n takerAssetFilledAmount,\n order.takerAssetAmount,\n order.makerAssetAmount\n ),\n \"ROUNDING_ERROR\"\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 = getPartialAmount(\n takerAssetFilledAmount,\n order.takerAssetAmount,\n order.makerAssetAmount\n );\n fillResults.makerFeePaid = getPartialAmount(\n takerAssetFilledAmount,\n order.takerAssetAmount,\n order.makerFee\n );\n fillResults.takerFeePaid = getPartialAmount(\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", - "2.0.0/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 \"./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 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 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 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 takerAddress,\n matchedFillResults.left.takerAssetFilledAmount,\n matchedFillResults.left.takerAssetFilledAmount,\n leftSignature\n );\n assertValidFill(\n rightOrder,\n rightOrderInfo,\n takerAddress,\n matchedFillResults.right.takerAssetFilledAmount,\n matchedFillResults.right.takerAssetFilledAmount,\n rightSignature\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 // / >= / \n // AND\n // / >= / \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 // We settle orders at the exchange rate of the right order.\n // The amount saved by the left maker goes to the taker.\n // Either the left or right order will be fully filled; possibly both.\n // The left order is fully filled iff the right order can sell more than left can buy.\n // That is: the amount required to fill the left order is less than or equal to\n // the amount we can spend from the right order:\n // <= * \n // <= * / \n // * <= * \n uint256 leftTakerAssetAmountRemaining = safeSub(leftOrder.takerAssetAmount, leftOrderTakerAssetFilledAmount);\n uint256 rightTakerAssetAmountRemaining = safeSub(rightOrder.takerAssetAmount, rightOrderTakerAssetFilledAmount);\n uint256 leftTakerAssetFilledAmount;\n uint256 rightTakerAssetFilledAmount;\n if (\n safeMul(leftTakerAssetAmountRemaining, rightOrder.takerAssetAmount) <=\n safeMul(rightTakerAssetAmountRemaining, rightOrder.makerAssetAmount)\n ) {\n // Left order will be fully filled: maximally fill left\n leftTakerAssetFilledAmount = leftTakerAssetAmountRemaining;\n\n // The right order receives an amount proportional to how much was spent.\n rightTakerAssetFilledAmount = getPartialAmount(\n rightOrder.takerAssetAmount,\n rightOrder.makerAssetAmount,\n leftTakerAssetFilledAmount\n );\n } else {\n // Right order will be fully filled: maximally fill right\n rightTakerAssetFilledAmount = rightTakerAssetAmountRemaining;\n\n // The left order receives an amount proportional to how much was spent.\n leftTakerAssetFilledAmount = getPartialAmount(\n rightOrder.makerAssetAmount,\n rightOrder.takerAssetAmount,\n rightTakerAssetFilledAmount\n );\n }\n\n // Calculate fill results for left order\n matchedFillResults.left = calculateFillResults(\n leftOrder,\n leftTakerAssetFilledAmount\n );\n\n // Calculate fill results for right order\n matchedFillResults.right = calculateFillResults(\n rightOrder,\n rightTakerAssetFilledAmount\n );\n\n // Calculate amount given to taker\n matchedFillResults.leftMakerAssetSpreadAmount = safeSub(\n matchedFillResults.left.makerAssetFilledAmount,\n matchedFillResults.right.takerAssetFilledAmount\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", - "2.0.0/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 \"./mixins/MSignatureValidator.sol\";\nimport \"./mixins/MTransactions.sol\";\nimport \"./interfaces/IWallet.sol\";\nimport \"./interfaces/IValidator.sol\";\n\n\ncontract MixinSignatureValidator is\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 require(\n isValidSignature(\n hash,\n signerAddress,\n signature\n ),\n \"INVALID_SIGNATURE\"\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 {\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 // Implicitly signed by caller.\n // The signer has initiated the call. In the case of non-contract\n // accounts it means the transaction itself was signed.\n // Example: let's say for a particular operation three signatures\n // A, B and C are required. To submit the transaction, A and B can\n // give a signature to C, who can then submit the transaction using\n // `Caller` for his own signature. Or A and C can sign and B can\n // submit using `Caller`. Having `Caller` allows this flexibility.\n } else if (signatureType == SignatureType.Caller) {\n require(\n signature.length == 0,\n \"LENGTH_0_REQUIRED\"\n );\n isValid = signerAddress == msg.sender;\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 = IWallet(signerAddress).isValidSignature(hash, signature);\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 = IValidator(validatorAddress).isValidSignature(\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 // Signature from Trezor hardware wallet.\n // It differs from web3.eth_sign in the encoding of message length\n // (Bitcoin varint encoding vs ascii-decimal, the latter is not\n // self-terminating which leads to ambiguities).\n // See also:\n // https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer\n // https://github.com/trezor/trezor-mcu/blob/master/firmware/ethereum.c#L602\n // https://github.com/trezor/trezor-mcu/blob/master/firmware/crypto.c#L36\n } else if (signatureType == SignatureType.Trezor) {\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:\\n\\x20\",\n hash\n )),\n v,\n r,\n s\n );\n isValid = signerAddress == recovered;\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", - "2.0.0/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\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 // 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 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 contextAddress = currentContextAddress == address(0) ? msg.sender : currentContextAddress;\n return contextAddress;\n }\n}\n", - "2.0.0/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 \"./libs/LibMath.sol\";\nimport \"./libs/LibOrder.sol\";\nimport \"./libs/LibFillResults.sol\";\nimport \"./libs/LibAbiEncoder.sol\";\nimport \"./mixins/MExchangeCore.sol\";\n\n\ncontract MixinWrapperFunctions is\n LibMath,\n LibFillResults,\n LibAbiEncoder,\n MExchangeCore\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 fillOrKillOrder(\n LibOrder.Order memory order,\n uint256 takerAssetFillAmount,\n bytes memory signature\n )\n public\n returns (FillResults memory fillResults)\n {\n fillResults = fillOrder(\n order,\n takerAssetFillAmount,\n signature\n );\n require(\n fillResults.takerAssetFilledAmount == takerAssetFillAmount,\n \"COMPLETE_FILL_FAILED\"\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, TODO: look into gas consumption of assert/throw\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 switch success\n case 0 {\n mstore(fillResults, 0)\n mstore(add(fillResults, 32), 0)\n mstore(add(fillResults, 64), 0)\n mstore(add(fillResults, 96), 0)\n }\n case 1 {\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 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 returns (FillResults memory totalFillResults)\n {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n FillResults memory singleFillResults = fillOrder(\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 returns (FillResults memory totalFillResults)\n {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n FillResults memory singleFillResults = fillOrKillOrder(\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 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 = fillOrder(\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 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 = getPartialAmount(\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 = fillOrder(\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 = getPartialAmount(\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 {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n cancelOrder(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", + "2.0.0/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 \"../../utils/LibBytes/LibBytes.sol\";\nimport \"./mixins/MAssetProxyDispatcher.sol\";\nimport \"../AssetProxy/interfaces/IAssetProxy.sol\";\n\n\ncontract MixinAssetProxyDispatcher is\n Ownable,\n MAssetProxyDispatcher\n{\n using LibBytes for bytes;\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\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", + "2.0.0/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(makerAddress, senderAddress, newOrderEpoch);\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 // 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 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(order, takerAddress, fillResults);\n\n return fillResults;\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 // Validate fill order rounding\n require(\n !isRoundingErrorFloor(\n takerAssetFilledAmount,\n order.takerAssetAmount,\n order.makerAssetAmount\n ),\n \"ROUNDING_ERROR\"\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 = getPartialAmountFloor(\n takerAssetFilledAmount,\n order.takerAssetAmount,\n order.makerAssetAmount\n );\n fillResults.makerFeePaid = getPartialAmountFloor(\n takerAssetFilledAmount,\n order.takerAssetAmount,\n order.makerFee\n );\n fillResults.takerFeePaid = getPartialAmountFloor(\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", + "2.0.0/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 // / >= / \n // AND\n // / >= / \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 = getPartialAmountFloor(\n leftOrder.makerAssetAmount,\n leftOrder.takerAssetAmount,\n leftTakerAssetAmountRemaining\n );\n uint256 rightTakerAssetAmountRemaining = safeSub(rightOrder.takerAssetAmount, rightOrderTakerAssetFilledAmount);\n uint256 rightMakerAssetAmountRemaining = getPartialAmountFloor(\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 = getPartialAmountFloor(\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 = getPartialAmountCeil(\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 = getPartialAmountFloor(\n matchedFillResults.left.makerAssetFilledAmount,\n leftOrder.makerAssetAmount,\n leftOrder.makerFee\n );\n matchedFillResults.left.takerFeePaid = getPartialAmountFloor(\n matchedFillResults.left.takerAssetFilledAmount,\n leftOrder.takerAssetAmount,\n leftOrder.takerFee\n );\n\n // Compute fees for right order\n matchedFillResults.right.makerFeePaid = getPartialAmountFloor(\n matchedFillResults.right.makerAssetFilledAmount,\n rightOrder.makerAssetAmount,\n rightOrder.makerFee\n );\n matchedFillResults.right.takerFeePaid = getPartialAmountFloor(\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", + "2.0.0/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 input over output\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 input over output\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", + "2.0.0/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\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 // 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 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", + "2.0.0/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\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, TODO: look into gas consumption of assert/throw\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 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 {\n uint256 ordersLength = orders.length;\n for (uint256 i = 0; i != ordersLength; i++) {\n cancelOrder(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", "2.0.0/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", "2.0.0/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", "2.0.0/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", @@ -742,13 +791,14 @@ "2.0.0/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 // 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", "2.0.0/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", "2.0.0/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\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", - "2.0.0/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\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 getPartialAmount(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (uint256 partialAmount)\n {\n partialAmount = safeDiv(\n safeMul(numerator, target),\n denominator\n );\n return partialAmount;\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 isRoundingError(\n uint256 numerator,\n uint256 denominator,\n uint256 target\n )\n internal\n pure\n returns (bool isError)\n {\n uint256 remainder = mulmod(target, numerator, denominator);\n if (remainder == 0) {\n return false; // No rounding error.\n }\n\n uint256 errPercentageTimes1000000 = safeDiv(\n safeMul(remainder, 1000000),\n safeMul(numerator, target)\n );\n isError = errPercentageTimes1000000 > 1000;\n return isError;\n }\n}\n", + "2.0.0/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\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(target, numerator, denominator);\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(target, numerator, denominator);\n // TODO: safeMod\n remainder = safeSub(denominator, remainder) % denominator;\n isError = safeMul(1000, remainder) >= safeMul(numerator, target);\n return isError;\n }\n}\n", "2.0.0/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\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", "2.0.0/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\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", - "2.0.0/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 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 Status, orderHash, and amount already filled of order.\n /// @param takerAddress Address of order taker.\n /// @param takerAssetFillAmount Desired amount of order to fill by taker.\n /// @param takerAssetFilledAmount Amount of takerAsset that will be filled.\n /// @param signature Proof that the orders was created by its maker.\n function assertValidFill(\n LibOrder.Order memory order,\n LibOrder.OrderInfo memory orderInfo,\n address takerAddress,\n uint256 takerAssetFillAmount,\n uint256 takerAssetFilledAmount,\n bytes memory signature\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", + "2.0.0/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 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", "2.0.0/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\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", - "2.0.0/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 Caller, // 0x04\n Wallet, // 0x05\n Validator, // 0x06\n PreSigned, // 0x07\n Trezor, // 0x08\n NSignatureTypes // 0x09, number of signature types. Always leave at end.\n }\n}\n", + "2.0.0/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", "2.0.0/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\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", + "2.0.0/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 {\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", "2.0.0/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\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", "2.0.0/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", "2.0.0/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", @@ -758,9 +808,10 @@ "2.0.0/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 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 into.\n /// @param index Index in byte array of .\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 return uint256(readBytes32(b, index));\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert into.\n /// @param index Index in byte array of .\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 assembly {\n result := mload(add(b, 32))\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 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 into.\n /// @param index Index in byte array of .\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 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 into \n memCopy(\n b.contentAddress() + index,\n input.rawAddress(), // includes length of \n input.length + 32 // +32 bytes to store 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", "2.0.0/utils/Ownable/IOwnable.sol": "pragma solidity 0.4.24;\n\n/*\n * Ownable\n *\n * Base contract with an owner.\n * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.\n */\n\ncontract IOwnable {\n function transferOwnership(address newOwner)\n public;\n}\n", "2.0.0/utils/Ownable/Ownable.sol": "pragma solidity 0.4.24;\n\n/*\n * Ownable\n *\n * Base contract with an owner.\n * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.\n */\n\nimport \"./IOwnable.sol\";\n\n\ncontract Ownable is IOwnable {\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", + "2.0.0/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*/\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", "2.0.0/utils/SafeMath/SafeMath.sol": "pragma solidity 0.4.24;\n\n\ncontract SafeMath {\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": "0xd6d4955beb696b73455fe763da7472fba92d3695d0c0455879babc4fae8663d3", + "sourceTreeHashHex": "0x41709e5597b9934bd39ebbfec8bdc1b39fa4db97e459fb1f13047a8643a68e76", "compiler": { "name": "solc", "version": "soljson-v0.4.24+commit.e67f0147.js", -- cgit v1.2.3 From 7271fc0bab45c3d85acee102f2e5cf7ec1249268 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 13:49:44 -0700 Subject: Add getBalancesAndAllowances to wrapper --- .../contract_wrappers/order_validator_wrapper.ts | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'packages') diff --git a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts index b33428306..1da88f624 100644 --- a/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts +++ b/packages/contract-wrappers/src/contract_wrappers/order_validator_wrapper.ts @@ -126,6 +126,31 @@ export class OrderValidatorWrapper extends ContractWrapper { }; return result; } + /** + * Get an array of objects conforming to BalanceAndAllowance containing on-chain balance and allowance for some address and array of assetDatas + * @param address An ethereum address + * @param assetDatas An array of encoded strings that can be decoded by a specified proxy contract + * @return BalanceAndAllowance + */ + public async getBalancesAndAllowancesAsync(address: string, assetDatas: string[]): Promise { + assert.isETHAddressHex('address', address); + _.forEach(assetDatas, (assetData, index) => assert.isHexString(`assetDatas[${index}]`, assetData)); + const OrderValidatorContractInstance = await this._getOrderValidatorContractAsync(); + const balancesAndAllowances = await OrderValidatorContractInstance.getBalancesAndAllowances.callAsync( + address, + assetDatas, + ); + const balances = balancesAndAllowances[0]; + const allowances = balancesAndAllowances[1]; + const result = _.map(balances, (balance, index) => { + const allowance = allowances[index]; + return { + balance, + allowance, + }; + }); + return result; + } /** * Get owner address of tokenId by calling `token.ownerOf(tokenId)`, but returns a null owner instead of reverting on an unowned token. * @param tokenAddress An ethereum address -- cgit v1.2.3 From 0fd44ee2c1c436b7ce31c29259504d37dcd2423c Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 13:53:51 -0700 Subject: Fix broken test --- packages/contract-wrappers/test/order_validator_wrapper_test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/contract-wrappers/test/order_validator_wrapper_test.ts b/packages/contract-wrappers/test/order_validator_wrapper_test.ts index 0226adec7..2fdb00a71 100644 --- a/packages/contract-wrappers/test/order_validator_wrapper_test.ts +++ b/packages/contract-wrappers/test/order_validator_wrapper_test.ts @@ -5,6 +5,7 @@ import { DoneCallback, SignedOrder } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import { BlockParamLiteral } from 'ethereum-types'; +import * as _ from 'lodash'; import 'mocha'; import { ContractWrappers, ExchangeCancelEventArgs, ExchangeEvents, ExchangeFillEventArgs, OrderStatus } from '../src'; @@ -102,8 +103,8 @@ describe('OrderValidator', () => { signedOrders, takerAddresses, ); - ordersInfo = ordersAndTradersInfo.ordersInfo; - tradersInfo = ordersAndTradersInfo.tradersInfo; + ordersInfo = _.map(ordersAndTradersInfo, orderAndTraderInfo => orderAndTraderInfo.orderInfo); + tradersInfo = _.map(ordersAndTradersInfo, orderAndTraderInfo => orderAndTraderInfo.traderInfo); }); it('should return the same number of order infos and trader infos as input orders', async () => { expect(ordersInfo.length).to.be.equal(signedOrders.length); -- cgit v1.2.3 From ca0dfc6610aae3f675abdc77942291c7fc1f5909 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 13:57:48 -0700 Subject: Add contract-wrappers changelog entry for OrderValidatorWrapper --- packages/contract-wrappers/CHANGELOG.json | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'packages') diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json index b3c9b0fb3..b7c89a325 100644 --- a/packages/contract-wrappers/CHANGELOG.json +++ b/packages/contract-wrappers/CHANGELOG.json @@ -1,4 +1,12 @@ [ + { + "version": "1.0.1-rc.6", + "changes": [ + { + "note": "Add `OrderValidatorWrapper`" + } + ] + }, { "version": "1.0.1-rc.5", "changes": [ -- cgit v1.2.3 From 2c846ff1458e23de334434108e8a6c93dbb6f5cf Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 27 Aug 2018 16:06:34 -0700 Subject: Add OrderValidatorWrapper to public interface --- packages/0x.js/src/index.ts | 1 + packages/contract-wrappers/src/index.ts | 1 + 2 files changed, 2 insertions(+) (limited to 'packages') diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 7058a898f..6256181b6 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -9,6 +9,7 @@ export { ERC20ProxyWrapper, ERC721ProxyWrapper, ForwarderWrapper, + OrderValidatorWrapper, IndexedFilterValues, BlockRange, ContractWrappersConfig, diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 5e691fc21..348854fef 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -6,6 +6,7 @@ export { ExchangeWrapper } from './contract_wrappers/exchange_wrapper'; 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 { TransactionEncoder } from './utils/transaction_encoder'; -- cgit v1.2.3 From 5785ec0713c39466b3a6a171f5f0a2d38207b44b Mon Sep 17 00:00:00 2001 From: fragosti Date: Mon, 27 Aug 2018 18:29:35 -0700 Subject: Have new Popover component working in React 16 --- .../ts/components/top_bar/provider_display.tsx | 2 - packages/website/ts/components/top_bar/top_bar.tsx | 2 - packages/website/ts/components/ui/container.tsx | 8 +-- packages/website/ts/components/ui/drop_down.tsx | 43 ++++++++-------- packages/website/ts/components/ui/overlay.tsx | 2 +- packages/website/ts/components/ui/popover.tsx | 59 ++++++++++++++++++++++ packages/website/ts/components/wallet/wallet.tsx | 2 - packages/website/ts/types.ts | 5 -- 8 files changed, 84 insertions(+), 39 deletions(-) create mode 100644 packages/website/ts/components/ui/popover.tsx (limited to 'packages') diff --git a/packages/website/ts/components/top_bar/provider_display.tsx b/packages/website/ts/components/top_bar/provider_display.tsx index 806eaeea5..0a5c61776 100644 --- a/packages/website/ts/components/top_bar/provider_display.tsx +++ b/packages/website/ts/components/top_bar/provider_display.tsx @@ -61,8 +61,6 @@ export class ProviderDisplay extends React.Component
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 8580c3a6e..3eef17746 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -276,8 +276,6 @@ export class TopBar extends React.Component { { public static defaultProps: Partial = { style: DEFAULT_STYLE, zDepth: 1, - activateEvent: DropdownMouseEvent.Hover, - closeEvent: DropdownMouseEvent.Hover, + activateEvent: DropdownMouseEvent.Click, + closeEvent: DropdownMouseEvent.Click, }; private _popoverCloseCheckIntervalId: number; public static getDerivedStateFromProps(props: DropDownProps, state: DropDownState): Partial { @@ -70,24 +69,22 @@ export class DropDown extends React.Component { onMouseLeave={this._onHoverOff.bind(this)} >
{this.props.activeNode}
- -
- {this.props.popoverContent} -
-
+
+ {this.props.popoverContent} +
+ + } ); } diff --git a/packages/website/ts/components/ui/overlay.tsx b/packages/website/ts/components/ui/overlay.tsx index fc7507475..cb68aeca1 100644 --- a/packages/website/ts/components/ui/overlay.tsx +++ b/packages/website/ts/components/ui/overlay.tsx @@ -29,4 +29,4 @@ Overlay.defaultProps = { onClick: _.noop.bind(_), }; -Overlay.displayName = 'Overlay'; +Overlay.displayName = 'Overlay'; \ No newline at end of file diff --git a/packages/website/ts/components/ui/popover.tsx b/packages/website/ts/components/ui/popover.tsx new file mode 100644 index 000000000..66c0ac663 --- /dev/null +++ b/packages/website/ts/components/ui/popover.tsx @@ -0,0 +1,59 @@ +import * as _ from 'lodash'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import { Placement, Popper, PopperChildrenProps } from 'react-popper'; + +import { colors } from '@0xproject/react-shared'; +import { Container } from 'ts/components/ui/container'; +import { Overlay } from 'ts/components/ui/overlay'; +import { styled } from 'ts/style/theme'; + +export interface PopoverProps { + anchorEl: HTMLInputElement; + placement?: Placement; + onRequestClose?: () => void; + zIndex?: number; +} + +const PopoverContainer = styled.div` + background-color: ${colors.white}; + max-height: 679px; + overflow-y: auto; + border-radius: 2px; +`; + +const defaultPlacement: Placement = 'bottom'; + +export class Popover extends React.Component { + public static defaultProps = { + placement: defaultPlacement, + }; + + public render(): React.ReactNode { + const { anchorEl, placement, zIndex, onRequestClose } = this.props; + const overlayStyleOverrides = { + zIndex, + backgroundColor: 'transparent', + }; + return ( +
+ + + {this._renderPopperChildren.bind(this)} + +
+ ); + } + private _renderPopperChildren(props: PopperChildrenProps): React.ReactNode { + const popperContainerStyleOverrids = { + zIndex: _.isUndefined(this.props.zIndex) ? undefined : this.props.zIndex + 1, + }; + return ( +
+ + {this.props.children} + +
+ ); + } +} diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 6abaa840b..968377010 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -234,8 +234,6 @@ export class Wallet extends React.Component { {!isMobile && } } - anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }} - targetOrigin={{ horizontal: 'right', vertical: 'top' }} zDepth={1} activateEvent={DropdownMouseEvent.Click} closeEvent={DropdownMouseEvent.Click} diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index c637171dd..e76fae932 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -492,11 +492,6 @@ export enum Deco { Upper, } -export interface MaterialUIPosition { - vertical: 'bottom' | 'top' | 'center'; - horizontal: 'left' | 'middle' | 'right'; -} - export enum Providers { Parity = 'PARITY', Metamask = 'METAMASK', -- cgit v1.2.3 From 9c4c4fb19ac14d19a1f13e1a2a9b3b8ca1fa83bc Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 28 Aug 2018 12:03:21 -0700 Subject: Export missing types and add OrderValidatorWrapper to hidden constructors --- packages/0x.js/src/index.ts | 3 +++ packages/contract-wrappers/src/index.ts | 3 +++ packages/monorepo-scripts/src/doc_gen_configs.ts | 1 + 3 files changed, 7 insertions(+) (limited to 'packages') diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 6256181b6..17511f468 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -43,6 +43,9 @@ export { DecodedLogEvent, ExchangeEventArgs, TransactionEncoder, + BalanceAndAllowance, + OrderAndTraderInfo, + TraderInfo, } from '@0xproject/contract-wrappers'; export { OrderWatcher, OnOrderStateChangeCallback, OrderWatcherConfig } from '@0xproject/order-watcher'; diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 348854fef..b66d8460e 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -22,6 +22,9 @@ export { OrderInfo, EventCallback, DecodedLogEvent, + BalanceAndAllowance, + OrderAndTraderInfo, + TraderInfo, } from './types'; export { Order, SignedOrder, AssetProxyId } from '@0xproject/types'; diff --git a/packages/monorepo-scripts/src/doc_gen_configs.ts b/packages/monorepo-scripts/src/doc_gen_configs.ts index 6d7560943..102b5d7ca 100644 --- a/packages/monorepo-scripts/src/doc_gen_configs.ts +++ b/packages/monorepo-scripts/src/doc_gen_configs.ts @@ -39,6 +39,7 @@ export const docGenConfigs: DocGenConfigs = { 'EtherTokenWrapper', 'ExchangeWrapper', 'ForwarderWrapper', + 'OrderValidatorWrapper', 'TransactionEncoder', ], // Some types are not explicitly part of the public interface like params, return values, etc... But we still -- cgit v1.2.3 From 14fdb71a716cb95bc1f6933db9057d23f3c41909 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Tue, 28 Aug 2018 13:00:49 -0700 Subject: safeGetPartialAmount (#1035) * Added Test "Should transfer correct amounts when left order is fully filled and values pass isRoundingErrorCeil but fail isRoundingErrorFloor" * Added RoundingError exception to reference function for getPartialAmount * Added RoundingError exception to reference function for getPartialAmount * Added isRoundingErrorCeil to getPartialAmountCeil reference funtion * Computed new values for "Should give right maker a better buy price when correct price is not integral" that does not have a rounding error * Almost all tests for match orders are passing after adding isRoundingErrorCeil check * WIP commit: Added rounding error checks to getPartialAmount * WIP commit: Added rounding error checks to getPartialAmount * Use safe versions of getPartialAmount * Update Exchange internals tests * Run linter * Found new values for "Should transfer correct amounts when right order fill amount deviates from amount derived by `Exchange.fillOrder`" * Fixed merge conflicts * Run all tests * Cleaned up some comments on match Orders tests * Fix tests for geth --- .../2.0.0/protocol/Exchange/MixinExchangeCore.sol | 16 +- .../2.0.0/protocol/Exchange/MixinMatchOrders.sol | 16 +- .../src/2.0.0/protocol/Exchange/libs/LibMath.sol | 82 +++++++- .../ReentrantERC20Token/ReentrantERC20Token.sol | 1 + .../TestExchangeInternals.sol | 36 ++++ packages/contracts/test/exchange/internal.ts | 181 ++++++++++++----- packages/contracts/test/exchange/match_orders.ts | 220 +++++++++++++++++---- 7 files changed, 442 insertions(+), 110 deletions(-) (limited to 'packages') diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol index be163ec97..64b1f7665 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol @@ -404,16 +404,6 @@ contract MixinExchangeCore is safeMul(order.makerAssetAmount, takerAssetFilledAmount), "INVALID_FILL_PRICE" ); - - // Validate fill order rounding - require( - !isRoundingErrorFloor( - takerAssetFilledAmount, - order.takerAssetAmount, - order.makerAssetAmount - ), - "ROUNDING_ERROR" - ); } /// @dev Validates context for cancelOrder. Succeeds or throws. @@ -463,17 +453,17 @@ contract MixinExchangeCore is { // Compute proportional transfer amounts fillResults.takerAssetFilledAmount = takerAssetFilledAmount; - fillResults.makerAssetFilledAmount = getPartialAmountFloor( + fillResults.makerAssetFilledAmount = safeGetPartialAmountFloor( takerAssetFilledAmount, order.takerAssetAmount, order.makerAssetAmount ); - fillResults.makerFeePaid = getPartialAmountFloor( + fillResults.makerFeePaid = safeGetPartialAmountFloor( takerAssetFilledAmount, order.takerAssetAmount, order.makerFee ); - fillResults.takerFeePaid = getPartialAmountFloor( + fillResults.takerFeePaid = safeGetPartialAmountFloor( takerAssetFilledAmount, order.takerAssetAmount, order.takerFee diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol index 075a610b5..b4f6bdb26 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinMatchOrders.sol @@ -177,13 +177,13 @@ contract MixinMatchOrders is { // Derive maker asset amounts for left & right orders, given store taker assert amounts uint256 leftTakerAssetAmountRemaining = safeSub(leftOrder.takerAssetAmount, leftOrderTakerAssetFilledAmount); - uint256 leftMakerAssetAmountRemaining = getPartialAmountFloor( + uint256 leftMakerAssetAmountRemaining = safeGetPartialAmountFloor( leftOrder.makerAssetAmount, leftOrder.takerAssetAmount, leftTakerAssetAmountRemaining ); uint256 rightTakerAssetAmountRemaining = safeSub(rightOrder.takerAssetAmount, rightOrderTakerAssetFilledAmount); - uint256 rightMakerAssetAmountRemaining = getPartialAmountFloor( + uint256 rightMakerAssetAmountRemaining = safeGetPartialAmountFloor( rightOrder.makerAssetAmount, rightOrder.takerAssetAmount, rightTakerAssetAmountRemaining @@ -205,7 +205,7 @@ contract MixinMatchOrders is 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 = getPartialAmountFloor( + matchedFillResults.left.makerAssetFilledAmount = safeGetPartialAmountFloor( leftOrder.makerAssetAmount, leftOrder.takerAssetAmount, matchedFillResults.left.takerAssetFilledAmount @@ -217,7 +217,7 @@ contract MixinMatchOrders is 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 = getPartialAmountCeil( + matchedFillResults.right.takerAssetFilledAmount = safeGetPartialAmountCeil( rightOrder.takerAssetAmount, rightOrder.makerAssetAmount, matchedFillResults.right.makerAssetFilledAmount @@ -231,24 +231,24 @@ contract MixinMatchOrders is ); // Compute fees for left order - matchedFillResults.left.makerFeePaid = getPartialAmountFloor( + matchedFillResults.left.makerFeePaid = safeGetPartialAmountFloor( matchedFillResults.left.makerAssetFilledAmount, leftOrder.makerAssetAmount, leftOrder.makerFee ); - matchedFillResults.left.takerFeePaid = getPartialAmountFloor( + matchedFillResults.left.takerFeePaid = safeGetPartialAmountFloor( matchedFillResults.left.takerAssetFilledAmount, leftOrder.takerAssetAmount, leftOrder.takerFee ); // Compute fees for right order - matchedFillResults.right.makerFeePaid = getPartialAmountFloor( + matchedFillResults.right.makerFeePaid = safeGetPartialAmountFloor( matchedFillResults.right.makerAssetFilledAmount, rightOrder.makerAssetAmount, rightOrder.makerFee ); - matchedFillResults.right.takerFeePaid = getPartialAmountFloor( + matchedFillResults.right.takerFeePaid = safeGetPartialAmountFloor( matchedFillResults.right.takerAssetFilledAmount, rightOrder.takerAssetAmount, rightOrder.takerFee diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol index 0e0fba5d2..57fd53f29 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/libs/LibMath.sol @@ -26,11 +26,48 @@ contract LibMath is { /// @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 getPartialAmountFloor( + 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 @@ -43,7 +80,48 @@ contract LibMath is 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 @@ -69,7 +147,7 @@ contract LibMath is 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. diff --git a/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol b/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol index 8bfdd2e66..4f4e28302 100644 --- a/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol +++ b/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol @@ -25,6 +25,7 @@ import "../../protocol/Exchange/interfaces/IExchange.sol"; import "../../protocol/Exchange/libs/LibOrder.sol"; +// solhint-disable no-unused-vars contract ReentrantERC20Token is ERC20Token { diff --git a/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol b/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol index da9313e02..27187f8f8 100644 --- a/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol +++ b/packages/contracts/src/2.0.0/test/TestExchangeInternals/TestExchangeInternals.sol @@ -62,6 +62,42 @@ contract TestExchangeInternals is return calculateFillResults(order, takerAssetFilledAmount); } + /// @dev Calculates partial value given a numerator and denominator. + /// 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. + function publicSafeGetPartialAmountFloor( + uint256 numerator, + uint256 denominator, + uint256 target + ) + public + pure + returns (uint256 partialAmount) + { + return safeGetPartialAmountFloor(numerator, denominator, target); + } + + /// @dev Calculates partial value given a numerator and denominator. + /// 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. + function publicSafeGetPartialAmountCeil( + uint256 numerator, + uint256 denominator, + uint256 target + ) + public + pure + returns (uint256 partialAmount) + { + return safeGetPartialAmountCeil(numerator, denominator, target); + } + /// @dev Calculates partial value given a numerator and denominator. /// @param numerator Numerator. /// @param denominator Denominator. diff --git a/packages/contracts/test/exchange/internal.ts b/packages/contracts/test/exchange/internal.ts index de381fca3..c5d2fc58f 100644 --- a/packages/contracts/test/exchange/internal.ts +++ b/packages/contracts/test/exchange/internal.ts @@ -48,9 +48,9 @@ const overflowErrorForCall = new Error(RevertReason.Uint256Overflow); describe('Exchange core internal functions', () => { let testExchange: TestExchangeInternalsContract; - let invalidOpcodeErrorForCall: Error | undefined; let overflowErrorForSendTransaction: Error | undefined; let divisionByZeroErrorForCall: Error | undefined; + let roundingErrorForCall: Error | undefined; before(async () => { await blockchainLifecycle.startAsync(); @@ -68,12 +68,67 @@ describe('Exchange core internal functions', () => { await getRevertReasonOrErrorMessageForSendTransactionAsync(RevertReason.Uint256Overflow), ); divisionByZeroErrorForCall = new Error(RevertReason.DivisionByZero); - invalidOpcodeErrorForCall = new Error(await getInvalidOpcodeErrorMessageForCallAsync()); + 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 referenceGetPartialAmountFloorAsync( + async function referenceIsRoundingErrorFloorAsync( + numerator: BigNumber, + denominator: BigNumber, + target: BigNumber, + ): Promise { + 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 { + 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, @@ -81,6 +136,10 @@ describe('Exchange core internal functions', () => { 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; @@ -163,18 +222,18 @@ describe('Exchange core internal functions', () => { // implementation or the Solidity implementation of // calculateFillResults. return { - makerAssetFilledAmount: await referenceGetPartialAmountFloorAsync( + makerAssetFilledAmount: await referenceSafeGetPartialAmountFloorAsync( takerAssetFilledAmount, orderTakerAssetAmount, otherAmount, ), takerAssetFilledAmount, - makerFeePaid: await referenceGetPartialAmountFloorAsync( + makerFeePaid: await referenceSafeGetPartialAmountFloorAsync( takerAssetFilledAmount, orderTakerAssetAmount, otherAmount, ), - takerFeePaid: await referenceGetPartialAmountFloorAsync( + takerFeePaid: await referenceSafeGetPartialAmountFloorAsync( takerAssetFilledAmount, orderTakerAssetAmount, otherAmount, @@ -198,6 +257,20 @@ describe('Exchange core internal functions', () => { }); describe('getPartialAmountFloor', async () => { + async function referenceGetPartialAmountFloorAsync( + numerator: BigNumber, + denominator: BigNumber, + target: BigNumber, + ): Promise { + 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, @@ -206,7 +279,7 @@ describe('Exchange core internal functions', () => { return testExchange.publicGetPartialAmountFloor.callAsync(numerator, denominator, target); } await testCombinatoriallyWithReferenceFuncAsync( - 'getPartialAmount', + 'getPartialAmountFloor', referenceGetPartialAmountFloorAsync, testGetPartialAmountFloorAsync, [uint256Values, uint256Values, uint256Values], @@ -250,76 +323,80 @@ describe('Exchange core internal functions', () => { ); }); - describe('isRoundingError', async () => { - async function referenceIsRoundingErrorAsync( + describe('safeGetPartialAmountFloor', async () => { + async function testSafeGetPartialAmountFloorAsync( numerator: BigNumber, denominator: BigNumber, target: BigNumber, - ): Promise { + ): Promise { + 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 { if (denominator.eq(0)) { throw divisionByZeroErrorForCall; } - if (numerator.eq(0)) { - return false; - } - if (target.eq(0)) { - return false; + const isRoundingError = await referenceIsRoundingErrorCeilAsync(numerator, denominator, target); + if (isRoundingError) { + throw roundingErrorForCall; } const product = numerator.mul(target); - const remainder = product.mod(denominator); - const remainderTimes1000 = remainder.mul('1000'); - const isError = remainderTimes1000.gt(product); - if (product.greaterThan(MAX_UINT256)) { + const offset = product.add(denominator.sub(1)); + if (offset.greaterThan(MAX_UINT256)) { throw overflowErrorForCall; } - if (remainderTimes1000.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 isError; + return result; } - async function testIsRoundingErrorAsync( + async function testSafeGetPartialAmountCeilAsync( numerator: BigNumber, denominator: BigNumber, target: BigNumber, - ): Promise { - return testExchange.publicIsRoundingErrorFloor.callAsync(numerator, denominator, target); + ): Promise { + return testExchange.publicSafeGetPartialAmountCeil.callAsync(numerator, denominator, target); } await testCombinatoriallyWithReferenceFuncAsync( - 'isRoundingError', - referenceIsRoundingErrorAsync, - testIsRoundingErrorAsync, + 'safeGetPartialAmountCeil', + referenceSafeGetPartialAmountCeilAsync, + testSafeGetPartialAmountCeilAsync, [uint256Values, uint256Values, uint256Values], ); }); - describe('isRoundingErrorCeil', async () => { - async function referenceIsRoundingErrorAsync( + describe('isRoundingErrorFloor', async () => { + async function testIsRoundingErrorFloorAsync( numerator: BigNumber, denominator: BigNumber, target: BigNumber, ): Promise { - 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.gt(product); - if (product.greaterThan(MAX_UINT256)) { - throw overflowErrorForCall; - } - if (errorTimes1000.greaterThan(MAX_UINT256)) { - throw overflowErrorForCall; - } - return isError; + 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, @@ -329,7 +406,7 @@ describe('Exchange core internal functions', () => { } await testCombinatoriallyWithReferenceFuncAsync( 'isRoundingErrorCeil', - referenceIsRoundingErrorAsync, + referenceIsRoundingErrorCeilAsync, testIsRoundingErrorCeilAsync, [uint256Values, uint256Values, uint256Values], ); diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 8732e20ba..554c456cc 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -3,6 +3,7 @@ import { assetDataUtils } from '@0xproject/order-utils'; import { RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as chai from 'chai'; import * as _ from 'lodash'; import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; @@ -11,8 +12,10 @@ import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_prox import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy'; import { ExchangeContract } from '../../generated_contract_wrappers/exchange'; import { ReentrantERC20TokenContract } from '../../generated_contract_wrappers/reentrant_erc20_token'; +import { TestExchangeInternalsContract } from '../../generated_contract_wrappers/test_exchange_internals'; import { artifacts } from '../utils/artifacts'; import { 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'; @@ -23,6 +26,8 @@ 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; @@ -58,6 +63,8 @@ describe('matchOrders', () => { let matchOrderTester: MatchOrderTester; + let testExchange: TestExchangeInternalsContract; + before(async () => { await blockchainLifecycle.startAsync(); }); @@ -160,6 +167,11 @@ describe('matchOrders', () => { 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(); @@ -173,39 +185,170 @@ describe('matchOrders', () => { erc721TokenIdsByOwner = await erc721Wrapper.getBalancesAsync(); }); - it('Should give right maker a better price when correct price is not integral', async () => { + 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(2000), 0), - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1001), 0), + 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(10000), 0), - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(3000), 0), + 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. Similarly, the right maker pays a - // slightly higher lower than the right taker. + // 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(2000), 0), - amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1001), 0), + 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(1001), 0), - amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(301), 0), - feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10.01), 16), // 10.01% + 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(1699), 0), + amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 0), feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100% - feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber('10.0333333333333333'), 16), // 10.03% + feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber('26.5306122448979591'), 16), // 26.531% }; // Match signedOrderLeft with signedOrderRight await matchOrderTester.matchOrdersAndAssertEffectsAsync( @@ -218,7 +361,7 @@ describe('matchOrders', () => { ); }); - it('Should give left maker a better price when correct price is not integral', async () => { + it('Should give left maker a better sell price when rounding', async () => { // Create orders to match const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({ makerAddress: makerAddressLeft, @@ -236,7 +379,8 @@ describe('matchOrders', () => { }); // Note: // The maker/taker fee percentage paid on the left order differs because - // they received different sale prices. + // 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), @@ -266,39 +410,45 @@ describe('matchOrders', () => { // Create orders to match const signedOrderLeft = await orderFactoryLeft.newSignedOrderAsync({ makerAddress: makerAddressLeft, - makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 0), - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 0), + 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(4), 0), - takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 0), + makerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(2126), 0), + takerAssetAmount: Web3Wrapper.toBaseUnitAmount(new BigNumber(1063), 0), feeRecipientAddress: feeRecipientAddressRight, }); - // TODO: These values will change after implementation of rounding up has been merged const expectedTransferAmounts = { // Left Maker - amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(10), 0), - amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(3), 0), + amountSoldByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), 0), + amountBoughtByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(1005), 0), feePaidByLeftMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100% // Right Maker - // Note: - // For order [4,2] valid fill amounts through `Exchange.fillOrder` would be [2, 1] or [4, 2] - // In this case we have fill amounts of [3, 1] which is attainable through - // `Exchange.matchOrders` but not `Exchange.fillOrder` - // Note: - // 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(3), 0), - amountBoughtByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(2), 0), - feePaidByRightMaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(75), 16), // 75% + // 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(8), 0), + amountReceivedByTaker: Web3Wrapper.toBaseUnitAmount(new BigNumber(497), 0), feePaidByTakerLeft: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100% - feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber(100), 16), // 100% + feePaidByTakerRight: Web3Wrapper.toBaseUnitAmount(new BigNumber('47.3189087488240827'), 16), // 47.31% }; // Match signedOrderLeft with signedOrderRight await matchOrderTester.matchOrdersAndAssertEffectsAsync( -- cgit v1.2.3 From f225f9e7c8f59a0ea04f6c9b07493a0458c4f502 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Tue, 28 Aug 2018 13:25:05 -0700 Subject: Making rounding consistent in calculateFillResults --- .../src/2.0.0/protocol/Exchange/MixinExchangeCore.sol | 4 ++-- packages/contracts/test/exchange/internal.ts | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'packages') diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol index 64b1f7665..ff908917d 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol @@ -459,8 +459,8 @@ contract MixinExchangeCore is order.makerAssetAmount ); fillResults.makerFeePaid = safeGetPartialAmountFloor( - takerAssetFilledAmount, - order.takerAssetAmount, + fillResults.makerAssetFilledAmount, + order.makerAssetAmount, order.makerFee ); fillResults.takerFeePaid = safeGetPartialAmountFloor( diff --git a/packages/contracts/test/exchange/internal.ts b/packages/contracts/test/exchange/internal.ts index c5d2fc58f..dc2c5fbe0 100644 --- a/packages/contracts/test/exchange/internal.ts +++ b/packages/contracts/test/exchange/internal.ts @@ -221,16 +221,19 @@ describe('Exchange core internal functions', () => { // 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: await referenceSafeGetPartialAmountFloorAsync( - takerAssetFilledAmount, - orderTakerAssetAmount, - otherAmount, - ), + makerAssetFilledAmount, takerAssetFilledAmount, makerFeePaid: await referenceSafeGetPartialAmountFloorAsync( - takerAssetFilledAmount, - orderTakerAssetAmount, + makerAssetFilledAmount, + orderMakerAssetAmount, otherAmount, ), takerFeePaid: await referenceSafeGetPartialAmountFloorAsync( -- cgit v1.2.3 From ac1640140c9279ac9e8a92d84702a2f84d9165fb Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 13:53:49 -0700 Subject: Enable hovering state for dropdown --- packages/website/ts/components/ui/drop_down.tsx | 13 +++++++------ packages/website/ts/components/ui/popover.tsx | 3 ++- packages/website/ts/components/wallet/wallet.tsx | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/components/ui/drop_down.tsx b/packages/website/ts/components/ui/drop_down.tsx index 638b29f88..32105d353 100644 --- a/packages/website/ts/components/ui/drop_down.tsx +++ b/packages/website/ts/components/ui/drop_down.tsx @@ -32,8 +32,8 @@ export class DropDown extends React.Component { public static defaultProps: Partial = { style: DEFAULT_STYLE, zDepth: 1, - activateEvent: DropdownMouseEvent.Click, - closeEvent: DropdownMouseEvent.Click, + activateEvent: DropdownMouseEvent.Hover, + closeEvent: DropdownMouseEvent.Hover, }; private _popoverCloseCheckIntervalId: number; public static getDerivedStateFromProps(props: DropDownProps, state: DropDownState): Partial { @@ -77,8 +77,6 @@ export class DropDown extends React.Component { zIndex={this.props.zDepth} >
{this.props.popoverContent} @@ -97,10 +95,13 @@ export class DropDown extends React.Component { } } private _onHover(event: React.FormEvent): void { - this.setState({ isHovering: true }); + this.setState({ + isHovering: true, + anchorEl: event.currentTarget, + }); } private _onHoverOff(): void { - this.setState({ isHovering: false }); + this.setState({ isHovering: false, anchorEl: undefined }); } private _checkIfShouldClosePopover(): void { if (!this.state.isDropDownOpen) { diff --git a/packages/website/ts/components/ui/popover.tsx b/packages/website/ts/components/ui/popover.tsx index 66c0ac663..556e8b110 100644 --- a/packages/website/ts/components/ui/popover.tsx +++ b/packages/website/ts/components/ui/popover.tsx @@ -20,6 +20,7 @@ const PopoverContainer = styled.div` max-height: 679px; overflow-y: auto; border-radius: 2px; + box-shadow: rgba(0, 0, 0, 0.12) 0px 1px 6px, rgba(0, 0, 0, 0.12) 0px 1px 4px; `; const defaultPlacement: Placement = 'bottom'; @@ -37,7 +38,7 @@ export class Popover extends React.Component { }; return (
- + {/* */} {this._renderPopperChildren.bind(this)} diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 968377010..191f3a18a 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -235,6 +235,7 @@ export class Wallet extends React.Component { } zDepth={1} + placement="right-end" activateEvent={DropdownMouseEvent.Click} closeEvent={DropdownMouseEvent.Click} /> -- cgit v1.2.3 From 2d1d14d2e42623d5345b6c1e64e39a87b7c3a223 Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 15:04:34 -0700 Subject: Upgrade material ui to 0.20.0 --- packages/website/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/website/package.json b/packages/website/package.json index abad4ab0c..64e317da9 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -37,7 +37,7 @@ "jsonschema": "^1.2.0", "less": "^2.7.2", "lodash": "^4.17.5", - "material-ui": "^0.17.1", + "material-ui": "^0.20.0", "moment": "2.21.0", "numeral": "^2.0.6", "polished": "^1.9.2", @@ -68,7 +68,7 @@ "@types/find-versions": "^2.0.0", "@types/jsonschema": "^1.1.1", "@types/lodash": "4.14.104", - "@types/material-ui": "0.18.0", + "@types/material-ui": "^0.20.0", "@types/node": "^8.0.53", "@types/numeral": "^0.0.22", "@types/query-string": "^5.1.0", -- cgit v1.2.3 From 8e14e65b60bc4b94ba686c7bb5467bb4a5e2c645 Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 15:07:24 -0700 Subject: Revert "Enable hovering state for dropdown" This reverts commit ac1640140c9279ac9e8a92d84702a2f84d9165fb. --- packages/website/ts/components/ui/drop_down.tsx | 13 ++++++------- packages/website/ts/components/ui/popover.tsx | 3 +-- packages/website/ts/components/wallet/wallet.tsx | 1 - 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/components/ui/drop_down.tsx b/packages/website/ts/components/ui/drop_down.tsx index 32105d353..638b29f88 100644 --- a/packages/website/ts/components/ui/drop_down.tsx +++ b/packages/website/ts/components/ui/drop_down.tsx @@ -32,8 +32,8 @@ export class DropDown extends React.Component { public static defaultProps: Partial = { style: DEFAULT_STYLE, zDepth: 1, - activateEvent: DropdownMouseEvent.Hover, - closeEvent: DropdownMouseEvent.Hover, + activateEvent: DropdownMouseEvent.Click, + closeEvent: DropdownMouseEvent.Click, }; private _popoverCloseCheckIntervalId: number; public static getDerivedStateFromProps(props: DropDownProps, state: DropDownState): Partial { @@ -77,6 +77,8 @@ export class DropDown extends React.Component { zIndex={this.props.zDepth} >
{this.props.popoverContent} @@ -95,13 +97,10 @@ export class DropDown extends React.Component { } } private _onHover(event: React.FormEvent): void { - this.setState({ - isHovering: true, - anchorEl: event.currentTarget, - }); + this.setState({ isHovering: true }); } private _onHoverOff(): void { - this.setState({ isHovering: false, anchorEl: undefined }); + this.setState({ isHovering: false }); } private _checkIfShouldClosePopover(): void { if (!this.state.isDropDownOpen) { diff --git a/packages/website/ts/components/ui/popover.tsx b/packages/website/ts/components/ui/popover.tsx index 556e8b110..66c0ac663 100644 --- a/packages/website/ts/components/ui/popover.tsx +++ b/packages/website/ts/components/ui/popover.tsx @@ -20,7 +20,6 @@ const PopoverContainer = styled.div` max-height: 679px; overflow-y: auto; border-radius: 2px; - box-shadow: rgba(0, 0, 0, 0.12) 0px 1px 6px, rgba(0, 0, 0, 0.12) 0px 1px 4px; `; const defaultPlacement: Placement = 'bottom'; @@ -38,7 +37,7 @@ export class Popover extends React.Component { }; return (
- {/* */} + {this._renderPopperChildren.bind(this)} diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 191f3a18a..968377010 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -235,7 +235,6 @@ export class Wallet extends React.Component { } zDepth={1} - placement="right-end" activateEvent={DropdownMouseEvent.Click} closeEvent={DropdownMouseEvent.Click} /> -- cgit v1.2.3 From de11b62e30270ec72ad42c510989b5698339e590 Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 15:07:28 -0700 Subject: Revert "Have new Popover component working in React 16" This reverts commit 5785ec0713c39466b3a6a171f5f0a2d38207b44b. --- .../ts/components/top_bar/provider_display.tsx | 2 + packages/website/ts/components/top_bar/top_bar.tsx | 2 + packages/website/ts/components/ui/container.tsx | 8 +-- packages/website/ts/components/ui/drop_down.tsx | 43 ++++++++-------- packages/website/ts/components/ui/overlay.tsx | 2 +- packages/website/ts/components/ui/popover.tsx | 59 ---------------------- packages/website/ts/components/wallet/wallet.tsx | 2 + packages/website/ts/types.ts | 5 ++ 8 files changed, 39 insertions(+), 84 deletions(-) delete mode 100644 packages/website/ts/components/ui/popover.tsx (limited to 'packages') diff --git a/packages/website/ts/components/top_bar/provider_display.tsx b/packages/website/ts/components/top_bar/provider_display.tsx index 0a5c61776..806eaeea5 100644 --- a/packages/website/ts/components/top_bar/provider_display.tsx +++ b/packages/website/ts/components/top_bar/provider_display.tsx @@ -61,6 +61,8 @@ export class ProviderDisplay extends React.Component
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 3eef17746..8580c3a6e 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -276,6 +276,8 @@ export class TopBar extends React.Component { { public static defaultProps: Partial = { style: DEFAULT_STYLE, zDepth: 1, - activateEvent: DropdownMouseEvent.Click, - closeEvent: DropdownMouseEvent.Click, + activateEvent: DropdownMouseEvent.Hover, + closeEvent: DropdownMouseEvent.Hover, }; private _popoverCloseCheckIntervalId: number; public static getDerivedStateFromProps(props: DropDownProps, state: DropDownState): Partial { @@ -69,22 +70,24 @@ export class DropDown extends React.Component { onMouseLeave={this._onHoverOff.bind(this)} >
{this.props.activeNode}
- {this.state.isDropDownOpen && - +
-
- {this.props.popoverContent} -
- - } + {this.props.popoverContent} +
+
); } diff --git a/packages/website/ts/components/ui/overlay.tsx b/packages/website/ts/components/ui/overlay.tsx index cb68aeca1..fc7507475 100644 --- a/packages/website/ts/components/ui/overlay.tsx +++ b/packages/website/ts/components/ui/overlay.tsx @@ -29,4 +29,4 @@ Overlay.defaultProps = { onClick: _.noop.bind(_), }; -Overlay.displayName = 'Overlay'; \ No newline at end of file +Overlay.displayName = 'Overlay'; diff --git a/packages/website/ts/components/ui/popover.tsx b/packages/website/ts/components/ui/popover.tsx deleted file mode 100644 index 66c0ac663..000000000 --- a/packages/website/ts/components/ui/popover.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import * as _ from 'lodash'; -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; -import { Placement, Popper, PopperChildrenProps } from 'react-popper'; - -import { colors } from '@0xproject/react-shared'; -import { Container } from 'ts/components/ui/container'; -import { Overlay } from 'ts/components/ui/overlay'; -import { styled } from 'ts/style/theme'; - -export interface PopoverProps { - anchorEl: HTMLInputElement; - placement?: Placement; - onRequestClose?: () => void; - zIndex?: number; -} - -const PopoverContainer = styled.div` - background-color: ${colors.white}; - max-height: 679px; - overflow-y: auto; - border-radius: 2px; -`; - -const defaultPlacement: Placement = 'bottom'; - -export class Popover extends React.Component { - public static defaultProps = { - placement: defaultPlacement, - }; - - public render(): React.ReactNode { - const { anchorEl, placement, zIndex, onRequestClose } = this.props; - const overlayStyleOverrides = { - zIndex, - backgroundColor: 'transparent', - }; - return ( -
- - - {this._renderPopperChildren.bind(this)} - -
- ); - } - private _renderPopperChildren(props: PopperChildrenProps): React.ReactNode { - const popperContainerStyleOverrids = { - zIndex: _.isUndefined(this.props.zIndex) ? undefined : this.props.zIndex + 1, - }; - return ( -
- - {this.props.children} - -
- ); - } -} diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 968377010..6abaa840b 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -234,6 +234,8 @@ export class Wallet extends React.Component { {!isMobile && } } + anchorOrigin={{ horizontal: 'right', vertical: 'bottom' }} + targetOrigin={{ horizontal: 'right', vertical: 'top' }} zDepth={1} activateEvent={DropdownMouseEvent.Click} closeEvent={DropdownMouseEvent.Click} diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index e76fae932..c637171dd 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -492,6 +492,11 @@ export enum Deco { Upper, } +export interface MaterialUIPosition { + vertical: 'bottom' | 'top' | 'center'; + horizontal: 'left' | 'middle' | 'right'; +} + export enum Providers { Parity = 'PARITY', Metamask = 'METAMASK', -- cgit v1.2.3 From 55fab3d98f8714d09906745922b59afbdc0de00d Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 15:07:29 -0700 Subject: Revert "Simplify dropdown component" This reverts commit 91a9014a50cca8e0d42634666fe409839aeae8cf. --- packages/website/ts/components/ui/drop_down.tsx | 40 +++++++++++++++---------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/components/ui/drop_down.tsx b/packages/website/ts/components/ui/drop_down.tsx index 752c92e02..4d5caef08 100644 --- a/packages/website/ts/components/ui/drop_down.tsx +++ b/packages/website/ts/components/ui/drop_down.tsx @@ -25,7 +25,6 @@ export interface DropDownProps { interface DropDownState { isDropDownOpen: boolean; - isHovering: boolean; anchorEl?: HTMLInputElement; } @@ -36,21 +35,11 @@ export class DropDown extends React.Component { activateEvent: DropdownMouseEvent.Hover, closeEvent: DropdownMouseEvent.Hover, }; + private _isHovering: boolean; private _popoverCloseCheckIntervalId: number; - public static getDerivedStateFromProps(props: DropDownProps, state: DropDownState): Partial { - switch (props.activateEvent) { - case DropdownMouseEvent.Click: - return { isDropDownOpen: state.isDropDownOpen }; - case DropdownMouseEvent.Hover: - return { isDropDownOpen: state.isHovering }; - default: - return {}; - } - } constructor(props: DropDownProps) { super(props); this.state = { - isHovering: false, isDropDownOpen: false, }; } @@ -62,6 +51,15 @@ export class DropDown extends React.Component { public componentWillUnmount(): void { window.clearInterval(this._popoverCloseCheckIntervalId); } + public componentWillReceiveProps(_nextProps: DropDownProps): void { + // HACK: If the popoverContent is updated to a different dimension and the users + // mouse is no longer above it, the dropdown can enter an inconsistent state where + // it believes the user is still hovering over it. In order to remedy this, we + // call hoverOff whenever the dropdown receives updated props. This is a hack + // because it will effectively close the dropdown on any prop update, barring + // dropdowns from having dynamic content. + this._onHoverOff(); + } public render(): React.ReactNode { return (
{ } } private _onHover(event: React.FormEvent): void { - this.setState({ isHovering: true }); + this._isHovering = true; + if (this.props.activateEvent === DropdownMouseEvent.Hover) { + this._checkIfShouldOpenPopover(event); + } } private _onHoverOff(): void { - this.setState({ isHovering: false }); + this._isHovering = false; + } + private _checkIfShouldOpenPopover(event: React.FormEvent): void { + if (this.state.isDropDownOpen) { + return; // noop + } + this.setState({ + isDropDownOpen: true, + anchorEl: event.currentTarget, + }); } private _checkIfShouldClosePopover(): void { if (!this.state.isDropDownOpen) { return; // noop } - if (this.props.closeEvent === DropdownMouseEvent.Hover && !this.state.isHovering) { + if (this.props.closeEvent === DropdownMouseEvent.Hover && !this._isHovering) { this._closePopover(); } } -- cgit v1.2.3 From 61a4ae7fc408cb2ee22aaf30ec5eb420ff9f2b03 Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 15:15:54 -0700 Subject: Update material-ui in react-shared --- packages/react-shared/package.json | 2 +- packages/website/package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 6d6c17830..aa542f04f 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -44,7 +44,7 @@ "change-case": "^3.0.2", "is-mobile": "^0.2.2", "lodash": "^4.17.5", - "material-ui": "^0.17.1", + "material-ui": "0.20.0", "react": "^16.4.2", "react-dom": "^16.4.2", "react-highlight": "0xproject/react-highlight#2f40a42e0a3f0ad126f9f42d505b97b603fc7162", diff --git a/packages/website/package.json b/packages/website/package.json index 64e317da9..0a3bec9b8 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -27,6 +27,7 @@ "@0xproject/typescript-typings": "^0.4.3", "@0xproject/utils": "^1.0.6", "@0xproject/web3-wrapper": "^2.0.0", + "@types/material-ui": "^0.20.0", "accounting": "^0.4.1", "basscss": "^8.0.3", "blockies": "^0.0.2", -- cgit v1.2.3 From ac135d55d369e456fbec754707842d5c81795aa3 Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 15:32:15 -0700 Subject: Upgrade material ui in react-docs --- packages/react-docs/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index ad35b8e13..4ad0b0c19 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -37,7 +37,7 @@ "@0xproject/react-shared": "^1.0.8", "@0xproject/utils": "^1.0.7", "@types/lodash": "4.14.104", - "@types/material-ui": "0.18.0", + "@types/material-ui": "^0.20.0", "@types/node": "^8.0.53", "@types/react": "*", "@types/react-dom": "*", @@ -45,7 +45,7 @@ "basscss": "^8.0.3", "compare-versions": "^3.0.1", "lodash": "^4.17.5", - "material-ui": "^0.17.1", + "material-ui": "^0.20.0", "react": "^16.4.2", "react-dom": "^16.4.2", "react-markdown": "^3.2.2", -- cgit v1.2.3 From 72710be04b1eae2a3d90bd8872501911f3bbad99 Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 15:37:20 -0700 Subject: Remove react-tap-event-plugin from react-shared --- packages/react-shared/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 6b0a8d60a..10d89e6cd 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -49,8 +49,7 @@ "react-dom": "^16.4.2", "react-highlight": "0xproject/react-highlight#2f40a42e0a3f0ad126f9f42d505b97b603fc7162", "react-markdown": "^3.2.2", - "react-scroll": "0xproject/react-scroll#similar-to-pr-330", - "react-tap-event-plugin": "^2.0.1" + "react-scroll": "0xproject/react-scroll#similar-to-pr-330" }, "publishConfig": { "access": "public" -- cgit v1.2.3 From 031807df9cb9258197bab671dda754e02b862267 Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 15:52:09 -0700 Subject: Upgrade react-copy-to-clipboard --- packages/website/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/website/package.json b/packages/website/package.json index 50f9d18d1..1d148c080 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -43,7 +43,7 @@ "polished": "^1.9.2", "query-string": "^6.0.0", "react": "^16.4.2", - "react-copy-to-clipboard": "^4.2.3", + "react-copy-to-clipboard": "^5.0.0", "react-document-title": "^2.0.3", "react-dom": "^16.4.2", "react-helmet": "^5.2.0", -- cgit v1.2.3 From a18d0f62298de76a2c6cd503e457123221d6bf9a Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 17:49:15 -0700 Subject: Upgrade version of react-shared in website --- packages/react-shared/package.json | 2 +- packages/website/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index 10d89e6cd..f341619d2 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -44,7 +44,7 @@ "change-case": "^3.0.2", "is-mobile": "^0.2.2", "lodash": "^4.17.5", - "material-ui": "0.20.0", + "material-ui": "^0.20.0", "react": "^16.4.2", "react-dom": "^16.4.2", "react-highlight": "0xproject/react-highlight#2f40a42e0a3f0ad126f9f42d505b97b603fc7162", diff --git a/packages/website/package.json b/packages/website/package.json index 1d148c080..3b6754fb3 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -21,7 +21,7 @@ "@0xproject/contract-wrappers": "^0.0.5", "@0xproject/order-utils": "^0.0.9", "@0xproject/react-docs": "^1.0.7", - "@0xproject/react-shared": "^1.0.7", + "@0xproject/react-shared": "^1.0.8", "@0xproject/subproviders": "^2.0.1", "@0xproject/types": "^0.8.1", "@0xproject/typescript-typings": "^0.4.3", -- cgit v1.2.3 From 68af0e9eb70151704098350f99437f92639de753 Mon Sep 17 00:00:00 2001 From: fragosti Date: Tue, 28 Aug 2018 18:08:06 -0700 Subject: Change VersionDropDown to use material-ui 3 --- packages/react-shared/package.json | 1 + .../react-shared/src/components/version_drop_down.tsx | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'packages') diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json index f341619d2..57aa9d51d 100644 --- a/packages/react-shared/package.json +++ b/packages/react-shared/package.json @@ -33,6 +33,7 @@ "typescript": "3.0.1" }, "dependencies": { + "@material-ui/core": "^3.0.1", "@types/is-mobile": "0.3.0", "@types/lodash": "4.14.104", "@types/material-ui": "0.18.0", diff --git a/packages/react-shared/src/components/version_drop_down.tsx b/packages/react-shared/src/components/version_drop_down.tsx index e41590957..e4a2798ab 100644 --- a/packages/react-shared/src/components/version_drop_down.tsx +++ b/packages/react-shared/src/components/version_drop_down.tsx @@ -1,6 +1,6 @@ +import MenuItem from '@material-ui/core/MenuItem'; +import Select from '@material-ui/core/Select'; import * as _ from 'lodash'; -import DropDownMenu from 'material-ui/DropDownMenu'; -import MenuItem from 'material-ui/MenuItem'; import * as React from 'react'; export interface VersionDropDownProps { @@ -15,23 +15,22 @@ export class VersionDropDown extends React.Component - {this._renderDropDownItems()} - +
); } private _renderDropDownItems(): React.ReactNode[] { const items = _.map(this.props.versions, version => { - return ; + return v{version}; }); return items; } - private _updateSelectedVersion(_e: any, _index: number, semver: string): void { - this.props.onVersionSelected(semver); + private _updateSelectedVersion(event: React.ChangeEvent): void { + this.props.onVersionSelected(event.target.value); } } -- cgit v1.2.3 From e7d5ceb9c5487a5851dbfc1f8bdbe0182fedaef2 Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Wed, 29 Aug 2018 11:15:30 -0700 Subject: feat: Add support for TypeScript project references (#991) * Update all package.json and tsconfig.json * fix(contracts): Make test/utils/web3_wrapper.ts compatible with project refs * Fix webpack config for 0x.js * Fix linter errors by adding rootDir to tsconfig.json as needed * Add build:ts and watch:ts commands to package.json * Update sra-spec to work with project references * Update tsconfig.json with latest new/removed packages * Add TypeScript as devDependency at root * Add missing rootDir to forwarder-helper package * Use a separate tsconfig file for typedoc * Fix linter errors * Apply PR feedback (add comments) * Fix 0x.js tsconfig --- packages/0x.js/package.json | 5 ++--- packages/0x.js/tsconfig.json | 5 +++-- packages/0x.js/typedoc-tsconfig.json | 7 +++++++ packages/0x.js/webpack.config.js | 5 +++++ packages/abi-gen/package.json | 3 +-- packages/abi-gen/tsconfig.json | 3 ++- packages/assert/package.json | 3 +-- packages/assert/tsconfig.json | 3 ++- packages/base-contract/package.json | 3 +-- packages/base-contract/tsconfig.json | 3 ++- packages/connect/package.json | 5 ++--- packages/connect/tsconfig.json | 3 ++- packages/connect/typedoc-tsconfig.json | 7 +++++++ packages/contract-wrappers/package.json | 5 ++--- packages/contract-wrappers/tsconfig.json | 3 ++- packages/contract-wrappers/typedoc-tsconfig.json | 7 +++++++ packages/contracts/package.json | 3 +-- packages/contracts/test/utils/web3_wrapper.ts | 4 ++-- packages/contracts/tsconfig.json | 6 ++---- packages/dev-utils/package.json | 3 +-- packages/dev-utils/tsconfig.json | 3 ++- packages/ethereum-types/package.json | 5 ++--- packages/ethereum-types/tsconfig.json | 3 ++- packages/ethereum-types/typedoc-tsconfig.json | 8 ++++++++ packages/fill-scenarios/package.json | 3 +-- packages/fill-scenarios/tsconfig.json | 3 ++- packages/forwarder-helper/package.json | 4 ++-- packages/forwarder-helper/tsconfig.json | 3 ++- packages/forwarder-helper/typedoc-tsconfig.json | 7 +++++++ packages/json-schemas/package.json | 5 ++--- packages/json-schemas/tsconfig.json | 5 +++-- packages/json-schemas/typedoc-tsconfig.json | 7 +++++++ packages/metacoin/package.json | 3 +-- packages/metacoin/tsconfig.json | 4 ++-- packages/migrations/package.json | 3 +-- packages/migrations/tsconfig.json | 3 ++- packages/monorepo-scripts/package.json | 3 +-- packages/monorepo-scripts/tsconfig.json | 3 ++- packages/order-utils/package.json | 6 ++---- packages/order-utils/tsconfig.json | 3 ++- packages/order-utils/typedoc-tsconfig.json | 7 +++++++ packages/order-watcher/package.json | 5 ++--- packages/order-watcher/tsconfig.json | 3 ++- packages/order-watcher/typedoc-tsconfig.json | 7 +++++++ packages/react-docs/package.json | 3 +-- packages/react-docs/tsconfig.json | 5 +++-- packages/react-shared/tsconfig.json | 5 +++-- packages/sol-compiler/package.json | 5 ++--- packages/sol-compiler/tsconfig.json | 1 + packages/sol-compiler/typedoc-tsconfig.json | 8 ++++++++ packages/sol-cov/package.json | 5 ++--- packages/sol-cov/tsconfig.json | 3 ++- packages/sol-cov/typedoc-tsconfig.json | 7 +++++++ packages/sol-resolver/package.json | 3 +-- packages/sol-resolver/tsconfig.json | 3 ++- packages/sra-report/package.json | 3 +-- packages/sra-report/tsconfig.json | 3 ++- packages/sra-spec/package.json | 12 ++++++------ packages/sra-spec/tsconfig.json | 5 +++-- packages/subproviders/package.json | 5 ++--- packages/subproviders/tsconfig.json | 3 ++- packages/subproviders/typedoc-tsconfig.json | 7 +++++++ packages/testnet-faucets/package.json | 1 - packages/testnet-faucets/tsconfig.json | 1 + packages/tslint-config/package.json | 3 +-- packages/tslint-config/tsconfig.json | 4 ++-- packages/types/package.json | 3 +-- packages/types/tsconfig.json | 4 ++-- packages/typescript-typings/package.json | 4 ++-- packages/typescript-typings/tsconfig.json | 3 ++- packages/utils/package.json | 3 +-- packages/utils/tsconfig.json | 3 ++- packages/web3-wrapper/package.json | 5 ++--- packages/web3-wrapper/tsconfig.json | 3 ++- packages/web3-wrapper/typedoc-tsconfig.json | 7 +++++++ packages/website/tsconfig.json | 5 +++++ 76 files changed, 210 insertions(+), 117 deletions(-) create mode 100644 packages/0x.js/typedoc-tsconfig.json create mode 100644 packages/connect/typedoc-tsconfig.json create mode 100644 packages/contract-wrappers/typedoc-tsconfig.json create mode 100644 packages/ethereum-types/typedoc-tsconfig.json create mode 100644 packages/forwarder-helper/typedoc-tsconfig.json create mode 100644 packages/json-schemas/typedoc-tsconfig.json create mode 100644 packages/order-utils/typedoc-tsconfig.json create mode 100644 packages/order-watcher/typedoc-tsconfig.json create mode 100644 packages/sol-compiler/typedoc-tsconfig.json create mode 100644 packages/sol-cov/typedoc-tsconfig.json create mode 100644 packages/subproviders/typedoc-tsconfig.json create mode 100644 packages/web3-wrapper/typedoc-tsconfig.json (limited to 'packages') diff --git a/packages/0x.js/package.json b/packages/0x.js/package.json index c3adb496e..db6e2363e 100644 --- a/packages/0x.js/package.json +++ b/packages/0x.js/package.json @@ -15,7 +15,6 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", "build": "yarn build:all", "build:all": "run-p build:umd:prod build:commonjs", "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*", @@ -25,8 +24,8 @@ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "clean": "shx rm -rf _bundles lib test_temp src/generated_contract_wrappers generated_docs", "build:umd:prod": "NODE_ENV=production webpack", - "build:commonjs": "tsc", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "build:commonjs": "tsc -b", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { diff --git a/packages/0x.js/tsconfig.json b/packages/0x.js/tsconfig.json index e35816553..a96536716 100644 --- a/packages/0x.js/tsconfig.json +++ b/packages/0x.js/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, - "include": ["./src/**/*", "./test/**/*"] + "include": ["./src/**/*"] } diff --git a/packages/0x.js/typedoc-tsconfig.json b/packages/0x.js/typedoc-tsconfig.json new file mode 100644 index 000000000..c9b0af1ae --- /dev/null +++ b/packages/0x.js/typedoc-tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/0x.js/webpack.config.js b/packages/0x.js/webpack.config.js index 982e076ee..1ad0a79ec 100644 --- a/packages/0x.js/webpack.config.js +++ b/packages/0x.js/webpack.config.js @@ -47,8 +47,13 @@ module.exports = { use: [ { loader: 'awesome-typescript-loader', + // tsconfig.json contains some options required for + // project references which do not work with webback. + // We override those options here. query: { declaration: false, + declarationMap: false, + composite: false, }, }, ], diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index 000e8cee0..5b4a2b7fc 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -8,10 +8,9 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", "lint": "tslint --project .", "clean": "shx rm -rf lib", - "build": "tsc", + "build": "tsc -b", "test": "yarn run_mocha", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit", "test:circleci": "yarn test:coverage", diff --git a/packages/abi-gen/tsconfig.json b/packages/abi-gen/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/abi-gen/tsconfig.json +++ b/packages/abi-gen/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/assert/package.json b/packages/assert/package.json index 2dea4b616..29ddb6002 100644 --- a/packages/assert/package.json +++ b/packages/assert/package.json @@ -8,8 +8,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib test_temp", "lint": "tslint --project .", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", diff --git a/packages/assert/tsconfig.json b/packages/assert/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/assert/tsconfig.json +++ b/packages/assert/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/base-contract/package.json b/packages/base-contract/package.json index 33a66c97a..08f8766b5 100644 --- a/packages/base-contract/package.json +++ b/packages/base-contract/package.json @@ -8,8 +8,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib", "test": "yarn run_mocha", "rebuild_and_test": "run-s clean build test", diff --git a/packages/base-contract/tsconfig.json b/packages/base-contract/tsconfig.json index 8b4cd47a2..718e623c7 100644 --- a/packages/base-contract/tsconfig.json +++ b/packages/base-contract/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["src/**/*", "test/**/*"] } diff --git a/packages/connect/package.json b/packages/connect/package.json index 15f537c7d..543852350 100644 --- a/packages/connect/package.json +++ b/packages/connect/package.json @@ -15,8 +15,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib test_temp generated_docs", "copy_test_fixtures": "copyfiles -u 2 './test/fixtures/**/*.json' ./lib/test/fixtures", "lint": "tslint --project .", @@ -26,7 +25,7 @@ "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { diff --git a/packages/connect/tsconfig.json b/packages/connect/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/connect/tsconfig.json +++ b/packages/connect/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/connect/typedoc-tsconfig.json b/packages/connect/typedoc-tsconfig.json new file mode 100644 index 000000000..c9b0af1ae --- /dev/null +++ b/packages/connect/typedoc-tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index a49a81d61..7da839a00 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -11,8 +11,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc", + "build": "yarn pre_build && tsc -b", "pre_build": "run-s update_artifacts_v2_beta update_artifacts_v2 generate_contract_wrappers copy_artifacts", "generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(Exchange|DummyERC20Token|DummyERC721Token|ZRXToken|ERC20Token|ERC721Token|WETH9|ERC20Proxy|ERC721Proxy|Forwarder|OrderValidator).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/contract_wrappers/generated --backend ethers", "lint": "tslint --project . --exclude **/src/contract_wrappers/**/* --exclude **/lib/**/*", @@ -26,7 +25,7 @@ "copy_artifacts": "copyfiles -u 2 './src/artifacts/**/*.json' ./lib/src/artifacts", "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/contract_wrappers/generated src/artifacts generated_docs", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "contracts_v2_beta": "AssetProxyOwner Exchange ERC20Proxy ERC20Token ERC721Proxy ERC721Token WETH9 ZRXToken Forwarder OrderValidator", diff --git a/packages/contract-wrappers/tsconfig.json b/packages/contract-wrappers/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/contract-wrappers/tsconfig.json +++ b/packages/contract-wrappers/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/contract-wrappers/typedoc-tsconfig.json b/packages/contract-wrappers/typedoc-tsconfig.json new file mode 100644 index 000000000..c9b0af1ae --- /dev/null +++ b/packages/contract-wrappers/typedoc-tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 5d2f290ac..d3351e6cf 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -11,8 +11,7 @@ "test": "test" }, "scripts": { - "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc", + "build": "yarn pre_build && tsc -b", "pre_build": "run-s compile copy_artifacts generate_contract_wrappers", "copy_artifacts": "copyfiles -u 4 '../migrations/artifacts/2.0.0/**/*' ./lib/artifacts;", "test": "yarn run_mocha", diff --git a/packages/contracts/test/utils/web3_wrapper.ts b/packages/contracts/test/utils/web3_wrapper.ts index acb3103b7..d1cd3d387 100644 --- a/packages/contracts/test/utils/web3_wrapper.ts +++ b/packages/contracts/test/utils/web3_wrapper.ts @@ -1,5 +1,5 @@ import { devConstants, env, EnvVars, web3Factory } from '@0xproject/dev-utils'; -import { prependSubprovider } from '@0xproject/subproviders'; +import { prependSubprovider, Web3ProviderEngine } from '@0xproject/subproviders'; import { logUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; @@ -47,7 +47,7 @@ const ganacheConfigs = { }; const providerConfigs = testProvider === ProviderType.Ganache ? ganacheConfigs : gethConfigs; -export const provider = web3Factory.getRpcProvider(providerConfigs); +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); diff --git a/packages/contracts/tsconfig.json b/packages/contracts/tsconfig.json index 86b33ede7..5fd4c5331 100644 --- a/packages/contracts/tsconfig.json +++ b/packages/contracts/tsconfig.json @@ -2,13 +2,11 @@ "extends": "../../tsconfig", "compilerOptions": { "outDir": "lib", - "baseUrl": ".", - "declaration": false, - "allowJs": true + "rootDir": "." }, "include": [ "./globals.d.ts", - "./contract_wrappers", + "./generated_contract_wrappers", "./src/**/*", "./utils/**/*", "./test/**/*", diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index d4740d3bd..afe518d10 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -8,8 +8,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "test": "yarn run_mocha", "rebuild_and_test": "run-s clean build test", "test:circleci": "yarn test:coverage", diff --git a/packages/dev-utils/tsconfig.json b/packages/dev-utils/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/dev-utils/tsconfig.json +++ b/packages/dev-utils/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/ethereum-types/package.json b/packages/ethereum-types/package.json index 9e4d287a4..007c4cebe 100644 --- a/packages/ethereum-types/package.json +++ b/packages/ethereum-types/package.json @@ -8,11 +8,10 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib generated_docs", "lint": "tslint --project .", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { diff --git a/packages/ethereum-types/tsconfig.json b/packages/ethereum-types/tsconfig.json index 82a45ea94..9ab22ac8a 100644 --- a/packages/ethereum-types/tsconfig.json +++ b/packages/ethereum-types/tsconfig.json @@ -2,7 +2,8 @@ "extends": "../../tsconfig", "compilerOptions": { "typeRoots": ["../../node_modules/@types"], - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, "include": ["src/**/*"] } diff --git a/packages/ethereum-types/typedoc-tsconfig.json b/packages/ethereum-types/typedoc-tsconfig.json new file mode 100644 index 000000000..f71153ec0 --- /dev/null +++ b/packages/ethereum-types/typedoc-tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "typeRoots": ["../../node_modules/@types"], + "outDir": "lib" + }, + "include": ["src/**/*"] +} diff --git a/packages/fill-scenarios/package.json b/packages/fill-scenarios/package.json index d0cb29df4..60192d03e 100644 --- a/packages/fill-scenarios/package.json +++ b/packages/fill-scenarios/package.json @@ -5,8 +5,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc", + "build": "yarn pre_build && tsc -b", "pre_build": "run-s update_artifacts generate_contract_wrappers", "update_artifacts": "for i in ${npm_package_config_contracts}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json lib/artifacts; done;", "generate_contract_wrappers": "abi-gen --abis 'lib/artifacts/@(Exchange|DummyERC20Token|DummyERC721Token).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", diff --git a/packages/fill-scenarios/tsconfig.json b/packages/fill-scenarios/tsconfig.json index f5f4b37c2..56689eaa3 100644 --- a/packages/fill-scenarios/tsconfig.json +++ b/packages/fill-scenarios/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, "include": ["src/**/*"] } diff --git a/packages/forwarder-helper/package.json b/packages/forwarder-helper/package.json index fccd7ccdd..ca2fa96d9 100644 --- a/packages/forwarder-helper/package.json +++ b/packages/forwarder-helper/package.json @@ -20,7 +20,7 @@ "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts", "manual:postpublish": "yarn build; node ./scripts/postpublish.js", "docs:stage": "node scripts/stage_docs.js", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES", + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES", "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json" }, "config": { @@ -63,7 +63,7 @@ "nyc": "^11.0.1", "shx": "^0.2.2", "tslint": "5.11.0", - "typedoc": "0xProject/typedoc", + "typedoc": "0.12.0", "typescript": "3.0.1" }, "publishConfig": { diff --git a/packages/forwarder-helper/tsconfig.json b/packages/forwarder-helper/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/forwarder-helper/tsconfig.json +++ b/packages/forwarder-helper/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/forwarder-helper/typedoc-tsconfig.json b/packages/forwarder-helper/typedoc-tsconfig.json new file mode 100644 index 000000000..c9b0af1ae --- /dev/null +++ b/packages/forwarder-helper/typedoc-tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/json-schemas/package.json b/packages/json-schemas/package.json index bdd801a19..b0ea37b6e 100644 --- a/packages/json-schemas/package.json +++ b/packages/json-schemas/package.json @@ -8,7 +8,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", + "build": "tsc -b", "lint": "tslint --project .", "test": "yarn run_mocha", "rebuild_and_test": "run-s clean build test", @@ -17,8 +17,7 @@ "test:circleci": "yarn test:coverage", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --exit", "clean": "shx rm -rf lib test_temp generated_docs", - "build": "tsc", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { diff --git a/packages/json-schemas/tsconfig.json b/packages/json-schemas/tsconfig.json index e35816553..96bf8789e 100644 --- a/packages/json-schemas/tsconfig.json +++ b/packages/json-schemas/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, - "include": ["./src/**/*", "./test/**/*"] + "include": ["./src/**/*", "./test/**/*", "./schemas/**/*"] } diff --git a/packages/json-schemas/typedoc-tsconfig.json b/packages/json-schemas/typedoc-tsconfig.json new file mode 100644 index 000000000..c9b0af1ae --- /dev/null +++ b/packages/json-schemas/typedoc-tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index ea251e2fe..4b467716d 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -8,8 +8,7 @@ "description": "Example solidity project using 0x dev tools", "scripts": { "lint": "tslint --project . --exclude **/src/contract_wrappers/**/*", - "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc", + "build": "yarn pre_build && tsc -b", "pre_build": "run-s compile generate_contract_wrappers copy_artifacts", "clean": "shx rm -rf lib artifacts src/contract_wrappers", "copy_artifacts": "copyfiles './artifacts/**/*' './contracts/**/*' ./lib", diff --git a/packages/metacoin/tsconfig.json b/packages/metacoin/tsconfig.json index bc3bd1e94..3065396ff 100644 --- a/packages/metacoin/tsconfig.json +++ b/packages/metacoin/tsconfig.json @@ -1,8 +1,8 @@ { + "extends": "../../tsconfig", "compilerOptions": { "outDir": "lib", - "lib": ["es2017"], - "skipLibCheck": true, + "rootDir": ".", "typeRoots": [ "comment: for building within 0x-monorepo:", "../../node_modules/@0xproject/typescript-typings/types", diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 89cd4207a..bd8451328 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -8,8 +8,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc", + "build": "yarn pre_build && tsc -b", "pre_build": "run-s compile:v2 copy_artifacts generate_contract_wrappers", "copy_artifacts": "copyfiles 'artifacts/**/*' ./lib", "clean": "shx rm -rf lib src/1.0.0/contract_wrappers src/2.0.0/contract_wrappers src/2.0.0-beta-testnet/contract_wrappers artifacts/2.0.0", diff --git a/packages/migrations/tsconfig.json b/packages/migrations/tsconfig.json index f5f4b37c2..56689eaa3 100644 --- a/packages/migrations/tsconfig.json +++ b/packages/migrations/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, "include": ["src/**/*"] } diff --git a/packages/monorepo-scripts/package.json b/packages/monorepo-scripts/package.json index a2f2343b8..f1d0ff29c 100644 --- a/packages/monorepo-scripts/package.json +++ b/packages/monorepo-scripts/package.json @@ -9,8 +9,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "lint": "tslint --project .", "clean": "shx rm -rf lib", "test:publish": "run-s build script:publish", diff --git a/packages/monorepo-scripts/tsconfig.json b/packages/monorepo-scripts/tsconfig.json index 332d3a5e1..c8b1d23e5 100644 --- a/packages/monorepo-scripts/tsconfig.json +++ b/packages/monorepo-scripts/tsconfig.json @@ -2,7 +2,8 @@ "extends": "../../tsconfig", "compilerOptions": { "typeRoots": ["../../node_modules/@types", "node_modules/@types"], - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, "include": ["./src/**/*"] } diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index 77a4142fc..7d2caa0e8 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -8,10 +8,8 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "yarn pre_build && tsc -w", - "build": "run-s pre_build transpile", + "build": "yarn pre_build && tsc -b", "pre_build": "run-s update_artifacts_v2_beta generate_contract_wrappers", - "transpile": "tsc", "generate_contract_wrappers": "abi-gen --abis 'lib/src/artifacts/@(Exchange|IWallet|IValidator|DummyERC20Token|ERC20Proxy|ERC20Token).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", "update_artifacts_v2_beta": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json lib/src/artifacts; done;", "test": "yarn run_mocha", @@ -22,7 +20,7 @@ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "clean": "shx rm -rf lib lib/src/artifacts src/generated_contract_wrappers generated_docs", "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "contracts_v2_beta": "IWallet IValidator Exchange ERC20Proxy ERC20Token DummyERC20Token", diff --git a/packages/order-utils/tsconfig.json b/packages/order-utils/tsconfig.json index 8b4cd47a2..718e623c7 100644 --- a/packages/order-utils/tsconfig.json +++ b/packages/order-utils/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["src/**/*", "test/**/*"] } diff --git a/packages/order-utils/typedoc-tsconfig.json b/packages/order-utils/typedoc-tsconfig.json new file mode 100644 index 000000000..b9c6b36f3 --- /dev/null +++ b/packages/order-utils/typedoc-tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["src/**/*", "test/**/*"] +} diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index 0d5bfd48c..27eeca6fd 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -12,8 +12,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc", + "build": "yarn pre_build && tsc -b", "pre_build": "run-s update_artifacts copy_artifacts generate_contract_wrappers", "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/*", "generate_contract_wrappers": "abi-gen --abis 'src/artifacts/@(Exchange|Token|TokenTransferProxy|EtherToken).json' --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output src/generated_contract_wrappers --backend ethers", @@ -26,7 +25,7 @@ "update_artifacts": "for i in ${npm_package_config_contracts_v2_beta}; do copyfiles -u 4 ../migrations/artifacts/2.0.0-beta-testnet/$i.json src/artifacts; done;", "clean": "shx rm -rf _bundles lib test_temp test/artifacts src/generated_contract_wrappers generated_docs", "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js lib/test/global_hooks.js --timeout 10000 --bail --exit", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "contracts_v2_beta": "AssetProxyOwner ERC20Proxy ERC20Token ERC721Proxy ERC721Token Exchange Forwarder OrderValidator WETH9 ZRXToken", diff --git a/packages/order-watcher/tsconfig.json b/packages/order-watcher/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/order-watcher/tsconfig.json +++ b/packages/order-watcher/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/order-watcher/typedoc-tsconfig.json b/packages/order-watcher/typedoc-tsconfig.json new file mode 100644 index 000000000..c9b0af1ae --- /dev/null +++ b/packages/order-watcher/typedoc-tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/react-docs/package.json b/packages/react-docs/package.json index 9e95e69d0..edd55a9b5 100644 --- a/packages/react-docs/package.json +++ b/packages/react-docs/package.json @@ -9,8 +9,7 @@ "types": "lib/index.d.ts", "scripts": { "lint": "tslint --project .", - "build": "tsc", - "watch_without_deps": "tsc -w", + "build": "tsc -b", "clean": "shx rm -rf lib" }, "author": "Fabio Berger", diff --git a/packages/react-docs/tsconfig.json b/packages/react-docs/tsconfig.json index 82f44a62c..76e2cd027 100644 --- a/packages/react-docs/tsconfig.json +++ b/packages/react-docs/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "./lib/", + "outDir": "lib", + "rootDir": "src", "jsx": "react", - "baseUrl": "./", + "baseUrl": ".", "strictNullChecks": false, "paths": { "*": ["node_modules/@types/*", "*"] diff --git a/packages/react-shared/tsconfig.json b/packages/react-shared/tsconfig.json index 687bd1f4e..5abe0ab4e 100644 --- a/packages/react-shared/tsconfig.json +++ b/packages/react-shared/tsconfig.json @@ -1,9 +1,10 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "./lib/", + "outDir": "lib", + "rootDir": "src", "jsx": "react", - "baseUrl": "./", + "baseUrl": ".", "paths": { "*": ["node_modules/@types/*", "*"] } diff --git a/packages/sol-compiler/package.json b/packages/sol-compiler/package.json index f60edc1f9..eab96fcce 100644 --- a/packages/sol-compiler/package.json +++ b/packages/sol-compiler/package.json @@ -8,8 +8,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc", + "build": "yarn pre_build && tsc -b", "pre_build": "run-s update_contract_fixtures", "update_contract_fixtures": "copyfiles 'test/fixtures/contracts/**/*' ./lib", "test": "yarn run_mocha", @@ -21,7 +20,7 @@ "migrate": "npm run build; node lib/src/cli.js migrate", "lint": "tslint --project .", "test:circleci": "yarn test:coverage", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { diff --git a/packages/sol-compiler/tsconfig.json b/packages/sol-compiler/tsconfig.json index 63cbc75c3..c6ffbb99b 100644 --- a/packages/sol-compiler/tsconfig.json +++ b/packages/sol-compiler/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig", "compilerOptions": { "outDir": "lib", + "rootDir": ".", "strictFunctionTypes": false }, "include": ["./src/**/*", "./test/**/*"] diff --git a/packages/sol-compiler/typedoc-tsconfig.json b/packages/sol-compiler/typedoc-tsconfig.json new file mode 100644 index 000000000..22897c131 --- /dev/null +++ b/packages/sol-compiler/typedoc-tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib", + "strictFunctionTypes": false + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/sol-cov/package.json b/packages/sol-cov/package.json index b8c008b3e..3772d02c5 100644 --- a/packages/sol-cov/package.json +++ b/packages/sol-cov/package.json @@ -8,8 +8,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "yarn pre_build && tsc -w", - "build": "yarn pre_build && tsc", + "build": "yarn pre_build && tsc -b", "pre_build": "run-s copy_test_fixtures", "lint": "tslint --project .", "test": "run-s compile_test run_mocha", @@ -21,7 +20,7 @@ "clean": "shx rm -rf lib test/fixtures/artifacts src/artifacts generated_docs", "copy_test_fixtures": "copyfiles 'test/fixtures/**/*' ./lib", "compile_test": "sol-compiler compile", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { diff --git a/packages/sol-cov/tsconfig.json b/packages/sol-cov/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/sol-cov/tsconfig.json +++ b/packages/sol-cov/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/sol-cov/typedoc-tsconfig.json b/packages/sol-cov/typedoc-tsconfig.json new file mode 100644 index 000000000..c9b0af1ae --- /dev/null +++ b/packages/sol-cov/typedoc-tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/sol-resolver/package.json b/packages/sol-resolver/package.json index f3772a118..7a773ce7c 100644 --- a/packages/sol-resolver/package.json +++ b/packages/sol-resolver/package.json @@ -8,8 +8,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib", "lint": "tslint --project ." }, diff --git a/packages/sol-resolver/tsconfig.json b/packages/sol-resolver/tsconfig.json index f5f4b37c2..56689eaa3 100644 --- a/packages/sol-resolver/tsconfig.json +++ b/packages/sol-resolver/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, "include": ["src/**/*"] } diff --git a/packages/sra-report/package.json b/packages/sra-report/package.json index 91b97dd98..481794d5d 100644 --- a/packages/sra-report/package.json +++ b/packages/sra-report/package.json @@ -8,9 +8,8 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", "clean": "shx rm -rf lib", - "build": "tsc", + "build": "tsc -b", "lint": "tslint --project .", "test:circleci": "yarn test:coverage", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", diff --git a/packages/sra-report/tsconfig.json b/packages/sra-report/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/sra-report/tsconfig.json +++ b/packages/sra-report/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/sra-spec/package.json b/packages/sra-spec/package.json index b560fa77b..f11b1bb5a 100644 --- a/packages/sra-spec/package.json +++ b/packages/sra-spec/package.json @@ -5,8 +5,8 @@ "node": ">=6.12" }, "description": "Standard Relayer API Open API Spec", - "main": "lib/index.js", - "types": "lib/index.d.ts", + "main": "lib/src/index.js", + "types": "lib/src/index.d.ts", "scripts": { "serve": "redoc-cli serve lib/api.json --watch", "watch_without_deps": "run-p build-json:watch serve", @@ -17,10 +17,10 @@ "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", "test:circleci": "yarn test:coverage", "clean": "shx rm -rf lib", - "build": "tsc && yarn copy_md_files && yarn build-json", - "build-json": "ts-node build_scripts/buildJson.ts", + "build": "tsc -b && yarn copy_md_files && yarn build-json", + "build-json": "node ./lib/build_scripts/buildJson", "build-json:watch": "chokidar 'src/**/*' -c 'yarn build-json' ", - "copy_md_files": "copyfiles -u 2 './src/md/**/*.md' ./lib/md", + "copy_md_files": "copyfiles -u 2 './src/md/**/*.md' ./lib/src/md", "deploy-site": "discharge deploy" }, "repository": { @@ -54,7 +54,7 @@ "swagger-cli": "^2.1.1", "ts-node": "^7.0.0", "tslint": "5.11.0", - "typescript": "2.7.1" + "typescript": "3.0.1" }, "publishConfig": { "access": "public" diff --git a/packages/sra-spec/tsconfig.json b/packages/sra-spec/tsconfig.json index e60028885..785ed914d 100644 --- a/packages/sra-spec/tsconfig.json +++ b/packages/sra-spec/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, - "include": ["./src/**/*", "./test/*"] + "include": ["./src/**/*", "./test/*", "./build_scripts/*", "./md/*"] } diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 48c6d5ae9..d9583b357 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -8,8 +8,7 @@ "types": "lib/src/index.d.ts", "license": "Apache-2.0", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib generated_docs", "lint": "tslint --project .", "run_mocha_unit": "mocha --require source-map-support/register --require make-promises-safe lib/test/unit/**/*_test.js --timeout 10000 --bail --exit", @@ -21,7 +20,7 @@ "test:all": "run-s test:unit test:integration", "test:unit": "run-s clean build run_mocha_unit", "test:integration": "run-s clean build run_mocha_integration", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { diff --git a/packages/subproviders/tsconfig.json b/packages/subproviders/tsconfig.json index e35816553..2ee711adc 100644 --- a/packages/subproviders/tsconfig.json +++ b/packages/subproviders/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["./src/**/*", "./test/**/*"] } diff --git a/packages/subproviders/typedoc-tsconfig.json b/packages/subproviders/typedoc-tsconfig.json new file mode 100644 index 000000000..c9b0af1ae --- /dev/null +++ b/packages/subproviders/typedoc-tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["./src/**/*", "./test/**/*"] +} diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index 9c32dde47..2e5e1f30a 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -8,7 +8,6 @@ "description": "A faucet micro-service that dispenses test ERC20 tokens or Ether", "main": "server.js", "scripts": { - "watch_without_deps": "tsc -w", "build": "node ../../node_modules/gulp/bin/gulp.js build", "dev": "node ../../node_modules/gulp/bin/gulp.js run", "start": "node ./server/server.js", diff --git a/packages/testnet-faucets/tsconfig.json b/packages/testnet-faucets/tsconfig.json index d7e89a1e2..4997ce208 100644 --- a/packages/testnet-faucets/tsconfig.json +++ b/packages/testnet-faucets/tsconfig.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig", "compilerOptions": { "outDir": "lib", + "rootDir": "src/ts", "strictPropertyInitialization": false }, "include": ["./src/ts/**/*"] diff --git a/packages/tslint-config/package.json b/packages/tslint-config/package.json index 330314974..0907b43b6 100644 --- a/packages/tslint-config/package.json +++ b/packages/tslint-config/package.json @@ -7,8 +7,7 @@ "description": "Lint rules related to 0xProject for TSLint", "main": "tslint.json", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib", "lint": "tslint --project ." }, diff --git a/packages/tslint-config/tsconfig.json b/packages/tslint-config/tsconfig.json index 1935fedc6..44845cf1f 100644 --- a/packages/tslint-config/tsconfig.json +++ b/packages/tslint-config/tsconfig.json @@ -1,8 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "typeRoots": ["../../node_modules/@types", "node_modules/@types"], - "outDir": "lib" + "outDir": "lib", + "rootDir": "rules" }, "include": ["./rules/**/*"] } diff --git a/packages/types/package.json b/packages/types/package.json index 291452cbb..362c8f639 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -8,8 +8,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib", "lint": "tslint --project ." }, diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index ce916a635..56689eaa3 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -1,8 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "typeRoots": ["../../node_modules/@types", "node_modules/@types"], - "outDir": "lib" + "outDir": "lib", + "rootDir": "src" }, "include": ["src/**/*"] } diff --git a/packages/typescript-typings/package.json b/packages/typescript-typings/package.json index c047a5328..08cf708a6 100644 --- a/packages/typescript-typings/package.json +++ b/packages/typescript-typings/package.json @@ -6,8 +6,7 @@ }, "description": "0x project typescript type definitions", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib" }, "repository": { @@ -32,6 +31,7 @@ }, "devDependencies": { "copyfiles": "^2.0.0", + "typescript": "3.0.1", "shx": "^0.2.2" }, "publishConfig": { diff --git a/packages/typescript-typings/tsconfig.json b/packages/typescript-typings/tsconfig.json index a9a644b17..7f0fe2f7a 100644 --- a/packages/typescript-typings/tsconfig.json +++ b/packages/typescript-typings/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." } } diff --git a/packages/utils/package.json b/packages/utils/package.json index c72fb4c83..d93163e81 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -8,8 +8,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib", "lint": "tslint --project .", "test": "yarn run_mocha", diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index 8b4cd47a2..718e623c7 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["src/**/*", "test/**/*"] } diff --git a/packages/web3-wrapper/package.json b/packages/web3-wrapper/package.json index f84074447..6361fbde7 100644 --- a/packages/web3-wrapper/package.json +++ b/packages/web3-wrapper/package.json @@ -8,8 +8,7 @@ "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "scripts": { - "watch_without_deps": "tsc -w", - "build": "tsc", + "build": "tsc -b", "clean": "shx rm -rf lib generated_docs", "lint": "tslint --project .", "test": "yarn run_mocha", @@ -18,7 +17,7 @@ "run_mocha": "mocha --require source-map-support/register --require make-promises-safe lib/test/**/*_test.js --bail --exit", "test:coverage": "nyc npm run test --all && yarn coverage:report:lcov", "coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info", - "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES" + "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES" }, "config": { "postpublish": { diff --git a/packages/web3-wrapper/tsconfig.json b/packages/web3-wrapper/tsconfig.json index 8b4cd47a2..718e623c7 100644 --- a/packages/web3-wrapper/tsconfig.json +++ b/packages/web3-wrapper/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig", "compilerOptions": { - "outDir": "lib" + "outDir": "lib", + "rootDir": "." }, "include": ["src/**/*", "test/**/*"] } diff --git a/packages/web3-wrapper/typedoc-tsconfig.json b/packages/web3-wrapper/typedoc-tsconfig.json new file mode 100644 index 000000000..b9c6b36f3 --- /dev/null +++ b/packages/web3-wrapper/typedoc-tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../typedoc-tsconfig", + "compilerOptions": { + "outDir": "lib" + }, + "include": ["src/**/*", "test/**/*"] +} diff --git a/packages/website/tsconfig.json b/packages/website/tsconfig.json index 34171b51e..6421cd459 100644 --- a/packages/website/tsconfig.json +++ b/packages/website/tsconfig.json @@ -8,7 +8,12 @@ "allowJs": true, "strictNullChecks": false, "noImplicitThis": false, + // tsconfig.json at the monorepo root contains some options required for + // project references which do not work for website. We override those + // options here. "declaration": false, + "declarationMap": false, + "composite": false, "paths": { "*": ["node_modules/@types/*", "*"] } -- cgit v1.2.3 From 1c3b2b7141138f8da82197dfbdbdbfd76e7780b7 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Wed, 29 Aug 2018 11:39:52 -0700 Subject: Updated readBytes4 to match spec + added unit tests. These are 3.5/3.6 from audit --- .../protocol/AssetProxyOwner/AssetProxyOwner.sol | 13 +++++++++-- .../src/2.0.0/utils/LibBytes/LibBytes.sol | 7 +++++- packages/contracts/test/libraries/lib_bytes.ts | 26 +++++++++++++++++++++- 3 files changed, 42 insertions(+), 4 deletions(-) (limited to 'packages') diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol index 8b7333646..e661f2427 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol @@ -105,11 +105,20 @@ contract AssetProxyOwner is uint256 index ) internal + pure returns (bytes4 result) { - require(b.length >= index + 4); + 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, 32)) + result := mload(add(b, index)) // Solidity does not require us to clean the trailing bytes. // We do it anyway result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000) diff --git a/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol b/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol index 504e950a8..93873cbcc 100644 --- a/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol +++ b/packages/contracts/src/2.0.0/utils/LibBytes/LibBytes.sol @@ -467,8 +467,13 @@ library LibBytes { 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, 32)) + result := mload(add(b, index)) // Solidity does not require us to clean the trailing bytes. // We do it anyway result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000) diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 1c497a226..6fda9dc97 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -41,6 +41,8 @@ describe('LibBytes', () => { const testBytes32B = '0x534877abd8443578526845cdfef020047528759477fedef87346527659aced32'; const testUint256 = new BigNumber(testBytes32, 16); const testUint256B = new BigNumber(testBytes32B, 16); + const testBytes4 = '0xabcdef12'; + const testBytes4B = new BigNumber(testBytes4, 16); let shortData: string; let shortTestBytes: string; let shortTestBytesAsBuffer: Buffer; @@ -462,8 +464,9 @@ describe('LibBytes', () => { // 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 expectContractCallFailed( - libBytes.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, new BigNumber(0)), + libBytes.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, offset), RevertReason.LibBytesGreaterOrEqualTo4LengthRequired, ); }); @@ -472,6 +475,27 @@ describe('LibBytes', () => { 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 expectContractCallFailed( + libBytes.publicReadBytes4.callAsync(testBytes4, badOffset), + RevertReason.LibBytesGreaterOrEqualTo4LengthRequired, + ); + }); }); describe('readBytesWithLength', () => { -- cgit v1.2.3 From 422e5e4dd734ce737bff42fb6a42ef07ad25f4b7 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 29 Aug 2018 11:57:52 -0700 Subject: Apply prettier --- packages/react-shared/src/components/version_drop_down.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'packages') diff --git a/packages/react-shared/src/components/version_drop_down.tsx b/packages/react-shared/src/components/version_drop_down.tsx index e4a2798ab..5ff4bed54 100644 --- a/packages/react-shared/src/components/version_drop_down.tsx +++ b/packages/react-shared/src/components/version_drop_down.tsx @@ -15,10 +15,7 @@ export class VersionDropDown extends React.Component - {this._renderDropDownItems()}
@@ -26,7 +23,11 @@ export class VersionDropDown extends React.Component { - return v{version}; + return ( + + v{version} + + ); }); return items; } -- cgit v1.2.3 From 8c803ab232d094c2f69d3b2d44cae11f153d2d5f Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Wed, 29 Aug 2018 12:25:06 -0700 Subject: Updated comments for ERC20 proxy to clarify how we load the token address from calldata (3.18 from audit) --- .../src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol | 67 +++++++++++++++++++--- .../src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol | 2 + 2 files changed, 60 insertions(+), 9 deletions(-) (limited to 'packages') diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol index 004c3892d..785f3aba9 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol @@ -59,15 +59,64 @@ contract ERC20Proxy is mstore(96, 0) revert(0, 100) } - - /////// Token contract address /////// - // The token address is found as follows: - // * It is stored at offset 4 in `assetData` contents. - // * This is stored at offset 32 from `assetData`. - // * The offset to `assetData` from Params is stored at offset - // 4 in calldata. - // * The offset of Params in calldata is 4. - // So we read location 4 and add 32 + 4 + 4 to it. + + // `transferFrom`. + // The function is marked `external`, so no abi decodeding 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. + + // Asset data itself is encoded as follows: + // + // | Area | Offset | Length | Contents | + // |----------|--------|---------|-------------------------------------| + // | Header | 0 | 4 | function selector | + // | Params | | 1 * 32 | function parameters: | + // | | 4 | 12 + 20 | 1. token address | + + // We construct calldata for the `token.transferFrom` ABI. + // The layout of this calldata is in the table below. + // + // | Area | Offset | Length | Contents | + // |----------|--------|---------|-------------------------------------| + // | Header | 0 | 4 | function selector | + // | Params | | 3 * 32 | function parameters: | + // | | 4 | | 1. from | + // | | 36 | | 2. to | + // | | 68 | | 3. amount | + + /////// Read token address from calldata /////// + // * The token address is stored in `assetData`. + // + // * The "offset to assetData" is stored at offset 4 in the calldata (table 1). + // [assetDataOffsetFromParams = calldataload(4)] + // + // * Notes that the "offset to assetData" is relative to the "Params" area of calldata; + // add 4 bytes to account for the length of the "Header" area (table 1). + // [assetDataOffsetFromHeader = assetDataOffsetFromParams + 4] + // + // * The "token address" is offset 32+4=36 bytes into "assetData" (tables 1 & 2). + // [tokenOffset = assetDataOffsetFromHeader + 36 = calldataload(4) + 4 + 36] let token := calldataload(add(calldataload(4), 40)) /////// Setup Header Area /////// diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol index 9d0bc0f74..caf05b0dd 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol @@ -80,6 +80,8 @@ contract ERC721Proxy is // (*): 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. -- cgit v1.2.3 From b9f7979e91790615c3f1e45c7a3d29d6369e8092 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 28 Aug 2018 21:01:26 -0700 Subject: Replace projects section with relayers --- packages/website/ts/pages/landing/landing.tsx | 82 ++------------------------- 1 file changed, 5 insertions(+), 77 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 78f5fc3c1..5b5bd753c 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -42,73 +42,6 @@ const THROTTLE_TIMEOUT = 100; const WHATS_NEW_TITLE = '18 ideas for 0x relayers in 2018'; const WHATS_NEW_URL = 'https://blog.0xproject.com/18-ideas-for-0x-relayers-in-2018-80a1498b955f'; -const relayersAndDappProjects: Project[] = [ - { - logoFileName: 'ercdex.png', - projectUrl: constants.PROJECT_URL_ERC_DEX, - }, - { - 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: 'dydx.png', - projectUrl: constants.PROJECT_URL_DYDX, - }, - { - logoFileName: 'ethfinex.png', - projectUrl: constants.PROJECT_URL_ETHFINEX, - }, - { - logoFileName: 'melonport.png', - projectUrl: constants.PROJECT_URL_MELONPORT, - }, - { - logoFileName: 'maker.png', - projectUrl: constants.PROJECT_URL_MAKER, - }, - { - logoFileName: 'dharma.png', - projectUrl: constants.PROJECT_URL_DHARMA, - }, - { - logoFileName: 'lendroid.png', - projectUrl: constants.PROJECT_URL_LENDROID, - }, - { - logoFileName: 'district0x.png', - projectUrl: constants.PROJECT_URL_DISTRICT_0X, - }, - { - logoFileName: 'aragon.png', - projectUrl: constants.PROJECT_URL_ARAGON, - }, - { - logoFileName: 'blocknet.png', - projectUrl: constants.PROJECT_URL_BLOCKNET, - }, - { - logoFileName: 'imtoken.png', - projectUrl: constants.PROJECT_URL_IMTOKEN, - }, - { - logoFileName: 'augur.png', - projectUrl: constants.PROJECT_URL_AUGUR, - }, - { - logoFileName: 'anx.png', - projectUrl: constants.PROJECT_URL_OPEN_ANX, - }, -]; - const relayerProjects: Project[] = [ { logoFileName: 'ethfinex.png', @@ -198,20 +131,15 @@ export class Landing extends React.Component { translate={this.props.translate} /> {this._renderHero()} - {this._renderProjects( - relayersAndDappProjects, - this.props.translate.get(Key.ProjectsHeader, Deco.Upper), - colors.projectsGrey, - false, - )} - {this._renderTokenizationSection()} - {this._renderProtocolSection()} {this._renderProjects( relayerProjects, this.props.translate.get(Key.RelayersHeader, Deco.Upper), - colors.heroGrey, + colors.projectsGrey, true, )} + {this._renderTokenizationSection()} + {this._renderProtocolSection()} + {this._renderInfoBoxes()} {this._renderBuildingBlocksSection()} {this._renderUseCases()} @@ -368,7 +296,7 @@ export class Landing extends React.Component { > {this.props.translate.get(Key.FullListPrompt)}{' '} -- cgit v1.2.3 From 557267477e10902e801e18733d551f13c402a6cd Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Tue, 28 Aug 2018 22:00:23 -0700 Subject: Add new header image --- .../website/public/images/landing/0x_homepage.svg | 386 +++++++++++++++++++++ packages/website/ts/pages/landing/landing.tsx | 9 +- 2 files changed, 391 insertions(+), 4 deletions(-) create mode 100644 packages/website/public/images/landing/0x_homepage.svg (limited to 'packages') diff --git a/packages/website/public/images/landing/0x_homepage.svg b/packages/website/public/images/landing/0x_homepage.svg new file mode 100644 index 000000000..061ac8939 --- /dev/null +++ b/packages/website/public/images/landing/0x_homepage.svg @@ -0,0 +1,386 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 5b5bd753c..4833fa8f3 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -151,14 +151,15 @@ export class Landing extends React.Component { private _renderHero(): React.ReactNode { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; const left = 'col lg-col-7 md-col-7 col-12 lg-pl4 md-pl4 sm-pl0 sm-px3 sm-center'; + const flexClassName = isSmallScreen ? 'flex items-center flex-column' : 'flex items-center'; return (
{this._renderWhatsNew()} -
-
- -
+
+ + +
Date: Tue, 28 Aug 2018 22:34:11 -0700 Subject: Update whats new --- packages/website/ts/pages/landing/landing.tsx | 32 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 4833fa8f3..1cc2ee5c0 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -8,6 +8,7 @@ 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 { Text } from 'ts/components/ui/text'; import { Dispatcher } from 'ts/redux/dispatcher'; import { Deco, Key, Language, ScreenWidths, WebsitePaths } from 'ts/types'; import { constants } from 'ts/utils/constants'; @@ -39,7 +40,7 @@ interface Project { } const THROTTLE_TIMEOUT = 100; -const WHATS_NEW_TITLE = '18 ideas for 0x relayers in 2018'; +const WHATS_NEW_TITLE = 'V2 of the 0x Protocol is now live!'; const WHATS_NEW_URL = 'https://blog.0xproject.com/18-ideas-for-0x-relayers-in-2018-80a1498b955f'; const relayerProjects: Project[] = [ @@ -216,19 +217,24 @@ export class Landing extends React.Component { return ( -- cgit v1.2.3 From 6924a2b681b8f6d6c154499f3e5d7879524f89c1 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 29 Aug 2018 10:38:15 -0700 Subject: Update benefits --- packages/website/translations/english.json | 10 +++++----- packages/website/ts/pages/landing/landing.tsx | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'packages') diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index 541c29997..09b118bae 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -19,15 +19,15 @@ "in 0x protocol, orders are transported off-chain, massively reducing gas costs and eliminating blockchain bloat. Relayers help broadcast orders and collect a fee each time they facilitate a trade. Anyone can build a relayer.", "RELAYERS_HEADER": "relayers building on 0x", "BENEFITS_HEADER": "benefits of 0x", - "BENEFIT_ONE_TITLE": "trustless exchange", + "BENEFIT_ONE_TITLE": "many assets", "BENEFIT_ONE_DESCRIPTION": - "built on Ethereum's distributed network with no centralized point of failure and no down time, each trade is settled atomically and without counterparty risk.", - "BENEFIT_TWO_TITLE": "shared liquidity", + "the 0x protocol facilitates the exchange of a growing number of Ethereum-based tokens including currencies, game items, and many more digital assets.", + "BENEFIT_TWO_TITLE": "networked liquidity", "BENEFIT_TWO_DESCRIPTION": "by sharing a standard API, relayers can easily aggregate liquidity pools, creating network effects around liquidity that compound as more relayers come online.", - "BENEFIT_THREE_TITLE": "open source", + "BENEFIT_THREE_TITLE": "exchange everywhere", "BENEFIT_THREE_DESCRIPTION": - "0x is open source, permissionless and free to use. Trade directly with a known counterparty for free or pay a relayer some ZRX tokens to access their liquidity pool.", + "0x allows trade functionality to fade into the background, enabling developers to focus on building while 0x handles the exchange.", "BUILDING_BLOCK_SECTION_HEADER": "a building block for dApps", "BUILDING_BLOCK_SECTION_DESCRIPTION": "0x protocol is a pluggable building block for dApps that require exchange functionality. Join the many developers that are already using 0x in their web applications and smart contracts.", diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 1cc2ee5c0..83484409d 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -138,10 +138,8 @@ export class Landing extends React.Component { colors.projectsGrey, true, )} - {this._renderTokenizationSection()} - {this._renderProtocolSection()} - {this._renderInfoBoxes()} + {this._renderTokenizationSection()} {this._renderBuildingBlocksSection()} {this._renderUseCases()} {this._renderCallToAction()} -- cgit v1.2.3 From 3bc9b309f6ea1889d775da88a06d9ba8b3a67bc9 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 29 Aug 2018 11:26:22 -0700 Subject: Update tokenization section --- packages/website/translations/english.json | 5 ++- packages/website/ts/pages/landing/landing.tsx | 54 ++++++--------------------- packages/website/ts/types.ts | 1 + 3 files changed, 15 insertions(+), 45 deletions(-) (limited to 'packages') diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index 09b118bae..4f3b4aaba 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -9,7 +9,7 @@ "FULL_LIST_LINK": "full list", "TOKENIZED_SECTION_HEADER": "the world's value is becoming tokenized", "TOKENIZED_SECTION_DESCRIPTION": - "the Ethereum blockchain is an open, borderless financial system that represents a wide variety of assets as cryptographic tokens. In the future, most digital assets and goods will be tokenized.", + "0x is the critical infrastructure layer in the emerging financial stack built on a foundation of Ethereum token standards. Developers needing exchange functionality for ERC 20 tokens, ERC 721 tokens, or any new asset type can easily integrate the 0x protocol into their application.", "CURRENCY": "currency", "TRADITIONAL_ASSETS": "traditional assets", "DIGITAL_GOODS": "digital goods", @@ -80,5 +80,6 @@ "DEVELOPERS": "developers", "HOME": "home", "ROCKETCHAT": "rocket.chat", - "TRADE_CALL_TO_ACTION": "trade on 0x" + "TRADE_CALL_TO_ACTION": "trade on 0x", + "OUR_MISSION_AND_VALUES": "our mission & values" } diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 83484409d..08da4da8f 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -335,7 +335,7 @@ export class Landing extends React.Component { > {this.props.translate.get(Key.TokenizedSectionDescription, Deco.Cap)}
-
{this._renderAssetTypes()}
+
{this._renderMissionAndValuesButton()}
{!isSmallScreen && this._renderTokenCloud()} @@ -461,48 +461,16 @@ export class Landing extends React.Component {
); } - private _renderAssetTypes(): React.ReactNode { - const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; - const assetTypes: AssetType[] = [ - { - title: this.props.translate.get(Key.Currency, Deco.Cap), - imageUrl: '/images/landing/currency.png', - }, - { - title: this.props.translate.get(Key.TraditionalAssets, Deco.Cap), - imageUrl: '/images/landing/stocks.png', - style: { - paddingLeft: isSmallScreen ? 41 : 56, - paddingRight: isSmallScreen ? 41 : 56, - }, - }, - { - title: this.props.translate.get(Key.DigitalGoods, Deco.Cap), - imageUrl: '/images/landing/digital_goods.png', - }, - ]; - const assets = _.map(assetTypes, (assetType: AssetType) => { - const style = _.isUndefined(assetType.style) ? {} : assetType.style; - return ( -
-
- -
-
- {assetType.title} -
-
- ); - }); - return assets; + private _renderMissionAndValuesButton(): React.ReactNode { + return ( + + {this.props.translate.get(Key.OurMissionAndValues, Deco.CapWords)} + + ); } private _renderInfoBoxes(): React.ReactNode { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index c637171dd..398a8da11 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -468,6 +468,7 @@ export enum Key { Home = 'HOME', RocketChat = 'ROCKETCHAT', TradeCallToAction = 'TRADE_CALL_TO_ACTION', + OurMissionAndValues = 'OUR_MISSION_AND_VALUES', } export enum SmartContractDocSections { -- cgit v1.2.3 From b1c5f6e8f175aab891b735ed0b4382a787cbbd9b Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Wed, 29 Aug 2018 12:41:25 -0700 Subject: Update use cases section --- packages/website/translations/english.json | 12 ++- packages/website/ts/pages/landing/landing.tsx | 133 ++++++++++++++++---------- packages/website/ts/types.ts | 4 + 3 files changed, 98 insertions(+), 51 deletions(-) (limited to 'packages') diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index 4f3b4aaba..042af251d 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -43,10 +43,10 @@ "decentralized prediction market platforms generate sets of tokens that represent a financial stake in the outcomes of real-world events. 0x allows these tokens to be instantly tradable.", "STABLE_TOKENS": "stable tokens", "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.", + "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.", "DECENTRALIZED_LOANS": "decentralized loans", "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.", + "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.", "FUND_MANAGEMENT": "fund management", "FUND_MANAGEMENT_DESCRIPTION": "Decentralized fund management limits fund managers to investing in pre-agreed upon asset classes. Embedding 0x into fund management smart contracts enables them to enforce these security constraints.", @@ -81,5 +81,11 @@ "HOME": "home", "ROCKETCHAT": "rocket.chat", "TRADE_CALL_TO_ACTION": "trade on 0x", - "OUR_MISSION_AND_VALUES": "our mission & values" + "OUR_MISSION_AND_VALUES": "our mission & values", + "GAMING_AND_COLLECTABLES": "gaming & collectables", + "GAMING_AND_COLLECTABLES_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 to give access and the ability to build marketplaces for NFT trading.", + "ORDER_BOOKS": "order books", + "ORDER_BOOKS_DESCRIPTION": + "there are thousands of decentralized apps that have native utility tokens. 0x provides market makers and professional exchanges an ability to host order books to facilitate the exchange of these assets." } diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 08da4da8f..68984896e 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -32,7 +32,6 @@ interface UseCase { description: string; classNames: string; style?: React.CSSProperties; - projectIconUrls: string[]; } interface Project { logoFileName: string; @@ -140,7 +139,6 @@ export class Landing extends React.Component { )} {this._renderInfoBoxes()} {this._renderTokenizationSection()} - {this._renderBuildingBlocksSection()} {this._renderUseCases()} {this._renderCallToAction()}
@@ -535,53 +533,92 @@ export class Landing extends React.Component {
); } - private _renderUseCases(): React.ReactNode { + private _getUseCases(): UseCase[] { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; - - const useCases: UseCase[] = [ - { - imageUrl: '/images/landing/governance_icon.png', - type: this.props.translate.get(Key.DecentralizedGovernance, Deco.Upper), - description: this.props.translate.get(Key.DecentralizedGovernanceDescription, Deco.Cap), - projectIconUrls: ['/images/landing/aragon.png'], - 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), - projectIconUrls: ['/images/landing/augur.png'], - 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), - projectIconUrls: ['/images/landing/maker.png'], - 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), - projectIconUrls: ['/images/landing/dharma.png', '/images/landing/lendroid.png'], - classNames: 'lg-pr2 md-pr2 lg-col-6 md-col-6', - style: { - width: 291, - float: 'right', - marginTop: !isSmallScreen ? 38 : 0, + 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/fund_management_icon.png', - type: this.props.translate.get(Key.FundManagement, Deco.Upper), - description: this.props.translate.get(Key.FundManagementDescription, Deco.Cap), - projectIconUrls: ['/images/landing/melonport.png'], - classNames: 'lg-pl2 md-pl2 lg-col-6 md-col-6', - style: { width: 291, marginTop: !isSmallScreen ? 38 : 0 }, - }, - ]; - + { + 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 = { @@ -626,7 +663,7 @@ export class Landing extends React.Component { ); }); return ( -
+
{cases}
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 398a8da11..c8789c274 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -436,6 +436,10 @@ export enum Key { DecentralizedLoansDescription = 'DECENTRALIZED_LOANS_DESCRIPTION', FundManagement = 'FUND_MANAGEMENT', FundManagementDescription = 'FUND_MANAGEMENT_DESCRIPTION', + GamingAndCollectables = 'GAMING_AND_COLLECTABLES', + GamingAndCollectablesDescription = 'GAMING_AND_COLLECTABLES_DESCRIPTION', + OrderBooks = 'ORDER_BOOKS', + OrderBooksDescription = 'ORDER_BOOKS_DESCRIPTION', FinalCallToAction = 'FINAL_CALL_TO_ACTION', Documentation = 'DOCUMENTATION', Community = 'COMMUNITY', -- cgit v1.2.3 From 62b93cf2ebf242ea5b432daddc030b24da46421f Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Wed, 29 Aug 2018 13:14:51 -0700 Subject: More tests for LibBytes --- packages/contracts/test/libraries/lib_bytes.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 6fda9dc97..646875f1e 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -42,7 +42,7 @@ describe('LibBytes', () => { const testUint256 = new BigNumber(testBytes32, 16); const testUint256B = new BigNumber(testBytes32B, 16); const testBytes4 = '0xabcdef12'; - const testBytes4B = new BigNumber(testBytes4, 16); + const testByte = '0xab'; let shortData: string; let shortTestBytes: string; let shortTestBytesAsBuffer: Buffer; @@ -108,13 +108,19 @@ describe('LibBytes', () => { RevertReason.LibBytesGreaterThanZeroLengthRequired, ); }); - it('should pop the last byte from the input and return it', async () => { + 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 one', 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', () => { @@ -124,13 +130,20 @@ describe('LibBytes', () => { RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); }); - it('should pop the last 20 bytes from the input and return it', async () => { + it('should pop the last 20 bytes from the input and return it when array holds more than one byte', 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', () => { -- cgit v1.2.3 From 5f1c9cfee503bd3fb53fe12bb21f42f3f7981dc7 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Wed, 29 Aug 2018 13:15:40 -0700 Subject: Reverted syntax used by readBytes4 in AssetProxyOwner to be compatible with Solidity v0.4.10 --- .../src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'packages') diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol index e661f2427..7da3d87e2 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol @@ -105,13 +105,9 @@ contract AssetProxyOwner is uint256 index ) internal - pure returns (bytes4 result) { - require( - b.length >= index + 4, - "GREATER_OR_EQUAL_TO_4_LENGTH_REQUIRED" - ); + require(b.length >= index + 4); // Arrays are prefixed by a 32 byte length field index += 32; -- cgit v1.2.3 From aa833ef074b5492dec876b2991175cbd9eae599c Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Wed, 29 Aug 2018 13:17:13 -0700 Subject: Typos in LibBytes tests --- packages/contracts/test/libraries/lib_bytes.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'packages') diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index 646875f1e..efdfa13a2 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -115,7 +115,7 @@ describe('LibBytes', () => { 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 one', async () => { + 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); @@ -130,7 +130,7 @@ describe('LibBytes', () => { RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); }); - it('should pop the last 20 bytes from the input and return it when array holds more than one byte', async () => { + 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)}`; @@ -318,7 +318,7 @@ describe('LibBytes', () => { 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 () => { + 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]); @@ -493,7 +493,7 @@ describe('LibBytes', () => { 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 () => { + 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]); @@ -583,7 +583,7 @@ describe('LibBytes', () => { }); describe('writeBytesWithLength', () => { - it('should successfully write short, nested array of bytes when it takes up the whole array)', async () => { + 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( @@ -692,7 +692,7 @@ describe('LibBytes', () => { 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 () => { + 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 expectContractCallFailed( -- cgit v1.2.3 From dcb12b6ad6485f987d574ee3b20bf24aaf7a7d40 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 29 Aug 2018 14:05:28 -0700 Subject: Update AssetProxyOwner to 0.4.24 --- .../protocol/AssetProxyOwner/AssetProxyOwner.sol | 49 +++++++--------------- .../TestAssetProxyOwner/TestAssetProxyOwner.sol | 23 +++------- .../contracts/test/multisig/asset_proxy_owner.ts | 19 --------- 3 files changed, 21 insertions(+), 70 deletions(-) (limited to 'packages') diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol index 7da3d87e2..bb02d8489 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol @@ -16,15 +16,18 @@ */ -pragma solidity 0.4.10; +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 => @@ -37,8 +40,14 @@ contract AssetProxyOwner is /// on an approved AssetProxy contract. modifier validRemoveAuthorizedAddressAtIndexTx(uint256 transactionId) { Transaction storage tx = transactions[transactionId]; - require(isAssetProxyRegistered[tx.destination]); - require(readBytes4(tx.data, 0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR); + require( + isAssetProxyRegistered[tx.destination], + "UNREGISTERED_ASSET_PROXY" + ); + require( + tx.data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR, + "INVALID_FUNCTION_SELECTOR" + ); _; } @@ -48,7 +57,7 @@ contract AssetProxyOwner is /// @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. - function AssetProxyOwner( + constructor ( address[] memory _owners, address[] memory _assetProxyContracts, uint256 _required, @@ -74,7 +83,7 @@ contract AssetProxyOwner is notNull(assetProxyContract) { isAssetProxyRegistered[assetProxyContract] = isRegistered; - AssetProxyRegistration(assetProxyContract, isRegistered); + emit AssetProxyRegistration(assetProxyContract, isRegistered); } /// @dev Allows execution of `removeAuthorizedAddressAtIndex` without time lock. @@ -89,36 +98,10 @@ contract AssetProxyOwner is tx.executed = true; // solhint-disable-next-line avoid-call-value if (tx.destination.call.value(tx.value)(tx.data)) - Execution(transactionId); + emit Execution(transactionId); else { - ExecutionFailure(transactionId); + emit ExecutionFailure(transactionId); tx.executed = false; } } - - /// @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 - returns (bytes4 result) - { - require(b.length >= index + 4); - - // 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; - } } diff --git a/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol b/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol index 75e782d43..38ec42a72 100644 --- a/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol +++ b/packages/contracts/src/2.0.0/test/TestAssetProxyOwner/TestAssetProxyOwner.sol @@ -16,7 +16,7 @@ */ -pragma solidity 0.4.10; +pragma solidity 0.4.24; import "../../protocol/AssetProxyOwner/AssetProxyOwner.sol"; @@ -26,7 +26,7 @@ contract TestAssetProxyOwner is AssetProxyOwner { - function TestAssetProxyOwner( + constructor ( address[] memory _owners, address[] memory _assetProxyContracts, uint256 _required, @@ -38,6 +38,7 @@ contract TestAssetProxyOwner is function testValidRemoveAuthorizedAddressAtIndexTx(uint256 id) public + view validRemoveAuthorizedAddressAtIndexTx(id) returns (bool) { @@ -50,23 +51,9 @@ contract TestAssetProxyOwner is /// @return Successful if data is a call to `removeAuthorizedAddressAtIndex`. function isFunctionRemoveAuthorizedAddressAtIndex(bytes memory data) public + pure returns (bool) { - return readBytes4(data, 0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR; - } - - /// @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 - returns (bytes4 result) - { - result = readBytes4(b, index); - return result; + return data.readBytes4(0) == REMOVE_AUTHORIZED_ADDRESS_AT_INDEX_SELECTOR; } } diff --git a/packages/contracts/test/multisig/asset_proxy_owner.ts b/packages/contracts/test/multisig/asset_proxy_owner.ts index 9515941ff..2f626daef 100644 --- a/packages/contracts/test/multisig/asset_proxy_owner.ts +++ b/packages/contracts/test/multisig/asset_proxy_owner.ts @@ -148,25 +148,6 @@ describe('AssetProxyOwner', () => { }); }); - describe('readBytes4', () => { - it('should revert if byte array has a length < 4', async () => { - const byteArrayLessThan4Bytes = '0x010101'; - return expectContractCallFailedWithoutReasonAsync( - testAssetProxyOwner.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, new BigNumber(0)), - ); - }); - it('should return the first 4 bytes of a byte array of arbitrary length', async () => { - const byteArrayLongerThan32Bytes = - '0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'; - const first4Bytes = await testAssetProxyOwner.publicReadBytes4.callAsync( - byteArrayLongerThan32Bytes, - new BigNumber(0), - ); - const expectedFirst4Bytes = byteArrayLongerThan32Bytes.slice(0, 10); - expect(first4Bytes).to.equal(expectedFirst4Bytes); - }); - }); - describe('registerAssetProxy', () => { it('should throw if not called by multisig', async () => { const isRegistered = true; -- cgit v1.2.3 From bf3ab1127d11a7530c1abe8236e149d3d96fd35b Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 29 Aug 2018 14:42:42 -0700 Subject: Remove unused imports --- packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol | 1 - packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol | 1 - .../src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol | 4 +--- 3 files changed, 1 insertion(+), 5 deletions(-) (limited to 'packages') diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol index 785f3aba9..258443bca 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC20Proxy.sol @@ -18,7 +18,6 @@ pragma solidity 0.4.24; -import "../../utils/LibBytes/LibBytes.sol"; import "./MixinAuthorizable.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol index caf05b0dd..65b664b8b 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxy/ERC721Proxy.sol @@ -18,7 +18,6 @@ pragma solidity 0.4.24; -import "../../utils/LibBytes/LibBytes.sol"; import "./MixinAuthorizable.sol"; diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol index 80475e6e3..e90b62f19 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinAssetProxyDispatcher.sol @@ -19,7 +19,6 @@ pragma solidity 0.4.24; import "../../utils/Ownable/Ownable.sol"; -import "../../utils/LibBytes/LibBytes.sol"; import "./mixins/MAssetProxyDispatcher.sol"; import "../AssetProxy/interfaces/IAssetProxy.sol"; @@ -28,7 +27,6 @@ contract MixinAssetProxyDispatcher is Ownable, MAssetProxyDispatcher { - using LibBytes for bytes; // Mapping from Asset Proxy Id's to their respective Asset Proxy mapping (bytes4 => IAssetProxy) public assetProxies; @@ -90,7 +88,7 @@ contract MixinAssetProxyDispatcher is "LENGTH_GREATER_THAN_3_REQUIRED" ); - // Lookup assetProxy + // Lookup assetProxy. We do not use `LibBytes.readBytes4` for gas efficiency reasons. bytes4 assetProxyId; assembly { assetProxyId := and(mload( -- cgit v1.2.3 From d80701c2779512324c7a9bef2a87b6f63239d281 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 29 Aug 2018 15:35:09 -0700 Subject: Fix geth tests --- .../protocol/AssetProxyOwner/AssetProxyOwner.sol | 5 ++- .../contracts/test/exchange/signature_validator.ts | 14 +++---- packages/contracts/test/libraries/lib_bytes.ts | 48 +++++++++++----------- .../contracts/test/multisig/asset_proxy_owner.ts | 26 ++++++++---- .../test/tokens/unlimited_allowance_token.ts | 8 ++-- packages/contracts/test/utils/assertions.ts | 17 +++++++- packages/types/CHANGELOG.json | 9 ++++ packages/types/src/index.ts | 3 ++ 8 files changed, 83 insertions(+), 47 deletions(-) (limited to 'packages') diff --git a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol index bb02d8489..4d00e92d3 100644 --- a/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol +++ b/packages/contracts/src/2.0.0/protocol/AssetProxyOwner/AssetProxyOwner.sol @@ -68,7 +68,10 @@ contract AssetProxyOwner is { for (uint256 i = 0; i < _assetProxyContracts.length; i++) { address assetProxy = _assetProxyContracts[i]; - require(assetProxy != address(0)); + require( + assetProxy != address(0), + "INVALID_ASSET_PROXY" + ); isAssetProxyRegistered[assetProxy] = true; } } diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index da2febfd8..b25483c4b 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -14,7 +14,7 @@ import { ValidatorContract } from '../../generated_contract_wrappers/validator'; import { WalletContract } from '../../generated_contract_wrappers/wallet'; import { addressUtils } from '../utils/address_utils'; import { artifacts } from '../utils/artifacts'; -import { expectContractCallFailed, expectContractCallFailedWithoutReasonAsync } from '../utils/assertions'; +import { expectContractCallFailedAsync, expectContractCallFailedWithoutReasonAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; import { LogDecoder } from '../utils/log_decoder'; @@ -119,7 +119,7 @@ describe('MixinSignatureValidator', () => { it('should revert when signature is empty', async () => { const emptySignature = '0x'; const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - return expectContractCallFailed( + return expectContractCallFailedAsync( signatureValidator.publicIsValidSignature.callAsync( orderHashHex, signedOrder.makerAddress, @@ -133,7 +133,7 @@ describe('MixinSignatureValidator', () => { const unsupportedSignatureType = SignatureType.NSignatureTypes; const unsupportedSignatureHex = '0x' + Buffer.from([unsupportedSignatureType]).toString('hex'); const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - return expectContractCallFailed( + return expectContractCallFailedAsync( signatureValidator.publicIsValidSignature.callAsync( orderHashHex, signedOrder.makerAddress, @@ -146,7 +146,7 @@ describe('MixinSignatureValidator', () => { it('should revert when SignatureType=Illegal', async () => { const unsupportedSignatureHex = '0x' + Buffer.from([SignatureType.Illegal]).toString('hex'); const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - return expectContractCallFailed( + return expectContractCallFailedAsync( signatureValidator.publicIsValidSignature.callAsync( orderHashHex, signedOrder.makerAddress, @@ -173,7 +173,7 @@ describe('MixinSignatureValidator', () => { const signatureBuffer = Buffer.concat([fillerData, signatureType]); const signatureHex = ethUtil.bufferToHex(signatureBuffer); const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - return expectContractCallFailed( + return expectContractCallFailedAsync( signatureValidator.publicIsValidSignature.callAsync( orderHashHex, signedOrder.makerAddress, @@ -339,7 +339,7 @@ describe('MixinSignatureValidator', () => { ethUtil.toBuffer(`0x${SignatureType.Wallet}`), ]); const signatureHex = ethUtil.bufferToHex(signature); - await expectContractCallFailed( + await expectContractCallFailedAsync( signatureValidator.publicIsValidSignature.callAsync( orderHashHex, maliciousWallet.address, @@ -385,7 +385,7 @@ describe('MixinSignatureValidator', () => { const signature = Buffer.concat([validatorAddress, signatureType]); const signatureHex = ethUtil.bufferToHex(signature); const orderHashHex = orderHashUtils.getOrderHashHex(signedOrder); - await expectContractCallFailed( + await expectContractCallFailedAsync( signatureValidator.publicIsValidSignature.callAsync(orderHashHex, signerAddress, signatureHex), RevertReason.ValidatorError, ); diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index efdfa13a2..13640a761 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -9,7 +9,7 @@ import * as _ from 'lodash'; import { TestLibBytesContract } from '../../generated_contract_wrappers/test_lib_bytes'; import { artifacts } from '../utils/artifacts'; -import { expectContractCallFailed } from '../utils/assertions'; +import { expectContractCallFailedAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; import { typeEncodingUtils } from '../utils/type_encoding_utils'; @@ -103,7 +103,7 @@ describe('LibBytes', () => { describe('popLastByte', () => { it('should revert if length is 0', async () => { - return expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicPopLastByte.callAsync(constants.NULL_BYTES), RevertReason.LibBytesGreaterThanZeroLengthRequired, ); @@ -125,7 +125,7 @@ describe('LibBytes', () => { describe('popLast20Bytes', () => { it('should revert if length is less than 20', async () => { - return expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicPopLast20Bytes.callAsync(byteArrayShorterThan20Bytes), RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); @@ -200,7 +200,7 @@ describe('LibBytes', () => { describe('deepCopyBytes', () => { it('should revert if dest is shorter than source', async () => { - return expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicDeepCopyBytes.callAsync(byteArrayShorterThan32Bytes, byteArrayLongerThan32Bytes), RevertReason.LibBytesGreaterOrEqualToSourceBytesLengthRequired, ); @@ -253,7 +253,7 @@ describe('LibBytes', () => { it('should fail if the byte array is too short to hold an address', async () => { const shortByteArray = '0xabcdef'; const offset = new BigNumber(0); - return expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicReadAddress.callAsync(shortByteArray, offset), RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); @@ -261,7 +261,7 @@ describe('LibBytes', () => { 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 expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicReadAddress.callAsync(byteArray, badOffset), RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); @@ -297,7 +297,7 @@ describe('LibBytes', () => { }); it('should fail if the byte array is too short to hold an address', async () => { const offset = new BigNumber(0); - return expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicWriteAddress.callAsync(byteArrayShorterThan20Bytes, offset, testAddress), RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); @@ -305,7 +305,7 @@ describe('LibBytes', () => { 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 expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicWriteAddress.callAsync(byteArray, badOffset, testAddress), RevertReason.LibBytesGreaterOrEqualTo20LengthRequired, ); @@ -329,14 +329,14 @@ describe('LibBytes', () => { }); it('should fail if the byte array is too short to hold a bytes32', async () => { const offset = new BigNumber(0); - return expectContractCallFailed( + 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 expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicReadBytes32.callAsync(testBytes32, badOffset), RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); @@ -372,7 +372,7 @@ describe('LibBytes', () => { }); it('should fail if the byte array is too short to hold a bytes32', async () => { const offset = new BigNumber(0); - return expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicWriteBytes32.callAsync(byteArrayShorterThan32Bytes, offset, testBytes32), RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); @@ -380,7 +380,7 @@ describe('LibBytes', () => { 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 expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicWriteBytes32.callAsync(byteArray, badOffset, testBytes32), RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); @@ -408,7 +408,7 @@ describe('LibBytes', () => { }); it('should fail if the byte array is too short to hold a uint256', async () => { const offset = new BigNumber(0); - return expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicReadUint256.callAsync(byteArrayShorterThan32Bytes, offset), RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); @@ -418,7 +418,7 @@ describe('LibBytes', () => { const testUint256AsBuffer = ethUtil.toBuffer(formattedTestUint256); const byteArray = ethUtil.bufferToHex(testUint256AsBuffer); const badOffset = new BigNumber(testUint256AsBuffer.byteLength); - return expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicReadUint256.callAsync(byteArray, badOffset), RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); @@ -458,7 +458,7 @@ describe('LibBytes', () => { }); it('should fail if the byte array is too short to hold a uint256', async () => { const offset = new BigNumber(0); - return expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicWriteUint256.callAsync(byteArrayShorterThan32Bytes, offset, testUint256), RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); @@ -466,7 +466,7 @@ describe('LibBytes', () => { 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 expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicWriteUint256.callAsync(byteArray, badOffset, testUint256), RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); @@ -478,7 +478,7 @@ describe('LibBytes', () => { it('should revert if byte array has a length < 4', async () => { const byteArrayLessThan4Bytes = '0x010101'; const offset = new BigNumber(0); - return expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicReadBytes4.callAsync(byteArrayLessThan4Bytes, offset), RevertReason.LibBytesGreaterOrEqualTo4LengthRequired, ); @@ -504,7 +504,7 @@ describe('LibBytes', () => { }); 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 expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicReadBytes4.callAsync(testBytes4, badOffset), RevertReason.LibBytesGreaterOrEqualTo4LengthRequired, ); @@ -554,28 +554,28 @@ describe('LibBytes', () => { 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 expectContractCallFailed( + 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 expectContractCallFailed( + 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 expectContractCallFailed( + 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 expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicReadBytesWithLength.callAsync(testBytes32, badOffset), RevertReason.LibBytesGreaterOrEqualTo32LengthRequired, ); @@ -687,7 +687,7 @@ describe('LibBytes', () => { 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 expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, offset, longData), RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired, ); @@ -695,7 +695,7 @@ describe('LibBytes', () => { 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 expectContractCallFailed( + return expectContractCallFailedAsync( libBytes.publicWriteBytesWithLength.callAsync(emptyByteArray, badOffset, shortData), RevertReason.LibBytesGreaterOrEqualToNestedBytesLengthRequired, ); diff --git a/packages/contracts/test/multisig/asset_proxy_owner.ts b/packages/contracts/test/multisig/asset_proxy_owner.ts index 2f626daef..bb2b3b1a3 100644 --- a/packages/contracts/test/multisig/asset_proxy_owner.ts +++ b/packages/contracts/test/multisig/asset_proxy_owner.ts @@ -1,4 +1,5 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; +import { RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import { LogWithDecodedArgs } from 'ethereum-types'; @@ -14,9 +15,11 @@ import { MixinAuthorizableContract } from '../../generated_contract_wrappers/mix import { TestAssetProxyOwnerContract } from '../../generated_contract_wrappers/test_asset_proxy_owner'; import { artifacts } from '../utils/artifacts'; import { - expectContractCallFailedWithoutReasonAsync, - expectContractCreationFailedWithoutReason, + expectContractCallFailedAsync, + expectContractCreationFailedAsync, + expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync, + sendTransactionResult, } from '../utils/assertions'; import { increaseTimeAndMineBlockAsync } from '../utils/block_timestamp'; import { chaiSetup } from '../utils/chai_setup'; @@ -109,8 +112,8 @@ describe('AssetProxyOwner', () => { }); it('should throw if a null address is included in assetProxyContracts', async () => { const assetProxyContractAddresses = [erc20Proxy.address, constants.NULL_ADDRESS]; - return expectContractCreationFailedWithoutReason( - AssetProxyOwnerContract.deployFrom0xArtifactAsync( + return expectContractCreationFailedAsync( + (AssetProxyOwnerContract.deployFrom0xArtifactAsync( artifacts.AssetProxyOwner, provider, txDefaults, @@ -118,7 +121,8 @@ describe('AssetProxyOwner', () => { assetProxyContractAddresses, REQUIRED_APPROVALS, SECONDS_TIME_LOCKED, - ), + ) as any) as sendTransactionResult, + RevertReason.InvalidAssetProxy, ); }); }); @@ -281,8 +285,9 @@ describe('AssetProxyOwner', () => { ); const log = submitTxRes.logs[0] as LogWithDecodedArgs; const txId = log.args.transactionId; - return expectContractCallFailedWithoutReasonAsync( + return expectContractCallFailedAsync( testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(txId), + RevertReason.InvalidFunctionSelector, ); }); @@ -316,8 +321,9 @@ describe('AssetProxyOwner', () => { ); const log = submitTxRes.logs[0] as LogWithDecodedArgs; const txId = log.args.transactionId; - return expectContractCallFailedWithoutReasonAsync( + return expectContractCallFailedAsync( testAssetProxyOwner.testValidRemoveAuthorizedAddressAtIndexTx.callAsync(txId), + RevertReason.UnregisteredAssetProxy, ); }); }); @@ -358,10 +364,11 @@ describe('AssetProxyOwner', () => { await multiSigWrapper.confirmTransactionAsync(txId, owners[1]); - return expectTransactionFailedWithoutReasonAsync( + return expectTransactionFailedAsync( testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, { from: owners[1], }), + RevertReason.UnregisteredAssetProxy, ); }); @@ -380,10 +387,11 @@ describe('AssetProxyOwner', () => { await multiSigWrapper.confirmTransactionAsync(txId, owners[1]); - return expectTransactionFailedWithoutReasonAsync( + return expectTransactionFailedAsync( testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, { from: owners[1], }), + RevertReason.InvalidFunctionSelector, ); }); diff --git a/packages/contracts/test/tokens/unlimited_allowance_token.ts b/packages/contracts/test/tokens/unlimited_allowance_token.ts index f2725b408..63680fe9b 100644 --- a/packages/contracts/test/tokens/unlimited_allowance_token.ts +++ b/packages/contracts/test/tokens/unlimited_allowance_token.ts @@ -5,7 +5,7 @@ import * as chai from 'chai'; import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; import { artifacts } from '../utils/artifacts'; -import { expectContractCallFailed } from '../utils/assertions'; +import { expectContractCallFailedAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper'; @@ -54,7 +54,7 @@ describe('UnlimitedAllowanceToken', () => { it('should throw if owner has insufficient balance', async () => { const ownerBalance = await token.balanceOf.callAsync(owner); const amountToTransfer = ownerBalance.plus(1); - return expectContractCallFailed( + return expectContractCallFailedAsync( token.transfer.callAsync(spender, amountToTransfer, { from: owner }), RevertReason.Erc20InsufficientBalance, ); @@ -93,7 +93,7 @@ describe('UnlimitedAllowanceToken', () => { await token.approve.sendTransactionAsync(spender, amountToTransfer, { from: owner }), constants.AWAIT_TRANSACTION_MINED_MS, ); - return expectContractCallFailed( + return expectContractCallFailedAsync( token.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender, }), @@ -109,7 +109,7 @@ describe('UnlimitedAllowanceToken', () => { const isSpenderAllowanceInsufficient = spenderAllowance.cmp(amountToTransfer) < 0; expect(isSpenderAllowanceInsufficient).to.be.true(); - return expectContractCallFailed( + return expectContractCallFailedAsync( token.transferFrom.callAsync(owner, spender, amountToTransfer, { from: spender, }), diff --git a/packages/contracts/test/utils/assertions.ts b/packages/contracts/test/utils/assertions.ts index 61df800c8..3361a751a 100644 --- a/packages/contracts/test/utils/assertions.ts +++ b/packages/contracts/test/utils/assertions.ts @@ -159,7 +159,7 @@ export async function expectTransactionFailedWithoutReasonAsync(p: sendTransacti * @returns a new Promise which will reject if the conditions are not met and * otherwise resolve with no value. */ -export async function expectContractCallFailed(p: Promise, reason: RevertReason): Promise { +export async function expectContractCallFailedAsync(p: Promise, reason: RevertReason): Promise { return expect(p).to.be.rejectedWith(reason); } @@ -180,7 +180,20 @@ export async function expectContractCallFailedWithoutReasonAsync(p: Promise(p: Promise): Promise { +export async function expectContractCreationFailedAsync( + p: sendTransactionResult, + reason: RevertReason, +): Promise { + 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(p: Promise): Promise { const errMessage = await _getTransactionFailedErrorMessageAsync(); return expect(p).to.be.rejectedWith(errMessage); } diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index e96d2a742..0bd9e3b37 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "1.0.1-rc.7", + "changes": [ + { + "note": "Add AssetProxyOwner revert reasons", + "pr": 1041 + } + ] + }, { "version": "1.0.1-rc.6", "changes": [ diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index d8bffccf9..3011dd87f 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -224,6 +224,9 @@ export enum RevertReason { Erc721InvalidSelector = 'ERC721_INVALID_SELECTOR', WalletError = 'WALLET_ERROR', ValidatorError = 'VALIDATOR_ERROR', + InvalidFunctionSelector = 'INVALID_FUNCTION_SELECTOR', + InvalidAssetProxy = 'INVALID_ASSET_PROXY', + UnregisteredAssetProxy = 'UNREGISTERED_ASSET_PROXY', } export enum StatusCodes { -- cgit v1.2.3 From afa2dd73743398f3973ab7de5a7a0d4c18acc5a5 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 27 Aug 2018 16:34:42 -0700 Subject: Add test for fillOrder and dispatchTransferFrom where maker == taker --- packages/contracts/test/exchange/core.ts | 39 ++++++++++++++++++- packages/contracts/test/exchange/dispatcher.ts | 54 ++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts index 3bb71b58f..acb99eed1 100644 --- a/packages/contracts/test/exchange/core.ts +++ b/packages/contracts/test/exchange/core.ts @@ -8,7 +8,10 @@ import { LogWithDecodedArgs } from 'ethereum-types'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; -import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; +import { + DummyERC20TokenContract, + DummyERC20TokenTransferEventArgs, +} from '../../generated_contract_wrappers/dummy_erc20_token'; import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; import { DummyNoReturnERC20TokenContract } from '../../generated_contract_wrappers/dummy_no_return_erc20_token'; import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; @@ -243,6 +246,40 @@ describe('Exchange core', () => { 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).event === 'Transfer', + ); + expect(transferLogs.length).to.be.equal(2); + expect((transferLogs[0] as LogWithDecodedArgs).address).to.be.equal( + zrxToken.address, + ); + expect((transferLogs[0] as LogWithDecodedArgs).args._from).to.be.equal( + makerAddress, + ); + expect((transferLogs[0] as LogWithDecodedArgs).args._to).to.be.equal( + feeRecipientAddress, + ); + expect( + (transferLogs[0] as LogWithDecodedArgs).args._value, + ).to.be.bignumber.equal(signedOrder.makerFee); + expect((transferLogs[1] as LogWithDecodedArgs).address).to.be.equal( + zrxToken.address, + ); + expect((transferLogs[1] as LogWithDecodedArgs).args._from).to.be.equal( + makerAddress, + ); + expect((transferLogs[1] as LogWithDecodedArgs).args._to).to.be.equal( + feeRecipientAddress, + ); + expect( + (transferLogs[1] as LogWithDecodedArgs).args._value, + ).to.be.bignumber.equal(signedOrder.takerFee); + }); }); describe('Testing exchange of ERC20 tokens with no return values', () => { diff --git a/packages/contracts/test/exchange/dispatcher.ts b/packages/contracts/test/exchange/dispatcher.ts index 81871a680..a8ae897a8 100644 --- a/packages/contracts/test/exchange/dispatcher.ts +++ b/packages/contracts/test/exchange/dispatcher.ts @@ -205,6 +205,60 @@ describe('AssetProxyDispatcher', () => { ); }); + 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); -- cgit v1.2.3 From 86319291e3e5eea7e9fd3ea683664743ae71cd8d Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 29 Aug 2018 14:32:49 -0700 Subject: Update used addresses for authorizable tests --- packages/contracts/test/asset_proxy/authorizable.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/contracts/test/asset_proxy/authorizable.ts b/packages/contracts/test/asset_proxy/authorizable.ts index e99c6cee3..0c0da46b3 100644 --- a/packages/contracts/test/asset_proxy/authorizable.ts +++ b/packages/contracts/test/asset_proxy/authorizable.ts @@ -2,6 +2,7 @@ import { BlockchainLifecycle } from '@0xproject/dev-utils'; import { RevertReason } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; +import * as _ from 'lodash'; import { MixinAuthorizableContract } from '../../generated_contract_wrappers/mixin_authorizable'; import { artifacts } from '../utils/artifacts'; @@ -28,8 +29,7 @@ describe('Authorizable', () => { }); before(async () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); - owner = address = accounts[0]; - notOwner = accounts[1]; + [owner, address, notOwner] = _.slice(accounts, 0, 3); authorizable = await MixinAuthorizableContract.deployFrom0xArtifactAsync( artifacts.MixinAuthorizable, provider, -- cgit v1.2.3 From 14793f30b5538f8d2a9dbe5f32589a8627865322 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 29 Aug 2018 17:07:43 -0700 Subject: Add more proxy tests --- packages/contracts/test/asset_proxy/proxies.ts | 184 +++++++++++++++++++++++-- 1 file changed, 176 insertions(+), 8 deletions(-) (limited to 'packages') diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index 6031e554d..b3cee23c7 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -8,6 +8,7 @@ import * as _ from 'lodash'; import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; import { DummyERC721ReceiverContract } from '../../generated_contract_wrappers/dummy_erc721_receiver'; import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; +import { DummyNoReturnERC20TokenContract } from '../../generated_contract_wrappers/dummy_no_return_erc20_token'; import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy'; import { IAssetProxyContract } from '../../generated_contract_wrappers/i_asset_proxy'; @@ -42,6 +43,7 @@ describe('Asset Transfer Proxies', () => { let erc721Receiver: DummyERC721ReceiverContract; let erc20Proxy: ERC20ProxyContract; let erc721Proxy: ERC721ProxyContract; + let noReturnErc20Token: DummyNoReturnERC20TokenContract; let erc20Wrapper: ERC20Wrapper; let erc721Wrapper: ERC721Wrapper; @@ -91,6 +93,27 @@ describe('Asset Transfer Proxies', () => { 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, + ); }); beforeEach(async () => { await blockchainLifecycle.startAsync(); @@ -141,6 +164,65 @@ describe('Asset Transfer Proxies', () => { ); }); + 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); @@ -189,6 +271,7 @@ describe('Asset Transfer Proxies', () => { }), constants.AWAIT_TRANSACTION_MINED_MS, ); + const erc20Balances = await erc20Wrapper.getBalancesAsync(); // Perform a transfer; expect this to fail. await expectTransactionFailedAsync( web3Wrapper.sendTransactionAsync({ @@ -198,6 +281,43 @@ describe('Asset Transfer Proxies', () => { }), 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 () => { @@ -211,6 +331,7 @@ describe('Asset Transfer Proxies', () => { takerAddress, amount, ); + const erc20Balances = await erc20Wrapper.getBalancesAsync(); await expectTransactionFailedAsync( web3Wrapper.sendTransactionAsync({ to: erc20Proxy.address, @@ -219,6 +340,8 @@ describe('Asset Transfer Proxies', () => { }), RevertReason.SenderNotAuthorized, ); + const newBalances = await erc20Wrapper.getBalancesAsync(); + expect(newBalances).to.deep.equal(erc20Balances); }); }); @@ -247,7 +370,38 @@ describe('Asset Transfer Proxies', () => { const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId); // Verify pre-condition const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId); - expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress); + 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( @@ -274,7 +428,7 @@ describe('Asset Transfer Proxies', () => { const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId); // Verify pre-condition const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId); - expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress); + expect(ownerMakerAsset).to.be.equal(makerAddress); // Perform a transfer from makerAddress to takerAddress const amount = new BigNumber(1); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( @@ -304,7 +458,7 @@ describe('Asset Transfer Proxies', () => { const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId); // Verify pre-condition const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId); - expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress); + expect(ownerMakerAsset).to.be.equal(makerAddress); // Perform a transfer from makerAddress to takerAddress const amount = new BigNumber(0); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( @@ -313,7 +467,7 @@ describe('Asset Transfer Proxies', () => { takerAddress, amount, ); - return expectTransactionFailedAsync( + await expectTransactionFailedAsync( web3Wrapper.sendTransactionAsync({ to: erc721Proxy.address, data, @@ -321,6 +475,8 @@ describe('Asset Transfer Proxies', () => { }), 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 () => { @@ -328,7 +484,7 @@ describe('Asset Transfer Proxies', () => { const encodedAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, erc721MakerTokenId); // Verify pre-condition const ownerMakerAsset = await erc721Token.ownerOf.callAsync(erc721MakerTokenId); - expect(ownerMakerAsset).to.be.bignumber.equal(makerAddress); + expect(ownerMakerAsset).to.be.equal(makerAddress); // Perform a transfer from makerAddress to takerAddress const amount = new BigNumber(500); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( @@ -337,7 +493,7 @@ describe('Asset Transfer Proxies', () => { takerAddress, amount, ); - return expectTransactionFailedAsync( + await expectTransactionFailedAsync( web3Wrapper.sendTransactionAsync({ to: erc721Proxy.address, data, @@ -345,11 +501,16 @@ describe('Asset Transfer Proxies', () => { }), 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, { @@ -365,7 +526,7 @@ describe('Asset Transfer Proxies', () => { takerAddress, amount, ); - return expectTransactionFailedAsync( + await expectTransactionFailedAsync( web3Wrapper.sendTransactionAsync({ to: erc721Proxy.address, data, @@ -373,11 +534,16 @@ describe('Asset Transfer Proxies', () => { }), 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( @@ -386,7 +552,7 @@ describe('Asset Transfer Proxies', () => { takerAddress, amount, ); - return expectTransactionFailedAsync( + await expectTransactionFailedAsync( web3Wrapper.sendTransactionAsync({ to: erc721Proxy.address, data, @@ -394,6 +560,8 @@ describe('Asset Transfer Proxies', () => { }), RevertReason.SenderNotAuthorized, ); + const newOwner = await erc721Token.ownerOf.callAsync(erc721MakerTokenId); + expect(newOwner).to.be.equal(ownerMakerAsset); }); }); -- cgit v1.2.3 From d0f693398074eaa8b08f76d18a594e86ad81b0ae Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Wed, 29 Aug 2018 17:21:20 -0700 Subject: Add tests for token that returns >32 bytes --- packages/contracts/compiler.json | 1 + packages/contracts/package.json | 12 ++-- .../DummyMultipleReturnERC20Token.sol | 70 ++++++++++++++++++++++ packages/contracts/test/asset_proxy/proxies.ts | 53 ++++++++++++++++ packages/contracts/test/utils/artifacts.ts | 2 + 5 files changed, 134 insertions(+), 4 deletions(-) create mode 100644 packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol (limited to 'packages') diff --git a/packages/contracts/compiler.json b/packages/contracts/compiler.json index f66114e87..cdf49dcf6 100644 --- a/packages/contracts/compiler.json +++ b/packages/contracts/compiler.json @@ -23,6 +23,7 @@ "DummyERC20Token", "DummyERC721Receiver", "DummyERC721Token", + "DummyMultipleReturnERC20Token", "DummyNoReturnERC20Token", "ERC20Proxy", "ERC20Token", diff --git a/packages/contracts/package.json b/packages/contracts/package.json index d3351e6cf..283991cee 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -19,11 +19,14 @@ "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", + "run_mocha": + "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit", "compile": "sol-compiler --contracts-dir src", "clean": "shx rm -rf lib generated_contract_wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output generated_contract_wrappers --backend ethers", - "lint": "tslint --project . --exclude **/src/generated_contract_wrappers/**/* --exclude **/lib/**/* && yarn lint-contracts", + "generate_contract_wrappers": + "abi-gen --abis ${npm_package_config_abis} --template ../contract_templates/contract.handlebars --partials '../contract_templates/partials/**/*.handlebars' --output generated_contract_wrappers --backend ethers", + "lint": + "tslint --project . --exclude **/src/generated_contract_wrappers/**/* --exclude **/lib/**/* && yarn lint-contracts", "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", @@ -32,7 +35,8 @@ "lint-contracts": "solhint src/2.0.0/**/**/**/**/*.sol" }, "config": { - "abis": "../migrations/artifacts/2.0.0/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyNoReturnERC20Token|ERC20Proxy|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|InvalidERC721Receiver|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|OrderValidator|ReentrantERC20Token|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestLibs|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|TokenRegistry|Whitelist|WETH9|ZRXToken).json" + "abis": + "../migrations/artifacts/2.0.0/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|ERC20Proxy|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|InvalidERC721Receiver|MixinAuthorizable|MultiSigWallet|MultiSigWalletWithTimeLock|OrderValidator|ReentrantERC20Token|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestLibs|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|TokenRegistry|Whitelist|WETH9|ZRXToken).json" }, "repository": { "type": "git", diff --git a/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol b/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.sol new file mode 100644 index 000000000..8a8aecae8 --- /dev/null +++ b/packages/contracts/src/2.0.0/test/DummyERC20Token/DummyMultipleReturnERC20Token.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 "./DummyERC20Token.sol"; + + +// solhint-disable no-empty-blocks +contract DummyMultipleReturnERC20Token is + DummyERC20Token +{ + + constructor ( + string _name, + string _symbol, + uint256 _decimals, + uint256 _totalSupply + ) + public + DummyERC20Token( + _name, + _symbol, + _decimals, + _totalSupply + ) + {} + + /// @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 + function transferFrom( + address _from, + address _to, + uint256 _value + ) + external + returns (bool) + { + emit Transfer( + _from, + _to, + _value + ); + + // HACK: This contract will not compile if we remove `returns (bool)`, so we manually return 64 bytes (equiavalent to true, true) + assembly { + mstore(0, 1) + mstore(32, 1) + return(0, 64) + } + } +} + diff --git a/packages/contracts/test/asset_proxy/proxies.ts b/packages/contracts/test/asset_proxy/proxies.ts index b3cee23c7..4d70031d1 100644 --- a/packages/contracts/test/asset_proxy/proxies.ts +++ b/packages/contracts/test/asset_proxy/proxies.ts @@ -8,6 +8,7 @@ import * as _ from 'lodash'; import { DummyERC20TokenContract } from '../../generated_contract_wrappers/dummy_erc20_token'; import { DummyERC721ReceiverContract } from '../../generated_contract_wrappers/dummy_erc721_receiver'; import { DummyERC721TokenContract } from '../../generated_contract_wrappers/dummy_erc721_token'; +import { DummyMultipleReturnERC20TokenContract } from '../../generated_contract_wrappers/dummy_multiple_return_erc20_token'; import { DummyNoReturnERC20TokenContract } from '../../generated_contract_wrappers/dummy_no_return_erc20_token'; import { ERC20ProxyContract } from '../../generated_contract_wrappers/erc20_proxy'; import { ERC721ProxyContract } from '../../generated_contract_wrappers/erc721_proxy'; @@ -44,6 +45,7 @@ describe('Asset Transfer Proxies', () => { let erc20Proxy: ERC20ProxyContract; let erc721Proxy: ERC721ProxyContract; let noReturnErc20Token: DummyNoReturnERC20TokenContract; + let multipleReturnErc20Token: DummyMultipleReturnERC20TokenContract; let erc20Wrapper: ERC20Wrapper; let erc721Wrapper: ERC721Wrapper; @@ -114,6 +116,30 @@ describe('Asset Transfer Proxies', () => { ), 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(); @@ -343,6 +369,33 @@ describe('Asset Transfer Proxies', () => { 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 () => { diff --git a/packages/contracts/test/utils/artifacts.ts b/packages/contracts/test/utils/artifacts.ts index 5ddb5cc7f..53f2a4e4e 100644 --- a/packages/contracts/test/utils/artifacts.ts +++ b/packages/contracts/test/utils/artifacts.ts @@ -4,6 +4,7 @@ import * as AssetProxyOwner from '../../artifacts/AssetProxyOwner.json'; import * as DummyERC20Token from '../../artifacts/DummyERC20Token.json'; import * as DummyERC721Receiver from '../../artifacts/DummyERC721Receiver.json'; import * as DummyERC721Token from '../../artifacts/DummyERC721Token.json'; +import * as DummyMultipleReturnERC20Token from '../../artifacts/DummyMultipleReturnERC20Token.json'; import * as DummyNoReturnERC20Token from '../../artifacts/DummyNoReturnERC20Token.json'; import * as ERC20Proxy from '../../artifacts/ERC20Proxy.json'; import * as ERC721Proxy from '../../artifacts/ERC721Proxy.json'; @@ -37,6 +38,7 @@ export const artifacts = { DummyERC20Token: (DummyERC20Token as any) as ContractArtifact, DummyERC721Receiver: (DummyERC721Receiver as any) as ContractArtifact, DummyERC721Token: (DummyERC721Token as any) as ContractArtifact, + DummyMultipleReturnERC20Token: (DummyMultipleReturnERC20Token as any) as ContractArtifact, DummyNoReturnERC20Token: (DummyNoReturnERC20Token as any) as ContractArtifact, ERC20Proxy: (ERC20Proxy as any) as ContractArtifact, ERC721Proxy: (ERC721Proxy as any) as ContractArtifact, -- cgit v1.2.3 From 5d008ee83ead8207c7aa80b249703660be8f7fad Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 30 Aug 2018 11:19:58 -0700 Subject: Update what's new styling --- packages/website/ts/pages/landing/landing.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 68984896e..3d0e6eb62 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -215,19 +215,19 @@ export class Landing extends React.Component {
- + New - + {WHATS_NEW_TITLE} -- cgit v1.2.3 From 038c21324e2ae37f2cd6f1199ee176707cd1fed4 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 30 Aug 2018 11:27:00 -0700 Subject: Make hero image responsive --- packages/website/ts/pages/landing/landing.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 3d0e6eb62..bd861670a 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -8,6 +8,7 @@ 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 { Dispatcher } from 'ts/redux/dispatcher'; import { Deco, Key, Language, ScreenWidths, WebsitePaths } from 'ts/types'; @@ -154,8 +155,8 @@ export class Landing extends React.Component {
{this._renderWhatsNew()}
- - + +
Date: Thu, 30 Aug 2018 11:37:33 -0700 Subject: Add title header to use cases section --- packages/website/translations/english.json | 1 + packages/website/ts/pages/landing/landing.tsx | 25 +++++++++++-------------- packages/website/ts/types.ts | 1 + 3 files changed, 13 insertions(+), 14 deletions(-) (limited to 'packages') diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index 042af251d..6864462c5 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -19,6 +19,7 @@ "in 0x protocol, orders are transported off-chain, massively reducing gas costs and eliminating blockchain bloat. Relayers help broadcast orders and collect a fee each time they facilitate a trade. Anyone can build a relayer.", "RELAYERS_HEADER": "relayers building on 0x", "BENEFITS_HEADER": "benefits of 0x", + "USE_CASES_HEADER": "uses of 0x", "BENEFIT_ONE_TITLE": "many assets", "BENEFIT_ONE_DESCRIPTION": "the 0x protocol facilitates the exchange of a growing number of Ethereum-based tokens including currencies, game items, and many more digital assets.", diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index bd861670a..b32526bba 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -42,6 +42,12 @@ interface Project { const THROTTLE_TIMEOUT = 100; const WHATS_NEW_TITLE = 'V2 of the 0x Protocol is now live!'; const WHATS_NEW_URL = 'https://blog.0xproject.com/18-ideas-for-0x-relayers-in-2018-80a1498b955f'; +const TITLE_STYLE: React.CSSProperties = { + fontFamily: 'Roboto Mono', + color: colors.grey, + fontWeight: 300, + letterSpacing: 3, +}; const relayerProjects: Project[] = [ { @@ -276,16 +282,10 @@ export class Landing extends React.Component {
); }); - const titleStyle: React.CSSProperties = { - fontFamily: 'Roboto Mono', - color: colors.grey, - fontWeight: 300, - letterSpacing: 3, - }; return (
-
+
{title}
{projectList}
@@ -517,15 +517,9 @@ export class Landing extends React.Component {
); }); - const titleStyle: React.CSSProperties = { - fontFamily: 'Roboto Mono', - color: colors.grey, - fontWeight: 300, - letterSpacing: 3, - }; return (
-
+
{this.props.translate.get(Key.BenefitsHeader, Deco.Upper)}
@@ -665,6 +659,9 @@ export class Landing extends React.Component { }); return (
+
+ {this.props.translate.get(Key.UseCasesHeader, Deco.Upper)} +
{cases}
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index c8789c274..6ab17e261 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -415,6 +415,7 @@ export enum Key { OffChainOnChainDescription = 'OFFCHAIN_ONCHAIN_DESCRIPTION', RelayersHeader = 'RELAYERS_HEADER', BenefitsHeader = 'BENEFITS_HEADER', + UseCasesHeader = 'USE_CASES_HEADER', BenefitOneTitle = 'BENEFIT_ONE_TITLE', BenefitOneDescription = 'BENEFIT_ONE_DESCRIPTION', BenefitTwoTitle = 'BENEFIT_TWO_TITLE', -- cgit v1.2.3 From 0368de701fa2443a2537d5ea6cb35bdce1ade638 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 30 Aug 2018 11:44:09 -0700 Subject: Added todo comments for missing items --- packages/website/ts/pages/landing/landing.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index b32526bba..0aa9693a4 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -41,6 +41,7 @@ interface Project { const THROTTLE_TIMEOUT = 100; const WHATS_NEW_TITLE = 'V2 of the 0x Protocol is now live!'; +// TODO: Update this url const WHATS_NEW_URL = 'https://blog.0xproject.com/18-ideas-for-0x-relayers-in-2018-80a1498b955f'; const TITLE_STYLE: React.CSSProperties = { fontFamily: 'Roboto Mono', @@ -496,7 +497,7 @@ export class Landing extends React.Component { { title: this.props.translate.get(Key.BenefitThreeTitle, Deco.Cap), description: this.props.translate.get(Key.BenefitThreeDescription, Deco.Cap), - imageUrl: '/images/landing/open_source.png', + imageUrl: '/images/landing/open_source.png', // TODO: Update this url classNames: 'right', }, ]; -- cgit v1.2.3 From 365890291f80a0580c8306c8aa498e64da7f86be Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 29 Aug 2018 15:02:58 -0700 Subject: Add generic title changes --- packages/website/ts/pages/landing/landing.tsx | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 0aa9693a4..72f6bdc9c 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -173,26 +173,16 @@ export class Landing extends React.Component { lineHeight: '36px', }} > -
{this.props.translate.get(Key.TopHeader, Deco.Cap)} -
-
- {this.props.translate.get(Key.TopTagline)} -
+
-- cgit v1.2.3 From 74d5af34ebf1e4d46a3cb13573d0793579454933 Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 29 Aug 2018 16:33:08 -0700 Subject: Add TypedText component and use it on landing page --- .../types/react-typist/index.d.ts | 1 + packages/website/package.json | 1 + packages/website/ts/components/ui/text.tsx | 2 + packages/website/ts/components/ui/typed_text.tsx | 75 ++++++++++++++++++++++ packages/website/ts/index.tsx | 1 + packages/website/ts/pages/landing/landing.tsx | 32 +++++++++ 6 files changed, 112 insertions(+) create mode 100644 packages/typescript-typings/types/react-typist/index.d.ts create mode 100644 packages/website/ts/components/ui/typed_text.tsx (limited to 'packages') diff --git a/packages/typescript-typings/types/react-typist/index.d.ts b/packages/typescript-typings/types/react-typist/index.d.ts new file mode 100644 index 000000000..692c596a5 --- /dev/null +++ b/packages/typescript-typings/types/react-typist/index.d.ts @@ -0,0 +1 @@ +declare module 'react-typist'; diff --git a/packages/website/package.json b/packages/website/package.json index 3b6754fb3..a7da19c9e 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -52,6 +52,7 @@ "react-router-dom": "^4.1.1", "react-scroll": "0xproject/react-scroll#similar-to-pr-330", "react-tooltip": "^3.2.7", + "react-typist": "^2.0.4", "redux": "^3.6.0", "redux-devtools-extension": "^2.13.2", "semver-sort": "0.0.4", diff --git a/packages/website/ts/components/ui/text.tsx b/packages/website/ts/components/ui/text.tsx index 734483564..cd8f290e3 100644 --- a/packages/website/ts/components/ui/text.tsx +++ b/packages/website/ts/components/ui/text.tsx @@ -20,6 +20,7 @@ export interface TextProps { onClick?: (event: React.MouseEvent) => void; hoverColor?: string; noWrap?: boolean; + display?: string; } const PlainText: React.StatelessComponent = ({ children, className, onClick, Tag }) => ( @@ -41,6 +42,7 @@ export const Text = styled(PlainText)` ${props => (props.onClick ? 'cursor: pointer' : '')}; transition: color 0.5s ease; ${props => (props.noWrap ? 'white-space: nowrap' : '')}; + ${props => (props.display ? `display: ${props.display}` : '')}; &:hover { ${props => (props.onClick ? `color: ${props.hoverColor || darken(0.3, props.fontColor)}` : '')}; } diff --git a/packages/website/ts/components/ui/typed_text.tsx b/packages/website/ts/components/ui/typed_text.tsx new file mode 100644 index 000000000..a59309139 --- /dev/null +++ b/packages/website/ts/components/ui/typed_text.tsx @@ -0,0 +1,75 @@ +import * as _ from 'lodash'; +import { darken } from 'polished'; +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 { + public static defaultProps = { + shouldRepeat: false, + avgKeystrokeDelayMs: 90, + wordDelayMs: 1000, + }; + public state = { + cycleCount: 0, + }; + public render(): React.ReactNode { + const { + textList, + shouldRepeat, + wordDelayMs, + avgKeystrokeDelayMs, + stdKeystrokeDelay, + ...textProps + } = this.props; + const { cycleCount } = this.state; + if (_.isEmpty(textList)) { + return null; + } + const typistChildren: React.ReactNode[] = []; + _.forEach(textList, text => { + typistChildren.push( + + {text} + , + ); + if (wordDelayMs) { + typistChildren.push(); + } + typistChildren.push(); + }); + return ( + + {typistChildren} + + ); + } + private _onTypingDone(): void { + if (this.props.shouldRepeat) { + this.setState({ + cycleCount: this.state.cycleCount + 1, + }); + } + } +} diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index 9e59b00ac..6b709df6a 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -23,6 +23,7 @@ trackedTokenStorage.clearIfRequired(); import 'basscss/css/basscss.css'; import 'less/all.less'; +import 'react-typist/dist/Typist.css'; // We pass modulePromise returning lambda instead of module promise, // cause we only want to import the module when the user navigates to the page. diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 72f6bdc9c..fc4194849 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -10,6 +10,7 @@ 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'; @@ -43,12 +44,26 @@ const THROTTLE_TIMEOUT = 100; const WHATS_NEW_TITLE = 'V2 of the 0x Protocol is now live!'; // TODO: Update this url const WHATS_NEW_URL = 'https://blog.0xproject.com/18-ideas-for-0x-relayers-in-2018-80a1498b955f'; +<<<<<<< HEAD const TITLE_STYLE: React.CSSProperties = { fontFamily: 'Roboto Mono', color: colors.grey, fontWeight: 300, letterSpacing: 3, }; +======= +const ROTATING_LIST = [ + 'tokens', + 'game items', + 'digital art', + 'outcomes', + 'stocks', + 'derivatives', + 'loans', + 'cats', + 'Everything.', +]; +>>>>>>> Add TypedText component and use it on landing page const relayerProjects: Project[] = [ { @@ -176,12 +191,29 @@ export class Landing extends React.Component { {this.props.translate.get(Key.TopHeader, Deco.Cap)} + {this.props.translate.getLanguage() === Language.English && ( + + {' '} + for{' '} + + + )}
-- cgit v1.2.3 From febddcb356de32c29ff45e885a0c202a03e064cf Mon Sep 17 00:00:00 2001 From: fragosti Date: Wed, 29 Aug 2018 16:39:03 -0700 Subject: Remove redundant import --- packages/website/ts/index.tsx | 1 - 1 file changed, 1 deletion(-) (limited to 'packages') diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index 6b709df6a..9e59b00ac 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -23,7 +23,6 @@ trackedTokenStorage.clearIfRequired(); import 'basscss/css/basscss.css'; import 'less/all.less'; -import 'react-typist/dist/Typist.css'; // We pass modulePromise returning lambda instead of module promise, // cause we only want to import the module when the user navigates to the page. -- cgit v1.2.3 From b1f97a27f3b0114ee1d9e648e0365932217c8dc8 Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 30 Aug 2018 11:37:58 -0700 Subject: Final tweaks --- packages/website/ts/components/ui/button.tsx | 1 + packages/website/ts/components/ui/typed_text.tsx | 1 + packages/website/ts/pages/landing/landing.tsx | 26 ++++++++++++++---------- 3 files changed, 17 insertions(+), 11 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/components/ui/button.tsx b/packages/website/ts/components/ui/button.tsx index 2952c8859..75ba7bcff 100644 --- a/packages/website/ts/components/ui/button.tsx +++ b/packages/website/ts/components/ui/button.tsx @@ -96,4 +96,5 @@ export const CallToAction: React.StatelessComponent = ({ CallToAction.defaultProps = { type: 'dark', fontSize: '14px', + padding: '0.9em 1.6em', }; diff --git a/packages/website/ts/components/ui/typed_text.tsx b/packages/website/ts/components/ui/typed_text.tsx index a59309139..2bb2d40b0 100644 --- a/packages/website/ts/components/ui/typed_text.tsx +++ b/packages/website/ts/components/ui/typed_text.tsx @@ -35,6 +35,7 @@ export class TypedText extends React.Component { wordDelayMs, avgKeystrokeDelayMs, stdKeystrokeDelay, + // tslint:disable-next-line ...textProps } = this.props; const { cycleCount } = this.state; diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index fc4194849..5a82576a1 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -61,7 +61,7 @@ const ROTATING_LIST = [ 'derivatives', 'loans', 'cats', - 'Everything.', + 'everything', ]; >>>>>>> Add TypedText component and use it on landing page @@ -170,8 +170,10 @@ export class Landing extends React.Component { } private _renderHero(): React.ReactNode { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; - const left = 'col lg-col-7 md-col-7 col-12 lg-pl4 md-pl4 sm-pl0 sm-px3 sm-center'; - const flexClassName = isSmallScreen ? 'flex items-center flex-column' : 'flex items-center'; + 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 (
@@ -194,7 +196,7 @@ export class Landing extends React.Component { display="inline-block" fontColor={colors.grey300} fontWeight={500} - lineHeight="1.2em" + lineHeight="1.3em" fontSize={isSmallScreen ? '28px' : '36px'} > {this.props.translate.get(Key.TopHeader, Deco.Cap)} @@ -207,7 +209,7 @@ export class Landing extends React.Component { display="inline-block" fontColor={colors.white} fontWeight={700} - lineHeight="1.2em" + lineHeight="1.3em" fontSize={isSmallScreen ? '28px' : '36px'} textList={ROTATING_LIST} shouldRepeat={true} @@ -215,17 +217,19 @@ export class Landing extends React.Component { )} - -
+ + - + {this.props.translate.get(Key.BuildCallToAction, Deco.Cap)} -
-
+ +
- + {this.props.translate.get(Key.TradeCallToAction, Deco.Cap)} -- cgit v1.2.3 From fd5ad69c268ef5411901d8ff24e429a7e0b4f888 Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 30 Aug 2018 11:47:55 -0700 Subject: Add careers page to top bar --- packages/website/ts/components/top_bar/top_bar.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 8580c3a6e..1841d890b 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -238,7 +238,7 @@ export class TopBar extends React.Component { const fullWidthClasses = isExpandedDisplayType ? 'pr4' : ''; const logoUrl = isNightVersion ? '/images/protocol_logo_white.png' : '/images/protocol_logo_black.png'; const menuClasses = `col col-${ - isExpandedDisplayType ? '4' : '5' + isExpandedDisplayType ? '4' : '6' } ${fullWidthClasses} lg-pr0 md-pr2 sm-hide xs-hide`; const menuIconStyle = { fontSize: 25, @@ -301,6 +301,13 @@ export class TopBar extends React.Component { isNightVersion={isNightVersion} isExternal={false} /> + { {this.props.translate.get(Key.About, Deco.Cap)} + + {this.props.translate.get(Key.Careers, Deco.Cap)} + {this.props.translate.get(Key.Blog, Deco.Cap)} -- cgit v1.2.3 From c3361bb86e4b022c65b7dc657827b78efca9be41 Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 30 Aug 2018 11:52:08 -0700 Subject: Remove conflict strings --- packages/website/ts/pages/landing/landing.tsx | 3 --- 1 file changed, 3 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 5a82576a1..c8dc2fc74 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -44,14 +44,12 @@ const THROTTLE_TIMEOUT = 100; const WHATS_NEW_TITLE = 'V2 of the 0x Protocol is now live!'; // TODO: Update this url const WHATS_NEW_URL = 'https://blog.0xproject.com/18-ideas-for-0x-relayers-in-2018-80a1498b955f'; -<<<<<<< HEAD const TITLE_STYLE: React.CSSProperties = { fontFamily: 'Roboto Mono', color: colors.grey, fontWeight: 300, letterSpacing: 3, }; -======= const ROTATING_LIST = [ 'tokens', 'game items', @@ -63,7 +61,6 @@ const ROTATING_LIST = [ 'cats', 'everything', ]; ->>>>>>> Add TypedText component and use it on landing page const relayerProjects: Project[] = [ { -- cgit v1.2.3 From 60f1bcf51f0917607582d6027329fd292c7fc251 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 30 Aug 2018 12:09:54 -0700 Subject: Remove unused render methods in landing page --- packages/website/ts/pages/landing/landing.tsx | 110 -------------------------- 1 file changed, 110 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index c8dc2fc74..d29abf835 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -366,116 +366,6 @@ export class Landing extends React.Component {
); } - private _renderProtocolSection(): React.ReactNode { - const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; - return ( -
-
-
- -
-
-
-
-
{this.props.translate.get(Key.OffChainOrderRelay, Deco.Cap)}
-
{this.props.translate.get(Key.OnChainSettlement, Deco.Cap)}
-
-
- {this.props.translate.get(Key.OffChainOnChainDescription, Deco.Cap)} -
-
-
-
-
- ); - } - private _renderBuildingBlocksSection(): React.ReactNode { - const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; - const descriptionStyle: React.CSSProperties = { - fontFamily: 'Roboto Mono', - lineHeight: isSmallScreen ? 1.5 : 2, - fontWeight: 300, - fontSize: 15, - maxWidth: isSmallScreen ? 375 : 'none', - }; - const callToActionStyle: React.CSSProperties = { - fontFamily: 'Roboto Mono', - fontSize: 15, - fontWeight: 300, - maxWidth: isSmallScreen ? 375 : 441, - }; - return ( -
-
- {isSmallScreen && this._renderBlockChipImage()} -
-
- {this.props.translate.get(Key.BuildingBlockSectionHeader, Deco.Cap)} -
-
- {this.props.translate.get(Key.BuildingBlockSectionDescription, Deco.Cap)} -
-
- {this.props.translate.get(Key.DevToolsPrompt, Deco.Cap)}{' '} - - 0x.js - {' '} - {this.props.translate.get(Key.And)}{' '} - - {this.props.translate.get(Key.SmartContract)} - {' '} - {this.props.translate.get(Key.Docs)} -
-
- {!isSmallScreen && this._renderBlockChipImage()} -
-
- ); - } - private _renderBlockChipImage(): React.ReactNode { - const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; - return ( -
- -
- ); - } private _renderTokenCloud(): React.ReactNode { const isSmallScreen = this.state.screenWidth === ScreenWidths.Sm; return ( -- cgit v1.2.3 From 09b4d5e0e4a7100ab591a8711c10a173fb6ea16c Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Thu, 30 Aug 2018 12:10:24 -0700 Subject: Add cancelOrderInternal, use within batchCancelOrders --- .../2.0.0/protocol/Exchange/MixinExchangeCore.sol | 25 +++++++++++++++------- .../protocol/Exchange/MixinWrapperFunctions.sol | 3 ++- .../protocol/Exchange/mixins/MExchangeCore.sol | 5 +++++ .../ReentrantERC20Token/ReentrantERC20Token.sol | 6 ++++++ packages/contracts/test/utils/constants.ts | 1 + 5 files changed, 31 insertions(+), 9 deletions(-) (limited to 'packages') diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol index ff908917d..11bbe40fb 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinExchangeCore.sol @@ -107,14 +107,7 @@ contract MixinExchangeCore is public nonReentrant { - // Fetch current order status - OrderInfo memory orderInfo = getOrderInfo(order); - - // Validate context - assertValidCancel(order, orderInfo); - - // Perform cancel - updateCancelledState(order, orderInfo.orderHash); + cancelOrderInternal(order); } /// @dev Gets information about an order: status, hash, and amount filled. @@ -236,6 +229,22 @@ contract MixinExchangeCore is 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. diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol index a5459a21e..a149f95c9 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinWrapperFunctions.sol @@ -377,10 +377,11 @@ contract MixinWrapperFunctions is /// @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++) { - cancelOrder(orders[i]); + cancelOrderInternal(orders[i]); } } diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol index d85913e0f..742499568 100644 --- a/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol +++ b/packages/contracts/src/2.0.0/protocol/Exchange/mixins/MExchangeCore.sol @@ -72,6 +72,11 @@ contract MExchangeCore is 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. diff --git a/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol b/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol index 4f4e28302..e3311c703 100644 --- a/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol +++ b/packages/contracts/src/2.0.0/test/ReentrantERC20Token/ReentrantERC20Token.sol @@ -51,6 +51,7 @@ contract ReentrantERC20Token is MARKET_SELL_ORDERS, MATCH_ORDERS, CANCEL_ORDER, + BATCH_CANCEL_ORDERS, CANCEL_ORDERS_UP_TO, SET_SIGNATURE_VALIDATOR_APPROVAL } @@ -150,6 +151,11 @@ contract ReentrantERC20Token is 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, diff --git a/packages/contracts/test/utils/constants.ts b/packages/contracts/test/utils/constants.ts index ee4378d2e..b9ba8ccb9 100644 --- a/packages/contracts/test/utils/constants.ts +++ b/packages/contracts/test/utils/constants.ts @@ -60,6 +60,7 @@ export const constants = { 'MARKET_SELL_ORDERS', 'MATCH_ORDERS', 'CANCEL_ORDER', + 'BATCH_CANCEL_ORDERS', 'CANCEL_ORDERS_UP_TO', 'SET_SIGNATURE_VALIDATOR_APPROVAL', ], -- cgit v1.2.3 From 0be2219bebcf8b33a134c387c1ef9b38416dffbc Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Thu, 30 Aug 2018 12:23:11 -0700 Subject: Test cases for rounding fees in matchOrders --- packages/contracts/test/exchange/match_orders.ts | 94 ++++++++++++++++++++++++ 1 file changed, 94 insertions(+) (limited to 'packages') diff --git a/packages/contracts/test/exchange/match_orders.ts b/packages/contracts/test/exchange/match_orders.ts index 554c456cc..c6e7b494f 100644 --- a/packages/contracts/test/exchange/match_orders.ts +++ b/packages/contracts/test/exchange/match_orders.ts @@ -406,6 +406,100 @@ describe('matchOrders', () => { ); }); + 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({ -- cgit v1.2.3 From e90dbf66f33d7d37ec07803df930a3c955eb4e73 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 30 Aug 2018 12:29:47 -0700 Subject: Add new exchange everywhere graphic --- .../public/images/landing/exchange_everywhere.png | Bin 0 -> 7084 bytes packages/website/ts/pages/landing/landing.tsx | 12 ++++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 packages/website/public/images/landing/exchange_everywhere.png (limited to 'packages') diff --git a/packages/website/public/images/landing/exchange_everywhere.png b/packages/website/public/images/landing/exchange_everywhere.png new file mode 100644 index 000000000..e63093929 Binary files /dev/null and b/packages/website/public/images/landing/exchange_everywhere.png differ diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index d29abf835..e2b4d8f80 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -410,7 +410,7 @@ export class Landing extends React.Component { { title: this.props.translate.get(Key.BenefitThreeTitle, Deco.Cap), description: this.props.translate.get(Key.BenefitThreeDescription, Deco.Cap), - imageUrl: '/images/landing/open_source.png', // TODO: Update this url + imageUrl: '/images/landing/exchange_everywhere.png', classNames: 'right', }, ]; @@ -418,9 +418,13 @@ export class Landing extends React.Component { return (
-
- -
+ + +
{boxContent.title}
-- cgit v1.2.3 From a224ce347e3ee15b7bb3992a3f59d1576b07b46a Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 30 Aug 2018 13:21:07 -0700 Subject: Revert whats new text --- packages/website/ts/pages/landing/landing.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index e2b4d8f80..34f124d8c 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -41,8 +41,7 @@ interface Project { } const THROTTLE_TIMEOUT = 100; -const WHATS_NEW_TITLE = 'V2 of the 0x Protocol is now live!'; -// TODO: Update this url +const WHATS_NEW_TITLE = '18 ideas for 0x relayers in 2018'; const WHATS_NEW_URL = 'https://blog.0xproject.com/18-ideas-for-0x-relayers-in-2018-80a1498b955f'; const TITLE_STYLE: React.CSSProperties = { fontFamily: 'Roboto Mono', -- cgit v1.2.3 From 1d5ef4d0ca4d0c65b6b73c56eb18550840bbc936 Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 30 Aug 2018 13:24:17 -0700 Subject: Fix unused vars for react-shared and website --- packages/contracts/test/exchange/internal.ts | 1 - packages/contracts/test/exchange/signature_validator.ts | 2 +- packages/react-docs/src/docs_info.ts | 1 - packages/react-shared/src/components/anchor_title.tsx | 1 - packages/tslint-config/tslint.json | 1 + packages/website/ts/components/top_bar/top_bar.tsx | 2 +- packages/website/ts/containers/connect_documentation.ts | 2 +- packages/website/ts/containers/contract_wrappers_documentation.ts | 3 +-- packages/website/ts/containers/ethereum_types_documentation.ts | 1 - packages/website/ts/containers/order_utils_documentation.ts | 1 - packages/website/ts/containers/order_watcher_documentation.ts | 1 - packages/website/ts/containers/sol_compiler_documentation.ts | 2 +- packages/website/ts/containers/sol_cov_documentation.ts | 2 +- packages/website/ts/containers/subproviders_documentation.ts | 3 +-- packages/website/ts/containers/web3_wrapper_documentation.ts | 3 +-- packages/website/ts/containers/zero_ex_js_documentation.ts | 3 +-- 16 files changed, 10 insertions(+), 19 deletions(-) (limited to 'packages') diff --git a/packages/contracts/test/exchange/internal.ts b/packages/contracts/test/exchange/internal.ts index dc2c5fbe0..78fe9944b 100644 --- a/packages/contracts/test/exchange/internal.ts +++ b/packages/contracts/test/exchange/internal.ts @@ -7,7 +7,6 @@ import * as _ from 'lodash'; import { TestExchangeInternalsContract } from '../../generated_contract_wrappers/test_exchange_internals'; import { artifacts } from '../utils/artifacts'; import { - getInvalidOpcodeErrorMessageForCallAsync, getRevertReasonOrErrorMessageForSendTransactionAsync, } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; diff --git a/packages/contracts/test/exchange/signature_validator.ts b/packages/contracts/test/exchange/signature_validator.ts index b25483c4b..5cc62e777 100644 --- a/packages/contracts/test/exchange/signature_validator.ts +++ b/packages/contracts/test/exchange/signature_validator.ts @@ -14,7 +14,7 @@ import { ValidatorContract } from '../../generated_contract_wrappers/validator'; import { WalletContract } from '../../generated_contract_wrappers/wallet'; import { addressUtils } from '../utils/address_utils'; import { artifacts } from '../utils/artifacts'; -import { expectContractCallFailedAsync, expectContractCallFailedWithoutReasonAsync } from '../utils/assertions'; +import { expectContractCallFailedAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { constants } from '../utils/constants'; import { LogDecoder } from '../utils/log_decoder'; diff --git a/packages/react-docs/src/docs_info.ts b/packages/react-docs/src/docs_info.ts index f429a34cb..dec44458d 100644 --- a/packages/react-docs/src/docs_info.ts +++ b/packages/react-docs/src/docs_info.ts @@ -1,5 +1,4 @@ import { MenuSubsectionsBySection } from '@0xproject/react-shared'; -import compareVersions = require('compare-versions'); import * as _ from 'lodash'; import { diff --git a/packages/react-shared/src/components/anchor_title.tsx b/packages/react-shared/src/components/anchor_title.tsx index 451ba1729..8f7e4af27 100644 --- a/packages/react-shared/src/components/anchor_title.tsx +++ b/packages/react-shared/src/components/anchor_title.tsx @@ -3,7 +3,6 @@ import { Link as ScrollLink } from 'react-scroll'; import { HeaderSizes, Styles } from '../types'; import { constants } from '../utils/constants'; -import { utils } from '../utils/utils'; const headerSizeToScrollOffset: { [headerSize: string]: number } = { h2: -20, diff --git a/packages/tslint-config/tslint.json b/packages/tslint-config/tslint.json index f207d0709..fd1849dd0 100644 --- a/packages/tslint-config/tslint.json +++ b/packages/tslint-config/tslint.json @@ -76,6 +76,7 @@ "no-unbound-method": true, "no-unnecessary-class": true, "no-unnecessary-type-assertion": true, + "no-unused-variable": true, "no-unsafe-finally": true, "number-literal-format": true, "object-literal-key-quotes": false, diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx index 8580c3a6e..fdfed961c 100644 --- a/packages/website/ts/components/top_bar/top_bar.tsx +++ b/packages/website/ts/components/top_bar/top_bar.tsx @@ -19,7 +19,7 @@ import { TopBarMenuItem } from 'ts/components/top_bar/top_bar_menu_item'; import { Container } from 'ts/components/ui/container'; import { DropDown } from 'ts/components/ui/drop_down'; import { Dispatcher } from 'ts/redux/dispatcher'; -import { Deco, Key, ProviderType, WebsiteLegacyPaths, WebsitePaths } from 'ts/types'; +import { Deco, Key, ProviderType, WebsitePaths } from 'ts/types'; import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; diff --git a/packages/website/ts/containers/connect_documentation.ts b/packages/website/ts/containers/connect_documentation.ts index 90137243c..a728abe2c 100644 --- a/packages/website/ts/containers/connect_documentation.ts +++ b/packages/website/ts/containers/connect_documentation.ts @@ -1,4 +1,4 @@ -import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; +import { DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; import * as React from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; diff --git a/packages/website/ts/containers/contract_wrappers_documentation.ts b/packages/website/ts/containers/contract_wrappers_documentation.ts index fd8599192..1e1735846 100644 --- a/packages/website/ts/containers/contract_wrappers_documentation.ts +++ b/packages/website/ts/containers/contract_wrappers_documentation.ts @@ -1,4 +1,4 @@ -import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; +import { DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; import * as React from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; @@ -6,7 +6,6 @@ import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentatio import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; import { DocPackages } from 'ts/types'; -import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ diff --git a/packages/website/ts/containers/ethereum_types_documentation.ts b/packages/website/ts/containers/ethereum_types_documentation.ts index e0bf9a83e..2b6d6e64d 100644 --- a/packages/website/ts/containers/ethereum_types_documentation.ts +++ b/packages/website/ts/containers/ethereum_types_documentation.ts @@ -6,7 +6,6 @@ import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentatio import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; import { DocPackages } from 'ts/types'; -import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ diff --git a/packages/website/ts/containers/order_utils_documentation.ts b/packages/website/ts/containers/order_utils_documentation.ts index 47ac35268..b54c30a1e 100644 --- a/packages/website/ts/containers/order_utils_documentation.ts +++ b/packages/website/ts/containers/order_utils_documentation.ts @@ -6,7 +6,6 @@ import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentatio import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; import { DocPackages } from 'ts/types'; -import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ diff --git a/packages/website/ts/containers/order_watcher_documentation.ts b/packages/website/ts/containers/order_watcher_documentation.ts index 2fa2a9d61..59a018847 100644 --- a/packages/website/ts/containers/order_watcher_documentation.ts +++ b/packages/website/ts/containers/order_watcher_documentation.ts @@ -6,7 +6,6 @@ import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentatio import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; import { DocPackages } from 'ts/types'; -import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ diff --git a/packages/website/ts/containers/sol_compiler_documentation.ts b/packages/website/ts/containers/sol_compiler_documentation.ts index 7cde68e5c..20f26ed1d 100644 --- a/packages/website/ts/containers/sol_compiler_documentation.ts +++ b/packages/website/ts/containers/sol_compiler_documentation.ts @@ -1,4 +1,4 @@ -import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; +import { DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; import * as React from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; diff --git a/packages/website/ts/containers/sol_cov_documentation.ts b/packages/website/ts/containers/sol_cov_documentation.ts index a457cbc1e..27efd641e 100644 --- a/packages/website/ts/containers/sol_cov_documentation.ts +++ b/packages/website/ts/containers/sol_cov_documentation.ts @@ -1,4 +1,4 @@ -import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; +import { DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; import * as React from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts index 43f06b4ed..28b2e9508 100644 --- a/packages/website/ts/containers/subproviders_documentation.ts +++ b/packages/website/ts/containers/subproviders_documentation.ts @@ -1,4 +1,4 @@ -import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; +import { DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; import * as React from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; @@ -6,7 +6,6 @@ import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentatio import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; import { DocPackages } from 'ts/types'; -import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ diff --git a/packages/website/ts/containers/web3_wrapper_documentation.ts b/packages/website/ts/containers/web3_wrapper_documentation.ts index 13924fde8..dc9d23304 100644 --- a/packages/website/ts/containers/web3_wrapper_documentation.ts +++ b/packages/website/ts/containers/web3_wrapper_documentation.ts @@ -1,4 +1,4 @@ -import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; +import { DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; import * as React from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; @@ -6,7 +6,6 @@ import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentatio import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; import { DocPackages } from 'ts/types'; -import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ diff --git a/packages/website/ts/containers/zero_ex_js_documentation.ts b/packages/website/ts/containers/zero_ex_js_documentation.ts index 367d3e064..922dd3c10 100644 --- a/packages/website/ts/containers/zero_ex_js_documentation.ts +++ b/packages/website/ts/containers/zero_ex_js_documentation.ts @@ -1,4 +1,4 @@ -import { constants as docConstants, DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; +import { DocsInfo, DocsInfoConfig, SupportedDocJson } from '@0xproject/react-docs'; import * as React from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; @@ -6,7 +6,6 @@ import { DocPage as DocPageComponent, DocPageProps } from 'ts/pages/documentatio import { Dispatcher } from 'ts/redux/dispatcher'; import { State } from 'ts/redux/reducer'; import { DocPackages } from 'ts/types'; -import { constants } from 'ts/utils/constants'; import { Translate } from 'ts/utils/translate'; /* tslint:disable:no-var-requires */ -- cgit v1.2.3 From 80b7a7842ca56677a5ead4155587d63153042afc Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 30 Aug 2018 13:47:33 -0700 Subject: run prettier --- packages/contracts/test/exchange/internal.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/contracts/test/exchange/internal.ts b/packages/contracts/test/exchange/internal.ts index 78fe9944b..156e086af 100644 --- a/packages/contracts/test/exchange/internal.ts +++ b/packages/contracts/test/exchange/internal.ts @@ -6,9 +6,7 @@ import * as _ from 'lodash'; import { TestExchangeInternalsContract } from '../../generated_contract_wrappers/test_exchange_internals'; import { artifacts } from '../utils/artifacts'; -import { - getRevertReasonOrErrorMessageForSendTransactionAsync, -} from '../utils/assertions'; +import { getRevertReasonOrErrorMessageForSendTransactionAsync } from '../utils/assertions'; import { chaiSetup } from '../utils/chai_setup'; import { bytes32Values, testCombinatoriallyWithReferenceFuncAsync, uint256Values } from '../utils/combinatorial_utils'; import { constants } from '../utils/constants'; -- cgit v1.2.3 From 2cac431c41fdcd7ee44cd9fb36e24bcac6ced40a Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 30 Aug 2018 13:53:30 -0700 Subject: Final tweaks for landing page --- packages/website/translations/english.json | 2 +- packages/website/ts/pages/landing/landing.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index 6864462c5..9bf09e689 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -19,7 +19,7 @@ "in 0x protocol, orders are transported off-chain, massively reducing gas costs and eliminating blockchain bloat. Relayers help broadcast orders and collect a fee each time they facilitate a trade. Anyone can build a relayer.", "RELAYERS_HEADER": "relayers building on 0x", "BENEFITS_HEADER": "benefits of 0x", - "USE_CASES_HEADER": "uses of 0x", + "USE_CASES_HEADER": "use cases of 0x", "BENEFIT_ONE_TITLE": "many assets", "BENEFIT_ONE_DESCRIPTION": "the 0x protocol facilitates the exchange of a growing number of Ethereum-based tokens including currencies, game items, and many more digital assets.", diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 34f124d8c..85e30a9fa 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -53,7 +53,7 @@ const ROTATING_LIST = [ 'tokens', 'game items', 'digital art', - 'outcomes', + 'futures', 'stocks', 'derivatives', 'loans', -- cgit v1.2.3 From c64f0ba34bfdaccc23cbddb5f21e20f7d2e25668 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 30 Aug 2018 15:26:03 -0700 Subject: Tweaks to benefits and use cases --- packages/website/ts/pages/landing/landing.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'packages') diff --git a/packages/website/ts/pages/landing/landing.tsx b/packages/website/ts/pages/landing/landing.tsx index 85e30a9fa..7dfd9c9df 100644 --- a/packages/website/ts/pages/landing/landing.tsx +++ b/packages/website/ts/pages/landing/landing.tsx @@ -22,6 +22,7 @@ interface BoxContent { description: string; imageUrl: string; classNames: string; + maxWidth: number; } interface AssetType { title: string; @@ -399,18 +400,21 @@ export class Landing extends React.Component { 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) => { @@ -421,7 +425,7 @@ export class Landing extends React.Component {
@@ -565,7 +569,7 @@ export class Landing extends React.Component { lineHeight: 1.5, fontSize: 14, overflow: 'hidden', - height: 104, + height: 124, }} > {useCase.description} -- cgit v1.2.3 From 6432f85eb0d2b0e765e7a699d6ccc951e0bee888 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Thu, 30 Aug 2018 17:14:17 -0700 Subject: Wording change for first benefit --- packages/website/translations/english.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages') diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json index 9bf09e689..9ce458111 100644 --- a/packages/website/translations/english.json +++ b/packages/website/translations/english.json @@ -20,7 +20,7 @@ "RELAYERS_HEADER": "relayers building on 0x", "BENEFITS_HEADER": "benefits of 0x", "USE_CASES_HEADER": "use cases of 0x", - "BENEFIT_ONE_TITLE": "many assets", + "BENEFIT_ONE_TITLE": "any asset", "BENEFIT_ONE_DESCRIPTION": "the 0x protocol facilitates the exchange of a growing number of Ethereum-based tokens including currencies, game items, and many more digital assets.", "BENEFIT_TWO_TITLE": "networked liquidity", -- cgit v1.2.3